mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
glsl-out: Add test for push constants
This commit is contained in:
committed by
Dzmitry Malyshau
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,
|
Targets::SPIRV | Targets::METAL | Targets::HLSL | Targets::WGSL | Targets::GLSL,
|
||||||
),
|
),
|
||||||
("extra", Targets::SPIRV | Targets::METAL | Targets::WGSL),
|
("extra", Targets::SPIRV | Targets::METAL | Targets::WGSL),
|
||||||
|
("push-constants", Targets::GLSL),
|
||||||
(
|
(
|
||||||
"operators",
|
"operators",
|
||||||
Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL,
|
Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL,
|
||||||
|
|||||||
Reference in New Issue
Block a user