Mercurial > games > semicongine
changeset 910:c62f7947d371
fix: error in descriptors, wait for gpu before cleaning up
author | Sam <sam@basx.dev> |
---|---|
date | Sat, 09 Mar 2024 20:30:08 +0700 |
parents | f4bc149a385c |
children | 0a1e68f32fca |
files | semicongine/renderer.nim |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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