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>
This commit is contained in:
Stephen White
2022-01-28 22:36:58 +00:00
committed by Tint LUCI CQ
parent f34038b1a0
commit 0b39270e01
1735 changed files with 9397 additions and 30642 deletions

View File

@@ -1,26 +1,45 @@
#version 310 es
precision mediump float;
struct tint_symbol_2 {
vec2 a_particlePos;
vec2 a_particleVel;
vec2 a_pos;
layout(location = 0) in vec2 a_particlePos_1;
layout(location = 1) in vec2 a_particleVel_1;
layout(location = 2) in vec2 a_pos_1;
struct Particle {
vec2 pos;
vec2 vel;
};
struct tint_symbol_3 {
vec4 value;
struct SimParams {
float deltaT;
float rule1Distance;
float rule2Distance;
float rule3Distance;
float rule1Scale;
float rule2Scale;
float rule3Scale;
};
vec4 vert_main_inner(vec2 a_particlePos, vec2 a_particleVel, vec2 a_pos) {
struct Particles {
Particle particles[5];
};
vec4 vert_main(vec2 a_particlePos, vec2 a_particleVel, vec2 a_pos) {
float angle = -(atan(a_particleVel.x, a_particleVel.y));
vec2 pos = vec2(((a_pos.x * cos(angle)) - (a_pos.y * sin(angle))), ((a_pos.x * sin(angle)) + (a_pos.y * cos(angle))));
return vec4((pos + a_particlePos), 0.0f, 1.0f);
}
struct tint_symbol_4 {
vec4 value;
};
void main() {
vec4 inner_result = vert_main(a_particlePos_1, a_particleVel_1, a_pos_1);
gl_Position = inner_result;
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) out vec4 value;
struct Particle {
vec2 pos;
vec2 vel;
@@ -40,108 +59,18 @@ struct Particles {
Particle particles[5];
};
struct tint_symbol_6 {
uvec3 tint_symbol;
};
tint_symbol_3 vert_main(tint_symbol_2 tint_symbol_1) {
vec4 inner_result = vert_main_inner(tint_symbol_1.a_particlePos, tint_symbol_1.a_particleVel, tint_symbol_1.a_pos);
tint_symbol_3 wrapper_result = tint_symbol_3(vec4(0.0f, 0.0f, 0.0f, 0.0f));
wrapper_result.value = inner_result;
return wrapper_result;
}
layout(location = 0) in vec2 a_particlePos;
layout(location = 1) in vec2 a_particleVel;
layout(location = 2) in vec2 a_pos;
void main() {
tint_symbol_2 inputs;
inputs.a_particlePos = a_particlePos;
inputs.a_particleVel = a_particleVel;
inputs.a_pos = a_pos;
tint_symbol_3 outputs;
outputs = vert_main(inputs);
gl_Position = outputs.value;
gl_Position.z = 2.0 * gl_Position.z - gl_Position.w;
gl_Position.y = -gl_Position.y;
}
#version 310 es
precision mediump float;
struct tint_symbol_2 {
vec2 a_particlePos;
vec2 a_particleVel;
vec2 a_pos;
};
struct tint_symbol_3 {
vec4 value;
};
struct tint_symbol_4 {
vec4 value;
};
vec4 frag_main_inner() {
vec4 frag_main() {
return vec4(1.0f, 1.0f, 1.0f, 1.0f);
}
struct Particle {
vec2 pos;
vec2 vel;
};
struct SimParams {
float deltaT;
float rule1Distance;
float rule2Distance;
float rule3Distance;
float rule1Scale;
float rule2Scale;
float rule3Scale;
};
struct Particles {
Particle particles[5];
};
struct tint_symbol_6 {
uvec3 tint_symbol;
};
tint_symbol_4 frag_main() {
vec4 inner_result_1 = frag_main_inner();
tint_symbol_4 wrapper_result_1 = tint_symbol_4(vec4(0.0f, 0.0f, 0.0f, 0.0f));
wrapper_result_1.value = inner_result_1;
return wrapper_result_1;
}
layout(location = 0) out vec4 value;
void main() {
tint_symbol_4 outputs;
outputs = frag_main();
value = outputs.value;
vec4 inner_result = frag_main();
value = inner_result;
return;
}
#version 310 es
precision mediump float;
struct tint_symbol_2 {
vec2 a_particlePos;
vec2 a_particleVel;
vec2 a_pos;
};
struct tint_symbol_3 {
vec4 value;
};
struct tint_symbol_4 {
vec4 value;
};
struct Particle {
vec2 pos;
vec2 vel;
@@ -177,11 +106,7 @@ layout(binding = 1) buffer Particles_1 {
layout(binding = 2) buffer Particles_2 {
Particle particles[5];
} particlesB;
struct tint_symbol_6 {
uvec3 tint_symbol;
};
void comp_main_inner(uvec3 tint_symbol) {
void comp_main(uvec3 tint_symbol) {
uint index = tint_symbol.x;
if ((index >= 5u)) {
return;
@@ -241,15 +166,7 @@ void comp_main_inner(uvec3 tint_symbol) {
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void comp_main(tint_symbol_6 tint_symbol_5) {
comp_main_inner(tint_symbol_5.tint_symbol);
void main() {
comp_main(gl_GlobalInvocationID);
return;
}
void main() {
tint_symbol_6 inputs;
inputs.tint_symbol = gl_GlobalInvocationID;
comp_main(inputs);
}

View File

@@ -1,6 +1,9 @@
#version 310 es
precision mediump float;
layout(location = 0) in vec4 cur_position_1;
layout(location = 1) in vec4 color_1;
layout(location = 0) out vec4 vtxFragColor_1;
struct Uniforms {
mat4 modelViewProjectionMatrix;
};
@@ -19,59 +22,27 @@ struct VertexOutput {
vec4 Position;
};
struct tint_symbol_3 {
vec4 cur_position;
vec4 color;
};
struct tint_symbol_4 {
vec4 vtxFragColor;
vec4 Position;
};
VertexOutput vtx_main_inner(VertexInput tint_symbol) {
VertexOutput vtx_main(VertexInput tint_symbol) {
VertexOutput tint_symbol_1 = VertexOutput(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f));
tint_symbol_1.Position = (uniforms.modelViewProjectionMatrix * tint_symbol.cur_position);
tint_symbol_1.vtxFragColor = tint_symbol.color;
return tint_symbol_1;
}
struct tint_symbol_6 {
vec4 fragColor;
};
struct tint_symbol_7 {
vec4 value;
};
tint_symbol_4 vtx_main(tint_symbol_3 tint_symbol_2) {
VertexInput tint_symbol_8 = VertexInput(tint_symbol_2.cur_position, tint_symbol_2.color);
VertexOutput inner_result = vtx_main_inner(tint_symbol_8);
tint_symbol_4 wrapper_result = tint_symbol_4(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f));
wrapper_result.vtxFragColor = inner_result.vtxFragColor;
wrapper_result.Position = inner_result.Position;
return wrapper_result;
}
layout(location = 0) in vec4 cur_position;
layout(location = 1) in vec4 color;
layout(location = 0) out vec4 vtxFragColor;
void main() {
tint_symbol_3 inputs;
inputs.cur_position = cur_position;
inputs.color = color;
tint_symbol_4 outputs;
outputs = vtx_main(inputs);
vtxFragColor = outputs.vtxFragColor;
gl_Position = outputs.Position;
gl_Position.z = 2.0 * gl_Position.z - gl_Position.w;
gl_Position.y = -gl_Position.y;
VertexInput tint_symbol_2 = VertexInput(cur_position_1, color_1);
VertexOutput inner_result = vtx_main(tint_symbol_2);
vtxFragColor_1 = inner_result.vtxFragColor;
gl_Position = inner_result.Position;
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) in vec4 fragColor_1;
layout(location = 0) out vec4 value;
struct Uniforms {
mat4 modelViewProjectionMatrix;
};
@@ -86,42 +57,12 @@ struct VertexOutput {
vec4 Position;
};
struct tint_symbol_3 {
vec4 cur_position;
vec4 color;
};
struct tint_symbol_4 {
vec4 vtxFragColor;
vec4 Position;
};
struct tint_symbol_6 {
vec4 fragColor;
};
struct tint_symbol_7 {
vec4 value;
};
vec4 frag_main_inner(vec4 fragColor) {
vec4 frag_main(vec4 fragColor) {
return fragColor;
}
tint_symbol_7 frag_main(tint_symbol_6 tint_symbol_5) {
vec4 inner_result_1 = frag_main_inner(tint_symbol_5.fragColor);
tint_symbol_7 wrapper_result_1 = tint_symbol_7(vec4(0.0f, 0.0f, 0.0f, 0.0f));
wrapper_result_1.value = inner_result_1;
return wrapper_result_1;
}
layout(location = 0) in vec4 fragColor;
layout(location = 0) out vec4 value;
void main() {
tint_symbol_6 inputs;
inputs.fragColor = fragColor;
tint_symbol_7 outputs;
outputs = frag_main(inputs);
value = outputs.value;
vec4 inner_result = frag_main(fragColor_1);
value = inner_result;
return;
}

View File

@@ -1,12 +1,11 @@
#version 310 es
precision mediump float;
layout(local_size_x = 2, local_size_y = 1, local_size_z = 1) in;
void ep() {
return;
}
layout(local_size_x = 2, local_size_y = 1, local_size_z = 1) in;
void main() {
ep();
return;
}

View File

@@ -1,30 +1,18 @@
#version 310 es
precision mediump float;
layout(location = 0) out vec4 value;
void bar() {
}
struct tint_symbol_1 {
vec4 value;
};
vec4 tint_symbol_inner() {
vec4 tint_symbol() {
vec2 a = vec2(0.0f, 0.0f);
bar();
return vec4(0.400000006f, 0.400000006f, 0.800000012f, 1.0f);
}
tint_symbol_1 tint_symbol() {
vec4 inner_result = tint_symbol_inner();
tint_symbol_1 wrapper_result = tint_symbol_1(vec4(0.0f, 0.0f, 0.0f, 0.0f));
wrapper_result.value = inner_result;
return wrapper_result;
}
layout(location = 0) out vec4 value;
void main() {
tint_symbol_1 outputs;
outputs = tint_symbol();
value = outputs.value;
vec4 inner_result = tint_symbol();
value = inner_result;
return;
}

View File

@@ -11,29 +11,16 @@ struct main_out {
vec4 tint_symbol;
};
struct tint_symbol_2 {
vec4 tint_symbol;
};
main_out tint_symbol_1_inner() {
main_out tint_symbol_1() {
main_1();
main_out tint_symbol_3 = main_out(tint_symbol);
return tint_symbol_3;
main_out tint_symbol_2 = main_out(tint_symbol);
return tint_symbol_2;
}
tint_symbol_2 tint_symbol_1() {
main_out inner_result = tint_symbol_1_inner();
tint_symbol_2 wrapper_result = tint_symbol_2(vec4(0.0f, 0.0f, 0.0f, 0.0f));
wrapper_result.tint_symbol = inner_result.tint_symbol;
return wrapper_result;
}
void main() {
tint_symbol_2 outputs;
outputs = tint_symbol_1();
gl_Position = outputs.tint_symbol;
gl_Position.z = 2.0 * gl_Position.z - gl_Position.w;
gl_Position.y = -gl_Position.y;
main_out inner_result = tint_symbol_1();
gl_Position = inner_result.tint_symbol;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}

View File

@@ -2,71 +2,27 @@
precision mediump float;
const vec2 pos[3] = vec2[3](vec2(0.0f, 0.5f), vec2(-0.5f, -0.5f), vec2(0.5f, -0.5f));
struct tint_symbol_1 {
uint VertexIndex;
};
struct tint_symbol_2 {
vec4 value;
};
vec4 vtx_main_inner(uint VertexIndex) {
vec4 vtx_main(uint VertexIndex) {
return vec4(pos[VertexIndex], 0.0f, 1.0f);
}
struct tint_symbol_3 {
vec4 value;
};
tint_symbol_2 vtx_main(tint_symbol_1 tint_symbol) {
vec4 inner_result = vtx_main_inner(tint_symbol.VertexIndex);
tint_symbol_2 wrapper_result = tint_symbol_2(vec4(0.0f, 0.0f, 0.0f, 0.0f));
wrapper_result.value = inner_result;
return wrapper_result;
}
void main() {
tint_symbol_1 inputs;
inputs.VertexIndex = uint(gl_VertexID);
tint_symbol_2 outputs;
outputs = vtx_main(inputs);
gl_Position = outputs.value;
gl_Position.z = 2.0 * gl_Position.z - gl_Position.w;
gl_Position.y = -gl_Position.y;
vec4 inner_result = vtx_main(uint(gl_VertexID));
gl_Position = inner_result;
gl_Position.y = -(gl_Position.y);
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
#version 310 es
precision mediump float;
struct tint_symbol_1 {
uint VertexIndex;
};
struct tint_symbol_2 {
vec4 value;
};
struct tint_symbol_3 {
vec4 value;
};
vec4 frag_main_inner() {
layout(location = 0) out vec4 value;
vec4 frag_main() {
return vec4(1.0f, 0.0f, 0.0f, 1.0f);
}
tint_symbol_3 frag_main() {
vec4 inner_result_1 = frag_main_inner();
tint_symbol_3 wrapper_result_1 = tint_symbol_3(vec4(0.0f, 0.0f, 0.0f, 0.0f));
wrapper_result_1.value = inner_result_1;
return wrapper_result_1;
}
layout(location = 0) out vec4 value;
void main() {
tint_symbol_3 outputs;
outputs = frag_main();
value = outputs.value;
vec4 inner_result = frag_main();
value = inner_result;
return;
}