# HG changeset patch # User Sam # Date 1709991008 -25200 # Node ID c62f7947d371b1c5053fe5898b2335f77b9e0207 # Parent f4bc149a385ce9a715a73d156168136c7e1894eb fix: error in descriptors, wait for gpu before cleaning up diff -r f4bc149a385c -r c62f7947d371 semicongine/renderer.nim --- a/semicongine/renderer.nim Sat Mar 09 16:45:57 2024 +0700 +++ b/semicongine/renderer.nim Sat Mar 09 20:30:08 2024 +0700 @@ -300,7 +300,8 @@ for descriptor in shaderPipeline.descriptorSetLayout.descriptors: if descriptor.thetype == ImageSampler: nTextures += descriptor.count - poolsizes.add (VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, nTextures * renderer.swapchain.inFlightFrames) + if nTextures > 0: + poolsizes.add (VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, nTextures * renderer.swapchain.inFlightFrames) scenedata.descriptorPools[shaderPipeline.vk] = renderer.device.createDescriptorSetPool(poolsizes) scenedata.descriptorSets[shaderPipeline.vk] = shaderPipeline.setupDescriptors( @@ -450,8 +451,8 @@ renderer.device.vk.valid proc destroy*(renderer: var Renderer, scene: Scene) = + checkVkResult renderer.device.vk.vkDeviceWaitIdle() var scenedata = renderer.scenedata[scene] - for buffer in scenedata.vertexBuffers.mvalues: assert buffer.vk.valid buffer.destroy() @@ -474,6 +475,7 @@ renderer.scenedata.del(scene) proc destroy*(renderer: var Renderer) = + checkVkResult renderer.device.vk.vkDeviceWaitIdle() for scenedata in renderer.scenedata.mvalues: for buffer in scenedata.vertexBuffers.mvalues: assert buffer.vk.valid