Skip to content

Commit ab6388c

Browse files
Vulkan: Fix HDR pipeline init indentation and use sdr_render_pass
Fix indentation of the HDR pipeline initialization block inside vulkan_init_pipelines to use consistent 3-space indentation matching the surrounding code style. Use vk->sdr_render_pass instead of vk->render_pass when restoring pipeline state after the HDR tonemapping readback pipeline setup, to correctly reference the SDR render pass.
1 parent 3c1f2aa commit ab6388c

1 file changed

Lines changed: 39 additions & 39 deletions

File tree

gfx/drivers/vulkan.c

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2663,55 +2663,55 @@ static void vulkan_init_pipelines(vk_t *vk)
26632663
vkDestroyShaderModule(vk->context->device, shader_stages[1].module, NULL);
26642664

26652665
#ifdef VULKAN_HDR_SWAPCHAIN
2666-
if (vk->context->flags & VK_CTX_FLAG_HDR_SUPPORT)
2667-
{
2668-
/* HDR pipeline. */
2669-
blend_attachment.blendEnable = VK_TRUE;
2670-
2671-
blend_attachment.srcColorBlendFactor = VK_BLEND_FACTOR_ONE;
2672-
blend_attachment.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
2666+
if (vk->context->flags & VK_CTX_FLAG_HDR_SUPPORT)
2667+
{
2668+
/* HDR pipeline. */
2669+
blend_attachment.blendEnable = VK_TRUE;
26732670

2674-
/* HDR pipeline. */
2675-
module_info.codeSize = sizeof(hdr_frag);
2676-
module_info.pCode = hdr_frag;
2677-
shader_stages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
2678-
shader_stages[1].pName = "main";
2679-
vkCreateShaderModule(vk->context->device,
2680-
&module_info, NULL, &shader_stages[1].module);
2671+
blend_attachment.srcColorBlendFactor = VK_BLEND_FACTOR_ONE;
2672+
blend_attachment.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
26812673

2682-
pipe.renderPass = vk->render_pass;
2683-
vkCreateGraphicsPipelines(vk->context->device, vk->pipelines.cache,
2684-
1, &pipe, NULL, &vk->pipelines.hdr);
2674+
/* HDR pipeline. */
2675+
module_info.codeSize = sizeof(hdr_frag);
2676+
module_info.pCode = hdr_frag;
2677+
shader_stages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
2678+
shader_stages[1].pName = "main";
2679+
vkCreateShaderModule(vk->context->device,
2680+
&module_info, NULL, &shader_stages[1].module);
26852681

2686-
/* Build display hdr pipelines. */
2687-
for (i = 4; i < 6; i++)
2688-
{
2689-
input_assembly.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
2682+
pipe.renderPass = vk->render_pass;
26902683
vkCreateGraphicsPipelines(vk->context->device, vk->pipelines.cache,
2691-
1, &pipe, NULL, &vk->display.pipelines[i]);
2692-
}
2684+
1, &pipe, NULL, &vk->pipelines.hdr);
26932685

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

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

2699-
module_info.codeSize = sizeof(hdr_tonemap_frag);
2700-
module_info.pCode = hdr_tonemap_frag;
2701-
shader_stages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
2702-
shader_stages[1].pName = "main";
2703-
vkCreateShaderModule(vk->context->device,
2704-
&module_info, NULL, &shader_stages[1].module);
2696+
/* HDR->SDR tonemapping readback pipeline. */
2697+
blend_attachment.blendEnable = VK_FALSE;
27052698

2706-
pipe.renderPass = vk->readback_render_pass;
2707-
vkCreateGraphicsPipelines(vk->context->device, vk->pipelines.cache,
2708-
1, &pipe, NULL, &vk->pipelines.hdr_to_sdr);
2699+
module_info.codeSize = sizeof(hdr_tonemap_frag);
2700+
module_info.pCode = hdr_tonemap_frag;
2701+
shader_stages[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
2702+
shader_stages[1].pName = "main";
2703+
vkCreateShaderModule(vk->context->device,
2704+
&module_info, NULL, &shader_stages[1].module);
27092705

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

2712-
pipe.renderPass = vk->render_pass;
2713-
blend_attachment.blendEnable = VK_TRUE;
2714-
}
2710+
vkDestroyShaderModule(vk->context->device, shader_stages[1].module, NULL);
2711+
2712+
pipe.renderPass = vk->sdr_render_pass;
2713+
blend_attachment.blendEnable = VK_TRUE;
2714+
}
27152715
#endif /* VULKAN_HDR_SWAPCHAIN */
27162716

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

0 commit comments

Comments
 (0)