tint: Show where control flow became non-uniform

Add additional nodes to capture places where control flow is changed
(if, switch, for, short-circuiting op, function call), and use these
to show the actual point at which control flow became non-uniform as a
result of a non-uniform value.

Do this recursively, to capture cases where control flow becomes
non-uniform after a function call statement.

Bug: tint:880
Change-Id: Ied92d690f98a5c11a1892eef500a50d0f123943d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89862
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
James Price
2022-05-16 11:53:25 +00:00
parent 5a69597698
commit a89ff5981b
27 changed files with 887 additions and 96 deletions

View File

@@ -2,6 +2,10 @@ bug/dawn/947.wgsl:59:20 warning: 'textureSample' must only be called from unifor
var srcColor = textureSample(myTexture, mySampler, texcoord);
^^^^^^^^^^^^^
bug/dawn/947.wgsl:55:5 note: control flow depends on non-uniform value
if (!all(clampedTexcoord == texcoord)) {
^^
bug/dawn/947.wgsl:54:15 note: reading from user-defined input 'texcoord' may result in a non-uniform value
clamp(texcoord, vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 1.0));
^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/dawn/947.wgsl:59:20 warning: 'textureSample' must only be called from unifor
var srcColor = textureSample(myTexture, mySampler, texcoord);
^^^^^^^^^^^^^
bug/dawn/947.wgsl:55:5 note: control flow depends on non-uniform value
if (!all(clampedTexcoord == texcoord)) {
^^
bug/dawn/947.wgsl:54:15 note: reading from user-defined input 'texcoord' may result in a non-uniform value
clamp(texcoord, vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 1.0));
^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/dawn/947.wgsl:59:20 warning: 'textureSample' must only be called from unifor
var srcColor = textureSample(myTexture, mySampler, texcoord);
^^^^^^^^^^^^^
bug/dawn/947.wgsl:55:5 note: control flow depends on non-uniform value
if (!all(clampedTexcoord == texcoord)) {
^^
bug/dawn/947.wgsl:54:15 note: reading from user-defined input 'texcoord' may result in a non-uniform value
clamp(texcoord, vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 1.0));
^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/dawn/947.wgsl:59:20 warning: 'textureSample' must only be called from unifor
var srcColor = textureSample(myTexture, mySampler, texcoord);
^^^^^^^^^^^^^
bug/dawn/947.wgsl:55:5 note: control flow depends on non-uniform value
if (!all(clampedTexcoord == texcoord)) {
^^
bug/dawn/947.wgsl:54:15 note: reading from user-defined input 'texcoord' may result in a non-uniform value
clamp(texcoord, vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 1.0));
^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/dawn/947.wgsl:59:20 warning: 'textureSample' must only be called from unifor
var srcColor = textureSample(myTexture, mySampler, texcoord);
^^^^^^^^^^^^^
bug/dawn/947.wgsl:55:5 note: control flow depends on non-uniform value
if (!all(clampedTexcoord == texcoord)) {
^^
bug/dawn/947.wgsl:54:15 note: reading from user-defined input 'texcoord' may result in a non-uniform value
clamp(texcoord, vec2<f32>(0.0, 0.0), vec2<f32>(1.0, 1.0));
^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/fxc/gradient_in_varying_loop/1112.wgsl:23:33 warning: 'textureSample' must o
let sampleDepth : f32 = textureSample(depthTexture, Sampler, offset.xy).r;
^^^^^^^^^^^^^
bug/fxc/gradient_in_varying_loop/1112.wgsl:18:28 note: control flow depends on non-uniform value
if (offset.x < 0.0 || offset.y < 0.0 || offset.x > 1.0 || offset.y > 1.0) {
^^
bug/fxc/gradient_in_varying_loop/1112.wgsl:8:29 note: return value of 'textureSample' may be non-uniform
let random: vec3<f32> = textureSample(randomTexture, Sampler, vUV).rgb;
^^^^^^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/fxc/gradient_in_varying_loop/1112.wgsl:23:33 warning: 'textureSample' must o
let sampleDepth : f32 = textureSample(depthTexture, Sampler, offset.xy).r;
^^^^^^^^^^^^^
bug/fxc/gradient_in_varying_loop/1112.wgsl:18:28 note: control flow depends on non-uniform value
if (offset.x < 0.0 || offset.y < 0.0 || offset.x > 1.0 || offset.y > 1.0) {
^^
bug/fxc/gradient_in_varying_loop/1112.wgsl:8:29 note: return value of 'textureSample' may be non-uniform
let random: vec3<f32> = textureSample(randomTexture, Sampler, vUV).rgb;
^^^^^^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/fxc/gradient_in_varying_loop/1112.wgsl:23:33 warning: 'textureSample' must o
let sampleDepth : f32 = textureSample(depthTexture, Sampler, offset.xy).r;
^^^^^^^^^^^^^
bug/fxc/gradient_in_varying_loop/1112.wgsl:18:28 note: control flow depends on non-uniform value
if (offset.x < 0.0 || offset.y < 0.0 || offset.x > 1.0 || offset.y > 1.0) {
^^
bug/fxc/gradient_in_varying_loop/1112.wgsl:8:29 note: return value of 'textureSample' may be non-uniform
let random: vec3<f32> = textureSample(randomTexture, Sampler, vUV).rgb;
^^^^^^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/fxc/gradient_in_varying_loop/1112.wgsl:23:33 warning: 'textureSample' must o
let sampleDepth : f32 = textureSample(depthTexture, Sampler, offset.xy).r;
^^^^^^^^^^^^^
bug/fxc/gradient_in_varying_loop/1112.wgsl:18:28 note: control flow depends on non-uniform value
if (offset.x < 0.0 || offset.y < 0.0 || offset.x > 1.0 || offset.y > 1.0) {
^^
bug/fxc/gradient_in_varying_loop/1112.wgsl:8:29 note: return value of 'textureSample' may be non-uniform
let random: vec3<f32> = textureSample(randomTexture, Sampler, vUV).rgb;
^^^^^^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/fxc/gradient_in_varying_loop/1112.wgsl:23:33 warning: 'textureSample' must o
let sampleDepth : f32 = textureSample(depthTexture, Sampler, offset.xy).r;
^^^^^^^^^^^^^
bug/fxc/gradient_in_varying_loop/1112.wgsl:18:28 note: control flow depends on non-uniform value
if (offset.x < 0.0 || offset.y < 0.0 || offset.x > 1.0 || offset.y > 1.0) {
^^
bug/fxc/gradient_in_varying_loop/1112.wgsl:8:29 note: return value of 'textureSample' may be non-uniform
let random: vec3<f32> = textureSample(randomTexture, Sampler, vUV).rgb;
^^^^^^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/tint/1118.wgsl:64:31 warning: 'dpdx' must only be called from uniform contro
normalW = normalize(-(cross(dpdx(x_62), dpdy(x_64))));
^^^^
bug/tint/1118.wgsl:47:3 note: control flow depends on non-uniform value
if ((x_9 > 0.0)) {
^^
bug/tint/1118.wgsl:46:19 note: reading from module-scope private variable 'fClipDistance3' may result in a non-uniform value
let x_9 : f32 = fClipDistance3;
^^^^^^^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/tint/1118.wgsl:64:31 warning: 'dpdx' must only be called from uniform contro
normalW = normalize(-(cross(dpdx(x_62), dpdy(x_64))));
^^^^
bug/tint/1118.wgsl:47:3 note: control flow depends on non-uniform value
if ((x_9 > 0.0)) {
^^
bug/tint/1118.wgsl:46:19 note: reading from module-scope private variable 'fClipDistance3' may result in a non-uniform value
let x_9 : f32 = fClipDistance3;
^^^^^^^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/tint/1118.wgsl:64:31 warning: 'dpdx' must only be called from uniform contro
normalW = normalize(-(cross(dpdx(x_62), dpdy(x_64))));
^^^^
bug/tint/1118.wgsl:47:3 note: control flow depends on non-uniform value
if ((x_9 > 0.0)) {
^^
bug/tint/1118.wgsl:46:19 note: reading from module-scope private variable 'fClipDistance3' may result in a non-uniform value
let x_9 : f32 = fClipDistance3;
^^^^^^^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/tint/1118.wgsl:64:31 warning: 'dpdx' must only be called from uniform contro
normalW = normalize(-(cross(dpdx(x_62), dpdy(x_64))));
^^^^
bug/tint/1118.wgsl:47:3 note: control flow depends on non-uniform value
if ((x_9 > 0.0)) {
^^
bug/tint/1118.wgsl:46:19 note: reading from module-scope private variable 'fClipDistance3' may result in a non-uniform value
let x_9 : f32 = fClipDistance3;
^^^^^^^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/tint/1118.wgsl:64:31 warning: 'dpdx' must only be called from uniform contro
normalW = normalize(-(cross(dpdx(x_62), dpdy(x_64))));
^^^^
bug/tint/1118.wgsl:47:3 note: control flow depends on non-uniform value
if ((x_9 > 0.0)) {
^^
bug/tint/1118.wgsl:46:19 note: reading from module-scope private variable 'fClipDistance3' may result in a non-uniform value
let x_9 : f32 = fClipDistance3;
^^^^^^^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/tint/948.wgsl:146:33 warning: 'textureSampleBias' must only be called from u
let x_217 : vec4<f32> = textureSampleBias(animationMapTexture, animationMapSampler, vec2<f32>(((x_208 + 0.5) / x_211), (0.125 * x_214)), 0.0);
^^^^^^^^^^^^^^^^^
bug/tint/948.wgsl:125:5 note: control flow depends on non-uniform value
if ((x_174 > 0.0)) {
^^
bug/tint/948.wgsl:146:33 note: return value of 'textureSampleBias' may be non-uniform
let x_217 : vec4<f32> = textureSampleBias(animationMapTexture, animationMapSampler, vec2<f32>(((x_208 + 0.5) / x_211), (0.125 * x_214)), 0.0);
^^^^^^^^^^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/tint/948.wgsl:146:33 warning: 'textureSampleBias' must only be called from u
let x_217 : vec4<f32> = textureSampleBias(animationMapTexture, animationMapSampler, vec2<f32>(((x_208 + 0.5) / x_211), (0.125 * x_214)), 0.0);
^^^^^^^^^^^^^^^^^
bug/tint/948.wgsl:125:5 note: control flow depends on non-uniform value
if ((x_174 > 0.0)) {
^^
bug/tint/948.wgsl:146:33 note: return value of 'textureSampleBias' may be non-uniform
let x_217 : vec4<f32> = textureSampleBias(animationMapTexture, animationMapSampler, vec2<f32>(((x_208 + 0.5) / x_211), (0.125 * x_214)), 0.0);
^^^^^^^^^^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/tint/948.wgsl:146:33 warning: 'textureSampleBias' must only be called from u
let x_217 : vec4<f32> = textureSampleBias(animationMapTexture, animationMapSampler, vec2<f32>(((x_208 + 0.5) / x_211), (0.125 * x_214)), 0.0);
^^^^^^^^^^^^^^^^^
bug/tint/948.wgsl:125:5 note: control flow depends on non-uniform value
if ((x_174 > 0.0)) {
^^
bug/tint/948.wgsl:146:33 note: return value of 'textureSampleBias' may be non-uniform
let x_217 : vec4<f32> = textureSampleBias(animationMapTexture, animationMapSampler, vec2<f32>(((x_208 + 0.5) / x_211), (0.125 * x_214)), 0.0);
^^^^^^^^^^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/tint/948.wgsl:146:33 warning: 'textureSampleBias' must only be called from u
let x_217 : vec4<f32> = textureSampleBias(animationMapTexture, animationMapSampler, vec2<f32>(((x_208 + 0.5) / x_211), (0.125 * x_214)), 0.0);
^^^^^^^^^^^^^^^^^
bug/tint/948.wgsl:125:5 note: control flow depends on non-uniform value
if ((x_174 > 0.0)) {
^^
bug/tint/948.wgsl:146:33 note: return value of 'textureSampleBias' may be non-uniform
let x_217 : vec4<f32> = textureSampleBias(animationMapTexture, animationMapSampler, vec2<f32>(((x_208 + 0.5) / x_211), (0.125 * x_214)), 0.0);
^^^^^^^^^^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/tint/948.wgsl:146:33 warning: 'textureSampleBias' must only be called from u
let x_217 : vec4<f32> = textureSampleBias(animationMapTexture, animationMapSampler, vec2<f32>(((x_208 + 0.5) / x_211), (0.125 * x_214)), 0.0);
^^^^^^^^^^^^^^^^^
bug/tint/948.wgsl:125:5 note: control flow depends on non-uniform value
if ((x_174 > 0.0)) {
^^
bug/tint/948.wgsl:146:33 note: return value of 'textureSampleBias' may be non-uniform
let x_217 : vec4<f32> = textureSampleBias(animationMapTexture, animationMapSampler, vec2<f32>(((x_208 + 0.5) / x_211), (0.125 * x_214)), 0.0);
^^^^^^^^^^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/tint/949.wgsl:326:29 warning: 'textureSample' must only be called from unifo
let x_397 : vec4<f32> = textureSample(TextureSamplerTexture, TextureSamplerSampler, (x_394 + x_395));
^^^^^^^^^^^^^
bug/tint/949.wgsl:330:5 note: control flow depends on non-uniform value
if ((x_400 > x_401)) {
^^
bug/tint/949.wgsl:326:29 note: return value of 'textureSample' may be non-uniform
let x_397 : vec4<f32> = textureSample(TextureSamplerTexture, TextureSamplerSampler, (x_394 + x_395));
^^^^^^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/tint/949.wgsl:326:29 warning: 'textureSample' must only be called from unifo
let x_397 : vec4<f32> = textureSample(TextureSamplerTexture, TextureSamplerSampler, (x_394 + x_395));
^^^^^^^^^^^^^
bug/tint/949.wgsl:330:5 note: control flow depends on non-uniform value
if ((x_400 > x_401)) {
^^
bug/tint/949.wgsl:326:29 note: return value of 'textureSample' may be non-uniform
let x_397 : vec4<f32> = textureSample(TextureSamplerTexture, TextureSamplerSampler, (x_394 + x_395));
^^^^^^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/tint/949.wgsl:326:29 warning: 'textureSample' must only be called from unifo
let x_397 : vec4<f32> = textureSample(TextureSamplerTexture, TextureSamplerSampler, (x_394 + x_395));
^^^^^^^^^^^^^
bug/tint/949.wgsl:330:5 note: control flow depends on non-uniform value
if ((x_400 > x_401)) {
^^
bug/tint/949.wgsl:326:29 note: return value of 'textureSample' may be non-uniform
let x_397 : vec4<f32> = textureSample(TextureSamplerTexture, TextureSamplerSampler, (x_394 + x_395));
^^^^^^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/tint/949.wgsl:326:29 warning: 'textureSample' must only be called from unifo
let x_397 : vec4<f32> = textureSample(TextureSamplerTexture, TextureSamplerSampler, (x_394 + x_395));
^^^^^^^^^^^^^
bug/tint/949.wgsl:330:5 note: control flow depends on non-uniform value
if ((x_400 > x_401)) {
^^
bug/tint/949.wgsl:326:29 note: return value of 'textureSample' may be non-uniform
let x_397 : vec4<f32> = textureSample(TextureSamplerTexture, TextureSamplerSampler, (x_394 + x_395));
^^^^^^^^^^^^^

View File

@@ -2,6 +2,10 @@ bug/tint/949.wgsl:326:29 warning: 'textureSample' must only be called from unifo
let x_397 : vec4<f32> = textureSample(TextureSamplerTexture, TextureSamplerSampler, (x_394 + x_395));
^^^^^^^^^^^^^
bug/tint/949.wgsl:330:5 note: control flow depends on non-uniform value
if ((x_400 > x_401)) {
^^
bug/tint/949.wgsl:326:29 note: return value of 'textureSample' may be non-uniform
let x_397 : vec4<f32> = textureSample(TextureSamplerTexture, TextureSamplerSampler, (x_394 + x_395));
^^^^^^^^^^^^^