Ensure instance_index push constant is always used in prepass.wgsl (#10706)
# Objective Kind of helps #10509 ## Solution Add a line to `prepass.wgsl` that ensure the `instance_index` push constant is always used on WebGL 2. This is not a full fix, as the _second_ a custom shader is used that doesn't use the push constant, the breakage will resurface. We have satisfying medium term and long term solutions. This is just a short term hack for 0.12.1 that will make more cases work. See #10509 for more details.
This commit is contained in:
		
							parent
							
								
									879893c30a
								
							
						
					
					
						commit
						90958104cb
					
				@ -107,6 +107,12 @@ fn vertex(vertex_no_morph: Vertex) -> VertexOutput {
 | 
			
		||||
    // See https://github.com/gfx-rs/naga/issues/2416
 | 
			
		||||
    out.instance_index = get_instance_index(vertex_no_morph.instance_index);
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef BASE_INSTANCE_WORKAROUND
 | 
			
		||||
    // Hack: this ensures the push constant is always used, which works around this issue:
 | 
			
		||||
    // https://github.com/bevyengine/bevy/issues/10509
 | 
			
		||||
    // This can be removed when wgpu 0.19 is released
 | 
			
		||||
    out.position.x += min(f32(get_instance_index(0u)), 0.0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    return out;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -88,6 +88,13 @@ fn vertex(vertex_no_morph: Vertex) -> VertexOutput {
 | 
			
		||||
    out.instance_index = get_instance_index(vertex_no_morph.instance_index);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef BASE_INSTANCE_WORKAROUND
 | 
			
		||||
    // Hack: this ensures the push constant is always used, which works around this issue:
 | 
			
		||||
    // https://github.com/bevyengine/bevy/issues/10509
 | 
			
		||||
    // This can be removed when wgpu 0.19 is released
 | 
			
		||||
    out.position.x += min(f32(get_instance_index(0u)), 0.0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    return out;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user