GLSL: swizzle out the dimension on cube arrays.

Note: ES doesn't support cube arrays, so this fixes the tests but does
not cause them to pass.

Bug: tint:1461
Change-Id: Ia2b1ffacab83dae58ac1b50eb04457da270d73e2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/82363
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Stephen White 2022-03-02 14:33:13 +00:00 committed by Tint LUCI CQ
parent 6c2115ee91
commit b4c338ff37
14 changed files with 32 additions and 31 deletions

View File

@ -1303,9 +1303,10 @@ bool GeneratorImpl::EmitTextureCall(std::ostream& out,
}
}
out << ")";
// textureSize() on sampler2dArray returns the array size in the
// textureSize() on array samplers returns the array size in the
// final component, so strip it out.
if (texture_type->dim() == ast::TextureDimension::k2dArray) {
if (texture_type->dim() == ast::TextureDimension::k2dArray ||
texture_type->dim() == ast::TextureDimension::kCubeArray) {
out << ".xy";
}
return true;

View File

@ -4,7 +4,7 @@ SKIP: FAILED
uniform highp isamplerCubeArray arg_0_1;
void textureDimensions_221f22() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
vec4 vertex_main() {
@ -31,7 +31,7 @@ precision mediump float;
uniform highp isamplerCubeArray arg_0_1;
void textureDimensions_221f22() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
void fragment_main() {
@ -53,7 +53,7 @@ ERROR: 2 compilation errors. No code generated.
uniform highp isamplerCubeArray arg_0_1;
void textureDimensions_221f22() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
void compute_main() {

View File

@ -4,7 +4,7 @@ SKIP: FAILED
uniform highp usamplerCubeArray arg_0_1;
void textureDimensions_4152a6() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
vec4 vertex_main() {
@ -31,7 +31,7 @@ precision mediump float;
uniform highp usamplerCubeArray arg_0_1;
void textureDimensions_4152a6() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
void fragment_main() {
@ -53,7 +53,7 @@ ERROR: 2 compilation errors. No code generated.
uniform highp usamplerCubeArray arg_0_1;
void textureDimensions_4152a6() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
void compute_main() {

View File

@ -4,7 +4,7 @@ SKIP: FAILED
uniform highp samplerCubeArray arg_0_1;
void textureDimensions_50a9ee() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
vec4 vertex_main() {
@ -31,7 +31,7 @@ precision mediump float;
uniform highp samplerCubeArray arg_0_1;
void textureDimensions_50a9ee() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
void fragment_main() {
@ -53,7 +53,7 @@ ERROR: 2 compilation errors. No code generated.
uniform highp samplerCubeArray arg_0_1;
void textureDimensions_50a9ee() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
void compute_main() {

View File

@ -4,7 +4,7 @@ SKIP: FAILED
uniform highp samplerCubeArray arg_0_1;
void textureDimensions_8f20bf() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
vec4 vertex_main() {
@ -31,7 +31,7 @@ precision mediump float;
uniform highp samplerCubeArray arg_0_1;
void textureDimensions_8f20bf() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
void fragment_main() {
@ -53,7 +53,7 @@ ERROR: 2 compilation errors. No code generated.
uniform highp samplerCubeArray arg_0_1;
void textureDimensions_8f20bf() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
void compute_main() {

View File

@ -4,7 +4,7 @@ SKIP: FAILED
uniform highp samplerCubeArray arg_0_1;
void textureDimensions_90340b() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
vec4 vertex_main() {
@ -31,7 +31,7 @@ precision mediump float;
uniform highp samplerCubeArray arg_0_1;
void textureDimensions_90340b() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
void fragment_main() {
@ -53,7 +53,7 @@ ERROR: 2 compilation errors. No code generated.
uniform highp samplerCubeArray arg_0_1;
void textureDimensions_90340b() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
void compute_main() {

View File

@ -4,7 +4,7 @@ SKIP: FAILED
uniform highp samplerCubeArray arg_0_1;
void textureDimensions_a01845() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
vec4 vertex_main() {
@ -31,7 +31,7 @@ precision mediump float;
uniform highp samplerCubeArray arg_0_1;
void textureDimensions_a01845() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
void fragment_main() {
@ -53,7 +53,7 @@ ERROR: 2 compilation errors. No code generated.
uniform highp samplerCubeArray arg_0_1;
void textureDimensions_a01845() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
void compute_main() {

View File

@ -1,6 +1,6 @@
SKIP: FAILED
../../src/tint/writer/glsl/generator_impl.cc:2571 internal compiler error: Multiplanar external texture transform was not run.
../../src/tint/writer/glsl/generator_impl.cc:2572 internal compiler error: Multiplanar external texture transform was not run.
********************************************************************

View File

@ -4,7 +4,7 @@ SKIP: FAILED
uniform highp usamplerCubeArray arg_0_1;
void textureDimensions_d83c45() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
vec4 vertex_main() {
@ -31,7 +31,7 @@ precision mediump float;
uniform highp usamplerCubeArray arg_0_1;
void textureDimensions_d83c45() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
void fragment_main() {
@ -53,7 +53,7 @@ ERROR: 2 compilation errors. No code generated.
uniform highp usamplerCubeArray arg_0_1;
void textureDimensions_d83c45() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
void compute_main() {

View File

@ -4,7 +4,7 @@ SKIP: FAILED
uniform highp isamplerCubeArray arg_0_1;
void textureDimensions_e927be() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
vec4 vertex_main() {
@ -31,7 +31,7 @@ precision mediump float;
uniform highp isamplerCubeArray arg_0_1;
void textureDimensions_e927be() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
void fragment_main() {
@ -53,7 +53,7 @@ ERROR: 2 compilation errors. No code generated.
uniform highp isamplerCubeArray arg_0_1;
void textureDimensions_e927be() {
ivec2 res = textureSize(arg_0_1, 0);
ivec2 res = textureSize(arg_0_1, 0).xy;
}
void compute_main() {

View File

@ -1,6 +1,6 @@
SKIP: FAILED
../../src/tint/writer/glsl/generator_impl.cc:2571 internal compiler error: Multiplanar external texture transform was not run.
../../src/tint/writer/glsl/generator_impl.cc:2572 internal compiler error: Multiplanar external texture transform was not run.
********************************************************************

View File

@ -1,6 +1,6 @@
SKIP: FAILED
../../src/tint/writer/glsl/generator_impl.cc:2571 internal compiler error: Multiplanar external texture transform was not run.
../../src/tint/writer/glsl/generator_impl.cc:2572 internal compiler error: Multiplanar external texture transform was not run.
********************************************************************

View File

@ -22,7 +22,7 @@ void main_1() {
vec2 coords12 = vf12;
vec3 coords123 = vf123;
vec4 coords1234 = vf1234;
ivec3 x_99 = ivec3(textureSize(x_20_1, i1).xy, textureSize(x_20_1, 0).z);
ivec3 x_99 = ivec3(textureSize(x_20_1, i1).xy.xy, textureSize(x_20_1, 0).z);
return;
}

View File

@ -22,7 +22,7 @@ void main_1() {
vec2 coords12 = vf12;
vec3 coords123 = vf123;
vec4 coords1234 = vf1234;
ivec3 x_99 = ivec3(textureSize(x_20_1, i1).xy, textureSize(x_20_1, 0).z);
ivec3 x_99 = ivec3(textureSize(x_20_1, i1).xy.xy, textureSize(x_20_1, 0).z);
return;
}