diff --git a/include/QF/Vulkan/qf_vid.h b/include/QF/Vulkan/qf_vid.h index f2d9bf0ec..b01000d06 100644 --- a/include/QF/Vulkan/qf_vid.h +++ b/include/QF/Vulkan/qf_vid.h @@ -38,9 +38,9 @@ //FIXME location typedef enum { QFV_passDepth, // geometry + QFV_passTranslucent, // geometry QFV_passGBuffer, // geometry QFV_passLighting, // single quad - QFV_passTranslucent, // geometry QFV_passCompose, // single quad QFV_NumPasses diff --git a/libs/video/renderer/vulkan/deferred.plist b/libs/video/renderer/vulkan/deferred.plist index 229c24c10..d956a5792 100644 --- a/libs/video/renderer/vulkan/deferred.plist +++ b/libs/video/renderer/vulkan/deferred.plist @@ -329,7 +329,21 @@ layout = depth_stencil_attachment_optimal; }; }, - { // 1 g-buffer generation + { // 1 translucent + pipelineBindPoint = graphics; + colorAttachments = ( + { // translucent + attachment = 6; + layout = color_attachment_optimal; + }, + ); + depthStencilAttachment = { + attachment = 0; + layout = depth_stencil_read_only_optimal; + }; + preserveAttachments = (1, 2, 3, 4, 5); + }, + { // 2 g-buffer generation pipelineBindPoint = graphics; colorAttachments = ( { // color @@ -351,11 +365,11 @@ ); depthStencilAttachment = { attachment = 0; - layout = depth_stencil_attachment_optimal; + layout = depth_stencil_read_only_optimal; }; preserveAttachments = (6); }, - { // 2 lighting + { // 3 lighting pipelineBindPoint = graphics; inputAttachments = ( { // depth @@ -387,16 +401,6 @@ ); preserveAttachments = (6); }, - { // 3 translucent - pipelineBindPoint = graphics; - colorAttachments = ( - { // translucent - attachment = 6; - layout = color_attachment_optimal; - }, - ); - preserveAttachments = (0, 1, 2, 3, 4, 5); - }, { // 4 compose pipelineBindPoint = graphics; inputAttachments = ( @@ -421,7 +425,7 @@ dependencies = ( { srcSubpass = 0; // depth - dstSubpass = 1; // g-buffer + dstSubpass = 1; // translucent srcStageMask = color_attachment_output; dstStageMask = fragment_shader; srcAccessMask = color_attachment_write; @@ -429,8 +433,8 @@ dependencyFlags = by_region; }, { - srcSubpass = 1; // g-buffer - dstSubpass = 2; // lighting + srcSubpass = 0; // depth + dstSubpass = 2; // g-buffer srcStageMask = color_attachment_output; dstStageMask = fragment_shader; srcAccessMask = color_attachment_write; @@ -438,7 +442,16 @@ dependencyFlags = by_region; }, { - srcSubpass = 2; // lighting + srcSubpass = 2; // g-buffer + dstSubpass = 3; // lighting + srcStageMask = color_attachment_output; + dstStageMask = fragment_shader; + srcAccessMask = color_attachment_write; + dstAccessMask = shader_read; + dependencyFlags = by_region; + }, + { + srcSubpass = 3; // lighting dstSubpass = 4; // compose srcStageMask = color_attachment_output; dstStageMask = fragment_shader; @@ -447,7 +460,7 @@ dependencyFlags = by_region; }, { - srcSubpass = 3; // translucent + srcSubpass = 1; // translucent dstSubpass = 4; // compose srcStageMask = color_attachment_output; dstStageMask = fragment_shader; diff --git a/libs/video/renderer/vulkan/qfpipeline.plist b/libs/video/renderer/vulkan/qfpipeline.plist index 54bc0f9af..97bcc9251 100644 --- a/libs/video/renderer/vulkan/qfpipeline.plist +++ b/libs/video/renderer/vulkan/qfpipeline.plist @@ -534,7 +534,7 @@ //renderPass = renderpass; }; alias_gbuf = { - subpass = 1; + subpass = 2; stages = ( { stage = vertex; @@ -604,7 +604,7 @@ //renderPass = renderpass; }; bsp_gbuf = { - subpass = 1; + subpass = 2; stages = ( { stage = vertex; @@ -653,7 +653,7 @@ //renderPass = renderpass; }; bsp_skysheet = { - subpass = 3; + subpass = 1; stages = ( { stage = vertex; @@ -690,7 +690,7 @@ //renderPass = renderpass; }; twod = { - subpass = 3; + subpass = 1; stages = ( { stage = vertex; @@ -708,7 +708,7 @@ viewport = $properties.viewport; rasterization = $properties.rasterization.counter_cw_cull_back; multisample = $properties.multisample; - depthStencil = $properties.depthStencil.test_and_write; + depthStencil = $properties.depthStencil.test_only; colorBlend = { logicOpEnable = false; attachments = ($properties.attachmentBlendOp.alpha_blend); @@ -720,7 +720,7 @@ //renderPass = renderpass; }; lighting = { - subpass = 2; + subpass = 3; stages = ( { stage = vertex; diff --git a/libs/video/renderer/vulkan/vulkan_alias.c b/libs/video/renderer/vulkan/vulkan_alias.c index 25a2d9d13..c2581e773 100644 --- a/libs/video/renderer/vulkan/vulkan_alias.c +++ b/libs/video/renderer/vulkan/vulkan_alias.c @@ -70,6 +70,12 @@ static const char *alias_pass_names[] = { "translucent", }; +static QFV_Subpass subpass_map[] = { + QFV_passDepth, // QFV_aliasDepth + QFV_passGBuffer, // QFV_aliasGBuffer + QFV_passTranslucent, // QFV_aliasTranslucent +}; + static void emit_commands (VkCommandBuffer cmd, int pose1, int pose2, qfv_alias_skin_t *skin, @@ -174,7 +180,7 @@ alias_begin_subpass (QFV_AliasSubpass subpass, VkPipeline pipeline, dfunc->vkResetCommandBuffer (cmd, 0); VkCommandBufferInheritanceInfo inherit = { VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, 0, - ctx->renderpass, subpass, + ctx->renderpass, subpass_map[subpass], cframe->framebuffer, 0, 0, 0, };