From 45bcb3168456a0a7aa9b1f36890698bbc9cd7349 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 12 Mar 2023 14:48:14 +0900 Subject: [PATCH] [vulkan] Use bare dictionaries for spec files Every time I created a new file from scratch, I always forgot the enclosing {}. Now I will probably include them by accident :P --- libs/video/renderer/vulkan/pl_output.plist | 494 ++-- libs/video/renderer/vulkan/pl_quake_def.plist | 2384 ++++++++--------- libs/video/renderer/vulkan/rp_defcube.plist | 648 +++-- libs/video/renderer/vulkan/rp_deferred.plist | 626 +++-- libs/video/renderer/vulkan/rp_forward.plist | 382 ++- libs/video/renderer/vulkan/rp_main_def.plist | 2 - libs/video/renderer/vulkan/rp_output.plist | 94 +- libs/video/renderer/vulkan/rp_shadow.plist | 100 +- libs/video/renderer/vulkan/vkparse.c | 2 +- 9 files changed, 2358 insertions(+), 2374 deletions(-) diff --git a/libs/video/renderer/vulkan/pl_output.plist b/libs/video/renderer/vulkan/pl_output.plist index ab3b2e029..a9a6198f2 100644 --- a/libs/video/renderer/vulkan/pl_output.plist +++ b/libs/video/renderer/vulkan/pl_output.plist @@ -1,260 +1,258 @@ -{ - samplers = { - linear = { - magFilter = linear; - minFilter = linear; - mipmapMode = linear; - addressModeU = clamp_to_edge; - addressModeV = clamp_to_edge; - addressModeW = clamp_to_edge; - mipLodBias = 0; - anisotropyEnable = false; - maxAnisotropy = 0; - compareEnable = false; - compareOp = always; - minLod = 0; - maxLod = 0; - borderColor = float_transparent_black; - unnormalizedCoordinates = false; - }; +samplers = { + linear = { + magFilter = linear; + minFilter = linear; + mipmapMode = linear; + addressModeU = clamp_to_edge; + addressModeV = clamp_to_edge; + addressModeW = clamp_to_edge; + mipLodBias = 0; + anisotropyEnable = false; + maxAnisotropy = 0; + compareEnable = false; + compareOp = always; + minLod = 0; + maxLod = 0; + borderColor = float_transparent_black; + unnormalizedCoordinates = false; }; - descriptorPools = { - output_pool = { - flags = 0; - maxSets = "$frames.size * 2z"; - bindings = ( - { - type = combined_image_sampler; - descriptorCount = "$frames.size * 2z"; - }, - ); - }; - }; - setLayouts = { - matrix_set = { - bindings = ( - { - binding = 0; - descriptorType = uniform_buffer; - descriptorCount = 1; - stageFlags = vertex|geometry|fragment; - }, - ); - }; - output_set = { - bindings = ( - { - binding = 0; - descriptorType = combined_image_sampler; - descriptorCount = 1; - stageFlags = fragment; - }, - ); - }; - }; - pipelineLayouts = { - output_layout = { - setLayouts = (matrix_set, output_set); - }; - waterwarp_layout = { - @inherit = $properties.pipelineLayouts.output_layout; - pushConstantRanges = ( - { - stageFlags = fragment; - offset = 0; - size = "4"; - } - ); - }; - fisheye_layout = { - @inherit = $properties.pipelineLayouts.output_layout; - pushConstantRanges = ( - { - stageFlags = fragment; - offset = 0; - size = "2 * 4"; - } - ); - }; - }; - - depthStencil = { - disable = { - depthTestEnable = false; - depthWriteEnable = false; - depthCompareOp = less_or_equal; - depthBoundsTestEnable = false; - stencilTestEnable = false; - }; - }; - - inputAssembly = { - }; - - vertexInput = { - index_only = { - bindings = (); - attributes = (); - }; - }; - - rasterization = { - cw_cull_back = { - depthClampEnable = false; - rasterizerDiscardEnable = false; - polygonMode = fill; - cullMode = back; - frontFace = clockwise; - depthBiasEnable = false; - lineWidth = 1; - }; - counter_cw_cull_back = { - depthClampEnable = false; - rasterizerDiscardEnable = false; - polygonMode = fill; - cullMode = back; - frontFace = counter_clockwise; - depthBiasEnable = false; - lineWidth = 1; - }; - }; - - multisample = { - rasterizationSamples = $msaaSamples; - sampleShadingEnable = false; - minSampleShading = 0.5f; - alphaToCoverageEnable = false; - alphaToOneEnable = false; - }; - - viewport = { - viewports = ( +}; +descriptorPools = { + output_pool = { + flags = 0; + maxSets = "$frames.size * 2z"; + bindings = ( { - x = 0; y = 0; - width = 640; height = 480; - minDepth = 0; maxDepth = 1; - } - ); - scissors = ( - { - offset = { x = 0; y = 0 }; - extent = { width = 640; height = 480; }; + type = combined_image_sampler; + descriptorCount = "$frames.size * 2z"; }, ); }; - - attachmentBlendOp = { - disabled = { - blendEnable = false; - srcColorBlendFactor = src_alpha; - dstColorBlendFactor = one_minus_src_alpha; - colorBlendOp = add; - srcAlphaBlendFactor = src_alpha; - dstAlphaBlendFactor = one_minus_src_alpha; - alphaBlendOp = add; - colorWriteMask = r|g|b|a; - }; - alpha_blend = { - blendEnable = true; - srcColorBlendFactor = one; - dstColorBlendFactor = one_minus_src_alpha; - colorBlendOp = add; - srcAlphaBlendFactor = one; - dstAlphaBlendFactor = one_minus_src_alpha; - alphaBlendOp = add; - colorWriteMask = r|g|b|a; - }; +}; +setLayouts = { + matrix_set = { + bindings = ( + { + binding = 0; + descriptorType = uniform_buffer; + descriptorCount = 1; + stageFlags = vertex|geometry|fragment; + }, + ); }; + output_set = { + bindings = ( + { + binding = 0; + descriptorType = combined_image_sampler; + descriptorCount = 1; + stageFlags = fragment; + }, + ); + }; +}; +pipelineLayouts = { + output_layout = { + setLayouts = (matrix_set, output_set); + }; + waterwarp_layout = { + @inherit = $properties.pipelineLayouts.output_layout; + pushConstantRanges = ( + { + stageFlags = fragment; + offset = 0; + size = "4"; + } + ); + }; + fisheye_layout = { + @inherit = $properties.pipelineLayouts.output_layout; + pushConstantRanges = ( + { + stageFlags = fragment; + offset = 0; + size = "2 * 4"; + } + ); + }; +}; - fstriangle = { - vertexStage = { - stage = vertex; - name = main; - module = $builtin/fstriangle.vert; - }; - vertexStageST = { - stage = vertex; - name = main; - module = $builtin/fstrianglest.vert; - }; - vertexInput = { - bindings = (); - attributes = (); - }; - inputAssembly = { - topology = triangle_list; - primitiveRestartEnable = false; - }; +depthStencil = { + disable = { + depthTestEnable = false; + depthWriteEnable = false; + depthCompareOp = less_or_equal; + depthBoundsTestEnable = false; + stencilTestEnable = false; + }; +}; + +inputAssembly = { +}; + +vertexInput = { + index_only = { + bindings = (); + attributes = (); + }; +}; + +rasterization = { + cw_cull_back = { + depthClampEnable = false; + rasterizerDiscardEnable = false; + polygonMode = fill; + cullMode = back; + frontFace = clockwise; + depthBiasEnable = false; + lineWidth = 1; + }; + counter_cw_cull_back = { + depthClampEnable = false; + rasterizerDiscardEnable = false; + polygonMode = fill; + cullMode = back; + frontFace = counter_clockwise; + depthBiasEnable = false; + lineWidth = 1; + }; +}; + +multisample = { + rasterizationSamples = $msaaSamples; + sampleShadingEnable = false; + minSampleShading = 0.5f; + alphaToCoverageEnable = false; + alphaToOneEnable = false; +}; + +viewport = { + viewports = ( + { + x = 0; y = 0; + width = 640; height = 480; + minDepth = 0; maxDepth = 1; + } + ); + scissors = ( + { + offset = { x = 0; y = 0 }; + extent = { width = 640; height = 480; }; + }, + ); +}; + +attachmentBlendOp = { + disabled = { + blendEnable = false; + srcColorBlendFactor = src_alpha; + dstColorBlendFactor = one_minus_src_alpha; + colorBlendOp = add; + srcAlphaBlendFactor = src_alpha; + dstAlphaBlendFactor = one_minus_src_alpha; + alphaBlendOp = add; + colorWriteMask = r|g|b|a; + }; + alpha_blend = { + blendEnable = true; + srcColorBlendFactor = one; + dstColorBlendFactor = one_minus_src_alpha; + colorBlendOp = add; + srcAlphaBlendFactor = one; + dstAlphaBlendFactor = one_minus_src_alpha; + alphaBlendOp = add; + colorWriteMask = r|g|b|a; + }; +}; + +fstriangle = { + vertexStage = { + stage = vertex; + name = main; + module = $builtin/fstriangle.vert; + }; + vertexStageST = { + stage = vertex; + name = main; + module = $builtin/fstrianglest.vert; + }; + vertexInput = { + bindings = (); + attributes = (); + }; + inputAssembly = { + topology = triangle_list; + primitiveRestartEnable = false; + }; + colorBlend = { + logicOpEnable = false; + attachments = ($properties.attachmentBlendOp.disabled); + }; +}; + +pipelines = { + base = { + viewport = $properties.viewport; + rasterization = $properties.rasterization.counter_cw_cull_back; + multisample = $properties.multisample; + depthStencil = $properties.depthStencil.disable; colorBlend = { logicOpEnable = false; - attachments = ($properties.attachmentBlendOp.disabled); + attachments = ( + $properties.attachmentBlendOp.disabled, + $properties.attachmentBlendOp.disabled, + $properties.attachmentBlendOp.disabled, + $properties.attachmentBlendOp.disabled, + ); }; + dynamic = { + dynamicState = ( viewport, scissor ); + }; + renderPass = output; }; - - pipelines = { - base = { - viewport = $properties.viewport; - rasterization = $properties.rasterization.counter_cw_cull_back; - multisample = $properties.multisample; - depthStencil = $properties.depthStencil.disable; - colorBlend = { - logicOpEnable = false; - attachments = ( - $properties.attachmentBlendOp.disabled, - $properties.attachmentBlendOp.disabled, - $properties.attachmentBlendOp.disabled, - $properties.attachmentBlendOp.disabled, - ); - }; - dynamic = { - dynamicState = ( viewport, scissor ); - }; - renderPass = output; - }; - output_base = { - @inherit = $properties.pipelines.base; - vertexInput = $properties.fstriangle.vertexInput; - inputAssembly = $properties.fstriangle.inputAssembly; - colorBlend = $properties.fstriangle.colorBlend; - }; - output = { - @inherit = $properties.pipelines.output_base; - subpass = 0; - stages = ( - $properties.fstriangle.vertexStage, - { - stage = fragment; - name = main; - module = $builtin/output.frag; - }, - ); - layout = output_layout; - }; - waterwarp = { - @inherit = $properties.pipelines.output_base; - subpass = 0; - stages = ( - $properties.fstriangle.vertexStageST, - { - stage = fragment; - name = main; - module = $builtin/waterwarp.frag; - }, - ); - layout = waterwarp_layout; - }; - fisheye = { - @inherit = $properties.pipelines.output_base; - subpass = 0; - stages = ( - $properties.fstriangle.vertexStageST, - { - stage = fragment; - name = main; - module = $builtin/fisheye.frag; - }, - ); - layout = fisheye_layout; - }; + output_base = { + @inherit = $properties.pipelines.base; + vertexInput = $properties.fstriangle.vertexInput; + inputAssembly = $properties.fstriangle.inputAssembly; + colorBlend = $properties.fstriangle.colorBlend; }; -} + output = { + @inherit = $properties.pipelines.output_base; + subpass = 0; + stages = ( + $properties.fstriangle.vertexStage, + { + stage = fragment; + name = main; + module = $builtin/output.frag; + }, + ); + layout = output_layout; + }; + waterwarp = { + @inherit = $properties.pipelines.output_base; + subpass = 0; + stages = ( + $properties.fstriangle.vertexStageST, + { + stage = fragment; + name = main; + module = $builtin/waterwarp.frag; + }, + ); + layout = waterwarp_layout; + }; + fisheye = { + @inherit = $properties.pipelines.output_base; + subpass = 0; + stages = ( + $properties.fstriangle.vertexStageST, + { + stage = fragment; + name = main; + module = $builtin/fisheye.frag; + }, + ); + layout = fisheye_layout; + }; +}; diff --git a/libs/video/renderer/vulkan/pl_quake_def.plist b/libs/video/renderer/vulkan/pl_quake_def.plist index ec70028ac..72a104744 100644 --- a/libs/video/renderer/vulkan/pl_quake_def.plist +++ b/libs/video/renderer/vulkan/pl_quake_def.plist @@ -1,1213 +1,1211 @@ -{ - limits = { - //FIXME this really needs to be an external variable as the C code - //needs to agree on the size, so it might as well set maxSamplers - //directly (and any other such variable) - maxSamplers = "min (256u, $physDevLimits.maxPerStageDescriptorSamplers)"; +limits = { + //FIXME this really needs to be an external variable as the C code + //needs to agree on the size, so it might as well set maxSamplers + //directly (and any other such variable) + maxSamplers = "min (256u, $physDevLimits.maxPerStageDescriptorSamplers)"; +}; +samplers = { + quakepic = { + magFilter = nearest; + minFilter = nearest; + mipmapMode = nearest; + addressModeU = clamp_to_edge; + addressModeV = clamp_to_edge; + addressModeW = clamp_to_edge; + mipLodBias = 0; + anisotropyEnable = false; + maxAnisotropy = 0; + compareEnable = false; + compareOp = always; + minLod = 0; + maxLod = 0; + borderColor = float_transparent_black; + unnormalizedCoordinates = false; }; - samplers = { - quakepic = { - magFilter = nearest; - minFilter = nearest; - mipmapMode = nearest; - addressModeU = clamp_to_edge; - addressModeV = clamp_to_edge; - addressModeW = clamp_to_edge; - mipLodBias = 0; - anisotropyEnable = false; - maxAnisotropy = 0; - compareEnable = false; - compareOp = always; - minLod = 0; - maxLod = 0; - borderColor = float_transparent_black; - unnormalizedCoordinates = false; - }; - glyph = { - magFilter = linear; - minFilter = linear; - mipmapMode = linear; - addressModeU = clamp_to_edge; - addressModeV = clamp_to_edge; - addressModeW = clamp_to_edge; - mipLodBias = 0; - anisotropyEnable = false; - maxAnisotropy = 0; - compareEnable = false; - compareOp = always; - minLod = 0; - maxLod = 0; - borderColor = float_transparent_black; - unnormalizedCoordinates = false; - }; - palette_sampler = { - magFilter = nearest; - minFilter = nearest; - mipmapMode = nearest; - addressModeU = clamp_to_edge; - addressModeV = clamp_to_edge; - addressModeW = clamp_to_edge; - mipLodBias = 0; - anisotropyEnable = false; - maxAnisotropy = 0; - compareEnable = false; - compareOp = always; - minLod = 0; - maxLod = 4; - borderColor = float_transparent_black; - unnormalizedCoordinates = false; - }; - quakebsp_sampler = { - magFilter = linear; - minFilter = linear; - mipmapMode = linear; - addressModeU = repeat; - addressModeV = repeat; - addressModeW = repeat; - mipLodBias = 0; - anisotropyEnable = false; - maxAnisotropy = 0; - compareEnable = false; - compareOp = always; - minLod = 0; - maxLod = 4; - borderColor = float_transparent_black; - unnormalizedCoordinates = false; - }; - alias_sampler = { - magFilter = linear; - minFilter = linear; - mipmapMode = linear; - addressModeU = clamp_to_edge; - addressModeV = clamp_to_edge; - addressModeW = clamp_to_edge; - mipLodBias = 0; - anisotropyEnable = false; - maxAnisotropy = 0; - compareEnable = false; - compareOp = always; - minLod = 0; - maxLod = 1000; - borderColor = float_transparent_black; - unnormalizedCoordinates = false; - }; - sprite_sampler = $properties.samplers.alias_sampler; - shadow_sampler = { - magFilter = linear; - minFilter = linear; - mipmapMode = linear; - addressModeU = clamp_to_edge; - addressModeV = clamp_to_edge; - addressModeW = clamp_to_edge; - mipLodBias = 0; - anisotropyEnable = false; - maxAnisotropy = 0; - compareEnable = true; - compareOp = greater_or_equal; - minLod = 0; - maxLod = 1000; - borderColor = float_transparent_black; - unnormalizedCoordinates = false; - }; + glyph = { + magFilter = linear; + minFilter = linear; + mipmapMode = linear; + addressModeU = clamp_to_edge; + addressModeV = clamp_to_edge; + addressModeW = clamp_to_edge; + mipLodBias = 0; + anisotropyEnable = false; + maxAnisotropy = 0; + compareEnable = false; + compareOp = always; + minLod = 0; + maxLod = 0; + borderColor = float_transparent_black; + unnormalizedCoordinates = false; }; - descriptorPools = { - matrix_pool = { - flags = 0; - maxSets = $frames.size; - bindings = ( - { - type = uniform_buffer; - descriptorCount = $frames.size; - }, - ); - }; - quad_pool = { - maxSets = 64; - bindings = ( - { - // quad geometry data (offset and uv) - type = uniform_texel_buffer; - descriptorCount = 64; - }, - { - // quad texture data - type = combined_image_sampler; - descriptorCount = 64; - }, - ); - }; - entity_pool = { - flags = free_descriptor_set; - maxSets = 512; - bindings = ( - { - type = storage_buffer; - descriptorCount = $properties.descriptorPools.entity_pool.maxSets; - }, - ); - }; - bone_pool = { - flags = free_descriptor_set; - maxSets = 512; - bindings = ( - { - type = storage_buffer; - descriptorCount = $properties.descriptorPools.bone_pool.maxSets; - }, - ); - }; - texture_pool = { - flags = free_descriptor_set; - maxSets = 1024; - bindings = ( - { - type = combined_image_sampler; - descriptorCount = $properties.descriptorPools.texture_pool.maxSets; - }, - ); - }; - particle_pool = { - flags = 0; - maxSets = "3z * $frames.size"; - bindings = ( - { - type = storage_buffer; - descriptorCount = "3z * 3z * $frames.size"; - }, - ); - }; - sprite_pool = { - flags = free_descriptor_set; - maxSets = 64; //FIXME cvar? - bindings = ( - { - type = uniform_buffer; - descriptorCount = $properties.descriptorPools.sprite_pool.maxSets; - }, - { - type = combined_image_sampler; - descriptorCount = $properties.descriptorPools.sprite_pool.maxSets; - }, - ); - }; - //FIXME probably should just share a larger pool - alias_pool = $properties.descriptorPools.texture_pool; - quakebsp_pool = $properties.descriptorPools.texture_pool; - lighting_attach_pool = { - flags = 0; - maxSets = $frames.size; - bindings = ( - { - type = input_attachment; - descriptorCount = "5z * $frames.size"; - }, - ); - }; - lighting_lights_pool = { - flags = 0; - maxSets = $frames.size; - bindings = ( - { - type = uniform_buffer; - descriptorCount = $frames.size; - }, - ); - }; - lighting_shadow_pool = { - flags = 0; - maxSets = $frames.size; - bindings = ( - { - type = combined_image_sampler; - descriptorCount = "$frames.size * size_t(32)"; - }, - ); - }; - oit_pool = { - flags = 0; - maxSets = $frames.size; - bindings = ( - { - type = storage_buffer; - descriptorCount = "2z * $frames.size"; - }, - { - type = storage_image; - descriptorCount = "1z * $frames.size"; - }, - ); - }; - compose_attach_pool = { - flags = 0; - maxSets = $frames.size; - bindings = ( - { - type = input_attachment; - descriptorCount = "2z * $frames.size"; - }, - ); - }; + palette_sampler = { + magFilter = nearest; + minFilter = nearest; + mipmapMode = nearest; + addressModeU = clamp_to_edge; + addressModeV = clamp_to_edge; + addressModeW = clamp_to_edge; + mipLodBias = 0; + anisotropyEnable = false; + maxAnisotropy = 0; + compareEnable = false; + compareOp = always; + minLod = 0; + maxLod = 4; + borderColor = float_transparent_black; + unnormalizedCoordinates = false; }; - setLayouts = { - matrix_set = { - bindings = ( - { - binding = 0; - descriptorType = uniform_buffer; - descriptorCount = 1; - stageFlags = vertex|geometry; - }, - ); - }; - quad_data_set = { - bindings = ( - { - // glyph texture data - binding = 0; - descriptorType = combined_image_sampler; - descriptorCount = 1; - stageFlags = fragment; - }, - { - // glyph geometry data (offset and uv) - binding = 1; - descriptorType = uniform_texel_buffer; - descriptorCount = 1; - stageFlags = vertex; - }, - ); - }; - texture_set = { - bindings = ( - { - binding = 0; - descriptorType = combined_image_sampler; - descriptorCount = 1; - stageFlags = fragment|vertex; - }, - ); - }; - oit_set = { - bindings = ( - { - binding = 0; - descriptorType = storage_buffer; - descriptorCount = 1; - stageFlags = fragment; - }, - { - binding = 1; - descriptorType = storage_buffer; - descriptorCount = 1; - stageFlags = fragment; - }, - { - binding = 2; - descriptorType = storage_image; - descriptorCount = 1; - stageFlags = fragment; - }, - ); - }; - entity_set = { - bindings = ( - { - binding = 0; - descriptorType = storage_buffer; - descriptorCount = 1; - stageFlags = vertex; - }, - ); - }; - bone_set = { - bindings = ( - { - binding = 0; - descriptorType = storage_buffer; - descriptorCount = 1; - stageFlags = vertex; - }, - ); - }; - sprite_set = { - bindings = ( - { - binding = 0; - descriptorType = uniform_buffer; - descriptorCount = 1; - stageFlags = vertex; - }, - { - binding = 1; - descriptorType = combined_image_sampler; - descriptorCount = 1; - stageFlags = fragment; - }, - ); - }; - lighting_attach = { - bindings = ( - { - binding = 0; - descriptorType = input_attachment; - descriptorCount = 1; - stageFlags = fragment; - }, - { - binding = 1; - descriptorType = input_attachment; - descriptorCount = 1; - stageFlags = fragment; - }, - { - binding = 2; - descriptorType = input_attachment; - descriptorCount = 1; - stageFlags = fragment; - }, - { - binding = 3; - descriptorType = input_attachment; - descriptorCount = 1; - stageFlags = fragment; - }, - { - binding = 4; - descriptorType = input_attachment; - descriptorCount = 1; - stageFlags = fragment; - }, - ); - }; - lighting_lights = { - bindings = ( - { - binding = 0; - descriptorType = uniform_buffer; - descriptorCount = 1; - stageFlags = fragment; - }, - ); - }; - lighting_shadow = { - bindings = ( - { - binding = 0; - descriptorType = combined_image_sampler; - descriptorCount = 32; - stageFlags = fragment; - }, - ); - }; - compose_attach = { - bindings = ( - { - binding = 0; - descriptorType = input_attachment; - descriptorCount = 1; - stageFlags = fragment; - }, - ); - }; - particle_set = { - bindings = ( - { - binding = 0; - descriptorType = storage_buffer; - descriptorCount = 1; - stageFlags = compute; - }, - { - binding = 1; - descriptorType = storage_buffer; - descriptorCount = 1; - stageFlags = compute; - }, - { - binding = 2; - descriptorType = storage_buffer; - descriptorCount = 1; - stageFlags = compute; - }, - ); - }; + quakebsp_sampler = { + magFilter = linear; + minFilter = linear; + mipmapMode = linear; + addressModeU = repeat; + addressModeV = repeat; + addressModeW = repeat; + mipLodBias = 0; + anisotropyEnable = false; + maxAnisotropy = 0; + compareEnable = false; + compareOp = always; + minLod = 0; + maxLod = 4; + borderColor = float_transparent_black; + unnormalizedCoordinates = false; }; - pipelineLayouts = { - quad_layout = { - setLayouts = (matrix_set, quad_data_set); - }; - lines_layout = { - setLayouts = (matrix_set); - }; - quakebsp_layout = { - setLayouts = (matrix_set, entity_set, oit_set, texture_set, texture_set); - pushConstantRanges = ( - { - stageFlags = fragment; - offset = 0; - size = "4 * 4 + 4 + 4 + 4"; - }, - ); - }; - alias_layout = { - setLayouts = (matrix_set, texture_set, texture_set); - pushConstantRanges = ( - { - stageFlags = vertex; - offset = 0; - size = "16 * 4 + 4"; - }, - { - stageFlags = fragment; - offset = 68; - size = "3 * 4 + 2 * 4 * 4"; - }, - ); - }; - iqm_layout = { - setLayouts = (matrix_set, texture_set, bone_set); - pushConstantRanges = ( - { - stageFlags = vertex; - offset = 0; - size = "16 * 4 + 4"; - }, - { - stageFlags = fragment; - offset = 68; - size = "3 * 4 + 2 * 4 * 4 + 4"; - }, - ); - }; - sprite_layout = { - setLayouts = (matrix_set, sprite_set); - pushConstantRanges = ( - { - stageFlags = vertex; - offset = 0; - size = "16 * 4 + 4"; - }, - { - stageFlags = fragment; - offset = 64; - size = "2 * 4 + 2 * 4 + 4 * 4"; - }, - ); - }; - lighting_layout = { - setLayouts = (lighting_attach, lighting_lights, lighting_shadow); - }; - compose_layout = { - setLayouts = (compose_attach, oit_set); - }; - partphysics_layout = { - setLayouts = (particle_set); - pushConstantRanges = ( - { - stageFlags = compute; - offset = 0; - size = "4 * 4 + 4"; - }, - ); - }; - partupdate_layout = { - setLayouts = (particle_set, particle_set, particle_set); - }; - partdraw_layout = { - setLayouts = (matrix_set, texture_set, oit_set); - pushConstantRanges = ( - { - stageFlags = vertex; - offset = 0; - size = "16 * 4"; - }, - ); - }; + alias_sampler = { + magFilter = linear; + minFilter = linear; + mipmapMode = linear; + addressModeU = clamp_to_edge; + addressModeV = clamp_to_edge; + addressModeW = clamp_to_edge; + mipLodBias = 0; + anisotropyEnable = false; + maxAnisotropy = 0; + compareEnable = false; + compareOp = always; + minLod = 0; + maxLod = 1000; + borderColor = float_transparent_black; + unnormalizedCoordinates = false; }; - - depthStencil = { - test_and_write = { - depthTestEnable = true; - depthWriteEnable = true; - depthCompareOp = less_or_equal; - depthBoundsTestEnable = false; - stencilTestEnable = false; - }; - test_only = { - depthTestEnable = true; - depthWriteEnable = false; - depthCompareOp = less_or_equal; - depthBoundsTestEnable = false; - stencilTestEnable = false; - }; - disable = { - depthTestEnable = false; - depthWriteEnable = false; - depthCompareOp = less_or_equal; - depthBoundsTestEnable = false; - stencilTestEnable = false; - }; + sprite_sampler = $properties.samplers.alias_sampler; + shadow_sampler = { + magFilter = linear; + minFilter = linear; + mipmapMode = linear; + addressModeU = clamp_to_edge; + addressModeV = clamp_to_edge; + addressModeW = clamp_to_edge; + mipLodBias = 0; + anisotropyEnable = false; + maxAnisotropy = 0; + compareEnable = true; + compareOp = greater_or_equal; + minLod = 0; + maxLod = 1000; + borderColor = float_transparent_black; + unnormalizedCoordinates = false; }; - - inputAssembly = { - alias = { - topology = triangle_list; - primitiveRestartEnable = false; - }; - brush = { - topology = triangle_fan; - primitiveRestartEnable = true; - }; - iqm = { - topology = triangle_list; - primitiveRestartEnable = false; - }; - lines = { - topology = line_list; - primitiveRestartEnable = false; - }; - sprite = { - topology = triangle_strip; - primitiveRestartEnable = true; - }; - point = { - topology = point_list; - primitiveRestartEnable = false; - }; - }; - - vertexInput = { - index_only = { - bindings = (); - attributes = (); - }; - alias = { - bindings = ( - { binding = 0; stride = "2 * 4 * 4"; inputRate = vertex; }, - { binding = 1; stride = "2 * 4 * 4"; inputRate = vertex; }, - { binding = 2; stride = "2 * 4"; inputRate = vertex; }, - ); - attributes = ( - { location = 0; binding = 0; format = r32g32b32a32_sfloat; offset = 0; }, - { location = 1; binding = 0; format = r32g32b32a32_sfloat; offset = 16; }, - { location = 2; binding = 1; format = r32g32b32a32_sfloat; offset = 0; }, - { location = 3; binding = 1; format = r32g32b32a32_sfloat; offset = 16; }, - { location = 4; binding = 2; format = r32g32_sfloat; offset = 0; }, - ); - }; - brush = { - bindings = ( - { binding = 0; stride = "2 * 4 * 4"; inputRate = vertex; }, - { binding = 1; stride = "4"; inputRate = instance; }, - ); - attributes = ( - { location = 0; binding = 0; format = r32g32b32a32_sfloat; offset = 0; }, - { location = 1; binding = 0; format = r32g32b32a32_sfloat; offset = 16; }, - { location = 2; binding = 1; format = r32_uint; offset = 0; }, - ); - }; - slice = { - bindings = ( - { binding = 0; stride = "4 + 4 + 4 * 4"; inputRate = instance; }, - ); - attributes = ( - // 9-slice index - { location = 0; binding = 0; format = r32_uint; offset = 0; }, - // 9-slice color - { location = 1; binding = 0; format = r8g8b8a8_unorm; offset = 4; }, - // 9-slice position (2d) - { location = 2; binding = 0; format = r32g32_sfloat; offset = 8; }, - // 9-slice size delta (2d) - { location = 3; binding = 0; format = r32g32_sfloat; offset = 16; }, - ); - }; - glyph = { - bindings = ( - { binding = 0; stride = "4 + 4 + 2 * 4"; inputRate = instance; }, - ); - attributes = ( - // glyph index - { location = 0; binding = 0; format = r32_uint; offset = 0; }, - // glyph color - { location = 1; binding = 0; format = r8g8b8a8_unorm; offset = 4; }, - // glyph position (2d) - { location = 2; binding = 0; format = r32g32_sfloat; offset = 8; }, - ); - }; - iqm = { - bindings = ( - { binding = 0; stride = 20; inputRate = vertex; }, - { binding = 1; stride = 40; inputRate = vertex; }, - ); - attributes = ( - { location = 0; binding = 0; format = r32g32b32_sfloat; offset = 0; }, // position - { location = 1; binding = 0; format = r8g8b8a8_uint; offset = 12; }, // bonindices - { location = 2; binding = 0; format = r8g8b8a8_unorm; offset = 16; }, // boneweights - - { location = 3; binding = 1; format = r32g32_sfloat; offset = 0; }, // texcoord - { location = 4; binding = 1; format = r32g32b32_sfloat; offset = 8; }, // normal - { location = 5; binding = 1; format = r32g32b32a32_sfloat; offset = 20; }, // tangent - { location = 6; binding = 1; format = r8g8b8a8_unorm; offset = 36; }, // color - - ); - }; - particle = { - bindings = ( - { binding = 0; stride = "4 * 4 * 4"; inputRate = instance; }, - ); - attributes = ( - { location = 0; binding = 0; format = r32g32b32a32_sfloat; offset = 0; }, - { location = 1; binding = 0; format = r32g32b32a32_sfloat; offset = 16; }, - { location = 2; binding = 0; format = r32g32b32a32_sfloat; offset = 32; }, - { location = 3; binding = 0; format = r32g32b32a32_sfloat; offset = 48; }, - ); - }; - lines = { - bindings = ( - { binding = 0; stride = "2 * 4 + 4"; inputRate = vertex; }, - ); - attributes = ( - { location = 0; binding = 0; format = r32g32_sfloat; offset = 0; }, - { location = 1; binding = 0; format = r8g8b8a8_unorm; offset = 8; }, - ); - }; - }; - - rasterization = { - cw_cull_back = { - depthClampEnable = false; - rasterizerDiscardEnable = false; - polygonMode = fill; - cullMode = back; - frontFace = clockwise; - depthBiasEnable = false; - lineWidth = 1; - }; - counter_cw_cull_back = { - depthClampEnable = false; - rasterizerDiscardEnable = false; - polygonMode = fill; - cullMode = back; - frontFace = counter_clockwise; - depthBiasEnable = false; - lineWidth = 1; - }; - }; - - multisample = { - rasterizationSamples = $msaaSamples; - sampleShadingEnable = false; - minSampleShading = 0.5f; - alphaToCoverageEnable = false; - alphaToOneEnable = false; - }; - - viewport = { - viewports = ( +}; +descriptorPools = { + matrix_pool = { + flags = 0; + maxSets = $frames.size; + bindings = ( { - x = 0; y = 0; - width = 640; height = 480; - minDepth = 0; maxDepth = 1; - } - ); - scissors = ( - { - offset = { x = 0; y = 0 }; - extent = { width = 640; height = 480; }; + type = uniform_buffer; + descriptorCount = $frames.size; }, ); }; - - attachmentBlendOp = { - disabled = { - blendEnable = false; - srcColorBlendFactor = src_alpha; - dstColorBlendFactor = one_minus_src_alpha; - colorBlendOp = add; - srcAlphaBlendFactor = src_alpha; - dstAlphaBlendFactor = one_minus_src_alpha; - alphaBlendOp = add; - colorWriteMask = r|g|b|a; - }; - alpha_blend = { - blendEnable = true; - srcColorBlendFactor = one; - dstColorBlendFactor = one_minus_src_alpha; - colorBlendOp = add; - srcAlphaBlendFactor = one; - dstAlphaBlendFactor = one_minus_src_alpha; - alphaBlendOp = add; - colorWriteMask = r|g|b|a; - }; + quad_pool = { + maxSets = 64; + bindings = ( + { + // quad geometry data (offset and uv) + type = uniform_texel_buffer; + descriptorCount = 64; + }, + { + // quad texture data + type = combined_image_sampler; + descriptorCount = 64; + }, + ); }; + entity_pool = { + flags = free_descriptor_set; + maxSets = 512; + bindings = ( + { + type = storage_buffer; + descriptorCount = $properties.descriptorPools.entity_pool.maxSets; + }, + ); + }; + bone_pool = { + flags = free_descriptor_set; + maxSets = 512; + bindings = ( + { + type = storage_buffer; + descriptorCount = $properties.descriptorPools.bone_pool.maxSets; + }, + ); + }; + texture_pool = { + flags = free_descriptor_set; + maxSets = 1024; + bindings = ( + { + type = combined_image_sampler; + descriptorCount = $properties.descriptorPools.texture_pool.maxSets; + }, + ); + }; + particle_pool = { + flags = 0; + maxSets = "3z * $frames.size"; + bindings = ( + { + type = storage_buffer; + descriptorCount = "3z * 3z * $frames.size"; + }, + ); + }; + sprite_pool = { + flags = free_descriptor_set; + maxSets = 64; //FIXME cvar? + bindings = ( + { + type = uniform_buffer; + descriptorCount = $properties.descriptorPools.sprite_pool.maxSets; + }, + { + type = combined_image_sampler; + descriptorCount = $properties.descriptorPools.sprite_pool.maxSets; + }, + ); + }; + //FIXME probably should just share a larger pool + alias_pool = $properties.descriptorPools.texture_pool; + quakebsp_pool = $properties.descriptorPools.texture_pool; + lighting_attach_pool = { + flags = 0; + maxSets = $frames.size; + bindings = ( + { + type = input_attachment; + descriptorCount = "5z * $frames.size"; + }, + ); + }; + lighting_lights_pool = { + flags = 0; + maxSets = $frames.size; + bindings = ( + { + type = uniform_buffer; + descriptorCount = $frames.size; + }, + ); + }; + lighting_shadow_pool = { + flags = 0; + maxSets = $frames.size; + bindings = ( + { + type = combined_image_sampler; + descriptorCount = "$frames.size * size_t(32)"; + }, + ); + }; + oit_pool = { + flags = 0; + maxSets = $frames.size; + bindings = ( + { + type = storage_buffer; + descriptorCount = "2z * $frames.size"; + }, + { + type = storage_image; + descriptorCount = "1z * $frames.size"; + }, + ); + }; + compose_attach_pool = { + flags = 0; + maxSets = $frames.size; + bindings = ( + { + type = input_attachment; + descriptorCount = "2z * $frames.size"; + }, + ); + }; +}; +setLayouts = { + matrix_set = { + bindings = ( + { + binding = 0; + descriptorType = uniform_buffer; + descriptorCount = 1; + stageFlags = vertex|geometry; + }, + ); + }; + quad_data_set = { + bindings = ( + { + // glyph texture data + binding = 0; + descriptorType = combined_image_sampler; + descriptorCount = 1; + stageFlags = fragment; + }, + { + // glyph geometry data (offset and uv) + binding = 1; + descriptorType = uniform_texel_buffer; + descriptorCount = 1; + stageFlags = vertex; + }, + ); + }; + texture_set = { + bindings = ( + { + binding = 0; + descriptorType = combined_image_sampler; + descriptorCount = 1; + stageFlags = fragment|vertex; + }, + ); + }; + oit_set = { + bindings = ( + { + binding = 0; + descriptorType = storage_buffer; + descriptorCount = 1; + stageFlags = fragment; + }, + { + binding = 1; + descriptorType = storage_buffer; + descriptorCount = 1; + stageFlags = fragment; + }, + { + binding = 2; + descriptorType = storage_image; + descriptorCount = 1; + stageFlags = fragment; + }, + ); + }; + entity_set = { + bindings = ( + { + binding = 0; + descriptorType = storage_buffer; + descriptorCount = 1; + stageFlags = vertex; + }, + ); + }; + bone_set = { + bindings = ( + { + binding = 0; + descriptorType = storage_buffer; + descriptorCount = 1; + stageFlags = vertex; + }, + ); + }; + sprite_set = { + bindings = ( + { + binding = 0; + descriptorType = uniform_buffer; + descriptorCount = 1; + stageFlags = vertex; + }, + { + binding = 1; + descriptorType = combined_image_sampler; + descriptorCount = 1; + stageFlags = fragment; + }, + ); + }; + lighting_attach = { + bindings = ( + { + binding = 0; + descriptorType = input_attachment; + descriptorCount = 1; + stageFlags = fragment; + }, + { + binding = 1; + descriptorType = input_attachment; + descriptorCount = 1; + stageFlags = fragment; + }, + { + binding = 2; + descriptorType = input_attachment; + descriptorCount = 1; + stageFlags = fragment; + }, + { + binding = 3; + descriptorType = input_attachment; + descriptorCount = 1; + stageFlags = fragment; + }, + { + binding = 4; + descriptorType = input_attachment; + descriptorCount = 1; + stageFlags = fragment; + }, + ); + }; + lighting_lights = { + bindings = ( + { + binding = 0; + descriptorType = uniform_buffer; + descriptorCount = 1; + stageFlags = fragment; + }, + ); + }; + lighting_shadow = { + bindings = ( + { + binding = 0; + descriptorType = combined_image_sampler; + descriptorCount = 32; + stageFlags = fragment; + }, + ); + }; + compose_attach = { + bindings = ( + { + binding = 0; + descriptorType = input_attachment; + descriptorCount = 1; + stageFlags = fragment; + }, + ); + }; + particle_set = { + bindings = ( + { + binding = 0; + descriptorType = storage_buffer; + descriptorCount = 1; + stageFlags = compute; + }, + { + binding = 1; + descriptorType = storage_buffer; + descriptorCount = 1; + stageFlags = compute; + }, + { + binding = 2; + descriptorType = storage_buffer; + descriptorCount = 1; + stageFlags = compute; + }, + ); + }; +}; +pipelineLayouts = { + quad_layout = { + setLayouts = (matrix_set, quad_data_set); + }; + lines_layout = { + setLayouts = (matrix_set); + }; + quakebsp_layout = { + setLayouts = (matrix_set, entity_set, oit_set, texture_set, texture_set); + pushConstantRanges = ( + { + stageFlags = fragment; + offset = 0; + size = "4 * 4 + 4 + 4 + 4"; + }, + ); + }; + alias_layout = { + setLayouts = (matrix_set, texture_set, texture_set); + pushConstantRanges = ( + { + stageFlags = vertex; + offset = 0; + size = "16 * 4 + 4"; + }, + { + stageFlags = fragment; + offset = 68; + size = "3 * 4 + 2 * 4 * 4"; + }, + ); + }; + iqm_layout = { + setLayouts = (matrix_set, texture_set, bone_set); + pushConstantRanges = ( + { + stageFlags = vertex; + offset = 0; + size = "16 * 4 + 4"; + }, + { + stageFlags = fragment; + offset = 68; + size = "3 * 4 + 2 * 4 * 4 + 4"; + }, + ); + }; + sprite_layout = { + setLayouts = (matrix_set, sprite_set); + pushConstantRanges = ( + { + stageFlags = vertex; + offset = 0; + size = "16 * 4 + 4"; + }, + { + stageFlags = fragment; + offset = 64; + size = "2 * 4 + 2 * 4 + 4 * 4"; + }, + ); + }; + lighting_layout = { + setLayouts = (lighting_attach, lighting_lights, lighting_shadow); + }; + compose_layout = { + setLayouts = (compose_attach, oit_set); + }; + partphysics_layout = { + setLayouts = (particle_set); + pushConstantRanges = ( + { + stageFlags = compute; + offset = 0; + size = "4 * 4 + 4"; + }, + ); + }; + partupdate_layout = { + setLayouts = (particle_set, particle_set, particle_set); + }; + partdraw_layout = { + setLayouts = (matrix_set, texture_set, oit_set); + pushConstantRanges = ( + { + stageFlags = vertex; + offset = 0; + size = "16 * 4"; + }, + ); + }; +}; - fstriangle = { - vertexStage = { - stage = vertex; - name = main; - module = $builtin/fstriangle.vert; +depthStencil = { + test_and_write = { + depthTestEnable = true; + depthWriteEnable = true; + depthCompareOp = less_or_equal; + depthBoundsTestEnable = false; + stencilTestEnable = false; + }; + test_only = { + depthTestEnable = true; + depthWriteEnable = false; + depthCompareOp = less_or_equal; + depthBoundsTestEnable = false; + stencilTestEnable = false; + }; + disable = { + depthTestEnable = false; + depthWriteEnable = false; + depthCompareOp = less_or_equal; + depthBoundsTestEnable = false; + stencilTestEnable = false; + }; +}; + +inputAssembly = { + alias = { + topology = triangle_list; + primitiveRestartEnable = false; + }; + brush = { + topology = triangle_fan; + primitiveRestartEnable = true; + }; + iqm = { + topology = triangle_list; + primitiveRestartEnable = false; + }; + lines = { + topology = line_list; + primitiveRestartEnable = false; + }; + sprite = { + topology = triangle_strip; + primitiveRestartEnable = true; + }; + point = { + topology = point_list; + primitiveRestartEnable = false; + }; +}; + +vertexInput = { + index_only = { + bindings = (); + attributes = (); + }; + alias = { + bindings = ( + { binding = 0; stride = "2 * 4 * 4"; inputRate = vertex; }, + { binding = 1; stride = "2 * 4 * 4"; inputRate = vertex; }, + { binding = 2; stride = "2 * 4"; inputRate = vertex; }, + ); + attributes = ( + { location = 0; binding = 0; format = r32g32b32a32_sfloat; offset = 0; }, + { location = 1; binding = 0; format = r32g32b32a32_sfloat; offset = 16; }, + { location = 2; binding = 1; format = r32g32b32a32_sfloat; offset = 0; }, + { location = 3; binding = 1; format = r32g32b32a32_sfloat; offset = 16; }, + { location = 4; binding = 2; format = r32g32_sfloat; offset = 0; }, + ); + }; + brush = { + bindings = ( + { binding = 0; stride = "2 * 4 * 4"; inputRate = vertex; }, + { binding = 1; stride = "4"; inputRate = instance; }, + ); + attributes = ( + { location = 0; binding = 0; format = r32g32b32a32_sfloat; offset = 0; }, + { location = 1; binding = 0; format = r32g32b32a32_sfloat; offset = 16; }, + { location = 2; binding = 1; format = r32_uint; offset = 0; }, + ); + }; + slice = { + bindings = ( + { binding = 0; stride = "4 + 4 + 4 * 4"; inputRate = instance; }, + ); + attributes = ( + // 9-slice index + { location = 0; binding = 0; format = r32_uint; offset = 0; }, + // 9-slice color + { location = 1; binding = 0; format = r8g8b8a8_unorm; offset = 4; }, + // 9-slice position (2d) + { location = 2; binding = 0; format = r32g32_sfloat; offset = 8; }, + // 9-slice size delta (2d) + { location = 3; binding = 0; format = r32g32_sfloat; offset = 16; }, + ); + }; + glyph = { + bindings = ( + { binding = 0; stride = "4 + 4 + 2 * 4"; inputRate = instance; }, + ); + attributes = ( + // glyph index + { location = 0; binding = 0; format = r32_uint; offset = 0; }, + // glyph color + { location = 1; binding = 0; format = r8g8b8a8_unorm; offset = 4; }, + // glyph position (2d) + { location = 2; binding = 0; format = r32g32_sfloat; offset = 8; }, + ); + }; + iqm = { + bindings = ( + { binding = 0; stride = 20; inputRate = vertex; }, + { binding = 1; stride = 40; inputRate = vertex; }, + ); + attributes = ( + { location = 0; binding = 0; format = r32g32b32_sfloat; offset = 0; }, // position + { location = 1; binding = 0; format = r8g8b8a8_uint; offset = 12; }, // bonindices + { location = 2; binding = 0; format = r8g8b8a8_unorm; offset = 16; }, // boneweights + + { location = 3; binding = 1; format = r32g32_sfloat; offset = 0; }, // texcoord + { location = 4; binding = 1; format = r32g32b32_sfloat; offset = 8; }, // normal + { location = 5; binding = 1; format = r32g32b32a32_sfloat; offset = 20; }, // tangent + { location = 6; binding = 1; format = r8g8b8a8_unorm; offset = 36; }, // color + + ); + }; + particle = { + bindings = ( + { binding = 0; stride = "4 * 4 * 4"; inputRate = instance; }, + ); + attributes = ( + { location = 0; binding = 0; format = r32g32b32a32_sfloat; offset = 0; }, + { location = 1; binding = 0; format = r32g32b32a32_sfloat; offset = 16; }, + { location = 2; binding = 0; format = r32g32b32a32_sfloat; offset = 32; }, + { location = 3; binding = 0; format = r32g32b32a32_sfloat; offset = 48; }, + ); + }; + lines = { + bindings = ( + { binding = 0; stride = "2 * 4 + 4"; inputRate = vertex; }, + ); + attributes = ( + { location = 0; binding = 0; format = r32g32_sfloat; offset = 0; }, + { location = 1; binding = 0; format = r8g8b8a8_unorm; offset = 8; }, + ); + }; +}; + +rasterization = { + cw_cull_back = { + depthClampEnable = false; + rasterizerDiscardEnable = false; + polygonMode = fill; + cullMode = back; + frontFace = clockwise; + depthBiasEnable = false; + lineWidth = 1; + }; + counter_cw_cull_back = { + depthClampEnable = false; + rasterizerDiscardEnable = false; + polygonMode = fill; + cullMode = back; + frontFace = counter_clockwise; + depthBiasEnable = false; + lineWidth = 1; + }; +}; + +multisample = { + rasterizationSamples = $msaaSamples; + sampleShadingEnable = false; + minSampleShading = 0.5f; + alphaToCoverageEnable = false; + alphaToOneEnable = false; +}; + +viewport = { + viewports = ( + { + x = 0; y = 0; + width = 640; height = 480; + minDepth = 0; maxDepth = 1; + } + ); + scissors = ( + { + offset = { x = 0; y = 0 }; + extent = { width = 640; height = 480; }; + }, + ); +}; + +attachmentBlendOp = { + disabled = { + blendEnable = false; + srcColorBlendFactor = src_alpha; + dstColorBlendFactor = one_minus_src_alpha; + colorBlendOp = add; + srcAlphaBlendFactor = src_alpha; + dstAlphaBlendFactor = one_minus_src_alpha; + alphaBlendOp = add; + colorWriteMask = r|g|b|a; + }; + alpha_blend = { + blendEnable = true; + srcColorBlendFactor = one; + dstColorBlendFactor = one_minus_src_alpha; + colorBlendOp = add; + srcAlphaBlendFactor = one; + dstAlphaBlendFactor = one_minus_src_alpha; + alphaBlendOp = add; + colorWriteMask = r|g|b|a; + }; +}; + +fstriangle = { + vertexStage = { + stage = vertex; + name = main; + module = $builtin/fstriangle.vert; + }; + vertexInput = { + bindings = (); + attributes = (); + }; + inputAssembly = { + topology = triangle_list; + primitiveRestartEnable = false; + }; + colorBlend = { + logicOpEnable = false; + attachments = ($properties.attachmentBlendOp.disabled); + }; +}; + +pipelines = { + base = { + viewport = $properties.viewport; + rasterization = $properties.rasterization.counter_cw_cull_back; + multisample = $properties.multisample; + depthStencil = $properties.depthStencil.disable; + colorBlend = { + logicOpEnable = false; + attachments = ( + $properties.attachmentBlendOp.disabled, + $properties.attachmentBlendOp.disabled, + $properties.attachmentBlendOp.disabled, + $properties.attachmentBlendOp.disabled, + ); }; - vertexInput = { - bindings = (); - attributes = (); - }; - inputAssembly = { - topology = triangle_list; - primitiveRestartEnable = false; + dynamic = { + dynamicState = ( viewport, scissor ); }; + renderPass = deferred; + }; + depth_base = { + @inherit = $properties.pipelines.base; + subpass = 0; + rasterization = $properties.rasterization.cw_cull_back; + depthStencil = $properties.depthStencil.test_and_write; + }; + trans_base = { + @inherit = $properties.pipelines.base; + subpass = 1; + rasterization = $properties.rasterization.cw_cull_back; + depthStencil = $properties.depthStencil.test_only; colorBlend = { logicOpEnable = false; attachments = ($properties.attachmentBlendOp.disabled); }; }; - - pipelines = { - base = { - viewport = $properties.viewport; - rasterization = $properties.rasterization.counter_cw_cull_back; - multisample = $properties.multisample; - depthStencil = $properties.depthStencil.disable; - colorBlend = { - logicOpEnable = false; - attachments = ( - $properties.attachmentBlendOp.disabled, - $properties.attachmentBlendOp.disabled, - $properties.attachmentBlendOp.disabled, - $properties.attachmentBlendOp.disabled, - ); - }; - dynamic = { - dynamicState = ( viewport, scissor ); - }; - renderPass = deferred; - }; - depth_base = { - @inherit = $properties.pipelines.base; - subpass = 0; - rasterization = $properties.rasterization.cw_cull_back; - depthStencil = $properties.depthStencil.test_and_write; - }; - trans_base = { - @inherit = $properties.pipelines.base; - subpass = 1; - rasterization = $properties.rasterization.cw_cull_back; - depthStencil = $properties.depthStencil.test_only; - colorBlend = { - logicOpEnable = false; - attachments = ($properties.attachmentBlendOp.disabled); - }; - }; - gbuf_base = { - @inherit = $properties.pipelines.base; - subpass = 2; - rasterization = $properties.rasterization.cw_cull_back; - depthStencil = $properties.depthStencil.test_only; - }; - comp_base = { - @inherit = $properties.pipelines.base; - vertexInput = $properties.fstriangle.vertexInput; - inputAssembly = $properties.fstriangle.inputAssembly; - colorBlend = $properties.fstriangle.colorBlend; - }; - shadow_base = { - @inherit = $properties.pipelines.depth_base; - renderPass = shadow; - }; - - alias_shadow = { - @inherit = $properties.pipelines.shadow_base; - stages = ( - { - stage = vertex; - name = main; - module = $builtin/alias_shadow.vert; - }, - ); - vertexInput = { - bindings = ( - "$properties.vertexInput.alias.bindings[0]", - "$properties.vertexInput.alias.bindings[1]", - ); - attributes = ( - "$properties.vertexInput.alias.attributes[0]", - "$properties.vertexInput.alias.attributes[1]", - "$properties.vertexInput.alias.attributes[2]", - "$properties.vertexInput.alias.attributes[3]", - ); - }; - inputAssembly = $properties.inputAssembly.alias; - layout = alias_layout; - }; - bsp_shadow = { - @inherit = $properties.pipelines.shadow_base; - stages = ( - { - stage = vertex; - name = main; - module = $builtin/bsp_shadow.vert; - }, - ); - vertexInput = { - bindings = ( - "$properties.vertexInput.brush.bindings[0]", - ); - attributes = ( - "$properties.vertexInput.brush.attributes[0]", - ); - }; - inputAssembly = $properties.inputAssembly.brush; - }; - alias_depth = { - @inherit = $properties.pipelines.depth_base; - stages = ( - { - stage = vertex; - name = main; - module = $builtin/alias_depth.vert; - }, - ); - vertexInput = { - // depth pass doesn't use UVs - bindings = ( - "$properties.vertexInput.alias.bindings[0]", - "$properties.vertexInput.alias.bindings[1]", - ); - attributes = ( - "$properties.vertexInput.alias.attributes[0]", - "$properties.vertexInput.alias.attributes[1]", - "$properties.vertexInput.alias.attributes[2]", - "$properties.vertexInput.alias.attributes[3]", - ); - }; - inputAssembly = $properties.inputAssembly.alias; - layout = alias_layout; - }; - alias_gbuf = { - @inherit = $properties.pipelines.gbuf_base; - stages = ( - { - stage = vertex; - name = main; - module = $builtin/alias.vert; - }, - { - stage = fragment; - name = main; - module = $builtin/alias_gbuf.frag; - }, - ); - vertexInput = $properties.vertexInput.alias; - inputAssembly = $properties.inputAssembly.alias; - layout = alias_layout; - }; - bsp_depth = { - @inherit = $properties.pipelines.depth_base; - stages = ( - { - stage = vertex; - name = main; - module = $builtin/bsp_depth.vert; - }, - ); - vertexInput = { - bindings = ( - "$properties.vertexInput.brush.bindings[0]", - "$properties.vertexInput.brush.bindings[1]", - ); - attributes = ( - "$properties.vertexInput.brush.attributes[0]", - "$properties.vertexInput.brush.attributes[2]", - ); - }; - inputAssembly = $properties.inputAssembly.brush; - layout = quakebsp_layout; - }; - bsp_gbuf = { - @inherit = $properties.pipelines.gbuf_base; - stages = ( - { - stage = vertex; - name = main; - module = $builtin/bsp_gbuf.vert; - }, - { - stage = geometry; - name = main; - module = $builtin/bsp_gbuf.geom; - }, - { - stage = fragment; - name = main; - module = $builtin/bsp_gbuf.frag; - }, - ); - vertexInput = $properties.vertexInput.brush; - inputAssembly = $properties.inputAssembly.brush; - layout = quakebsp_layout; - }; - bsp_skybox = { - @inherit = $properties.pipelines.trans_base; - stages = ( - { - stage = vertex; - name = main; - module = $builtin/quakebsp.vert; - }, - { - stage = fragment; - name = main; - module = $builtin/bsp_sky.frag; - specializationInfo = { - mapEntries = ( - // doSkyBox - { size = 4; offset = 0; constantID = 0; }, - // doSkySheet - { size = 4; offset = 4; constantID = 1; }, - ); - data = "array(1, 0)"; - }; - }, - ); - vertexInput = $properties.vertexInput.brush; - inputAssembly = $properties.inputAssembly.brush; - layout = quakebsp_layout; - }; - bsp_skysheet = { - @inherit = $properties.pipelines.trans_base; - stages = ( - { - stage = vertex; - name = main; - module = $builtin/quakebsp.vert; - }, - { - stage = fragment; - name = main; - module = $builtin/bsp_sky.frag; - specializationInfo = { - mapEntries = ( - // doSkyBox - { size = 4; offset = 0; constantID = 0; }, - // doSkySheet - { size = 4; offset = 4; constantID = 1; }, - ); - data = "array(0, 1)"; - }; - }, - ); - vertexInput = $properties.vertexInput.brush; - inputAssembly = $properties.inputAssembly.brush; - layout = quakebsp_layout; - }; - bsp_turb = { - @inherit = $properties.pipelines.trans_base; - stages = ( - { - stage = vertex; - name = main; - module = $builtin/quakebsp.vert; - }, - { - stage = fragment; - name = main; - module = $builtin/bsp_turb.frag; - }, - ); - vertexInput = $properties.vertexInput.brush; - inputAssembly = $properties.inputAssembly.brush; - layout = quakebsp_layout; - }; - iqm_depth = { - @inherit = $properties.pipelines.depth_base; - stages = ( - { - stage = vertex; - name = main; - module = $builtin/iqm.vert; - specializationInfo = { - mapEntries = ( - // IQMDepthOnly - { size = 4; offset = 0; constantID = 0; }, - ); - data = "array(1)"; - }; - }, - ); - vertexInput = $properties.vertexInput.iqm; - inputAssembly = $properties.inputAssembly.iqm; - layout = iqm_layout; - }; - iqm_gbuf = { - @inherit = $properties.pipelines.gbuf_base; - stages = ( - { - stage = vertex; - name = main; - module = $builtin/iqm.vert; - specializationInfo = { - mapEntries = ( - // !IQMDepthOnly - { size = 4; offset = 0; constantID = 0; }, - ); - data = "array(0)"; - }; - }, - { - stage = fragment; - name = main; - module = $builtin/iqm.frag; - }, - ); - vertexInput = $properties.vertexInput.iqm; - inputAssembly = $properties.inputAssembly.iqm; - layout = iqm_layout; - }; - partdraw = { - @inherit = $properties.pipelines.trans_base; - stages = ( - { - stage = vertex; - name = main; - module = $builtin/particle.vert; - }, - { - stage = geometry; - name = main; - module = $builtin/particle.geom; - }, - { - stage = fragment; - name = main; - module = $builtin/particle.frag; - }, - ); - vertexInput = $properties.vertexInput.particle; - inputAssembly = $properties.inputAssembly.point; - layout = partdraw_layout; - }; - sprite_gbuf = { - @inherit = $properties.pipelines.gbuf_base; - stages = ( - { - stage = vertex; - name = main; - module = $builtin/sprite_gbuf.vert; - }, - { - stage = fragment; - name = main; - module = $builtin/sprite_gbuf.frag; - }, - ); - vertexInput = $properties.vertexInput.index_only; - inputAssembly = $properties.inputAssembly.sprite; - layout = sprite_layout; - }; - sprite_depth = { - @inherit = $properties.pipelines.depth_base; - stages = ( - { - stage = vertex; - name = main; - module = $builtin/sprite_depth.vert; - }, - { - stage = fragment; - name = main; - module = $builtin/sprite_depth.frag; - }, - ); - vertexInput = $properties.vertexInput.index_only; - inputAssembly = $properties.inputAssembly.sprite; - layout = sprite_layout; - }; - slice = { - @inherit = $properties.pipelines.trans_base; - renderPass = output; - subpass = 0; - stages = ( - { stage = vertex; name = main; module = $builtin/slice.vert; }, - { stage = fragment; name = main; module = $builtin/twod.frag; }, - ); - vertexInput = $properties.vertexInput.slice; - inputAssembly = { - // slices are drawn using instanced slice triples - topology = triangle_strip; - primitiveRestartEnable = true; - }; - rasterization = $properties.rasterization.counter_cw_cull_back; - colorBlend = { - logicOpEnable = false; - attachments = ($properties.attachmentBlendOp.alpha_blend); - }; - layout = quad_layout; - }; - lines = { - @inherit = $properties.pipelines.trans_base; - renderPass = output; - subpass = 0; - stages = ( - { stage = vertex; name = main; module = $builtin/line.vert; }, - { stage = fragment; name = main; module = $builtin/line.frag; }, - ); - vertexInput = $properties.vertexInput.lines; - rasterization = $properties.rasterization.counter_cw_cull_back; - depthStencil = $properties.depthStencil.disable; - colorBlend = { - logicOpEnable = false; - attachments = ($properties.attachmentBlendOp.alpha_blend); - }; - inputAssembly = $properties.inputAssembly.lines; - layout = lines_layout; - }; - lighting = { - @inherit = $properties.pipelines.comp_base; - subpass = 3; - stages = ( - $properties.fstriangle.vertexStage, - { - stage = fragment; - name = main; - module = $builtin/lighting.frag; - //specializationInfo = { - // mapEntries = ( - // { size = 4; offset = 0; constantID = 0; }, - // ); - // data = "array(uint($properties.limits.maxSamplers))"; - //}; - }, - ); - layout = lighting_layout; - }; - compose = { - @inherit = $properties.pipelines.comp_base; - subpass = 4; - stages = ( - $properties.fstriangle.vertexStage, - { - stage = fragment; - name = main; - module = $builtin/compose.frag; - }, - ); - layout = compose_layout; - }; - - partphysics = { - stage = { - stage = compute; - name = main; - module = $builtin/partphysics.comp; - }; - layout = partphysics_layout; - }; - partupdate = { - stage = { - stage = compute; - name = main; - module = $builtin/partupdate.comp; - }; - layout = partupdate_layout; - }; + gbuf_base = { + @inherit = $properties.pipelines.base; + subpass = 2; + rasterization = $properties.rasterization.cw_cull_back; + depthStencil = $properties.depthStencil.test_only; }; -} + comp_base = { + @inherit = $properties.pipelines.base; + vertexInput = $properties.fstriangle.vertexInput; + inputAssembly = $properties.fstriangle.inputAssembly; + colorBlend = $properties.fstriangle.colorBlend; + }; + shadow_base = { + @inherit = $properties.pipelines.depth_base; + renderPass = shadow; + }; + + alias_shadow = { + @inherit = $properties.pipelines.shadow_base; + stages = ( + { + stage = vertex; + name = main; + module = $builtin/alias_shadow.vert; + }, + ); + vertexInput = { + bindings = ( + "$properties.vertexInput.alias.bindings[0]", + "$properties.vertexInput.alias.bindings[1]", + ); + attributes = ( + "$properties.vertexInput.alias.attributes[0]", + "$properties.vertexInput.alias.attributes[1]", + "$properties.vertexInput.alias.attributes[2]", + "$properties.vertexInput.alias.attributes[3]", + ); + }; + inputAssembly = $properties.inputAssembly.alias; + layout = alias_layout; + }; + bsp_shadow = { + @inherit = $properties.pipelines.shadow_base; + stages = ( + { + stage = vertex; + name = main; + module = $builtin/bsp_shadow.vert; + }, + ); + vertexInput = { + bindings = ( + "$properties.vertexInput.brush.bindings[0]", + ); + attributes = ( + "$properties.vertexInput.brush.attributes[0]", + ); + }; + inputAssembly = $properties.inputAssembly.brush; + }; + alias_depth = { + @inherit = $properties.pipelines.depth_base; + stages = ( + { + stage = vertex; + name = main; + module = $builtin/alias_depth.vert; + }, + ); + vertexInput = { + // depth pass doesn't use UVs + bindings = ( + "$properties.vertexInput.alias.bindings[0]", + "$properties.vertexInput.alias.bindings[1]", + ); + attributes = ( + "$properties.vertexInput.alias.attributes[0]", + "$properties.vertexInput.alias.attributes[1]", + "$properties.vertexInput.alias.attributes[2]", + "$properties.vertexInput.alias.attributes[3]", + ); + }; + inputAssembly = $properties.inputAssembly.alias; + layout = alias_layout; + }; + alias_gbuf = { + @inherit = $properties.pipelines.gbuf_base; + stages = ( + { + stage = vertex; + name = main; + module = $builtin/alias.vert; + }, + { + stage = fragment; + name = main; + module = $builtin/alias_gbuf.frag; + }, + ); + vertexInput = $properties.vertexInput.alias; + inputAssembly = $properties.inputAssembly.alias; + layout = alias_layout; + }; + bsp_depth = { + @inherit = $properties.pipelines.depth_base; + stages = ( + { + stage = vertex; + name = main; + module = $builtin/bsp_depth.vert; + }, + ); + vertexInput = { + bindings = ( + "$properties.vertexInput.brush.bindings[0]", + "$properties.vertexInput.brush.bindings[1]", + ); + attributes = ( + "$properties.vertexInput.brush.attributes[0]", + "$properties.vertexInput.brush.attributes[2]", + ); + }; + inputAssembly = $properties.inputAssembly.brush; + layout = quakebsp_layout; + }; + bsp_gbuf = { + @inherit = $properties.pipelines.gbuf_base; + stages = ( + { + stage = vertex; + name = main; + module = $builtin/bsp_gbuf.vert; + }, + { + stage = geometry; + name = main; + module = $builtin/bsp_gbuf.geom; + }, + { + stage = fragment; + name = main; + module = $builtin/bsp_gbuf.frag; + }, + ); + vertexInput = $properties.vertexInput.brush; + inputAssembly = $properties.inputAssembly.brush; + layout = quakebsp_layout; + }; + bsp_skybox = { + @inherit = $properties.pipelines.trans_base; + stages = ( + { + stage = vertex; + name = main; + module = $builtin/quakebsp.vert; + }, + { + stage = fragment; + name = main; + module = $builtin/bsp_sky.frag; + specializationInfo = { + mapEntries = ( + // doSkyBox + { size = 4; offset = 0; constantID = 0; }, + // doSkySheet + { size = 4; offset = 4; constantID = 1; }, + ); + data = "array(1, 0)"; + }; + }, + ); + vertexInput = $properties.vertexInput.brush; + inputAssembly = $properties.inputAssembly.brush; + layout = quakebsp_layout; + }; + bsp_skysheet = { + @inherit = $properties.pipelines.trans_base; + stages = ( + { + stage = vertex; + name = main; + module = $builtin/quakebsp.vert; + }, + { + stage = fragment; + name = main; + module = $builtin/bsp_sky.frag; + specializationInfo = { + mapEntries = ( + // doSkyBox + { size = 4; offset = 0; constantID = 0; }, + // doSkySheet + { size = 4; offset = 4; constantID = 1; }, + ); + data = "array(0, 1)"; + }; + }, + ); + vertexInput = $properties.vertexInput.brush; + inputAssembly = $properties.inputAssembly.brush; + layout = quakebsp_layout; + }; + bsp_turb = { + @inherit = $properties.pipelines.trans_base; + stages = ( + { + stage = vertex; + name = main; + module = $builtin/quakebsp.vert; + }, + { + stage = fragment; + name = main; + module = $builtin/bsp_turb.frag; + }, + ); + vertexInput = $properties.vertexInput.brush; + inputAssembly = $properties.inputAssembly.brush; + layout = quakebsp_layout; + }; + iqm_depth = { + @inherit = $properties.pipelines.depth_base; + stages = ( + { + stage = vertex; + name = main; + module = $builtin/iqm.vert; + specializationInfo = { + mapEntries = ( + // IQMDepthOnly + { size = 4; offset = 0; constantID = 0; }, + ); + data = "array(1)"; + }; + }, + ); + vertexInput = $properties.vertexInput.iqm; + inputAssembly = $properties.inputAssembly.iqm; + layout = iqm_layout; + }; + iqm_gbuf = { + @inherit = $properties.pipelines.gbuf_base; + stages = ( + { + stage = vertex; + name = main; + module = $builtin/iqm.vert; + specializationInfo = { + mapEntries = ( + // !IQMDepthOnly + { size = 4; offset = 0; constantID = 0; }, + ); + data = "array(0)"; + }; + }, + { + stage = fragment; + name = main; + module = $builtin/iqm.frag; + }, + ); + vertexInput = $properties.vertexInput.iqm; + inputAssembly = $properties.inputAssembly.iqm; + layout = iqm_layout; + }; + partdraw = { + @inherit = $properties.pipelines.trans_base; + stages = ( + { + stage = vertex; + name = main; + module = $builtin/particle.vert; + }, + { + stage = geometry; + name = main; + module = $builtin/particle.geom; + }, + { + stage = fragment; + name = main; + module = $builtin/particle.frag; + }, + ); + vertexInput = $properties.vertexInput.particle; + inputAssembly = $properties.inputAssembly.point; + layout = partdraw_layout; + }; + sprite_gbuf = { + @inherit = $properties.pipelines.gbuf_base; + stages = ( + { + stage = vertex; + name = main; + module = $builtin/sprite_gbuf.vert; + }, + { + stage = fragment; + name = main; + module = $builtin/sprite_gbuf.frag; + }, + ); + vertexInput = $properties.vertexInput.index_only; + inputAssembly = $properties.inputAssembly.sprite; + layout = sprite_layout; + }; + sprite_depth = { + @inherit = $properties.pipelines.depth_base; + stages = ( + { + stage = vertex; + name = main; + module = $builtin/sprite_depth.vert; + }, + { + stage = fragment; + name = main; + module = $builtin/sprite_depth.frag; + }, + ); + vertexInput = $properties.vertexInput.index_only; + inputAssembly = $properties.inputAssembly.sprite; + layout = sprite_layout; + }; + slice = { + @inherit = $properties.pipelines.trans_base; + renderPass = output; + subpass = 0; + stages = ( + { stage = vertex; name = main; module = $builtin/slice.vert; }, + { stage = fragment; name = main; module = $builtin/twod.frag; }, + ); + vertexInput = $properties.vertexInput.slice; + inputAssembly = { + // slices are drawn using instanced slice triples + topology = triangle_strip; + primitiveRestartEnable = true; + }; + rasterization = $properties.rasterization.counter_cw_cull_back; + colorBlend = { + logicOpEnable = false; + attachments = ($properties.attachmentBlendOp.alpha_blend); + }; + layout = quad_layout; + }; + lines = { + @inherit = $properties.pipelines.trans_base; + renderPass = output; + subpass = 0; + stages = ( + { stage = vertex; name = main; module = $builtin/line.vert; }, + { stage = fragment; name = main; module = $builtin/line.frag; }, + ); + vertexInput = $properties.vertexInput.lines; + rasterization = $properties.rasterization.counter_cw_cull_back; + depthStencil = $properties.depthStencil.disable; + colorBlend = { + logicOpEnable = false; + attachments = ($properties.attachmentBlendOp.alpha_blend); + }; + inputAssembly = $properties.inputAssembly.lines; + layout = lines_layout; + }; + lighting = { + @inherit = $properties.pipelines.comp_base; + subpass = 3; + stages = ( + $properties.fstriangle.vertexStage, + { + stage = fragment; + name = main; + module = $builtin/lighting.frag; + //specializationInfo = { + // mapEntries = ( + // { size = 4; offset = 0; constantID = 0; }, + // ); + // data = "array(uint($properties.limits.maxSamplers))"; + //}; + }, + ); + layout = lighting_layout; + }; + compose = { + @inherit = $properties.pipelines.comp_base; + subpass = 4; + stages = ( + $properties.fstriangle.vertexStage, + { + stage = fragment; + name = main; + module = $builtin/compose.frag; + }, + ); + layout = compose_layout; + }; + + partphysics = { + stage = { + stage = compute; + name = main; + module = $builtin/partphysics.comp; + }; + layout = partphysics_layout; + }; + partupdate = { + stage = { + stage = compute; + name = main; + module = $builtin/partupdate.comp; + }; + layout = partupdate_layout; + }; +}; diff --git a/libs/video/renderer/vulkan/rp_defcube.plist b/libs/video/renderer/vulkan/rp_defcube.plist index 062f12fca..3a4cd1089 100644 --- a/libs/video/renderer/vulkan/rp_defcube.plist +++ b/libs/video/renderer/vulkan/rp_defcube.plist @@ -1,330 +1,328 @@ -{ - flat_color_image_template = { - imageType = `2d; - samples = 1; - extent = { - width = $output.extent.width; - height = $output.extent.height; - depth = 1; - }; - mipLevels = 1; - arrayLayers = 6; - tiling = optimal; - usage = color_attachment|input_attachment|transient_attachment; - initialLayout = undefined; - }; - images = { - depth = { - @inherit = $properties.flat_color_image_template; - format = x8_d24_unorm_pack32; - usage = depth_stencil_attachment|input_attachment|transient_attachment; - }; - color = { - @inherit = $properties.flat_color_image_template; - format = r8g8b8a8_unorm; - }; - emission = { - @inherit = $properties.flat_color_image_template; - format = r16g16b16a16_sfloat; - }; - normal = { - @inherit = $properties.flat_color_image_template; - format = r16g16b16a16_sfloat; - }; - position = { - @inherit = $properties.flat_color_image_template; - format = r32g32b32a32_sfloat; - }; - opaque = { - @inherit = $properties.flat_color_image_template; - format = r16g16b16a16_sfloat; - }; - }; - flat_color_view_template = { - viewType = `2d_array; - components = { - r = identity; - g = identity; - b = identity; - a = identity; - }; - subresourceRange = { - aspectMask = color; - levelCount = 1; - layerCount = 6; - }; - }; - imageViews = { - depth = { - @inherit = $properties.flat_color_view_template; - image = depth; - format = $properties.images.depth.format; - subresourceRange = { - aspectMask = depth; - }; - }; - color = { - @inherit = $properties.flat_color_view_template; - image = color; - format = $properties.images.color.format; - }; - emission = { - @inherit = $properties.flat_color_view_template; - image = emission; - format = $properties.images.emission.format; - }; - normal = { - @inherit = $properties.flat_color_view_template; - image = normal; - format = $properties.images.normal.format; - }; - position = { - @inherit = $properties.flat_color_view_template; - image = position; - format = $properties.images.position.format; - }; - opaque = { - @inherit = $properties.flat_color_view_template; - image = opaque; - format = $properties.images.opaque.format; - }; - aview = { - @inherit = $properties.flat_color_view_template; - image = $output.image; - format = $output.format; - }; - }; - output = { - image = { - @inherit = $properties.flat_color_image_template; - flags = cube_compatible; - usage = color_attachment|input_attachment|sampled; - format = $output.format; - }; - view = { - @inherit = $properties.flat_color_view_template; - viewType = cube; - image = $output.image; - format = $output.format; - }; - format = r16g16b16a16_sfloat; - finalLayout = shader_read_only_optimal; - }; - framebuffer = { - renderPass = defcube; - attachments = (depth, color, emission, normal, position, opaque, - $properties.imageViews.aview); +flat_color_image_template = { + imageType = `2d; + samples = 1; + extent = { width = $output.extent.width; height = $output.extent.height; - layers = 1; + depth = 1; }; - clearValues = ( - { depthStencil = { depth = 1; stencil = 0; }; }, - { color = "[0, 0, 0, 1]"; }, // color - { color = "[0, 0, 0, 1]"; }, // emission - { color = "[0, 0, 0, 1]"; }, // normal - { color = "[0, 0, 0, 1]"; }, // position - { color = "[0, 0, 0, 1]"; }, // opaque - { color = "[0, 0, 0, 1]"; }, // output + mipLevels = 1; + arrayLayers = 6; + tiling = optimal; + usage = color_attachment|input_attachment|transient_attachment; + initialLayout = undefined; +}; +images = { + depth = { + @inherit = $properties.flat_color_image_template; + format = x8_d24_unorm_pack32; + usage = depth_stencil_attachment|input_attachment|transient_attachment; + }; + color = { + @inherit = $properties.flat_color_image_template; + format = r8g8b8a8_unorm; + }; + emission = { + @inherit = $properties.flat_color_image_template; + format = r16g16b16a16_sfloat; + }; + normal = { + @inherit = $properties.flat_color_image_template; + format = r16g16b16a16_sfloat; + }; + position = { + @inherit = $properties.flat_color_image_template; + format = r32g32b32a32_sfloat; + }; + opaque = { + @inherit = $properties.flat_color_image_template; + format = r16g16b16a16_sfloat; + }; +}; +flat_color_view_template = { + viewType = `2d_array; + components = { + r = identity; + g = identity; + b = identity; + a = identity; + }; + subresourceRange = { + aspectMask = color; + levelCount = 1; + layerCount = 6; + }; +}; +imageViews = { + depth = { + @inherit = $properties.flat_color_view_template; + image = depth; + format = $properties.images.depth.format; + subresourceRange = { + aspectMask = depth; + }; + }; + color = { + @inherit = $properties.flat_color_view_template; + image = color; + format = $properties.images.color.format; + }; + emission = { + @inherit = $properties.flat_color_view_template; + image = emission; + format = $properties.images.emission.format; + }; + normal = { + @inherit = $properties.flat_color_view_template; + image = normal; + format = $properties.images.normal.format; + }; + position = { + @inherit = $properties.flat_color_view_template; + image = position; + format = $properties.images.position.format; + }; + opaque = { + @inherit = $properties.flat_color_view_template; + image = opaque; + format = $properties.images.opaque.format; + }; + aview = { + @inherit = $properties.flat_color_view_template; + image = $output.image; + format = $output.format; + }; +}; +output = { + image = { + @inherit = $properties.flat_color_image_template; + flags = cube_compatible; + usage = color_attachment|input_attachment|sampled; + format = $output.format; + }; + view = { + @inherit = $properties.flat_color_view_template; + viewType = cube; + image = $output.image; + format = $output.format; + }; + format = r16g16b16a16_sfloat; + finalLayout = shader_read_only_optimal; +}; +framebuffer = { + renderPass = defcube; + attachments = (depth, color, emission, normal, position, opaque, + $properties.imageViews.aview); + width = $output.extent.width; + height = $output.extent.height; + layers = 1; +}; +clearValues = ( + { depthStencil = { depth = 1; stencil = 0; }; }, + { color = "[0, 0, 0, 1]"; }, // color + { color = "[0, 0, 0, 1]"; }, // emission + { color = "[0, 0, 0, 1]"; }, // normal + { color = "[0, 0, 0, 1]"; }, // position + { color = "[0, 0, 0, 1]"; }, // opaque + { color = "[0, 0, 0, 1]"; }, // output +); +attachment_template = { + samples = 1; + loadOp = dont_care; + storeOp = store; + stencilLoadOp = dont_care; + stencilStoreOp = dont_care; + initialLayout = undefined; + finalLayout = color_attachment_optimal; +}; +info = { + color = "[0, 1, 0, 1]"; + subpass_info = ( + { name = depth; color = "[ 0.5, 0.5, 0.5, 1]" }, + { name = translucent; color = "[ 0.25, 0.25, 0.6, 1]" }, + { name = g-buffef; color = "[ 0.3, 0.7, 0.3, 1]" }, + { name = lighting; color = "[ 0.8, 0.8, 0.8, 1]" }, + { name = compose; color = "[ 0.7, 0.3, 0.3, 1]" }, ); - attachment_template = { - samples = 1; - loadOp = dont_care; - storeOp = store; - stencilLoadOp = dont_care; - stencilStoreOp = dont_care; - initialLayout = undefined; - finalLayout = color_attachment_optimal; - }; - info = { - color = "[0, 1, 0, 1]"; - subpass_info = ( - { name = depth; color = "[ 0.5, 0.5, 0.5, 1]" }, - { name = translucent; color = "[ 0.25, 0.25, 0.6, 1]" }, - { name = g-buffef; color = "[ 0.3, 0.7, 0.3, 1]" }, - { name = lighting; color = "[ 0.8, 0.8, 0.8, 1]" }, - { name = compose; color = "[ 0.7, 0.3, 0.3, 1]" }, - ); - }; - renderpass = { - attachments = ( - { - @inherit = $properties.attachment_template; - format = $properties.images.depth.format; - loadOp = clear; - finalLayout = depth_stencil_attachment_optimal; - }, - { - @inherit = $properties.attachment_template; - format = $properties.images.color.format; - loadOp = clear; - }, - { - @inherit = $properties.attachment_template; - format = $properties.images.emission.format; - loadOp = clear; - }, - { - @inherit = $properties.attachment_template; - format = $properties.images.normal.format; - }, - { - @inherit = $properties.attachment_template; - format = $properties.images.position.format; - }, - { - @inherit = $properties.attachment_template; - format = $properties.images.opaque.format; - }, - { - @inherit = $properties.attachment_template; - format = $output.format; - loadOp = clear; - storeOp = store; - finalLayout = $output.finalLayout; - }, - ); - subpasses = ( - { // 0 depth - pipelineBindPoint = graphics; - depthStencilAttachment = { +}; +renderpass = { + attachments = ( + { + @inherit = $properties.attachment_template; + format = $properties.images.depth.format; + loadOp = clear; + finalLayout = depth_stencil_attachment_optimal; + }, + { + @inherit = $properties.attachment_template; + format = $properties.images.color.format; + loadOp = clear; + }, + { + @inherit = $properties.attachment_template; + format = $properties.images.emission.format; + loadOp = clear; + }, + { + @inherit = $properties.attachment_template; + format = $properties.images.normal.format; + }, + { + @inherit = $properties.attachment_template; + format = $properties.images.position.format; + }, + { + @inherit = $properties.attachment_template; + format = $properties.images.opaque.format; + }, + { + @inherit = $properties.attachment_template; + format = $output.format; + loadOp = clear; + storeOp = store; + finalLayout = $output.finalLayout; + }, + ); + subpasses = ( + { // 0 depth + pipelineBindPoint = graphics; + depthStencilAttachment = { + attachment = 0; + layout = depth_stencil_attachment_optimal; + }; + }, + { // 1 translucent-frags + pipelineBindPoint = graphics; + depthStencilAttachment = { + attachment = 0; + layout = depth_stencil_read_only_optimal; + }; + preserveAttachments = (1, 2, 3, 4, 5); + }, + { // 2 g-buffer generation + pipelineBindPoint = graphics; + colorAttachments = ( + { // color + attachment = 1; + layout = color_attachment_optimal; + }, + { // emission + attachment = 2; + layout = color_attachment_optimal; + }, + { // normal + attachment = 3; + layout = color_attachment_optimal; + }, + { // position + attachment = 4; + layout = color_attachment_optimal; + }, + ); + depthStencilAttachment = { + attachment = 0; + layout = depth_stencil_read_only_optimal; + }; + preserveAttachments = (6); + }, + { // 3 lighting + pipelineBindPoint = graphics; + inputAttachments = ( + { // depth attachment = 0; - layout = depth_stencil_attachment_optimal; - }; - }, - { // 1 translucent-frags - pipelineBindPoint = graphics; - depthStencilAttachment = { - attachment = 0; - layout = depth_stencil_read_only_optimal; - }; - preserveAttachments = (1, 2, 3, 4, 5); - }, - { // 2 g-buffer generation - pipelineBindPoint = graphics; - colorAttachments = ( - { // color - attachment = 1; - layout = color_attachment_optimal; - }, - { // emission - attachment = 2; - layout = color_attachment_optimal; - }, - { // normal - attachment = 3; - layout = color_attachment_optimal; - }, - { // position - attachment = 4; - layout = color_attachment_optimal; - }, - ); - depthStencilAttachment = { - attachment = 0; - layout = depth_stencil_read_only_optimal; - }; - preserveAttachments = (6); - }, - { // 3 lighting - pipelineBindPoint = graphics; - inputAttachments = ( - { // depth - attachment = 0; - layout = shader_read_only_optimal; - }, - { // color - attachment = 1; - layout = shader_read_only_optimal; - }, - { // emission - attachment = 2; - layout = shader_read_only_optimal; - }, - { // normal - attachment = 3; - layout = shader_read_only_optimal; - }, - { // position - attachment = 4; - layout = shader_read_only_optimal; - }, - ); - colorAttachments = ( - { // opaque - attachment = 5; - layout = color_attachment_optimal; - }, - ); - preserveAttachments = (6); - }, - { // 4 compose - pipelineBindPoint = graphics; - inputAttachments = ( - { // opaque - attachment = 5; - layout = shader_read_only_optimal; - }, - ); - colorAttachments = ( - { // output - attachment = 6; - layout = color_attachment_optimal; - }, - ); - preserveAttachments = (0, 1, 2, 3, 4); - }, - ); - dependencies = ( - { - srcSubpass = 0; // depth - dstSubpass = 1; // translucent - srcStageMask = late_fragment_tests; - dstStageMask = fragment_shader|early_fragment_tests; - srcAccessMask = depth_stencil_attachment_write; - dstAccessMask = input_attachment_read|depth_stencil_attachment_read; - dependencyFlags = by_region|view_local; - }, - { - srcSubpass = 0; // depth - dstSubpass = 2; // g-buffer - srcStageMask = late_fragment_tests; - dstStageMask = early_fragment_tests; - srcAccessMask = depth_stencil_attachment_write; - dstAccessMask = depth_stencil_attachment_read; - dependencyFlags = by_region|view_local; - }, - { - srcSubpass = 2; // g-buffer - dstSubpass = 3; // lighting - srcStageMask = color_attachment_output; - dstStageMask = fragment_shader; - srcAccessMask = color_attachment_write; - dstAccessMask = input_attachment_read; - dependencyFlags = by_region|view_local; - }, - { - srcSubpass = 3; // lighting - dstSubpass = 4; // compose - srcStageMask = color_attachment_output; - dstStageMask = fragment_shader; - srcAccessMask = color_attachment_write; - dstAccessMask = input_attachment_read; - dependencyFlags = by_region|view_local; - }, - { - srcSubpass = 1; // translucent-frags - dstSubpass = 4; // translucent-final/compose - srcStageMask = color_attachment_output; - dstStageMask = fragment_shader; - srcAccessMask = color_attachment_write; - dstAccessMask = input_attachment_read; - dependencyFlags = by_region|view_local; - }, - ); - @next = (VkRenderPassMultiviewCreateInfo, { - viewMasks = (0x3fu, 0x3fu, 0x3fu, 0x3fu, 0x3fu); - viewOffsets = ( 0, 0, 0, 0, 0); - }); - }; -} + layout = shader_read_only_optimal; + }, + { // color + attachment = 1; + layout = shader_read_only_optimal; + }, + { // emission + attachment = 2; + layout = shader_read_only_optimal; + }, + { // normal + attachment = 3; + layout = shader_read_only_optimal; + }, + { // position + attachment = 4; + layout = shader_read_only_optimal; + }, + ); + colorAttachments = ( + { // opaque + attachment = 5; + layout = color_attachment_optimal; + }, + ); + preserveAttachments = (6); + }, + { // 4 compose + pipelineBindPoint = graphics; + inputAttachments = ( + { // opaque + attachment = 5; + layout = shader_read_only_optimal; + }, + ); + colorAttachments = ( + { // output + attachment = 6; + layout = color_attachment_optimal; + }, + ); + preserveAttachments = (0, 1, 2, 3, 4); + }, + ); + dependencies = ( + { + srcSubpass = 0; // depth + dstSubpass = 1; // translucent + srcStageMask = late_fragment_tests; + dstStageMask = fragment_shader|early_fragment_tests; + srcAccessMask = depth_stencil_attachment_write; + dstAccessMask = input_attachment_read|depth_stencil_attachment_read; + dependencyFlags = by_region|view_local; + }, + { + srcSubpass = 0; // depth + dstSubpass = 2; // g-buffer + srcStageMask = late_fragment_tests; + dstStageMask = early_fragment_tests; + srcAccessMask = depth_stencil_attachment_write; + dstAccessMask = depth_stencil_attachment_read; + dependencyFlags = by_region|view_local; + }, + { + srcSubpass = 2; // g-buffer + dstSubpass = 3; // lighting + srcStageMask = color_attachment_output; + dstStageMask = fragment_shader; + srcAccessMask = color_attachment_write; + dstAccessMask = input_attachment_read; + dependencyFlags = by_region|view_local; + }, + { + srcSubpass = 3; // lighting + dstSubpass = 4; // compose + srcStageMask = color_attachment_output; + dstStageMask = fragment_shader; + srcAccessMask = color_attachment_write; + dstAccessMask = input_attachment_read; + dependencyFlags = by_region|view_local; + }, + { + srcSubpass = 1; // translucent-frags + dstSubpass = 4; // translucent-final/compose + srcStageMask = color_attachment_output; + dstStageMask = fragment_shader; + srcAccessMask = color_attachment_write; + dstAccessMask = input_attachment_read; + dependencyFlags = by_region|view_local; + }, + ); + @next = (VkRenderPassMultiviewCreateInfo, { + viewMasks = (0x3fu, 0x3fu, 0x3fu, 0x3fu, 0x3fu); + viewOffsets = ( 0, 0, 0, 0, 0); + }); +}; diff --git a/libs/video/renderer/vulkan/rp_deferred.plist b/libs/video/renderer/vulkan/rp_deferred.plist index 13bf88cb8..9fb3845de 100644 --- a/libs/video/renderer/vulkan/rp_deferred.plist +++ b/libs/video/renderer/vulkan/rp_deferred.plist @@ -1,319 +1,317 @@ -{ - flat_color_image_template = { - imageType = `2d; - samples = 1; - extent = { - width = $output.extent.width; - height = $output.extent.height; - depth = 1; - }; - mipLevels = 1; - arrayLayers = 1; - tiling = optimal; - usage = color_attachment|input_attachment|transient_attachment; - initialLayout = undefined; - }; - images = { - depth = { - @inherit = $properties.flat_color_image_template; - format = x8_d24_unorm_pack32; - usage = depth_stencil_attachment|input_attachment|transient_attachment; - }; - color = { - @inherit = $properties.flat_color_image_template; - format = r8g8b8a8_unorm; - }; - emission = { - @inherit = $properties.flat_color_image_template; - format = r16g16b16a16_sfloat; - }; - normal = { - @inherit = $properties.flat_color_image_template; - format = r16g16b16a16_sfloat; - }; - position = { - @inherit = $properties.flat_color_image_template; - format = r32g32b32a32_sfloat; - }; - opaque = { - @inherit = $properties.flat_color_image_template; - format = r16g16b16a16_sfloat; - }; - }; - flat_color_view_template = { - viewType = VK_IMAGE_VIEW_TYPE_2D; - components = { - r = identity; - g = identity; - b = identity; - a = identity; - }; - subresourceRange = { - aspectMask = color; - levelCount = 1; - layerCount = 1; - }; - }; - imageViews = { - depth = { - @inherit = $properties.flat_color_view_template; - image = depth; - format = $properties.images.depth.format; - subresourceRange = { - aspectMask = depth; - }; - }; - color = { - @inherit = $properties.flat_color_view_template; - image = color; - format = $properties.images.color.format; - }; - emission = { - @inherit = $properties.flat_color_view_template; - image = emission; - format = $properties.images.emission.format; - }; - normal = { - @inherit = $properties.flat_color_view_template; - image = normal; - format = $properties.images.normal.format; - }; - position = { - @inherit = $properties.flat_color_view_template; - image = position; - format = $properties.images.position.format; - }; - opaque = { - @inherit = $properties.flat_color_view_template; - image = opaque; - format = $properties.images.opaque.format; - }; - }; - output = { - image = { - @inherit = $properties.flat_color_image_template; - usage = color_attachment|input_attachment|sampled; - format = $output.format; - }; - view = { - @inherit = $properties.flat_color_view_template; - image = $output.image; - format = $output.format; - }; - format = r16g16b16a16_sfloat; - finalLayout = shader_read_only_optimal; - }; - framebuffer = { - renderPass = deferred; - attachments = (depth, color, emission, normal, position, opaque, - $output.view); +flat_color_image_template = { + imageType = `2d; + samples = 1; + extent = { width = $output.extent.width; height = $output.extent.height; - layers = 1; + depth = 1; }; - clearValues = ( - { depthStencil = { depth = 1; stencil = 0; }; }, - { color = "[0, 0, 0, 1]"; }, // color - { color = "[0, 0, 0, 1]"; }, // emission - { color = "[0, 0, 0, 1]"; }, // normal - { color = "[0, 0, 0, 1]"; }, // position - { color = "[0, 0, 0, 1]"; }, // opaque - { color = "[0, 0, 0, 1]"; }, // output + mipLevels = 1; + arrayLayers = 1; + tiling = optimal; + usage = color_attachment|input_attachment|transient_attachment; + initialLayout = undefined; +}; +images = { + depth = { + @inherit = $properties.flat_color_image_template; + format = x8_d24_unorm_pack32; + usage = depth_stencil_attachment|input_attachment|transient_attachment; + }; + color = { + @inherit = $properties.flat_color_image_template; + format = r8g8b8a8_unorm; + }; + emission = { + @inherit = $properties.flat_color_image_template; + format = r16g16b16a16_sfloat; + }; + normal = { + @inherit = $properties.flat_color_image_template; + format = r16g16b16a16_sfloat; + }; + position = { + @inherit = $properties.flat_color_image_template; + format = r32g32b32a32_sfloat; + }; + opaque = { + @inherit = $properties.flat_color_image_template; + format = r16g16b16a16_sfloat; + }; +}; +flat_color_view_template = { + viewType = VK_IMAGE_VIEW_TYPE_2D; + components = { + r = identity; + g = identity; + b = identity; + a = identity; + }; + subresourceRange = { + aspectMask = color; + levelCount = 1; + layerCount = 1; + }; +}; +imageViews = { + depth = { + @inherit = $properties.flat_color_view_template; + image = depth; + format = $properties.images.depth.format; + subresourceRange = { + aspectMask = depth; + }; + }; + color = { + @inherit = $properties.flat_color_view_template; + image = color; + format = $properties.images.color.format; + }; + emission = { + @inherit = $properties.flat_color_view_template; + image = emission; + format = $properties.images.emission.format; + }; + normal = { + @inherit = $properties.flat_color_view_template; + image = normal; + format = $properties.images.normal.format; + }; + position = { + @inherit = $properties.flat_color_view_template; + image = position; + format = $properties.images.position.format; + }; + opaque = { + @inherit = $properties.flat_color_view_template; + image = opaque; + format = $properties.images.opaque.format; + }; +}; +output = { + image = { + @inherit = $properties.flat_color_image_template; + usage = color_attachment|input_attachment|sampled; + format = $output.format; + }; + view = { + @inherit = $properties.flat_color_view_template; + image = $output.image; + format = $output.format; + }; + format = r16g16b16a16_sfloat; + finalLayout = shader_read_only_optimal; +}; +framebuffer = { + renderPass = deferred; + attachments = (depth, color, emission, normal, position, opaque, + $output.view); + width = $output.extent.width; + height = $output.extent.height; + layers = 1; +}; +clearValues = ( + { depthStencil = { depth = 1; stencil = 0; }; }, + { color = "[0, 0, 0, 1]"; }, // color + { color = "[0, 0, 0, 1]"; }, // emission + { color = "[0, 0, 0, 1]"; }, // normal + { color = "[0, 0, 0, 1]"; }, // position + { color = "[0, 0, 0, 1]"; }, // opaque + { color = "[0, 0, 0, 1]"; }, // output +); +attachment_template = { + samples = 1; + loadOp = dont_care; + storeOp = dont_care; + stencilLoadOp = dont_care; + stencilStoreOp = dont_care; + initialLayout = undefined; + finalLayout = color_attachment_optimal; +}; +info = { + color = "[0, 1, 0, 1]"; + subpass_info = ( + { name = depth; color = "[ 0.5, 0.5, 0.5, 1]" }, + { name = translucent; color = "[ 0.25, 0.25, 0.6, 1]" }, + { name = g-buffef; color = "[ 0.3, 0.7, 0.3, 1]" }, + { name = lighting; color = "[ 0.8, 0.8, 0.8, 1]" }, + { name = compose; color = "[ 0.7, 0.3, 0.3, 1]" }, ); - attachment_template = { - samples = 1; - loadOp = dont_care; - storeOp = dont_care; - stencilLoadOp = dont_care; - stencilStoreOp = dont_care; - initialLayout = undefined; - finalLayout = color_attachment_optimal; - }; - info = { - color = "[0, 1, 0, 1]"; - subpass_info = ( - { name = depth; color = "[ 0.5, 0.5, 0.5, 1]" }, - { name = translucent; color = "[ 0.25, 0.25, 0.6, 1]" }, - { name = g-buffef; color = "[ 0.3, 0.7, 0.3, 1]" }, - { name = lighting; color = "[ 0.8, 0.8, 0.8, 1]" }, - { name = compose; color = "[ 0.7, 0.3, 0.3, 1]" }, - ); - }; - renderpass = { - attachments = ( - { - @inherit = $properties.attachment_template; - format = $properties.images.depth.format; - loadOp = clear; - finalLayout = depth_stencil_attachment_optimal; - }, - { - @inherit = $properties.attachment_template; - format = $properties.images.color.format; - loadOp = clear; - }, - { - @inherit = $properties.attachment_template; - format = $properties.images.emission.format; - loadOp = clear; - }, - { - @inherit = $properties.attachment_template; - format = $properties.images.normal.format; - }, - { - @inherit = $properties.attachment_template; - format = $properties.images.position.format; - }, - { - @inherit = $properties.attachment_template; - format = $properties.images.opaque.format; - }, - { - @inherit = $properties.attachment_template; - format = $output.format; - loadOp = clear; - storeOp = store; - finalLayout = $output.finalLayout; - }, - ); - subpasses = ( - { // 0 depth - pipelineBindPoint = graphics; - depthStencilAttachment = { +}; +renderpass = { + attachments = ( + { + @inherit = $properties.attachment_template; + format = $properties.images.depth.format; + loadOp = clear; + finalLayout = depth_stencil_attachment_optimal; + }, + { + @inherit = $properties.attachment_template; + format = $properties.images.color.format; + loadOp = clear; + }, + { + @inherit = $properties.attachment_template; + format = $properties.images.emission.format; + loadOp = clear; + }, + { + @inherit = $properties.attachment_template; + format = $properties.images.normal.format; + }, + { + @inherit = $properties.attachment_template; + format = $properties.images.position.format; + }, + { + @inherit = $properties.attachment_template; + format = $properties.images.opaque.format; + }, + { + @inherit = $properties.attachment_template; + format = $output.format; + loadOp = clear; + storeOp = store; + finalLayout = $output.finalLayout; + }, + ); + subpasses = ( + { // 0 depth + pipelineBindPoint = graphics; + depthStencilAttachment = { + attachment = 0; + layout = depth_stencil_attachment_optimal; + }; + }, + { // 1 translucent-frags + pipelineBindPoint = graphics; + depthStencilAttachment = { + attachment = 0; + layout = depth_stencil_read_only_optimal; + }; + preserveAttachments = (1, 2, 3, 4, 5); + }, + { // 2 g-buffer generation + pipelineBindPoint = graphics; + colorAttachments = ( + { // color + attachment = 1; + layout = color_attachment_optimal; + }, + { // emission + attachment = 2; + layout = color_attachment_optimal; + }, + { // normal + attachment = 3; + layout = color_attachment_optimal; + }, + { // position + attachment = 4; + layout = color_attachment_optimal; + }, + ); + depthStencilAttachment = { + attachment = 0; + layout = depth_stencil_read_only_optimal; + }; + preserveAttachments = (6); + }, + { // 3 lighting + pipelineBindPoint = graphics; + inputAttachments = ( + { // depth attachment = 0; - layout = depth_stencil_attachment_optimal; - }; - }, - { // 1 translucent-frags - pipelineBindPoint = graphics; - depthStencilAttachment = { - attachment = 0; - layout = depth_stencil_read_only_optimal; - }; - preserveAttachments = (1, 2, 3, 4, 5); - }, - { // 2 g-buffer generation - pipelineBindPoint = graphics; - colorAttachments = ( - { // color - attachment = 1; - layout = color_attachment_optimal; - }, - { // emission - attachment = 2; - layout = color_attachment_optimal; - }, - { // normal - attachment = 3; - layout = color_attachment_optimal; - }, - { // position - attachment = 4; - layout = color_attachment_optimal; - }, - ); - depthStencilAttachment = { - attachment = 0; - layout = depth_stencil_read_only_optimal; - }; - preserveAttachments = (6); - }, - { // 3 lighting - pipelineBindPoint = graphics; - inputAttachments = ( - { // depth - attachment = 0; - layout = shader_read_only_optimal; - }, - { // color - attachment = 1; - layout = shader_read_only_optimal; - }, - { // emission - attachment = 2; - layout = shader_read_only_optimal; - }, - { // normal - attachment = 3; - layout = shader_read_only_optimal; - }, - { // position - attachment = 4; - layout = shader_read_only_optimal; - }, - ); - colorAttachments = ( - { // opaque - attachment = 5; - layout = color_attachment_optimal; - }, - ); - preserveAttachments = (6); - }, - { // 4 compose - pipelineBindPoint = graphics; - inputAttachments = ( - { // opaque - attachment = 5; - layout = shader_read_only_optimal; - }, - ); - colorAttachments = ( - { // output - attachment = 6; - layout = color_attachment_optimal; - }, - ); - preserveAttachments = (0, 1, 2, 3, 4); - }, - ); - dependencies = ( - { - srcSubpass = 0; // depth - dstSubpass = 1; // translucent - srcStageMask = late_fragment_tests; - dstStageMask = fragment_shader|early_fragment_tests; - srcAccessMask = depth_stencil_attachment_write; - dstAccessMask = input_attachment_read|depth_stencil_attachment_read; - dependencyFlags = by_region; - }, - { - srcSubpass = 0; // depth - dstSubpass = 2; // g-buffer - srcStageMask = late_fragment_tests; - dstStageMask = early_fragment_tests; - srcAccessMask = depth_stencil_attachment_write; - dstAccessMask = depth_stencil_attachment_read; - dependencyFlags = by_region; - }, - { - srcSubpass = 2; // g-buffer - dstSubpass = 3; // lighting - srcStageMask = color_attachment_output; - dstStageMask = fragment_shader; - srcAccessMask = color_attachment_write; - dstAccessMask = input_attachment_read; - dependencyFlags = by_region; - }, - { - srcSubpass = 3; // lighting - dstSubpass = 4; // compose - srcStageMask = color_attachment_output; - dstStageMask = fragment_shader; - srcAccessMask = color_attachment_write; - dstAccessMask = input_attachment_read; - dependencyFlags = by_region; - }, - { - srcSubpass = 1; // translucent-frags - dstSubpass = 4; // translucent-final/compose - srcStageMask = color_attachment_output; - dstStageMask = fragment_shader; - srcAccessMask = color_attachment_write; - dstAccessMask = input_attachment_read; - dependencyFlags = by_region; - }, - ); - }; -} + layout = shader_read_only_optimal; + }, + { // color + attachment = 1; + layout = shader_read_only_optimal; + }, + { // emission + attachment = 2; + layout = shader_read_only_optimal; + }, + { // normal + attachment = 3; + layout = shader_read_only_optimal; + }, + { // position + attachment = 4; + layout = shader_read_only_optimal; + }, + ); + colorAttachments = ( + { // opaque + attachment = 5; + layout = color_attachment_optimal; + }, + ); + preserveAttachments = (6); + }, + { // 4 compose + pipelineBindPoint = graphics; + inputAttachments = ( + { // opaque + attachment = 5; + layout = shader_read_only_optimal; + }, + ); + colorAttachments = ( + { // output + attachment = 6; + layout = color_attachment_optimal; + }, + ); + preserveAttachments = (0, 1, 2, 3, 4); + }, + ); + dependencies = ( + { + srcSubpass = 0; // depth + dstSubpass = 1; // translucent + srcStageMask = late_fragment_tests; + dstStageMask = fragment_shader|early_fragment_tests; + srcAccessMask = depth_stencil_attachment_write; + dstAccessMask = input_attachment_read|depth_stencil_attachment_read; + dependencyFlags = by_region; + }, + { + srcSubpass = 0; // depth + dstSubpass = 2; // g-buffer + srcStageMask = late_fragment_tests; + dstStageMask = early_fragment_tests; + srcAccessMask = depth_stencil_attachment_write; + dstAccessMask = depth_stencil_attachment_read; + dependencyFlags = by_region; + }, + { + srcSubpass = 2; // g-buffer + dstSubpass = 3; // lighting + srcStageMask = color_attachment_output; + dstStageMask = fragment_shader; + srcAccessMask = color_attachment_write; + dstAccessMask = input_attachment_read; + dependencyFlags = by_region; + }, + { + srcSubpass = 3; // lighting + dstSubpass = 4; // compose + srcStageMask = color_attachment_output; + dstStageMask = fragment_shader; + srcAccessMask = color_attachment_write; + dstAccessMask = input_attachment_read; + dependencyFlags = by_region; + }, + { + srcSubpass = 1; // translucent-frags + dstSubpass = 4; // translucent-final/compose + srcStageMask = color_attachment_output; + dstStageMask = fragment_shader; + srcAccessMask = color_attachment_write; + dstAccessMask = input_attachment_read; + dependencyFlags = by_region; + }, + ); +}; diff --git a/libs/video/renderer/vulkan/rp_forward.plist b/libs/video/renderer/vulkan/rp_forward.plist index e8c703a23..0e7366801 100644 --- a/libs/video/renderer/vulkan/rp_forward.plist +++ b/libs/video/renderer/vulkan/rp_forward.plist @@ -1,199 +1,197 @@ -{ - flat_color_image_template = { - imageType = `2d; - samples = $msaaSamples; - extent = { - width = $output.extent.width; - height = $output.extent.height; - depth = 1; - }; - mipLevels = 1; - arrayLayers = 1; - tiling = optimal; - usage = color_attachment|transient_attachment; +flat_color_image_template = { + imageType = `2d; + samples = $msaaSamples; + extent = { + width = $output.extent.width; + height = $output.extent.height; + depth = 1; }; - images = { - depth = { - @inherit = @properties.flat_color_image_template; - format = x8_d24_unorm_pack32; - usage = depth_stencil_attachment|transient_attachment; - }; - color = { - @inherit = @properties.flat_color_image_template; - format = $output.format; - }; + mipLevels = 1; + arrayLayers = 1; + tiling = optimal; + usage = color_attachment|transient_attachment; +}; +images = { + depth = { + @inherit = @properties.flat_color_image_template; + format = x8_d24_unorm_pack32; + usage = depth_stencil_attachment|transient_attachment; }; - flat_color_view_template = { - viewType = `2d; - components = { - r = identity; - g = identity; - b = identity; - a = identity; - }; + color = { + @inherit = @properties.flat_color_image_template; + format = $output.format; + }; +}; +flat_color_view_template = { + viewType = `2d; + components = { + r = identity; + g = identity; + b = identity; + a = identity; + }; + subresourceRange = { + aspectMask = color; + levelCount = 1; + layerCount = 1; + }; +}; +imageViews = { + depth = { + @inherit = $properties.flat_color_view_template; + image = depth; + format = $properties.images.depth.format; subresourceRange = { - aspectMask = color; - levelCount = 1; - layerCount = 1; + aspectMask = depth; }; }; - imageViews = { - depth = { - @inherit = $properties.flat_color_view_template; - image = depth; + color = { + @inherit = $properties.flat_color_view_template; + image = color; + format = $properties.images.color.format; + }; +}; +framebuffer = { + renderPass = $properties.renderpass; + attachment = ($output.view, depth); + width = $output.extent.width; + height = $output.extent.height; + layers = 1; +}; +framebuffer_msaa = { + renderPass = $properties.renderpass_msaa; + attachment = ($output.view, depth, color); + width = $output.extent.width; + height = $output.extent.height; + layers = 1; +}; +attachment_template = { + samples = 1; + loadOp = dont_care; + storeOp = dont_care; + stencilLoadOp = dont_care; + stencilStoreOp = dont_care; + initialLayout = undefined; + finalLayout = color_attachment_optimal; +}; +renderpass = { + attachments = ( + { + @inherit = $properties.attachment_template; + format = $output.format; + loadOp = clear; + storeOp = store; + finalLayout = present_src_khr; + }, + { + @inherit = $properties.attachment_template; format = $properties.images.depth.format; - subresourceRange = { - aspectMask = depth; + loadOp = clear; + finalLayout = depth_stencil_attachment_optimal; + }, + ); + subpasses = ( + { + pipelineBindPoint = graphics; + colorAttachments = ( + { + attachment = 0; + layout = color_attachment_optimal; + } + ); + depthStencilAttachment = { + attachment = 1; + layout = depth_stencil_attachment_optimal; }; - }; - color = { - @inherit = $properties.flat_color_view_template; - image = color; - format = $properties.images.color.format; - }; - }; - framebuffer = { - renderPass = $properties.renderpass; - attachment = ($output.view, depth); - width = $output.extent.width; - height = $output.extent.height; - layers = 1; - }; - framebuffer_msaa = { - renderPass = $properties.renderpass_msaa; - attachment = ($output.view, depth, color); - width = $output.extent.width; - height = $output.extent.height; - layers = 1; - }; - attachment_template = { - samples = 1; - loadOp = dont_care; - storeOp = dont_care; - stencilLoadOp = dont_care; - stencilStoreOp = dont_care; - initialLayout = undefined; - finalLayout = color_attachment_optimal; - }; - renderpass = { - attachments = ( - { - @inherit = $properties.attachment_template; - format = $output.format; - loadOp = clear; - storeOp = store; - finalLayout = present_src_khr; - }, - { - @inherit = $properties.attachment_template; - format = $properties.images.depth.format; - loadOp = clear; - finalLayout = depth_stencil_attachment_optimal; - }, - ); - subpasses = ( - { - pipelineBindPoint = graphics; - colorAttachments = ( - { - attachment = 0; - layout = color_attachment_optimal; - } - ); - depthStencilAttachment = { - attachment = 1; - layout = depth_stencil_attachment_optimal; - }; - preserveAttachments = (); - }, - ); - dependencies = ( - { - srcSubpass = ~0u; // external - dstSubpass = 0; - srcStageMask = top_of_pipe; - dstStageMask = color_attachment_output; - srcAccessMask = memory_read; - dstAccessMask = color_attachment_write; - dependencyFlags = by_region; - }, - { - srcSubpass = 0; - dstSubpass = ~0u; // external - srcStageMask = color_attachment_output; - dstStageMask = bottom_of_pipe; - srcAccessMask = color_attachment_write; - dstAccessMask = memory_read; - dependencyFlags = by_region; - }, - ); - }; - renderpass_msaa = { - attachments = ( - { - @inherit = $properties.attachment_template; - format = $output.format; - storeOp = store; - finalLayout = present_src_khr; - }, - { - @inherit = $properties.attachment_template; - format = $properties.images.depth.format; - samples = $msaaSamples; - loadOp = clear; - storeOp = dont_care; - finalLayout = depth_stencil_attachment_optimal; - }, - { - @inherit = $properties.attachment_template; - format = $swapchain.format; - samples = $msaaSamples; - loadOp = clear; - storeOp = store;// dont_care? - finalLayout = color_attachment_optimal; - }, - ); - subpasses = ( - { - pipelineBindPoint = graphics; - colorAttachments = ( - { - attachment = 2; - layout = color_attachment_optimal; - } - ); - resolveAttachments = ( - { - attachment = 0; - layout = color_attachment_optimal; - } - ); - depthStencilAttachment = { - attachment = 1; - layout = depth_stencil_attachment_optimal; - }; - preserveAttachments = (); - }, - ); - dependencies = ( - { - srcSubpass = ~0u; // external - dstSubpass = 0; - srcStageMask = top_of_pipe; - dstStageMask = color_attachment_output; - srcAccessMask = memory_read; - dstAccessMask = color_attachment_write; - dependencyFlags = by_region; - }, - { - srcSubpass = 0; - dstSubpass = ~0u; // external - srcStageMask = color_attachment_output; - dstStageMask = bottom_of_pipe; - srcAccessMask = color_attachment_write; - dstAccessMask = memory_read; - dependencyFlags = by_region; - }, - ); - }; -} + preserveAttachments = (); + }, + ); + dependencies = ( + { + srcSubpass = ~0u; // external + dstSubpass = 0; + srcStageMask = top_of_pipe; + dstStageMask = color_attachment_output; + srcAccessMask = memory_read; + dstAccessMask = color_attachment_write; + dependencyFlags = by_region; + }, + { + srcSubpass = 0; + dstSubpass = ~0u; // external + srcStageMask = color_attachment_output; + dstStageMask = bottom_of_pipe; + srcAccessMask = color_attachment_write; + dstAccessMask = memory_read; + dependencyFlags = by_region; + }, + ); +}; +renderpass_msaa = { + attachments = ( + { + @inherit = $properties.attachment_template; + format = $output.format; + storeOp = store; + finalLayout = present_src_khr; + }, + { + @inherit = $properties.attachment_template; + format = $properties.images.depth.format; + samples = $msaaSamples; + loadOp = clear; + storeOp = dont_care; + finalLayout = depth_stencil_attachment_optimal; + }, + { + @inherit = $properties.attachment_template; + format = $swapchain.format; + samples = $msaaSamples; + loadOp = clear; + storeOp = store;// dont_care? + finalLayout = color_attachment_optimal; + }, + ); + subpasses = ( + { + pipelineBindPoint = graphics; + colorAttachments = ( + { + attachment = 2; + layout = color_attachment_optimal; + } + ); + resolveAttachments = ( + { + attachment = 0; + layout = color_attachment_optimal; + } + ); + depthStencilAttachment = { + attachment = 1; + layout = depth_stencil_attachment_optimal; + }; + preserveAttachments = (); + }, + ); + dependencies = ( + { + srcSubpass = ~0u; // external + dstSubpass = 0; + srcStageMask = top_of_pipe; + dstStageMask = color_attachment_output; + srcAccessMask = memory_read; + dstAccessMask = color_attachment_write; + dependencyFlags = by_region; + }, + { + srcSubpass = 0; + dstSubpass = ~0u; // external + srcStageMask = color_attachment_output; + dstStageMask = bottom_of_pipe; + srcAccessMask = color_attachment_write; + dstAccessMask = memory_read; + dependencyFlags = by_region; + }, + ); +}; diff --git a/libs/video/renderer/vulkan/rp_main_def.plist b/libs/video/renderer/vulkan/rp_main_def.plist index 73b6be1b5..99e67b79f 100644 --- a/libs/video/renderer/vulkan/rp_main_def.plist +++ b/libs/video/renderer/vulkan/rp_main_def.plist @@ -1,4 +1,3 @@ -{ properties = { color = { bsp = "[0.0, 0.5, 0.6, 1]"; @@ -1161,4 +1160,3 @@ renderpasses = { }); }; }; -}; diff --git a/libs/video/renderer/vulkan/rp_output.plist b/libs/video/renderer/vulkan/rp_output.plist index f36286299..86e27a6f3 100644 --- a/libs/video/renderer/vulkan/rp_output.plist +++ b/libs/video/renderer/vulkan/rp_output.plist @@ -1,49 +1,47 @@ -{ - framebuffer = { - renderPass = output; - attachments = ($output.view); - width = $output.extent.width; - height = $output.extent.height; - layers = 1; - }; - clearValues = ( - { color = "[0, 0, 0, 1]"; }, // output +framebuffer = { + renderPass = output; + attachments = ($output.view); + width = $output.extent.width; + height = $output.extent.height; + layers = 1; +}; +clearValues = ( + { color = "[0, 0, 0, 1]"; }, // output +); +attachment_template = { + samples = 1; + loadOp = dont_care; + storeOp = dont_care; + stencilLoadOp = dont_care; + stencilStoreOp = dont_care; + initialLayout = undefined; + finalLayout = color_attachment_optimal; +}; +info = { + color = "[0.9, 0.9, 0.9, 1]"; + subpass_info = ( + { name = compose; color = "[ 0.9, 0.9, 0.9, 1]" }, ); - attachment_template = { - samples = 1; - loadOp = dont_care; - storeOp = dont_care; - stencilLoadOp = dont_care; - stencilStoreOp = dont_care; - initialLayout = undefined; - finalLayout = color_attachment_optimal; - }; - info = { - color = "[0.9, 0.9, 0.9, 1]"; - subpass_info = ( - { name = compose; color = "[ 0.9, 0.9, 0.9, 1]" }, - ); - }; - renderpass = { - attachments = ( - { - @inherit = $properties.attachment_template; - format = $output.format; - loadOp = clear; - storeOp = store; - finalLayout = present_src_khr; - }, - ); - subpasses = ( - { // 0 output - pipelineBindPoint = graphics; - colorAttachments = ( - { // output - attachment = 0; - layout = color_attachment_optimal; - }, - ); - }, - ); - }; -} +}; +renderpass = { + attachments = ( + { + @inherit = $properties.attachment_template; + format = $output.format; + loadOp = clear; + storeOp = store; + finalLayout = present_src_khr; + }, + ); + subpasses = ( + { // 0 output + pipelineBindPoint = graphics; + colorAttachments = ( + { // output + attachment = 0; + layout = color_attachment_optimal; + }, + ); + }, + ); +}; diff --git a/libs/video/renderer/vulkan/rp_shadow.plist b/libs/video/renderer/vulkan/rp_shadow.plist index e2f6e5778..f56ad2270 100644 --- a/libs/video/renderer/vulkan/rp_shadow.plist +++ b/libs/video/renderer/vulkan/rp_shadow.plist @@ -1,52 +1,50 @@ -{ - clearValues = ( - { depthStencil = { depth = 1; stencil = 0; }; }, +clearValues = ( + { depthStencil = { depth = 1; stencil = 0; }; }, +); +info = { + color = "[0.2, 0.2, 0.2, 1]"; + subpass_info = ( + { name = depth; color = "[ 0.5, 0.5, 0.5, 1]" }, ); - info = { - color = "[0.2, 0.2, 0.2, 1]"; - subpass_info = ( - { name = depth; color = "[ 0.5, 0.5, 0.5, 1]" }, - ); - }; - renderpass_base = { - attachments = ( - { - format = $output.format; - samples = 1; - loadOp = dont_care; - storeOp = store; - stencilLoadOp = dont_care; - stencilStoreOp = dont_care; - initialLayout = undefined; - finalLayout = shader_read_only_optimal; - }, - ); - subpasses = ( - { // 0 depth - pipelineBindPoint = graphics; - depthStencilAttachment = { - attachment = 0; - layout = depth_stencil_attachment_optimal; - }; - } - ); - }; - renderpass_6 = { - @inherit = $properties.renderpass_base; - @next = (VkRenderPassMultiviewCreateInfo, { - viewMasks = (0x0000003fu); - }); - }; - renderpass_4 = { - @inherit = $properties.renderpass_base; - @next = (VkRenderPassMultiviewCreateInfo, { - viewMasks = (0x0000000fu); - }); - }; - renderpass_1 = { - @inherit = $properties.renderpass_base; - @next = (VkRenderPassMultiviewCreateInfo, { - viewMasks = (0x00000001u); - }); - }; -} +}; +renderpass_base = { + attachments = ( + { + format = $output.format; + samples = 1; + loadOp = dont_care; + storeOp = store; + stencilLoadOp = dont_care; + stencilStoreOp = dont_care; + initialLayout = undefined; + finalLayout = shader_read_only_optimal; + }, + ); + subpasses = ( + { // 0 depth + pipelineBindPoint = graphics; + depthStencilAttachment = { + attachment = 0; + layout = depth_stencil_attachment_optimal; + }; + } + ); +}; +renderpass_6 = { + @inherit = $properties.renderpass_base; + @next = (VkRenderPassMultiviewCreateInfo, { + viewMasks = (0x0000003fu); + }); +}; +renderpass_4 = { + @inherit = $properties.renderpass_base; + @next = (VkRenderPassMultiviewCreateInfo, { + viewMasks = (0x0000000fu); + }); +}; +renderpass_1 = { + @inherit = $properties.renderpass_base; + @next = (VkRenderPassMultiviewCreateInfo, { + viewMasks = (0x00000001u); + }); +}; diff --git a/libs/video/renderer/vulkan/vkparse.c b/libs/video/renderer/vulkan/vkparse.c index e771b8759..23ac80d3f 100644 --- a/libs/video/renderer/vulkan/vkparse.c +++ b/libs/video/renderer/vulkan/vkparse.c @@ -1960,7 +1960,7 @@ build_configs (scriptctx_t *sctx) builtin_plists = malloc (num_plists * sizeof (plitem_t *)); num_plists = 0; for (exprsym_t *sym = builtin_plist_syms; sym->name; sym++) { - plitem_t *item = PL_GetPropertyList (sym->value, &sctx->hashctx); + plitem_t *item = PL_GetDictionary (sym->value, &sctx->hashctx); if (!item) { // Syntax errors in the compiled-in plists are unrecoverable Sys_Error ("Error parsing plist for %s", sym->name);