mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 01:15:39 +00:00
tint: Support @diagnostic on for loops
Bug: tint:1809 Change-Id: I0c6ce482a6d91ddfbcd3e69938ff09de79823e05 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124101 Reviewed-by: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: James Price <jrprice@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
242e1efc98
commit
ed28de3c53
7
test/tint/diagnostic_filtering/for_loop_attribute.wgsl
Normal file
7
test/tint/diagnostic_filtering/for_loop_attribute.wgsl
Normal file
@@ -0,0 +1,7 @@
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
var v = vec4<f32>(0);
|
||||
@diagnostic(warning, derivative_uniformity)
|
||||
for (; x > v.x && dpdx(1.0) > 0.0; ) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
diagnostic_filtering/for_loop_attribute.wgsl:5:21 warning: 'dpdx' must only be called from uniform control flow
|
||||
for (; x > v.x && dpdx(1.0) > 0.0; ) {
|
||||
^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/for_loop_attribute.wgsl:5:3 note: control flow depends on possibly non-uniform value
|
||||
for (; x > v.x && dpdx(1.0) > 0.0; ) {
|
||||
^^^
|
||||
|
||||
diagnostic_filtering/for_loop_attribute.wgsl:5:21 note: return value of 'dpdx' may be non-uniform
|
||||
for (; x > v.x && dpdx(1.0) > 0.0; ) {
|
||||
^^^^^^^^^
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
float4 v = (0.0f).xxxx;
|
||||
{
|
||||
while (true) {
|
||||
bool tint_tmp = (x > v.x);
|
||||
if (tint_tmp) {
|
||||
tint_tmp = (ddx(1.0f) > 0.0f);
|
||||
}
|
||||
if (!((tint_tmp))) { break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
diagnostic_filtering/for_loop_attribute.wgsl:5:21 warning: 'dpdx' must only be called from uniform control flow
|
||||
for (; x > v.x && dpdx(1.0) > 0.0; ) {
|
||||
^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/for_loop_attribute.wgsl:5:3 note: control flow depends on possibly non-uniform value
|
||||
for (; x > v.x && dpdx(1.0) > 0.0; ) {
|
||||
^^^
|
||||
|
||||
diagnostic_filtering/for_loop_attribute.wgsl:5:21 note: return value of 'dpdx' may be non-uniform
|
||||
for (; x > v.x && dpdx(1.0) > 0.0; ) {
|
||||
^^^^^^^^^
|
||||
|
||||
struct tint_symbol_1 {
|
||||
float x : TEXCOORD0;
|
||||
};
|
||||
|
||||
void main_inner(float x) {
|
||||
float4 v = (0.0f).xxxx;
|
||||
{
|
||||
while (true) {
|
||||
bool tint_tmp = (x > v.x);
|
||||
if (tint_tmp) {
|
||||
tint_tmp = (ddx(1.0f) > 0.0f);
|
||||
}
|
||||
if (!((tint_tmp))) { break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main(tint_symbol_1 tint_symbol) {
|
||||
main_inner(tint_symbol.x);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
diagnostic_filtering/for_loop_attribute.wgsl:5:21 warning: 'dpdx' must only be called from uniform control flow
|
||||
for (; x > v.x && dpdx(1.0) > 0.0; ) {
|
||||
^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/for_loop_attribute.wgsl:5:3 note: control flow depends on possibly non-uniform value
|
||||
for (; x > v.x && dpdx(1.0) > 0.0; ) {
|
||||
^^^
|
||||
|
||||
diagnostic_filtering/for_loop_attribute.wgsl:5:21 note: return value of 'dpdx' may be non-uniform
|
||||
for (; x > v.x && dpdx(1.0) > 0.0; ) {
|
||||
^^^^^^^^^
|
||||
|
||||
#version 310 es
|
||||
precision highp float;
|
||||
|
||||
layout(location = 0) in float x_1;
|
||||
void tint_symbol(float x) {
|
||||
vec4 v = vec4(0.0f);
|
||||
{
|
||||
while (true) {
|
||||
bool tint_tmp = (x > v.x);
|
||||
if (tint_tmp) {
|
||||
tint_tmp = (dFdx(1.0f) > 0.0f);
|
||||
}
|
||||
if (!((tint_tmp))) { break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
tint_symbol(x_1);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
diagnostic_filtering/for_loop_attribute.wgsl:5:21 warning: 'dpdx' must only be called from uniform control flow
|
||||
for (; x > v.x && dpdx(1.0) > 0.0; ) {
|
||||
^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/for_loop_attribute.wgsl:5:3 note: control flow depends on possibly non-uniform value
|
||||
for (; x > v.x && dpdx(1.0) > 0.0; ) {
|
||||
^^^
|
||||
|
||||
diagnostic_filtering/for_loop_attribute.wgsl:5:21 note: return value of 'dpdx' may be non-uniform
|
||||
for (; x > v.x && dpdx(1.0) > 0.0; ) {
|
||||
^^^^^^^^^
|
||||
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol_2 {
|
||||
float x [[user(locn0)]];
|
||||
};
|
||||
|
||||
void tint_symbol_inner(float x) {
|
||||
float4 v = float4(0.0f);
|
||||
for(; ((x > v[0]) && (dfdx(1.0f) > 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,81 @@
|
||||
diagnostic_filtering/for_loop_attribute.wgsl:5:21 warning: 'dpdx' must only be called from uniform control flow
|
||||
for (; x > v.x && dpdx(1.0) > 0.0; ) {
|
||||
^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/for_loop_attribute.wgsl:5:3 note: control flow depends on possibly non-uniform value
|
||||
for (; x > v.x && dpdx(1.0) > 0.0; ) {
|
||||
^^^
|
||||
|
||||
diagnostic_filtering/for_loop_attribute.wgsl:5:21 note: return value of 'dpdx' may be non-uniform
|
||||
for (; x > v.x && dpdx(1.0) > 0.0; ) {
|
||||
^^^^^^^^^
|
||||
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 39
|
||||
; 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 %v "v"
|
||||
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
|
||||
%v4float = OpTypeVector %float 4
|
||||
%10 = 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
|
||||
%float_1 = OpConstant %float 1
|
||||
%29 = OpConstantNull %float
|
||||
%34 = OpTypeFunction %void
|
||||
%main_inner = OpFunction %void None %4
|
||||
%x = OpFunctionParameter %float
|
||||
%8 = OpLabel
|
||||
%v = OpVariable %_ptr_Function_v4float Function %10
|
||||
OpStore %v %10
|
||||
OpBranch %13
|
||||
%13 = OpLabel
|
||||
OpLoopMerge %14 %15 None
|
||||
OpBranch %16
|
||||
%16 = OpLabel
|
||||
%21 = OpAccessChain %_ptr_Function_float %v %uint_0
|
||||
%22 = OpLoad %float %21
|
||||
%23 = OpFOrdGreaterThan %bool %x %22
|
||||
OpSelectionMerge %25 None
|
||||
OpBranchConditional %23 %26 %25
|
||||
%26 = OpLabel
|
||||
%27 = OpDPdx %float %float_1
|
||||
%30 = OpFOrdGreaterThan %bool %27 %29
|
||||
OpBranch %25
|
||||
%25 = OpLabel
|
||||
%31 = OpPhi %bool %23 %16 %30 %26
|
||||
%17 = OpLogicalNot %bool %31
|
||||
OpSelectionMerge %32 None
|
||||
OpBranchConditional %17 %33 %32
|
||||
%33 = OpLabel
|
||||
OpBranch %14
|
||||
%32 = OpLabel
|
||||
OpBranch %15
|
||||
%15 = OpLabel
|
||||
OpBranch %13
|
||||
%14 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %34
|
||||
%36 = OpLabel
|
||||
%38 = OpLoad %float %x_1
|
||||
%37 = OpFunctionCall %void %main_inner %38
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,18 @@
|
||||
diagnostic_filtering/for_loop_attribute.wgsl:5:21 warning: 'dpdx' must only be called from uniform control flow
|
||||
for (; x > v.x && dpdx(1.0) > 0.0; ) {
|
||||
^^^^^^^^^
|
||||
|
||||
diagnostic_filtering/for_loop_attribute.wgsl:5:3 note: control flow depends on possibly non-uniform value
|
||||
for (; x > v.x && dpdx(1.0) > 0.0; ) {
|
||||
^^^
|
||||
|
||||
diagnostic_filtering/for_loop_attribute.wgsl:5:21 note: return value of 'dpdx' may be non-uniform
|
||||
for (; x > v.x && dpdx(1.0) > 0.0; ) {
|
||||
^^^^^^^^^
|
||||
|
||||
@fragment
|
||||
fn main(@location(0) x : f32) {
|
||||
var v = vec4<f32>(0);
|
||||
@diagnostic(warning, derivative_uniformity) for(; ((x > v.x) && (dpdx(1.0) > 0.0)); ) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user