dawn-cmake/test/shader_io/shared_struct_helper_function.wgsl.expected.glsl
Stephen White 0b39270e01 GLSL: move entry point handling to CanonicalizeEntryPointIO transform.
Move builtin_to_string() and builtin_type() to
the CanonicalizeEntryPointIO transform. Use the former to
rename entry point IO variables to the gl_ names, and the latter
to cast values to the correct type.

Change-Id: Iddfad574ddd660ff1bfd89a399a001b967b6b67e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/78380
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
2022-01-28 22:36:58 +00:00

53 lines
1.0 KiB
GLSL

#version 310 es
precision mediump float;
layout(location = 0) flat out int loc0_1;
struct VertexOutput {
vec4 pos;
int loc0;
};
VertexOutput foo(float x) {
VertexOutput tint_symbol = VertexOutput(vec4(x, x, x, 1.0f), 42);
return tint_symbol;
}
VertexOutput vert_main1() {
return foo(0.5f);
}
void main() {
VertexOutput inner_result = vert_main1();
gl_Position = inner_result.pos;
loc0_1 = inner_result.loc0;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
layout(location = 0) flat out int loc0_1;
struct VertexOutput {
vec4 pos;
int loc0;
};
VertexOutput foo(float x) {
VertexOutput tint_symbol = VertexOutput(vec4(x, x, x, 1.0f), 42);
return tint_symbol;
}
VertexOutput vert_main2() {
return foo(0.25f);
}
void main() {
VertexOutput inner_result = vert_main2();
gl_Position = inner_result.pos;
loc0_1 = inner_result.loc0;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}