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;