GLSL: fix single-valued vector init.

No need for the HLSL-style repeated swizzle; GLSL allows construction
of a vector from a scalar value of the component type.

Bug: tint:1317

Change-Id: Ia0afe3012cbb56716a2d1c5c3849dd662a5ff89c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70342
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
Stephen White
2021-11-22 16:14:16 +00:00
committed by Tint LUCI CQ
parent 177e7bfa5d
commit 7368e287dc
8 changed files with 34 additions and 93 deletions

View File

@@ -1,5 +1,3 @@
SKIP: FAILED
#version 310 es
precision mediump float;
@@ -59,8 +57,8 @@ void tint_symbol_2_inner(uvec3 GlobalInvocationID) {
lightPos = (uniforms.viewMatrix * lightPos);
lightPos = (lightPos / lightPos.w);
float lightRadius = lightsBuffer.lights[index].radius;
vec4 boxMin = (lightPos - vec4(vec3((lightRadius).xxx), 0.0f));
vec4 boxMax = (lightPos + vec4(vec3((lightRadius).xxx), 0.0f));
vec4 boxMin = (lightPos - vec4(vec3(lightRadius), 0.0f));
vec4 boxMax = (lightPos + vec4(vec3(lightRadius), 0.0f));
vec4 frustumPlanes[6] = vec4[6](vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f));
frustumPlanes[4] = vec4(0.0f, 0.0f, -1.0f, viewNear);
frustumPlanes[5] = vec4(0.0f, 0.0f, 1.0f, -(viewFar));
@@ -71,8 +69,8 @@ void tint_symbol_2_inner(uvec3 GlobalInvocationID) {
{
for(int x_1 = 0; (x_1 < TILE_COUNT_X); x_1 = (x_1 + 1)) {
ivec2 tilePixel0Idx = ivec2((x_1 * TILE_SIZE), (y_1 * TILE_SIZE));
vec2 floorCoord = (((2.0f * vec2(tilePixel0Idx)) / uniforms.fullScreenSize.xy) - vec2((1.0f).xx));
vec2 ceilCoord = (((2.0f * vec2((tilePixel0Idx + ivec2((TILE_SIZE).xx)))) / uniforms.fullScreenSize.xy) - vec2((1.0f).xx));
vec2 floorCoord = (((2.0f * vec2(tilePixel0Idx)) / uniforms.fullScreenSize.xy) - vec2(1.0f));
vec2 ceilCoord = (((2.0f * vec2((tilePixel0Idx + ivec2(TILE_SIZE)))) / uniforms.fullScreenSize.xy) - vec2(1.0f));
vec2 viewFloorCoord = vec2((((-(viewNear) * floorCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * floorCoord.y) - (M[2][1] * viewNear)) / M[1][1]));
vec2 viewCeilCoord = vec2((((-(viewNear) * ceilCoord.x) - (M[2][0] * viewNear)) / M[0][0]), (((-(viewNear) * ceilCoord.y) - (M[2][1] * viewNear)) / M[1][1]));
frustumPlanes[0] = vec4(1.0f, 0.0f, (-(viewFloorCoord.x) / viewNear), 0.0f);
@@ -135,10 +133,3 @@ void main() {
}
Error parsing GLSL shader:
ERROR: 0:60: 'scalar swizzle' : not supported with this profile: es
ERROR: 0:60: '' : compilation terminated
ERROR: 2 compilation errors. No code generated.

View File

@@ -1,10 +1,8 @@
SKIP: FAILED
#version 310 es
precision mediump float;
vec3 Bad(uint index, vec3 rd) {
vec3 normal = vec3((0.0f).xxx);
vec3 normal = vec3(0.0f);
normal[index] = -(sign(rd[index]));
return normalize(normal);
}
@@ -34,10 +32,3 @@ void main() {
}
Error parsing GLSL shader:
ERROR: 0:5: 'scalar swizzle' : not supported with this profile: es
ERROR: 0:5: '' : compilation terminated
ERROR: 2 compilation errors. No code generated.

View File

@@ -1,5 +1,3 @@
SKIP: FAILED
#version 310 es
precision mediump float;
@@ -9,7 +7,7 @@ struct tint_symbol {
vec4 frag_main_inner() {
float b = 0.0f;
vec3 v = vec3((b).xxx);
vec3 v = vec3(b);
return vec4(v, 1.0f);
}
@@ -27,10 +25,3 @@ void main() {
}
Error parsing GLSL shader:
ERROR: 0:10: 'scalar swizzle' : not supported with this profile: es
ERROR: 0:10: '' : compilation terminated
ERROR: 2 compilation errors. No code generated.