mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-10 14:08:04 +00:00
tint: Support @diagnostic on loop and loop body
Bug: tint:1809 Change-Id: Ib3ccfd823f9cccb67bebbf04927d54f193a4e281 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124321 Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
221d628392
commit
d7d8b80c81
10
test/tint/diagnostic_filtering/loop_attribute.wgsl
Normal file
10
test/tint/diagnostic_filtering/loop_attribute.wgsl
Normal file
@@ -0,0 +1,10 @@
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
@diagnostic(warning, derivative_uniformity)
|
||||
loop {
|
||||
_ = dpdx(1.0);
|
||||
continuing {
|
||||
break if x > 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
diagnostic_filtering/loop_attribute.wgsl:5:9 warning: 'dpdx' must only be called from uniform control flow
|
||||
_ = dpdx(1.0);
|
||||
^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/loop_attribute.wgsl:7:7 note: control flow depends on possibly non-uniform value
|
||||
break if x > 0.0;
|
||||
^^^^^
|
||||
|
||||
diagnostic_filtering/loop_attribute.wgsl:7:16 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
break if x > 0.0;
|
||||
^
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
while (true) {
|
||||
{
|
||||
if ((x > 0.0f)) { break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
diagnostic_filtering/loop_attribute.wgsl:5:9 warning: 'dpdx' must only be called from uniform control flow
|
||||
_ = dpdx(1.0);
|
||||
^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/loop_attribute.wgsl:7:7 note: control flow depends on possibly non-uniform value
|
||||
break if x > 0.0;
|
||||
^^^^^
|
||||
|
||||
diagnostic_filtering/loop_attribute.wgsl:7:16 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
break if x > 0.0;
|
||||
^
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
while (true) {
|
||||
{
|
||||
if ((x > 0.0f)) { break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
diagnostic_filtering/loop_attribute.wgsl:5:9 warning: 'dpdx' must only be called from uniform control flow
|
||||
_ = dpdx(1.0);
|
||||
^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/loop_attribute.wgsl:7:7 note: control flow depends on possibly non-uniform value
|
||||
break if x > 0.0;
|
||||
^^^^^
|
||||
|
||||
diagnostic_filtering/loop_attribute.wgsl:7:16 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
break if x > 0.0;
|
||||
^
|
||||
|
||||
#version 310 es
|
||||
precision highp float;
|
||||
|
||||
layout(location = 0) in float x_1;
|
||||
void tint_symbol(float x) {
|
||||
while (true) {
|
||||
{
|
||||
if ((x > 0.0f)) { break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
tint_symbol(x_1);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
diagnostic_filtering/loop_attribute.wgsl:5:9 warning: 'dpdx' must only be called from uniform control flow
|
||||
_ = dpdx(1.0);
|
||||
^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/loop_attribute.wgsl:7:7 note: control flow depends on possibly non-uniform value
|
||||
break if x > 0.0;
|
||||
^^^^^
|
||||
|
||||
diagnostic_filtering/loop_attribute.wgsl:7:16 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
break if x > 0.0;
|
||||
^
|
||||
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol_2 {
|
||||
float x [[user(locn0)]];
|
||||
};
|
||||
|
||||
void tint_symbol_inner(float x) {
|
||||
while (true) {
|
||||
{
|
||||
if ((x > 0.0f)) { break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
|
||||
tint_symbol_inner(tint_symbol_1.x);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
diagnostic_filtering/loop_attribute.wgsl:5:9 warning: 'dpdx' must only be called from uniform control flow
|
||||
_ = dpdx(1.0);
|
||||
^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/loop_attribute.wgsl:7:7 note: control flow depends on possibly non-uniform value
|
||||
break if x > 0.0;
|
||||
^^^^^
|
||||
|
||||
diagnostic_filtering/loop_attribute.wgsl:7:16 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
break if x > 0.0;
|
||||
^
|
||||
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 21
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %x_1
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %x_1 "x_1"
|
||||
OpName %main_inner "main_inner"
|
||||
OpName %x "x"
|
||||
OpName %main "main"
|
||||
OpDecorate %x_1 Location 0
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%x_1 = OpVariable %_ptr_Input_float Input
|
||||
%void = OpTypeVoid
|
||||
%4 = OpTypeFunction %void %float
|
||||
%13 = OpConstantNull %float
|
||||
%bool = OpTypeBool
|
||||
%16 = OpTypeFunction %void
|
||||
%main_inner = OpFunction %void None %4
|
||||
%x = OpFunctionParameter %float
|
||||
%8 = OpLabel
|
||||
OpBranch %9
|
||||
%9 = OpLabel
|
||||
OpLoopMerge %10 %11 None
|
||||
OpBranch %12
|
||||
%12 = OpLabel
|
||||
OpBranch %11
|
||||
%11 = OpLabel
|
||||
%14 = OpFOrdGreaterThan %bool %x %13
|
||||
OpBranchConditional %14 %10 %9
|
||||
%10 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %16
|
||||
%18 = OpLabel
|
||||
%20 = OpLoad %float %x_1
|
||||
%19 = OpFunctionCall %void %main_inner %20
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,22 @@
|
||||
diagnostic_filtering/loop_attribute.wgsl:5:9 warning: 'dpdx' must only be called from uniform control flow
|
||||
_ = dpdx(1.0);
|
||||
^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/loop_attribute.wgsl:7:7 note: control flow depends on possibly non-uniform value
|
||||
break if x > 0.0;
|
||||
^^^^^
|
||||
|
||||
diagnostic_filtering/loop_attribute.wgsl:7:16 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
break if x > 0.0;
|
||||
^
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
@diagnostic(warning, derivative_uniformity) loop {
|
||||
_ = dpdx(1.0);
|
||||
|
||||
continuing {
|
||||
break if (x > 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
9
test/tint/diagnostic_filtering/loop_body_attribute.wgsl
Normal file
9
test/tint/diagnostic_filtering/loop_body_attribute.wgsl
Normal file
@@ -0,0 +1,9 @@
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
loop @diagnostic(warning, derivative_uniformity) {
|
||||
_ = dpdx(1.0);
|
||||
continuing {
|
||||
break if x > 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
diagnostic_filtering/loop_body_attribute.wgsl:4:9 warning: 'dpdx' must only be called from uniform control flow
|
||||
_ = dpdx(1.0);
|
||||
^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/loop_body_attribute.wgsl:6:7 note: control flow depends on possibly non-uniform value
|
||||
break if x > 0.0;
|
||||
^^^^^
|
||||
|
||||
diagnostic_filtering/loop_body_attribute.wgsl:6:16 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
break if x > 0.0;
|
||||
^
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
while (true) {
|
||||
{
|
||||
if ((x > 0.0f)) { break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
diagnostic_filtering/loop_body_attribute.wgsl:4:9 warning: 'dpdx' must only be called from uniform control flow
|
||||
_ = dpdx(1.0);
|
||||
^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/loop_body_attribute.wgsl:6:7 note: control flow depends on possibly non-uniform value
|
||||
break if x > 0.0;
|
||||
^^^^^
|
||||
|
||||
diagnostic_filtering/loop_body_attribute.wgsl:6:16 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
break if x > 0.0;
|
||||
^
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
while (true) {
|
||||
{
|
||||
if ((x > 0.0f)) { break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
diagnostic_filtering/loop_body_attribute.wgsl:4:9 warning: 'dpdx' must only be called from uniform control flow
|
||||
_ = dpdx(1.0);
|
||||
^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/loop_body_attribute.wgsl:6:7 note: control flow depends on possibly non-uniform value
|
||||
break if x > 0.0;
|
||||
^^^^^
|
||||
|
||||
diagnostic_filtering/loop_body_attribute.wgsl:6:16 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
break if x > 0.0;
|
||||
^
|
||||
|
||||
#version 310 es
|
||||
precision highp float;
|
||||
|
||||
layout(location = 0) in float x_1;
|
||||
void tint_symbol(float x) {
|
||||
while (true) {
|
||||
{
|
||||
if ((x > 0.0f)) { break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
tint_symbol(x_1);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
diagnostic_filtering/loop_body_attribute.wgsl:4:9 warning: 'dpdx' must only be called from uniform control flow
|
||||
_ = dpdx(1.0);
|
||||
^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/loop_body_attribute.wgsl:6:7 note: control flow depends on possibly non-uniform value
|
||||
break if x > 0.0;
|
||||
^^^^^
|
||||
|
||||
diagnostic_filtering/loop_body_attribute.wgsl:6:16 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
break if x > 0.0;
|
||||
^
|
||||
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol_2 {
|
||||
float x [[user(locn0)]];
|
||||
};
|
||||
|
||||
void tint_symbol_inner(float x) {
|
||||
while (true) {
|
||||
{
|
||||
if ((x > 0.0f)) { break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
|
||||
tint_symbol_inner(tint_symbol_1.x);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
diagnostic_filtering/loop_body_attribute.wgsl:4:9 warning: 'dpdx' must only be called from uniform control flow
|
||||
_ = dpdx(1.0);
|
||||
^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/loop_body_attribute.wgsl:6:7 note: control flow depends on possibly non-uniform value
|
||||
break if x > 0.0;
|
||||
^^^^^
|
||||
|
||||
diagnostic_filtering/loop_body_attribute.wgsl:6:16 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
break if x > 0.0;
|
||||
^
|
||||
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 21
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %x_1
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %x_1 "x_1"
|
||||
OpName %main_inner "main_inner"
|
||||
OpName %x "x"
|
||||
OpName %main "main"
|
||||
OpDecorate %x_1 Location 0
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%x_1 = OpVariable %_ptr_Input_float Input
|
||||
%void = OpTypeVoid
|
||||
%4 = OpTypeFunction %void %float
|
||||
%13 = OpConstantNull %float
|
||||
%bool = OpTypeBool
|
||||
%16 = OpTypeFunction %void
|
||||
%main_inner = OpFunction %void None %4
|
||||
%x = OpFunctionParameter %float
|
||||
%8 = OpLabel
|
||||
OpBranch %9
|
||||
%9 = OpLabel
|
||||
OpLoopMerge %10 %11 None
|
||||
OpBranch %12
|
||||
%12 = OpLabel
|
||||
OpBranch %11
|
||||
%11 = OpLabel
|
||||
%14 = OpFOrdGreaterThan %bool %x %13
|
||||
OpBranchConditional %14 %10 %9
|
||||
%10 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %16
|
||||
%18 = OpLabel
|
||||
%20 = OpLoad %float %x_1
|
||||
%19 = OpFunctionCall %void %main_inner %20
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,22 @@
|
||||
diagnostic_filtering/loop_body_attribute.wgsl:4:9 warning: 'dpdx' must only be called from uniform control flow
|
||||
_ = dpdx(1.0);
|
||||
^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/loop_body_attribute.wgsl:6:7 note: control flow depends on possibly non-uniform value
|
||||
break if x > 0.0;
|
||||
^^^^^
|
||||
|
||||
diagnostic_filtering/loop_body_attribute.wgsl:6:16 note: user-defined input 'x' of 'main' may be non-uniform
|
||||
break if x > 0.0;
|
||||
^
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
loop @diagnostic(warning, derivative_uniformity) {
|
||||
_ = dpdx(1.0);
|
||||
|
||||
continuing {
|
||||
break if (x > 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user