James Price be656f7984 tint: Implement uniformity analaysis
This implements the uniformity analysis as currently described in the
WGSL specification. Uniformity issues are presented as warnings, and
will be switched to errors in a future release.

A follow-up patch will improve the error messages, which currently
just show the point at which a uniformity was detected.

In a future release, once we have obtained initial feedback from
users, uniformity issues will become errors.

Bug: tint:880
Change-Id: I7d0b3080932c786c5d50b55720fec6d19f00d356
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/88368
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Alan Baker <alanbaker@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
2022-05-11 22:05:15 +00:00

30 lines
958 B
WebGPU Shading Language

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;
^^^^^^^^^^^^^
@group(0) @binding(0) var Sampler : sampler;
@group(0) @binding(1) var randomTexture : texture_2d<f32>;
@group(0) @binding(2) var depthTexture : texture_2d<f32>;
@stage(fragment)
fn main(@location(0) vUV : vec2<f32>) -> @location(0) vec4<f32> {
let random : vec3<f32> = textureSample(randomTexture, Sampler, vUV).rgb;
var i = 0;
loop {
if ((i < 1)) {
} else {
break;
}
let offset : vec3<f32> = vec3<f32>(random.x);
if (((((offset.x < 0.0) || (offset.y < 0.0)) || (offset.x > 1.0)) || (offset.y > 1.0))) {
i = (i + 1);
continue;
}
let sampleDepth : f32 = textureSample(depthTexture, Sampler, offset.xy).r;
i = (i + 1);
}
return vec4<f32>(1.0);
}