mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
glsl-in: Add test for conditional builtin inject
This commit is contained in:
committed by
Dzmitry Malyshau
parent
9f62feee87
commit
1ccfc8991e
9
tests/in/variations.glsl
Normal file
9
tests/in/variations.glsl
Normal file
@@ -0,0 +1,9 @@
|
||||
#version 460 core
|
||||
|
||||
layout(set = 0, binding = 0) uniform textureCube texCube;
|
||||
layout(set = 0, binding = 1) uniform sampler samp;
|
||||
|
||||
void main() {
|
||||
ivec2 sizeCube = textureSize(samplerCube(texCube, samp), 0);
|
||||
float a = ceil(1.0);
|
||||
}
|
||||
21
tests/out/glsl/variations-glsl.main.Fragment.glsl
Normal file
21
tests/out/glsl/variations-glsl.main.Fragment.glsl
Normal file
@@ -0,0 +1,21 @@
|
||||
#version 310 es
|
||||
|
||||
precision highp float;
|
||||
precision highp int;
|
||||
|
||||
uniform highp samplerCube _group_0_binding_0_fs;
|
||||
|
||||
|
||||
void main_1() {
|
||||
ivec2 sizeCube = ivec2(0);
|
||||
float a = 0.0;
|
||||
sizeCube = textureSize(_group_0_binding_0_fs, 0).xy;
|
||||
a = ceil(1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
void main() {
|
||||
main_1();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -556,6 +556,25 @@ fn convert_spv_all() {
|
||||
convert_spv("degrees", false, Targets::empty());
|
||||
}
|
||||
|
||||
#[cfg(feature = "glsl-in")]
|
||||
#[test]
|
||||
fn convert_glsl_variations_check() {
|
||||
let root = env!("CARGO_MANIFEST_DIR");
|
||||
let file = fs::read_to_string(format!("{}/{}/variations.glsl", root, BASE_DIR_IN))
|
||||
.expect("Couldn't find glsl file");
|
||||
let mut parser = naga::front::glsl::Parser::default();
|
||||
let module = parser
|
||||
.parse(
|
||||
&naga::front::glsl::Options {
|
||||
stage: naga::ShaderStage::Fragment,
|
||||
defines: Default::default(),
|
||||
},
|
||||
&file,
|
||||
)
|
||||
.unwrap();
|
||||
check_targets(&module, "variations-glsl", Targets::GLSL);
|
||||
}
|
||||
|
||||
#[cfg(feature = "glsl-in")]
|
||||
#[allow(unused_variables)]
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user