mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 05:27:49 +00:00
tint: Use "demote-to-helper" semantics for discard
Discard statements no longer affect the behavior or uniformity analysis. Update the resolver, validator, and several tests to reflect this. Some E2E tests were removed as they had loops that are now considered to be infinite. Use the DemoteToHelper transform to emulate the correct semantics on platforms where discard is (or may) terminate the invocation in a manner that would affect derivative operations. We no longer need the UnwindDiscardFunctions transform for HLSL, which already implements the correct semantics. However, we still run the DemoteToHelper transform for the HLSL backend due to issues with FXC's handling of discard statements (see crbug.com/tint/1118). Fixed: tint:1723 Change-Id: Ib49ff187919ae81c4af8675e1b66acd57e2ff7d2 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109003 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
78ae4c243b
commit
744d0eb4aa
@@ -1,3 +1,5 @@
|
||||
static bool tint_discarded = false;
|
||||
|
||||
cbuffer cbuffer_uniforms : register(b0, space0) {
|
||||
uint4 uniforms[1];
|
||||
};
|
||||
@@ -45,30 +47,21 @@ struct tint_symbol_5 {
|
||||
float4 value : SV_Target0;
|
||||
};
|
||||
|
||||
static bool tint_discard = false;
|
||||
|
||||
float4 fs_main_inner(float2 texcoord) {
|
||||
float2 clampedTexcoord = clamp(texcoord, (0.0f).xx, (1.0f).xx);
|
||||
if (!(all((clampedTexcoord == texcoord)))) {
|
||||
tint_discard = true;
|
||||
return (0.0f).xxxx;
|
||||
tint_discarded = true;
|
||||
}
|
||||
float4 srcColor = (0.0f).xxxx;
|
||||
return srcColor;
|
||||
}
|
||||
|
||||
void tint_discard_func() {
|
||||
discard;
|
||||
}
|
||||
|
||||
tint_symbol_5 fs_main(tint_symbol_4 tint_symbol_3) {
|
||||
const float4 inner_result_1 = fs_main_inner(tint_symbol_3.texcoord);
|
||||
if (tint_discard) {
|
||||
tint_discard_func();
|
||||
const tint_symbol_5 tint_symbol_8 = (tint_symbol_5)0;
|
||||
return tint_symbol_8;
|
||||
}
|
||||
tint_symbol_5 wrapper_result_1 = (tint_symbol_5)0;
|
||||
wrapper_result_1.value = inner_result_1;
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return wrapper_result_1;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
static bool tint_discarded = false;
|
||||
|
||||
cbuffer cbuffer_uniforms : register(b0, space0) {
|
||||
uint4 uniforms[1];
|
||||
};
|
||||
@@ -45,30 +47,21 @@ struct tint_symbol_5 {
|
||||
float4 value : SV_Target0;
|
||||
};
|
||||
|
||||
static bool tint_discard = false;
|
||||
|
||||
float4 fs_main_inner(float2 texcoord) {
|
||||
float2 clampedTexcoord = clamp(texcoord, (0.0f).xx, (1.0f).xx);
|
||||
if (!(all((clampedTexcoord == texcoord)))) {
|
||||
tint_discard = true;
|
||||
return (0.0f).xxxx;
|
||||
tint_discarded = true;
|
||||
}
|
||||
float4 srcColor = (0.0f).xxxx;
|
||||
return srcColor;
|
||||
}
|
||||
|
||||
void tint_discard_func() {
|
||||
discard;
|
||||
}
|
||||
|
||||
tint_symbol_5 fs_main(tint_symbol_4 tint_symbol_3) {
|
||||
const float4 inner_result_1 = fs_main_inner(tint_symbol_3.texcoord);
|
||||
if (tint_discard) {
|
||||
tint_discard_func();
|
||||
const tint_symbol_5 tint_symbol_8 = (tint_symbol_5)0;
|
||||
return tint_symbol_8;
|
||||
}
|
||||
tint_symbol_5 wrapper_result_1 = (tint_symbol_5)0;
|
||||
wrapper_result_1.value = inner_result_1;
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return wrapper_result_1;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ void main() {
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
bool tint_discarded = false;
|
||||
layout(location = 0) in vec2 texcoord_1;
|
||||
layout(location = 0) out vec4 value;
|
||||
struct Uniforms {
|
||||
@@ -52,27 +53,20 @@ struct VertexOutputs {
|
||||
vec4 position;
|
||||
};
|
||||
|
||||
bool tint_discard = false;
|
||||
vec4 fs_main(vec2 texcoord) {
|
||||
vec2 clampedTexcoord = clamp(texcoord, vec2(0.0f), vec2(1.0f));
|
||||
if (!(all(equal(clampedTexcoord, texcoord)))) {
|
||||
tint_discard = true;
|
||||
return vec4(0.0f);
|
||||
tint_discarded = true;
|
||||
}
|
||||
vec4 srcColor = vec4(0.0f);
|
||||
return srcColor;
|
||||
}
|
||||
|
||||
void tint_discard_func() {
|
||||
discard;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 inner_result = fs_main(texcoord_1);
|
||||
if (tint_discard) {
|
||||
tint_discard_func();
|
||||
return;
|
||||
}
|
||||
value = inner_result;
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,21 +29,21 @@ struct tint_symbol {
|
||||
float4 position [[position]];
|
||||
};
|
||||
|
||||
VertexOutputs vs_main_inner(uint VertexIndex, const constant Uniforms* const tint_symbol_5) {
|
||||
VertexOutputs vs_main_inner(uint VertexIndex, const constant Uniforms* const tint_symbol_4) {
|
||||
tint_array<float2, 3> texcoord = tint_array<float2, 3>{float2(-0.5f, 0.0f), float2(1.5f, 0.0f), float2(0.5f, 2.0f)};
|
||||
VertexOutputs output = {};
|
||||
output.position = float4(((texcoord[VertexIndex] * 2.0f) - float2(1.0f)), 0.0f, 1.0f);
|
||||
bool flipY = ((*(tint_symbol_5)).u_scale[1] < 0.0f);
|
||||
bool flipY = ((*(tint_symbol_4)).u_scale[1] < 0.0f);
|
||||
if (flipY) {
|
||||
output.texcoords = ((((texcoord[VertexIndex] * (*(tint_symbol_5)).u_scale) + (*(tint_symbol_5)).u_offset) * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f));
|
||||
output.texcoords = ((((texcoord[VertexIndex] * (*(tint_symbol_4)).u_scale) + (*(tint_symbol_4)).u_offset) * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f));
|
||||
} else {
|
||||
output.texcoords = ((((texcoord[VertexIndex] * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f)) * (*(tint_symbol_5)).u_scale) + (*(tint_symbol_5)).u_offset);
|
||||
output.texcoords = ((((texcoord[VertexIndex] * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f)) * (*(tint_symbol_4)).u_scale) + (*(tint_symbol_4)).u_offset);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
vertex tint_symbol vs_main(const constant Uniforms* tint_symbol_6 [[buffer(0)]], uint VertexIndex [[vertex_id]]) {
|
||||
VertexOutputs const inner_result = vs_main_inner(VertexIndex, tint_symbol_6);
|
||||
vertex tint_symbol vs_main(const constant Uniforms* tint_symbol_5 [[buffer(0)]], uint VertexIndex [[vertex_id]]) {
|
||||
VertexOutputs const inner_result = vs_main_inner(VertexIndex, tint_symbol_5);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.texcoords = inner_result.texcoords;
|
||||
wrapper_result.position = inner_result.position;
|
||||
@@ -58,30 +58,23 @@ struct tint_symbol_3 {
|
||||
float4 value [[color(0)]];
|
||||
};
|
||||
|
||||
float4 fs_main_inner(float2 texcoord, thread bool* const tint_symbol_7) {
|
||||
float4 fs_main_inner(float2 texcoord, thread bool* const tint_symbol_6) {
|
||||
float2 clampedTexcoord = clamp(texcoord, float2(0.0f), float2(1.0f));
|
||||
if (!(all((clampedTexcoord == texcoord)))) {
|
||||
*(tint_symbol_7) = true;
|
||||
return float4(0.0f);
|
||||
*(tint_symbol_6) = true;
|
||||
}
|
||||
float4 srcColor = float4(0.0f);
|
||||
return srcColor;
|
||||
}
|
||||
|
||||
void tint_discard_func() {
|
||||
discard_fragment();
|
||||
}
|
||||
|
||||
fragment tint_symbol_3 fs_main(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
|
||||
thread bool tint_symbol_8 = false;
|
||||
float4 const inner_result_1 = fs_main_inner(tint_symbol_1.texcoord, &(tint_symbol_8));
|
||||
if (tint_symbol_8) {
|
||||
tint_discard_func();
|
||||
tint_symbol_3 const tint_symbol_4 = tint_symbol_3{};
|
||||
return tint_symbol_4;
|
||||
}
|
||||
thread bool tint_symbol_7 = false;
|
||||
float4 const inner_result_1 = fs_main_inner(tint_symbol_1.texcoord, &(tint_symbol_7));
|
||||
tint_symbol_3 wrapper_result_1 = {};
|
||||
wrapper_result_1.value = inner_result_1;
|
||||
if (tint_symbol_7) {
|
||||
discard_fragment();
|
||||
}
|
||||
return wrapper_result_1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 134
|
||||
; Bound: 137
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%118 = OpExtInstImport "GLSL.std.450"
|
||||
@@ -9,6 +9,7 @@
|
||||
OpEntryPoint Vertex %vs_main "vs_main" %VertexIndex_1 %texcoords_1 %position_1 %vertex_point_size
|
||||
OpEntryPoint Fragment %fs_main "fs_main" %texcoord_1 %value
|
||||
OpExecutionMode %fs_main OriginUpperLeft
|
||||
OpName %tint_discarded "tint_discarded"
|
||||
OpName %VertexIndex_1 "VertexIndex_1"
|
||||
OpName %texcoords_1 "texcoords_1"
|
||||
OpName %position_1 "position_1"
|
||||
@@ -32,7 +33,6 @@
|
||||
OpName %output "output"
|
||||
OpName %flipY "flipY"
|
||||
OpName %vs_main "vs_main"
|
||||
OpName %tint_discard_func "tint_discard_func"
|
||||
OpName %fs_main_inner "fs_main_inner"
|
||||
OpName %texcoord_0 "texcoord"
|
||||
OpName %clampedTexcoord "clampedTexcoord"
|
||||
@@ -58,144 +58,143 @@
|
||||
OpMemberDecorate %VertexOutputs 0 Offset 0
|
||||
OpMemberDecorate %VertexOutputs 1 Offset 16
|
||||
OpDecorate %_arr_v2float_uint_3 ArrayStride 8
|
||||
%bool = OpTypeBool
|
||||
%2 = OpConstantNull %bool
|
||||
%_ptr_Private_bool = OpTypePointer Private %bool
|
||||
%tint_discarded = OpVariable %_ptr_Private_bool Private %2
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%VertexIndex_1 = OpVariable %_ptr_Input_uint Input
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Output_v2float = OpTypePointer Output %v2float
|
||||
%8 = OpConstantNull %v2float
|
||||
%texcoords_1 = OpVariable %_ptr_Output_v2float Output %8
|
||||
%12 = OpConstantNull %v2float
|
||||
%texcoords_1 = OpVariable %_ptr_Output_v2float Output %12
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%12 = OpConstantNull %v4float
|
||||
%position_1 = OpVariable %_ptr_Output_v4float Output %12
|
||||
%16 = OpConstantNull %v4float
|
||||
%position_1 = OpVariable %_ptr_Output_v4float Output %16
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%15 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %15
|
||||
%19 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %19
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%texcoord_1 = OpVariable %_ptr_Input_v2float Input
|
||||
%value = OpVariable %_ptr_Output_v4float Output %12
|
||||
%value = OpVariable %_ptr_Output_v4float Output %16
|
||||
%Uniforms = OpTypeStruct %v2float %v2float
|
||||
%uniforms_block = OpTypeStruct %Uniforms
|
||||
%_ptr_Uniform_uniforms_block = OpTypePointer Uniform %uniforms_block
|
||||
%uniforms = OpVariable %_ptr_Uniform_uniforms_block Uniform
|
||||
%25 = OpTypeSampler
|
||||
%_ptr_UniformConstant_25 = OpTypePointer UniformConstant %25
|
||||
%mySampler = OpVariable %_ptr_UniformConstant_25 UniformConstant
|
||||
%28 = OpTypeImage %float 2D 0 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_28 = OpTypePointer UniformConstant %28
|
||||
%myTexture = OpVariable %_ptr_UniformConstant_28 UniformConstant
|
||||
%29 = OpTypeSampler
|
||||
%_ptr_UniformConstant_29 = OpTypePointer UniformConstant %29
|
||||
%mySampler = OpVariable %_ptr_UniformConstant_29 UniformConstant
|
||||
%32 = OpTypeImage %float 2D 0 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_32 = OpTypePointer UniformConstant %32
|
||||
%myTexture = OpVariable %_ptr_UniformConstant_32 UniformConstant
|
||||
%VertexOutputs = OpTypeStruct %v2float %v4float
|
||||
%29 = OpTypeFunction %VertexOutputs %uint
|
||||
%33 = OpTypeFunction %VertexOutputs %uint
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3
|
||||
%float_n0_5 = OpConstant %float -0.5
|
||||
%37 = OpConstantComposite %v2float %float_n0_5 %15
|
||||
%41 = OpConstantComposite %v2float %float_n0_5 %19
|
||||
%float_1_5 = OpConstant %float 1.5
|
||||
%39 = OpConstantComposite %v2float %float_1_5 %15
|
||||
%43 = OpConstantComposite %v2float %float_1_5 %19
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%float_2 = OpConstant %float 2
|
||||
%42 = OpConstantComposite %v2float %float_0_5 %float_2
|
||||
%43 = OpConstantComposite %_arr_v2float_uint_3 %37 %39 %42
|
||||
%46 = OpConstantComposite %v2float %float_0_5 %float_2
|
||||
%47 = OpConstantComposite %_arr_v2float_uint_3 %41 %43 %46
|
||||
%_ptr_Function__arr_v2float_uint_3 = OpTypePointer Function %_arr_v2float_uint_3
|
||||
%46 = OpConstantNull %_arr_v2float_uint_3
|
||||
%50 = OpConstantNull %_arr_v2float_uint_3
|
||||
%_ptr_Function_VertexOutputs = OpTypePointer Function %VertexOutputs
|
||||
%49 = OpConstantNull %VertexOutputs
|
||||
%53 = OpConstantNull %VertexOutputs
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%float_1 = OpConstant %float 1
|
||||
%58 = OpConstantComposite %v2float %float_1 %float_1
|
||||
%62 = OpConstantComposite %v2float %float_1 %float_1
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Function_bool = OpTypePointer Function %bool
|
||||
%71 = OpConstantNull %bool
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%float_n1 = OpConstant %float -1
|
||||
%87 = OpConstantComposite %v2float %float_1 %float_n1
|
||||
%89 = OpConstantComposite %v2float %15 %float_1
|
||||
%89 = OpConstantComposite %v2float %float_1 %float_n1
|
||||
%91 = OpConstantComposite %v2float %19 %float_1
|
||||
%void = OpTypeVoid
|
||||
%103 = OpTypeFunction %void
|
||||
%105 = OpTypeFunction %void
|
||||
%113 = OpTypeFunction %v4float %v2float
|
||||
%v2bool = OpTypeVector %bool 2
|
||||
%vs_main_inner = OpFunction %VertexOutputs None %29
|
||||
%true = OpConstantTrue %bool
|
||||
%vs_main_inner = OpFunction %VertexOutputs None %33
|
||||
%VertexIndex = OpFunctionParameter %uint
|
||||
%33 = OpLabel
|
||||
%texcoord = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %46
|
||||
%output = OpVariable %_ptr_Function_VertexOutputs Function %49
|
||||
%flipY = OpVariable %_ptr_Function_bool Function %71
|
||||
OpStore %texcoord %43
|
||||
%52 = OpAccessChain %_ptr_Function_v4float %output %uint_1
|
||||
%54 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex
|
||||
%55 = OpLoad %v2float %54
|
||||
%56 = OpVectorTimesScalar %v2float %55 %float_2
|
||||
%59 = OpFSub %v2float %56 %58
|
||||
%60 = OpCompositeExtract %float %59 0
|
||||
%61 = OpCompositeExtract %float %59 1
|
||||
%62 = OpCompositeConstruct %v4float %60 %61 %15 %float_1
|
||||
OpStore %52 %62
|
||||
%65 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_0 %uint_1
|
||||
%66 = OpLoad %float %65
|
||||
%67 = OpFOrdLessThan %bool %66 %15
|
||||
OpStore %flipY %67
|
||||
%72 = OpLoad %bool %flipY
|
||||
OpSelectionMerge %73 None
|
||||
OpBranchConditional %72 %74 %75
|
||||
%74 = OpLabel
|
||||
%76 = OpAccessChain %_ptr_Function_v2float %output %uint_0
|
||||
%77 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex
|
||||
%78 = OpLoad %v2float %77
|
||||
%80 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 %uint_0
|
||||
%81 = OpLoad %v2float %80
|
||||
%82 = OpFMul %v2float %78 %81
|
||||
%83 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 %uint_1
|
||||
%84 = OpLoad %v2float %83
|
||||
%85 = OpFAdd %v2float %82 %84
|
||||
%88 = OpFMul %v2float %85 %87
|
||||
%90 = OpFAdd %v2float %88 %89
|
||||
OpStore %76 %90
|
||||
OpBranch %73
|
||||
%37 = OpLabel
|
||||
%texcoord = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %50
|
||||
%output = OpVariable %_ptr_Function_VertexOutputs Function %53
|
||||
%flipY = OpVariable %_ptr_Function_bool Function %2
|
||||
OpStore %texcoord %47
|
||||
%56 = OpAccessChain %_ptr_Function_v4float %output %uint_1
|
||||
%58 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex
|
||||
%59 = OpLoad %v2float %58
|
||||
%60 = OpVectorTimesScalar %v2float %59 %float_2
|
||||
%63 = OpFSub %v2float %60 %62
|
||||
%64 = OpCompositeExtract %float %63 0
|
||||
%65 = OpCompositeExtract %float %63 1
|
||||
%66 = OpCompositeConstruct %v4float %64 %65 %19 %float_1
|
||||
OpStore %56 %66
|
||||
%69 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_0 %uint_1
|
||||
%70 = OpLoad %float %69
|
||||
%71 = OpFOrdLessThan %bool %70 %19
|
||||
OpStore %flipY %71
|
||||
%74 = OpLoad %bool %flipY
|
||||
OpSelectionMerge %75 None
|
||||
OpBranchConditional %74 %76 %77
|
||||
%76 = OpLabel
|
||||
%78 = OpAccessChain %_ptr_Function_v2float %output %uint_0
|
||||
%79 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex
|
||||
%80 = OpLoad %v2float %79
|
||||
%82 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 %uint_0
|
||||
%83 = OpLoad %v2float %82
|
||||
%84 = OpFMul %v2float %80 %83
|
||||
%85 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 %uint_1
|
||||
%86 = OpLoad %v2float %85
|
||||
%87 = OpFAdd %v2float %84 %86
|
||||
%90 = OpFMul %v2float %87 %89
|
||||
%92 = OpFAdd %v2float %90 %91
|
||||
OpStore %78 %92
|
||||
OpBranch %75
|
||||
%77 = OpLabel
|
||||
%93 = OpAccessChain %_ptr_Function_v2float %output %uint_0
|
||||
%94 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex
|
||||
%95 = OpLoad %v2float %94
|
||||
%96 = OpFMul %v2float %95 %89
|
||||
%97 = OpFAdd %v2float %96 %91
|
||||
%98 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 %uint_0
|
||||
%99 = OpLoad %v2float %98
|
||||
%100 = OpFMul %v2float %97 %99
|
||||
%101 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 %uint_1
|
||||
%102 = OpLoad %v2float %101
|
||||
%103 = OpFAdd %v2float %100 %102
|
||||
OpStore %93 %103
|
||||
OpBranch %75
|
||||
%75 = OpLabel
|
||||
%91 = OpAccessChain %_ptr_Function_v2float %output %uint_0
|
||||
%92 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex
|
||||
%93 = OpLoad %v2float %92
|
||||
%94 = OpFMul %v2float %93 %87
|
||||
%95 = OpFAdd %v2float %94 %89
|
||||
%96 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 %uint_0
|
||||
%97 = OpLoad %v2float %96
|
||||
%98 = OpFMul %v2float %95 %97
|
||||
%99 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0 %uint_1
|
||||
%100 = OpLoad %v2float %99
|
||||
%101 = OpFAdd %v2float %98 %100
|
||||
OpStore %91 %101
|
||||
OpBranch %73
|
||||
%73 = OpLabel
|
||||
%102 = OpLoad %VertexOutputs %output
|
||||
OpReturnValue %102
|
||||
%104 = OpLoad %VertexOutputs %output
|
||||
OpReturnValue %104
|
||||
OpFunctionEnd
|
||||
%vs_main = OpFunction %void None %103
|
||||
%106 = OpLabel
|
||||
%108 = OpLoad %uint %VertexIndex_1
|
||||
%107 = OpFunctionCall %VertexOutputs %vs_main_inner %108
|
||||
%109 = OpCompositeExtract %v2float %107 0
|
||||
OpStore %texcoords_1 %109
|
||||
%110 = OpCompositeExtract %v4float %107 1
|
||||
OpStore %position_1 %110
|
||||
%vs_main = OpFunction %void None %105
|
||||
%108 = OpLabel
|
||||
%110 = OpLoad %uint %VertexIndex_1
|
||||
%109 = OpFunctionCall %VertexOutputs %vs_main_inner %110
|
||||
%111 = OpCompositeExtract %v2float %109 0
|
||||
OpStore %texcoords_1 %111
|
||||
%112 = OpCompositeExtract %v4float %109 1
|
||||
OpStore %position_1 %112
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_discard_func = OpFunction %void None %103
|
||||
%112 = OpLabel
|
||||
OpKill
|
||||
OpFunctionEnd
|
||||
%fs_main_inner = OpFunction %v4float None %113
|
||||
%texcoord_0 = OpFunctionParameter %v2float
|
||||
%116 = OpLabel
|
||||
%clampedTexcoord = OpVariable %_ptr_Function_v2float Function %8
|
||||
%srcColor = OpVariable %_ptr_Function_v4float Function %12
|
||||
%117 = OpExtInst %v2float %118 NClamp %texcoord_0 %8 %58
|
||||
%clampedTexcoord = OpVariable %_ptr_Function_v2float Function %12
|
||||
%srcColor = OpVariable %_ptr_Function_v4float Function %16
|
||||
%117 = OpExtInst %v2float %118 NClamp %texcoord_0 %12 %62
|
||||
OpStore %clampedTexcoord %117
|
||||
%122 = OpLoad %v2float %clampedTexcoord
|
||||
%123 = OpFOrdEqual %v2bool %122 %texcoord_0
|
||||
@@ -204,17 +203,23 @@
|
||||
OpSelectionMerge %125 None
|
||||
OpBranchConditional %120 %126 %125
|
||||
%126 = OpLabel
|
||||
%127 = OpFunctionCall %void %tint_discard_func
|
||||
OpReturnValue %12
|
||||
OpStore %tint_discarded %true
|
||||
OpBranch %125
|
||||
%125 = OpLabel
|
||||
OpStore %srcColor %12
|
||||
OpStore %srcColor %16
|
||||
%129 = OpLoad %v4float %srcColor
|
||||
OpReturnValue %129
|
||||
OpFunctionEnd
|
||||
%fs_main = OpFunction %void None %103
|
||||
%fs_main = OpFunction %void None %105
|
||||
%131 = OpLabel
|
||||
%133 = OpLoad %v2float %texcoord_1
|
||||
%132 = OpFunctionCall %v4float %fs_main_inner %133
|
||||
OpStore %value %132
|
||||
%134 = OpLoad %bool %tint_discarded
|
||||
OpSelectionMerge %135 None
|
||||
OpBranchConditional %134 %136 %135
|
||||
%136 = OpLabel
|
||||
OpKill
|
||||
%135 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
static bool tint_discard = false;
|
||||
static bool tint_discarded = false;
|
||||
|
||||
int f(int x) {
|
||||
if ((x == 10)) {
|
||||
tint_discard = true;
|
||||
return 0;
|
||||
tint_discarded = true;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
@@ -19,9 +18,6 @@ int main_inner(int3 x) {
|
||||
int y = x.x;
|
||||
while (true) {
|
||||
const int r = f(y);
|
||||
if (tint_discard) {
|
||||
return 0;
|
||||
}
|
||||
if ((r == 0)) {
|
||||
break;
|
||||
}
|
||||
@@ -29,18 +25,12 @@ int main_inner(int3 x) {
|
||||
return y;
|
||||
}
|
||||
|
||||
void tint_discard_func() {
|
||||
discard;
|
||||
}
|
||||
|
||||
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
||||
const int inner_result = main_inner(tint_symbol.x);
|
||||
if (tint_discard) {
|
||||
tint_discard_func();
|
||||
const tint_symbol_2 tint_symbol_3 = (tint_symbol_2)0;
|
||||
return tint_symbol_3;
|
||||
}
|
||||
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
|
||||
wrapper_result.value = inner_result;
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
static bool tint_discard = false;
|
||||
static bool tint_discarded = false;
|
||||
|
||||
int f(int x) {
|
||||
if ((x == 10)) {
|
||||
tint_discard = true;
|
||||
return 0;
|
||||
tint_discarded = true;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
@@ -19,9 +18,6 @@ int main_inner(int3 x) {
|
||||
int y = x.x;
|
||||
while (true) {
|
||||
const int r = f(y);
|
||||
if (tint_discard) {
|
||||
return 0;
|
||||
}
|
||||
if ((r == 0)) {
|
||||
break;
|
||||
}
|
||||
@@ -29,18 +25,12 @@ int main_inner(int3 x) {
|
||||
return y;
|
||||
}
|
||||
|
||||
void tint_discard_func() {
|
||||
discard;
|
||||
}
|
||||
|
||||
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
||||
const int inner_result = main_inner(tint_symbol.x);
|
||||
if (tint_discard) {
|
||||
tint_discard_func();
|
||||
const tint_symbol_2 tint_symbol_3 = (tint_symbol_2)0;
|
||||
return tint_symbol_3;
|
||||
}
|
||||
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
|
||||
wrapper_result.value = inner_result;
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
bool tint_discarded = false;
|
||||
layout(location = 1) flat in ivec3 x_1;
|
||||
layout(location = 2) out int value;
|
||||
bool tint_discard = false;
|
||||
int f(int x) {
|
||||
if ((x == 10)) {
|
||||
tint_discard = true;
|
||||
return 0;
|
||||
tint_discarded = true;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
@@ -16,9 +15,6 @@ int tint_symbol(ivec3 x) {
|
||||
int y = x.x;
|
||||
while (true) {
|
||||
int r = f(y);
|
||||
if (tint_discard) {
|
||||
return 0;
|
||||
}
|
||||
if ((r == 0)) {
|
||||
break;
|
||||
}
|
||||
@@ -26,16 +22,11 @@ int tint_symbol(ivec3 x) {
|
||||
return y;
|
||||
}
|
||||
|
||||
void tint_discard_func() {
|
||||
discard;
|
||||
}
|
||||
|
||||
void main() {
|
||||
int inner_result = tint_symbol(x_1);
|
||||
if (tint_discard) {
|
||||
tint_discard_func();
|
||||
return;
|
||||
}
|
||||
value = inner_result;
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
int f(int x, thread bool* const tint_symbol_5) {
|
||||
int f(int x, thread bool* const tint_symbol_4) {
|
||||
if ((x == 10)) {
|
||||
*(tint_symbol_5) = true;
|
||||
return 0;
|
||||
*(tint_symbol_4) = true;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
@@ -17,13 +16,10 @@ struct tint_symbol_3 {
|
||||
int value [[color(2)]];
|
||||
};
|
||||
|
||||
int tint_symbol_inner(int3 x, thread bool* const tint_symbol_6) {
|
||||
int tint_symbol_inner(int3 x, thread bool* const tint_symbol_5) {
|
||||
int y = x[0];
|
||||
while (true) {
|
||||
int const r = f(y, tint_symbol_6);
|
||||
if (*(tint_symbol_6)) {
|
||||
return 0;
|
||||
}
|
||||
int const r = f(y, tint_symbol_5);
|
||||
if ((r == 0)) {
|
||||
break;
|
||||
}
|
||||
@@ -31,20 +27,14 @@ int tint_symbol_inner(int3 x, thread bool* const tint_symbol_6) {
|
||||
return y;
|
||||
}
|
||||
|
||||
void tint_discard_func() {
|
||||
discard_fragment();
|
||||
}
|
||||
|
||||
fragment tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
|
||||
thread bool tint_symbol_7 = false;
|
||||
int const inner_result = tint_symbol_inner(tint_symbol_1.x, &(tint_symbol_7));
|
||||
if (tint_symbol_7) {
|
||||
tint_discard_func();
|
||||
tint_symbol_3 const tint_symbol_4 = tint_symbol_3{};
|
||||
return tint_symbol_4;
|
||||
}
|
||||
thread bool tint_symbol_6 = false;
|
||||
int const inner_result = tint_symbol_inner(tint_symbol_1.x, &(tint_symbol_6));
|
||||
tint_symbol_3 wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
if (tint_symbol_6) {
|
||||
discard_fragment();
|
||||
}
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 58
|
||||
; Bound: 47
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %x_1 %value
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %tint_discarded "tint_discarded"
|
||||
OpName %x_1 "x_1"
|
||||
OpName %value "value"
|
||||
OpName %tint_discard "tint_discard"
|
||||
OpName %f "f"
|
||||
OpName %x "x"
|
||||
OpName %tint_return_flag "tint_return_flag"
|
||||
OpName %tint_return_value "tint_return_value"
|
||||
OpName %tint_discard_func "tint_discard_func"
|
||||
OpName %main_inner "main_inner"
|
||||
OpName %x_0 "x"
|
||||
OpName %y "y"
|
||||
@@ -22,92 +19,72 @@
|
||||
OpDecorate %x_1 Location 1
|
||||
OpDecorate %x_1 Flat
|
||||
OpDecorate %value Location 2
|
||||
%bool = OpTypeBool
|
||||
%2 = OpConstantNull %bool
|
||||
%_ptr_Private_bool = OpTypePointer Private %bool
|
||||
%tint_discarded = OpVariable %_ptr_Private_bool Private %2
|
||||
%int = OpTypeInt 32 1
|
||||
%v3int = OpTypeVector %int 3
|
||||
%_ptr_Input_v3int = OpTypePointer Input %v3int
|
||||
%x_1 = OpVariable %_ptr_Input_v3int Input
|
||||
%_ptr_Output_int = OpTypePointer Output %int
|
||||
%7 = OpConstantNull %int
|
||||
%value = OpVariable %_ptr_Output_int Output %7
|
||||
%bool = OpTypeBool
|
||||
%9 = OpConstantNull %bool
|
||||
%_ptr_Private_bool = OpTypePointer Private %bool
|
||||
%tint_discard = OpVariable %_ptr_Private_bool Private %9
|
||||
%11 = OpConstantNull %int
|
||||
%value = OpVariable %_ptr_Output_int Output %11
|
||||
%12 = OpTypeFunction %int %int
|
||||
%_ptr_Function_bool = OpTypePointer Function %bool
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_10 = OpConstant %int 10
|
||||
%true = OpConstantTrue %bool
|
||||
%21 = OpTypeFunction %int %v3int
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%void = OpTypeVoid
|
||||
%30 = OpTypeFunction %void
|
||||
%34 = OpTypeFunction %int %v3int
|
||||
%38 = OpTypeFunction %void
|
||||
%f = OpFunction %int None %12
|
||||
%x = OpFunctionParameter %int
|
||||
%15 = OpLabel
|
||||
%tint_return_flag = OpVariable %_ptr_Function_bool Function %9
|
||||
%tint_return_value = OpVariable %_ptr_Function_int Function %7
|
||||
%21 = OpIEqual %bool %x %int_10
|
||||
OpSelectionMerge %22 None
|
||||
OpBranchConditional %21 %23 %22
|
||||
%23 = OpLabel
|
||||
OpStore %tint_discard %true
|
||||
OpStore %tint_return_flag %true
|
||||
OpStore %tint_return_value %7
|
||||
OpBranch %22
|
||||
%22 = OpLabel
|
||||
%26 = OpLoad %bool %tint_return_flag
|
||||
%25 = OpLogicalNot %bool %26
|
||||
OpSelectionMerge %27 None
|
||||
OpBranchConditional %25 %28 %27
|
||||
%28 = OpLabel
|
||||
OpStore %tint_return_flag %true
|
||||
OpStore %tint_return_value %x
|
||||
OpBranch %27
|
||||
%27 = OpLabel
|
||||
%29 = OpLoad %int %tint_return_value
|
||||
OpReturnValue %29
|
||||
%17 = OpIEqual %bool %x %int_10
|
||||
OpSelectionMerge %18 None
|
||||
OpBranchConditional %17 %19 %18
|
||||
%19 = OpLabel
|
||||
OpStore %tint_discarded %true
|
||||
OpBranch %18
|
||||
%18 = OpLabel
|
||||
OpReturnValue %x
|
||||
OpFunctionEnd
|
||||
%tint_discard_func = OpFunction %void None %30
|
||||
%33 = OpLabel
|
||||
OpKill
|
||||
OpFunctionEnd
|
||||
%main_inner = OpFunction %int None %34
|
||||
%main_inner = OpFunction %int None %21
|
||||
%x_0 = OpFunctionParameter %v3int
|
||||
%37 = OpLabel
|
||||
%y = OpVariable %_ptr_Function_int Function %7
|
||||
%38 = OpCompositeExtract %int %x_0 0
|
||||
OpStore %y %38
|
||||
OpBranch %40
|
||||
%40 = OpLabel
|
||||
OpLoopMerge %41 %42 None
|
||||
OpBranch %43
|
||||
%43 = OpLabel
|
||||
%45 = OpLoad %int %y
|
||||
%44 = OpFunctionCall %int %f %45
|
||||
%46 = OpLoad %bool %tint_discard
|
||||
OpSelectionMerge %47 None
|
||||
OpBranchConditional %46 %48 %47
|
||||
%48 = OpLabel
|
||||
%49 = OpFunctionCall %void %tint_discard_func
|
||||
OpReturnValue %7
|
||||
%47 = OpLabel
|
||||
%50 = OpIEqual %bool %44 %7
|
||||
OpSelectionMerge %51 None
|
||||
OpBranchConditional %50 %52 %51
|
||||
%52 = OpLabel
|
||||
OpBranch %41
|
||||
%51 = OpLabel
|
||||
OpBranch %42
|
||||
%42 = OpLabel
|
||||
OpBranch %40
|
||||
%41 = OpLabel
|
||||
%53 = OpLoad %int %y
|
||||
OpReturnValue %53
|
||||
%24 = OpLabel
|
||||
%y = OpVariable %_ptr_Function_int Function %11
|
||||
%25 = OpCompositeExtract %int %x_0 0
|
||||
OpStore %y %25
|
||||
OpBranch %28
|
||||
%28 = OpLabel
|
||||
OpLoopMerge %29 %30 None
|
||||
OpBranch %31
|
||||
%31 = OpLabel
|
||||
%33 = OpLoad %int %y
|
||||
%32 = OpFunctionCall %int %f %33
|
||||
%34 = OpIEqual %bool %32 %11
|
||||
OpSelectionMerge %35 None
|
||||
OpBranchConditional %34 %36 %35
|
||||
%36 = OpLabel
|
||||
OpBranch %29
|
||||
%35 = OpLabel
|
||||
OpBranch %30
|
||||
%30 = OpLabel
|
||||
OpBranch %28
|
||||
%29 = OpLabel
|
||||
%37 = OpLoad %int %y
|
||||
OpReturnValue %37
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %30
|
||||
%55 = OpLabel
|
||||
%57 = OpLoad %v3int %x_1
|
||||
%56 = OpFunctionCall %int %main_inner %57
|
||||
OpStore %value %56
|
||||
%main = OpFunction %void None %38
|
||||
%41 = OpLabel
|
||||
%43 = OpLoad %v3int %x_1
|
||||
%42 = OpFunctionCall %int %main_inner %43
|
||||
OpStore %value %42
|
||||
%44 = OpLoad %bool %tint_discarded
|
||||
OpSelectionMerge %45 None
|
||||
OpBranchConditional %44 %46 %45
|
||||
%46 = OpLabel
|
||||
OpKill
|
||||
%45 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
static bool tint_discarded = false;
|
||||
|
||||
static float fClipDistance3 = 0.0f;
|
||||
static float fClipDistance4 = 0.0f;
|
||||
cbuffer cbuffer_x_29 : register(b0, space0) {
|
||||
@@ -10,7 +12,6 @@ cbuffer cbuffer_x_137 : register(b2, space0) {
|
||||
uint4 x_137[1];
|
||||
};
|
||||
static float4 glFragColor = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
static bool tint_discard = false;
|
||||
|
||||
void main_1() {
|
||||
float3 viewDirectionW = float3(0.0f, 0.0f, 0.0f);
|
||||
@@ -31,13 +32,11 @@ void main_1() {
|
||||
float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
const float x_9 = fClipDistance3;
|
||||
if ((x_9 > 0.0f)) {
|
||||
tint_discard = true;
|
||||
return;
|
||||
tint_discarded = true;
|
||||
}
|
||||
const float x_17 = fClipDistance4;
|
||||
if ((x_17 > 0.0f)) {
|
||||
tint_discard = true;
|
||||
return;
|
||||
tint_discarded = true;
|
||||
}
|
||||
const float4 x_34 = asfloat(x_29[0]);
|
||||
const float3 x_38 = (0.0f).xxx;
|
||||
@@ -105,26 +104,16 @@ main_out main_inner(float fClipDistance3_param, float fClipDistance4_param) {
|
||||
fClipDistance3 = fClipDistance3_param;
|
||||
fClipDistance4 = fClipDistance4_param;
|
||||
main_1();
|
||||
if (tint_discard) {
|
||||
const main_out tint_symbol_8 = (main_out)0;
|
||||
return tint_symbol_8;
|
||||
}
|
||||
const main_out tint_symbol_9 = {glFragColor};
|
||||
return tint_symbol_9;
|
||||
}
|
||||
|
||||
void tint_discard_func() {
|
||||
discard;
|
||||
const main_out tint_symbol_8 = {glFragColor};
|
||||
return tint_symbol_8;
|
||||
}
|
||||
|
||||
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
||||
const main_out inner_result = main_inner(tint_symbol.fClipDistance3_param, tint_symbol.fClipDistance4_param);
|
||||
if (tint_discard) {
|
||||
tint_discard_func();
|
||||
const tint_symbol_2 tint_symbol_10 = (tint_symbol_2)0;
|
||||
return tint_symbol_10;
|
||||
}
|
||||
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
|
||||
wrapper_result.glFragColor_1 = inner_result.glFragColor_1;
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
static bool tint_discarded = false;
|
||||
|
||||
static float fClipDistance3 = 0.0f;
|
||||
static float fClipDistance4 = 0.0f;
|
||||
cbuffer cbuffer_x_29 : register(b0, space0) {
|
||||
@@ -10,7 +12,6 @@ cbuffer cbuffer_x_137 : register(b2, space0) {
|
||||
uint4 x_137[1];
|
||||
};
|
||||
static float4 glFragColor = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
static bool tint_discard = false;
|
||||
|
||||
void main_1() {
|
||||
float3 viewDirectionW = float3(0.0f, 0.0f, 0.0f);
|
||||
@@ -31,13 +32,11 @@ void main_1() {
|
||||
float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
const float x_9 = fClipDistance3;
|
||||
if ((x_9 > 0.0f)) {
|
||||
tint_discard = true;
|
||||
return;
|
||||
tint_discarded = true;
|
||||
}
|
||||
const float x_17 = fClipDistance4;
|
||||
if ((x_17 > 0.0f)) {
|
||||
tint_discard = true;
|
||||
return;
|
||||
tint_discarded = true;
|
||||
}
|
||||
const float4 x_34 = asfloat(x_29[0]);
|
||||
const float3 x_38 = (0.0f).xxx;
|
||||
@@ -105,26 +104,16 @@ main_out main_inner(float fClipDistance3_param, float fClipDistance4_param) {
|
||||
fClipDistance3 = fClipDistance3_param;
|
||||
fClipDistance4 = fClipDistance4_param;
|
||||
main_1();
|
||||
if (tint_discard) {
|
||||
const main_out tint_symbol_8 = (main_out)0;
|
||||
return tint_symbol_8;
|
||||
}
|
||||
const main_out tint_symbol_9 = {glFragColor};
|
||||
return tint_symbol_9;
|
||||
}
|
||||
|
||||
void tint_discard_func() {
|
||||
discard;
|
||||
const main_out tint_symbol_8 = {glFragColor};
|
||||
return tint_symbol_8;
|
||||
}
|
||||
|
||||
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
||||
const main_out inner_result = main_inner(tint_symbol.fClipDistance3_param, tint_symbol.fClipDistance4_param);
|
||||
if (tint_discard) {
|
||||
tint_discard_func();
|
||||
const tint_symbol_2 tint_symbol_10 = (tint_symbol_2)0;
|
||||
return tint_symbol_10;
|
||||
}
|
||||
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
|
||||
wrapper_result.glFragColor_1 = inner_result.glFragColor_1;
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
bool tint_discarded = false;
|
||||
layout(location = 2) in float fClipDistance3_param_1;
|
||||
layout(location = 3) in float fClipDistance4_param_1;
|
||||
layout(location = 0) out vec4 glFragColor_1_1;
|
||||
@@ -38,7 +39,6 @@ layout(binding = 2, std140) uniform x_137_block_ubo {
|
||||
} x_137;
|
||||
|
||||
vec4 glFragColor = vec4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
bool tint_discard = false;
|
||||
void main_1() {
|
||||
vec3 viewDirectionW = vec3(0.0f, 0.0f, 0.0f);
|
||||
vec4 baseColor = vec4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
@@ -58,13 +58,11 @@ void main_1() {
|
||||
vec4 color = vec4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
float x_9 = fClipDistance3;
|
||||
if ((x_9 > 0.0f)) {
|
||||
tint_discard = true;
|
||||
return;
|
||||
tint_discarded = true;
|
||||
}
|
||||
float x_17 = fClipDistance4;
|
||||
if ((x_17 > 0.0f)) {
|
||||
tint_discard = true;
|
||||
return;
|
||||
tint_discarded = true;
|
||||
}
|
||||
vec4 x_34 = x_29.inner.vEyePosition;
|
||||
vec3 x_38 = vec3(0.0f);
|
||||
@@ -125,24 +123,15 @@ main_out tint_symbol(float fClipDistance3_param, float fClipDistance4_param) {
|
||||
fClipDistance3 = fClipDistance3_param;
|
||||
fClipDistance4 = fClipDistance4_param;
|
||||
main_1();
|
||||
if (tint_discard) {
|
||||
main_out tint_symbol_1 = main_out(vec4(0.0f));
|
||||
return tint_symbol_1;
|
||||
}
|
||||
main_out tint_symbol_2 = main_out(glFragColor);
|
||||
return tint_symbol_2;
|
||||
}
|
||||
|
||||
void tint_discard_func() {
|
||||
discard;
|
||||
main_out tint_symbol_1 = main_out(glFragColor);
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
void main() {
|
||||
main_out inner_result = tint_symbol(fClipDistance3_param_1, fClipDistance4_param_1);
|
||||
if (tint_discard) {
|
||||
tint_discard_func();
|
||||
return;
|
||||
}
|
||||
glFragColor_1_1 = inner_result.glFragColor_1;
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ struct Mesh {
|
||||
/* 0x0000 */ float visibility;
|
||||
};
|
||||
|
||||
void main_1(thread float* const tint_symbol_7, thread bool* const tint_symbol_8, thread float* const tint_symbol_9, const constant Scene* const tint_symbol_10, const constant Material* const tint_symbol_11, const constant Mesh* const tint_symbol_12, thread float4* const tint_symbol_13) {
|
||||
void main_1(thread float* const tint_symbol_5, thread bool* const tint_symbol_6, thread float* const tint_symbol_7, const constant Scene* const tint_symbol_8, const constant Material* const tint_symbol_9, const constant Mesh* const tint_symbol_10, thread float4* const tint_symbol_11) {
|
||||
float3 viewDirectionW = 0.0f;
|
||||
float4 baseColor = 0.0f;
|
||||
float3 diffuseColor = 0.0f;
|
||||
@@ -34,23 +34,21 @@ void main_1(thread float* const tint_symbol_7, thread bool* const tint_symbol_8,
|
||||
float3 finalDiffuse = 0.0f;
|
||||
float3 finalSpecular = 0.0f;
|
||||
float4 color = 0.0f;
|
||||
float const x_9 = *(tint_symbol_7);
|
||||
float const x_9 = *(tint_symbol_5);
|
||||
if ((x_9 > 0.0f)) {
|
||||
*(tint_symbol_8) = true;
|
||||
return;
|
||||
*(tint_symbol_6) = true;
|
||||
}
|
||||
float const x_17 = *(tint_symbol_9);
|
||||
float const x_17 = *(tint_symbol_7);
|
||||
if ((x_17 > 0.0f)) {
|
||||
*(tint_symbol_8) = true;
|
||||
return;
|
||||
*(tint_symbol_6) = true;
|
||||
}
|
||||
float4 const x_34 = (*(tint_symbol_10)).vEyePosition;
|
||||
float4 const x_34 = (*(tint_symbol_8)).vEyePosition;
|
||||
float3 const x_38 = float3(0.0f);
|
||||
viewDirectionW = normalize((float3(x_34[0], x_34[1], x_34[2]) - x_38));
|
||||
baseColor = float4(1.0f);
|
||||
float4 const x_52 = (*(tint_symbol_11)).vDiffuseColor;
|
||||
float4 const x_52 = (*(tint_symbol_9)).vDiffuseColor;
|
||||
diffuseColor = float3(x_52[0], x_52[1], x_52[2]);
|
||||
float const x_60 = (*(tint_symbol_11)).vDiffuseColor[3];
|
||||
float const x_60 = (*(tint_symbol_9)).vDiffuseColor[3];
|
||||
alpha = x_60;
|
||||
float3 const x_62 = float3(0.0f);
|
||||
float3 const x_64 = float3(0.0f);
|
||||
@@ -66,12 +64,12 @@ void main_1(thread float* const tint_symbol_7, thread bool* const tint_symbol_8,
|
||||
shadow = 1.0f;
|
||||
refractionColor = float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
reflectionColor = float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
float3 const x_94 = float3((*(tint_symbol_11)).vEmissiveColor);
|
||||
float3 const x_94 = float3((*(tint_symbol_9)).vEmissiveColor);
|
||||
emissiveColor = x_94;
|
||||
float3 const x_96 = diffuseBase;
|
||||
float3 const x_97 = diffuseColor;
|
||||
float3 const x_99 = emissiveColor;
|
||||
float3 const x_103 = float3((*(tint_symbol_11)).vAmbientColor);
|
||||
float3 const x_103 = float3((*(tint_symbol_9)).vAmbientColor);
|
||||
float4 const x_108 = baseColor;
|
||||
finalDiffuse = (clamp((((x_96 * x_97) + x_99) + x_103), float3(0.0f), float3(1.0f)) * float3(x_108[0], x_108[1], x_108[2]));
|
||||
finalSpecular = float3(0.0f);
|
||||
@@ -87,11 +85,11 @@ void main_1(thread float* const tint_symbol_7, thread bool* const tint_symbol_8,
|
||||
float3 const x_132 = fmax(float3(x_129[0], x_129[1], x_129[2]), float3(0.0f));
|
||||
float4 const x_133 = color;
|
||||
color = float4(x_132[0], x_132[1], x_132[2], x_133[3]);
|
||||
float const x_140 = (*(tint_symbol_12)).visibility;
|
||||
float const x_140 = (*(tint_symbol_10)).visibility;
|
||||
float const x_142 = color[3];
|
||||
color[3] = (x_142 * x_140);
|
||||
float4 const x_147 = color;
|
||||
*(tint_symbol_13) = x_147;
|
||||
*(tint_symbol_11) = x_147;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -108,35 +106,25 @@ struct tint_symbol_3 {
|
||||
float4 glFragColor_1 [[color(0)]];
|
||||
};
|
||||
|
||||
main_out tint_symbol_inner(float fClipDistance3_param, float fClipDistance4_param, thread float* const tint_symbol_14, thread float* const tint_symbol_15, thread bool* const tint_symbol_16, const constant Scene* const tint_symbol_17, const constant Material* const tint_symbol_18, const constant Mesh* const tint_symbol_19, thread float4* const tint_symbol_20) {
|
||||
*(tint_symbol_14) = fClipDistance3_param;
|
||||
*(tint_symbol_15) = fClipDistance4_param;
|
||||
main_1(tint_symbol_14, tint_symbol_16, tint_symbol_15, tint_symbol_17, tint_symbol_18, tint_symbol_19, tint_symbol_20);
|
||||
if (*(tint_symbol_16)) {
|
||||
main_out const tint_symbol_4 = main_out{};
|
||||
return tint_symbol_4;
|
||||
}
|
||||
main_out const tint_symbol_5 = {.glFragColor_1=*(tint_symbol_20)};
|
||||
return tint_symbol_5;
|
||||
main_out tint_symbol_inner(float fClipDistance3_param, float fClipDistance4_param, thread float* const tint_symbol_12, thread float* const tint_symbol_13, thread bool* const tint_symbol_14, const constant Scene* const tint_symbol_15, const constant Material* const tint_symbol_16, const constant Mesh* const tint_symbol_17, thread float4* const tint_symbol_18) {
|
||||
*(tint_symbol_12) = fClipDistance3_param;
|
||||
*(tint_symbol_13) = fClipDistance4_param;
|
||||
main_1(tint_symbol_12, tint_symbol_14, tint_symbol_13, tint_symbol_15, tint_symbol_16, tint_symbol_17, tint_symbol_18);
|
||||
main_out const tint_symbol_4 = {.glFragColor_1=*(tint_symbol_18)};
|
||||
return tint_symbol_4;
|
||||
}
|
||||
|
||||
void tint_discard_func() {
|
||||
discard_fragment();
|
||||
}
|
||||
|
||||
fragment tint_symbol_3 tint_symbol(const constant Scene* tint_symbol_24 [[buffer(0)]], const constant Material* tint_symbol_25 [[buffer(1)]], const constant Mesh* tint_symbol_26 [[buffer(2)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
|
||||
thread float tint_symbol_21 = 0.0f;
|
||||
thread float tint_symbol_22 = 0.0f;
|
||||
thread bool tint_symbol_23 = false;
|
||||
thread float4 tint_symbol_27 = 0.0f;
|
||||
main_out const inner_result = tint_symbol_inner(tint_symbol_1.fClipDistance3_param, tint_symbol_1.fClipDistance4_param, &(tint_symbol_21), &(tint_symbol_22), &(tint_symbol_23), tint_symbol_24, tint_symbol_25, tint_symbol_26, &(tint_symbol_27));
|
||||
if (tint_symbol_23) {
|
||||
tint_discard_func();
|
||||
tint_symbol_3 const tint_symbol_6 = tint_symbol_3{};
|
||||
return tint_symbol_6;
|
||||
}
|
||||
fragment tint_symbol_3 tint_symbol(const constant Scene* tint_symbol_22 [[buffer(0)]], const constant Material* tint_symbol_23 [[buffer(1)]], const constant Mesh* tint_symbol_24 [[buffer(2)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
|
||||
thread float tint_symbol_19 = 0.0f;
|
||||
thread float tint_symbol_20 = 0.0f;
|
||||
thread bool tint_symbol_21 = false;
|
||||
thread float4 tint_symbol_25 = 0.0f;
|
||||
main_out const inner_result = tint_symbol_inner(tint_symbol_1.fClipDistance3_param, tint_symbol_1.fClipDistance4_param, &(tint_symbol_19), &(tint_symbol_20), &(tint_symbol_21), tint_symbol_22, tint_symbol_23, tint_symbol_24, &(tint_symbol_25));
|
||||
tint_symbol_3 wrapper_result = {};
|
||||
wrapper_result.glFragColor_1 = inner_result.glFragColor_1;
|
||||
if (tint_symbol_21) {
|
||||
discard_fragment();
|
||||
}
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 202
|
||||
; Bound: 188
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%84 = OpExtInstImport "GLSL.std.450"
|
||||
%74 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %fClipDistance3_param_1 %fClipDistance4_param_1 %glFragColor_1_1
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %tint_discarded "tint_discarded"
|
||||
OpName %fClipDistance3_param_1 "fClipDistance3_param_1"
|
||||
OpName %fClipDistance4_param_1 "fClipDistance4_param_1"
|
||||
OpName %glFragColor_1_1 "glFragColor_1_1"
|
||||
@@ -33,9 +34,7 @@
|
||||
OpMemberName %Mesh 0 "visibility"
|
||||
OpName %x_137 "x_137"
|
||||
OpName %glFragColor "glFragColor"
|
||||
OpName %tint_discard "tint_discard"
|
||||
OpName %main_1 "main_1"
|
||||
OpName %tint_return_flag "tint_return_flag"
|
||||
OpName %viewDirectionW "viewDirectionW"
|
||||
OpName %baseColor "baseColor"
|
||||
OpName %diffuseColor "diffuseColor"
|
||||
@@ -52,7 +51,6 @@
|
||||
OpName %finalDiffuse "finalDiffuse"
|
||||
OpName %finalSpecular "finalSpecular"
|
||||
OpName %color "color"
|
||||
OpName %tint_discard_func "tint_discard_func"
|
||||
OpName %main_out "main_out"
|
||||
OpMemberName %main_out 0 "glFragColor_1"
|
||||
OpName %main_inner "main_inner"
|
||||
@@ -85,18 +83,22 @@
|
||||
OpDecorate %x_137 DescriptorSet 0
|
||||
OpDecorate %x_137 Binding 2
|
||||
OpMemberDecorate %main_out 0 Offset 0
|
||||
%bool = OpTypeBool
|
||||
%2 = OpConstantNull %bool
|
||||
%_ptr_Private_bool = OpTypePointer Private %bool
|
||||
%tint_discarded = OpVariable %_ptr_Private_bool Private %2
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%fClipDistance3_param_1 = OpVariable %_ptr_Input_float Input
|
||||
%fClipDistance4_param_1 = OpVariable %_ptr_Input_float Input
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%8 = OpConstantNull %v4float
|
||||
%glFragColor_1_1 = OpVariable %_ptr_Output_v4float Output %8
|
||||
%12 = OpConstantNull %v4float
|
||||
%glFragColor_1_1 = OpVariable %_ptr_Output_v4float Output %12
|
||||
%_ptr_Private_float = OpTypePointer Private %float
|
||||
%11 = OpConstantNull %float
|
||||
%fClipDistance3 = OpVariable %_ptr_Private_float Private %11
|
||||
%fClipDistance4 = OpVariable %_ptr_Private_float Private %11
|
||||
%15 = OpConstantNull %float
|
||||
%fClipDistance3 = OpVariable %_ptr_Private_float Private %15
|
||||
%fClipDistance4 = OpVariable %_ptr_Private_float Private %15
|
||||
%Scene = OpTypeStruct %v4float
|
||||
%x_29_block = OpTypeStruct %Scene
|
||||
%_ptr_Uniform_x_29_block = OpTypePointer Uniform %x_29_block
|
||||
@@ -111,227 +113,198 @@
|
||||
%_ptr_Uniform_x_137_block = OpTypePointer Uniform %x_137_block
|
||||
%x_137 = OpVariable %_ptr_Uniform_x_137_block Uniform
|
||||
%_ptr_Private_v4float = OpTypePointer Private %v4float
|
||||
%glFragColor = OpVariable %_ptr_Private_v4float Private %8
|
||||
%bool = OpTypeBool
|
||||
%29 = OpConstantNull %bool
|
||||
%_ptr_Private_bool = OpTypePointer Private %bool
|
||||
%tint_discard = OpVariable %_ptr_Private_bool Private %29
|
||||
%glFragColor = OpVariable %_ptr_Private_v4float Private %12
|
||||
%void = OpTypeVoid
|
||||
%32 = OpTypeFunction %void
|
||||
%_ptr_Function_bool = OpTypePointer Function %bool
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%40 = OpConstantNull %v3float
|
||||
%38 = OpConstantNull %v3float
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%50 = OpConstantNull %v2float
|
||||
%48 = OpConstantNull %v2float
|
||||
%true = OpConstantTrue %bool
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%91 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
|
||||
%81 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
||||
%118 = OpConstantComposite %v3float %float_1 %float_1 %float_1
|
||||
%119 = OpConstantComposite %v4float %11 %11 %11 %float_1
|
||||
%108 = OpConstantComposite %v3float %float_1 %float_1 %float_1
|
||||
%109 = OpConstantComposite %v4float %15 %15 %15 %float_1
|
||||
%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%182 = OpTypeFunction %main_out %float %float
|
||||
%193 = OpConstantNull %main_out
|
||||
%170 = OpTypeFunction %main_out %float %float
|
||||
%main_1 = OpFunction %void None %32
|
||||
%35 = OpLabel
|
||||
%tint_return_flag = OpVariable %_ptr_Function_bool Function %29
|
||||
%viewDirectionW = OpVariable %_ptr_Function_v3float Function %40
|
||||
%baseColor = OpVariable %_ptr_Function_v4float Function %8
|
||||
%diffuseColor = OpVariable %_ptr_Function_v3float Function %40
|
||||
%alpha = OpVariable %_ptr_Function_float Function %11
|
||||
%normalW = OpVariable %_ptr_Function_v3float Function %40
|
||||
%uvOffset = OpVariable %_ptr_Function_v2float Function %50
|
||||
%baseAmbientColor = OpVariable %_ptr_Function_v3float Function %40
|
||||
%glossiness = OpVariable %_ptr_Function_float Function %11
|
||||
%diffuseBase = OpVariable %_ptr_Function_v3float Function %40
|
||||
%shadow = OpVariable %_ptr_Function_float Function %11
|
||||
%refractionColor = OpVariable %_ptr_Function_v4float Function %8
|
||||
%reflectionColor = OpVariable %_ptr_Function_v4float Function %8
|
||||
%emissiveColor = OpVariable %_ptr_Function_v3float Function %40
|
||||
%finalDiffuse = OpVariable %_ptr_Function_v3float Function %40
|
||||
%finalSpecular = OpVariable %_ptr_Function_v3float Function %40
|
||||
%color = OpVariable %_ptr_Function_v4float Function %8
|
||||
%61 = OpLoad %float %fClipDistance3
|
||||
%62 = OpFOrdGreaterThan %bool %61 %11
|
||||
OpSelectionMerge %63 None
|
||||
OpBranchConditional %62 %64 %63
|
||||
%64 = OpLabel
|
||||
OpStore %tint_discard %true
|
||||
OpStore %tint_return_flag %true
|
||||
OpBranch %63
|
||||
%63 = OpLabel
|
||||
%67 = OpLoad %bool %tint_return_flag
|
||||
%66 = OpLogicalNot %bool %67
|
||||
OpSelectionMerge %68 None
|
||||
OpBranchConditional %66 %69 %68
|
||||
%69 = OpLabel
|
||||
%70 = OpLoad %float %fClipDistance4
|
||||
%71 = OpFOrdGreaterThan %bool %70 %11
|
||||
OpSelectionMerge %72 None
|
||||
OpBranchConditional %71 %73 %72
|
||||
%73 = OpLabel
|
||||
OpStore %tint_discard %true
|
||||
OpStore %tint_return_flag %true
|
||||
OpBranch %72
|
||||
%72 = OpLabel
|
||||
%75 = OpLoad %bool %tint_return_flag
|
||||
%74 = OpLogicalNot %bool %75
|
||||
OpSelectionMerge %76 None
|
||||
OpBranchConditional %74 %77 %76
|
||||
%77 = OpLabel
|
||||
%81 = OpAccessChain %_ptr_Uniform_v4float %x_29 %uint_0 %uint_0
|
||||
%82 = OpLoad %v4float %81
|
||||
%85 = OpCompositeExtract %float %82 0
|
||||
%86 = OpCompositeExtract %float %82 1
|
||||
%87 = OpCompositeExtract %float %82 2
|
||||
%88 = OpCompositeConstruct %v3float %85 %86 %87
|
||||
%89 = OpFSub %v3float %88 %40
|
||||
%83 = OpExtInst %v3float %84 Normalize %89
|
||||
OpStore %viewDirectionW %83
|
||||
OpStore %baseColor %91
|
||||
%92 = OpAccessChain %_ptr_Uniform_v4float %x_49 %uint_0 %uint_0
|
||||
%93 = OpLoad %v4float %92
|
||||
%94 = OpCompositeExtract %float %93 0
|
||||
%95 = OpCompositeExtract %float %93 1
|
||||
%96 = OpCompositeExtract %float %93 2
|
||||
%97 = OpCompositeConstruct %v3float %94 %95 %96
|
||||
OpStore %diffuseColor %97
|
||||
%100 = OpAccessChain %_ptr_Uniform_float %x_49 %uint_0 %uint_0 %uint_3
|
||||
%101 = OpLoad %float %100
|
||||
OpStore %alpha %101
|
||||
OpStore %uvOffset %50
|
||||
%viewDirectionW = OpVariable %_ptr_Function_v3float Function %38
|
||||
%baseColor = OpVariable %_ptr_Function_v4float Function %12
|
||||
%diffuseColor = OpVariable %_ptr_Function_v3float Function %38
|
||||
%alpha = OpVariable %_ptr_Function_float Function %15
|
||||
%normalW = OpVariable %_ptr_Function_v3float Function %38
|
||||
%uvOffset = OpVariable %_ptr_Function_v2float Function %48
|
||||
%baseAmbientColor = OpVariable %_ptr_Function_v3float Function %38
|
||||
%glossiness = OpVariable %_ptr_Function_float Function %15
|
||||
%diffuseBase = OpVariable %_ptr_Function_v3float Function %38
|
||||
%shadow = OpVariable %_ptr_Function_float Function %15
|
||||
%refractionColor = OpVariable %_ptr_Function_v4float Function %12
|
||||
%reflectionColor = OpVariable %_ptr_Function_v4float Function %12
|
||||
%emissiveColor = OpVariable %_ptr_Function_v3float Function %38
|
||||
%finalDiffuse = OpVariable %_ptr_Function_v3float Function %38
|
||||
%finalSpecular = OpVariable %_ptr_Function_v3float Function %38
|
||||
%color = OpVariable %_ptr_Function_v4float Function %12
|
||||
%59 = OpLoad %float %fClipDistance3
|
||||
%60 = OpFOrdGreaterThan %bool %59 %15
|
||||
OpSelectionMerge %61 None
|
||||
OpBranchConditional %60 %62 %61
|
||||
%62 = OpLabel
|
||||
OpStore %tint_discarded %true
|
||||
OpBranch %61
|
||||
%61 = OpLabel
|
||||
%64 = OpLoad %float %fClipDistance4
|
||||
%65 = OpFOrdGreaterThan %bool %64 %15
|
||||
OpSelectionMerge %66 None
|
||||
OpBranchConditional %65 %67 %66
|
||||
%67 = OpLabel
|
||||
OpStore %tint_discarded %true
|
||||
OpBranch %66
|
||||
%66 = OpLabel
|
||||
%71 = OpAccessChain %_ptr_Uniform_v4float %x_29 %uint_0 %uint_0
|
||||
%72 = OpLoad %v4float %71
|
||||
%75 = OpCompositeExtract %float %72 0
|
||||
%76 = OpCompositeExtract %float %72 1
|
||||
%77 = OpCompositeExtract %float %72 2
|
||||
%78 = OpCompositeConstruct %v3float %75 %76 %77
|
||||
%79 = OpFSub %v3float %78 %38
|
||||
%73 = OpExtInst %v3float %74 Normalize %79
|
||||
OpStore %viewDirectionW %73
|
||||
OpStore %baseColor %81
|
||||
%82 = OpAccessChain %_ptr_Uniform_v4float %x_49 %uint_0 %uint_0
|
||||
%83 = OpLoad %v4float %82
|
||||
%84 = OpCompositeExtract %float %83 0
|
||||
%85 = OpCompositeExtract %float %83 1
|
||||
%86 = OpCompositeExtract %float %83 2
|
||||
%87 = OpCompositeConstruct %v3float %84 %85 %86
|
||||
OpStore %diffuseColor %87
|
||||
%90 = OpAccessChain %_ptr_Uniform_float %x_49 %uint_0 %uint_0 %uint_3
|
||||
%91 = OpLoad %float %90
|
||||
OpStore %alpha %91
|
||||
OpStore %uvOffset %48
|
||||
%92 = OpLoad %v4float %baseColor
|
||||
%93 = OpCompositeExtract %float %92 0
|
||||
%94 = OpCompositeExtract %float %92 1
|
||||
%95 = OpCompositeExtract %float %92 2
|
||||
%96 = OpCompositeConstruct %v3float %93 %94 %95
|
||||
%97 = OpCompositeExtract %float %12 0
|
||||
%98 = OpCompositeExtract %float %12 1
|
||||
%99 = OpCompositeExtract %float %12 2
|
||||
%100 = OpCompositeConstruct %v3float %97 %98 %99
|
||||
%101 = OpFMul %v3float %96 %100
|
||||
%102 = OpLoad %v4float %baseColor
|
||||
%103 = OpCompositeExtract %float %102 0
|
||||
%104 = OpCompositeExtract %float %102 1
|
||||
%105 = OpCompositeExtract %float %102 2
|
||||
%106 = OpCompositeConstruct %v3float %103 %104 %105
|
||||
%107 = OpCompositeExtract %float %8 0
|
||||
%108 = OpCompositeExtract %float %8 1
|
||||
%109 = OpCompositeExtract %float %8 2
|
||||
%110 = OpCompositeConstruct %v3float %107 %108 %109
|
||||
%111 = OpFMul %v3float %106 %110
|
||||
%112 = OpLoad %v4float %baseColor
|
||||
%113 = OpCompositeExtract %float %111 0
|
||||
%114 = OpCompositeExtract %float %111 1
|
||||
%115 = OpCompositeExtract %float %111 2
|
||||
%116 = OpCompositeExtract %float %112 3
|
||||
%117 = OpCompositeConstruct %v4float %113 %114 %115 %116
|
||||
OpStore %baseColor %117
|
||||
OpStore %baseAmbientColor %118
|
||||
OpStore %glossiness %11
|
||||
OpStore %diffuseBase %40
|
||||
%103 = OpCompositeExtract %float %101 0
|
||||
%104 = OpCompositeExtract %float %101 1
|
||||
%105 = OpCompositeExtract %float %101 2
|
||||
%106 = OpCompositeExtract %float %102 3
|
||||
%107 = OpCompositeConstruct %v4float %103 %104 %105 %106
|
||||
OpStore %baseColor %107
|
||||
OpStore %baseAmbientColor %108
|
||||
OpStore %glossiness %15
|
||||
OpStore %diffuseBase %38
|
||||
OpStore %shadow %float_1
|
||||
OpStore %refractionColor %119
|
||||
OpStore %reflectionColor %119
|
||||
%121 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_0 %uint_3
|
||||
%122 = OpLoad %v3float %121
|
||||
OpStore %emissiveColor %122
|
||||
%123 = OpLoad %v3float %diffuseBase
|
||||
%124 = OpLoad %v3float %diffuseColor
|
||||
%125 = OpLoad %v3float %emissiveColor
|
||||
%127 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_0 %uint_1
|
||||
%128 = OpLoad %v3float %127
|
||||
%129 = OpLoad %v4float %baseColor
|
||||
%131 = OpFMul %v3float %123 %124
|
||||
%132 = OpFAdd %v3float %131 %125
|
||||
%133 = OpFAdd %v3float %132 %128
|
||||
%130 = OpExtInst %v3float %84 NClamp %133 %40 %118
|
||||
%134 = OpCompositeExtract %float %129 0
|
||||
%135 = OpCompositeExtract %float %129 1
|
||||
%136 = OpCompositeExtract %float %129 2
|
||||
%137 = OpCompositeConstruct %v3float %134 %135 %136
|
||||
%138 = OpFMul %v3float %130 %137
|
||||
OpStore %finalDiffuse %138
|
||||
OpStore %finalSpecular %40
|
||||
%139 = OpLoad %v3float %finalDiffuse
|
||||
%140 = OpLoad %v3float %baseAmbientColor
|
||||
%141 = OpLoad %v3float %finalSpecular
|
||||
%142 = OpLoad %v4float %reflectionColor
|
||||
%143 = OpLoad %v4float %refractionColor
|
||||
%144 = OpFMul %v3float %139 %140
|
||||
%145 = OpFAdd %v3float %144 %141
|
||||
%146 = OpCompositeExtract %float %142 0
|
||||
%147 = OpCompositeExtract %float %142 1
|
||||
%148 = OpCompositeExtract %float %142 2
|
||||
%149 = OpCompositeConstruct %v3float %146 %147 %148
|
||||
%150 = OpFAdd %v3float %145 %149
|
||||
%151 = OpCompositeExtract %float %143 0
|
||||
%152 = OpCompositeExtract %float %143 1
|
||||
%153 = OpCompositeExtract %float %143 2
|
||||
%154 = OpCompositeConstruct %v3float %151 %152 %153
|
||||
%155 = OpFAdd %v3float %150 %154
|
||||
%156 = OpLoad %float %alpha
|
||||
%157 = OpCompositeExtract %float %155 0
|
||||
%158 = OpCompositeExtract %float %155 1
|
||||
%159 = OpCompositeExtract %float %155 2
|
||||
%160 = OpCompositeConstruct %v4float %157 %158 %159 %156
|
||||
OpStore %color %160
|
||||
%161 = OpLoad %v4float %color
|
||||
%163 = OpCompositeExtract %float %161 0
|
||||
%164 = OpCompositeExtract %float %161 1
|
||||
%165 = OpCompositeExtract %float %161 2
|
||||
%166 = OpCompositeConstruct %v3float %163 %164 %165
|
||||
%162 = OpExtInst %v3float %84 NMax %166 %40
|
||||
%167 = OpLoad %v4float %color
|
||||
%168 = OpCompositeExtract %float %162 0
|
||||
%169 = OpCompositeExtract %float %162 1
|
||||
%170 = OpCompositeExtract %float %162 2
|
||||
%171 = OpCompositeExtract %float %167 3
|
||||
%172 = OpCompositeConstruct %v4float %168 %169 %170 %171
|
||||
OpStore %color %172
|
||||
%173 = OpAccessChain %_ptr_Uniform_float %x_137 %uint_0 %uint_0
|
||||
%174 = OpLoad %float %173
|
||||
%175 = OpAccessChain %_ptr_Function_float %color %uint_3
|
||||
%176 = OpLoad %float %175
|
||||
%177 = OpAccessChain %_ptr_Function_float %color %uint_3
|
||||
%178 = OpFMul %float %176 %174
|
||||
OpStore %177 %178
|
||||
%179 = OpLoad %v4float %color
|
||||
OpStore %glFragColor %179
|
||||
OpStore %tint_return_flag %true
|
||||
OpBranch %76
|
||||
%76 = OpLabel
|
||||
OpBranch %68
|
||||
%68 = OpLabel
|
||||
OpStore %refractionColor %109
|
||||
OpStore %reflectionColor %109
|
||||
%111 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_0 %uint_3
|
||||
%112 = OpLoad %v3float %111
|
||||
OpStore %emissiveColor %112
|
||||
%113 = OpLoad %v3float %diffuseBase
|
||||
%114 = OpLoad %v3float %diffuseColor
|
||||
%115 = OpLoad %v3float %emissiveColor
|
||||
%117 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_0 %uint_1
|
||||
%118 = OpLoad %v3float %117
|
||||
%119 = OpLoad %v4float %baseColor
|
||||
%121 = OpFMul %v3float %113 %114
|
||||
%122 = OpFAdd %v3float %121 %115
|
||||
%123 = OpFAdd %v3float %122 %118
|
||||
%120 = OpExtInst %v3float %74 NClamp %123 %38 %108
|
||||
%124 = OpCompositeExtract %float %119 0
|
||||
%125 = OpCompositeExtract %float %119 1
|
||||
%126 = OpCompositeExtract %float %119 2
|
||||
%127 = OpCompositeConstruct %v3float %124 %125 %126
|
||||
%128 = OpFMul %v3float %120 %127
|
||||
OpStore %finalDiffuse %128
|
||||
OpStore %finalSpecular %38
|
||||
%129 = OpLoad %v3float %finalDiffuse
|
||||
%130 = OpLoad %v3float %baseAmbientColor
|
||||
%131 = OpLoad %v3float %finalSpecular
|
||||
%132 = OpLoad %v4float %reflectionColor
|
||||
%133 = OpLoad %v4float %refractionColor
|
||||
%134 = OpFMul %v3float %129 %130
|
||||
%135 = OpFAdd %v3float %134 %131
|
||||
%136 = OpCompositeExtract %float %132 0
|
||||
%137 = OpCompositeExtract %float %132 1
|
||||
%138 = OpCompositeExtract %float %132 2
|
||||
%139 = OpCompositeConstruct %v3float %136 %137 %138
|
||||
%140 = OpFAdd %v3float %135 %139
|
||||
%141 = OpCompositeExtract %float %133 0
|
||||
%142 = OpCompositeExtract %float %133 1
|
||||
%143 = OpCompositeExtract %float %133 2
|
||||
%144 = OpCompositeConstruct %v3float %141 %142 %143
|
||||
%145 = OpFAdd %v3float %140 %144
|
||||
%146 = OpLoad %float %alpha
|
||||
%147 = OpCompositeExtract %float %145 0
|
||||
%148 = OpCompositeExtract %float %145 1
|
||||
%149 = OpCompositeExtract %float %145 2
|
||||
%150 = OpCompositeConstruct %v4float %147 %148 %149 %146
|
||||
OpStore %color %150
|
||||
%151 = OpLoad %v4float %color
|
||||
%153 = OpCompositeExtract %float %151 0
|
||||
%154 = OpCompositeExtract %float %151 1
|
||||
%155 = OpCompositeExtract %float %151 2
|
||||
%156 = OpCompositeConstruct %v3float %153 %154 %155
|
||||
%152 = OpExtInst %v3float %74 NMax %156 %38
|
||||
%157 = OpLoad %v4float %color
|
||||
%158 = OpCompositeExtract %float %152 0
|
||||
%159 = OpCompositeExtract %float %152 1
|
||||
%160 = OpCompositeExtract %float %152 2
|
||||
%161 = OpCompositeExtract %float %157 3
|
||||
%162 = OpCompositeConstruct %v4float %158 %159 %160 %161
|
||||
OpStore %color %162
|
||||
%163 = OpAccessChain %_ptr_Uniform_float %x_137 %uint_0 %uint_0
|
||||
%164 = OpLoad %float %163
|
||||
%165 = OpAccessChain %_ptr_Function_float %color %uint_3
|
||||
%166 = OpLoad %float %165
|
||||
%167 = OpAccessChain %_ptr_Function_float %color %uint_3
|
||||
%168 = OpFMul %float %166 %164
|
||||
OpStore %167 %168
|
||||
%169 = OpLoad %v4float %color
|
||||
OpStore %glFragColor %169
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_discard_func = OpFunction %void None %32
|
||||
%181 = OpLabel
|
||||
OpKill
|
||||
OpFunctionEnd
|
||||
%main_inner = OpFunction %main_out None %182
|
||||
%main_inner = OpFunction %main_out None %170
|
||||
%fClipDistance3_param = OpFunctionParameter %float
|
||||
%fClipDistance4_param = OpFunctionParameter %float
|
||||
%187 = OpLabel
|
||||
%175 = OpLabel
|
||||
OpStore %fClipDistance3 %fClipDistance3_param
|
||||
OpStore %fClipDistance4 %fClipDistance4_param
|
||||
%188 = OpFunctionCall %void %main_1
|
||||
%189 = OpLoad %bool %tint_discard
|
||||
OpSelectionMerge %190 None
|
||||
OpBranchConditional %189 %191 %190
|
||||
%191 = OpLabel
|
||||
%192 = OpFunctionCall %void %tint_discard_func
|
||||
OpReturnValue %193
|
||||
%190 = OpLabel
|
||||
%194 = OpLoad %v4float %glFragColor
|
||||
%195 = OpCompositeConstruct %main_out %194
|
||||
OpReturnValue %195
|
||||
%176 = OpFunctionCall %void %main_1
|
||||
%177 = OpLoad %v4float %glFragColor
|
||||
%178 = OpCompositeConstruct %main_out %177
|
||||
OpReturnValue %178
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %32
|
||||
%197 = OpLabel
|
||||
%199 = OpLoad %float %fClipDistance3_param_1
|
||||
%200 = OpLoad %float %fClipDistance4_param_1
|
||||
%198 = OpFunctionCall %main_out %main_inner %199 %200
|
||||
%201 = OpCompositeExtract %v4float %198 0
|
||||
OpStore %glFragColor_1_1 %201
|
||||
%180 = OpLabel
|
||||
%182 = OpLoad %float %fClipDistance3_param_1
|
||||
%183 = OpLoad %float %fClipDistance4_param_1
|
||||
%181 = OpFunctionCall %main_out %main_inner %182 %183
|
||||
%184 = OpCompositeExtract %v4float %181 0
|
||||
OpStore %glFragColor_1_1 %184
|
||||
%185 = OpLoad %bool %tint_discarded
|
||||
OpSelectionMerge %186 None
|
||||
OpBranchConditional %185 %187 %186
|
||||
%187 = OpLabel
|
||||
OpKill
|
||||
%186 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
@@ -1,29 +1,15 @@
|
||||
bug/tint/1369.wgsl:3:3 warning: code is unreachable
|
||||
return true;
|
||||
^^^^^^
|
||||
|
||||
bug/tint/1369.wgsl:9:5 warning: code is unreachable
|
||||
var also_unreachable : bool;
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
static bool tint_discard = false;
|
||||
static bool tint_discarded = false;
|
||||
|
||||
bool call_discard() {
|
||||
tint_discard = true;
|
||||
return false;
|
||||
tint_discarded = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void tint_discard_func() {
|
||||
discard;
|
||||
}
|
||||
|
||||
void f() {
|
||||
bool v = call_discard();
|
||||
if (tint_discard) {
|
||||
tint_discard_func();
|
||||
return;
|
||||
}
|
||||
bool also_unreachable = false;
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,29 +1,15 @@
|
||||
bug/tint/1369.wgsl:3:3 warning: code is unreachable
|
||||
return true;
|
||||
^^^^^^
|
||||
|
||||
bug/tint/1369.wgsl:9:5 warning: code is unreachable
|
||||
var also_unreachable : bool;
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
static bool tint_discard = false;
|
||||
static bool tint_discarded = false;
|
||||
|
||||
bool call_discard() {
|
||||
tint_discard = true;
|
||||
return false;
|
||||
tint_discarded = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void tint_discard_func() {
|
||||
discard;
|
||||
}
|
||||
|
||||
void f() {
|
||||
bool v = call_discard();
|
||||
if (tint_discard) {
|
||||
tint_discard_func();
|
||||
return;
|
||||
}
|
||||
bool also_unreachable = false;
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,38 +1,21 @@
|
||||
bug/tint/1369.wgsl:3:3 warning: code is unreachable
|
||||
return true;
|
||||
^^^^^^
|
||||
|
||||
bug/tint/1369.wgsl:9:5 warning: code is unreachable
|
||||
var also_unreachable : bool;
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
bool tint_discard = false;
|
||||
bool tint_discarded = false;
|
||||
bool call_discard() {
|
||||
tint_discard = true;
|
||||
return false;
|
||||
tint_discarded = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void f() {
|
||||
bool v = call_discard();
|
||||
if (tint_discard) {
|
||||
return;
|
||||
}
|
||||
bool also_unreachable = false;
|
||||
}
|
||||
|
||||
void tint_discard_func() {
|
||||
discard;
|
||||
}
|
||||
|
||||
void main() {
|
||||
f();
|
||||
if (tint_discard) {
|
||||
tint_discard_func();
|
||||
return;
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,32 +1,18 @@
|
||||
bug/tint/1369.wgsl:3:3 warning: code is unreachable
|
||||
return true;
|
||||
^^^^^^
|
||||
|
||||
bug/tint/1369.wgsl:9:5 warning: code is unreachable
|
||||
var also_unreachable : bool;
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
bool call_discard(thread bool* const tint_symbol) {
|
||||
*(tint_symbol) = true;
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void tint_discard_func() {
|
||||
discard_fragment();
|
||||
}
|
||||
|
||||
fragment void f() {
|
||||
thread bool tint_symbol_1 = false;
|
||||
bool v = call_discard(&(tint_symbol_1));
|
||||
if (tint_symbol_1) {
|
||||
tint_discard_func();
|
||||
return;
|
||||
}
|
||||
bool also_unreachable = false;
|
||||
if (tint_symbol_1) {
|
||||
discard_fragment();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,29 +1,21 @@
|
||||
bug/tint/1369.wgsl:3:3 warning: code is unreachable
|
||||
return true;
|
||||
^^^^^^
|
||||
|
||||
bug/tint/1369.wgsl:9:5 warning: code is unreachable
|
||||
var also_unreachable : bool;
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 22
|
||||
; Bound: 20
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %f "f"
|
||||
OpExecutionMode %f OriginUpperLeft
|
||||
OpName %tint_discard "tint_discard"
|
||||
OpName %tint_discarded "tint_discarded"
|
||||
OpName %call_discard "call_discard"
|
||||
OpName %tint_discard_func "tint_discard_func"
|
||||
OpName %f "f"
|
||||
OpName %v "v"
|
||||
OpName %also_unreachable "also_unreachable"
|
||||
%bool = OpTypeBool
|
||||
%2 = OpConstantNull %bool
|
||||
%_ptr_Private_bool = OpTypePointer Private %bool
|
||||
%tint_discard = OpVariable %_ptr_Private_bool Private %2
|
||||
%tint_discarded = OpVariable %_ptr_Private_bool Private %2
|
||||
%5 = OpTypeFunction %bool
|
||||
%true = OpConstantTrue %bool
|
||||
%void = OpTypeVoid
|
||||
@@ -31,24 +23,20 @@ bug/tint/1369.wgsl:9:5 warning: code is unreachable
|
||||
%_ptr_Function_bool = OpTypePointer Function %bool
|
||||
%call_discard = OpFunction %bool None %5
|
||||
%7 = OpLabel
|
||||
OpStore %tint_discard %true
|
||||
OpReturnValue %2
|
||||
OpFunctionEnd
|
||||
%tint_discard_func = OpFunction %void None %9
|
||||
%12 = OpLabel
|
||||
OpKill
|
||||
OpStore %tint_discarded %true
|
||||
OpReturnValue %true
|
||||
OpFunctionEnd
|
||||
%f = OpFunction %void None %9
|
||||
%14 = OpLabel
|
||||
%12 = OpLabel
|
||||
%v = OpVariable %_ptr_Function_bool Function %2
|
||||
%15 = OpFunctionCall %bool %call_discard
|
||||
OpStore %v %15
|
||||
%18 = OpLoad %bool %tint_discard
|
||||
OpSelectionMerge %19 None
|
||||
OpBranchConditional %18 %20 %19
|
||||
%20 = OpLabel
|
||||
%21 = OpFunctionCall %void %tint_discard_func
|
||||
OpReturn
|
||||
%also_unreachable = OpVariable %_ptr_Function_bool Function %2
|
||||
%13 = OpFunctionCall %bool %call_discard
|
||||
OpStore %v %13
|
||||
%17 = OpLoad %bool %tint_discarded
|
||||
OpSelectionMerge %18 None
|
||||
OpBranchConditional %17 %19 %18
|
||||
%19 = OpLabel
|
||||
OpKill
|
||||
%18 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
bug/tint/1369.wgsl:3:3 warning: code is unreachable
|
||||
return true;
|
||||
^^^^^^
|
||||
|
||||
bug/tint/1369.wgsl:9:5 warning: code is unreachable
|
||||
var also_unreachable : bool;
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
fn call_discard() -> bool {
|
||||
discard;
|
||||
return true;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
@group(0) @binding(0) var t : texture_2d<f32>;
|
||||
|
||||
@group(0) @binding(1) var s : sampler;
|
||||
|
||||
@group(0) @binding(2) var<storage, read_write> a : atomic<i32>;
|
||||
|
||||
@fragment
|
||||
fn foo(@location(0) in : f32, @location(1) coord : vec2<f32>) -> @location(0) i32 {
|
||||
if (in == 0.0) {
|
||||
discard;
|
||||
}
|
||||
var result = i32(textureSample(t, s, coord).x);
|
||||
for (var i = 0; i < 10; i = atomicAdd(&a, 1)) {
|
||||
result += i;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
static bool tint_discarded = false;
|
||||
Texture2D<float4> t : register(t0, space0);
|
||||
SamplerState s : register(s1, space0);
|
||||
RWByteAddressBuffer a : register(u2, space0);
|
||||
|
||||
struct tint_symbol_2 {
|
||||
float tint_symbol : TEXCOORD0;
|
||||
float2 coord : TEXCOORD1;
|
||||
};
|
||||
struct tint_symbol_3 {
|
||||
int value : SV_Target0;
|
||||
};
|
||||
|
||||
int tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, int value) {
|
||||
int original_value = 0;
|
||||
buffer.InterlockedAdd(offset, value, original_value);
|
||||
return original_value;
|
||||
}
|
||||
|
||||
|
||||
int foo_inner(float tint_symbol, float2 coord) {
|
||||
if ((tint_symbol == 0.0f)) {
|
||||
tint_discarded = true;
|
||||
}
|
||||
int result = int(t.Sample(s, coord).x);
|
||||
{
|
||||
int i = 0;
|
||||
while (true) {
|
||||
if (!((i < 10))) {
|
||||
break;
|
||||
}
|
||||
{
|
||||
result = (result + i);
|
||||
}
|
||||
{
|
||||
int tint_symbol_4 = 0;
|
||||
if (!(tint_discarded)) {
|
||||
tint_symbol_4 = tint_atomicAdd(a, 0u, 1);
|
||||
}
|
||||
i = tint_symbol_4;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
tint_symbol_3 foo(tint_symbol_2 tint_symbol_1) {
|
||||
const int inner_result = foo_inner(tint_symbol_1.tint_symbol, tint_symbol_1.coord);
|
||||
tint_symbol_3 wrapper_result = (tint_symbol_3)0;
|
||||
wrapper_result.value = inner_result;
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return wrapper_result;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
static bool tint_discarded = false;
|
||||
Texture2D<float4> t : register(t0, space0);
|
||||
SamplerState s : register(s1, space0);
|
||||
RWByteAddressBuffer a : register(u2, space0);
|
||||
|
||||
struct tint_symbol_2 {
|
||||
float tint_symbol : TEXCOORD0;
|
||||
float2 coord : TEXCOORD1;
|
||||
};
|
||||
struct tint_symbol_3 {
|
||||
int value : SV_Target0;
|
||||
};
|
||||
|
||||
int tint_atomicAdd(RWByteAddressBuffer buffer, uint offset, int value) {
|
||||
int original_value = 0;
|
||||
buffer.InterlockedAdd(offset, value, original_value);
|
||||
return original_value;
|
||||
}
|
||||
|
||||
|
||||
int foo_inner(float tint_symbol, float2 coord) {
|
||||
if ((tint_symbol == 0.0f)) {
|
||||
tint_discarded = true;
|
||||
}
|
||||
int result = int(t.Sample(s, coord).x);
|
||||
{
|
||||
int i = 0;
|
||||
while (true) {
|
||||
if (!((i < 10))) {
|
||||
break;
|
||||
}
|
||||
{
|
||||
result = (result + i);
|
||||
}
|
||||
{
|
||||
int tint_symbol_4 = 0;
|
||||
if (!(tint_discarded)) {
|
||||
tint_symbol_4 = tint_atomicAdd(a, 0u, 1);
|
||||
}
|
||||
i = tint_symbol_4;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
tint_symbol_3 foo(tint_symbol_2 tint_symbol_1) {
|
||||
const int inner_result = foo_inner(tint_symbol_1.tint_symbol, tint_symbol_1.coord);
|
||||
tint_symbol_3 wrapper_result = (tint_symbol_3)0;
|
||||
wrapper_result.value = inner_result;
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return wrapper_result;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
bool tint_discarded = false;
|
||||
layout(location = 0) in float tint_symbol_1;
|
||||
layout(location = 1) in vec2 coord_1;
|
||||
layout(location = 0) out int value;
|
||||
layout(binding = 2, std430) buffer a_block_ssbo {
|
||||
int inner;
|
||||
} a;
|
||||
|
||||
uniform highp sampler2D t_s;
|
||||
|
||||
int foo(float tint_symbol, vec2 coord) {
|
||||
if ((tint_symbol == 0.0f)) {
|
||||
tint_discarded = true;
|
||||
}
|
||||
int result = int(texture(t_s, coord).x);
|
||||
{
|
||||
int i = 0;
|
||||
while (true) {
|
||||
if (!((i < 10))) {
|
||||
break;
|
||||
}
|
||||
{
|
||||
result = (result + i);
|
||||
}
|
||||
{
|
||||
int tint_symbol_2 = 0;
|
||||
if (!(tint_discarded)) {
|
||||
tint_symbol_2 = atomicAdd(a.inner, 1);
|
||||
}
|
||||
i = tint_symbol_2;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void main() {
|
||||
int inner_result = foo(tint_symbol_1, coord_1);
|
||||
value = inner_result;
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol_1 {
|
||||
float in [[user(locn0)]];
|
||||
float2 coord [[user(locn1)]];
|
||||
};
|
||||
|
||||
struct tint_symbol_2 {
|
||||
int value [[color(0)]];
|
||||
};
|
||||
|
||||
int foo_inner(float in, float2 coord, thread bool* const tint_symbol_4, texture2d<float, access::sample> tint_symbol_5, sampler tint_symbol_6, device atomic_int* const tint_symbol_7) {
|
||||
if ((in == 0.0f)) {
|
||||
*(tint_symbol_4) = true;
|
||||
}
|
||||
int result = int(tint_symbol_5.sample(tint_symbol_6, coord)[0]);
|
||||
{
|
||||
int i = 0;
|
||||
while (true) {
|
||||
if (!((i < 10))) {
|
||||
break;
|
||||
}
|
||||
{
|
||||
result = as_type<int>((as_type<uint>(result) + as_type<uint>(i)));
|
||||
}
|
||||
{
|
||||
int tint_symbol_3 = 0;
|
||||
if (!(*(tint_symbol_4))) {
|
||||
tint_symbol_3 = atomic_fetch_add_explicit(tint_symbol_7, 1, memory_order_relaxed);
|
||||
}
|
||||
i = tint_symbol_3;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
fragment tint_symbol_2 foo(texture2d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]], device atomic_int* tint_symbol_11 [[buffer(0)]], tint_symbol_1 tint_symbol [[stage_in]]) {
|
||||
thread bool tint_symbol_8 = false;
|
||||
int const inner_result = foo_inner(tint_symbol.in, tint_symbol.coord, &(tint_symbol_8), tint_symbol_9, tint_symbol_10, tint_symbol_11);
|
||||
tint_symbol_2 wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
if (tint_symbol_8) {
|
||||
discard_fragment();
|
||||
}
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 83
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %foo "foo" %in_1 %coord_1 %value
|
||||
OpExecutionMode %foo OriginUpperLeft
|
||||
OpName %tint_discarded "tint_discarded"
|
||||
OpName %in_1 "in_1"
|
||||
OpName %coord_1 "coord_1"
|
||||
OpName %value "value"
|
||||
OpName %t "t"
|
||||
OpName %s "s"
|
||||
OpName %a_block "a_block"
|
||||
OpMemberName %a_block 0 "inner"
|
||||
OpName %a "a"
|
||||
OpName %foo_inner "foo_inner"
|
||||
OpName %in "in"
|
||||
OpName %coord "coord"
|
||||
OpName %result "result"
|
||||
OpName %i "i"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %foo "foo"
|
||||
OpDecorate %in_1 Location 0
|
||||
OpDecorate %coord_1 Location 1
|
||||
OpDecorate %value Location 0
|
||||
OpDecorate %t DescriptorSet 0
|
||||
OpDecorate %t Binding 0
|
||||
OpDecorate %s DescriptorSet 0
|
||||
OpDecorate %s Binding 1
|
||||
OpDecorate %a_block Block
|
||||
OpMemberDecorate %a_block 0 Offset 0
|
||||
OpDecorate %a DescriptorSet 0
|
||||
OpDecorate %a Binding 2
|
||||
%bool = OpTypeBool
|
||||
%2 = OpConstantNull %bool
|
||||
%_ptr_Private_bool = OpTypePointer Private %bool
|
||||
%tint_discarded = OpVariable %_ptr_Private_bool Private %2
|
||||
%float = OpTypeFloat 32
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%in_1 = OpVariable %_ptr_Input_float Input
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Input_v2float = OpTypePointer Input %v2float
|
||||
%coord_1 = OpVariable %_ptr_Input_v2float Input
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Output_int = OpTypePointer Output %int
|
||||
%14 = OpConstantNull %int
|
||||
%value = OpVariable %_ptr_Output_int Output %14
|
||||
%17 = OpTypeImage %float 2D 0 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_17 = OpTypePointer UniformConstant %17
|
||||
%t = OpVariable %_ptr_UniformConstant_17 UniformConstant
|
||||
%20 = OpTypeSampler
|
||||
%_ptr_UniformConstant_20 = OpTypePointer UniformConstant %20
|
||||
%s = OpVariable %_ptr_UniformConstant_20 UniformConstant
|
||||
%a_block = OpTypeStruct %int
|
||||
%_ptr_StorageBuffer_a_block = OpTypePointer StorageBuffer %a_block
|
||||
%a = OpVariable %_ptr_StorageBuffer_a_block StorageBuffer
|
||||
%24 = OpTypeFunction %int %float %v2float
|
||||
%29 = OpConstantNull %float
|
||||
%true = OpConstantTrue %bool
|
||||
%v4float = OpTypeVector %float 4
|
||||
%39 = OpTypeSampledImage %17
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_10 = OpConstant %int 10
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
|
||||
%int_1 = OpConstant %int 1
|
||||
%void = OpTypeVoid
|
||||
%73 = OpTypeFunction %void
|
||||
%foo_inner = OpFunction %int None %24
|
||||
%in = OpFunctionParameter %float
|
||||
%coord = OpFunctionParameter %v2float
|
||||
%28 = OpLabel
|
||||
%result = OpVariable %_ptr_Function_int Function %14
|
||||
%i = OpVariable %_ptr_Function_int Function %14
|
||||
%tint_symbol = OpVariable %_ptr_Function_int Function %14
|
||||
%30 = OpFOrdEqual %bool %in %29
|
||||
OpSelectionMerge %31 None
|
||||
OpBranchConditional %30 %32 %31
|
||||
%32 = OpLabel
|
||||
OpStore %tint_discarded %true
|
||||
OpBranch %31
|
||||
%31 = OpLabel
|
||||
%37 = OpLoad %20 %s
|
||||
%38 = OpLoad %17 %t
|
||||
%40 = OpSampledImage %39 %38 %37
|
||||
%35 = OpImageSampleImplicitLod %v4float %40 %coord
|
||||
%41 = OpCompositeExtract %float %35 0
|
||||
%34 = OpConvertFToS %int %41
|
||||
OpStore %result %34
|
||||
OpStore %i %14
|
||||
OpBranch %45
|
||||
%45 = OpLabel
|
||||
OpLoopMerge %46 %47 None
|
||||
OpBranch %48
|
||||
%48 = OpLabel
|
||||
%50 = OpLoad %int %i
|
||||
%52 = OpSLessThan %bool %50 %int_10
|
||||
%49 = OpLogicalNot %bool %52
|
||||
OpSelectionMerge %53 None
|
||||
OpBranchConditional %49 %54 %53
|
||||
%54 = OpLabel
|
||||
OpBranch %46
|
||||
%53 = OpLabel
|
||||
%55 = OpLoad %int %result
|
||||
%56 = OpLoad %int %i
|
||||
%57 = OpIAdd %int %55 %56
|
||||
OpStore %result %57
|
||||
OpBranch %47
|
||||
%47 = OpLabel
|
||||
%60 = OpLoad %bool %tint_discarded
|
||||
%59 = OpLogicalNot %bool %60
|
||||
OpSelectionMerge %61 None
|
||||
OpBranchConditional %59 %62 %61
|
||||
%62 = OpLabel
|
||||
%69 = OpAccessChain %_ptr_StorageBuffer_int %a %uint_0
|
||||
%63 = OpAtomicIAdd %int %69 %uint_1 %uint_0 %int_1
|
||||
OpStore %tint_symbol %63
|
||||
OpBranch %61
|
||||
%61 = OpLabel
|
||||
%71 = OpLoad %int %tint_symbol
|
||||
OpStore %i %71
|
||||
OpBranch %45
|
||||
%46 = OpLabel
|
||||
%72 = OpLoad %int %result
|
||||
OpReturnValue %72
|
||||
OpFunctionEnd
|
||||
%foo = OpFunction %void None %73
|
||||
%76 = OpLabel
|
||||
%78 = OpLoad %float %in_1
|
||||
%79 = OpLoad %v2float %coord_1
|
||||
%77 = OpFunctionCall %int %foo_inner %78 %79
|
||||
OpStore %value %77
|
||||
%80 = OpLoad %bool %tint_discarded
|
||||
OpSelectionMerge %81 None
|
||||
OpBranchConditional %80 %82 %81
|
||||
%82 = OpLabel
|
||||
OpKill
|
||||
%81 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,17 @@
|
||||
@group(0) @binding(0) var t : texture_2d<f32>;
|
||||
|
||||
@group(0) @binding(1) var s : sampler;
|
||||
|
||||
@group(0) @binding(2) var<storage, read_write> a : atomic<i32>;
|
||||
|
||||
@fragment
|
||||
fn foo(@location(0) in : f32, @location(1) coord : vec2<f32>) -> @location(0) i32 {
|
||||
if ((in == 0.0)) {
|
||||
discard;
|
||||
}
|
||||
var result = i32(textureSample(t, s, coord).x);
|
||||
for(var i = 0; (i < 10); i = atomicAdd(&(a), 1)) {
|
||||
result += i;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
19
test/tint/statements/discard/helper_functions.wgsl
Normal file
19
test/tint/statements/discard/helper_functions.wgsl
Normal file
@@ -0,0 +1,19 @@
|
||||
@group(0) @binding(0) var<storage, read_write> non_uniform_global : i32;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> output : f32;
|
||||
|
||||
fn foo() {
|
||||
if (non_uniform_global < 0) {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
|
||||
fn bar() {
|
||||
output = dpdx(1.0);
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn main() {
|
||||
foo();
|
||||
bar();
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
static bool tint_discarded = false;
|
||||
RWByteAddressBuffer non_uniform_global : register(u0, space0);
|
||||
RWByteAddressBuffer output : register(u1, space0);
|
||||
|
||||
void foo() {
|
||||
if ((asint(non_uniform_global.Load(0u)) < 0)) {
|
||||
tint_discarded = true;
|
||||
}
|
||||
}
|
||||
|
||||
void bar() {
|
||||
if (!(tint_discarded)) {
|
||||
output.Store(0u, asuint(ddx(1.0f)));
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
foo();
|
||||
bar();
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
static bool tint_discarded = false;
|
||||
RWByteAddressBuffer non_uniform_global : register(u0, space0);
|
||||
RWByteAddressBuffer output : register(u1, space0);
|
||||
|
||||
void foo() {
|
||||
if ((asint(non_uniform_global.Load(0u)) < 0)) {
|
||||
tint_discarded = true;
|
||||
}
|
||||
}
|
||||
|
||||
void bar() {
|
||||
if (!(tint_discarded)) {
|
||||
output.Store(0u, asuint(ddx(1.0f)));
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
foo();
|
||||
bar();
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
bool tint_discarded = false;
|
||||
layout(binding = 0, std430) buffer non_uniform_global_block_ssbo {
|
||||
int inner;
|
||||
} non_uniform_global;
|
||||
|
||||
layout(binding = 1, std430) buffer tint_symbol_block_ssbo {
|
||||
float inner;
|
||||
} tint_symbol;
|
||||
|
||||
void foo() {
|
||||
if ((non_uniform_global.inner < 0)) {
|
||||
tint_discarded = true;
|
||||
}
|
||||
}
|
||||
|
||||
void bar() {
|
||||
if (!(tint_discarded)) {
|
||||
tint_symbol.inner = dFdx(1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void tint_symbol_1() {
|
||||
foo();
|
||||
bar();
|
||||
}
|
||||
|
||||
void main() {
|
||||
tint_symbol_1();
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
void foo(device int* const tint_symbol_1, thread bool* const tint_symbol_2) {
|
||||
if ((*(tint_symbol_1) < 0)) {
|
||||
*(tint_symbol_2) = true;
|
||||
}
|
||||
}
|
||||
|
||||
void bar(thread bool* const tint_symbol_3, device float* const tint_symbol_4) {
|
||||
if (!(*(tint_symbol_3))) {
|
||||
*(tint_symbol_4) = dfdx(1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
fragment void tint_symbol(device int* tint_symbol_5 [[buffer(0)]], device float* tint_symbol_7 [[buffer(1)]]) {
|
||||
thread bool tint_symbol_6 = false;
|
||||
foo(tint_symbol_5, &(tint_symbol_6));
|
||||
bar(&(tint_symbol_6), tint_symbol_7);
|
||||
if (tint_symbol_6) {
|
||||
discard_fragment();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 44
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main"
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %tint_discarded "tint_discarded"
|
||||
OpName %non_uniform_global_block "non_uniform_global_block"
|
||||
OpMemberName %non_uniform_global_block 0 "inner"
|
||||
OpName %non_uniform_global "non_uniform_global"
|
||||
OpName %output_block "output_block"
|
||||
OpMemberName %output_block 0 "inner"
|
||||
OpName %output "output"
|
||||
OpName %foo "foo"
|
||||
OpName %bar "bar"
|
||||
OpName %main "main"
|
||||
OpDecorate %non_uniform_global_block Block
|
||||
OpMemberDecorate %non_uniform_global_block 0 Offset 0
|
||||
OpDecorate %non_uniform_global DescriptorSet 0
|
||||
OpDecorate %non_uniform_global Binding 0
|
||||
OpDecorate %output_block Block
|
||||
OpMemberDecorate %output_block 0 Offset 0
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 1
|
||||
%bool = OpTypeBool
|
||||
%2 = OpConstantNull %bool
|
||||
%_ptr_Private_bool = OpTypePointer Private %bool
|
||||
%tint_discarded = OpVariable %_ptr_Private_bool Private %2
|
||||
%int = OpTypeInt 32 1
|
||||
%non_uniform_global_block = OpTypeStruct %int
|
||||
%_ptr_StorageBuffer_non_uniform_global_block = OpTypePointer StorageBuffer %non_uniform_global_block
|
||||
%non_uniform_global = OpVariable %_ptr_StorageBuffer_non_uniform_global_block StorageBuffer
|
||||
%float = OpTypeFloat 32
|
||||
%output_block = OpTypeStruct %float
|
||||
%_ptr_StorageBuffer_output_block = OpTypePointer StorageBuffer %output_block
|
||||
%output = OpVariable %_ptr_StorageBuffer_output_block StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%13 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
|
||||
%22 = OpConstantNull %int
|
||||
%true = OpConstantTrue %bool
|
||||
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%foo = OpFunction %void None %13
|
||||
%16 = OpLabel
|
||||
%20 = OpAccessChain %_ptr_StorageBuffer_int %non_uniform_global %uint_0
|
||||
%21 = OpLoad %int %20
|
||||
%23 = OpSLessThan %bool %21 %22
|
||||
OpSelectionMerge %24 None
|
||||
OpBranchConditional %23 %25 %24
|
||||
%25 = OpLabel
|
||||
OpStore %tint_discarded %true
|
||||
OpBranch %24
|
||||
%24 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%bar = OpFunction %void None %13
|
||||
%28 = OpLabel
|
||||
%30 = OpLoad %bool %tint_discarded
|
||||
%29 = OpLogicalNot %bool %30
|
||||
OpSelectionMerge %31 None
|
||||
OpBranchConditional %29 %32 %31
|
||||
%32 = OpLabel
|
||||
%34 = OpAccessChain %_ptr_StorageBuffer_float %output %uint_0
|
||||
%35 = OpDPdx %float %float_1
|
||||
OpStore %34 %35
|
||||
OpBranch %31
|
||||
%31 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %13
|
||||
%38 = OpLabel
|
||||
%39 = OpFunctionCall %void %foo
|
||||
%40 = OpFunctionCall %void %bar
|
||||
%41 = OpLoad %bool %tint_discarded
|
||||
OpSelectionMerge %42 None
|
||||
OpBranchConditional %41 %43 %42
|
||||
%43 = OpLabel
|
||||
OpKill
|
||||
%42 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,19 @@
|
||||
@group(0) @binding(0) var<storage, read_write> non_uniform_global : i32;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> output : f32;
|
||||
|
||||
fn foo() {
|
||||
if ((non_uniform_global < 0)) {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
|
||||
fn bar() {
|
||||
output = dpdx(1.0);
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn main() {
|
||||
foo();
|
||||
bar();
|
||||
}
|
||||
26
test/tint/statements/discard/multiple_returns.wgsl
Normal file
26
test/tint/statements/discard/multiple_returns.wgsl
Normal file
@@ -0,0 +1,26 @@
|
||||
@group(0) @binding(0) var<storage, read_write> non_uniform_global : i32;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> output : f32;
|
||||
|
||||
@fragment
|
||||
fn main() {
|
||||
if (non_uniform_global < 0) {
|
||||
discard;
|
||||
}
|
||||
output = dpdx(1.0);
|
||||
if (output < 0) {
|
||||
var i = 0;
|
||||
loop {
|
||||
if (output > f32(i)) {
|
||||
output = f32(i);
|
||||
return;
|
||||
}
|
||||
continuing {
|
||||
i++;
|
||||
break if i == 5;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
static bool tint_discarded = false;
|
||||
RWByteAddressBuffer non_uniform_global : register(u0, space0);
|
||||
RWByteAddressBuffer output : register(u1, space0);
|
||||
|
||||
void main() {
|
||||
if ((asint(non_uniform_global.Load(0u)) < 0)) {
|
||||
tint_discarded = true;
|
||||
}
|
||||
if (!(tint_discarded)) {
|
||||
output.Store(0u, asuint(ddx(1.0f)));
|
||||
}
|
||||
if ((asfloat(output.Load(0u)) < 0.0f)) {
|
||||
int i = 0;
|
||||
while (true) {
|
||||
if ((asfloat(output.Load(0u)) > float(i))) {
|
||||
if (!(tint_discarded)) {
|
||||
output.Store(0u, asuint(float(i)));
|
||||
}
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
{
|
||||
i = (i + 1);
|
||||
if ((i == 5)) { break; }
|
||||
}
|
||||
}
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
static bool tint_discarded = false;
|
||||
RWByteAddressBuffer non_uniform_global : register(u0, space0);
|
||||
RWByteAddressBuffer output : register(u1, space0);
|
||||
|
||||
void main() {
|
||||
if ((asint(non_uniform_global.Load(0u)) < 0)) {
|
||||
tint_discarded = true;
|
||||
}
|
||||
if (!(tint_discarded)) {
|
||||
output.Store(0u, asuint(ddx(1.0f)));
|
||||
}
|
||||
if ((asfloat(output.Load(0u)) < 0.0f)) {
|
||||
int i = 0;
|
||||
while (true) {
|
||||
if ((asfloat(output.Load(0u)) > float(i))) {
|
||||
if (!(tint_discarded)) {
|
||||
output.Store(0u, asuint(float(i)));
|
||||
}
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
{
|
||||
i = (i + 1);
|
||||
if ((i == 5)) { break; }
|
||||
}
|
||||
}
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
bool tint_discarded = false;
|
||||
layout(binding = 0, std430) buffer non_uniform_global_block_ssbo {
|
||||
int inner;
|
||||
} non_uniform_global;
|
||||
|
||||
layout(binding = 1, std430) buffer tint_symbol_block_ssbo {
|
||||
float inner;
|
||||
} tint_symbol;
|
||||
|
||||
void tint_symbol_1() {
|
||||
if ((non_uniform_global.inner < 0)) {
|
||||
tint_discarded = true;
|
||||
}
|
||||
if (!(tint_discarded)) {
|
||||
tint_symbol.inner = dFdx(1.0f);
|
||||
}
|
||||
if ((tint_symbol.inner < 0.0f)) {
|
||||
int i = 0;
|
||||
while (true) {
|
||||
if ((tint_symbol.inner > float(i))) {
|
||||
if (!(tint_discarded)) {
|
||||
tint_symbol.inner = float(i);
|
||||
}
|
||||
return;
|
||||
}
|
||||
{
|
||||
i = (i + 1);
|
||||
if ((i == 5)) { break; }
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void main() {
|
||||
tint_symbol_1();
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
fragment void tint_symbol(device int* tint_symbol_1 [[buffer(0)]], device float* tint_symbol_3 [[buffer(1)]]) {
|
||||
thread bool tint_symbol_2 = false;
|
||||
if ((*(tint_symbol_1) < 0)) {
|
||||
tint_symbol_2 = true;
|
||||
}
|
||||
if (!(tint_symbol_2)) {
|
||||
*(tint_symbol_3) = dfdx(1.0f);
|
||||
}
|
||||
if ((*(tint_symbol_3) < 0.0f)) {
|
||||
int i = 0;
|
||||
while (true) {
|
||||
if ((*(tint_symbol_3) > float(i))) {
|
||||
if (!(tint_symbol_2)) {
|
||||
*(tint_symbol_3) = float(i);
|
||||
}
|
||||
if (tint_symbol_2) {
|
||||
discard_fragment();
|
||||
}
|
||||
return;
|
||||
}
|
||||
{
|
||||
i = as_type<int>((as_type<uint>(i) + as_type<uint>(1)));
|
||||
if ((i == 5)) { break; }
|
||||
}
|
||||
}
|
||||
if (tint_symbol_2) {
|
||||
discard_fragment();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (tint_symbol_2) {
|
||||
discard_fragment();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 76
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main"
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %tint_discarded "tint_discarded"
|
||||
OpName %non_uniform_global_block "non_uniform_global_block"
|
||||
OpMemberName %non_uniform_global_block 0 "inner"
|
||||
OpName %non_uniform_global "non_uniform_global"
|
||||
OpName %output_block "output_block"
|
||||
OpMemberName %output_block 0 "inner"
|
||||
OpName %output "output"
|
||||
OpName %main "main"
|
||||
OpName %i "i"
|
||||
OpDecorate %non_uniform_global_block Block
|
||||
OpMemberDecorate %non_uniform_global_block 0 Offset 0
|
||||
OpDecorate %non_uniform_global DescriptorSet 0
|
||||
OpDecorate %non_uniform_global Binding 0
|
||||
OpDecorate %output_block Block
|
||||
OpMemberDecorate %output_block 0 Offset 0
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 1
|
||||
%bool = OpTypeBool
|
||||
%2 = OpConstantNull %bool
|
||||
%_ptr_Private_bool = OpTypePointer Private %bool
|
||||
%tint_discarded = OpVariable %_ptr_Private_bool Private %2
|
||||
%int = OpTypeInt 32 1
|
||||
%non_uniform_global_block = OpTypeStruct %int
|
||||
%_ptr_StorageBuffer_non_uniform_global_block = OpTypePointer StorageBuffer %non_uniform_global_block
|
||||
%non_uniform_global = OpVariable %_ptr_StorageBuffer_non_uniform_global_block StorageBuffer
|
||||
%float = OpTypeFloat 32
|
||||
%output_block = OpTypeStruct %float
|
||||
%_ptr_StorageBuffer_output_block = OpTypePointer StorageBuffer %output_block
|
||||
%output = OpVariable %_ptr_StorageBuffer_output_block StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%13 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
|
||||
%22 = OpConstantNull %int
|
||||
%true = OpConstantTrue %bool
|
||||
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%37 = OpConstantNull %float
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_1 = OpConstant %int 1
|
||||
%int_5 = OpConstant %int 5
|
||||
%main = OpFunction %void None %13
|
||||
%16 = OpLabel
|
||||
%i = OpVariable %_ptr_Function_int Function %22
|
||||
%20 = OpAccessChain %_ptr_StorageBuffer_int %non_uniform_global %uint_0
|
||||
%21 = OpLoad %int %20
|
||||
%23 = OpSLessThan %bool %21 %22
|
||||
OpSelectionMerge %24 None
|
||||
OpBranchConditional %23 %25 %24
|
||||
%25 = OpLabel
|
||||
OpStore %tint_discarded %true
|
||||
OpBranch %24
|
||||
%24 = OpLabel
|
||||
%28 = OpLoad %bool %tint_discarded
|
||||
%27 = OpLogicalNot %bool %28
|
||||
OpSelectionMerge %29 None
|
||||
OpBranchConditional %27 %30 %29
|
||||
%30 = OpLabel
|
||||
%32 = OpAccessChain %_ptr_StorageBuffer_float %output %uint_0
|
||||
%33 = OpDPdx %float %float_1
|
||||
OpStore %32 %33
|
||||
OpBranch %29
|
||||
%29 = OpLabel
|
||||
%35 = OpAccessChain %_ptr_StorageBuffer_float %output %uint_0
|
||||
%36 = OpLoad %float %35
|
||||
%38 = OpFOrdLessThan %bool %36 %37
|
||||
OpSelectionMerge %39 None
|
||||
OpBranchConditional %38 %40 %39
|
||||
%40 = OpLabel
|
||||
OpStore %i %22
|
||||
OpBranch %43
|
||||
%43 = OpLabel
|
||||
OpLoopMerge %44 %45 None
|
||||
OpBranch %46
|
||||
%46 = OpLabel
|
||||
%47 = OpAccessChain %_ptr_StorageBuffer_float %output %uint_0
|
||||
%48 = OpLoad %float %47
|
||||
%50 = OpLoad %int %i
|
||||
%49 = OpConvertSToF %float %50
|
||||
%51 = OpFOrdGreaterThan %bool %48 %49
|
||||
OpSelectionMerge %52 None
|
||||
OpBranchConditional %51 %53 %52
|
||||
%53 = OpLabel
|
||||
%55 = OpLoad %bool %tint_discarded
|
||||
%54 = OpLogicalNot %bool %55
|
||||
OpSelectionMerge %56 None
|
||||
OpBranchConditional %54 %57 %56
|
||||
%57 = OpLabel
|
||||
%58 = OpAccessChain %_ptr_StorageBuffer_float %output %uint_0
|
||||
%60 = OpLoad %int %i
|
||||
%59 = OpConvertSToF %float %60
|
||||
OpStore %58 %59
|
||||
OpBranch %56
|
||||
%56 = OpLabel
|
||||
%61 = OpLoad %bool %tint_discarded
|
||||
OpSelectionMerge %62 None
|
||||
OpBranchConditional %61 %63 %62
|
||||
%63 = OpLabel
|
||||
OpKill
|
||||
%62 = OpLabel
|
||||
OpReturn
|
||||
%52 = OpLabel
|
||||
OpBranch %45
|
||||
%45 = OpLabel
|
||||
%64 = OpLoad %int %i
|
||||
%66 = OpIAdd %int %64 %int_1
|
||||
OpStore %i %66
|
||||
%67 = OpLoad %int %i
|
||||
%69 = OpIEqual %bool %67 %int_5
|
||||
OpBranchConditional %69 %44 %43
|
||||
%44 = OpLabel
|
||||
%70 = OpLoad %bool %tint_discarded
|
||||
OpSelectionMerge %71 None
|
||||
OpBranchConditional %70 %72 %71
|
||||
%72 = OpLabel
|
||||
OpKill
|
||||
%71 = OpLabel
|
||||
OpReturn
|
||||
%39 = OpLabel
|
||||
%73 = OpLoad %bool %tint_discarded
|
||||
OpSelectionMerge %74 None
|
||||
OpBranchConditional %73 %75 %74
|
||||
%75 = OpLabel
|
||||
OpKill
|
||||
%74 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,27 @@
|
||||
@group(0) @binding(0) var<storage, read_write> non_uniform_global : i32;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> output : f32;
|
||||
|
||||
@fragment
|
||||
fn main() {
|
||||
if ((non_uniform_global < 0)) {
|
||||
discard;
|
||||
}
|
||||
output = dpdx(1.0);
|
||||
if ((output < 0)) {
|
||||
var i = 0;
|
||||
loop {
|
||||
if ((output > f32(i))) {
|
||||
output = f32(i);
|
||||
return;
|
||||
}
|
||||
|
||||
continuing {
|
||||
i++;
|
||||
break if (i == 5);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
13
test/tint/statements/discard/nested_return.wgsl
Normal file
13
test/tint/statements/discard/nested_return.wgsl
Normal file
@@ -0,0 +1,13 @@
|
||||
@group(0) @binding(0) var<storage, read_write> non_uniform_global : i32;
|
||||
|
||||
@fragment
|
||||
fn main() {
|
||||
if (non_uniform_global < 0) {
|
||||
discard;
|
||||
}
|
||||
{
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
static bool tint_discarded = false;
|
||||
RWByteAddressBuffer non_uniform_global : register(u0, space0);
|
||||
|
||||
void main() {
|
||||
if ((asint(non_uniform_global.Load(0u)) < 0)) {
|
||||
tint_discarded = true;
|
||||
}
|
||||
{
|
||||
{
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
static bool tint_discarded = false;
|
||||
RWByteAddressBuffer non_uniform_global : register(u0, space0);
|
||||
|
||||
void main() {
|
||||
if ((asint(non_uniform_global.Load(0u)) < 0)) {
|
||||
tint_discarded = true;
|
||||
}
|
||||
{
|
||||
{
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
bool tint_discarded = false;
|
||||
layout(binding = 0, std430) buffer non_uniform_global_block_ssbo {
|
||||
int inner;
|
||||
} non_uniform_global;
|
||||
|
||||
void tint_symbol() {
|
||||
if ((non_uniform_global.inner < 0)) {
|
||||
tint_discarded = true;
|
||||
}
|
||||
{
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
tint_symbol();
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
19
test/tint/statements/discard/nested_return.wgsl.expected.msl
Normal file
19
test/tint/statements/discard/nested_return.wgsl.expected.msl
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
fragment void tint_symbol(device int* tint_symbol_1 [[buffer(0)]]) {
|
||||
thread bool tint_symbol_2 = false;
|
||||
if ((*(tint_symbol_1) < 0)) {
|
||||
tint_symbol_2 = true;
|
||||
}
|
||||
{
|
||||
{
|
||||
if (tint_symbol_2) {
|
||||
discard_fragment();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 26
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main"
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %tint_discarded "tint_discarded"
|
||||
OpName %non_uniform_global_block "non_uniform_global_block"
|
||||
OpMemberName %non_uniform_global_block 0 "inner"
|
||||
OpName %non_uniform_global "non_uniform_global"
|
||||
OpName %main "main"
|
||||
OpDecorate %non_uniform_global_block Block
|
||||
OpMemberDecorate %non_uniform_global_block 0 Offset 0
|
||||
OpDecorate %non_uniform_global DescriptorSet 0
|
||||
OpDecorate %non_uniform_global Binding 0
|
||||
%bool = OpTypeBool
|
||||
%2 = OpConstantNull %bool
|
||||
%_ptr_Private_bool = OpTypePointer Private %bool
|
||||
%tint_discarded = OpVariable %_ptr_Private_bool Private %2
|
||||
%int = OpTypeInt 32 1
|
||||
%non_uniform_global_block = OpTypeStruct %int
|
||||
%_ptr_StorageBuffer_non_uniform_global_block = OpTypePointer StorageBuffer %non_uniform_global_block
|
||||
%non_uniform_global = OpVariable %_ptr_StorageBuffer_non_uniform_global_block StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%9 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
|
||||
%18 = OpConstantNull %int
|
||||
%true = OpConstantTrue %bool
|
||||
%main = OpFunction %void None %9
|
||||
%12 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_StorageBuffer_int %non_uniform_global %uint_0
|
||||
%17 = OpLoad %int %16
|
||||
%19 = OpSLessThan %bool %17 %18
|
||||
OpSelectionMerge %20 None
|
||||
OpBranchConditional %19 %21 %20
|
||||
%21 = OpLabel
|
||||
OpStore %tint_discarded %true
|
||||
OpBranch %20
|
||||
%20 = OpLabel
|
||||
%23 = OpLoad %bool %tint_discarded
|
||||
OpSelectionMerge %24 None
|
||||
OpBranchConditional %23 %25 %24
|
||||
%25 = OpLabel
|
||||
OpKill
|
||||
%24 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,13 @@
|
||||
@group(0) @binding(0) var<storage, read_write> non_uniform_global : i32;
|
||||
|
||||
@fragment
|
||||
fn main() {
|
||||
if ((non_uniform_global < 0)) {
|
||||
discard;
|
||||
}
|
||||
{
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
test/tint/statements/discard/non_uniform.wgsl
Normal file
11
test/tint/statements/discard/non_uniform.wgsl
Normal file
@@ -0,0 +1,11 @@
|
||||
@group(0) @binding(0) var<storage, read_write> non_uniform_global : i32;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> output : f32;
|
||||
|
||||
@fragment
|
||||
fn main() {
|
||||
if (non_uniform_global < 0) {
|
||||
discard;
|
||||
}
|
||||
output = dpdx(1.0);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
static bool tint_discarded = false;
|
||||
RWByteAddressBuffer non_uniform_global : register(u0, space0);
|
||||
RWByteAddressBuffer output : register(u1, space0);
|
||||
|
||||
void main() {
|
||||
if ((asint(non_uniform_global.Load(0u)) < 0)) {
|
||||
tint_discarded = true;
|
||||
}
|
||||
if (!(tint_discarded)) {
|
||||
output.Store(0u, asuint(ddx(1.0f)));
|
||||
}
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
static bool tint_discarded = false;
|
||||
RWByteAddressBuffer non_uniform_global : register(u0, space0);
|
||||
RWByteAddressBuffer output : register(u1, space0);
|
||||
|
||||
void main() {
|
||||
if ((asint(non_uniform_global.Load(0u)) < 0)) {
|
||||
tint_discarded = true;
|
||||
}
|
||||
if (!(tint_discarded)) {
|
||||
output.Store(0u, asuint(ddx(1.0f)));
|
||||
}
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
28
test/tint/statements/discard/non_uniform.wgsl.expected.glsl
Normal file
28
test/tint/statements/discard/non_uniform.wgsl.expected.glsl
Normal file
@@ -0,0 +1,28 @@
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
bool tint_discarded = false;
|
||||
layout(binding = 0, std430) buffer non_uniform_global_block_ssbo {
|
||||
int inner;
|
||||
} non_uniform_global;
|
||||
|
||||
layout(binding = 1, std430) buffer tint_symbol_block_ssbo {
|
||||
float inner;
|
||||
} tint_symbol;
|
||||
|
||||
void tint_symbol_1() {
|
||||
if ((non_uniform_global.inner < 0)) {
|
||||
tint_discarded = true;
|
||||
}
|
||||
if (!(tint_discarded)) {
|
||||
tint_symbol.inner = dFdx(1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
tint_symbol_1();
|
||||
if (tint_discarded) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
17
test/tint/statements/discard/non_uniform.wgsl.expected.msl
Normal file
17
test/tint/statements/discard/non_uniform.wgsl.expected.msl
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
fragment void tint_symbol(device int* tint_symbol_1 [[buffer(0)]], device float* tint_symbol_3 [[buffer(1)]]) {
|
||||
thread bool tint_symbol_2 = false;
|
||||
if ((*(tint_symbol_1) < 0)) {
|
||||
tint_symbol_2 = true;
|
||||
}
|
||||
if (!(tint_symbol_2)) {
|
||||
*(tint_symbol_3) = dfdx(1.0f);
|
||||
}
|
||||
if (tint_symbol_2) {
|
||||
discard_fragment();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 38
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main"
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %tint_discarded "tint_discarded"
|
||||
OpName %non_uniform_global_block "non_uniform_global_block"
|
||||
OpMemberName %non_uniform_global_block 0 "inner"
|
||||
OpName %non_uniform_global "non_uniform_global"
|
||||
OpName %output_block "output_block"
|
||||
OpMemberName %output_block 0 "inner"
|
||||
OpName %output "output"
|
||||
OpName %main "main"
|
||||
OpDecorate %non_uniform_global_block Block
|
||||
OpMemberDecorate %non_uniform_global_block 0 Offset 0
|
||||
OpDecorate %non_uniform_global DescriptorSet 0
|
||||
OpDecorate %non_uniform_global Binding 0
|
||||
OpDecorate %output_block Block
|
||||
OpMemberDecorate %output_block 0 Offset 0
|
||||
OpDecorate %output DescriptorSet 0
|
||||
OpDecorate %output Binding 1
|
||||
%bool = OpTypeBool
|
||||
%2 = OpConstantNull %bool
|
||||
%_ptr_Private_bool = OpTypePointer Private %bool
|
||||
%tint_discarded = OpVariable %_ptr_Private_bool Private %2
|
||||
%int = OpTypeInt 32 1
|
||||
%non_uniform_global_block = OpTypeStruct %int
|
||||
%_ptr_StorageBuffer_non_uniform_global_block = OpTypePointer StorageBuffer %non_uniform_global_block
|
||||
%non_uniform_global = OpVariable %_ptr_StorageBuffer_non_uniform_global_block StorageBuffer
|
||||
%float = OpTypeFloat 32
|
||||
%output_block = OpTypeStruct %float
|
||||
%_ptr_StorageBuffer_output_block = OpTypePointer StorageBuffer %output_block
|
||||
%output = OpVariable %_ptr_StorageBuffer_output_block StorageBuffer
|
||||
%void = OpTypeVoid
|
||||
%13 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
|
||||
%22 = OpConstantNull %int
|
||||
%true = OpConstantTrue %bool
|
||||
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%main = OpFunction %void None %13
|
||||
%16 = OpLabel
|
||||
%20 = OpAccessChain %_ptr_StorageBuffer_int %non_uniform_global %uint_0
|
||||
%21 = OpLoad %int %20
|
||||
%23 = OpSLessThan %bool %21 %22
|
||||
OpSelectionMerge %24 None
|
||||
OpBranchConditional %23 %25 %24
|
||||
%25 = OpLabel
|
||||
OpStore %tint_discarded %true
|
||||
OpBranch %24
|
||||
%24 = OpLabel
|
||||
%28 = OpLoad %bool %tint_discarded
|
||||
%27 = OpLogicalNot %bool %28
|
||||
OpSelectionMerge %29 None
|
||||
OpBranchConditional %27 %30 %29
|
||||
%30 = OpLabel
|
||||
%32 = OpAccessChain %_ptr_StorageBuffer_float %output %uint_0
|
||||
%33 = OpDPdx %float %float_1
|
||||
OpStore %32 %33
|
||||
OpBranch %29
|
||||
%29 = OpLabel
|
||||
%35 = OpLoad %bool %tint_discarded
|
||||
OpSelectionMerge %36 None
|
||||
OpBranchConditional %35 %37 %36
|
||||
%37 = OpLabel
|
||||
OpKill
|
||||
%36 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
11
test/tint/statements/discard/non_uniform.wgsl.expected.wgsl
Normal file
11
test/tint/statements/discard/non_uniform.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,11 @@
|
||||
@group(0) @binding(0) var<storage, read_write> non_uniform_global : i32;
|
||||
|
||||
@group(0) @binding(1) var<storage, read_write> output : f32;
|
||||
|
||||
@fragment
|
||||
fn main() {
|
||||
if ((non_uniform_global < 0)) {
|
||||
discard;
|
||||
}
|
||||
output = dpdx(1.0);
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
; Test: SpvParserCFGTest_EmitBody_Kill_InsideLoop.spvasm
|
||||
; SPIR-V
|
||||
; Version: 1.0
|
||||
; Generator: Khronos SPIR-V Tools Assembler; 0
|
||||
; Bound: 1000
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical Simple
|
||||
OpEntryPoint Fragment %100 "main"
|
||||
OpExecutionMode %100 OriginUpperLeft
|
||||
OpName %var "var"
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%bool = OpTypeBool
|
||||
%5 = OpConstantNull %bool
|
||||
%true = OpConstantTrue %bool
|
||||
%false = OpConstantFalse %bool
|
||||
%uint = OpTypeInt 32 0
|
||||
%int = OpTypeInt 32 1
|
||||
%uint_42 = OpConstant %uint 42
|
||||
%int_42 = OpConstant %int 42
|
||||
%13 = OpTypeFunction %uint
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%uint_5 = OpConstant %uint 5
|
||||
%uint_6 = OpConstant %uint 6
|
||||
%uint_7 = OpConstant %uint 7
|
||||
%uint_8 = OpConstant %uint 8
|
||||
%uint_10 = OpConstant %uint 10
|
||||
%uint_20 = OpConstant %uint 20
|
||||
%uint_30 = OpConstant %uint 30
|
||||
%uint_40 = OpConstant %uint 40
|
||||
%uint_50 = OpConstant %uint 50
|
||||
%uint_90 = OpConstant %uint 90
|
||||
%uint_99 = OpConstant %uint 99
|
||||
%_ptr_Private_uint = OpTypePointer Private %uint
|
||||
%var = OpVariable %_ptr_Private_uint Private
|
||||
%uint_999 = OpConstant %uint 999
|
||||
%100 = OpFunction %void None %3
|
||||
%10 = OpLabel
|
||||
OpBranch %20
|
||||
%20 = OpLabel
|
||||
OpLoopMerge %99 %80 None
|
||||
OpBranchConditional %5 %30 %30
|
||||
%30 = OpLabel
|
||||
OpKill
|
||||
%80 = OpLabel
|
||||
OpBranch %20
|
||||
%99 = OpLabel
|
||||
OpKill
|
||||
OpFunctionEnd
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,958 +0,0 @@
|
||||
struct BST {
|
||||
data : i32,
|
||||
leftIndex : i32,
|
||||
rightIndex : i32,
|
||||
}
|
||||
|
||||
struct buf0 {
|
||||
injectionSwitch : vec2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> x_8 : buf0;
|
||||
|
||||
var<private> gl_FragCoord : vec4<f32>;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var tree : array<BST, 10u>;
|
||||
var x_67 : bool;
|
||||
var x_114 : bool;
|
||||
var x_572 : i32;
|
||||
var x_67_phi : bool;
|
||||
var x_70_phi : i32;
|
||||
var x_116_phi : bool;
|
||||
var x_119_phi : i32;
|
||||
var x_569_phi : i32;
|
||||
var x_572_phi : i32;
|
||||
var x_574_phi : i32;
|
||||
tree[0] = BST(9, -1, -1);
|
||||
switch(0u) {
|
||||
default: {
|
||||
x_67_phi = false;
|
||||
x_70_phi = 0;
|
||||
loop {
|
||||
var x_95 : i32;
|
||||
var x_87 : i32;
|
||||
var x_68 : bool;
|
||||
var x_71 : i32;
|
||||
var x_68_phi : bool;
|
||||
var x_71_phi : i32;
|
||||
x_67 = x_67_phi;
|
||||
let x_70 : i32 = x_70_phi;
|
||||
x_116_phi = x_67;
|
||||
if ((x_70 <= 1)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_76 : i32 = tree[x_70].data;
|
||||
if ((5 <= x_76)) {
|
||||
var x_114_phi : bool;
|
||||
let x_89_save = x_70;
|
||||
let x_90 : i32 = tree[x_89_save].leftIndex;
|
||||
if ((x_90 == -1)) {
|
||||
let x_97 : f32 = x_8.injectionSwitch.y;
|
||||
let x_99 : f32 = x_8.injectionSwitch.x;
|
||||
if ((x_97 < x_99)) {
|
||||
loop {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
tree[x_89_save].leftIndex = 1;
|
||||
tree[1] = BST(5, -1, -1);
|
||||
loop {
|
||||
x_114_phi = x_67;
|
||||
if ((0 < i32(x_97))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
x_114_phi = true;
|
||||
break;
|
||||
}
|
||||
x_114 = x_114_phi;
|
||||
x_116_phi = x_114;
|
||||
if (x_114) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
x_95 = tree[x_89_save].leftIndex;
|
||||
x_68_phi = x_67;
|
||||
x_71_phi = x_95;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
let x_81_save = x_70;
|
||||
let x_82 : i32 = tree[x_81_save].rightIndex;
|
||||
if ((x_82 == -1)) {
|
||||
tree[x_81_save].rightIndex = 1;
|
||||
tree[1] = BST(5, -1, -1);
|
||||
x_116_phi = true;
|
||||
break;
|
||||
} else {
|
||||
x_87 = tree[x_81_save].rightIndex;
|
||||
x_68_phi = x_67;
|
||||
x_71_phi = x_87;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
x_68_phi = x_114;
|
||||
x_71_phi = x_70;
|
||||
|
||||
continuing {
|
||||
x_68 = x_68_phi;
|
||||
x_71 = x_71_phi;
|
||||
x_67_phi = x_68;
|
||||
x_70_phi = x_71;
|
||||
}
|
||||
}
|
||||
let x_116 : bool = x_116_phi;
|
||||
if (x_116) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
x_119_phi = 0;
|
||||
loop {
|
||||
var x_133 : bool;
|
||||
var x_120 : i32;
|
||||
var x_134_phi : bool;
|
||||
let x_119 : i32 = x_119_phi;
|
||||
let x_125 : f32 = gl_FragCoord.y;
|
||||
let x_126 : bool = (x_125 < 0.0);
|
||||
x_134_phi = x_126;
|
||||
if (!(x_126)) {
|
||||
let x_131 : f32 = x_8.injectionSwitch.y;
|
||||
x_133 = (x_119 != i32(x_131));
|
||||
x_134_phi = x_133;
|
||||
}
|
||||
let x_134 : bool = x_134_phi;
|
||||
if (x_134) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
var x_139 : bool;
|
||||
var x_186 : bool;
|
||||
var x_139_phi : bool;
|
||||
var x_142_phi : i32;
|
||||
var x_188_phi : bool;
|
||||
switch(0u) {
|
||||
default: {
|
||||
x_139_phi = false;
|
||||
x_142_phi = 0;
|
||||
loop {
|
||||
var x_167 : i32;
|
||||
var x_159 : i32;
|
||||
var x_140 : bool;
|
||||
var x_143 : i32;
|
||||
var x_140_phi : bool;
|
||||
var x_143_phi : i32;
|
||||
x_139 = x_139_phi;
|
||||
let x_142 : i32 = x_142_phi;
|
||||
x_188_phi = x_139;
|
||||
if ((x_142 <= 2)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_148 : i32 = tree[x_142].data;
|
||||
if ((12 <= x_148)) {
|
||||
var x_186_phi : bool;
|
||||
let x_161_save = x_142;
|
||||
let x_162 : i32 = tree[x_161_save].leftIndex;
|
||||
if ((x_162 == -1)) {
|
||||
let x_169 : f32 = x_8.injectionSwitch.y;
|
||||
let x_171 : f32 = x_8.injectionSwitch.x;
|
||||
if ((x_169 < x_171)) {
|
||||
loop {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
tree[x_161_save].leftIndex = 2;
|
||||
tree[2] = BST(12, -1, -1);
|
||||
loop {
|
||||
x_186_phi = x_139;
|
||||
if ((0 < i32(x_169))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
x_186_phi = true;
|
||||
break;
|
||||
}
|
||||
x_186 = x_186_phi;
|
||||
x_188_phi = x_186;
|
||||
if (x_186) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
x_167 = tree[x_161_save].leftIndex;
|
||||
x_140_phi = x_139;
|
||||
x_143_phi = x_167;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
let x_153_save = x_142;
|
||||
let x_154 : i32 = tree[x_153_save].rightIndex;
|
||||
if ((x_154 == -1)) {
|
||||
tree[x_153_save].rightIndex = 2;
|
||||
tree[2] = BST(12, -1, -1);
|
||||
x_188_phi = true;
|
||||
break;
|
||||
} else {
|
||||
x_159 = tree[x_153_save].rightIndex;
|
||||
x_140_phi = x_139;
|
||||
x_143_phi = x_159;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
x_140_phi = x_186;
|
||||
x_143_phi = x_142;
|
||||
|
||||
continuing {
|
||||
x_140 = x_140_phi;
|
||||
x_143 = x_143_phi;
|
||||
x_139_phi = x_140;
|
||||
x_142_phi = x_143;
|
||||
}
|
||||
}
|
||||
let x_188 : bool = x_188_phi;
|
||||
if (x_188) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
continuing {
|
||||
x_120 = (x_119 + 1);
|
||||
x_119_phi = x_120;
|
||||
}
|
||||
}
|
||||
var x_193 : bool;
|
||||
var x_240 : bool;
|
||||
var x_193_phi : bool;
|
||||
var x_196_phi : i32;
|
||||
var x_242_phi : bool;
|
||||
switch(0u) {
|
||||
default: {
|
||||
x_193_phi = false;
|
||||
x_196_phi = 0;
|
||||
loop {
|
||||
var x_221 : i32;
|
||||
var x_213 : i32;
|
||||
var x_194 : bool;
|
||||
var x_197 : i32;
|
||||
var x_194_phi : bool;
|
||||
var x_197_phi : i32;
|
||||
x_193 = x_193_phi;
|
||||
let x_196 : i32 = x_196_phi;
|
||||
x_242_phi = x_193;
|
||||
if ((x_196 <= 3)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_202 : i32 = tree[x_196].data;
|
||||
if ((15 <= x_202)) {
|
||||
var x_240_phi : bool;
|
||||
let x_215_save = x_196;
|
||||
let x_216 : i32 = tree[x_215_save].leftIndex;
|
||||
if ((x_216 == -1)) {
|
||||
let x_223 : f32 = x_8.injectionSwitch.y;
|
||||
let x_225 : f32 = x_8.injectionSwitch.x;
|
||||
if ((x_223 < x_225)) {
|
||||
loop {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
tree[x_215_save].leftIndex = 3;
|
||||
tree[3] = BST(15, -1, -1);
|
||||
loop {
|
||||
x_240_phi = x_193;
|
||||
if ((0 < i32(x_223))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
x_240_phi = true;
|
||||
break;
|
||||
}
|
||||
x_240 = x_240_phi;
|
||||
x_242_phi = x_240;
|
||||
if (x_240) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
x_221 = tree[x_215_save].leftIndex;
|
||||
x_194_phi = x_193;
|
||||
x_197_phi = x_221;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
let x_207_save = x_196;
|
||||
let x_208 : i32 = tree[x_207_save].rightIndex;
|
||||
if ((x_208 == -1)) {
|
||||
tree[x_207_save].rightIndex = 3;
|
||||
tree[3] = BST(15, -1, -1);
|
||||
x_242_phi = true;
|
||||
break;
|
||||
} else {
|
||||
x_213 = tree[x_207_save].rightIndex;
|
||||
x_194_phi = x_193;
|
||||
x_197_phi = x_213;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
x_194_phi = x_240;
|
||||
x_197_phi = x_196;
|
||||
|
||||
continuing {
|
||||
x_194 = x_194_phi;
|
||||
x_197 = x_197_phi;
|
||||
x_193_phi = x_194;
|
||||
x_196_phi = x_197;
|
||||
}
|
||||
}
|
||||
let x_242 : bool = x_242_phi;
|
||||
if (x_242) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
var x_247 : bool;
|
||||
var x_294 : bool;
|
||||
var x_247_phi : bool;
|
||||
var x_250_phi : i32;
|
||||
var x_296_phi : bool;
|
||||
switch(0u) {
|
||||
default: {
|
||||
x_247_phi = false;
|
||||
x_250_phi = 0;
|
||||
loop {
|
||||
var x_275 : i32;
|
||||
var x_267 : i32;
|
||||
var x_248 : bool;
|
||||
var x_251 : i32;
|
||||
var x_248_phi : bool;
|
||||
var x_251_phi : i32;
|
||||
x_247 = x_247_phi;
|
||||
let x_250 : i32 = x_250_phi;
|
||||
x_296_phi = x_247;
|
||||
if ((x_250 <= 4)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_256 : i32 = tree[x_250].data;
|
||||
if ((7 <= x_256)) {
|
||||
var x_294_phi : bool;
|
||||
let x_269_save = x_250;
|
||||
let x_270 : i32 = tree[x_269_save].leftIndex;
|
||||
if ((x_270 == -1)) {
|
||||
let x_277 : f32 = x_8.injectionSwitch.y;
|
||||
let x_279 : f32 = x_8.injectionSwitch.x;
|
||||
if ((x_277 < x_279)) {
|
||||
loop {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
tree[x_269_save].leftIndex = 4;
|
||||
tree[4] = BST(7, -1, -1);
|
||||
loop {
|
||||
x_294_phi = x_247;
|
||||
if ((0 < i32(x_277))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
x_294_phi = true;
|
||||
break;
|
||||
}
|
||||
x_294 = x_294_phi;
|
||||
x_296_phi = x_294;
|
||||
if (x_294) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
x_275 = tree[x_269_save].leftIndex;
|
||||
x_248_phi = x_247;
|
||||
x_251_phi = x_275;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
let x_261_save = x_250;
|
||||
let x_262 : i32 = tree[x_261_save].rightIndex;
|
||||
if ((x_262 == -1)) {
|
||||
tree[x_261_save].rightIndex = 4;
|
||||
tree[4] = BST(7, -1, -1);
|
||||
x_296_phi = true;
|
||||
break;
|
||||
} else {
|
||||
x_267 = tree[x_261_save].rightIndex;
|
||||
x_248_phi = x_247;
|
||||
x_251_phi = x_267;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
x_248_phi = x_294;
|
||||
x_251_phi = x_250;
|
||||
|
||||
continuing {
|
||||
x_248 = x_248_phi;
|
||||
x_251 = x_251_phi;
|
||||
x_247_phi = x_248;
|
||||
x_250_phi = x_251;
|
||||
}
|
||||
}
|
||||
let x_296 : bool = x_296_phi;
|
||||
if (x_296) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
var x_301 : bool;
|
||||
var x_348 : bool;
|
||||
var x_301_phi : bool;
|
||||
var x_304_phi : i32;
|
||||
var x_350_phi : bool;
|
||||
switch(0u) {
|
||||
default: {
|
||||
x_301_phi = false;
|
||||
x_304_phi = 0;
|
||||
loop {
|
||||
var x_329 : i32;
|
||||
var x_321 : i32;
|
||||
var x_302 : bool;
|
||||
var x_305 : i32;
|
||||
var x_302_phi : bool;
|
||||
var x_305_phi : i32;
|
||||
x_301 = x_301_phi;
|
||||
let x_304 : i32 = x_304_phi;
|
||||
x_350_phi = x_301;
|
||||
if ((x_304 <= 5)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_310 : i32 = tree[x_304].data;
|
||||
if ((8 <= x_310)) {
|
||||
var x_348_phi : bool;
|
||||
let x_323_save = x_304;
|
||||
let x_324 : i32 = tree[x_323_save].leftIndex;
|
||||
if ((x_324 == -1)) {
|
||||
let x_331 : f32 = x_8.injectionSwitch.y;
|
||||
let x_333 : f32 = x_8.injectionSwitch.x;
|
||||
if ((x_331 < x_333)) {
|
||||
loop {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
tree[x_323_save].leftIndex = 5;
|
||||
tree[5] = BST(8, -1, -1);
|
||||
loop {
|
||||
x_348_phi = x_301;
|
||||
if ((0 < i32(x_331))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
x_348_phi = true;
|
||||
break;
|
||||
}
|
||||
x_348 = x_348_phi;
|
||||
x_350_phi = x_348;
|
||||
if (x_348) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
x_329 = tree[x_323_save].leftIndex;
|
||||
x_302_phi = x_301;
|
||||
x_305_phi = x_329;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
let x_315_save = x_304;
|
||||
let x_316 : i32 = tree[x_315_save].rightIndex;
|
||||
if ((x_316 == -1)) {
|
||||
tree[x_315_save].rightIndex = 5;
|
||||
tree[5] = BST(8, -1, -1);
|
||||
x_350_phi = true;
|
||||
break;
|
||||
} else {
|
||||
x_321 = tree[x_315_save].rightIndex;
|
||||
x_302_phi = x_301;
|
||||
x_305_phi = x_321;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
x_302_phi = x_348;
|
||||
x_305_phi = x_304;
|
||||
|
||||
continuing {
|
||||
x_302 = x_302_phi;
|
||||
x_305 = x_305_phi;
|
||||
x_301_phi = x_302;
|
||||
x_304_phi = x_305;
|
||||
}
|
||||
}
|
||||
let x_350 : bool = x_350_phi;
|
||||
if (x_350) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
var x_355 : bool;
|
||||
var x_402 : bool;
|
||||
var x_355_phi : bool;
|
||||
var x_358_phi : i32;
|
||||
var x_404_phi : bool;
|
||||
switch(0u) {
|
||||
default: {
|
||||
x_355_phi = false;
|
||||
x_358_phi = 0;
|
||||
loop {
|
||||
var x_383 : i32;
|
||||
var x_375 : i32;
|
||||
var x_356 : bool;
|
||||
var x_359 : i32;
|
||||
var x_356_phi : bool;
|
||||
var x_359_phi : i32;
|
||||
x_355 = x_355_phi;
|
||||
let x_358 : i32 = x_358_phi;
|
||||
x_404_phi = x_355;
|
||||
if ((x_358 <= 6)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_364 : i32 = tree[x_358].data;
|
||||
if ((2 <= x_364)) {
|
||||
var x_402_phi : bool;
|
||||
let x_377_save = x_358;
|
||||
let x_378 : i32 = tree[x_377_save].leftIndex;
|
||||
if ((x_378 == -1)) {
|
||||
let x_385 : f32 = x_8.injectionSwitch.y;
|
||||
let x_387 : f32 = x_8.injectionSwitch.x;
|
||||
if ((x_385 < x_387)) {
|
||||
loop {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
tree[x_377_save].leftIndex = 6;
|
||||
tree[6] = BST(2, -1, -1);
|
||||
loop {
|
||||
x_402_phi = x_355;
|
||||
if ((0 < i32(x_385))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
x_402_phi = true;
|
||||
break;
|
||||
}
|
||||
x_402 = x_402_phi;
|
||||
x_404_phi = x_402;
|
||||
if (x_402) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
x_383 = tree[x_377_save].leftIndex;
|
||||
x_356_phi = x_355;
|
||||
x_359_phi = x_383;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
let x_369_save = x_358;
|
||||
let x_370 : i32 = tree[x_369_save].rightIndex;
|
||||
if ((x_370 == -1)) {
|
||||
tree[x_369_save].rightIndex = 6;
|
||||
tree[6] = BST(2, -1, -1);
|
||||
x_404_phi = true;
|
||||
break;
|
||||
} else {
|
||||
x_375 = tree[x_369_save].rightIndex;
|
||||
x_356_phi = x_355;
|
||||
x_359_phi = x_375;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
x_356_phi = x_402;
|
||||
x_359_phi = x_358;
|
||||
|
||||
continuing {
|
||||
x_356 = x_356_phi;
|
||||
x_359 = x_359_phi;
|
||||
x_355_phi = x_356;
|
||||
x_358_phi = x_359;
|
||||
}
|
||||
}
|
||||
let x_404 : bool = x_404_phi;
|
||||
if (x_404) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
var x_409 : bool;
|
||||
var x_456 : bool;
|
||||
var x_409_phi : bool;
|
||||
var x_412_phi : i32;
|
||||
var x_458_phi : bool;
|
||||
switch(0u) {
|
||||
default: {
|
||||
x_409_phi = false;
|
||||
x_412_phi = 0;
|
||||
loop {
|
||||
var x_437 : i32;
|
||||
var x_429 : i32;
|
||||
var x_410 : bool;
|
||||
var x_413 : i32;
|
||||
var x_410_phi : bool;
|
||||
var x_413_phi : i32;
|
||||
x_409 = x_409_phi;
|
||||
let x_412 : i32 = x_412_phi;
|
||||
x_458_phi = x_409;
|
||||
if ((x_412 <= 7)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_418 : i32 = tree[x_412].data;
|
||||
if ((6 <= x_418)) {
|
||||
var x_456_phi : bool;
|
||||
let x_431_save = x_412;
|
||||
let x_432 : i32 = tree[x_431_save].leftIndex;
|
||||
if ((x_432 == -1)) {
|
||||
let x_439 : f32 = x_8.injectionSwitch.y;
|
||||
let x_441 : f32 = x_8.injectionSwitch.x;
|
||||
if ((x_439 < x_441)) {
|
||||
loop {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
tree[x_431_save].leftIndex = 7;
|
||||
tree[7] = BST(6, -1, -1);
|
||||
loop {
|
||||
x_456_phi = x_409;
|
||||
if ((0 < i32(x_439))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
x_456_phi = true;
|
||||
break;
|
||||
}
|
||||
x_456 = x_456_phi;
|
||||
x_458_phi = x_456;
|
||||
if (x_456) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
x_437 = tree[x_431_save].leftIndex;
|
||||
x_410_phi = x_409;
|
||||
x_413_phi = x_437;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
let x_423_save = x_412;
|
||||
let x_424 : i32 = tree[x_423_save].rightIndex;
|
||||
if ((x_424 == -1)) {
|
||||
tree[x_423_save].rightIndex = 7;
|
||||
tree[7] = BST(6, -1, -1);
|
||||
x_458_phi = true;
|
||||
break;
|
||||
} else {
|
||||
x_429 = tree[x_423_save].rightIndex;
|
||||
x_410_phi = x_409;
|
||||
x_413_phi = x_429;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
x_410_phi = x_456;
|
||||
x_413_phi = x_412;
|
||||
|
||||
continuing {
|
||||
x_410 = x_410_phi;
|
||||
x_413 = x_413_phi;
|
||||
x_409_phi = x_410;
|
||||
x_412_phi = x_413;
|
||||
}
|
||||
}
|
||||
let x_458 : bool = x_458_phi;
|
||||
if (x_458) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
var x_463 : bool;
|
||||
var x_510 : bool;
|
||||
var x_463_phi : bool;
|
||||
var x_466_phi : i32;
|
||||
var x_512_phi : bool;
|
||||
switch(0u) {
|
||||
default: {
|
||||
x_463_phi = false;
|
||||
x_466_phi = 0;
|
||||
loop {
|
||||
var x_491 : i32;
|
||||
var x_483 : i32;
|
||||
var x_464 : bool;
|
||||
var x_467 : i32;
|
||||
var x_464_phi : bool;
|
||||
var x_467_phi : i32;
|
||||
x_463 = x_463_phi;
|
||||
let x_466 : i32 = x_466_phi;
|
||||
x_512_phi = x_463;
|
||||
if ((x_466 <= 8)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_472 : i32 = tree[x_466].data;
|
||||
if ((17 <= x_472)) {
|
||||
var x_510_phi : bool;
|
||||
let x_485_save = x_466;
|
||||
let x_486 : i32 = tree[x_485_save].leftIndex;
|
||||
if ((x_486 == -1)) {
|
||||
let x_493 : f32 = x_8.injectionSwitch.y;
|
||||
let x_495 : f32 = x_8.injectionSwitch.x;
|
||||
if ((x_493 < x_495)) {
|
||||
loop {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
tree[x_485_save].leftIndex = 8;
|
||||
tree[8] = BST(17, -1, -1);
|
||||
loop {
|
||||
x_510_phi = x_463;
|
||||
if ((0 < i32(x_493))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
x_510_phi = true;
|
||||
break;
|
||||
}
|
||||
x_510 = x_510_phi;
|
||||
x_512_phi = x_510;
|
||||
if (x_510) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
x_491 = tree[x_485_save].leftIndex;
|
||||
x_464_phi = x_463;
|
||||
x_467_phi = x_491;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
let x_477_save = x_466;
|
||||
let x_478 : i32 = tree[x_477_save].rightIndex;
|
||||
if ((x_478 == -1)) {
|
||||
tree[x_477_save].rightIndex = 8;
|
||||
tree[8] = BST(17, -1, -1);
|
||||
x_512_phi = true;
|
||||
break;
|
||||
} else {
|
||||
x_483 = tree[x_477_save].rightIndex;
|
||||
x_464_phi = x_463;
|
||||
x_467_phi = x_483;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
x_464_phi = x_510;
|
||||
x_467_phi = x_466;
|
||||
|
||||
continuing {
|
||||
x_464 = x_464_phi;
|
||||
x_467 = x_467_phi;
|
||||
x_463_phi = x_464;
|
||||
x_466_phi = x_467;
|
||||
}
|
||||
}
|
||||
let x_512 : bool = x_512_phi;
|
||||
if (x_512) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
var x_517 : bool;
|
||||
var x_564 : bool;
|
||||
var x_517_phi : bool;
|
||||
var x_520_phi : i32;
|
||||
var x_566_phi : bool;
|
||||
switch(0u) {
|
||||
default: {
|
||||
x_517_phi = false;
|
||||
x_520_phi = 0;
|
||||
loop {
|
||||
var x_545 : i32;
|
||||
var x_537 : i32;
|
||||
var x_518 : bool;
|
||||
var x_521 : i32;
|
||||
var x_518_phi : bool;
|
||||
var x_521_phi : i32;
|
||||
x_517 = x_517_phi;
|
||||
let x_520 : i32 = x_520_phi;
|
||||
x_566_phi = x_517;
|
||||
if ((x_520 <= 9)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_526 : i32 = tree[x_520].data;
|
||||
if ((13 <= x_526)) {
|
||||
var x_564_phi : bool;
|
||||
let x_539_save = x_520;
|
||||
let x_540 : i32 = tree[x_539_save].leftIndex;
|
||||
if ((x_540 == -1)) {
|
||||
let x_547 : f32 = x_8.injectionSwitch.y;
|
||||
let x_549 : f32 = x_8.injectionSwitch.x;
|
||||
if ((x_547 < x_549)) {
|
||||
loop {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
tree[x_539_save].leftIndex = 9;
|
||||
tree[9] = BST(13, -1, -1);
|
||||
loop {
|
||||
x_564_phi = x_517;
|
||||
if ((0 < i32(x_547))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
x_564_phi = true;
|
||||
break;
|
||||
}
|
||||
x_564 = x_564_phi;
|
||||
x_566_phi = x_564;
|
||||
if (x_564) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
x_545 = tree[x_539_save].leftIndex;
|
||||
x_518_phi = x_517;
|
||||
x_521_phi = x_545;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
let x_531_save = x_520;
|
||||
let x_532 : i32 = tree[x_531_save].rightIndex;
|
||||
if ((x_532 == -1)) {
|
||||
tree[x_531_save].rightIndex = 9;
|
||||
tree[9] = BST(13, -1, -1);
|
||||
x_566_phi = true;
|
||||
break;
|
||||
} else {
|
||||
x_537 = tree[x_531_save].rightIndex;
|
||||
x_518_phi = x_517;
|
||||
x_521_phi = x_537;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
x_518_phi = x_564;
|
||||
x_521_phi = x_520;
|
||||
|
||||
continuing {
|
||||
x_518 = x_518_phi;
|
||||
x_521 = x_521_phi;
|
||||
x_517_phi = x_518;
|
||||
x_520_phi = x_521;
|
||||
}
|
||||
}
|
||||
let x_566 : bool = x_566_phi;
|
||||
if (x_566) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
x_569_phi = 0;
|
||||
x_572_phi = 0;
|
||||
x_574_phi = 0;
|
||||
loop {
|
||||
var x_597 : i32;
|
||||
var x_607 : i32;
|
||||
var x_612 : i32;
|
||||
var x_575 : i32;
|
||||
var x_570_phi : i32;
|
||||
var x_573_phi : i32;
|
||||
let x_569 : i32 = x_569_phi;
|
||||
x_572 = x_572_phi;
|
||||
let x_574 : i32 = x_574_phi;
|
||||
if ((x_574 < 20)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
var x_582_phi : i32;
|
||||
var x_597_phi : i32;
|
||||
var x_598_phi : bool;
|
||||
switch(0u) {
|
||||
default: {
|
||||
x_582_phi = 0;
|
||||
loop {
|
||||
let x_582 : i32 = x_582_phi;
|
||||
x_597_phi = x_569;
|
||||
x_598_phi = false;
|
||||
if ((x_582 != -1)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_589 : BST = tree[x_582];
|
||||
let x_590 : i32 = x_589.data;
|
||||
let x_591 : i32 = x_589.leftIndex;
|
||||
let x_592 : i32 = x_589.rightIndex;
|
||||
if ((x_590 == x_574)) {
|
||||
x_597_phi = x_574;
|
||||
x_598_phi = true;
|
||||
break;
|
||||
}
|
||||
|
||||
continuing {
|
||||
x_582_phi = select(x_591, x_592, (x_574 > x_590));
|
||||
}
|
||||
}
|
||||
x_597 = x_597_phi;
|
||||
let x_598 : bool = x_598_phi;
|
||||
x_570_phi = x_597;
|
||||
if (x_598) {
|
||||
break;
|
||||
}
|
||||
x_570_phi = -1;
|
||||
}
|
||||
}
|
||||
var x_570 : i32;
|
||||
var x_606 : i32;
|
||||
var x_611 : i32;
|
||||
var x_607_phi : i32;
|
||||
var x_612_phi : i32;
|
||||
x_570 = x_570_phi;
|
||||
switch(x_574) {
|
||||
case 2, 5, 6, 7, 8, 9, 12, 13, 15, 17: {
|
||||
x_607_phi = x_572;
|
||||
if ((x_570 == bitcast<i32>(x_574))) {
|
||||
x_606 = bitcast<i32>((x_572 + bitcast<i32>(1)));
|
||||
x_607_phi = x_606;
|
||||
}
|
||||
x_607 = x_607_phi;
|
||||
x_573_phi = x_607;
|
||||
}
|
||||
default: {
|
||||
x_612_phi = x_572;
|
||||
if ((x_570 == bitcast<i32>(-1))) {
|
||||
x_611 = bitcast<i32>((x_572 + bitcast<i32>(1)));
|
||||
x_612_phi = x_611;
|
||||
}
|
||||
x_612 = x_612_phi;
|
||||
x_573_phi = x_612;
|
||||
}
|
||||
}
|
||||
let x_573 : i32 = x_573_phi;
|
||||
|
||||
continuing {
|
||||
x_575 = (x_574 + 1);
|
||||
x_569_phi = x_570;
|
||||
x_572_phi = x_573;
|
||||
x_574_phi = x_575;
|
||||
}
|
||||
}
|
||||
if ((x_572 == bitcast<i32>(20))) {
|
||||
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
} else {
|
||||
x_GLF_color = vec4<f32>(0.0, 0.0, 1.0, 1.0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
@location(0)
|
||||
x_GLF_color_1 : vec4<f32>,
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn main(@builtin(position) gl_FragCoord_param : vec4<f32>) -> main_out {
|
||||
gl_FragCoord = gl_FragCoord_param;
|
||||
main_1();
|
||||
return main_out(x_GLF_color);
|
||||
}
|
||||
Reference in New Issue
Block a user