-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Naga mesh shader WGSL writer #8481
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
base: trunk
Are you sure you want to change the base?
Naga mesh shader WGSL writer #8481
Conversation
|
All changes are in Dunno what's up with the PR history lol. |
|
First comments
|
I though so, but wasn't sure. Will change,
Ah yep, not sure how I missed that one.
Because I am a clutz, and didn't sanity check that after going "Yay it no longer crashes".
Whoops, that's what I get for not looking at the correct spec document.
Not sure what you mean by this?
Again, not sure what you mean. I may just be being a bit thick though |
|
For the snapshot, you will want to go to Then run |
inner-daemons
left a comment
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.
Generally pretty good, some comments. Also please format your code and make sure that CI passes. At the bottom of the github page it'll say stuff like "CI / Test Linux x86_64 (pull_request) Failing after 4m", you can usually figure out the error by reading through these logs
| if shader_stage == ShaderStage::Mesh { | ||
| write!( | ||
| self.out, | ||
| "@{stage_str}({})", |
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.
| "@{stage_str}({})", | |
| "@{stage_str}({}) ", |
|
|
||
| [msl] | ||
| fake_missing_bindings = true | ||
| lang_version = [2, 4] | ||
| spirv_cross_compatibility = false | ||
| zero_initialize_workgroup_memory = false | ||
|
|
||
| [hlsl] | ||
| shader_model = "V6_5" | ||
| fake_missing_bindings = true | ||
| zero_initialize_workgroup_memory = true | ||
|
|
||
| [spv] | ||
| version = [1, 4] | ||
| capabilities = ["MeshShadingEXT"] |
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.
| [msl] | |
| fake_missing_bindings = true | |
| lang_version = [2, 4] | |
| spirv_cross_compatibility = false | |
| zero_initialize_workgroup_memory = false | |
| [hlsl] | |
| shader_model = "V6_5" | |
| fake_missing_bindings = true | |
| zero_initialize_workgroup_memory = true | |
| [spv] | |
| version = [1, 4] | |
| capabilities = ["MeshShadingEXT"] |
| # Stolen from ray-query.toml | ||
|
|
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.
| # Stolen from ray-query.toml |
|
|
||
| god_mode = true | ||
| targets = "IR | ANALYSIS" | ||
| targets = "IR | ANALYSIS | WGSL" |
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.
Can you apply this change to the other files here, like mesh-shader-lines.toml etc
| let det = (m[0][0] * adj[0][0] + m[0][1] * adj[1][0] + m[0][2] * adj[2][0] + m[0][3] * adj[3][0]); | ||
|
|
||
| return adj * (1 / det); | ||
| fn _naga_inverse_4x4_f32(m: mat4x4<f32>) -> mat4x4<f32> { |
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.
Can you undo this? You can just run git checkout trunk -- naga/tests/out/wgsl/glsl-inverse-pollyfill.frag.wgsl
Unsure if this is due to changing the tabs to spaces/vice versa or due to line endings, I suspect the first
| fn write_attributes( | ||
| &mut self, | ||
| attributes: &[Attribute], | ||
| mesh_output_variable: Option<String>, |
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.
Lets not have this as another args, can you change the mesh stage attribute to being a special enum variant with this?
| if per_primitive { | ||
| vec![ | ||
| Attribute::PerPrimitive, | ||
| Attribute::Location(location), | ||
| Attribute::BlendSrc(blend_src), | ||
| Attribute::Interpolate(interpolation, sampling), | ||
| ] | ||
| } else { | ||
| vec![ | ||
| Attribute::Location(location), | ||
| Attribute::BlendSrc(blend_src), | ||
| Attribute::Interpolate(interpolation, sampling), | ||
| ] | ||
| } |
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.
Lets try to just have one vector, and add an extra PerPrimitive element to it if needed
| | Bi::LineIndices | ||
| | Bi::MeshTaskSize | ||
| | Bi::PointIndex | ||
| | Bi::VertexCount | ||
| | Bi::PrimitiveCount | ||
| | Bi::Vertices | ||
| | Bi::Primitives => return None, | ||
| | Bi::PointIndex => return None, |
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.
These should also be written, just like TriangleIndices
| if per_primitive { | ||
| vec![ | ||
| Attribute::PerPrimitive, | ||
| Attribute::Location(location), | ||
| Attribute::Interpolate(interpolation, sampling), | ||
| ] | ||
| } else { | ||
| vec![ | ||
| Attribute::Location(location), | ||
| Attribute::Interpolate(interpolation, sampling), | ||
| ] | ||
| } |
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.
Lets try to just have one vector, and add an extra PerPrimitive element to it if needed
| if ep.task_payload.is_some() { | ||
| let payload_name = module.global_variables[ep.task_payload.unwrap()] | ||
| .name | ||
| .clone() | ||
| .unwrap(); | ||
| vec![ | ||
| Attribute::Stage(ShaderStage::Mesh), | ||
| Attribute::MeshTaskPayload(payload_name), | ||
| Attribute::WorkGroupSize(ep.workgroup_size), | ||
| ] | ||
| } else { | ||
| vec![ | ||
| Attribute::Stage(ShaderStage::Mesh), | ||
| Attribute::WorkGroupSize(ep.workgroup_size), | ||
| ] | ||
| } |
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.
Lets try to just have one vector, and add an extra TaskPayload element to it if needed
|
Also feel free to mark this as no longer a draft And just to manage expectations, this probably won't be merged until at least the 26th, as I don't have the power to do that so it'll have to have a second review (hopefully with fewer comments) |
Connections
Based off of #8370
Description
Adds a WGSL writer for mesh shader functionality.
Testing
TODO
Squash or Rebase?
Squash
Checklist
cargo fmt.taplo format.cargo clippy --tests. If applicable, add:--target wasm32-unknown-unknowncargo xtask testto run tests.CHANGELOG.mdentry.