vulkan-tutorial-rust icon indicating copy to clipboard operation
vulkan-tutorial-rust copied to clipboard

example 01: memory access violation on windows 10

Open Fahisto opened this issue 6 years ago • 5 comments

Cannot implement Drop for VulkanApp in example01, because the usage of destroy_instance(None) crashes the program on closing the window and produces error: process didn't exit successfully: `target\debug\01.exe` (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION) Without the Drop implementation or the destroy_instance() usage everything is fine. I read the actual docs for Vulakn API for this function, and I'm assuming there's a dangling reference somewhere inside the instance fields, but couldnt confirm (I'm not even sure if I'm right). Any suggestions?

Fahisto avatar Jul 31 '19 13:07 Fahisto

Is this issue reproduced on other examples? I mainly work on macOS, and the code works well on macOS. So this may be a platform-specific problem. It may take me 2 or 3 days to have access to Windows machine to test this problem.

I recommend you to try running the example of ash. This help me to figure out if it's the problem of my code, a machine specific problem, or any bug issure in SDK.

unknownue avatar Aug 01 '19 01:08 unknownue

I ran all the ash examples and they were fine: no crashes, no errors, nothing. Most of the other examples up to 17th from your tutorial were fine too, so that's strange. Ones that aren't workin are 17, 23. When I try to run the 17th example, it shows a whole bunch of errors and crashes without window even appearing on my screen:

[Debug][Error][Validation]"The Pipeline State Object (0x2a) expects that this Command
Buffer\'s vertex binding Index 0 should be set via vkCmdBindVertexBuffers. This is because VkVertexInputBindingDescription struct at index 0 of pVertexBindingDescriptions has a binding value of 0."
[Debug][Error][Validation]"The Pipeline State Object (0x2a) expects that this Command
Buffer\'s vertex binding Index 0 should be set via vkCmdBindVertexBuffers. This is because VkVertexInputBindingDescription struct at index 0 of pVertexBindingDescriptions has a binding value of 0."
thread 'main' panicked at 'Failed to wait for Fence!: Result(-4)', src\libcore\result.rs:999:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[Debug][Error][Validation]"Cannot call vkDestroySemaphore on Semaphore 0x2f 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://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkDestroySemaphore-semaphore-01137)"
[Debug][Error][Validation]"Fence 0x30 is in use. The Vulkan spec states: All queue submission commands that refer to fence must have completed execution (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkDestroyFence-fence-01120)"
[Debug][Error][Validation]"Cannot call vkDestroySemaphore on Semaphore 0x32 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://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkDestroySemaphore-semaphore-01137)"
[Debug][Error][Validation]"Fence 0x33 is in use. The Vulkan spec states: All queue submission commands that refer to fence must have completed execution (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkDestroyFence-fence-01120)"
[Debug][Error][Validation]"Attempt to free command buffer (0x26f709b8790) which is in
use. The Vulkan spec states: All elements of pCommandBuffers must not be in the pending state (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkFreeCommandBuffers-pCommandBuffers-00047)"
[Debug][Error][Validation]"Attempt to free command buffer (0x26f709b9320) which is in
use. The Vulkan spec states: All elements of pCommandBuffers must not be in the pending state (https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkFreeCommandBuffers-pCommandBuffers-00047)"
[Debug][Error][Validation]"Cannot call vkDestroyFramebuffer on Framebuffer 0x2b 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://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkDestroyFramebuffer-framebuffer-00892)"
[Debug][Error][Validation]"Cannot call vkDestroyFramebuffer on Framebuffer 0x2c 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://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkDestroyFramebuffer-framebuffer-00892)"
[Debug][Error][Validation]"Cannot call vkDestroyPipeline on Pipeline 0x2a 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://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkDestroyPipeline-pipeline-00765)"
[Debug][Error][Validation]"Cannot call vkDestroyRenderPass on RenderPass 0x26 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://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkDestroyRenderPass-renderPass-00873)"
[Debug][Error][Validation]"Cannot call vkDestroyImageView on ImageView 0x24 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://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkDestroyImageView-imageView-01026)"
[Debug][Error][Validation]"Cannot call vkDestroyImageView on ImageView 0x25 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://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-vkDestroyImageView-imageView-01026)"

Example 23, however, does launch, but there's no texture in assets folder, and when I try to use my own jpg image as texture, it seems fine, but the textures itself does not appear on the screen, there's only the rotating square from previous example. No errors or anything for this one. However, following examples crash with thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: FormatError("first two bytes is not a SOI marker")' , so I'm assuming ther's something wrong with my image, what are the requirements then for it to display correctly (I did use .jpg image)?

Fahisto avatar Aug 01 '19 05:08 Fahisto

Forgot to mention the other example that's not working. Example 21 does launch, but displays nothing (only black window) and produces following errors:

[Debug][Error][Validation]"VkPipeline 0x2b uses set #0 but that set is not bound."
[Debug][Error][Validation]"VkPipeline 0x2b uses set #0 but that set is not bound."

Fahisto avatar Aug 01 '19 05:08 Fahisto

Here are some instructions may help you:

  1. example 01: The code in 01_instance_creation.rs does not hold ash::Entry after ash::Instance is built. Add ash::Entry as a member of VulkanApp may fix this like other examples.
  2. example 17: This is an incomplete example and the validation layer should output some error message. But this example should not crashes immediately without cleaning other vulkan resources. That why you see a bunch of errors output. I can't see which line of code cause the crash, so I have not idea what's the problem.
  3. example 23: The assets used in the tutorial do not include in this repo. See here. Like the C++ implementation, the code does not guarantee all image formats are support(since it introduces more operations). So it's not strange that the image you provided failed to display. Try the image in tutorial next time.
  4. example 21: Black window and some validation output. That's just what this example would show you. It's Ok.

I would test these problems as soon as I get access to Windows machine.

unknownue avatar Aug 01 '19 07:08 unknownue

Example 01 works now, thank you.

Fahisto avatar Aug 01 '19 07:08 Fahisto