-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Support DXR in wgpu-hal & naga. #6777
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
Merged
Merged
Changes from all commits
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
4be11ec
implement device calls
Vecvec 647ddd0
implement todo and fmt
Vecvec 0d0b2ab
properly implement todo and fix other clippy errors
Vecvec f91a482
don't use buffers in getting build sizes
Vecvec 951d437
fmt
Vecvec f017080
implement commands
Vecvec 23cc3a1
fix errors
Vecvec 6a2f362
implement hlsl out
Vecvec 7e2fc34
fix clippy warnings
Vecvec 2350e04
fix CI errors
Vecvec 4bdf0ed
fix CI errors #2
Vecvec 1750afb
fix CI errors #3
Vecvec 45ec097
fix CI errors #4
Vecvec 275d082
fix CI errors #5
Vecvec 3cc9801
check for sm 6.5
Vecvec dd99a08
implement rest of direct x ray queries
Vecvec 499fa9b
fix issues with ray-traced triangle
Vecvec 4f762e0
clippy & fmt
Vecvec f92221d
Merge remote-tracking branch 'refs/remotes/gfx-rs/trunk' into dx-ray-…
Vecvec 0877129
Merge remote-tracking branch 'refs/remotes/gfx-rs/trunk' into dx-ray-…
Vecvec 7576bbe
fix merge
Vecvec 44f73e6
fix build
Vecvec 02c8699
remove unused import
Vecvec 19caada
don't use `Direct3D12::D3D12_RESOURCE_FLAG_RAYTRACING_ACCELERATION_ST…
Vecvec 2493f04
support candidate intersections
Vecvec 3810051
write out values of constants, not their wgsl names.
Vecvec d6a4fee
format
Vecvec ef1ffd7
Merge remote-tracking branch 'refs/remotes/gfx-rs/trunk' into dx-ray-…
Vecvec 8a88223
fix merge
Vecvec f74a6da
remove println!
Vecvec 01e31e4
Remove unnecessary feature. This was preventing DXR from being used.
Vecvec 9a57f86
Remove println!()
Vecvec 1506561
Merge branch 'trunk' into dx-ray-tracing
Vecvec a66ebcf
Changelog
Vecvec f93a97d
Correctly use candidate instead of committed int the candidate inters…
Vecvec def77b5
swap the instance calls because have different names
Vecvec 93f700b
fmt
Vecvec 31715f4
regen snapshots
Vecvec f46ec3c
Merge branch 'trunk' into dx-ray-tracing
Vecvec 0de5a51
Merge branch 'trunk' into dx-ray-tracing
Vecvec 3b89172
Merge branch 'trunk' into dx-ray-tracing
cwfitzgerald 72676fc
Merge branch 'trunk' into dx-ray-tracing
Vecvec 45ed3f3
Merge branch 'trunk' into dx-ray-tracing
Vecvec 0aeed65
remove layout variable (all paths lead to the same value). Fix incorr…
Vecvec 9c54f4f
begin addressing comments
Vecvec 0665c93
address comments
Vecvec 31c6990
Merge branch 'trunk' into dx-ray-tracing
Vecvec c5fdde4
use rgba8
Vecvec d86619d
Merge branch 'trunk' into dx-ray-tracing
Vecvec 06fec21
clarify that DXR means DirectX Ray-tracing
Vecvec 0093945
Merge branch 'trunk' into dx-ray-tracing
Vecvec 21c25ab
Merge remote-tracking branch 'trunk/trunk' into dx-ray-tracing
Vecvec d1840aa
Merge remote-tracking branch 'trunk/trunk' into dx-ray-tracing
Vecvec 261941b
Address feedback.
Vecvec 4d92eb7
Merge branch 'trunk' into dx-ray-tracing
Vecvec 05179e0
Merge branch 'trunk' into dx-ray-tracing
cwfitzgerald eb14b30
check that it only writes intersection getters once.
Vecvec db8a6a8
address uses feedback
Vecvec 6c83651
Clippy & format.
Vecvec File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
use crate::back::hlsl::BackendResult; | ||
use crate::{RayQueryIntersection, TypeInner}; | ||
use std::fmt::Write; | ||
|
||
impl<W: Write> super::Writer<'_, W> { | ||
// constructs hlsl RayDesc from wgsl RayDesc | ||
pub(super) fn write_ray_desc_from_ray_desc_constructor_function( | ||
&mut self, | ||
module: &crate::Module, | ||
) -> BackendResult { | ||
write!(self.out, "RayDesc RayDescFromRayDesc_(")?; | ||
self.write_type(module, module.special_types.ray_desc.unwrap())?; | ||
writeln!(self.out, " arg0) {{")?; | ||
writeln!(self.out, " RayDesc ret = (RayDesc)0;")?; | ||
writeln!(self.out, " ret.Origin = arg0.origin;")?; | ||
writeln!(self.out, " ret.TMin = arg0.tmin;")?; | ||
writeln!(self.out, " ret.Direction = arg0.dir;")?; | ||
writeln!(self.out, " ret.TMax = arg0.tmax;")?; | ||
writeln!(self.out, " return ret;")?; | ||
writeln!(self.out, "}}")?; | ||
writeln!(self.out)?; | ||
Ok(()) | ||
} | ||
pub(super) fn write_committed_intersection_function( | ||
&mut self, | ||
module: &crate::Module, | ||
) -> BackendResult { | ||
self.write_type(module, module.special_types.ray_intersection.unwrap())?; | ||
write!(self.out, " GetCommittedIntersection(")?; | ||
self.write_value_type(module, &TypeInner::RayQuery)?; | ||
writeln!(self.out, " rq) {{")?; | ||
write!(self.out, " ")?; | ||
self.write_type(module, module.special_types.ray_intersection.unwrap())?; | ||
write!(self.out, " ret = (")?; | ||
self.write_type(module, module.special_types.ray_intersection.unwrap())?; | ||
writeln!(self.out, ")0;")?; | ||
writeln!(self.out, " ret.kind = rq.CommittedStatus();")?; | ||
writeln!( | ||
self.out, | ||
" if( rq.CommittedStatus() == COMMITTED_NOTHING) {{}} else {{" | ||
)?; | ||
writeln!(self.out, " ret.t = rq.CommittedRayT();")?; | ||
writeln!( | ||
self.out, | ||
" ret.instance_custom_index = rq.CommittedInstanceID();" | ||
)?; | ||
writeln!( | ||
self.out, | ||
" ret.instance_id = rq.CommittedInstanceIndex();" | ||
)?; | ||
writeln!( | ||
self.out, | ||
" ret.sbt_record_offset = rq.CommittedInstanceContributionToHitGroupIndex();" | ||
)?; | ||
writeln!( | ||
self.out, | ||
" ret.geometry_index = rq.CommittedGeometryIndex();" | ||
)?; | ||
writeln!( | ||
self.out, | ||
" ret.primitive_index = rq.CommittedPrimitiveIndex();" | ||
)?; | ||
writeln!( | ||
self.out, | ||
" if( rq.CommittedStatus() == COMMITTED_TRIANGLE_HIT ) {{" | ||
)?; | ||
writeln!( | ||
self.out, | ||
" ret.barycentrics = rq.CommittedTriangleBarycentrics();" | ||
)?; | ||
writeln!( | ||
self.out, | ||
" ret.front_face = rq.CommittedTriangleFrontFace();" | ||
)?; | ||
writeln!(self.out, " }}")?; | ||
writeln!( | ||
self.out, | ||
" ret.object_to_world = rq.CommittedObjectToWorld4x3();" | ||
)?; | ||
writeln!( | ||
self.out, | ||
" ret.world_to_object = rq.CommittedWorldToObject4x3();" | ||
)?; | ||
writeln!(self.out, " }}")?; | ||
writeln!(self.out, " return ret;")?; | ||
writeln!(self.out, "}}")?; | ||
writeln!(self.out)?; | ||
Ok(()) | ||
} | ||
pub(super) fn write_candidate_intersection_function( | ||
&mut self, | ||
module: &crate::Module, | ||
) -> BackendResult { | ||
self.write_type(module, module.special_types.ray_intersection.unwrap())?; | ||
write!(self.out, " GetCandidateIntersection(")?; | ||
self.write_value_type(module, &TypeInner::RayQuery)?; | ||
writeln!(self.out, " rq) {{")?; | ||
write!(self.out, " ")?; | ||
self.write_type(module, module.special_types.ray_intersection.unwrap())?; | ||
write!(self.out, " ret = (")?; | ||
self.write_type(module, module.special_types.ray_intersection.unwrap())?; | ||
writeln!(self.out, ")0;")?; | ||
writeln!(self.out, " CANDIDATE_TYPE kind = rq.CandidateType();")?; | ||
writeln!( | ||
self.out, | ||
" if (kind == CANDIDATE_NON_OPAQUE_TRIANGLE) {{" | ||
)?; | ||
writeln!( | ||
self.out, | ||
" ret.kind = {};", | ||
RayQueryIntersection::Triangle as u32 | ||
)?; | ||
writeln!(self.out, " ret.t = rq.CandidateTriangleRayT();")?; | ||
writeln!( | ||
self.out, | ||
" ret.barycentrics = rq.CandidateTriangleBarycentrics();" | ||
)?; | ||
writeln!( | ||
self.out, | ||
" ret.front_face = rq.CandidateTriangleFrontFace();" | ||
)?; | ||
writeln!(self.out, " }} else {{")?; | ||
writeln!( | ||
self.out, | ||
" ret.kind = {};", | ||
RayQueryIntersection::Aabb as u32 | ||
)?; | ||
writeln!(self.out, " }}")?; | ||
|
||
writeln!( | ||
self.out, | ||
" ret.instance_custom_index = rq.CandidateInstanceID();" | ||
)?; | ||
writeln!( | ||
self.out, | ||
" ret.instance_id = rq.CandidateInstanceIndex();" | ||
)?; | ||
writeln!( | ||
self.out, | ||
" ret.sbt_record_offset = rq.CandidateInstanceContributionToHitGroupIndex();" | ||
)?; | ||
writeln!( | ||
self.out, | ||
" ret.geometry_index = rq.CandidateGeometryIndex();" | ||
)?; | ||
writeln!( | ||
self.out, | ||
" ret.primitive_index = rq.CandidatePrimitiveIndex();" | ||
)?; | ||
writeln!( | ||
self.out, | ||
" ret.object_to_world = rq.CandidateObjectToWorld4x3();" | ||
)?; | ||
writeln!( | ||
self.out, | ||
" ret.world_to_object = rq.CandidateWorldToObject4x3();" | ||
)?; | ||
writeln!(self.out, " return ret;")?; | ||
writeln!(self.out, "}}")?; | ||
writeln!(self.out)?; | ||
Ok(()) | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.