-
Notifications
You must be signed in to change notification settings - Fork 901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ray Queries #6291
base: trunk
Are you sure you want to change the base?
Ray Queries #6291
Conversation
…leration-structures
# Conflicts: # Cargo.lock # tests/Cargo.toml # wgpu-core/src/binding_model.rs # wgpu-core/src/command/compute.rs # wgpu-core/src/command/mod.rs # wgpu-core/src/command/render.rs # wgpu-core/src/device/life.rs # wgpu-core/src/device/queue.rs # wgpu-core/src/device/resource.rs # wgpu-core/src/hub.rs # wgpu-core/src/resource.rs # wgpu-core/src/track/mod.rs # wgpu-hal/Cargo.toml # wgpu-hal/src/dx11/mod.rs # wgpu-hal/src/lib.rs # wgpu-hal/src/vulkan/adapter.rs # wgpu-types/src/lib.rs # wgpu/Cargo.toml # wgpu/src/context.rs
…' into ray-tracing # Conflicts: # Cargo.lock # wgpu-hal/Cargo.toml # wgpu-hal/src/dx11/mod.rs # wgpu-types/src/lib.rs
# Conflicts: # wgpu-core/src/binding_model.rs # wgpu-core/src/device/resource.rs # wgpu-hal/examples/ray-traced-triangle/main.rs # wgpu-hal/src/dx11/command.rs # wgpu-hal/src/dx11/device.rs # wgpu-hal/src/dx11/mod.rs # wgpu-hal/src/lib.rs # wgpu-types/src/lib.rs
upgrade
I think the second one is actually valid, ordering:
edit: If you create a new ASContext before step 3 this will work. |
mumble mumble mutable damn state |
Okay nice, it does seem to work. I am also getting some intermittent
Which means the tlas drop isn't properly deferring until the command encoder is done with it. |
I suspect the second error is that if we are breaking with an error it fails since it has drained the actions. |
Looking into queue submit, it seems that earlier errors ( wgpu/wgpu-core/src/device/queue.rs Lines 1098 to 1111 in 8e787eb
wgpu/wgpu-core/src/device/queue.rs Lines 1137 to 1145 in 8e787eb
validate_command_buffer .
Edit: never mind, this didn't help the validation errors |
also for the first validation error we place some acceleration structure barriers that go between build and shader input I think this needs something in hal that conditionally adds that based on feature support (or we expand shader input to vertex, fragment, compute, and later ray-tracing-pipeline inputs). |
Chatted with the other maintainers, and two main things to do before we can land, then we're good to land with follow up testing for any naga stuff. Both of these things I can take on:
|
I'm fine to work on some of the testing, I assume common errors are thing like:
|
After using advanced debugging (putting an |
It seems like command buffers might be leaking if a validation error is generated [2024-09-26T08:58:50Z INFO wgpu_core::device::global] CommandEncoder::drop Id(1,1)
[2024-09-26T08:58:50Z INFO wgpu_core::command] Drop CommandBuffer with 'TLAS 1' label <--- command buffer freed here
[2024-09-26T08:58:50Z INFO wgpu_core::device::global] Device::create_shader_module -> Id(0,1)
[2024-09-26T08:58:50Z INFO wgpu_core::device::global] Device::create_compute_pipeline -> Id(0,1)
[2024-09-26T08:58:50Z INFO wgpu_core::device::global] Device::create_bind_group -> Id(0,1)
[2024-09-26T08:58:50Z INFO wgpu_core::device::global] BindGroupLayout::drop Id(0,1)
[2024-09-26T08:58:50Z INFO wgpu_core::device::global] Device::create_command_encoder -> Id(1,2)
[2024-09-26T08:58:50Z INFO wgpu_core::device::queue] Queue::submit Id(0,1)
[2024-09-26T08:58:50Z INFO wgpu_core::device::global] CommandBuffer::drop Id(1,2)
[2024-09-26T08:58:50Z INFO wgpu_core::device::global] CommandEncoder::drop Id(1,2)
[2024-09-26T08:58:50Z INFO wgpu_core::command] Drop CommandBuffer with '' label
[2024-09-26T08:58:50Z INFO wgpu_core::device::global] BindGroup::drop Id(0,1)
[2024-09-26T08:58:50Z INFO wgpu_core::binding_model] Destroy raw BindGroup with '' label
[2024-09-26T08:58:50Z INFO wgpu_core::device::global] ComputePipeline::drop Id(0,1)
[2024-09-26T08:58:50Z INFO wgpu_core::pipeline] Destroy raw ComputePipeline with '' label
[2024-09-26T08:58:50Z INFO wgpu_core::binding_model] Destroy raw PipelineLayout with '' label
[2024-09-26T08:58:50Z INFO wgpu_core::binding_model] Destroy raw BindGroupLayout with '' label
[2024-09-26T08:58:50Z INFO wgpu_core::device::global] ShaderModule::drop Id(0,1)
[2024-09-26T08:58:50Z INFO wgpu_core::pipeline] Destroy raw ShaderModule with 'shader.wgsl' label
[2024-09-26T08:58:50Z INFO wgpu_core::device::global] CommandEncoder::drop Id(0,1)
[2024-09-26T08:58:50Z INFO wgpu_core::command] Drop CommandBuffer with 'BLAS 1' label
[2024-09-26T08:58:50Z INFO wgpu_core::device::global] Buffer::drop Id(0,1)
[2024-09-26T08:58:50Z INFO wgpu_core::resource] Destroy raw Tlas with 'TLAS' label
[2024-09-26T08:58:50Z ERROR wgpu_hal::vulkan::instance] VALIDATION [VUID-vkDestroyAccelerationStructureKHR-accelerationStructure-02442 (0xaf03fd73)]
Validation Error: [ VUID-vkDestroyAccelerationStructureKHR-accelerationStructure-02442 ] | MessageID = 0xaf03fd73 | vkDestroyAccelerationStructureKHR(): can't be called on VkAccelerationStructureKHR 0xcad092000000000d[TLAS] that is currently in use by VkCommandBuffer 0x7f8b0de60af0[TLAS 1]. The Vulkan spec states: All submitted commands that refer to accelerationStructure must have completed execution (https://vulkan.lunarg.com/doc/view/1.3.290.0/linux/1.3-extensions/vkspec.html#VUID-vkDestroyAccelerationStructureKHR-accelerationStructure-02442)
^--- vulkan validation error about command buffer being still active
Edit: wondering if #6323 might be related |
I've put a workaround in the tests that has stopped the vulkan validation errors as I believe that the errors from the vulkan validation layers are the same as those in #6323. |
Connections
Works towards #1040
Description
This PR provides BLASes (bottom level acceleration structures), TLASes (top level acceleration structures), TLAS instances (which contain BLASes and data, like transforms, about them), TLAS packages (which contain vectors of TLAS instances).
Testing
Running tests & examples included in PR
This a updated version of #3631 and is intended to replace it.
Checklist
cargo fmt
.cargo clippy
. If applicable, add:--target wasm32-unknown-unknown
--target wasm32-unknown-emscripten
cargo xtask test
to run tests.CHANGELOG.md
. See simple instructions inside file.Later (follow-up PR)
as_hal
methods