Skip to content
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

Merged
merged 374 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
374 commits
Select commit Hold shift + click to select a range
96bb3e7
fix more compile errors
Vecvec Dec 8, 2023
9b3266c
fix err
Vecvec Dec 8, 2023
06dc329
Merge branch 'trunk' into ray-tracing
Vecvec Dec 8, 2023
99f4236
fix all compile errors
Vecvec Dec 10, 2023
0fab2a4
Merge pull request #4 from gfx-rs/trunk
Vecvec Dec 10, 2023
5efddd7
fix clippy errors
Vecvec Dec 10, 2023
49d5e85
Merge remote-tracking branch 'origin/ray-tracing' into ray-tracing
Vecvec Dec 10, 2023
b7486bd
fix issues in ray-traced-triangle example
Vecvec Dec 10, 2023
2f49af2
fix clippy warnings
Vecvec Dec 10, 2023
014d283
fix wasm not compiling
Vecvec Dec 10, 2023
6a6345c
fix test
Vecvec Dec 10, 2023
a636d08
fix clippy (again)
Vecvec Dec 10, 2023
5ec1735
fix some rustfmt issues
Vecvec Dec 10, 2023
8604794
fix more rustfmt issues
Vecvec Dec 10, 2023
eb23a11
fix even more rustfmt issues
Vecvec Dec 10, 2023
b48b66d
fix yet more rustfmt issues
Vecvec Dec 11, 2023
14e65dd
add #[allow(dead_code)] to some structs to fix clippy on web assembly
Vecvec Dec 11, 2023
c9c027e
more format fixes
Vecvec Dec 11, 2023
9e9ae22
even more format fixes
Vecvec Dec 11, 2023
b00bc83
close to final format fixes
Vecvec Dec 11, 2023
2971bca
final format fixes (hopefully)
Vecvec Dec 11, 2023
4280f29
actual final format fixes (hopefully)
Vecvec Dec 11, 2023
4e06007
Merge pull request #5 from gfx-rs/trunk
Vecvec Dec 11, 2023
331625a
move ray_cube_cube example and fix bugs
Vecvec Dec 12, 2023
49b65e4
move other examples
Vecvec Dec 12, 2023
2f25773
fix crash when dropping
Vecvec Dec 12, 2023
74ce414
fix test
Vecvec Dec 12, 2023
3765def
apply clippy and rustfmt changes
Vecvec Dec 12, 2023
986d520
fix some memory leaks
Vecvec Dec 13, 2023
859f6c5
Merge from gfx-rs/trunk
Vecvec Dec 13, 2023
07f6e1a
Merge remote-tracking branch 'gfx-rs/trunk' into ray-tracing
Vecvec Dec 17, 2023
817e545
fix incompatibility with new wgpu trunk changes
Vecvec Dec 17, 2023
e0b6724
fix clippy & fmt
Vecvec Dec 17, 2023
d66fcaa
fix clippy errors on github
Vecvec Dec 17, 2023
9980d45
Merge remote-tracking branch 'gfx-rs/trunk' into ray-tracing
Vecvec Dec 18, 2023
c288e08
update to trunk
Vecvec Dec 18, 2023
8e606c2
remove a line that printed log "Created blas ..." in device create tlas
Vecvec Dec 18, 2023
a9d12af
Merge remote-tracking branch 'gfx-rs/trunk' into ray-tracing
Vecvec Dec 20, 2023
ea77c34
Merge remote-tracking branch 'gfx-rs/trunk' into ray-tracing
Vecvec Dec 21, 2023
0f3c84b
Merge remote-tracking branch 'gfx-rs/trunk' into ray-tracing
Vecvec Jan 2, 2024
909f366
Merge remote-tracking branch 'gfx-rs/trunk' into ray-tracing
Vecvec Jan 7, 2024
ccc6969
fix merge issues
Vecvec Jan 7, 2024
8c82cc5
Merge remote-tracking branch 'gfx-rs/trunk' into ray-tracing
Vecvec Jan 8, 2024
f2d5734
Merge remote-tracking branch 'gfx-rs/trunk' into ray-tracing
Vecvec Jan 14, 2024
8734e03
fix merge
Vecvec Jan 14, 2024
316f0e2
fix fmt
Vecvec Jan 14, 2024
f39a44c
Merge pull request #2 from Vecvec/ray-tracing
daniel-keitel Jan 17, 2024
1b4f220
restored example ray scene functionality
daniel-keitel Jan 17, 2024
78f399b
Merge commit 'c038b5c433aeb3bc55f2091da56216e3f1c07e74' into ray-tracing
JMS55 Feb 3, 2024
41133c4
WIP fix rebase
JMS55 Feb 3, 2024
41fe261
Fix compile issues
JMS55 Feb 4, 2024
d94cbeb
More fixes
JMS55 Feb 4, 2024
13c09f9
Merge commit '004e3efe84a320d9331371ed31fa50baa2414911' into ray-tracing
JMS55 Feb 18, 2024
b60f318
Fix rebase
JMS55 Feb 18, 2024
91b7546
Add wgls backend write_value_type AccelerationStructure
JMS55 Feb 18, 2024
972d9cb
Merge commit '5b9ade82233deac341c577ec02b70e7b3e518933' into ray-tracing
JMS55 Feb 25, 2024
2bc105d
Add back xtask Cargo.lock
JMS55 Feb 25, 2024
f3fa301
Revert serde path
JMS55 Feb 25, 2024
96877cc
Doc typos
JMS55 Feb 25, 2024
b459f37
Add -diff
JMS55 Feb 25, 2024
4a1080a
Revert more serde
JMS55 Feb 25, 2024
991c2c4
Revert serde again?
JMS55 Feb 25, 2024
e042a86
Fix doc typo
JMS55 Feb 25, 2024
5da071f
add test
Vecvec Mar 25, 2024
a7b90fe
clippy & fmt
Vecvec Mar 25, 2024
6633fae
fix error "blas does not exist"
Vecvec Mar 26, 2024
d9feef7
fix various things
Vecvec Mar 29, 2024
62de7ce
fix unused acceleration structures causing invalid SPIR-V
Vecvec Mar 29, 2024
1e737be
Merge branch 'fix-unused-acceleration-structure' into ray-tracing-tests
Vecvec Mar 30, 2024
fcc1a68
fix merge
Vecvec Mar 30, 2024
ed2b294
fix use after free in a different way (now moved tlas instances to wg…
Vecvec Apr 6, 2024
b6b44da
refactor & fmt
Vecvec Apr 6, 2024
d9b82b3
remove accidentally created file
Vecvec Apr 6, 2024
0a52484
remove accidentally created file (actually)
Vecvec Apr 6, 2024
6a35108
Merge remote-tracking branch 'gfx-rs/trunk' into ray-tracing-tests
Vecvec Apr 13, 2024
f421374
merge & fix
Vecvec Apr 13, 2024
abdbb40
Merge branch 'trunk' into ray-tracing
atlv24 Apr 14, 2024
67710d7
Fix problems
atlv24 Apr 14, 2024
03c00e9
fix validation error
Vecvec Apr 21, 2024
f2511b5
fix validation
Vecvec Apr 26, 2024
6166c86
Merge pull request #1 from Vecvec/ray-tracing-fix-validation
atlv24 May 1, 2024
1aefc53
Merge commit 'fb3b33d09233140533a9e431256a8690bf4c5d42' into ray-trac…
JMS55 May 2, 2024
d0238b2
Merge pull request #2 from JMS55/ray-tracing2
atlv24 May 4, 2024
7a51685
Merge remote-tracking branch 'refs/remotes/gfx-rs/trunk' into ray-tra…
Vecvec Jun 1, 2024
a63b8d4
fix merge
Vecvec Jun 1, 2024
0c54402
fmt
Vecvec Jun 1, 2024
d079bd0
Merge remote-tracking branch 'refs/remotes/gfx-rs/trunk' into ray-tra…
Vecvec Jun 15, 2024
7050d34
fix merge
Vecvec Jun 15, 2024
a5365bf
use staging buffer trackers in creating the ray-tracing staging buffe…
Vecvec Jun 16, 2024
ce64c15
Merge branch 'refs/heads/ray-tracing-updated' into ray-tracing-tests
Vecvec Jun 17, 2024
9aaab3f
change one missed staging buffer's tracker
Vecvec Jun 17, 2024
d2140ea
Merge branch 'refs/heads/ray-tracing-updated' into ray-tracing-tests
Vecvec Jun 17, 2024
9261031
wip: example
Vecvec Jun 25, 2024
518c7fb
finished shadow!
Vecvec Jul 1, 2024
c33de62
Merge remote-tracking branch 'refs/remotes/gfx-rs/trunk' into ray-tra…
Vecvec Jul 1, 2024
3ad91f2
fix merge
Vecvec Jul 3, 2024
8555869
clippy
Vecvec Jul 3, 2024
3eb8835
merge & fix
Vecvec Jul 7, 2024
b524bb2
remove some uses of blas ids
Vecvec Jul 8, 2024
f02507d
fmt
Vecvec Jul 8, 2024
4afba3b
Merge remote-tracking branch 'refs/remotes/gfx-rs/trunk' into ray-tra…
Vecvec Jul 9, 2024
7cb078b
fix merge
Vecvec Jul 9, 2024
d659a41
Merge pull request #3 from Vecvec/ray-tracing-updated
atlv24 Jul 26, 2024
d40b0fc
deduplicate code shared between command_encoder_build_acceleration_st…
Vecvec Jul 28, 2024
cafc0b0
clippy
Vecvec Jul 29, 2024
0cb14f5
Merge pull request #4 from Vecvec/ray-tracing-refactor
atlv24 Aug 9, 2024
523756a
Merge remote-tracking branch 'refs/remotes/gfx-rs/trunk' into ray-tra…
Vecvec Aug 14, 2024
9706f3c
fix merge
Vecvec Aug 14, 2024
49cfa7d
fix warnings
Vecvec Aug 14, 2024
2810f13
clippy & fmt
Vecvec Aug 14, 2024
7866557
re-add matching to get_raw_tlas_instance_size and tlas_instance_into_…
Vecvec Aug 15, 2024
af183c5
fmt
Vecvec Aug 15, 2024
a6d78f5
fix command
Vecvec Aug 31, 2024
9ae808a
Merge remote-tracking branch 'refs/remotes/gfx-rs/trunk' into ray-tra…
Vecvec Aug 31, 2024
5e2f061
wip: fix merge
Vecvec Sep 1, 2024
dbfbe56
Merge remote-tracking branch 'refs/remotes/gfx-rs/trunk' into ray-tra…
Vecvec Sep 14, 2024
fda4ff8
fix merge
Vecvec Sep 14, 2024
d5532b0
fmt & docs
Vecvec Sep 14, 2024
7400129
fix wasm clippy
Vecvec Sep 14, 2024
3b573c8
fix issues with tests
Vecvec Sep 14, 2024
7dccf40
Merge branch 'refs/heads/ray-tracing-updated' into ray-tracing-tests
Vecvec Sep 14, 2024
86f7823
fix issues with tests
Vecvec Sep 16, 2024
93fba52
Merge remote-tracking branch 'refs/remotes/gfx-rs/trunk' into ray-tra…
Vecvec Sep 16, 2024
32f9666
Merge branch 'refs/heads/ray-tracing-updated' into ray-tracing-tests
Vecvec Sep 16, 2024
7f69da4
fmt & clippy (wasm)
Vecvec Sep 16, 2024
e8067ff
wip ray-traced-triangle (non hal)
Vecvec Sep 17, 2024
5461327
unify camera location in ray_shadows
Vecvec Sep 18, 2024
c13baf1
fix tests
Vecvec Sep 19, 2024
592270d
Merge remote-tracking branch 'refs/remotes/gfx-rs/trunk' into ray-tra…
Vecvec Sep 19, 2024
c137a33
Merge branch 'refs/heads/ray-tracing-new' into ray-tracing-tests
Vecvec Sep 19, 2024
ba098f2
add readme to ray_traced_triangle
Vecvec Sep 19, 2024
8d1c193
note that vertex format must be f32x3 (not yet validated)
Vecvec Sep 19, 2024
ff6988d
changelog
Vecvec Sep 19, 2024
638f4c5
require VertexFormat::Float32x3
Vecvec Sep 19, 2024
cb167a4
fix compile error
Vecvec Sep 19, 2024
e2168e6
when creating and building acceleration structures require Features::…
Vecvec Sep 20, 2024
0fcc749
remove duplicate workaround
Vecvec Sep 20, 2024
c3aa7ba
fix most feedback
Vecvec Sep 20, 2024
9e6bf29
Merge branch 'trunk' into ray-tracing-new
Vecvec Sep 20, 2024
9127686
remove all changes from .gitattributes
Vecvec Sep 20, 2024
9133567
fix compile error in test
Vecvec Sep 20, 2024
358a4ec
more changes along same lines
Vecvec Sep 20, 2024
0d67c0a
format
Vecvec Sep 20, 2024
8d1f97b
apply feedback to more places
Vecvec Sep 20, 2024
e7fb920
fix `cargo clippy` not just `cargo clippy --all-features`
Vecvec Sep 20, 2024
86d8801
cache max instances from tlas creation
Vecvec Sep 20, 2024
07b899c
fix clippy
Vecvec Sep 20, 2024
5ced4e6
fix examples
Vecvec Sep 20, 2024
093acad
fix tests
Vecvec Sep 20, 2024
e6eb770
remove now useless docs
Vecvec Sep 21, 2024
41a1181
add more docs
Vecvec Sep 21, 2024
9f808c0
yet more docs
Vecvec Sep 21, 2024
2da9dff
Merge branch 'trunk' into ray-tracing-new
Vecvec Sep 21, 2024
6a385da
still more docs
Vecvec Sep 22, 2024
eed7256
Merge remote-tracking branch 'refs/remotes/gfx-rs/trunk' into ray-tra…
Vecvec Sep 22, 2024
7c3e070
Merge remote-tracking branch 'origin/ray-tracing-new' into ray-tracin…
Vecvec Sep 22, 2024
31fd7b3
Documentation.
Vecvec Sep 22, 2024
c534106
Running out of unique commit messages to say writing docs.
Vecvec Sep 22, 2024
ae692b0
Add more references to docs.
Vecvec Sep 22, 2024
6eba476
Get BindGroup in scope
Vecvec Sep 22, 2024
27c19fc
Merge branch 'trunk' into ray-tracing-new
Vecvec Sep 22, 2024
d32d086
Remove unintentional changes
Vecvec Sep 22, 2024
ff9dc96
Remove #[allow(dead_code)]
Vecvec Sep 22, 2024
3936b8c
Remove old comments
Vecvec Sep 22, 2024
cadec75
Add device.poll
Vecvec Sep 22, 2024
b406903
Merge remote-tracking branch 'origin/ray-tracing-new' into ray-tracin…
Vecvec Sep 22, 2024
cde7c14
Merge remote-tracking branch 'refs/remotes/gfx-rs/trunk' into ray-tra…
Vecvec Sep 22, 2024
c2566d4
make ray_scene start right way up
Vecvec Sep 22, 2024
dcb2955
fmt
Vecvec Sep 22, 2024
ab69ac5
move scratch buffer to its own module
Vecvec Sep 22, 2024
82042f1
actually remove intentional changes (turns out wgt is inconsistent)
Vecvec Sep 22, 2024
86adda1
use better names in ray_scene/shader.wgsl
Vecvec Sep 22, 2024
bcd61d0
fmt
Vecvec Sep 22, 2024
1dec1af
remove more unintentional changes.
Vecvec Sep 22, 2024
142f086
work on ray_tracing use after free
Vecvec Sep 22, 2024
dc5293c
spelling
Vecvec Sep 23, 2024
ad7c8ea
grammar
Vecvec Sep 23, 2024
c05d021
Merge branch 'trunk' into ray-tracing-new
Vecvec Sep 23, 2024
000a505
move things into struct (should be all vectors with 3 item types or m…
Vecvec Sep 23, 2024
5b7c7c2
Merge remote-tracking branch 'origin/ray-tracing-new' into ray-tracin…
Vecvec Sep 23, 2024
c4f71c7
remove long-standing locks.
Vecvec Sep 23, 2024
77de647
fmt
Vecvec Sep 23, 2024
67bc235
move not using index buffer to test
Vecvec Sep 23, 2024
0a5781f
impl index & index mut for tlas package
Vecvec Sep 23, 2024
5ece2f8
impl index & index mut for tlas package
Vecvec Sep 23, 2024
d7140d8
fix errors
Vecvec Sep 23, 2024
207b97b
fix test errors
Vecvec Sep 23, 2024
f666e28
move everything out of ray_tracing.rs
Vecvec Sep 23, 2024
43c1fbe
more index_mut
Vecvec Sep 23, 2024
4f2e045
fmt
Vecvec Sep 23, 2024
b57b019
fix docs links
Vecvec Sep 23, 2024
0c1db5f
move to separate impl block
Vecvec Sep 23, 2024
546db21
fix older request review
Vecvec Sep 23, 2024
1602222
fmt
Vecvec Sep 23, 2024
a211921
remove missed deref
Vecvec Sep 23, 2024
0d55822
fix wasm clippy
Vecvec Sep 23, 2024
18a8b73
change to suggestions
Vecvec Sep 23, 2024
9b65611
Merge branch 'trunk' into ray-tracing-new
Vecvec Sep 23, 2024
75b184f
fmt
Vecvec Sep 23, 2024
2f9e18d
Merge remote-tracking branch 'origin/ray-tracing-new' into ray-tracin…
Vecvec Sep 23, 2024
2088bea
add a note as to why `command_encoder_build_acceleration_structures_u…
Vecvec Sep 23, 2024
a5dfc77
add a todo to reconsider soon `command_encoder_build_acceleration_str…
Vecvec Sep 24, 2024
a8916b0
switch to mat4 in ray-tracing examples
Vecvec Sep 24, 2024
bd07701
Combine RT Tests Under Single Submodule
cwfitzgerald Sep 25, 2024
a507937
Add More Raytracing Tests and Re-Organize
cwfitzgerald Sep 25, 2024
893b8c5
Documentation and Formatting Fixes
cwfitzgerald Sep 25, 2024
84054df
Remove Forced Alignment in wgpu-hal
cwfitzgerald Sep 25, 2024
1143de9
Merge remote-tracking branch 'upstream/trunk' into ray-tracing-new
cwfitzgerald Sep 25, 2024
ca5a64a
work on out_of_order_as_build and add out_of_order_as_build_use
Vecvec Sep 25, 2024
62b01f3
fmt
Vecvec Sep 25, 2024
e6b2fd4
Merge branch 'trunk' into ray-tracing-new
Vecvec Sep 25, 2024
f4bfe81
update test label naming
Vecvec Sep 25, 2024
76f4402
fix one validation error
Vecvec Sep 25, 2024
2be625a
Merge remote-tracking branch 'origin/ray-tracing-new' into ray-tracin…
Vecvec Sep 25, 2024
44d108f
fix clippy & fmt
Vecvec Sep 25, 2024
fccf8a2
Merge branch 'trunk' into ray-tracing-new
Vecvec Sep 25, 2024
cd0e4c0
Merge branch 'trunk' into ray-tracing-new
Vecvec Sep 26, 2024
aef0c64
add acceleration structure creation tests
Vecvec Sep 26, 2024
0e90de9
Merge remote-tracking branch 'origin/ray-tracing-new' into ray-tracin…
Vecvec Sep 26, 2024
9a9ac03
make mis-matched index test use the correct function
Vecvec Sep 26, 2024
311e5ea
Merge branch 'trunk' into ray-tracing-new
Vecvec Sep 26, 2024
1504e78
Merge branch 'trunk' into ray-tracing-new
Vecvec Sep 27, 2024
bc907c8
move validation into validate_command_buffer
Vecvec Sep 28, 2024
62aa9e6
fix tests
Vecvec Sep 28, 2024
7662d99
Merge remote-tracking branch 'origin/ray-tracing-new' into ray-tracin…
Vecvec Sep 28, 2024
ae371cf
Merge branch 'trunk' into ray-tracing-new
Vecvec Sep 28, 2024
a89c742
add blas and tlas to pending writes to remove (now unneeded) `device.…
Vecvec Sep 28, 2024
cf177af
Merge remote-tracking branch 'origin/ray-tracing-new' into ray-tracin…
Vecvec Sep 28, 2024
0f2baeb
remove commented out code from examples and properly use the constant…
Vecvec Sep 29, 2024
9e205cd
add examples to examples\README.md
Vecvec Sep 29, 2024
568edcc
rename ray tracing to ray queries in readme
Vecvec Sep 29, 2024
66e19c3
Merge remote-tracking branch 'refs/remotes/gfx-rs/trunk' into ray-tra…
Vecvec Sep 29, 2024
689ea8b
Merge branch 'trunk' into ray-tracing-new
Vecvec Oct 1, 2024
1e860ca
remove unneeded usage from scratch buffer creation
Vecvec Oct 1, 2024
5c086b0
Merge branch 'trunk' into ray-tracing-new
Vecvec Oct 4, 2024
ab32656
Merge branch 'trunk' into ray-tracing-new
Vecvec Oct 8, 2024
e777b76
Merge remote-tracking branch 'refs/remotes/gfx-rs/trunk' into ray-tra…
Vecvec Oct 19, 2024
66c0cbb
use snatchables for raw acceleration structures
Vecvec Oct 20, 2024
17b2d89
format
Vecvec Oct 20, 2024
6c2b6f3
Merge branch 'trunk' into ray-tracing-new
Vecvec Oct 21, 2024
258ef45
Merge branch 'trunk' into ray-tracing-new
Vecvec Oct 25, 2024
b400342
Merge branch 'trunk' into ray-tracing-new
Vecvec Oct 26, 2024
4ac0e8a
Merge branch 'trunk' into ray-tracing-new
Vecvec Oct 29, 2024
17b90a1
Merge branch 'trunk' into ray-tracing-new
Vecvec Nov 1, 2024
2b5f833
Merge branch 'trunk' into ray-tracing-new
Vecvec Nov 4, 2024
90dba73
Merge branch 'trunk' into ray-tracing-new
Vecvec Nov 8, 2024
1ecb65c
Merge branch 'trunk' into ray-tracing-new
Vecvec Nov 8, 2024
27b96fe
add EXPERIMENTAL_ to features
Vecvec Nov 8, 2024
8f803e1
Merge remote-tracking branch 'origin/ray-tracing-new' into ray-tracin…
Vecvec Nov 8, 2024
ac20f02
fix missed comment
Vecvec Nov 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ By @MarijnS95 in [#6006](https://github.com/gfx-rs/wgpu/pull/6006).

### New Features

#### Wgpu

- Added initial acceleration structure and ray query support into wgpu. By @expenses @daniel-keitel @Vecvec @JMS55 @atlv24 in [#6291](https://github.com/gfx-rs/wgpu/pull/6291)

#### Naga

- Support constant evaluation for `firstLeadingBit` and `firstTrailingBit` numeric built-ins in WGSL. Front-ends that translate to these built-ins also benefit from constant evaluation. By @ErichDonGubler in [#5101](https://github.com/gfx-rs/wgpu/pull/5101).
Expand Down
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ cfg-if.workspace = true
encase = { workspace = true, features = ["glam"] }
flume.workspace = true
getrandom.workspace = true
glam.workspace = true
glam = { workspace = true, features = ["bytemuck"] }
ktx2.workspace = true
log.workspace = true
nanorand.workspace = true
Expand Down
84 changes: 45 additions & 39 deletions examples/README.md

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions examples/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ pub mod hello_windows;
pub mod hello_workgroups;
pub mod mipmap;
pub mod msaa_line;
pub mod ray_cube_compute;
pub mod ray_cube_fragment;
pub mod ray_scene;
pub mod ray_shadows;
pub mod ray_traced_triangle;
pub mod render_to_texture;
pub mod repeated_compute;
pub mod shadow;
Expand Down
30 changes: 30 additions & 0 deletions examples/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,36 @@ const EXAMPLES: &[ExampleDesc] = &[
webgl: false, // No RODS
webgpu: true,
},
ExampleDesc {
name: "ray_cube_compute",
function: wgpu_examples::ray_cube_compute::main,
webgl: false, // No Ray-tracing extensions
webgpu: false, // No Ray-tracing extensions (yet)
},
ExampleDesc {
name: "ray_cube_fragment",
function: wgpu_examples::ray_cube_fragment::main,
webgl: false, // No Ray-tracing extensions
webgpu: false, // No Ray-tracing extensions (yet)
},
ExampleDesc {
name: "ray_scene",
function: wgpu_examples::ray_scene::main,
webgl: false, // No Ray-tracing extensions
webgpu: false, // No Ray-tracing extensions (yet)
},
ExampleDesc {
name: "ray_shadows",
function: wgpu_examples::ray_shadows::main,
webgl: false, // No Ray-tracing extensions
webgpu: false, // No Ray-tracing extensions (yet)
},
ExampleDesc {
name: "ray_traced_triangle",
function: wgpu_examples::ray_traced_triangle::main,
webgl: false,
webgpu: false,
},
];

fn get_example_name() -> Option<String> {
Expand Down
14 changes: 14 additions & 0 deletions examples/src/ray_cube_compute/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# ray-cube

This example renders a ray traced cube with hardware acceleration.
A separate compute shader is used to perform the ray queries.

## To Run

```
cargo run --bin wgpu-examples ray_cube_compute
```

## Screenshots

![Cube example](screenshot.png)
52 changes: 52 additions & 0 deletions examples/src/ray_cube_compute/blit.wgsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
struct VertexOutput {
@builtin(position) position: vec4<f32>,
@location(0) tex_coords: vec2<f32>,
};

// meant to be called with 3 vertex indices: 0, 1, 2
// draws one large triangle over the clip space like this:
// (the asterisks represent the clip space bounds)
//-1,1 1,1
// ---------------------------------
// | * .
// | * .
// | * .
// | * .
// | * .
// | * .
// |***************
// | . 1,-1
// | .
// | .
// | .
// | .
// |.
@vertex
fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput {
var result: VertexOutput;
let x = i32(vertex_index) / 2;
let y = i32(vertex_index) & 1;
let tc = vec2<f32>(
f32(x) * 2.0,
f32(y) * 2.0
);
result.position = vec4<f32>(
tc.x * 2.0 - 1.0,
1.0 - tc.y * 2.0,
0.0, 1.0
);
result.tex_coords = tc;
return result;
}

@group(0)
@binding(0)
var r_color: texture_2d<f32>;
@group(0)
@binding(1)
var r_sampler: sampler;

@fragment
fn fs_main(vertex: VertexOutput) -> @location(0) vec4<f32> {
return textureSample(r_color, r_sampler, vertex.tex_coords);
}
Loading
Loading