Conversation
Writes the primitive_index to a secondary render target and uses that to highlight the primitive that the pointer is over on subsequent frames.
greggman
approved these changes
Sep 23, 2025
Collaborator
greggman
left a comment
There was a problem hiding this comment.
This is great!
I think it might be nice to add a few more comments in the code. I also notice lots of inconsistent formatting like a: b vs a : b and a + b vs a+b. I don't mind but just thought I'd point it out. npm run lint though does complain about some things though.
Contributor
Author
|
Updated with more comments all around, as well as addressing your feedback. I think the formatting issues you pointed out were in the WGSL files, which is why they weren't showing up for my with lint. |
beaufortfrancois
requested changes
Sep 24, 2025
Collaborator
beaufortfrancois
left a comment
There was a problem hiding this comment.
This is a great sample. Thanks @toji!
Co-authored-by: François Beaufort <beaufort.francois@gmail.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Writes the
primitive_indexto a secondary render target and uses that to highlight the primitive that the pointer is over on subsequent frames. Also includes a mode that visualizes the primitive index. Used as a (somewhat contrived) example of using theprimitive_indexbuiltin.This was based on the deferred shading sample, but has been modified significantly.