# HG changeset patch # User sam # Date 1712073999 -25200 # Node ID 9d3f6d742e6507f0aea9373c5e81f39325f1eef0 # Parent 7855746f2d13193fe61ea8b30fe1a9ac39752425 add: some more debug log diff -r 7855746f2d13 -r 9d3f6d742e65 semicongine/engine.nim --- a/semicongine/engine.nim Tue Apr 02 22:02:44 2024 +0700 +++ b/semicongine/engine.nim Tue Apr 02 23:06:39 2024 +0700 @@ -154,6 +154,7 @@ checkVkResult engine.device.vk.vkDeviceWaitIdle() proc loadScene*(engine: var Engine, scene: var Scene) = + debug &"start loading scene '{scene.name}'" assert engine.renderer.isSome assert not scene.loaded checkVkResult engine.device.vk.vkDeviceWaitIdle() @@ -162,11 +163,11 @@ engine.renderer.get.updateMeshData(scene, forceAll = true) engine.renderer.get.updateUniformData(scene, forceAll = true) checkVkResult engine.device.vk.vkDeviceWaitIdle() + debug &"done loading scene '{scene.name}'" proc unloadScene*(engine: var Engine, scene: Scene) = - checkVkResult engine.device.vk.vkDeviceWaitIdle() + debug &"unload scene '{scene.name}'" engine.renderer.get.destroy(scene) - checkVkResult engine.device.vk.vkDeviceWaitIdle() proc renderScene*(engine: var Engine, scene: var Scene) = assert engine.state == Running diff -r 7855746f2d13 -r 9d3f6d742e65 semicongine/vulkan/drawable.nim --- a/semicongine/vulkan/drawable.nim Tue Apr 02 22:02:44 2024 +0700 +++ b/semicongine/vulkan/drawable.nim Tue Apr 02 23:06:39 2024 +0700 @@ -25,16 +25,18 @@ &"Drawable({drawable.name}, elementCount: {drawable.elementCount}, instanceCount: {drawable.instanceCount}, bufferOffsets: {drawable.bufferOffsets})" proc draw*(drawable: Drawable, commandBuffer: VkCommandBuffer, vertexBuffers: Table[MemoryPerformanceHint, Buffer], indexBuffer: Buffer, pipeline: VkPipeline) = - debug "Draw ", drawable + debug "Draw {drawable} with pipeline {pipeline}" + debug "Vertex buffers ", vertexBuffers var buffers: seq[VkBuffer] var offsets: seq[VkDeviceSize] - for (name, performanceHint, offset) in drawable.bufferOffsets[pipeline]: + assert vertexBuffers[performanceHint].vk.valid buffers.add vertexBuffers[performanceHint].vk offsets.add VkDeviceSize(offset) + debug "Binding buffers: ", buffers commandBuffer.vkCmdBindVertexBuffers( firstBinding = 0'u32, bindingCount = uint32(buffers.len), @@ -42,6 +44,7 @@ pOffsets = offsets.toCPointer() ) if drawable.indexed: + assert indexBuffer.vk.valid commandBuffer.vkCmdBindIndexBuffer(indexBuffer.vk, VkDeviceSize(drawable.indexBufferOffset), drawable.indexType) commandBuffer.vkCmdDrawIndexed( indexCount = uint32(drawable.elementCount),