1
Fork 0

Properly enable alpha blending when needed

This commit is contained in:
Joshua Goins 2022-10-05 23:09:11 -04:00
parent 5a5f31b2f6
commit aecea750f7

View file

@ -480,6 +480,16 @@ static std::tuple<VkPipeline, VkPipelineLayout, VkDescriptorSetLayout> gfx_vulka
VkPipelineColorBlendAttachmentState color_blend_attachment = {};
color_blend_attachment.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
if(uses_alpha) {
color_blend_attachment.blendEnable = VK_TRUE;
color_blend_attachment.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
color_blend_attachment.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
color_blend_attachment.colorBlendOp = VK_BLEND_OP_ADD;
color_blend_attachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
color_blend_attachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
color_blend_attachment.alphaBlendOp = VK_BLEND_OP_ADD;
}
VkPipelineColorBlendStateCreateInfo color_blending = {};
color_blending.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
color_blending.attachmentCount = 1;
@ -1471,6 +1481,7 @@ static void gfx_vulkan_renderer_set_scissor(int x, int y, int width, int height)
}
static void gfx_vulkan_renderer_set_use_alpha(bool use_alpha) {
}
static void gfx_vulkan_renderer_unload_shader(struct ShaderProgram *old_prg) {