changeset 1346:e6fdd7327847

add: option to bind descriptor without pipeline, but only pipeline layout
author sam <sam@basx.dev>
date Tue, 27 Aug 2024 19:53:24 +0700
parents 34832174824b
children 6e94b1717d3a
files semicongine/rendering/renderer.nim
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/semicongine/rendering/renderer.nim	Mon Aug 26 23:04:50 2024 +0700
+++ b/semicongine/rendering/renderer.nim	Tue Aug 27 19:53:24 2024 +0700
@@ -597,19 +597,25 @@
           "Incompatible descriptor set types for set number " & $index & " in shader " &
             name(TShader)
 
+proc bindDescriptorSet*[TDescriptorSet](
+    commandBuffer: VkCommandBuffer,
+    descriptorSet: DescriptorSetData[TDescriptorSet],
+    index: static DescriptorSetIndex,
+    layout: VkPipelineLayout,
+) =
+  assert descriptorSet.vk[currentFiF()].Valid,
+    "DescriptorSetData not initialized, maybe forgot to call initDescriptorSet"
+  svkCmdBindDescriptorSet(commandBuffer, descriptorSet.vk[currentFiF()], index, layout)
+
 proc bindDescriptorSet*[TDescriptorSet, TShader](
     commandBuffer: VkCommandBuffer,
     descriptorSet: DescriptorSetData[TDescriptorSet],
     index: static DescriptorSetIndex,
     pipeline: Pipeline[TShader],
 ) =
-  assert descriptorSet.vk[currentFiF()].Valid,
-    "DescriptorSetData not initialized, maybe forgot to call initDescriptorSet"
   static:
     assertCompatibleDescriptorSet(TDescriptorSet, TShader, index)
-  svkCmdBindDescriptorSet(
-    commandBuffer, descriptorSet.vk[currentFiF()], index, pipeline.layout
-  )
+  bindDescriptorSet(commandBuffer, descriptorSet, index, pipeline.layout)
 
 proc assertCanRenderMesh(TShader, TMesh, TInstance: typedesc) =
   for attrName, attrValue in default(TShader).fieldPairs: