Mercurial > games > semicongine
changeset 1349:cee8348fe7d7
add: parameter to set instance count for rendering
author | sam <sam@basx.dev> |
---|---|
date | Sat, 07 Sep 2024 21:23:16 +0700 |
parents | 55c7aac521e3 |
children | 6646270a6032 |
files | semicongine/rendering/renderer.nim |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/semicongine/rendering/renderer.nim Sat Aug 31 22:57:33 2024 +0700 +++ b/semicongine/rendering/renderer.nim Sat Sep 07 21:23:16 2024 +0700 @@ -735,8 +735,9 @@ pipeline: Pipeline[TShader], mesh: TMesh, fixedVertexCount = -1, + fixedInstanceCount = -1, ) = - render(commandBuffer, pipeline, mesh, EMPTY(), fixedVertexCount) + render(commandBuffer, pipeline, mesh, EMPTY(), fixedVertexCount, fixedInstanceCount) proc assertValidPushConstantType(TShader, TPushConstant: typedesc) = assert sizeof(TPushConstant) <= PUSH_CONSTANT_SIZE, @@ -757,6 +758,7 @@ instances: TInstance, pushConstant: TPushConstant, fixedVertexCount = -1, + fixedInstanceCount = -1, ) = static: assertValidPushConstantType(TShader, TPushConstant) @@ -768,7 +770,7 @@ size = alignedTo(sizeof(pushConstant).uint32, 4), pValues = addr(pushConstant), ) - render(commandBuffer, pipeline, mesh, instances, fixedVertexCount) + render(commandBuffer, pipeline, mesh, instances, fixedVertexCount, fixedInstanceCount) proc renderWithPushConstant*[TShader, TMesh, TPushConstant]( commandBuffer: VkCommandBuffer, @@ -776,6 +778,7 @@ mesh: TMesh, pushConstant: TPushConstant, fixedVertexCount = -1, + fixedInstanceCount = -1, ) = static: assertValidPushConstantType(TShader, TPushConstant) @@ -787,7 +790,7 @@ size = sizeof(pushConstant).uint32, pValues = addr(pushConstant), ) - render(commandBuffer, pipeline, mesh, EMPTY(), fixedVertexCount) + render(commandBuffer, pipeline, mesh, EMPTY(), fixedVertexCount, fixedInstanceCount) proc asGPUArray*[T](data: sink openArray[T], bufferType: static BufferType): auto = GPUArray[T, bufferType](data: @data)