tint: Make uniformity analysis failures a hard error

These have been warnings for multiple months.
Time to properly turn this on.

Bug: tint:880
Change-Id: I3b38f672309b5acd48c12a38dc5a1675f3c62470
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/103480
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2022-09-26 12:30:05 +00:00
committed by Dawn LUCI CQ
parent 03199c2b44
commit 4c70d7fff2
55 changed files with 643 additions and 6520 deletions

View File

@@ -20,7 +20,9 @@ fn main(@location(0) vUV : vec2<f32>) -> @location(0) vec4<f32> {
continue;
}
let sampleDepth : f32 = textureSample(depthTexture, Sampler, offset.xy).r;
// Violates uniformity analysis:
// let sampleDepth : f32 = textureSample(depthTexture, Sampler, offset.xy).r;
let sampleDepth : f32 = 0;
i = i + 1;
}

View File

@@ -1,15 +1,3 @@
bug/fxc/gradient_in_varying_loop/1112.wgsl:23:33 warning: 'textureSample' must only be called from uniform control flow
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;
^^^^^^^^^^^^^
SamplerState tint_symbol : register(s0, space0);
Texture2D<float4> randomTexture : register(t1, space0);
Texture2D<float4> depthTexture : register(t2, space0);
@@ -46,7 +34,7 @@ float4 main_inner(float2 vUV) {
i = (i + 1);
continue;
}
const float sampleDepth = depthTexture.Sample(tint_symbol, offset.xy).r;
const float sampleDepth = 0.0f;
i = (i + 1);
}
return (1.0f).xxxx;

View File

@@ -1,15 +1,3 @@
bug/fxc/gradient_in_varying_loop/1112.wgsl:23:33 warning: 'textureSample' must only be called from uniform control flow
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;
^^^^^^^^^^^^^
SamplerState tint_symbol : register(s0, space0);
Texture2D<float4> randomTexture : register(t1, space0);
Texture2D<float4> depthTexture : register(t2, space0);
@@ -46,7 +34,7 @@ float4 main_inner(float2 vUV) {
i = (i + 1);
continue;
}
const float sampleDepth = depthTexture.Sample(tint_symbol, offset.xy).r;
const float sampleDepth = 0.0f;
i = (i + 1);
}
return (1.0f).xxxx;

View File

@@ -1,22 +1,9 @@
bug/fxc/gradient_in_varying_loop/1112.wgsl:23:33 warning: 'textureSample' must only be called from uniform control flow
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;
^^^^^^^^^^^^^
#version 310 es
precision mediump float;
layout(location = 0) in vec2 vUV_1;
layout(location = 0) out vec4 value;
uniform highp sampler2D randomTexture_Sampler;
uniform highp sampler2D depthTexture_Sampler;
vec4 tint_symbol(vec2 vUV) {
vec3 random = texture(randomTexture_Sampler, vUV).rgb;
@@ -43,7 +30,7 @@ vec4 tint_symbol(vec2 vUV) {
i = (i + 1);
continue;
}
float sampleDepth = texture(depthTexture_Sampler, offset.xy).r;
float sampleDepth = 0.0f;
i = (i + 1);
}
return vec4(1.0f);

View File

@@ -1,15 +1,3 @@
bug/fxc/gradient_in_varying_loop/1112.wgsl:23:33 warning: 'textureSample' must only be called from uniform control flow
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;
^^^^^^^^^^^^^
#include <metal_stdlib>
using namespace metal;
@@ -21,7 +9,7 @@ struct tint_symbol_3 {
float4 value [[color(0)]];
};
float4 tint_symbol_inner(float2 vUV, texture2d<float, access::sample> tint_symbol_4, sampler tint_symbol_5, texture2d<float, access::sample> tint_symbol_6) {
float4 tint_symbol_inner(float2 vUV, texture2d<float, access::sample> tint_symbol_4, sampler tint_symbol_5) {
float3 const random = float4(tint_symbol_4.sample(tint_symbol_5, vUV)).rgb;
int i = 0;
while (true) {
@@ -34,14 +22,14 @@ float4 tint_symbol_inner(float2 vUV, texture2d<float, access::sample> tint_symbo
i = as_type<int>((as_type<uint>(i) + as_type<uint>(1)));
continue;
}
float const sampleDepth = tint_symbol_6.sample(tint_symbol_5, float3(offset).xy)[0];
float const sampleDepth = 0.0f;
i = as_type<int>((as_type<uint>(i) + as_type<uint>(1)));
}
return float4(1.0f);
}
fragment tint_symbol_3 tint_symbol(texture2d<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]], texture2d<float, access::sample> tint_symbol_9 [[texture(1)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
float4 const inner_result = tint_symbol_inner(tint_symbol_1.vUV, tint_symbol_7, tint_symbol_8, tint_symbol_9);
fragment tint_symbol_3 tint_symbol(texture2d<float, access::sample> tint_symbol_6 [[texture(0)]], sampler tint_symbol_7 [[sampler(0)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
float4 const inner_result = tint_symbol_inner(tint_symbol_1.vUV, tint_symbol_6, tint_symbol_7);
tint_symbol_3 wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;

View File

@@ -1,19 +1,7 @@
bug/fxc/gradient_in_varying_loop/1112.wgsl:23:33 warning: 'textureSample' must only be called from uniform control flow
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;
^^^^^^^^^^^^^
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 82
; Bound: 76
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -61,9 +49,9 @@ bug/fxc/gradient_in_varying_loop/1112.wgsl:8:29 note: return value of 'textureSa
%bool = OpTypeBool
%45 = OpConstantNull %float
%float_1 = OpConstant %float 1
%75 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%69 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%void = OpTypeVoid
%76 = OpTypeFunction %void
%70 = OpTypeFunction %void
%main_inner = OpFunction %v4float None %16
%vUV = OpFunctionParameter %v2float
%19 = OpLabel
@@ -124,25 +112,19 @@ bug/fxc/gradient_in_varying_loop/1112.wgsl:8:29 note: return value of 'textureSa
OpStore %i %66
OpBranch %33
%63 = OpLabel
%68 = OpLoad %11 %Sampler
%69 = OpLoad %14 %depthTexture
%70 = OpSampledImage %23 %69 %68
%71 = OpVectorShuffle %v2float %43 %43 0 1
%67 = OpImageSampleImplicitLod %v4float %70 %71
%72 = OpCompositeExtract %float %67 0
%73 = OpLoad %int %i
%74 = OpIAdd %int %73 %int_1
OpStore %i %74
%67 = OpLoad %int %i
%68 = OpIAdd %int %67 %int_1
OpStore %i %68
OpBranch %33
%33 = OpLabel
OpBranch %31
%32 = OpLabel
OpReturnValue %75
OpReturnValue %69
OpFunctionEnd
%main = OpFunction %void None %76
%79 = OpLabel
%81 = OpLoad %v2float %vUV_1
%80 = OpFunctionCall %v4float %main_inner %81
OpStore %value %80
%main = OpFunction %void None %70
%73 = OpLabel
%75 = OpLoad %v2float %vUV_1
%74 = OpFunctionCall %v4float %main_inner %75
OpStore %value %74
OpReturn
OpFunctionEnd

View File

@@ -1,15 +1,3 @@
bug/fxc/gradient_in_varying_loop/1112.wgsl:23:33 warning: 'textureSample' must only be called from uniform control flow
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;
^^^^^^^^^^^^^
@group(0) @binding(0) var Sampler : sampler;
@group(0) @binding(1) var randomTexture : texture_2d<f32>;
@@ -30,7 +18,7 @@ fn main(@location(0) vUV : vec2<f32>) -> @location(0) vec4<f32> {
i = (i + 1);
continue;
}
let sampleDepth : f32 = textureSample(depthTexture, Sampler, offset.xy).r;
let sampleDepth : f32 = 0;
i = (i + 1);
}
return vec4<f32>(1.0);