mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 15:14:50 +00:00
add NO_STORAGE_BUFFERS_SUPPORT shaderdef when needed (#4949)
# Objective - fix #4946 - fix running 3d in wasm ## Solution - since #4867, the imports are splitter differently, and this shader def was not always set correctly depending on the shader used - add it when needed
This commit is contained in:
parent
25219a4d18
commit
193998b5d4
1 changed files with 12 additions and 0 deletions
|
@ -212,6 +212,7 @@ pub struct ShadowPipeline {
|
|||
pub skinned_mesh_layout: BindGroupLayout,
|
||||
pub point_light_sampler: Sampler,
|
||||
pub directional_light_sampler: Sampler,
|
||||
pub clustered_forward_buffer_binding_type: BufferBindingType,
|
||||
}
|
||||
|
||||
// TODO: this pattern for initializing the shaders / pipeline isn't ideal. this should be handled by the asset system
|
||||
|
@ -220,6 +221,9 @@ impl FromWorld for ShadowPipeline {
|
|||
let world = world.cell();
|
||||
let render_device = world.resource::<RenderDevice>();
|
||||
|
||||
let clustered_forward_buffer_binding_type = render_device
|
||||
.get_supported_read_only_binding_type(CLUSTERED_FORWARD_STORAGE_BUFFER_COUNT);
|
||||
|
||||
let view_layout = render_device.create_bind_group_layout(&BindGroupLayoutDescriptor {
|
||||
entries: &[
|
||||
// View
|
||||
|
@ -264,6 +268,7 @@ impl FromWorld for ShadowPipeline {
|
|||
compare: Some(CompareFunction::GreaterEqual),
|
||||
..Default::default()
|
||||
}),
|
||||
clustered_forward_buffer_binding_type,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -325,6 +330,13 @@ impl SpecializedMeshPipeline for ShadowPipeline {
|
|||
bind_group_layout.push(self.mesh_layout.clone());
|
||||
}
|
||||
|
||||
if !matches!(
|
||||
self.clustered_forward_buffer_binding_type,
|
||||
BufferBindingType::Storage { .. }
|
||||
) {
|
||||
shader_defs.push(String::from("NO_STORAGE_BUFFERS_SUPPORT"));
|
||||
}
|
||||
|
||||
let vertex_buffer_layout = layout.get_layout(&vertex_attributes)?;
|
||||
|
||||
Ok(RenderPipelineDescriptor {
|
||||
|
|
Loading…
Reference in a new issue