-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Description
Bevy version and features
Bevy 0.16, but also on 0.17 and main AFAICT based on main not including my fix below (but I can't test my own game yet).
AdapterInfo { name: "Apple M1 Max", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }What you did
Turned on wireframes in my game. I have directional lights, ambient light, and possibly Lightmaps (can't remember if I do have them on right now, but I don't think this is too relevant).
What went wrong
It crashed.
wgpu error: Validation Error
Caused by:
In RenderPass::end
In a draw command, kind: MultiDrawIndirect
The BindGroupLayout with 'lightmapped_mesh_layout' label of current set BindGroup with 'lightmapped_mesh_bind_group' label at index 1 is not compatible with the corresponding BindGroupLayout with 'mesh_layout' label of RenderPipeline with 'wireframe_3d_pipeline' label
Assigned entry with binding 4 not found in expected bind group layout
Assigned entry with binding 5 not found in expected bind group layout
Additional information
This seems to be the same sort of problem reported in #11898 and fixed by #11910.
I applied a similar fix to crates/bevy_pbr/src/wireframe.rs in my local bevy fork and it fixes the panic:
if render_lightmaps
.render_lightmaps
.contains_key(visible_entity)
{
mesh_key |= MeshPipelineKey::LIGHTMAPPED;
}Commit here: mgi388@39e8816
This fixes the panic, and it feels like the right fix based on #11910, but I'm not 100% sure it's the right fix.
I haven't really tried to understand the fix so I didn't do a PR, and I'm also not sure how to adapt this comment:
// Even though we don't use the lightmap in the shadow map, the
// `SetMeshBindGroup` render command will bind the data for it. So
// we need to include the appropriate flag in the mesh pipeline key
// to ensure that the necessary bind group layout entries are
// present.
from the light module.
Also, I wonder if there are other places the fix needs to be applied?