# HG changeset patch # User sam # Date 1740824867 -25200 # Node ID b17098eb052f61616bcc17a83502d400d67be139 # Parent ee9bc0f47f41a9b8811c00a3db69b1703a4420ce did: adjust a few types diff -r ee9bc0f47f41 -r b17098eb052f semicongine/rendering/renderer.nim --- a/semicongine/rendering/renderer.nim Sat Mar 01 10:53:47 2025 +0700 +++ b/semicongine/rendering/renderer.nim Sat Mar 01 17:27:47 2025 +0700 @@ -268,8 +268,8 @@ pipeline: Pipeline[TShader], mesh: TMesh, instances: TInstance, - fixedVertexCount = -1, - fixedInstanceCount = -1, + fixedVertexCount = high(uint32), + fixedInstanceCount = high(uint32), ) = debug("render ", name(TShader)) static: @@ -343,23 +343,30 @@ if indexType != VK_INDEX_TYPE_NONE_KHR: debug " indexed (", elementCount, ")" vkCmdBindIndexBuffer(commandBuffer, indexBuffer, indexBufferOffset, indexType) + let instanceCount = + if fixedInstanceCount == high(uint32): instanceCount else: fixedInstanceCount + if instanceCount > 1: + debug " ", instanceCount, " instances" vkCmdDrawIndexed( commandBuffer = commandBuffer, indexCount = elementCount, - instanceCount = - if fixedInstanceCount == -1: instanceCount else: fixedInstanceCount.uint32, + instanceCount = instanceCount, firstIndex = 0, vertexOffset = 0, firstInstance = 0, ) else: debug " non-indexed (", - if fixedVertexCount < 0: elementCount else: fixedVertexCount.uint32, ")" + if fixedVertexCount == high(uint32): elementCount else: fixedVertexCount, ")" + let instanceCount = + if fixedInstanceCount == high(uint32): instanceCount else: fixedInstanceCount + if instanceCount > 1: + debug " ", instanceCount, " instances" vkCmdDraw( commandBuffer = commandBuffer, - vertexCount = if fixedVertexCount < 0: elementCount else: fixedVertexCount.uint32, - instanceCount = - if fixedInstanceCount == -1: instanceCount else: fixedInstanceCount.uint32, + vertexCount = + if fixedVertexCount == high(uint32): elementCount else: fixedVertexCount, + instanceCount = instanceCount, firstVertex = 0, firstInstance = 0, ) @@ -368,8 +375,8 @@ commandBuffer: VkCommandBuffer, pipeline: Pipeline[TShader], mesh: TMesh, - fixedVertexCount = -1, - fixedInstanceCount = -1, + fixedVertexCount = high(uint32), + fixedInstanceCount = high(uint32), ) = render(commandBuffer, pipeline, mesh, EMPTY(), fixedVertexCount, fixedInstanceCount) @@ -391,8 +398,8 @@ mesh: TMesh, instances: TInstance, pushConstant: TPushConstant, - fixedVertexCount = -1, - fixedInstanceCount = -1, + fixedVertexCount = high(uint32), + fixedInstanceCount = high(uint32), ) = static: assertValidPushConstantType(TShader, TPushConstant) @@ -411,8 +418,8 @@ pipeline: Pipeline[TShader], mesh: TMesh, pushConstant: TPushConstant, - fixedVertexCount = -1, - fixedInstanceCount = -1, + fixedVertexCount = high(uint32), + fixedInstanceCount = high(uint32), ) = static: assertValidPushConstantType(TShader, TPushConstant) diff -r ee9bc0f47f41 -r b17098eb052f semicongine/text.nim --- a/semicongine/text.nim Sat Mar 01 10:53:47 2025 +0700 +++ b/semicongine/text.nim Sat Mar 01 17:27:47 2025 +0700 @@ -268,5 +268,5 @@ textbuffer, pushConstant = TextRendering(aspectRatio: getAspectRatio()), fixedVertexCount = 6, - fixedInstanceCount = textbuffer.cursor, + fixedInstanceCount = textbuffer.cursor.uint32, )