mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 16:24:24 +00:00
glsl-out: Add test for push constants
This commit is contained in:
parent
91ca923553
commit
a1840beb1a
9
tests/in/push-constants.param.ron
Normal file
9
tests/in/push-constants.param.ron
Normal file
@ -0,0 +1,9 @@
|
||||
(
|
||||
god_mode: true,
|
||||
glsl: (
|
||||
version: Embedded(320),
|
||||
writer_flags: (bits: 0),
|
||||
binding_map: {},
|
||||
push_constant_binding: 4,
|
||||
),
|
||||
)
|
13
tests/in/push-constants.wgsl
Normal file
13
tests/in/push-constants.wgsl
Normal 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;
|
||||
}
|
23
tests/out/glsl/push-constants.main.Fragment.glsl
Normal file
23
tests/out/glsl/push-constants.main.Fragment.glsl
Normal 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;
|
||||
}
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user