Mercurial > games > semicongine
diff semiconginev2/rendering/renderer.nim @ 1252:01e9f41d35b1
add:support for push constants
author | sam <sam@basx.dev> |
---|---|
date | Fri, 26 Jul 2024 23:04:01 +0700 |
parents | c15770761865 |
children | c4f98eb4bb05 |
line wrap: on
line diff
--- a/semiconginev2/rendering/renderer.nim Fri Jul 26 20:34:02 2024 +0700 +++ b/semiconginev2/rendering/renderer.nim Fri Jul 26 23:04:01 2024 +0700 @@ -670,6 +670,38 @@ ) = Render(commandBuffer, pipeline, mesh, EMPTY()) +proc RenderWithPushConstant*[TShader, TMesh, TInstance, TPushConstant]( + commandBuffer: VkCommandBuffer, + pipeline: Pipeline[TShader], + mesh: TMesh, + instances: TInstance, + pushConstant: TPushConstant, +) = + vkCmdPushConstants( + commandBuffer = commandBuffer, + layout = pipeline.layout, + stageFlags = VkShaderStageFlags(VK_SHADER_STAGE_ALL_GRAPHICS), + offset = 0, + size = 128, + pValues = addr(pushConstant) + ); + Render(commandBuffer, pipeline, mesh, instances) +proc RenderWithPushConstant*[TShader, TMesh, TPushConstant]( + commandBuffer: VkCommandBuffer, + pipeline: Pipeline[TShader], + mesh: TMesh, + pushConstant: TPushConstant, +) = + vkCmdPushConstants( + commandBuffer = commandBuffer, + layout = pipeline.layout, + stageFlags = VkShaderStageFlags(VK_SHADER_STAGE_ALL_GRAPHICS), + offset = 0, + size = 128, + pValues = addr(pushConstant) + ); + Render(commandBuffer, pipeline, mesh, EMPTY()) + proc asGPUArray*[T](data: openArray[T], bufferType: static BufferType): auto = GPUArray[T, bufferType](data: @data)