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

@@ -3,19 +3,18 @@ SKIP: FAILED
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
float r = (1.0f % 0.0f);
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}
Error parsing GLSL shader:
ERROR: 0:6: '%' : wrong operand types: no operation '%' exists that takes a left-hand operand of type ' const float' and a right operand of type ' const float' (or there is no acceptable conversion)
ERROR: 0:6: '' : compilation terminated
ERROR: 0:5: '%' : wrong operand types: no operation '%' exists that takes a left-hand operand of type ' const float' and a right operand of type ' const float' (or there is no acceptable conversion)
ERROR: 0:5: '' : compilation terminated
ERROR: 2 compilation errors. No code generated.

View File

@@ -1,13 +1,12 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
int r = (1 % 0);
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -1,13 +1,12 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
uint r = (1u % 0u);
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -1,15 +1,14 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
int a = 4;
ivec3 b = ivec3(0, 2, 0);
ivec3 r = (a % b);
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -1,15 +1,14 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
uint a = 4u;
uvec3 b = uvec3(0u, 2u, 0u);
uvec3 r = (a % b);
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -1,14 +1,13 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
ivec3 a = ivec3(1, 2, 3);
ivec3 r = (a % 0);
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -1,14 +1,13 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
uvec3 a = uvec3(1u, 2u, 3u);
uvec3 r = (a % 0u);
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -3,21 +3,20 @@ SKIP: FAILED
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
vec3 a = vec3(1.0f, 2.0f, 3.0f);
vec3 b = vec3(0.0f, 5.0f, 0.0f);
vec3 r = (a % b);
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}
Error parsing GLSL shader:
ERROR: 0:8: '%' : wrong operand types: no operation '%' exists that takes a left-hand operand of type ' temp mediump 3-component vector of float' and a right operand of type ' temp mediump 3-component vector of float' (or there is no acceptable conversion)
ERROR: 0:8: '' : compilation terminated
ERROR: 0:7: '%' : wrong operand types: no operation '%' exists that takes a left-hand operand of type ' temp mediump 3-component vector of float' and a right operand of type ' temp mediump 3-component vector of float' (or there is no acceptable conversion)
ERROR: 0:7: '' : compilation terminated
ERROR: 2 compilation errors. No code generated.

View File

@@ -1,15 +1,14 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
ivec3 a = ivec3(1, 2, 3);
ivec3 b = ivec3(0, 5, 0);
ivec3 r = (a % b);
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -1,15 +1,14 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
uvec3 a = uvec3(1u, 2u, 3u);
uvec3 b = uvec3(0u, 5u, 0u);
uvec3 r = (a % b);
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -3,21 +3,20 @@ SKIP: FAILED
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
float a = 1.0f;
float b = 0.0f;
float r = (a % (b + b));
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}
Error parsing GLSL shader:
ERROR: 0:8: '%' : wrong operand types: no operation '%' exists that takes a left-hand operand of type ' temp mediump float' and a right operand of type ' temp mediump float' (or there is no acceptable conversion)
ERROR: 0:8: '' : compilation terminated
ERROR: 0:7: '%' : wrong operand types: no operation '%' exists that takes a left-hand operand of type ' temp mediump float' and a right operand of type ' temp mediump float' (or there is no acceptable conversion)
ERROR: 0:7: '' : compilation terminated
ERROR: 2 compilation errors. No code generated.

View File

@@ -1,15 +1,14 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
int a = 1;
int b = 0;
int r = (a % (b + b));
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -1,15 +1,14 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
uint a = 1u;
uint b = 0u;
uint r = (a % (b + b));
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -1,15 +1,14 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
int a = 4;
ivec3 b = ivec3(0, 2, 0);
ivec3 r = (a % (b + b));
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -1,15 +1,14 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
uint a = 4u;
uvec3 b = uvec3(0u, 2u, 0u);
uvec3 r = (a % (b + b));
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -1,15 +1,14 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
ivec3 a = ivec3(1, 2, 3);
int b = 0;
ivec3 r = (a % (b + b));
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -1,15 +1,14 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
uvec3 a = uvec3(1u, 2u, 3u);
uint b = 0u;
uvec3 r = (a % (b + b));
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -3,21 +3,20 @@ SKIP: FAILED
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
vec3 a = vec3(1.0f, 2.0f, 3.0f);
vec3 b = vec3(0.0f, 5.0f, 0.0f);
vec3 r = (a % (b + b));
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}
Error parsing GLSL shader:
ERROR: 0:8: '%' : wrong operand types: no operation '%' exists that takes a left-hand operand of type ' temp mediump 3-component vector of float' and a right operand of type ' temp mediump 3-component vector of float' (or there is no acceptable conversion)
ERROR: 0:8: '' : compilation terminated
ERROR: 0:7: '%' : wrong operand types: no operation '%' exists that takes a left-hand operand of type ' temp mediump 3-component vector of float' and a right operand of type ' temp mediump 3-component vector of float' (or there is no acceptable conversion)
ERROR: 0:7: '' : compilation terminated
ERROR: 2 compilation errors. No code generated.

View File

@@ -1,15 +1,14 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
ivec3 a = ivec3(1, 2, 3);
ivec3 b = ivec3(0, 5, 0);
ivec3 r = (a % (b + b));
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -1,15 +1,14 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
uvec3 a = uvec3(1u, 2u, 3u);
uvec3 b = uvec3(0u, 5u, 0u);
uvec3 r = (a % (b + b));
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -3,21 +3,20 @@ SKIP: FAILED
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
float a = 1.0f;
float b = 0.0f;
float r = (a % b);
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}
Error parsing GLSL shader:
ERROR: 0:8: '%' : wrong operand types: no operation '%' exists that takes a left-hand operand of type ' temp mediump float' and a right operand of type ' temp mediump float' (or there is no acceptable conversion)
ERROR: 0:8: '' : compilation terminated
ERROR: 0:7: '%' : wrong operand types: no operation '%' exists that takes a left-hand operand of type ' temp mediump float' and a right operand of type ' temp mediump float' (or there is no acceptable conversion)
ERROR: 0:7: '' : compilation terminated
ERROR: 2 compilation errors. No code generated.

View File

@@ -1,15 +1,14 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
int a = 1;
int b = 0;
int r = (a % b);
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -1,15 +1,14 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
uint a = 1u;
uint b = 0u;
uint r = (a % b);
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -1,15 +1,14 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
int a = 4;
ivec3 b = ivec3(0, 2, 0);
ivec3 r = (a % b);
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -1,15 +1,14 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
uint a = 4u;
uvec3 b = uvec3(0u, 2u, 0u);
uvec3 r = (a % b);
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -1,15 +1,14 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
ivec3 a = ivec3(1, 2, 3);
int b = 0;
ivec3 r = (a % b);
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -1,15 +1,14 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
uvec3 a = uvec3(1u, 2u, 3u);
uint b = 0u;
uvec3 r = (a % b);
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -3,21 +3,20 @@ SKIP: FAILED
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
vec3 a = vec3(1.0f, 2.0f, 3.0f);
vec3 b = vec3(0.0f, 5.0f, 0.0f);
vec3 r = (a % b);
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}
Error parsing GLSL shader:
ERROR: 0:8: '%' : wrong operand types: no operation '%' exists that takes a left-hand operand of type ' temp mediump 3-component vector of float' and a right operand of type ' temp mediump 3-component vector of float' (or there is no acceptable conversion)
ERROR: 0:8: '' : compilation terminated
ERROR: 0:7: '%' : wrong operand types: no operation '%' exists that takes a left-hand operand of type ' temp mediump 3-component vector of float' and a right operand of type ' temp mediump 3-component vector of float' (or there is no acceptable conversion)
ERROR: 0:7: '' : compilation terminated
ERROR: 2 compilation errors. No code generated.

View File

@@ -1,15 +1,14 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
ivec3 a = ivec3(1, 2, 3);
ivec3 b = ivec3(0, 5, 0);
ivec3 r = (a % b);
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}

View File

@@ -1,15 +1,14 @@
#version 310 es
precision mediump float;
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void f() {
uvec3 a = uvec3(1u, 2u, 3u);
uvec3 b = uvec3(0u, 5u, 0u);
uvec3 r = (a % b);
return;
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
f();
return;
}