-
Notifications
You must be signed in to change notification settings - Fork 990
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
Implement ray query candidate intersection generation and confirmation #7047
Merged
+250
−45
Merged
Changes from all commits
Commits
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 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 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 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 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 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 |
---|---|---|
|
@@ -30,6 +30,7 @@ const RT_NAMESPACE: &str = "metal::raytracing"; | |
const RAY_QUERY_TYPE: &str = "_RayQuery"; | ||
const RAY_QUERY_FIELD_INTERSECTOR: &str = "intersector"; | ||
const RAY_QUERY_FIELD_INTERSECTION: &str = "intersection"; | ||
const RAY_QUERY_MODERN_SUPPORT: bool = false; //TODO | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be worth opening a new issue to track the transition to the new API. |
||
const RAY_QUERY_FIELD_READY: &str = "ready"; | ||
const RAY_QUERY_FUN_MAP_INTERSECTION: &str = "_map_intersection_type"; | ||
|
||
|
@@ -3506,16 +3507,41 @@ impl<W: Write> Writer<W> { | |
self.named_expressions.insert(result, name); | ||
self.put_expression(query, &context.expression, true)?; | ||
writeln!(self.out, ".{RAY_QUERY_FIELD_READY};")?; | ||
//TODO: actually proceed? | ||
|
||
write!(self.out, "{level}")?; | ||
self.put_expression(query, &context.expression, true)?; | ||
writeln!(self.out, ".{RAY_QUERY_FIELD_READY} = false;")?; | ||
if RAY_QUERY_MODERN_SUPPORT { | ||
write!(self.out, "{level}")?; | ||
self.put_expression(query, &context.expression, true)?; | ||
writeln!(self.out, ".?.next();")?; | ||
} | ||
} | ||
crate::RayQueryFunction::GenerateIntersection { hit_t } => { | ||
if RAY_QUERY_MODERN_SUPPORT { | ||
write!(self.out, "{level}")?; | ||
self.put_expression(query, &context.expression, true)?; | ||
write!(self.out, ".?.commit_bounding_box_intersection(")?; | ||
self.put_expression(hit_t, &context.expression, true)?; | ||
writeln!(self.out, ");")?; | ||
} else { | ||
log::warn!("Ray Query GenerateIntersection is not yet supported"); | ||
} | ||
} | ||
crate::RayQueryFunction::ConfirmIntersection => { | ||
if RAY_QUERY_MODERN_SUPPORT { | ||
write!(self.out, "{level}")?; | ||
self.put_expression(query, &context.expression, true)?; | ||
writeln!(self.out, ".?.commit_triangle_intersection();")?; | ||
} else { | ||
log::warn!("Ray Query ConfirmIntersection is not yet supported"); | ||
} | ||
} | ||
crate::RayQueryFunction::Terminate => { | ||
if RAY_QUERY_MODERN_SUPPORT { | ||
write!(self.out, "{level}")?; | ||
self.put_expression(query, &context.expression, true)?; | ||
writeln!(self.out, ".?.abort();")?; | ||
} | ||
write!(self.out, "{level}")?; | ||
self.put_expression(query, &context.expression, true)?; | ||
writeln!(self.out, ".{RAY_QUERY_FIELD_INTERSECTION}.abort();")?; | ||
writeln!(self.out, ".{RAY_QUERY_FIELD_READY} = false;")?; | ||
} | ||
} | ||
} | ||
|
This file contains 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 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 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 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 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 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 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 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 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 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.
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.
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.
It might not be helpful to have these formatting changes.
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.
Looks harmless though? Also, unintentional - my editor made them automatically.
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.
Yeah, but it made it slower to figure out what had changed. Personally I don't think this really needs to be fixed as it would be difficult but it might be worth turning that feature off in your editor if possible.
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.
While I agree, I think most people nowadays have whitespace stripping in their editors. Github also highlights only the whitespace being removed but it does clutter the blame.
It would be nice to not have trailing whitespace in files from the beginning but we decided against adding a CI check for that #6368 (comment).
Related: long term we would like to do these changes in bulk prior to releasing #6973.
In conclusion, I'd say these removals of whitespace are fine even though not ideal, they would either happen now or prior to a release.