Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 39 additions & 39 deletions gfx/drivers/vulkan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2663,55 +2663,55 @@ static void vulkan_init_pipelines(vk_t *vk)
vkDestroyShaderModule(vk->context->device, shader_stages[1].module, NULL);

#ifdef VULKAN_HDR_SWAPCHAIN
if (vk->context->flags & VK_CTX_FLAG_HDR_SUPPORT)
{
/* HDR pipeline. */
blend_attachment.blendEnable = VK_TRUE;

blend_attachment.srcColorBlendFactor = VK_BLEND_FACTOR_ONE;
blend_attachment.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
if (vk->context->flags & VK_CTX_FLAG_HDR_SUPPORT)
{
/* HDR pipeline. */
blend_attachment.blendEnable = VK_TRUE;

/* HDR pipeline. */
module_info.codeSize = sizeof(hdr_frag);
module_info.pCode = hdr_frag;
shader_stages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
shader_stages[1].pName = "main";
vkCreateShaderModule(vk->context->device,
&module_info, NULL, &shader_stages[1].module);
blend_attachment.srcColorBlendFactor = VK_BLEND_FACTOR_ONE;
blend_attachment.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;

pipe.renderPass = vk->render_pass;
vkCreateGraphicsPipelines(vk->context->device, vk->pipelines.cache,
1, &pipe, NULL, &vk->pipelines.hdr);
/* HDR pipeline. */
module_info.codeSize = sizeof(hdr_frag);
module_info.pCode = hdr_frag;
shader_stages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
shader_stages[1].pName = "main";
vkCreateShaderModule(vk->context->device,
&module_info, NULL, &shader_stages[1].module);

/* Build display hdr pipelines. */
for (i = 4; i < 6; i++)
{
input_assembly.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
pipe.renderPass = vk->render_pass;
vkCreateGraphicsPipelines(vk->context->device, vk->pipelines.cache,
1, &pipe, NULL, &vk->display.pipelines[i]);
}
1, &pipe, NULL, &vk->pipelines.hdr);

vkDestroyShaderModule(vk->context->device, shader_stages[1].module, NULL);
/* Build display hdr pipelines. */
for (i = 4; i < 6; i++)
{
input_assembly.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
vkCreateGraphicsPipelines(vk->context->device, vk->pipelines.cache,
1, &pipe, NULL, &vk->display.pipelines[i]);
}

/* HDR->SDR tonemapping readback pipeline. */
blend_attachment.blendEnable = VK_FALSE;
vkDestroyShaderModule(vk->context->device, shader_stages[1].module, NULL);

module_info.codeSize = sizeof(hdr_tonemap_frag);
module_info.pCode = hdr_tonemap_frag;
shader_stages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
shader_stages[1].pName = "main";
vkCreateShaderModule(vk->context->device,
&module_info, NULL, &shader_stages[1].module);
/* HDR->SDR tonemapping readback pipeline. */
blend_attachment.blendEnable = VK_FALSE;

pipe.renderPass = vk->readback_render_pass;
vkCreateGraphicsPipelines(vk->context->device, vk->pipelines.cache,
1, &pipe, NULL, &vk->pipelines.hdr_to_sdr);
module_info.codeSize = sizeof(hdr_tonemap_frag);
module_info.pCode = hdr_tonemap_frag;
shader_stages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
shader_stages[1].pName = "main";
vkCreateShaderModule(vk->context->device,
&module_info, NULL, &shader_stages[1].module);

vkDestroyShaderModule(vk->context->device, shader_stages[1].module, NULL);
pipe.renderPass = vk->readback_render_pass;
vkCreateGraphicsPipelines(vk->context->device, vk->pipelines.cache,
1, &pipe, NULL, &vk->pipelines.hdr_to_sdr);

pipe.renderPass = vk->render_pass;
blend_attachment.blendEnable = VK_TRUE;
}
vkDestroyShaderModule(vk->context->device, shader_stages[1].module, NULL);

pipe.renderPass = vk->sdr_render_pass;
blend_attachment.blendEnable = VK_TRUE;
}
#endif /* VULKAN_HDR_SWAPCHAIN */

vkDestroyShaderModule(vk->context->device, shader_stages[0].module, NULL);
Expand Down
Loading