set AVAILABLE_STORAGE_BUFFER_BINDINGS to the actual number of buffers available (#6787)
# Objective - Since #5900 3d examples fail in wasm ``` ERROR crates/bevy_render/src/render_resource/pipeline_cache.rs:660 failed to process shader: Unknown shader def: 'AVAILABLE_STORAGE_BUFFER_BINDINGS' ``` ## Solution - Fix it by always adding the shaderdef `AVAILABLE_STORAGE_BUFFER_BINDINGS` with the actual value, instead of 3 when 3 or more were available
This commit is contained in:
parent
0d833a3ebc
commit
9c79b39d73
@ -19,9 +19,7 @@ use bevy_utils::{
|
|||||||
};
|
};
|
||||||
use std::{hash::Hash, iter::FusedIterator, mem, ops::Deref};
|
use std::{hash::Hash, iter::FusedIterator, mem, ops::Deref};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use wgpu::{
|
use wgpu::{PipelineLayoutDescriptor, VertexBufferLayout as RawVertexBufferLayout};
|
||||||
BufferBindingType, PipelineLayoutDescriptor, VertexBufferLayout as RawVertexBufferLayout,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::render_resource::resource_macros::*;
|
use crate::render_resource::resource_macros::*;
|
||||||
|
|
||||||
@ -178,17 +176,10 @@ impl ShaderCache {
|
|||||||
shader_defs.push("SIXTEEN_BYTE_ALIGNMENT".into());
|
shader_defs.push("SIXTEEN_BYTE_ALIGNMENT".into());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3 is the value from CLUSTERED_FORWARD_STORAGE_BUFFER_COUNT declared in bevy_pbr
|
|
||||||
// Using the value directly here to avoid the cyclic dependency
|
|
||||||
if matches!(
|
|
||||||
render_device.get_supported_read_only_binding_type(3),
|
|
||||||
BufferBindingType::Storage { .. }
|
|
||||||
) {
|
|
||||||
shader_defs.push(ShaderDefVal::Int(
|
shader_defs.push(ShaderDefVal::Int(
|
||||||
String::from("AVAILABLE_STORAGE_BUFFER_BINDINGS"),
|
String::from("AVAILABLE_STORAGE_BUFFER_BINDINGS"),
|
||||||
3,
|
render_device.limits().max_storage_buffers_per_shader_stage as i32,
|
||||||
));
|
));
|
||||||
}
|
|
||||||
|
|
||||||
debug!(
|
debug!(
|
||||||
"processing shader {:?}, with shader defs {:?}",
|
"processing shader {:?}, with shader defs {:?}",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user