Skip to content

Commit

Permalink
only consider global variables of storage class uniform, storage or h…
Browse files Browse the repository at this point in the history
…andle for bindings
  • Loading branch information
jakobhellermann committed May 15, 2021
1 parent 53b75bf commit 119951d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions crates/bevy_render/src/shader/shader_reflect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::convert::TryInto;

use bevy_core::AsBytes;
use bevy_utils::HashMap;
use naga::{ScalarKind, VectorSize};
use naga::{ScalarKind, StorageClass, VectorSize};

use crate::{
pipeline::{
Expand Down Expand Up @@ -148,6 +148,10 @@ fn reflect_bind_groups(
.global_variables
.iter()
.map(|(_, variable)| variable)
.filter(|variable| match variable.class {
StorageClass::Uniform | StorageClass::Storage | StorageClass::Handle => true,
_ => false,
})
.filter_map(|variable| {
let binding = variable.binding.as_ref()?;
Some((variable, binding))
Expand Down Expand Up @@ -269,7 +273,6 @@ fn reflect_bind_type(
has_dynamic_offset: false,
readonly: !variable.storage_access.contains(naga::StorageAccess::STORE),
},
naga::StorageClass::PushConstant => panic!("unsupported bind type: push constant"),
other => panic!("unexpected storage type for shader binding: {:?}", other),
}
}
Expand Down

0 comments on commit 119951d

Please sign in to comment.