Mercurial > games > semicongine
comparison 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 |
comparison
equal
deleted
inserted
replaced
1251:3f98ad20a9d3 | 1252:01e9f41d35b1 |
---|---|
668 pipeline: Pipeline[TShader], | 668 pipeline: Pipeline[TShader], |
669 mesh: TMesh, | 669 mesh: TMesh, |
670 ) = | 670 ) = |
671 Render(commandBuffer, pipeline, mesh, EMPTY()) | 671 Render(commandBuffer, pipeline, mesh, EMPTY()) |
672 | 672 |
673 proc RenderWithPushConstant*[TShader, TMesh, TInstance, TPushConstant]( | |
674 commandBuffer: VkCommandBuffer, | |
675 pipeline: Pipeline[TShader], | |
676 mesh: TMesh, | |
677 instances: TInstance, | |
678 pushConstant: TPushConstant, | |
679 ) = | |
680 vkCmdPushConstants( | |
681 commandBuffer = commandBuffer, | |
682 layout = pipeline.layout, | |
683 stageFlags = VkShaderStageFlags(VK_SHADER_STAGE_ALL_GRAPHICS), | |
684 offset = 0, | |
685 size = 128, | |
686 pValues = addr(pushConstant) | |
687 ); | |
688 Render(commandBuffer, pipeline, mesh, instances) | |
689 proc RenderWithPushConstant*[TShader, TMesh, TPushConstant]( | |
690 commandBuffer: VkCommandBuffer, | |
691 pipeline: Pipeline[TShader], | |
692 mesh: TMesh, | |
693 pushConstant: TPushConstant, | |
694 ) = | |
695 vkCmdPushConstants( | |
696 commandBuffer = commandBuffer, | |
697 layout = pipeline.layout, | |
698 stageFlags = VkShaderStageFlags(VK_SHADER_STAGE_ALL_GRAPHICS), | |
699 offset = 0, | |
700 size = 128, | |
701 pValues = addr(pushConstant) | |
702 ); | |
703 Render(commandBuffer, pipeline, mesh, EMPTY()) | |
704 | |
673 proc asGPUArray*[T](data: openArray[T], bufferType: static BufferType): auto = | 705 proc asGPUArray*[T](data: openArray[T], bufferType: static BufferType): auto = |
674 GPUArray[T, bufferType](data: @data) | 706 GPUArray[T, bufferType](data: @data) |
675 | 707 |
676 proc asGPUValue*[T](data: T, bufferType: static BufferType): auto = | 708 proc asGPUValue*[T](data: T, bufferType: static BufferType): auto = |
677 GPUValue[T, bufferType](data: data) | 709 GPUValue[T, bufferType](data: data) |