# HG changeset patch # User Sam # Date 1709991008 -25200 # Node ID 9e621b1116b9fa418204d971040e85335717aec0 # Parent ab406a0d1551ece383d63a0de63c731aa70d8df2 fix: error in descriptors, wait for gpu before cleaning up diff -r ab406a0d1551 -r 9e621b1116b9 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