-
Notifications
You must be signed in to change notification settings - Fork 933
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
Add support for occlusion queries #3402
Conversation
I also want to add, as this is my first contribution, and a rather large, to check if I did the Features Flag implementation correctly, as for my understanding OCCLUSION_QUERY, is not a feature flag in WebGPU, and is always supported there, but atm. there is no support for this in DirectX11 FL 9.1, and Metal (Queries are generally not implemented yet) |
0382a52
to
f8ab890
Compare
It should be a new flag in the (Downlevel flags are features that WebGPU must support but not all backends/adapters do.)
Ideally, we should add core features to all primary backends (Vulkan, DX12 and Metal); not a blocker though. |
5661701
to
25f0d10
Compare
Changed OCCLUSION_QUERY to a down-level feature, and made everything spec conform again, Still has to be implement in web backend; auxil, gles, and metal |
5586b1b
to
7f71a5c
Compare
This is really good stuff! The code looks good - though CI and merging is mad. Would it be possible to write a simple test (a new file under wgpu/tests/root.rs) that draws two fullscreen triangles with a depth buffer and makes sure the occlusion queries return the correct values on both? |
3616a84
to
a84d422
Compare
…ELOG.md, OCCLUSION_QUERY feature is now a downlevel flag Fix typos, working on proper handling of begin occlusion query Add proper support for occlusion queries
Co-authored-by: Leo Kettmeir <[email protected]>
Co-authored-by: Leo Kettmeir <[email protected]>
Co-authored-by: Leo Kettmeir <[email protected]>
a84d422
to
2809045
Compare
2809045
to
5740521
Compare
Added a simple test for occlusion queries, and added occlusion queries to deno (never worked with deno before) Theoretically there is still a check missing if the provided query set is an occlusion query set, but the check is also done when starting an query There are also no details of how the result should look like, Vulkan/Metal specifies it as non-zero and zero, in DirectX 12 there is also the possibility to choose between binary, and normal (frag. shader invocations), |
@crowlKats poke from triage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deno part LGTM. not sure what i was thinking when i said something didnt look right 😓
…port it and ancient OpenGL (ES) versions, remove fragment stage in occlusion query test
# Conflicts: # deno_webgpu/src/01_webgpu.js # deno_webgpu/src/02_idl_types.js # wgpu-core/src/command/bundle.rs # wgpu-hal/src/dx12/device.rs
Updated the PR, but I noticed that the #3489 PR broke the mipmap example, it runs because query_set is None for some reason when running the example test, but running the example main results in an error:
The examples use a staging buffer now (Don't know if this is mandatory, but seems to be intended according to WebGPU spec) And WebGL doesn't work because queries are not immediately available. |
99b9dc5
to
c11e34b
Compare
…tShader occlusion query problem
…lusion query problem, ignore gl backend in occlusion_query test for now
…ffer usage, fix glew query resolve
…ve wasm_bindgen_test from occlusion_query
…ve wasm_bindgen_test from occlusion_query
@valaphee Sorry this got caught up in the backlog. Could you merge in main and we'll get this reviewed and in |
# Conflicts: # deno_webgpu/lib.rs # examples/mipmap/src/main.rs # tests/tests/shader_primitive_index/mod.rs
…x in mipmap example
Merged with upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely phenomenal work!
Checklist
cargo clippy
.RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown
if applicable.Connections
Description
At the moment its possible to create an occlusion query set, but it can't be used as there is no way to start and end a occlusion
query.
This pr implements the occlusion query set and adds the occlusion_query_set to the render pass descriptor which will be used by subsequent beginOcclusionQuery and endOcclusionQuery commands.
For finding purposes, here is a good overview of the differences for queries for different backends gpuweb/gpuweb#614
Testing
I modified the mipmap example, and replaced pipeline statistics with occlusion query, as the used value (FRAGMENT_SHADER_INVOCATIONS) should be the same as the value returned by occlusion query in this case (might differ on DirectX as binary mode is used, either 0 if occluded or 1, but can be changed)