glsl-out: Add test for push constants

This commit is contained in:
João Capucho 2022-01-16 12:42:57 +00:00 committed by Dzmitry Malyshau
parent 91ca923553
commit a1840beb1a
4 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,9 @@
(
god_mode: true,
glsl: (
version: Embedded(320),
writer_flags: (bits: 0),
binding_map: {},
push_constant_binding: 4,
),
)

View File

@ -0,0 +1,13 @@
struct PushConstants {
multiplier: f32;
};
var<push_constant> pc: PushConstants;
struct FragmentIn {
[[location(0)]] color: vec4<f32>;
};
[[stage(fragment)]]
fn main(in: FragmentIn) -> [[location(0)]] vec4<f32> {
return in.color * pc.multiplier;
}

View File

@ -0,0 +1,23 @@
#version 320 es
precision highp float;
precision highp int;
struct PushConstants {
float multiplier;
};
struct FragmentIn {
vec4 color;
};
layout(std140, binding = 4) uniform PushConstants_block_0Fragment { PushConstants pc; };
layout(location = 0) smooth in vec4 _vs2fs_location0;
layout(location = 0) out vec4 _fs2p_location0;
void main() {
FragmentIn in_ = FragmentIn(_vs2fs_location0);
float _e4 = pc.multiplier;
_fs2p_location0 = (in_.color * _e4);
return;
}

View File

@ -439,6 +439,7 @@ fn convert_wgsl() {
Targets::SPIRV | Targets::METAL | Targets::HLSL | Targets::WGSL | Targets::GLSL,
),
("extra", Targets::SPIRV | Targets::METAL | Targets::WGSL),
("push-constants", Targets::GLSL),
(
"operators",
Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL,