diff --git a/tests/in/push-constants.param.ron b/tests/in/push-constants.param.ron new file mode 100644 index 0000000000..4e25193b0f --- /dev/null +++ b/tests/in/push-constants.param.ron @@ -0,0 +1,9 @@ +( + god_mode: true, + glsl: ( + version: Embedded(320), + writer_flags: (bits: 0), + binding_map: {}, + push_constant_binding: 4, + ), +) diff --git a/tests/in/push-constants.wgsl b/tests/in/push-constants.wgsl new file mode 100644 index 0000000000..bb5b0e732a --- /dev/null +++ b/tests/in/push-constants.wgsl @@ -0,0 +1,13 @@ +struct PushConstants { + multiplier: f32; +}; +var pc: PushConstants; + +struct FragmentIn { + [[location(0)]] color: vec4; +}; + +[[stage(fragment)]] +fn main(in: FragmentIn) -> [[location(0)]] vec4 { + return in.color * pc.multiplier; +} diff --git a/tests/out/glsl/push-constants.main.Fragment.glsl b/tests/out/glsl/push-constants.main.Fragment.glsl new file mode 100644 index 0000000000..3a9f896c3d --- /dev/null +++ b/tests/out/glsl/push-constants.main.Fragment.glsl @@ -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; +} + diff --git a/tests/snapshots.rs b/tests/snapshots.rs index dbc86b682d..dd3bd0ccc0 100644 --- a/tests/snapshots.rs +++ b/tests/snapshots.rs @@ -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,