-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Fix meshlet shaders for bindless mode. #16825
base: main
Are you sure you want to change the base?
Conversation
We have to extract the material ID from the mesh and stuff it in the vertex during visibility buffer resolution.
@@ -5,8 +5,7 @@ | |||
mesh_bindings::mesh | |||
} | |||
|
|||
fn sample_depth_map(uv: vec2<f32>, instance_index: u32) -> f32 { | |||
let slot = mesh[instance_index].material_bind_group_slot; | |||
fn sample_depth_map(uv: vec2<f32>, material_bind_group_slot: u32) -> 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.
Why did this change? Was it missed in an earlier PR?
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.
Not quite sure what you mean. It changed because we don't use that mesh
array in visbuffer resolution. If you're asking whether I didn't fix meshlets in an earlier PR, yes, I broke them (that's the whole point of this PR).
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.
Ah nvm I see that it used to get the slot in the function itself, and all you did was move it outside the function so that the slot could be obtained differently for meshlet meshes.
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.
Right.
@@ -12,6 +12,7 @@ | |||
} | |||
#import bevy_render::maths::{affine3_to_square, mat2x4_f32_to_mat3x3_unpack} | |||
|
|||
#ifndef MESHLET_MESH_MATERIAL_PASS |
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.
Why were the #ifndef MESHLET_MESH_MATERIAL_PASS
added here? Did they cause compilation issues?
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.
The mesh
array that's used in those functions isn't present during visbuffer resolution.
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.
Right, but I don't think that causes any actual issues, unless you try and use them? It was never an issue in 0.15. Unless a recent PR changed that. Anyways I'm fine with the ifdef, I was just wondering why it was added.
I can't test meshlets atm (don't have access to my desktop), but approving on the assumption that it was tested and this works. Code looks fine. |
We have to extract the material ID from the mesh and stuff it in the vertex during visibility buffer resolution.