mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 21:47:47 +00:00
tint: Handle @diagnostic on block statements
Use expect_compound_statement() in all the places that use compound_statement in the WGSL grammar. Handle attributes on statements inside Resolver::StatementScope, so that the logic can be reused for the various places where block statements are used. This will also make it easier to reuse this logic when we allow these attributes on other types of statement in the future. Add an `EmitBlockHeader()` helper to the WGSL writer to reuse the logic for emitting attributes on block statements for all the places that use them. Bug: tint:1809 Change-Id: Iac3bb01f5031e6134c1798ddafdad080412c8bef Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/118000 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: James Price <jrprice@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
e60a579c19
commit
d9f659670d
13
test/tint/diagnostic_filtering/case_body_attribute.wgsl
Normal file
13
test/tint/diagnostic_filtering/case_body_attribute.wgsl
Normal file
@@ -0,0 +1,13 @@
|
||||
@group(0) @binding(1) var t : texture_2d<f32>;
|
||||
@group(0) @binding(2) var s : sampler;
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
switch (i32(x)) {
|
||||
case 0 @diagnostic(warning, derivative_uniformity) {
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
}
|
||||
default {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
diagnostic_filtering/case_body_attribute.wgsl:8:11 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/case_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
switch (i32(x)) {
|
||||
^^^^^^
|
||||
|
||||
diagnostic_filtering/case_body_attribute.wgsl:6:15 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
switch (i32(x)) {
|
||||
^
|
||||
|
||||
Texture2D<float4> t : register(t1, space0);
|
||||
SamplerState s : register(s2, space0);
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
switch(int(x)) {
|
||||
case 0: {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
diagnostic_filtering/case_body_attribute.wgsl:8:11 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/case_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
switch (i32(x)) {
|
||||
^^^^^^
|
||||
|
||||
diagnostic_filtering/case_body_attribute.wgsl:6:15 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
switch (i32(x)) {
|
||||
^
|
||||
|
||||
Texture2D<float4> t : register(t1, space0);
|
||||
SamplerState s : register(s2, space0);
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
switch(int(x)) {
|
||||
case 0: {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
diagnostic_filtering/case_body_attribute.wgsl:8:11 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/case_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
switch (i32(x)) {
|
||||
^^^^^^
|
||||
|
||||
diagnostic_filtering/case_body_attribute.wgsl:6:15 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
switch (i32(x)) {
|
||||
^
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
layout(location = 0) in float x_1;
|
||||
void tint_symbol(float x) {
|
||||
switch(int(x)) {
|
||||
case 0: {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
tint_symbol(x_1);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
diagnostic_filtering/case_body_attribute.wgsl:8:11 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/case_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
switch (i32(x)) {
|
||||
^^^^^^
|
||||
|
||||
diagnostic_filtering/case_body_attribute.wgsl:6:15 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
switch (i32(x)) {
|
||||
^
|
||||
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol_2 {
|
||||
float x [[user(locn0)]];
|
||||
};
|
||||
|
||||
void tint_symbol_inner(float x) {
|
||||
switch(int(x)) {
|
||||
case 0: {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
|
||||
tint_symbol_inner(tint_symbol_1.x);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
diagnostic_filtering/case_body_attribute.wgsl:8:11 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/case_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
switch (i32(x)) {
|
||||
^^^^^^
|
||||
|
||||
diagnostic_filtering/case_body_attribute.wgsl:6:15 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
switch (i32(x)) {
|
||||
^
|
||||
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 25
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %x_1
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %x_1 "x_1"
|
||||
OpName %t "t"
|
||||
OpName %s "s"
|
||||
OpName %main_inner "main_inner"
|
||||
OpName %x "x"
|
||||
OpName %main "main"
|
||||
OpDecorate %x_1 Location 0
|
||||
OpDecorate %t DescriptorSet 0
|
||||
OpDecorate %t Binding 1
|
||||
OpDecorate %s DescriptorSet 0
|
||||
OpDecorate %s Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%x_1 = OpVariable %_ptr_Input_float Input
|
||||
%6 = OpTypeImage %float 2D 0 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
|
||||
%t = OpVariable %_ptr_UniformConstant_6 UniformConstant
|
||||
%9 = OpTypeSampler
|
||||
%_ptr_UniformConstant_9 = OpTypePointer UniformConstant %9
|
||||
%s = OpVariable %_ptr_UniformConstant_9 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%10 = OpTypeFunction %void %float
|
||||
%int = OpTypeInt 32 1
|
||||
%20 = OpTypeFunction %void
|
||||
%main_inner = OpFunction %void None %10
|
||||
%x = OpFunctionParameter %float
|
||||
%14 = OpLabel
|
||||
%16 = OpConvertFToS %int %x
|
||||
OpSelectionMerge %15 None
|
||||
OpSwitch %16 %18 0 %19
|
||||
%19 = OpLabel
|
||||
OpBranch %15
|
||||
%18 = OpLabel
|
||||
OpBranch %15
|
||||
%15 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %20
|
||||
%22 = OpLabel
|
||||
%24 = OpLoad %float %x_1
|
||||
%23 = OpFunctionCall %void %main_inner %24
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,26 @@
|
||||
diagnostic_filtering/case_body_attribute.wgsl:8:11 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/case_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
switch (i32(x)) {
|
||||
^^^^^^
|
||||
|
||||
diagnostic_filtering/case_body_attribute.wgsl:6:15 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
switch (i32(x)) {
|
||||
^
|
||||
|
||||
@group(0) @binding(1) var t : texture_2d<f32>;
|
||||
|
||||
@group(0) @binding(2) var s : sampler;
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
switch(i32(x)) {
|
||||
case 0: @diagnostic(warning, derivative_uniformity) {
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
}
|
||||
default: {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
@group(0) @binding(1) var t : texture_2d<f32>;
|
||||
@group(0) @binding(2) var s : sampler;
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
@diagnostic(warning, derivative_uniformity) {
|
||||
if (x > 0) {
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
diagnostic_filtering/compound_statement_attribute.wgsl:8:11 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/compound_statement_attribute.wgsl:7:5 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/compound_statement_attribute.wgsl:7:9 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
Texture2D<float4> t : register(t1, space0);
|
||||
SamplerState s : register(s2, space0);
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
{
|
||||
if ((x > 0.0f)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
diagnostic_filtering/compound_statement_attribute.wgsl:8:11 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/compound_statement_attribute.wgsl:7:5 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/compound_statement_attribute.wgsl:7:9 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
Texture2D<float4> t : register(t1, space0);
|
||||
SamplerState s : register(s2, space0);
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
{
|
||||
if ((x > 0.0f)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
diagnostic_filtering/compound_statement_attribute.wgsl:8:11 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/compound_statement_attribute.wgsl:7:5 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/compound_statement_attribute.wgsl:7:9 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
layout(location = 0) in float x_1;
|
||||
void tint_symbol(float x) {
|
||||
{
|
||||
if ((x > 0.0f)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
tint_symbol(x_1);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
diagnostic_filtering/compound_statement_attribute.wgsl:8:11 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/compound_statement_attribute.wgsl:7:5 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/compound_statement_attribute.wgsl:7:9 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol_2 {
|
||||
float x [[user(locn0)]];
|
||||
};
|
||||
|
||||
void tint_symbol_inner(float x) {
|
||||
{
|
||||
if ((x > 0.0f)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
|
||||
tint_symbol_inner(tint_symbol_1.x);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
diagnostic_filtering/compound_statement_attribute.wgsl:8:11 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/compound_statement_attribute.wgsl:7:5 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/compound_statement_attribute.wgsl:7:9 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 25
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %x_1
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %x_1 "x_1"
|
||||
OpName %t "t"
|
||||
OpName %s "s"
|
||||
OpName %main_inner "main_inner"
|
||||
OpName %x "x"
|
||||
OpName %main "main"
|
||||
OpDecorate %x_1 Location 0
|
||||
OpDecorate %t DescriptorSet 0
|
||||
OpDecorate %t Binding 1
|
||||
OpDecorate %s DescriptorSet 0
|
||||
OpDecorate %s Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%x_1 = OpVariable %_ptr_Input_float Input
|
||||
%6 = OpTypeImage %float 2D 0 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
|
||||
%t = OpVariable %_ptr_UniformConstant_6 UniformConstant
|
||||
%9 = OpTypeSampler
|
||||
%_ptr_UniformConstant_9 = OpTypePointer UniformConstant %9
|
||||
%s = OpVariable %_ptr_UniformConstant_9 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%10 = OpTypeFunction %void %float
|
||||
%15 = OpConstantNull %float
|
||||
%bool = OpTypeBool
|
||||
%20 = OpTypeFunction %void
|
||||
%main_inner = OpFunction %void None %10
|
||||
%x = OpFunctionParameter %float
|
||||
%14 = OpLabel
|
||||
%16 = OpFOrdGreaterThan %bool %x %15
|
||||
OpSelectionMerge %18 None
|
||||
OpBranchConditional %16 %19 %18
|
||||
%19 = OpLabel
|
||||
OpBranch %18
|
||||
%18 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %20
|
||||
%22 = OpLabel
|
||||
%24 = OpLoad %float %x_1
|
||||
%23 = OpFunctionCall %void %main_inner %24
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,24 @@
|
||||
diagnostic_filtering/compound_statement_attribute.wgsl:8:11 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/compound_statement_attribute.wgsl:7:5 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/compound_statement_attribute.wgsl:7:9 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
@group(0) @binding(1) var t : texture_2d<f32>;
|
||||
|
||||
@group(0) @binding(2) var s : sampler;
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
@diagnostic(warning, derivative_uniformity) {
|
||||
if ((x > 0)) {
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
@group(0) @binding(1) var t : texture_2d<f32>;
|
||||
@group(0) @binding(2) var s : sampler;
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
switch (i32(x)) {
|
||||
default @diagnostic(warning, derivative_uniformity) {
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
diagnostic_filtering/default_case_body_attribute.wgsl:8:11 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/default_case_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
switch (i32(x)) {
|
||||
^^^^^^
|
||||
|
||||
diagnostic_filtering/default_case_body_attribute.wgsl:6:15 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
switch (i32(x)) {
|
||||
^
|
||||
|
||||
Texture2D<float4> t : register(t1, space0);
|
||||
SamplerState s : register(s2, space0);
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
do {
|
||||
} while (false);
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
diagnostic_filtering/default_case_body_attribute.wgsl:8:11 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/default_case_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
switch (i32(x)) {
|
||||
^^^^^^
|
||||
|
||||
diagnostic_filtering/default_case_body_attribute.wgsl:6:15 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
switch (i32(x)) {
|
||||
^
|
||||
|
||||
Texture2D<float4> t : register(t1, space0);
|
||||
SamplerState s : register(s2, space0);
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
do {
|
||||
} while (false);
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
diagnostic_filtering/default_case_body_attribute.wgsl:8:11 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/default_case_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
switch (i32(x)) {
|
||||
^^^^^^
|
||||
|
||||
diagnostic_filtering/default_case_body_attribute.wgsl:6:15 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
switch (i32(x)) {
|
||||
^
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
layout(location = 0) in float x_1;
|
||||
void tint_symbol(float x) {
|
||||
switch(int(x)) {
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
tint_symbol(x_1);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
diagnostic_filtering/default_case_body_attribute.wgsl:8:11 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/default_case_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
switch (i32(x)) {
|
||||
^^^^^^
|
||||
|
||||
diagnostic_filtering/default_case_body_attribute.wgsl:6:15 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
switch (i32(x)) {
|
||||
^
|
||||
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol_2 {
|
||||
float x [[user(locn0)]];
|
||||
};
|
||||
|
||||
void tint_symbol_inner(float x) {
|
||||
switch(int(x)) {
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
|
||||
tint_symbol_inner(tint_symbol_1.x);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
diagnostic_filtering/default_case_body_attribute.wgsl:8:11 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/default_case_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
switch (i32(x)) {
|
||||
^^^^^^
|
||||
|
||||
diagnostic_filtering/default_case_body_attribute.wgsl:6:15 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
switch (i32(x)) {
|
||||
^
|
||||
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 24
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %x_1
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %x_1 "x_1"
|
||||
OpName %t "t"
|
||||
OpName %s "s"
|
||||
OpName %main_inner "main_inner"
|
||||
OpName %x "x"
|
||||
OpName %main "main"
|
||||
OpDecorate %x_1 Location 0
|
||||
OpDecorate %t DescriptorSet 0
|
||||
OpDecorate %t Binding 1
|
||||
OpDecorate %s DescriptorSet 0
|
||||
OpDecorate %s Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%x_1 = OpVariable %_ptr_Input_float Input
|
||||
%6 = OpTypeImage %float 2D 0 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
|
||||
%t = OpVariable %_ptr_UniformConstant_6 UniformConstant
|
||||
%9 = OpTypeSampler
|
||||
%_ptr_UniformConstant_9 = OpTypePointer UniformConstant %9
|
||||
%s = OpVariable %_ptr_UniformConstant_9 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%10 = OpTypeFunction %void %float
|
||||
%int = OpTypeInt 32 1
|
||||
%19 = OpTypeFunction %void
|
||||
%main_inner = OpFunction %void None %10
|
||||
%x = OpFunctionParameter %float
|
||||
%14 = OpLabel
|
||||
%16 = OpConvertFToS %int %x
|
||||
OpSelectionMerge %15 None
|
||||
OpSwitch %16 %18
|
||||
%18 = OpLabel
|
||||
OpBranch %15
|
||||
%15 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %19
|
||||
%21 = OpLabel
|
||||
%23 = OpLoad %float %x_1
|
||||
%22 = OpFunctionCall %void %main_inner %23
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,24 @@
|
||||
diagnostic_filtering/default_case_body_attribute.wgsl:8:11 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/default_case_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
switch (i32(x)) {
|
||||
^^^^^^
|
||||
|
||||
diagnostic_filtering/default_case_body_attribute.wgsl:6:15 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
switch (i32(x)) {
|
||||
^
|
||||
|
||||
@group(0) @binding(1) var t : texture_2d<f32>;
|
||||
|
||||
@group(0) @binding(2) var s : sampler;
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
switch(i32(x)) {
|
||||
default: @diagnostic(warning, derivative_uniformity) {
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
10
test/tint/diagnostic_filtering/else_body_attribute.wgsl
Normal file
10
test/tint/diagnostic_filtering/else_body_attribute.wgsl
Normal file
@@ -0,0 +1,10 @@
|
||||
@group(0) @binding(1) var t : texture_2d<f32>;
|
||||
@group(0) @binding(2) var s : sampler;
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
if (x > 0) {
|
||||
} else @diagnostic(warning, derivative_uniformity) {
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
diagnostic_filtering/else_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/else_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/else_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
Texture2D<float4> t : register(t1, space0);
|
||||
SamplerState s : register(s2, space0);
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
if ((x > 0.0f)) {
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
diagnostic_filtering/else_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/else_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/else_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
Texture2D<float4> t : register(t1, space0);
|
||||
SamplerState s : register(s2, space0);
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
if ((x > 0.0f)) {
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
diagnostic_filtering/else_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/else_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/else_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
layout(location = 0) in float x_1;
|
||||
void tint_symbol(float x) {
|
||||
if ((x > 0.0f)) {
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
tint_symbol(x_1);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
diagnostic_filtering/else_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/else_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/else_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol_2 {
|
||||
float x [[user(locn0)]];
|
||||
};
|
||||
|
||||
void tint_symbol_inner(float x) {
|
||||
if ((x > 0.0f)) {
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
|
||||
tint_symbol_inner(tint_symbol_1.x);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
diagnostic_filtering/else_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/else_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/else_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 26
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %x_1
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %x_1 "x_1"
|
||||
OpName %t "t"
|
||||
OpName %s "s"
|
||||
OpName %main_inner "main_inner"
|
||||
OpName %x "x"
|
||||
OpName %main "main"
|
||||
OpDecorate %x_1 Location 0
|
||||
OpDecorate %t DescriptorSet 0
|
||||
OpDecorate %t Binding 1
|
||||
OpDecorate %s DescriptorSet 0
|
||||
OpDecorate %s Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%x_1 = OpVariable %_ptr_Input_float Input
|
||||
%6 = OpTypeImage %float 2D 0 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
|
||||
%t = OpVariable %_ptr_UniformConstant_6 UniformConstant
|
||||
%9 = OpTypeSampler
|
||||
%_ptr_UniformConstant_9 = OpTypePointer UniformConstant %9
|
||||
%s = OpVariable %_ptr_UniformConstant_9 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%10 = OpTypeFunction %void %float
|
||||
%15 = OpConstantNull %float
|
||||
%bool = OpTypeBool
|
||||
%21 = OpTypeFunction %void
|
||||
%main_inner = OpFunction %void None %10
|
||||
%x = OpFunctionParameter %float
|
||||
%14 = OpLabel
|
||||
%16 = OpFOrdGreaterThan %bool %x %15
|
||||
OpSelectionMerge %18 None
|
||||
OpBranchConditional %16 %19 %20
|
||||
%19 = OpLabel
|
||||
OpBranch %18
|
||||
%20 = OpLabel
|
||||
OpBranch %18
|
||||
%18 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %21
|
||||
%23 = OpLabel
|
||||
%25 = OpLoad %float %x_1
|
||||
%24 = OpFunctionCall %void %main_inner %25
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,23 @@
|
||||
diagnostic_filtering/else_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/else_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/else_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
@group(0) @binding(1) var t : texture_2d<f32>;
|
||||
|
||||
@group(0) @binding(2) var s : sampler;
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
if ((x > 0)) {
|
||||
} else @diagnostic(warning, derivative_uniformity) {
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
}
|
||||
}
|
||||
10
test/tint/diagnostic_filtering/else_if_body_attribute.wgsl
Normal file
10
test/tint/diagnostic_filtering/else_if_body_attribute.wgsl
Normal file
@@ -0,0 +1,10 @@
|
||||
@group(0) @binding(1) var t : texture_2d<f32>;
|
||||
@group(0) @binding(2) var s : sampler;
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
if (x > 0) {
|
||||
} else if (x < 0) @diagnostic(warning, derivative_uniformity) {
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
diagnostic_filtering/else_if_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/else_if_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/else_if_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
Texture2D<float4> t : register(t1, space0);
|
||||
SamplerState s : register(s2, space0);
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
if ((x > 0.0f)) {
|
||||
} else {
|
||||
if ((x < 0.0f)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
diagnostic_filtering/else_if_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/else_if_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/else_if_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
Texture2D<float4> t : register(t1, space0);
|
||||
SamplerState s : register(s2, space0);
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
if ((x > 0.0f)) {
|
||||
} else {
|
||||
if ((x < 0.0f)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
diagnostic_filtering/else_if_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/else_if_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/else_if_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
layout(location = 0) in float x_1;
|
||||
void tint_symbol(float x) {
|
||||
if ((x > 0.0f)) {
|
||||
} else {
|
||||
if ((x < 0.0f)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
tint_symbol(x_1);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
diagnostic_filtering/else_if_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/else_if_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/else_if_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol_2 {
|
||||
float x [[user(locn0)]];
|
||||
};
|
||||
|
||||
void tint_symbol_inner(float x) {
|
||||
if ((x > 0.0f)) {
|
||||
} else {
|
||||
if ((x < 0.0f)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
|
||||
tint_symbol_inner(tint_symbol_1.x);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
diagnostic_filtering/else_if_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/else_if_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/else_if_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 29
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %x_1
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %x_1 "x_1"
|
||||
OpName %t "t"
|
||||
OpName %s "s"
|
||||
OpName %main_inner "main_inner"
|
||||
OpName %x "x"
|
||||
OpName %main "main"
|
||||
OpDecorate %x_1 Location 0
|
||||
OpDecorate %t DescriptorSet 0
|
||||
OpDecorate %t Binding 1
|
||||
OpDecorate %s DescriptorSet 0
|
||||
OpDecorate %s Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%x_1 = OpVariable %_ptr_Input_float Input
|
||||
%6 = OpTypeImage %float 2D 0 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
|
||||
%t = OpVariable %_ptr_UniformConstant_6 UniformConstant
|
||||
%9 = OpTypeSampler
|
||||
%_ptr_UniformConstant_9 = OpTypePointer UniformConstant %9
|
||||
%s = OpVariable %_ptr_UniformConstant_9 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%10 = OpTypeFunction %void %float
|
||||
%15 = OpConstantNull %float
|
||||
%bool = OpTypeBool
|
||||
%24 = OpTypeFunction %void
|
||||
%main_inner = OpFunction %void None %10
|
||||
%x = OpFunctionParameter %float
|
||||
%14 = OpLabel
|
||||
%16 = OpFOrdGreaterThan %bool %x %15
|
||||
OpSelectionMerge %18 None
|
||||
OpBranchConditional %16 %19 %20
|
||||
%19 = OpLabel
|
||||
OpBranch %18
|
||||
%20 = OpLabel
|
||||
%21 = OpFOrdLessThan %bool %x %15
|
||||
OpSelectionMerge %22 None
|
||||
OpBranchConditional %21 %23 %22
|
||||
%23 = OpLabel
|
||||
OpBranch %22
|
||||
%22 = OpLabel
|
||||
OpBranch %18
|
||||
%18 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %24
|
||||
%26 = OpLabel
|
||||
%28 = OpLoad %float %x_1
|
||||
%27 = OpFunctionCall %void %main_inner %28
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,23 @@
|
||||
diagnostic_filtering/else_if_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/else_if_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/else_if_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
@group(0) @binding(1) var t : texture_2d<f32>;
|
||||
|
||||
@group(0) @binding(2) var s : sampler;
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
if ((x > 0)) {
|
||||
} else if ((x < 0)) @diagnostic(warning, derivative_uniformity) {
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
}
|
||||
}
|
||||
10
test/tint/diagnostic_filtering/for_loop_body_attribute.wgsl
Normal file
10
test/tint/diagnostic_filtering/for_loop_body_attribute.wgsl
Normal file
@@ -0,0 +1,10 @@
|
||||
@group(0) @binding(1) var t : texture_2d<f32>;
|
||||
@group(0) @binding(2) var s : sampler;
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
var v = vec4<f32>(0);
|
||||
for (; x > v.x; ) @diagnostic(warning, derivative_uniformity) {
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
diagnostic_filtering/for_loop_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/for_loop_body_attribute.wgsl:7:3 note: control flow depends on possibly non-uniform value
|
||||
for (; x > v.x; ) @diagnostic(warning, derivative_uniformity) {
|
||||
^^^
|
||||
|
||||
diagnostic_filtering/for_loop_body_attribute.wgsl:8:9 note: return value of 'textureSample' may be non-uniform
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
Texture2D<float4> t : register(t1, space0);
|
||||
SamplerState s : register(s2, space0);
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
float4 v = (0.0f).xxxx;
|
||||
{
|
||||
for(; (x > v.x); ) {
|
||||
v = t.Sample(s, (0.0f).xx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
SKIP: FXC rejects non-uniform texture sample operation in output
|
||||
|
||||
diagnostic_filtering/for_loop_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/for_loop_body_attribute.wgsl:7:3 note: control flow depends on possibly non-uniform value
|
||||
for (; x > v.x; ) @diagnostic(warning, derivative_uniformity) {
|
||||
^^^
|
||||
|
||||
diagnostic_filtering/for_loop_body_attribute.wgsl:8:9 note: return value of 'textureSample' may be non-uniform
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
Texture2D<float4> t : register(t1, space0);
|
||||
SamplerState s : register(s2, space0);
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
float4 v = (0.0f).xxxx;
|
||||
{
|
||||
for(; (x > v.x); ) {
|
||||
v = t.Sample(s, (0.0f).xx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
diagnostic_filtering/for_loop_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/for_loop_body_attribute.wgsl:7:3 note: control flow depends on possibly non-uniform value
|
||||
for (; x > v.x; ) @diagnostic(warning, derivative_uniformity) {
|
||||
^^^
|
||||
|
||||
diagnostic_filtering/for_loop_body_attribute.wgsl:8:9 note: return value of 'textureSample' may be non-uniform
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
layout(location = 0) in float x_1;
|
||||
uniform highp sampler2D t_s;
|
||||
|
||||
void tint_symbol(float x) {
|
||||
vec4 v = vec4(0.0f);
|
||||
{
|
||||
for(; (x > v.x); ) {
|
||||
v = texture(t_s, vec2(0.0f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
tint_symbol(x_1);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
diagnostic_filtering/for_loop_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/for_loop_body_attribute.wgsl:7:3 note: control flow depends on possibly non-uniform value
|
||||
for (; x > v.x; ) @diagnostic(warning, derivative_uniformity) {
|
||||
^^^
|
||||
|
||||
diagnostic_filtering/for_loop_body_attribute.wgsl:8:9 note: return value of 'textureSample' may be non-uniform
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol_2 {
|
||||
float x [[user(locn0)]];
|
||||
};
|
||||
|
||||
void tint_symbol_inner(float x, texture2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
float4 v = float4(0.0f);
|
||||
for(; (x > v[0]); ) {
|
||||
v = tint_symbol_3.sample(tint_symbol_4, float2(0.0f));
|
||||
}
|
||||
}
|
||||
|
||||
fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
|
||||
tint_symbol_inner(tint_symbol_1.x, tint_symbol_5, tint_symbol_6);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
diagnostic_filtering/for_loop_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/for_loop_body_attribute.wgsl:7:3 note: control flow depends on possibly non-uniform value
|
||||
for (; x > v.x; ) @diagnostic(warning, derivative_uniformity) {
|
||||
^^^
|
||||
|
||||
diagnostic_filtering/for_loop_body_attribute.wgsl:8:9 note: return value of 'textureSample' may be non-uniform
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 45
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %x_1
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %x_1 "x_1"
|
||||
OpName %t "t"
|
||||
OpName %s "s"
|
||||
OpName %main_inner "main_inner"
|
||||
OpName %x "x"
|
||||
OpName %v "v"
|
||||
OpName %main "main"
|
||||
OpDecorate %x_1 Location 0
|
||||
OpDecorate %t DescriptorSet 0
|
||||
OpDecorate %t Binding 1
|
||||
OpDecorate %s DescriptorSet 0
|
||||
OpDecorate %s Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%x_1 = OpVariable %_ptr_Input_float Input
|
||||
%6 = OpTypeImage %float 2D 0 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
|
||||
%t = OpVariable %_ptr_UniformConstant_6 UniformConstant
|
||||
%9 = OpTypeSampler
|
||||
%_ptr_UniformConstant_9 = OpTypePointer UniformConstant %9
|
||||
%s = OpVariable %_ptr_UniformConstant_9 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%10 = OpTypeFunction %void %float
|
||||
%v4float = OpTypeVector %float 4
|
||||
%16 = OpConstantNull %v4float
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%bool = OpTypeBool
|
||||
%36 = OpTypeSampledImage %6
|
||||
%v2float = OpTypeVector %float 2
|
||||
%39 = OpConstantNull %v2float
|
||||
%40 = OpTypeFunction %void
|
||||
%main_inner = OpFunction %void None %10
|
||||
%x = OpFunctionParameter %float
|
||||
%14 = OpLabel
|
||||
%v = OpVariable %_ptr_Function_v4float Function %16
|
||||
OpStore %v %16
|
||||
OpBranch %19
|
||||
%19 = OpLabel
|
||||
OpLoopMerge %20 %21 None
|
||||
OpBranch %22
|
||||
%22 = OpLabel
|
||||
%27 = OpAccessChain %_ptr_Function_float %v %uint_0
|
||||
%28 = OpLoad %float %27
|
||||
%29 = OpFOrdGreaterThan %bool %x %28
|
||||
%23 = OpLogicalNot %bool %29
|
||||
OpSelectionMerge %31 None
|
||||
OpBranchConditional %23 %32 %31
|
||||
%32 = OpLabel
|
||||
OpBranch %20
|
||||
%31 = OpLabel
|
||||
%34 = OpLoad %9 %s
|
||||
%35 = OpLoad %6 %t
|
||||
%37 = OpSampledImage %36 %35 %34
|
||||
%33 = OpImageSampleImplicitLod %v4float %37 %39
|
||||
OpStore %v %33
|
||||
OpBranch %21
|
||||
%21 = OpLabel
|
||||
OpBranch %19
|
||||
%20 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %40
|
||||
%42 = OpLabel
|
||||
%44 = OpLoad %float %x_1
|
||||
%43 = OpFunctionCall %void %main_inner %44
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,23 @@
|
||||
diagnostic_filtering/for_loop_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/for_loop_body_attribute.wgsl:7:3 note: control flow depends on possibly non-uniform value
|
||||
for (; x > v.x; ) @diagnostic(warning, derivative_uniformity) {
|
||||
^^^
|
||||
|
||||
diagnostic_filtering/for_loop_body_attribute.wgsl:8:9 note: return value of 'textureSample' may be non-uniform
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
@group(0) @binding(1) var t : texture_2d<f32>;
|
||||
|
||||
@group(0) @binding(2) var s : sampler;
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
var v = vec4<f32>(0);
|
||||
for(; (x > v.x); ) @diagnostic(warning, derivative_uniformity) {
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
@group(0) @binding(1) var t : texture_2d<f32>;
|
||||
@group(0) @binding(2) var s : sampler;
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) @diagnostic(warning, derivative_uniformity) {
|
||||
if (x > 0) {
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
diagnostic_filtering/function_body_attribute.wgsl:7:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/function_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/function_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
Texture2D<float4> t : register(t1, space0);
|
||||
SamplerState s : register(s2, space0);
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
if ((x > 0.0f)) {
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
diagnostic_filtering/function_body_attribute.wgsl:7:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/function_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/function_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
Texture2D<float4> t : register(t1, space0);
|
||||
SamplerState s : register(s2, space0);
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
if ((x > 0.0f)) {
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
diagnostic_filtering/function_body_attribute.wgsl:7:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/function_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/function_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
layout(location = 0) in float x_1;
|
||||
void tint_symbol(float x) {
|
||||
if ((x > 0.0f)) {
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
tint_symbol(x_1);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
diagnostic_filtering/function_body_attribute.wgsl:7:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/function_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/function_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol_2 {
|
||||
float x [[user(locn0)]];
|
||||
};
|
||||
|
||||
void tint_symbol_inner(float x) {
|
||||
if ((x > 0.0f)) {
|
||||
}
|
||||
}
|
||||
|
||||
fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
|
||||
tint_symbol_inner(tint_symbol_1.x);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
diagnostic_filtering/function_body_attribute.wgsl:7:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/function_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/function_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 25
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %x_1
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %x_1 "x_1"
|
||||
OpName %t "t"
|
||||
OpName %s "s"
|
||||
OpName %main_inner "main_inner"
|
||||
OpName %x "x"
|
||||
OpName %main "main"
|
||||
OpDecorate %x_1 Location 0
|
||||
OpDecorate %t DescriptorSet 0
|
||||
OpDecorate %t Binding 1
|
||||
OpDecorate %s DescriptorSet 0
|
||||
OpDecorate %s Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%x_1 = OpVariable %_ptr_Input_float Input
|
||||
%6 = OpTypeImage %float 2D 0 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
|
||||
%t = OpVariable %_ptr_UniformConstant_6 UniformConstant
|
||||
%9 = OpTypeSampler
|
||||
%_ptr_UniformConstant_9 = OpTypePointer UniformConstant %9
|
||||
%s = OpVariable %_ptr_UniformConstant_9 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%10 = OpTypeFunction %void %float
|
||||
%15 = OpConstantNull %float
|
||||
%bool = OpTypeBool
|
||||
%20 = OpTypeFunction %void
|
||||
%main_inner = OpFunction %void None %10
|
||||
%x = OpFunctionParameter %float
|
||||
%14 = OpLabel
|
||||
%16 = OpFOrdGreaterThan %bool %x %15
|
||||
OpSelectionMerge %18 None
|
||||
OpBranchConditional %16 %19 %18
|
||||
%19 = OpLabel
|
||||
OpBranch %18
|
||||
%18 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %20
|
||||
%22 = OpLabel
|
||||
%24 = OpLoad %float %x_1
|
||||
%23 = OpFunctionCall %void %main_inner %24
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,22 @@
|
||||
diagnostic_filtering/function_body_attribute.wgsl:7:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/function_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/function_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) {
|
||||
^
|
||||
|
||||
@group(0) @binding(1) var t : texture_2d<f32>;
|
||||
|
||||
@group(0) @binding(2) var s : sampler;
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) @diagnostic(warning, derivative_uniformity) {
|
||||
if ((x > 0)) {
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
}
|
||||
}
|
||||
9
test/tint/diagnostic_filtering/if_body_attribute.wgsl
Normal file
9
test/tint/diagnostic_filtering/if_body_attribute.wgsl
Normal file
@@ -0,0 +1,9 @@
|
||||
@group(0) @binding(1) var t : texture_2d<f32>;
|
||||
@group(0) @binding(2) var s : sampler;
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
if (x > 0) @diagnostic(warning, derivative_uniformity) {
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
diagnostic_filtering/if_body_attribute.wgsl:7:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/if_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) @diagnostic(warning, derivative_uniformity) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/if_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) @diagnostic(warning, derivative_uniformity) {
|
||||
^
|
||||
|
||||
Texture2D<float4> t : register(t1, space0);
|
||||
SamplerState s : register(s2, space0);
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
if ((x > 0.0f)) {
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
diagnostic_filtering/if_body_attribute.wgsl:7:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/if_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) @diagnostic(warning, derivative_uniformity) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/if_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) @diagnostic(warning, derivative_uniformity) {
|
||||
^
|
||||
|
||||
Texture2D<float4> t : register(t1, space0);
|
||||
SamplerState s : register(s2, space0);
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
if ((x > 0.0f)) {
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
diagnostic_filtering/if_body_attribute.wgsl:7:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/if_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) @diagnostic(warning, derivative_uniformity) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/if_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) @diagnostic(warning, derivative_uniformity) {
|
||||
^
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
layout(location = 0) in float x_1;
|
||||
void tint_symbol(float x) {
|
||||
if ((x > 0.0f)) {
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
tint_symbol(x_1);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
diagnostic_filtering/if_body_attribute.wgsl:7:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/if_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) @diagnostic(warning, derivative_uniformity) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/if_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) @diagnostic(warning, derivative_uniformity) {
|
||||
^
|
||||
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol_2 {
|
||||
float x [[user(locn0)]];
|
||||
};
|
||||
|
||||
void tint_symbol_inner(float x) {
|
||||
if ((x > 0.0f)) {
|
||||
}
|
||||
}
|
||||
|
||||
fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
|
||||
tint_symbol_inner(tint_symbol_1.x);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
diagnostic_filtering/if_body_attribute.wgsl:7:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/if_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) @diagnostic(warning, derivative_uniformity) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/if_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) @diagnostic(warning, derivative_uniformity) {
|
||||
^
|
||||
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 25
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %x_1
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %x_1 "x_1"
|
||||
OpName %t "t"
|
||||
OpName %s "s"
|
||||
OpName %main_inner "main_inner"
|
||||
OpName %x "x"
|
||||
OpName %main "main"
|
||||
OpDecorate %x_1 Location 0
|
||||
OpDecorate %t DescriptorSet 0
|
||||
OpDecorate %t Binding 1
|
||||
OpDecorate %s DescriptorSet 0
|
||||
OpDecorate %s Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%x_1 = OpVariable %_ptr_Input_float Input
|
||||
%6 = OpTypeImage %float 2D 0 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
|
||||
%t = OpVariable %_ptr_UniformConstant_6 UniformConstant
|
||||
%9 = OpTypeSampler
|
||||
%_ptr_UniformConstant_9 = OpTypePointer UniformConstant %9
|
||||
%s = OpVariable %_ptr_UniformConstant_9 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%10 = OpTypeFunction %void %float
|
||||
%15 = OpConstantNull %float
|
||||
%bool = OpTypeBool
|
||||
%20 = OpTypeFunction %void
|
||||
%main_inner = OpFunction %void None %10
|
||||
%x = OpFunctionParameter %float
|
||||
%14 = OpLabel
|
||||
%16 = OpFOrdGreaterThan %bool %x %15
|
||||
OpSelectionMerge %18 None
|
||||
OpBranchConditional %16 %19 %18
|
||||
%19 = OpLabel
|
||||
OpBranch %18
|
||||
%18 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %20
|
||||
%22 = OpLabel
|
||||
%24 = OpLoad %float %x_1
|
||||
%23 = OpFunctionCall %void %main_inner %24
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,22 @@
|
||||
diagnostic_filtering/if_body_attribute.wgsl:7:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/if_body_attribute.wgsl:6:3 note: control flow depends on possibly non-uniform value
|
||||
if (x > 0) @diagnostic(warning, derivative_uniformity) {
|
||||
^^
|
||||
|
||||
diagnostic_filtering/if_body_attribute.wgsl:6:7 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
if (x > 0) @diagnostic(warning, derivative_uniformity) {
|
||||
^
|
||||
|
||||
@group(0) @binding(1) var t : texture_2d<f32>;
|
||||
|
||||
@group(0) @binding(2) var s : sampler;
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
if ((x > 0)) @diagnostic(warning, derivative_uniformity) {
|
||||
_ = textureSample(t, s, vec2(0, 0));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
@group(0) @binding(1) var t : texture_2d<f32>;
|
||||
@group(0) @binding(2) var s : sampler;
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
var v = vec4<f32>(0);
|
||||
while (x > v.x) @diagnostic(warning, derivative_uniformity) {
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
diagnostic_filtering/while_loop_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/while_loop_body_attribute.wgsl:7:3 note: control flow depends on possibly non-uniform value
|
||||
while (x > v.x) @diagnostic(warning, derivative_uniformity) {
|
||||
^^^^^
|
||||
|
||||
diagnostic_filtering/while_loop_body_attribute.wgsl:8:9 note: return value of 'textureSample' may be non-uniform
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
Texture2D<float4> t : register(t1, space0);
|
||||
SamplerState s : register(s2, space0);
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
float4 v = (0.0f).xxxx;
|
||||
while((x > v.x)) {
|
||||
v = t.Sample(s, (0.0f).xx);
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
SKIP: FXC rejects non-uniform texture sample operation in output
|
||||
|
||||
diagnostic_filtering/while_loop_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/while_loop_body_attribute.wgsl:7:3 note: control flow depends on possibly non-uniform value
|
||||
while (x > v.x) @diagnostic(warning, derivative_uniformity) {
|
||||
^^^^^
|
||||
|
||||
diagnostic_filtering/while_loop_body_attribute.wgsl:8:9 note: return value of 'textureSample' may be non-uniform
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
Texture2D<float4> t : register(t1, space0);
|
||||
SamplerState s : register(s2, space0);
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
float4 v = (0.0f).xxxx;
|
||||
while((x > v.x)) {
|
||||
v = t.Sample(s, (0.0f).xx);
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
diagnostic_filtering/while_loop_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/while_loop_body_attribute.wgsl:7:3 note: control flow depends on possibly non-uniform value
|
||||
while (x > v.x) @diagnostic(warning, derivative_uniformity) {
|
||||
^^^^^
|
||||
|
||||
diagnostic_filtering/while_loop_body_attribute.wgsl:8:9 note: return value of 'textureSample' may be non-uniform
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
layout(location = 0) in float x_1;
|
||||
uniform highp sampler2D t_s;
|
||||
|
||||
void tint_symbol(float x) {
|
||||
vec4 v = vec4(0.0f);
|
||||
while((x > v.x)) {
|
||||
v = texture(t_s, vec2(0.0f));
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
tint_symbol(x_1);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
diagnostic_filtering/while_loop_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/while_loop_body_attribute.wgsl:7:3 note: control flow depends on possibly non-uniform value
|
||||
while (x > v.x) @diagnostic(warning, derivative_uniformity) {
|
||||
^^^^^
|
||||
|
||||
diagnostic_filtering/while_loop_body_attribute.wgsl:8:9 note: return value of 'textureSample' may be non-uniform
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol_2 {
|
||||
float x [[user(locn0)]];
|
||||
};
|
||||
|
||||
void tint_symbol_inner(float x, texture2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
float4 v = float4(0.0f);
|
||||
while((x > v[0])) {
|
||||
v = tint_symbol_3.sample(tint_symbol_4, float2(0.0f));
|
||||
}
|
||||
}
|
||||
|
||||
fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
|
||||
tint_symbol_inner(tint_symbol_1.x, tint_symbol_5, tint_symbol_6);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
diagnostic_filtering/while_loop_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/while_loop_body_attribute.wgsl:7:3 note: control flow depends on possibly non-uniform value
|
||||
while (x > v.x) @diagnostic(warning, derivative_uniformity) {
|
||||
^^^^^
|
||||
|
||||
diagnostic_filtering/while_loop_body_attribute.wgsl:8:9 note: return value of 'textureSample' may be non-uniform
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 45
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %x_1
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %x_1 "x_1"
|
||||
OpName %t "t"
|
||||
OpName %s "s"
|
||||
OpName %main_inner "main_inner"
|
||||
OpName %x "x"
|
||||
OpName %v "v"
|
||||
OpName %main "main"
|
||||
OpDecorate %x_1 Location 0
|
||||
OpDecorate %t DescriptorSet 0
|
||||
OpDecorate %t Binding 1
|
||||
OpDecorate %s DescriptorSet 0
|
||||
OpDecorate %s Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%x_1 = OpVariable %_ptr_Input_float Input
|
||||
%6 = OpTypeImage %float 2D 0 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_6 = OpTypePointer UniformConstant %6
|
||||
%t = OpVariable %_ptr_UniformConstant_6 UniformConstant
|
||||
%9 = OpTypeSampler
|
||||
%_ptr_UniformConstant_9 = OpTypePointer UniformConstant %9
|
||||
%s = OpVariable %_ptr_UniformConstant_9 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%10 = OpTypeFunction %void %float
|
||||
%v4float = OpTypeVector %float 4
|
||||
%16 = OpConstantNull %v4float
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%bool = OpTypeBool
|
||||
%36 = OpTypeSampledImage %6
|
||||
%v2float = OpTypeVector %float 2
|
||||
%39 = OpConstantNull %v2float
|
||||
%40 = OpTypeFunction %void
|
||||
%main_inner = OpFunction %void None %10
|
||||
%x = OpFunctionParameter %float
|
||||
%14 = OpLabel
|
||||
%v = OpVariable %_ptr_Function_v4float Function %16
|
||||
OpStore %v %16
|
||||
OpBranch %19
|
||||
%19 = OpLabel
|
||||
OpLoopMerge %20 %21 None
|
||||
OpBranch %22
|
||||
%22 = OpLabel
|
||||
%27 = OpAccessChain %_ptr_Function_float %v %uint_0
|
||||
%28 = OpLoad %float %27
|
||||
%29 = OpFOrdGreaterThan %bool %x %28
|
||||
%23 = OpLogicalNot %bool %29
|
||||
OpSelectionMerge %31 None
|
||||
OpBranchConditional %23 %32 %31
|
||||
%32 = OpLabel
|
||||
OpBranch %20
|
||||
%31 = OpLabel
|
||||
%34 = OpLoad %9 %s
|
||||
%35 = OpLoad %6 %t
|
||||
%37 = OpSampledImage %36 %35 %34
|
||||
%33 = OpImageSampleImplicitLod %v4float %37 %39
|
||||
OpStore %v %33
|
||||
OpBranch %21
|
||||
%21 = OpLabel
|
||||
OpBranch %19
|
||||
%20 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %40
|
||||
%42 = OpLabel
|
||||
%44 = OpLoad %float %x_1
|
||||
%43 = OpFunctionCall %void %main_inner %44
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,23 @@
|
||||
diagnostic_filtering/while_loop_body_attribute.wgsl:8:9 warning: 'textureSample' must only be called from uniform control flow
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/while_loop_body_attribute.wgsl:7:3 note: control flow depends on possibly non-uniform value
|
||||
while (x > v.x) @diagnostic(warning, derivative_uniformity) {
|
||||
^^^^^
|
||||
|
||||
diagnostic_filtering/while_loop_body_attribute.wgsl:8:9 note: return value of 'textureSample' may be non-uniform
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
@group(0) @binding(1) var t : texture_2d<f32>;
|
||||
|
||||
@group(0) @binding(2) var s : sampler;
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
var v = vec4<f32>(0);
|
||||
while((x > v.x)) @diagnostic(warning, derivative_uniformity) {
|
||||
v = textureSample(t, s, vec2(0, 0));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user