mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 23:24:44 +00:00
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
1 changed files with 5 additions and 14 deletions
|
@ -19,9 +19,7 @@ use bevy_utils::{
|
|||
};
|
||||
use std::{hash::Hash, iter::FusedIterator, mem, ops::Deref};
|
||||
use thiserror::Error;
|
||||
use wgpu::{
|
||||
BufferBindingType, PipelineLayoutDescriptor, VertexBufferLayout as RawVertexBufferLayout,
|
||||
};
|
||||
use wgpu::{PipelineLayoutDescriptor, VertexBufferLayout as RawVertexBufferLayout};
|
||||
|
||||
use crate::render_resource::resource_macros::*;
|
||||
|
||||
|
@ -178,17 +176,10 @@ impl ShaderCache {
|
|||
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(
|
||||
String::from("AVAILABLE_STORAGE_BUFFER_BINDINGS"),
|
||||
3,
|
||||
));
|
||||
}
|
||||
shader_defs.push(ShaderDefVal::Int(
|
||||
String::from("AVAILABLE_STORAGE_BUFFER_BINDINGS"),
|
||||
render_device.limits().max_storage_buffers_per_shader_stage as i32,
|
||||
));
|
||||
|
||||
debug!(
|
||||
"processing shader {:?}, with shader defs {:?}",
|
||||
|
|
Loading…
Reference in a new issue