# HG changeset patch # User sam # Date 1722258544 -25200 # Node ID feb52b1c18e02f4de502aeec4f9bee36308e88d2 # Parent 0369fa1ffbd9c539342405a9d4030f224e4a12fc fixing stuff diff -r 0369fa1ffbd9 -r feb52b1c18e0 semicongine/rendering/renderer.nim --- a/semicongine/rendering/renderer.nim Mon Jul 29 16:50:50 2024 +0700 +++ b/semicongine/rendering/renderer.nim Mon Jul 29 20:09:04 2024 +0700 @@ -638,8 +638,9 @@ for attrName, attrValue in default(TShader).fieldPairs(): if attrValue.hasCustomPragma(DescriptorSets): hasDescriptorSets = true - if hasDescriptorSets: - assert hasBoundDescriptorSets, "Shader uses descriptor sets, but none are bound" + # TODO: fix this, not working as intended, seems to depend on scope + # if hasDescriptorSets: + # assert hasBoundDescriptorSets, "Shader uses descriptor sets, but none are bound" var vertexBuffers: seq[VkBuffer] var vertexBuffersOffsets: seq[uint64] diff -r 0369fa1ffbd9 -r feb52b1c18e0 semicongine/rendering/shaders.nim --- a/semicongine/rendering/shaders.nim Mon Jul 29 16:50:50 2024 +0700 +++ b/semicongine/rendering/shaders.nim Mon Jul 29 20:09:04 2024 +0700 @@ -163,7 +163,7 @@ elif hasCustomPragma(value, DescriptorSets): assert not sawDescriptorSets, "Only one field with pragma DescriptorSets allowed per shader" assert typeof(value) is tuple, "Descriptor field '" & fieldname & "' must be of type tuple" - assert tupleLen(typeof(value)) <= MAX_DESCRIPTORSETS, typetraits.name(TShader) & ": maximum " & $MAX_DESCRIPTORSETS & " allowed" + assert tupleLen(value) <= MAX_DESCRIPTORSETS, typetraits.name(TShader) & ": maximum " & $MAX_DESCRIPTORSETS & " allowed" sawDescriptorSets = true var descriptorSetIndex = 0 for descriptor in value.fields: @@ -224,7 +224,9 @@ pushConstants.add " " & glslType(constFieldValue) & " " & constFieldName & ";" pushConstants.add "} " & fieldname & ";" else: - {.error: "Unsupported shader field '" & typetraits.name(TShader) & "." & fieldname & "' of type " & typetraits.name(typeof(value)).} + static: + echo "Unsupported shader field '" & typetraits.name(TShader) & "." & fieldname & "' of type " & typetraits.name(typeof(value)) + {.error: "Unsupported shader field".} result[0] = (@[&"#version {GLSL_VERSION}", "#extension GL_EXT_scalar_block_layout : require", ""] & vsInput & @@ -528,6 +530,9 @@ addr(result.vk) ) +func layout*(pipeline: Pipeline, level: int): VkDescriptorSetLayout = + pipeline.descriptorSetLayouts[level] + template withPipeline*(commandbuffer: VkCommandBuffer, pipeline: Pipeline, body: untyped): untyped = block: vkCmdBindPipeline(commandbuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline.vk)