Handle empty variable names in namer (#1484)

* Handle empty variable names in namer

* Add glsl-in test with empty global name
This commit is contained in:
Igor Shaposhnik authored and GitHub committed 2021-10-26 17:46:27 -04:00
1 parent 63dbd38edc
commit 00bbbed90a
3 files changed
+35 -1

No files matched your search

+7 -1
View File
@@ -117,7 +117,13 @@ impl Namer {
pub fn call_or(&mut self, label: &Option<String>, fallback: &str) -> String {
self.call(match *label {
Some(ref name) => name,
Some(ref name) => {
if name.trim().is_empty() {
fallback
} else {
name
}
}
None => fallback,
})
}
+7
View File
@@ -0,0 +1,7 @@
layout(set = 1, binding = 1) uniform TextureData {
vec4 material;
};
void main() {
vec2 coords = vec2(material.xy);
}
@@ -0,0 +1,21 @@
[[block]]
struct TextureData {
material: vec4<f32>;
};
[[group(1), binding(1)]]
var<uniform> global: TextureData;
fn main1() {
var coords: vec2<f32>;
let e2: vec4<f32> = global.material;
coords = vec2<f32>(e2.xy);
return;
}
[[stage(fragment)]]
fn main() {
main1();
return;
}