mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
Remove unnecessary "gl_PerVertex" name check so unused builtins will be
handled even when this name is not in the input SPIRV.
This commit is contained in:
parent
18b7904b8e
commit
b704132b4c
@ -121,6 +121,7 @@ Bottom level categories:
|
||||
|
||||
#### Naga
|
||||
- Make use of `GL_EXT_texture_shadow_lod` to support sampling a cube depth texture with an explicit LOD. By @cmrschwarz in #[5171](https://github.com/gfx-rs/wgpu/pull/5171).
|
||||
- In spv-in, remove unnecessary "gl_PerVertex" name check so unused builtins will always be skipped. By @Imberflur in [#5227](https://github.com/gfx-rs/wgpu/pull/5227).
|
||||
|
||||
#### Tests
|
||||
|
||||
|
@ -376,34 +376,33 @@ impl<I: Iterator<Item = u32>> super::Frontend<I> {
|
||||
// See the docs for `Frontend::gl_per_vertex_builtin_access`.
|
||||
{
|
||||
let ty = &module.types[result.ty];
|
||||
match ty.inner {
|
||||
crate::TypeInner::Struct {
|
||||
members: ref original_members,
|
||||
span,
|
||||
} if ty.name.as_deref() == Some("gl_PerVertex") => {
|
||||
let mut new_members = original_members.clone();
|
||||
for member in &mut new_members {
|
||||
if let Some(crate::Binding::BuiltIn(built_in)) = member.binding
|
||||
{
|
||||
if !self.gl_per_vertex_builtin_access.contains(&built_in) {
|
||||
member.binding = None
|
||||
}
|
||||
if let crate::TypeInner::Struct {
|
||||
members: ref original_members,
|
||||
span,
|
||||
} = ty.inner
|
||||
{
|
||||
let mut new_members = None;
|
||||
for (idx, member) in original_members.iter().enumerate() {
|
||||
if let Some(crate::Binding::BuiltIn(built_in)) = member.binding {
|
||||
if !self.gl_per_vertex_builtin_access.contains(&built_in) {
|
||||
new_members
|
||||
.get_or_insert_with(|| original_members.clone())[idx]
|
||||
.binding = None;
|
||||
}
|
||||
}
|
||||
if &new_members != original_members {
|
||||
module.types.replace(
|
||||
result.ty,
|
||||
crate::Type {
|
||||
name: ty.name.clone(),
|
||||
inner: crate::TypeInner::Struct {
|
||||
members: new_members,
|
||||
span,
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
if let Some(new_members) = new_members {
|
||||
module.types.replace(
|
||||
result.ty,
|
||||
crate::Type {
|
||||
name: ty.name.clone(),
|
||||
inner: crate::TypeInner::Struct {
|
||||
members: new_members,
|
||||
span,
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1561,12 +1561,10 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
|
||||
span,
|
||||
);
|
||||
|
||||
if ty.name.as_deref() == Some("gl_PerVertex") {
|
||||
if let Some(crate::Binding::BuiltIn(built_in)) =
|
||||
members[index as usize].binding
|
||||
{
|
||||
self.gl_per_vertex_builtin_access.insert(built_in);
|
||||
}
|
||||
if let Some(crate::Binding::BuiltIn(built_in)) =
|
||||
members[index as usize].binding
|
||||
{
|
||||
self.gl_per_vertex_builtin_access.insert(built_in);
|
||||
}
|
||||
|
||||
AccessExpression {
|
||||
|
Loading…
Reference in New Issue
Block a user