Avokadoen / zig_vulkan

Toying with vulkan and zig
45 stars 2 forks source link

Panic if bounce count and sampling is high #107

Closed Avokadoen closed 2 years ago

Avokadoen commented 2 years ago

The program panics if bounce count and sampling is high. This is mostly a performance issue as it seems like the shader is not capable of finishing in acceptable time and so vulkan terminates the device. There is also probably some issues with how compute synchronization is handled by the application

Zig error trace & validation errors:

waiting for fence failed: error.DeviceLostvalidation layer: Validation Error: [ VUID-vkResetFences-pFences-01123 ] Object 0: handle = 0xfb17b5000000006b, type = VK_OBJECT_TYPE_FENCE; | MessageID = 0x68a5074e | VkFence 0xfb17b5000000006b[] is in use. The Vulkan spec states: Each element of pFences must not be currently associated with any queue command that has not yet completed execution on that queue (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkResetFences-pFences-01123)
validation layer: Validation Error: [ VUID-vkQueueSubmit-pCommandBuffers-00071 ] Object 0: handle = 0x26bf170c060, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x2e2f4d65 | vkQueueSubmit(): pSubmits[0].pCommandBuffers[0] VkCommandBuffer 0x26bf62790e0[] is already in use and is not marked for simultaneous use. The Vulkan spec states: If any element of the pCommandBuffers member of any element of pSubmits was not recorded with the VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT, it must not be in the pending state (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkQueueSubmit-pCommandBuffers-00071)
waiting for fence failed: error.DeviceLostvalidation layer: Validation Error: [ VUID-vkDestroySemaphore-semaphore-01137 ] Object 0: handle = 0x26bf170c060, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xa1569838 | Cannot call vkDestroySemaphore on VkSemaphore 0xc90b70000000004f[] that is currently in use by a command buffer. The Vulkan spec states: All submitted batches that refer to semaphore must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkDestroySemaphore-semaphore-01137)
validation layer: Validation Error: [ VUID-vkDestroyFence-fence-01120 ] Object 0: handle = 0x4cfa370000000050, type = VK_OBJECT_TYPE_FENCE; | MessageID = 0x5d296248 | VkFence 0x4cfa370000000050[] is in use. The Vulkan spec states: All queue submission commands that refer to fence must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkDestroyFence-fence-01120)
validation layer: Validation Error: [ VUID-vkDestroyBuffer-buffer-00922 ] Object 0: handle = 0x11e7eb0000000045, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0xe4549c11 | Cannot free VkBuffer 0x11e7eb0000000045[] that is in use by a command buffer. The Vulkan spec states: All submitted commands that refer to buffer, either directly or via a VkBufferView, must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkDestroyBuffer-buffer-00922)
validation layer: Validation Error: [ VUID-vkFreeMemory-memory-00677 ] Object 0: handle = 0x26bf170c060, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x485c8ea2 | Cannot call vkFreeMemory on VkDeviceMemory 0xbaf5110000000046[] that is currently in use by a command buffer. The Vulkan spec states: All submitted commands that refer to memory (via images or buffers) must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkFreeMemory-memory-00677)
validation layer: Validation Error: [ VUID-vkDestroyBuffer-buffer-00922 ] Object 0: handle = 0x83becb0000000049, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0xe4549c11 | Cannot free VkBuffer 0x83becb0000000049[] that is in use by a command buffer. The Vulkan spec states: All submitted commands that refer to buffer, either directly or via a VkBufferView, must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkDestroyBuffer-buffer-00922)
validation layer: Validation Error: [ VUID-vkFreeMemory-memory-00677 ] Object 0: handle = 0x26bf170c060, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x485c8ea2 | Cannot call vkFreeMemory on VkDeviceMemory 0xf19131000000004a[] that is currently in use by a command buffer. The Vulkan spec states: All submitted commands that refer to memory (via images or buffers) must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkFreeMemory-memory-00677)
validation layer: Validation Error: [ VUID-vkDestroyFramebuffer-framebuffer-00892 ] Object 0: handle = 0x26bf170c060, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xdb308312 | Cannot call vkDestroyFramebuffer on VkFramebuffer 0x95cebe0000000040[] that is currently in use by a command buffer. The Vulkan spec states: All submitted commands that refer to framebuffer must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkDestroyFramebuffer-framebuffer-00892)
validation layer: Validation Error: [ VUID-vkDestroyRenderPass-renderPass-00873 ] Object 0: handle = 0x26bf170c060, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x473619ad | Cannot call vkDestroyRenderPass on VkRenderPass 0xd5e9a7000000003c[] that is currently in use by a command buffer. The Vulkan spec states: All submitted commands that refer to renderPass must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkDestroyRenderPass-renderPass-00873)
validation layer: Validation Error: [ VUID-vkDestroyPipeline-pipeline-00765 ] Object 0: handle = 0x26bf170c060, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6bdce5fd | Cannot call vkDestroyPipeline on VkPipeline 0x3ad55c000000003f[] that is currently in use by a command buffer. The Vulkan spec states: All submitted commands that refer to pipeline must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkDestroyPipeline-pipeline-00765)
validation layer: Validation Error: [ VUID-vkDestroySampler-sampler-01082 ] Object 0: handle = 0x26bf170c060, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xcca99934 | Cannot call vkDestroySampler on VkSampler 0x8e52990000000013[] that is currently in use by a command buffer. The Vulkan spec states: All submitted commands that refer to sampler must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkDestroySampler-sampler-01082)
validation layer: Validation Error: [ VUID-vkDestroyImageView-imageView-01026 ] Object 0: handle = 0x26bf170c060, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x63ac21f0 | Cannot call vkDestroyImageView on VkImageView 0x6614340000000012[] that is currently in use by a command buffer. The Vulkan spec states: All submitted commands that refer to imageView must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkDestroyImageView-imageView-01026)
validation layer: Validation Error: [ VUID-vkDestroyImage-image-01000 ] Object 0: handle = 0x26bf170c060, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xf2d29b5a | Cannot call vkDestroyImage on VkImage 0xc689440000000010[] that is currently in use by a command buffer. The Vulkan spec states: All submitted commands that refer to image, either directly or via a VkImageView, must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkDestroyImage-image-01000)
validation layer: Validation Error: [ VUID-vkFreeMemory-memory-00677 ] Object 0: handle = 0x26bf170c060, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x485c8ea2 | Cannot call vkFreeMemory on VkDeviceMemory 0xf3fb360000000011[] that is currently in use by a command buffer. The Vulkan spec states: All submitted commands that refer to memory (via images or buffers) must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkFreeMemory-memory-00677)
validation layer: Validation Error: [ VUID-vkDestroyBuffer-buffer-00922 ] Object 0: handle = 0x1c8ae60000000014, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0xe4549c11 | Cannot free VkBuffer 0x1c8ae60000000014[] that is in use by a command buffer. The Vulkan spec states: All submitted commands that refer to buffer, either directly or via a VkBufferView, must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkDestroyBuffer-buffer-00922)
validation layer: Validation Error: [ VUID-vkFreeMemory-memory-00677 ] Object 0: handle = 0x26bf170c060, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x485c8ea2 | Cannot call vkFreeMemory on VkDeviceMemory 0x9252730000000015[] that is currently in use by a command buffer. The Vulkan spec states: All submitted commands that refer to memory (via images or buffers) must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkFreeMemory-memory-00677)
validation layer: Validation Error: [ VUID-vkDestroyBuffer-buffer-00922 ] Object 0: handle = 0xc9b4ee000000001a, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0xe4549c11 | Cannot free VkBuffer 0xc9b4ee000000001a[] that is in use by a command buffer. The Vulkan spec states: All submitted commands that refer to buffer, either directly or via a VkBufferView, must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkDestroyBuffer-buffer-00922)
validation layer: Validation Error: [ VUID-vkFreeMemory-memory-00677 ] Object 0: handle = 0x26bf170c060, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x485c8ea2 | Cannot call vkFreeMemory on VkDeviceMemory 0xe15aec000000001b[] that is currently in use by a command buffer. The Vulkan spec states: All submitted commands that refer to memory (via images or buffers) must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkFreeMemory-memory-00677)
validation layer: Validation Error: [ VUID-vkDestroyBuffer-buffer-00922 ] Object 0: handle = 0x799352000000001c, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0xe4549c11 | Cannot free VkBuffer 0x799352000000001c[] that is in use by a command buffer. The Vulkan spec states: All submitted commands that refer to buffer, either directly or via a VkBufferView, must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkDestroyBuffer-buffer-00922)
validation layer: Validation Error: [ VUID-vkFreeMemory-memory-00677 ] Object 0: handle = 0x26bf170c060, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x485c8ea2 | Cannot call vkFreeMemory on VkDeviceMemory 0x4dbc9f000000001d[] that is currently in use by a command buffer. The Vulkan spec states: All submitted commands that refer to memory (via images or buffers) must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkFreeMemory-memory-00677)
validation layer: Validation Error: [ VUID-vkDestroyBuffer-buffer-00922 ] Object 0: handle = 0x3b4330000000001e, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0xe4549c11 | Cannot free VkBuffer 0x3b4330000000001e[] that is in use by a command buffer. The Vulkan spec states: All submitted commands that refer to buffer, either directly or via a VkBufferView, must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkDestroyBuffer-buffer-00922)
validation layer: Validation Error: [ VUID-vkFreeMemory-memory-00677 ] Object 0: handle = 0x26bf170c060, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x485c8ea2 | Cannot call vkFreeMemory on VkDeviceMemory 0xd1a8a9000000001f[] that is currently in use by a command buffer. The Vulkan spec states: All submitted commands that refer to memory (via images or buffers) must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkFreeMemory-memory-00677)
validation layer: Validation Error: [ VUID-vkDestroyBuffer-buffer-00922 ] Object 0: handle = 0xee9f7d0000000020, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0xe4549c11 | Cannot free VkBuffer 0xee9f7d0000000020[] that is in use by a command buffer. The Vulkan spec states: All submitted commands that refer to buffer, either directly or via a VkBufferView, must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkDestroyBuffer-buffer-00922)
validation layer: Validation Error: [ VUID-vkFreeMemory-memory-00677 ] Object 0: handle = 0x26bf170c060, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x485c8ea2 | Cannot call vkFreeMemory on VkDeviceMemory 0xa2590f0000000021[] that is currently in use by a command buffer. The Vulkan spec states: All submitted commands that refer to memory (via images or buffers) must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkFreeMemory-memory-00677)
validation layer: Validation Error: [ VUID-vkDestroyBuffer-buffer-00922 ] Object 0: handle = 0x97b7a0000000022, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0xe4549c11 | Cannot free VkBuffer 0x97b7a0000000022[] that is in use by a command buffer. The Vulkan spec states: All submitted commands that refer to buffer, either directly or via a VkBufferView, must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkDestroyBuffer-buffer-00922)
validation layer: Validation Error: [ VUID-vkFreeMemory-memory-00677 ] Object 0: handle = 0x26bf170c060, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x485c8ea2 | Cannot call vkFreeMemory on VkDeviceMemory 0x6401a90000000023[] that is currently in use by a command buffer. The Vulkan spec states: All submitted commands that refer to memory (via images or buffers) must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkFreeMemory-memory-00677)
validation layer: Validation Error: [ VUID-vkDestroyDescriptorPool-descriptorPool-00303 ] Object 0: handle = 0x26bf170c060, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x4dad1ae8 | Cannot call vkDestroyDescriptorPool on VkDescriptorPool 0x3d3145000000000d[] that is currently in use by a command buffer. The Vulkan spec states: All submitted commands that refer to descriptorPool (via any allocated descriptor sets) must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkDestroyDescriptorPool-descriptorPool-00303)
validation layer: Validation Error: [ VUID-vkDestroyImageView-imageView-01026 ] Object 0: handle = 0x26bf170c060, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x63ac21f0 | Cannot call vkDestroyImageView on VkImageView 0xf4f1d50000000009[] that is currently in use by a command buffer. The Vulkan spec states: All submitted commands that refer to imageView must have completed execution (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkDestroyImageView-imageView-01026)
validation layer: Validation Error: [ VUID-vkDestroyCommandPool-commandPool-00041 ] Object 0: handle = 0x26bf61667f0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0xad474cda | Attempt to destroy command pool with VkCommandBuffer 0x26bf61667f0[] which is in use. The Vulkan spec states: All VkCommandBuffer objects allocated from commandPool must not be in the pending state (https://vulkan.lunarg.com/doc/view/1.2.176.1/windows/1.2-extensions/vkspec.html#VUID-vkDestroyCommandPool-commandPool-00041)
error: DeviceLost
C:\repositories\zig_vulkan\zig-cache\vk.zig:17866:45: 0x7ff734b2fcf4 in .vulkan.DeviceWrapper((struct std.enums.struct:24:19 constant))::.vulkan.DeviceWrapper((struct std.enums.struct:24:19 constant)).queueSubmit (zig_vulkan.obj)
                Result.error_device_lost => return error.DeviceLost,
                                            ^
C:\repositories\zig_vulkan\src\modules\render\pipeline.zig:871:9: 0x7ff734b624ed in modules.render.pipeline.ComputeDrawPipeline::modules.render.pipeline.ComputeDrawPipeline.compute (zig_vulkan.obj)
        try ctx.vkd.queueSubmit(
        ^
C:\repositories\zig_vulkan\src\main.zig:200:33: 0x7ff734aecd48 in main (zig_vulkan.obj)
            try voxel_rt.compute(ctx);
                                ^
C:\repositories\zig_vulkan\src\main.zig:200:13: 0x7ff734aed010 in main (zig_vulkan.obj)
            try voxel_rt.compute(ctx);
Avokadoen commented 2 years ago

Turned out this was caused by unstaged changes