mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-11 22:44:04 +00:00
Add tests derived from VK-GL-CTS
This adds SPIR-V assembly and WGSL tests derived from VK-GL-CTS commit 571256871c2e2f03995373e1e4a02958d8cd8cf5. The following procedure was followed: - Those .amber files in VK-GL-CTS wholly owned by Google were identified - All GLSL and SPIR-V shaders were extracted from the Amber files and converted into SPIR-V binaries - The compact-ids pass of spirv-opt was applied to each binary - Duplicate binaries were removed - spirv-opt -O was used to obtain an optimized version of each remaining binary, with duplicates discarded - Binaries that failed validation using spirv-val with target environment SPIR-V 1.3 were discarded - Those binaries that tint could not successfully convert into WGSL were put aside for further investigation - SPIR-V assembly versions of the remaining binaries are included in this CL - test-runner with -generate-expected and -generate-skip was used to generate expected .spvasm, .msl, .hlsl and .wgsl outputs for these SPIR-V assembly tests - Each successfully-generated .expected.wgsl is included in this CL again, as a WGLSL test - test-runner with -generate-expected and -generate-skip was used again, to generate expected outputs for these WGSL tests Change-Id: Ibe9baf2729cf97e0b633db9a426f53362a5de540 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58842 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
bd3edb564f
commit
f7e73d4ee3
@@ -0,0 +1,259 @@
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %main "main"
|
||||
OpName %cross2d_vf2_vf2_ "cross2d(vf2;vf2;"
|
||||
OpName %a "a"
|
||||
OpName %b "b"
|
||||
OpName %pointInTriangle_vf2_vf2_vf2_vf2_ "pointInTriangle(vf2;vf2;vf2;vf2;"
|
||||
OpName %p "p"
|
||||
OpName %a_0 "a"
|
||||
OpName %b_0 "b"
|
||||
OpName %c "c"
|
||||
OpName %pab "pab"
|
||||
OpName %param "param"
|
||||
OpName %param_0 "param"
|
||||
OpName %pbc "pbc"
|
||||
OpName %param_1 "param"
|
||||
OpName %param_2 "param"
|
||||
OpName %pca "pca"
|
||||
OpName %param_3 "param"
|
||||
OpName %param_4 "param"
|
||||
OpName %pos "pos"
|
||||
OpName %gl_FragCoord "gl_FragCoord"
|
||||
OpName %buf0 "buf0"
|
||||
OpMemberName %buf0 0 "resolution"
|
||||
OpName %_ ""
|
||||
OpName %param_5 "param"
|
||||
OpName %param_6 "param"
|
||||
OpName %param_7 "param"
|
||||
OpName %param_8 "param"
|
||||
OpName %_GLF_color "_GLF_color"
|
||||
OpDecorate %gl_FragCoord BuiltIn FragCoord
|
||||
OpMemberDecorate %buf0 0 Offset 0
|
||||
OpDecorate %buf0 Block
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %_GLF_color Location 0
|
||||
%void = OpTypeVoid
|
||||
%30 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%34 = OpTypeFunction %float %_ptr_Function_v2float %_ptr_Function_v2float
|
||||
%int = OpTypeInt 32 1
|
||||
%36 = OpTypeFunction %int %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%bool = OpTypeBool
|
||||
%float_0 = OpConstant %float 0
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%gl_FragCoord = OpVariable %_ptr_Input_v4float Input
|
||||
%buf0 = OpTypeStruct %v2float
|
||||
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
|
||||
%_ = OpVariable %_ptr_Uniform_buf0 Uniform
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%float_0_699999988 = OpConstant %float 0.699999988
|
||||
%float_0_300000012 = OpConstant %float 0.300000012
|
||||
%51 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%float_0_899999976 = OpConstant %float 0.899999976
|
||||
%54 = OpConstantComposite %v2float %float_0_5 %float_0_899999976
|
||||
%float_0_100000001 = OpConstant %float 0.100000001
|
||||
%float_0_400000006 = OpConstant %float 0.400000006
|
||||
%57 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_GLF_color = OpVariable %_ptr_Output_v4float Output
|
||||
%float_1 = OpConstant %float 1
|
||||
%60 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
|
||||
%61 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%false = OpConstantFalse %bool
|
||||
%_ptr_Function_bool = OpTypePointer Function %bool
|
||||
%true = OpConstantTrue %bool
|
||||
%main = OpFunction %void None %30
|
||||
%66 = OpLabel
|
||||
%pos = OpVariable %_ptr_Function_v2float Function
|
||||
%param_5 = OpVariable %_ptr_Function_v2float Function
|
||||
%param_6 = OpVariable %_ptr_Function_v2float Function
|
||||
%param_7 = OpVariable %_ptr_Function_v2float Function
|
||||
%param_8 = OpVariable %_ptr_Function_v2float Function
|
||||
%67 = OpLoad %v4float %gl_FragCoord
|
||||
%68 = OpVectorShuffle %v2float %67 %67 0 1
|
||||
%69 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0
|
||||
%70 = OpLoad %v2float %69
|
||||
%71 = OpFDiv %v2float %68 %70
|
||||
OpStore %pos %71
|
||||
OpStore %param_5 %71
|
||||
OpStore %param_6 %51
|
||||
OpStore %param_7 %54
|
||||
OpStore %param_8 %57
|
||||
%72 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_5 %param_6 %param_7 %param_8
|
||||
%73 = OpIEqual %bool %72 %int_1
|
||||
OpSelectionMerge %74 None
|
||||
OpBranchConditional %73 %75 %76
|
||||
%75 = OpLabel
|
||||
OpStore %_GLF_color %60
|
||||
OpBranch %74
|
||||
%76 = OpLabel
|
||||
OpStore %_GLF_color %61
|
||||
OpBranch %74
|
||||
%74 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%cross2d_vf2_vf2_ = OpFunction %float None %34
|
||||
%a = OpFunctionParameter %_ptr_Function_v2float
|
||||
%b = OpFunctionParameter %_ptr_Function_v2float
|
||||
%77 = OpLabel
|
||||
%78 = OpAccessChain %_ptr_Function_float %a %uint_0
|
||||
%79 = OpLoad %float %78
|
||||
%80 = OpAccessChain %_ptr_Function_float %b %uint_1
|
||||
%81 = OpLoad %float %80
|
||||
%82 = OpFMul %float %79 %81
|
||||
%83 = OpAccessChain %_ptr_Function_float %b %uint_0
|
||||
%84 = OpLoad %float %83
|
||||
%85 = OpAccessChain %_ptr_Function_float %a %uint_1
|
||||
%86 = OpLoad %float %85
|
||||
%87 = OpFMul %float %84 %86
|
||||
%88 = OpFSub %float %82 %87
|
||||
OpReturnValue %88
|
||||
OpFunctionEnd
|
||||
%pointInTriangle_vf2_vf2_vf2_vf2_ = OpFunction %int None %36
|
||||
%p = OpFunctionParameter %_ptr_Function_v2float
|
||||
%a_0 = OpFunctionParameter %_ptr_Function_v2float
|
||||
%b_0 = OpFunctionParameter %_ptr_Function_v2float
|
||||
%c = OpFunctionParameter %_ptr_Function_v2float
|
||||
%89 = OpLabel
|
||||
%90 = OpVariable %_ptr_Function_bool Function %false
|
||||
%91 = OpVariable %_ptr_Function_int Function
|
||||
%pab = OpVariable %_ptr_Function_float Function
|
||||
%param = OpVariable %_ptr_Function_v2float Function
|
||||
%param_0 = OpVariable %_ptr_Function_v2float Function
|
||||
%pbc = OpVariable %_ptr_Function_float Function
|
||||
%param_1 = OpVariable %_ptr_Function_v2float Function
|
||||
%param_2 = OpVariable %_ptr_Function_v2float Function
|
||||
%pca = OpVariable %_ptr_Function_float Function
|
||||
%param_3 = OpVariable %_ptr_Function_v2float Function
|
||||
%param_4 = OpVariable %_ptr_Function_v2float Function
|
||||
OpSelectionMerge %92 None
|
||||
OpSwitch %uint_0 %93
|
||||
%93 = OpLabel
|
||||
%94 = OpAccessChain %_ptr_Function_float %p %uint_0
|
||||
%95 = OpLoad %float %94
|
||||
%96 = OpAccessChain %_ptr_Function_float %a_0 %uint_0
|
||||
%97 = OpLoad %float %96
|
||||
%98 = OpFSub %float %95 %97
|
||||
%99 = OpAccessChain %_ptr_Function_float %p %uint_1
|
||||
%100 = OpLoad %float %99
|
||||
%101 = OpAccessChain %_ptr_Function_float %a_0 %uint_1
|
||||
%102 = OpLoad %float %101
|
||||
%103 = OpFSub %float %100 %102
|
||||
%104 = OpCompositeConstruct %v2float %98 %103
|
||||
%105 = OpAccessChain %_ptr_Function_float %b_0 %uint_0
|
||||
%106 = OpLoad %float %105
|
||||
%107 = OpLoad %float %96
|
||||
%108 = OpFSub %float %106 %107
|
||||
%109 = OpAccessChain %_ptr_Function_float %b_0 %uint_1
|
||||
%110 = OpLoad %float %109
|
||||
%111 = OpLoad %float %101
|
||||
%112 = OpFSub %float %110 %111
|
||||
%113 = OpCompositeConstruct %v2float %108 %112
|
||||
OpStore %param %104
|
||||
OpStore %param_0 %113
|
||||
%114 = OpFunctionCall %float %cross2d_vf2_vf2_ %param %param_0
|
||||
OpStore %pab %114
|
||||
%115 = OpLoad %float %94
|
||||
%116 = OpLoad %float %105
|
||||
%117 = OpFSub %float %115 %116
|
||||
%118 = OpLoad %float %99
|
||||
%119 = OpLoad %float %109
|
||||
%120 = OpFSub %float %118 %119
|
||||
%121 = OpCompositeConstruct %v2float %117 %120
|
||||
%122 = OpAccessChain %_ptr_Function_float %c %uint_0
|
||||
%123 = OpLoad %float %122
|
||||
%124 = OpLoad %float %105
|
||||
%125 = OpFSub %float %123 %124
|
||||
%126 = OpAccessChain %_ptr_Function_float %c %uint_1
|
||||
%127 = OpLoad %float %126
|
||||
%128 = OpLoad %float %109
|
||||
%129 = OpFSub %float %127 %128
|
||||
%130 = OpCompositeConstruct %v2float %125 %129
|
||||
OpStore %param_1 %121
|
||||
OpStore %param_2 %130
|
||||
%131 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_1 %param_2
|
||||
OpStore %pbc %131
|
||||
%132 = OpFOrdLessThan %bool %114 %float_0
|
||||
%133 = OpFOrdLessThan %bool %131 %float_0
|
||||
%134 = OpLogicalAnd %bool %132 %133
|
||||
%135 = OpLogicalNot %bool %134
|
||||
OpSelectionMerge %136 None
|
||||
OpBranchConditional %135 %137 %136
|
||||
%137 = OpLabel
|
||||
%138 = OpFOrdGreaterThanEqual %bool %114 %float_0
|
||||
%139 = OpFOrdGreaterThanEqual %bool %131 %float_0
|
||||
%140 = OpLogicalAnd %bool %138 %139
|
||||
OpBranch %136
|
||||
%136 = OpLabel
|
||||
%141 = OpPhi %bool %134 %93 %140 %137
|
||||
%142 = OpLogicalNot %bool %141
|
||||
OpSelectionMerge %143 None
|
||||
OpBranchConditional %142 %144 %143
|
||||
%144 = OpLabel
|
||||
OpStore %90 %true
|
||||
OpStore %91 %int_0
|
||||
OpBranch %92
|
||||
%143 = OpLabel
|
||||
%145 = OpLoad %float %94
|
||||
%146 = OpLoad %float %122
|
||||
%147 = OpFSub %float %145 %146
|
||||
%148 = OpLoad %float %99
|
||||
%149 = OpLoad %float %126
|
||||
%150 = OpFSub %float %148 %149
|
||||
%151 = OpCompositeConstruct %v2float %147 %150
|
||||
%152 = OpLoad %float %96
|
||||
%153 = OpLoad %float %122
|
||||
%154 = OpFSub %float %152 %153
|
||||
%155 = OpLoad %float %101
|
||||
%156 = OpLoad %float %126
|
||||
%157 = OpFSub %float %155 %156
|
||||
%158 = OpCompositeConstruct %v2float %154 %157
|
||||
OpStore %param_3 %151
|
||||
OpStore %param_4 %158
|
||||
%159 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_3 %param_4
|
||||
OpStore %pca %159
|
||||
%160 = OpFOrdLessThan %bool %114 %float_0
|
||||
%161 = OpFOrdLessThan %bool %159 %float_0
|
||||
%162 = OpLogicalAnd %bool %160 %161
|
||||
%163 = OpLogicalNot %bool %162
|
||||
OpSelectionMerge %164 None
|
||||
OpBranchConditional %163 %165 %164
|
||||
%165 = OpLabel
|
||||
%166 = OpFOrdGreaterThanEqual %bool %114 %float_0
|
||||
%167 = OpFOrdGreaterThanEqual %bool %159 %float_0
|
||||
%168 = OpLogicalAnd %bool %166 %167
|
||||
OpBranch %164
|
||||
%164 = OpLabel
|
||||
%169 = OpPhi %bool %162 %143 %168 %165
|
||||
%170 = OpLogicalNot %bool %169
|
||||
OpSelectionMerge %171 None
|
||||
OpBranchConditional %170 %172 %171
|
||||
%172 = OpLabel
|
||||
OpStore %90 %true
|
||||
OpStore %91 %int_0
|
||||
OpBranch %92
|
||||
%171 = OpLabel
|
||||
OpStore %90 %true
|
||||
OpStore %91 %int_1
|
||||
OpBranch %92
|
||||
%92 = OpLabel
|
||||
%173 = OpPhi %int %int_0 %144 %int_0 %172 %int_1 %171
|
||||
OpReturnValue %173
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,159 @@
|
||||
static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
cbuffer cbuffer_x_24 : register(b0, space0) {
|
||||
uint4 x_24[1];
|
||||
};
|
||||
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
float cross2d_vf2_vf2_(inout float2 a, inout float2 b) {
|
||||
const float x_79 = a.x;
|
||||
const float x_81 = b.y;
|
||||
const float x_84 = b.x;
|
||||
const float x_86 = a.y;
|
||||
return ((x_79 * x_81) - (x_84 * x_86));
|
||||
}
|
||||
|
||||
int pointInTriangle_vf2_vf2_vf2_vf2_(inout float2 p, inout float2 a_1, inout float2 b_1, inout float2 c) {
|
||||
bool x_90 = false;
|
||||
int x_91 = 0;
|
||||
float pab = 0.0f;
|
||||
float2 param = float2(0.0f, 0.0f);
|
||||
float2 param_1 = float2(0.0f, 0.0f);
|
||||
float pbc = 0.0f;
|
||||
float2 param_2 = float2(0.0f, 0.0f);
|
||||
float2 param_3 = float2(0.0f, 0.0f);
|
||||
float pca = 0.0f;
|
||||
float2 param_4 = float2(0.0f, 0.0f);
|
||||
float2 param_5 = float2(0.0f, 0.0f);
|
||||
bool x_140 = false;
|
||||
bool x_168 = false;
|
||||
bool x_141_phi = false;
|
||||
bool x_169_phi = false;
|
||||
int x_173_phi = 0;
|
||||
switch(0u) {
|
||||
default: {
|
||||
const float x_95 = p.x;
|
||||
const float x_97 = a_1.x;
|
||||
const float x_100 = p.y;
|
||||
const float x_102 = a_1.y;
|
||||
const float x_106 = b_1.x;
|
||||
const float x_107 = a_1.x;
|
||||
const float x_110 = b_1.y;
|
||||
const float x_111 = a_1.y;
|
||||
param = float2((x_95 - x_97), (x_100 - x_102));
|
||||
param_1 = float2((x_106 - x_107), (x_110 - x_111));
|
||||
const float x_114 = cross2d_vf2_vf2_(param, param_1);
|
||||
pab = x_114;
|
||||
const float x_115 = p.x;
|
||||
const float x_116 = b_1.x;
|
||||
const float x_118 = p.y;
|
||||
const float x_119 = b_1.y;
|
||||
const float x_123 = c.x;
|
||||
const float x_124 = b_1.x;
|
||||
const float x_127 = c.y;
|
||||
const float x_128 = b_1.y;
|
||||
param_2 = float2((x_115 - x_116), (x_118 - x_119));
|
||||
param_3 = float2((x_123 - x_124), (x_127 - x_128));
|
||||
const float x_131 = cross2d_vf2_vf2_(param_2, param_3);
|
||||
pbc = x_131;
|
||||
bool tint_tmp = (x_114 < 0.0f);
|
||||
if (tint_tmp) {
|
||||
tint_tmp = (x_131 < 0.0f);
|
||||
}
|
||||
const bool x_134 = (tint_tmp);
|
||||
x_141_phi = x_134;
|
||||
if (!(x_134)) {
|
||||
bool tint_tmp_1 = (x_114 >= 0.0f);
|
||||
if (tint_tmp_1) {
|
||||
tint_tmp_1 = (x_131 >= 0.0f);
|
||||
}
|
||||
x_140 = (tint_tmp_1);
|
||||
x_141_phi = x_140;
|
||||
}
|
||||
if (!(x_141_phi)) {
|
||||
x_90 = true;
|
||||
x_91 = 0;
|
||||
x_173_phi = 0;
|
||||
break;
|
||||
}
|
||||
const float x_145 = p.x;
|
||||
const float x_146 = c.x;
|
||||
const float x_148 = p.y;
|
||||
const float x_149 = c.y;
|
||||
const float x_152 = a_1.x;
|
||||
const float x_153 = c.x;
|
||||
const float x_155 = a_1.y;
|
||||
const float x_156 = c.y;
|
||||
param_4 = float2((x_145 - x_146), (x_148 - x_149));
|
||||
param_5 = float2((x_152 - x_153), (x_155 - x_156));
|
||||
const float x_159 = cross2d_vf2_vf2_(param_4, param_5);
|
||||
pca = x_159;
|
||||
bool tint_tmp_2 = (x_114 < 0.0f);
|
||||
if (tint_tmp_2) {
|
||||
tint_tmp_2 = (x_159 < 0.0f);
|
||||
}
|
||||
const bool x_162 = (tint_tmp_2);
|
||||
x_169_phi = x_162;
|
||||
if (!(x_162)) {
|
||||
bool tint_tmp_3 = (x_114 >= 0.0f);
|
||||
if (tint_tmp_3) {
|
||||
tint_tmp_3 = (x_159 >= 0.0f);
|
||||
}
|
||||
x_168 = (tint_tmp_3);
|
||||
x_169_phi = x_168;
|
||||
}
|
||||
if (!(x_169_phi)) {
|
||||
x_90 = true;
|
||||
x_91 = 0;
|
||||
x_173_phi = 0;
|
||||
break;
|
||||
}
|
||||
x_90 = true;
|
||||
x_91 = 1;
|
||||
x_173_phi = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return x_173_phi;
|
||||
}
|
||||
|
||||
void main_1() {
|
||||
float2 pos = float2(0.0f, 0.0f);
|
||||
float2 param_6 = float2(0.0f, 0.0f);
|
||||
float2 param_7 = float2(0.0f, 0.0f);
|
||||
float2 param_8 = float2(0.0f, 0.0f);
|
||||
float2 param_9 = float2(0.0f, 0.0f);
|
||||
const float4 x_67 = gl_FragCoord;
|
||||
const float2 x_70 = asfloat(x_24[0].xy);
|
||||
const float2 x_71 = (float2(x_67.x, x_67.y) / x_70);
|
||||
pos = x_71;
|
||||
param_6 = x_71;
|
||||
param_7 = float2(0.699999988f, 0.300000012f);
|
||||
param_8 = float2(0.5f, 0.899999976f);
|
||||
param_9 = float2(0.100000001f, 0.400000006f);
|
||||
const int x_72 = pointInTriangle_vf2_vf2_vf2_vf2_(param_6, param_7, param_8, param_9);
|
||||
if ((x_72 == 1)) {
|
||||
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
} else {
|
||||
x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol_1 {
|
||||
float4 gl_FragCoord_param : SV_Position;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float4 x_GLF_color_1 : SV_Target0;
|
||||
};
|
||||
|
||||
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
||||
const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param;
|
||||
gl_FragCoord = gl_FragCoord_param;
|
||||
main_1();
|
||||
const main_out tint_symbol_3 = {x_GLF_color};
|
||||
const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct buf0 {
|
||||
/* 0x0000 */ packed_float2 resolution;
|
||||
};
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float4 x_GLF_color_1 [[color(0)]];
|
||||
};
|
||||
|
||||
float cross2d_vf2_vf2_(thread float2* const a, thread float2* const b) {
|
||||
float const x_79 = (*(a)).x;
|
||||
float const x_81 = (*(b)).y;
|
||||
float const x_84 = (*(b)).x;
|
||||
float const x_86 = (*(a)).y;
|
||||
return ((x_79 * x_81) - (x_84 * x_86));
|
||||
}
|
||||
|
||||
int pointInTriangle_vf2_vf2_vf2_vf2_(thread float2* const p, thread float2* const a_1, thread float2* const b_1, thread float2* const c) {
|
||||
bool x_90 = false;
|
||||
int x_91 = 0;
|
||||
float pab = 0.0f;
|
||||
float2 param = 0.0f;
|
||||
float2 param_1 = 0.0f;
|
||||
float pbc = 0.0f;
|
||||
float2 param_2 = 0.0f;
|
||||
float2 param_3 = 0.0f;
|
||||
float pca = 0.0f;
|
||||
float2 param_4 = 0.0f;
|
||||
float2 param_5 = 0.0f;
|
||||
bool x_140 = false;
|
||||
bool x_168 = false;
|
||||
bool x_141_phi = false;
|
||||
bool x_169_phi = false;
|
||||
int x_173_phi = 0;
|
||||
switch(0u) {
|
||||
default: {
|
||||
float const x_95 = (*(p)).x;
|
||||
float const x_97 = (*(a_1)).x;
|
||||
float const x_100 = (*(p)).y;
|
||||
float const x_102 = (*(a_1)).y;
|
||||
float const x_106 = (*(b_1)).x;
|
||||
float const x_107 = (*(a_1)).x;
|
||||
float const x_110 = (*(b_1)).y;
|
||||
float const x_111 = (*(a_1)).y;
|
||||
param = float2((x_95 - x_97), (x_100 - x_102));
|
||||
param_1 = float2((x_106 - x_107), (x_110 - x_111));
|
||||
float const x_114 = cross2d_vf2_vf2_(&(param), &(param_1));
|
||||
pab = x_114;
|
||||
float const x_115 = (*(p)).x;
|
||||
float const x_116 = (*(b_1)).x;
|
||||
float const x_118 = (*(p)).y;
|
||||
float const x_119 = (*(b_1)).y;
|
||||
float const x_123 = (*(c)).x;
|
||||
float const x_124 = (*(b_1)).x;
|
||||
float const x_127 = (*(c)).y;
|
||||
float const x_128 = (*(b_1)).y;
|
||||
param_2 = float2((x_115 - x_116), (x_118 - x_119));
|
||||
param_3 = float2((x_123 - x_124), (x_127 - x_128));
|
||||
float const x_131 = cross2d_vf2_vf2_(&(param_2), &(param_3));
|
||||
pbc = x_131;
|
||||
bool const x_134 = ((x_114 < 0.0f) && (x_131 < 0.0f));
|
||||
x_141_phi = x_134;
|
||||
if (!(x_134)) {
|
||||
x_140 = ((x_114 >= 0.0f) && (x_131 >= 0.0f));
|
||||
x_141_phi = x_140;
|
||||
}
|
||||
bool const x_141 = x_141_phi;
|
||||
if (!(x_141)) {
|
||||
x_90 = true;
|
||||
x_91 = 0;
|
||||
x_173_phi = 0;
|
||||
break;
|
||||
}
|
||||
float const x_145 = (*(p)).x;
|
||||
float const x_146 = (*(c)).x;
|
||||
float const x_148 = (*(p)).y;
|
||||
float const x_149 = (*(c)).y;
|
||||
float const x_152 = (*(a_1)).x;
|
||||
float const x_153 = (*(c)).x;
|
||||
float const x_155 = (*(a_1)).y;
|
||||
float const x_156 = (*(c)).y;
|
||||
param_4 = float2((x_145 - x_146), (x_148 - x_149));
|
||||
param_5 = float2((x_152 - x_153), (x_155 - x_156));
|
||||
float const x_159 = cross2d_vf2_vf2_(&(param_4), &(param_5));
|
||||
pca = x_159;
|
||||
bool const x_162 = ((x_114 < 0.0f) && (x_159 < 0.0f));
|
||||
x_169_phi = x_162;
|
||||
if (!(x_162)) {
|
||||
x_168 = ((x_114 >= 0.0f) && (x_159 >= 0.0f));
|
||||
x_169_phi = x_168;
|
||||
}
|
||||
bool const x_169 = x_169_phi;
|
||||
if (!(x_169)) {
|
||||
x_90 = true;
|
||||
x_91 = 0;
|
||||
x_173_phi = 0;
|
||||
break;
|
||||
}
|
||||
x_90 = true;
|
||||
x_91 = 1;
|
||||
x_173_phi = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int const x_173 = x_173_phi;
|
||||
return x_173;
|
||||
}
|
||||
|
||||
void main_1(constant buf0& x_24, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) {
|
||||
float2 pos = 0.0f;
|
||||
float2 param_6 = 0.0f;
|
||||
float2 param_7 = 0.0f;
|
||||
float2 param_8 = 0.0f;
|
||||
float2 param_9 = 0.0f;
|
||||
float4 const x_67 = *(tint_symbol_5);
|
||||
float2 const x_70 = x_24.resolution;
|
||||
float2 const x_71 = (float2(x_67.x, x_67.y) / x_70);
|
||||
pos = x_71;
|
||||
param_6 = x_71;
|
||||
param_7 = float2(0.699999988f, 0.300000012f);
|
||||
param_8 = float2(0.5f, 0.899999976f);
|
||||
param_9 = float2(0.100000001f, 0.400000006f);
|
||||
int const x_72 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9));
|
||||
if ((x_72 == 1)) {
|
||||
*(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
} else {
|
||||
*(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_24 [[buffer(0)]]) {
|
||||
thread float4 tint_symbol_7 = 0.0f;
|
||||
thread float4 tint_symbol_8 = 0.0f;
|
||||
tint_symbol_7 = gl_FragCoord_param;
|
||||
main_1(x_24, &(tint_symbol_7), &(tint_symbol_8));
|
||||
main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8};
|
||||
tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
|
||||
return tint_symbol_4;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,360 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 265
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %gl_FragCoord "gl_FragCoord"
|
||||
OpName %buf0 "buf0"
|
||||
OpMemberName %buf0 0 "resolution"
|
||||
OpName %x_24 "x_24"
|
||||
OpName %x_GLF_color "x_GLF_color"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %cross2d_vf2_vf2_ "cross2d_vf2_vf2_"
|
||||
OpName %a "a"
|
||||
OpName %b "b"
|
||||
OpName %pointInTriangle_vf2_vf2_vf2_vf2_ "pointInTriangle_vf2_vf2_vf2_vf2_"
|
||||
OpName %p "p"
|
||||
OpName %a_1 "a_1"
|
||||
OpName %b_1 "b_1"
|
||||
OpName %c "c"
|
||||
OpName %x_90 "x_90"
|
||||
OpName %x_91 "x_91"
|
||||
OpName %pab "pab"
|
||||
OpName %param "param"
|
||||
OpName %param_1 "param_1"
|
||||
OpName %pbc "pbc"
|
||||
OpName %param_2 "param_2"
|
||||
OpName %param_3 "param_3"
|
||||
OpName %pca "pca"
|
||||
OpName %param_4 "param_4"
|
||||
OpName %param_5 "param_5"
|
||||
OpName %x_140 "x_140"
|
||||
OpName %x_168 "x_168"
|
||||
OpName %x_141_phi "x_141_phi"
|
||||
OpName %x_169_phi "x_169_phi"
|
||||
OpName %x_173_phi "x_173_phi"
|
||||
OpName %main_1 "main_1"
|
||||
OpName %pos "pos"
|
||||
OpName %param_6 "param_6"
|
||||
OpName %param_7 "param_7"
|
||||
OpName %param_8 "param_8"
|
||||
OpName %param_9 "param_9"
|
||||
OpName %main_out "main_out"
|
||||
OpMemberName %main_out 0 "x_GLF_color_1"
|
||||
OpName %tint_symbol_3 "tint_symbol_3"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %main "main"
|
||||
OpDecorate %buf0 Block
|
||||
OpMemberDecorate %buf0 0 Offset 0
|
||||
OpDecorate %x_24 NonWritable
|
||||
OpDecorate %x_24 DescriptorSet 0
|
||||
OpDecorate %x_24 Binding 0
|
||||
OpDecorate %tint_symbol BuiltIn FragCoord
|
||||
OpDecorate %tint_symbol_2 Location 0
|
||||
OpMemberDecorate %main_out 0 Offset 0
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Private_v4float = OpTypePointer Private %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5
|
||||
%v2float = OpTypeVector %float 2
|
||||
%buf0 = OpTypeStruct %v2float
|
||||
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
|
||||
%x_24 = OpVariable %_ptr_Uniform_buf0 Uniform
|
||||
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%tint_symbol = OpVariable %_ptr_Input_v4float Input
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%15 = OpTypeFunction %float %_ptr_Function_v2float %_ptr_Function_v2float
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%int = OpTypeInt 32 1
|
||||
%40 = OpTypeFunction %int %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float
|
||||
%bool = OpTypeBool
|
||||
%false = OpConstantFalse %bool
|
||||
%_ptr_Function_bool = OpTypePointer Function %bool
|
||||
%52 = OpConstantNull %bool
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%55 = OpConstantNull %int
|
||||
%57 = OpConstantNull %float
|
||||
%59 = OpConstantNull %v2float
|
||||
%float_0 = OpConstant %float 0
|
||||
%true = OpConstantTrue %bool
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%void = OpTypeVoid
|
||||
%214 = OpTypeFunction %void
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%float_0_699999988 = OpConstant %float 0.699999988
|
||||
%float_0_300000012 = OpConstant %float 0.300000012
|
||||
%233 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%float_0_899999976 = OpConstant %float 0.899999976
|
||||
%236 = OpConstantComposite %v2float %float_0_5 %float_0_899999976
|
||||
%float_0_100000001 = OpConstant %float 0.100000001
|
||||
%float_0_400000006 = OpConstant %float 0.400000006
|
||||
%239 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006
|
||||
%float_1 = OpConstant %float 1
|
||||
%250 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
|
||||
%251 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%252 = OpTypeFunction %void %main_out
|
||||
%cross2d_vf2_vf2_ = OpFunction %float None %15
|
||||
%a = OpFunctionParameter %_ptr_Function_v2float
|
||||
%b = OpFunctionParameter %_ptr_Function_v2float
|
||||
%20 = OpLabel
|
||||
%25 = OpAccessChain %_ptr_Function_float %a %uint_0
|
||||
%26 = OpLoad %float %25
|
||||
%29 = OpAccessChain %_ptr_Function_float %b %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpAccessChain %_ptr_Function_float %b %uint_0
|
||||
%33 = OpLoad %float %32
|
||||
%35 = OpAccessChain %_ptr_Function_float %a %uint_1
|
||||
%36 = OpLoad %float %35
|
||||
%37 = OpFMul %float %26 %30
|
||||
%38 = OpFMul %float %33 %36
|
||||
%39 = OpFSub %float %37 %38
|
||||
OpReturnValue %39
|
||||
OpFunctionEnd
|
||||
%pointInTriangle_vf2_vf2_vf2_vf2_ = OpFunction %int None %40
|
||||
%p = OpFunctionParameter %_ptr_Function_v2float
|
||||
%a_1 = OpFunctionParameter %_ptr_Function_v2float
|
||||
%b_1 = OpFunctionParameter %_ptr_Function_v2float
|
||||
%c = OpFunctionParameter %_ptr_Function_v2float
|
||||
%47 = OpLabel
|
||||
%x_90 = OpVariable %_ptr_Function_bool Function %52
|
||||
%x_91 = OpVariable %_ptr_Function_int Function %55
|
||||
%pab = OpVariable %_ptr_Function_float Function %57
|
||||
%param = OpVariable %_ptr_Function_v2float Function %59
|
||||
%param_1 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%pbc = OpVariable %_ptr_Function_float Function %57
|
||||
%param_2 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%param_3 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%pca = OpVariable %_ptr_Function_float Function %57
|
||||
%param_4 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%param_5 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%x_140 = OpVariable %_ptr_Function_bool Function %52
|
||||
%x_168 = OpVariable %_ptr_Function_bool Function %52
|
||||
%x_141_phi = OpVariable %_ptr_Function_bool Function %52
|
||||
%x_169_phi = OpVariable %_ptr_Function_bool Function %52
|
||||
%x_173_phi = OpVariable %_ptr_Function_int Function %55
|
||||
OpStore %x_90 %false
|
||||
OpSelectionMerge %72 None
|
||||
OpSwitch %uint_0 %73
|
||||
%73 = OpLabel
|
||||
%75 = OpAccessChain %_ptr_Function_float %p %uint_0
|
||||
%76 = OpLoad %float %75
|
||||
%78 = OpAccessChain %_ptr_Function_float %a_1 %uint_0
|
||||
%79 = OpLoad %float %78
|
||||
%81 = OpAccessChain %_ptr_Function_float %p %uint_1
|
||||
%82 = OpLoad %float %81
|
||||
%84 = OpAccessChain %_ptr_Function_float %a_1 %uint_1
|
||||
%85 = OpLoad %float %84
|
||||
%87 = OpAccessChain %_ptr_Function_float %b_1 %uint_0
|
||||
%88 = OpLoad %float %87
|
||||
%90 = OpAccessChain %_ptr_Function_float %a_1 %uint_0
|
||||
%91 = OpLoad %float %90
|
||||
%93 = OpAccessChain %_ptr_Function_float %b_1 %uint_1
|
||||
%94 = OpLoad %float %93
|
||||
%96 = OpAccessChain %_ptr_Function_float %a_1 %uint_1
|
||||
%97 = OpLoad %float %96
|
||||
%98 = OpFSub %float %76 %79
|
||||
%99 = OpFSub %float %82 %85
|
||||
%100 = OpCompositeConstruct %v2float %98 %99
|
||||
OpStore %param %100
|
||||
%101 = OpFSub %float %88 %91
|
||||
%102 = OpFSub %float %94 %97
|
||||
%103 = OpCompositeConstruct %v2float %101 %102
|
||||
OpStore %param_1 %103
|
||||
%104 = OpFunctionCall %float %cross2d_vf2_vf2_ %param %param_1
|
||||
OpStore %pab %104
|
||||
%108 = OpAccessChain %_ptr_Function_float %p %uint_0
|
||||
%109 = OpLoad %float %108
|
||||
%111 = OpAccessChain %_ptr_Function_float %b_1 %uint_0
|
||||
%112 = OpLoad %float %111
|
||||
%114 = OpAccessChain %_ptr_Function_float %p %uint_1
|
||||
%115 = OpLoad %float %114
|
||||
%117 = OpAccessChain %_ptr_Function_float %b_1 %uint_1
|
||||
%118 = OpLoad %float %117
|
||||
%120 = OpAccessChain %_ptr_Function_float %c %uint_0
|
||||
%121 = OpLoad %float %120
|
||||
%123 = OpAccessChain %_ptr_Function_float %b_1 %uint_0
|
||||
%124 = OpLoad %float %123
|
||||
%126 = OpAccessChain %_ptr_Function_float %c %uint_1
|
||||
%127 = OpLoad %float %126
|
||||
%129 = OpAccessChain %_ptr_Function_float %b_1 %uint_1
|
||||
%130 = OpLoad %float %129
|
||||
%131 = OpFSub %float %109 %112
|
||||
%132 = OpFSub %float %115 %118
|
||||
%133 = OpCompositeConstruct %v2float %131 %132
|
||||
OpStore %param_2 %133
|
||||
%134 = OpFSub %float %121 %124
|
||||
%135 = OpFSub %float %127 %130
|
||||
%136 = OpCompositeConstruct %v2float %134 %135
|
||||
OpStore %param_3 %136
|
||||
%137 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_2 %param_3
|
||||
OpStore %pbc %137
|
||||
%141 = OpFOrdLessThan %bool %104 %float_0
|
||||
OpSelectionMerge %142 None
|
||||
OpBranchConditional %141 %143 %142
|
||||
%143 = OpLabel
|
||||
%144 = OpFOrdLessThan %bool %137 %float_0
|
||||
OpBranch %142
|
||||
%142 = OpLabel
|
||||
%145 = OpPhi %bool %141 %73 %144 %143
|
||||
OpStore %x_141_phi %145
|
||||
%146 = OpLogicalNot %bool %145
|
||||
OpSelectionMerge %147 None
|
||||
OpBranchConditional %146 %148 %147
|
||||
%148 = OpLabel
|
||||
%149 = OpFOrdGreaterThanEqual %bool %104 %float_0
|
||||
OpSelectionMerge %150 None
|
||||
OpBranchConditional %149 %151 %150
|
||||
%151 = OpLabel
|
||||
%152 = OpFOrdGreaterThanEqual %bool %137 %float_0
|
||||
OpBranch %150
|
||||
%150 = OpLabel
|
||||
%153 = OpPhi %bool %149 %148 %152 %151
|
||||
OpStore %x_140 %153
|
||||
%154 = OpLoad %bool %x_140
|
||||
OpStore %x_141_phi %154
|
||||
OpBranch %147
|
||||
%147 = OpLabel
|
||||
%155 = OpLoad %bool %x_141_phi
|
||||
%156 = OpLogicalNot %bool %155
|
||||
OpSelectionMerge %157 None
|
||||
OpBranchConditional %156 %158 %157
|
||||
%158 = OpLabel
|
||||
OpStore %x_90 %true
|
||||
OpStore %x_91 %int_0
|
||||
OpStore %x_173_phi %int_0
|
||||
OpBranch %72
|
||||
%157 = OpLabel
|
||||
%162 = OpAccessChain %_ptr_Function_float %p %uint_0
|
||||
%163 = OpLoad %float %162
|
||||
%165 = OpAccessChain %_ptr_Function_float %c %uint_0
|
||||
%166 = OpLoad %float %165
|
||||
%168 = OpAccessChain %_ptr_Function_float %p %uint_1
|
||||
%169 = OpLoad %float %168
|
||||
%171 = OpAccessChain %_ptr_Function_float %c %uint_1
|
||||
%172 = OpLoad %float %171
|
||||
%174 = OpAccessChain %_ptr_Function_float %a_1 %uint_0
|
||||
%175 = OpLoad %float %174
|
||||
%177 = OpAccessChain %_ptr_Function_float %c %uint_0
|
||||
%178 = OpLoad %float %177
|
||||
%180 = OpAccessChain %_ptr_Function_float %a_1 %uint_1
|
||||
%181 = OpLoad %float %180
|
||||
%183 = OpAccessChain %_ptr_Function_float %c %uint_1
|
||||
%184 = OpLoad %float %183
|
||||
%185 = OpFSub %float %163 %166
|
||||
%186 = OpFSub %float %169 %172
|
||||
%187 = OpCompositeConstruct %v2float %185 %186
|
||||
OpStore %param_4 %187
|
||||
%188 = OpFSub %float %175 %178
|
||||
%189 = OpFSub %float %181 %184
|
||||
%190 = OpCompositeConstruct %v2float %188 %189
|
||||
OpStore %param_5 %190
|
||||
%191 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_4 %param_5
|
||||
OpStore %pca %191
|
||||
%194 = OpFOrdLessThan %bool %104 %float_0
|
||||
OpSelectionMerge %195 None
|
||||
OpBranchConditional %194 %196 %195
|
||||
%196 = OpLabel
|
||||
%197 = OpFOrdLessThan %bool %191 %float_0
|
||||
OpBranch %195
|
||||
%195 = OpLabel
|
||||
%198 = OpPhi %bool %194 %157 %197 %196
|
||||
OpStore %x_169_phi %198
|
||||
%199 = OpLogicalNot %bool %198
|
||||
OpSelectionMerge %200 None
|
||||
OpBranchConditional %199 %201 %200
|
||||
%201 = OpLabel
|
||||
%202 = OpFOrdGreaterThanEqual %bool %104 %float_0
|
||||
OpSelectionMerge %203 None
|
||||
OpBranchConditional %202 %204 %203
|
||||
%204 = OpLabel
|
||||
%205 = OpFOrdGreaterThanEqual %bool %191 %float_0
|
||||
OpBranch %203
|
||||
%203 = OpLabel
|
||||
%206 = OpPhi %bool %202 %201 %205 %204
|
||||
OpStore %x_168 %206
|
||||
%207 = OpLoad %bool %x_168
|
||||
OpStore %x_169_phi %207
|
||||
OpBranch %200
|
||||
%200 = OpLabel
|
||||
%208 = OpLoad %bool %x_169_phi
|
||||
%209 = OpLogicalNot %bool %208
|
||||
OpSelectionMerge %210 None
|
||||
OpBranchConditional %209 %211 %210
|
||||
%211 = OpLabel
|
||||
OpStore %x_90 %true
|
||||
OpStore %x_91 %int_0
|
||||
OpStore %x_173_phi %int_0
|
||||
OpBranch %72
|
||||
%210 = OpLabel
|
||||
OpStore %x_90 %true
|
||||
OpStore %x_91 %int_1
|
||||
OpStore %x_173_phi %int_1
|
||||
OpBranch %72
|
||||
%72 = OpLabel
|
||||
%213 = OpLoad %int %x_173_phi
|
||||
OpReturnValue %213
|
||||
OpFunctionEnd
|
||||
%main_1 = OpFunction %void None %214
|
||||
%217 = OpLabel
|
||||
%pos = OpVariable %_ptr_Function_v2float Function %59
|
||||
%param_6 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%param_7 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%param_8 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%param_9 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%223 = OpLoad %v4float %gl_FragCoord
|
||||
%225 = OpAccessChain %_ptr_Uniform_v2float %x_24 %uint_0
|
||||
%226 = OpLoad %v2float %225
|
||||
%227 = OpCompositeExtract %float %223 0
|
||||
%228 = OpCompositeExtract %float %223 1
|
||||
%229 = OpCompositeConstruct %v2float %227 %228
|
||||
%230 = OpFDiv %v2float %229 %226
|
||||
OpStore %pos %230
|
||||
OpStore %param_6 %230
|
||||
OpStore %param_7 %233
|
||||
OpStore %param_8 %236
|
||||
OpStore %param_9 %239
|
||||
%240 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_6 %param_7 %param_8 %param_9
|
||||
%245 = OpIEqual %bool %240 %int_1
|
||||
OpSelectionMerge %246 None
|
||||
OpBranchConditional %245 %247 %248
|
||||
%247 = OpLabel
|
||||
OpStore %x_GLF_color %250
|
||||
OpBranch %246
|
||||
%248 = OpLabel
|
||||
OpStore %x_GLF_color %251
|
||||
OpBranch %246
|
||||
%246 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_3 = OpFunction %void None %252
|
||||
%tint_symbol_1 = OpFunctionParameter %main_out
|
||||
%256 = OpLabel
|
||||
%257 = OpCompositeExtract %v4float %tint_symbol_1 0
|
||||
OpStore %tint_symbol_2 %257
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %214
|
||||
%259 = OpLabel
|
||||
%260 = OpLoad %v4float %tint_symbol
|
||||
OpStore %gl_FragCoord %260
|
||||
%261 = OpFunctionCall %void %main_1
|
||||
%263 = OpLoad %v4float %x_GLF_color
|
||||
%264 = OpCompositeConstruct %main_out %263
|
||||
%262 = OpFunctionCall %void %tint_symbol_3 %264
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,151 @@
|
||||
[[block]]
|
||||
struct buf0 {
|
||||
resolution : vec2<f32>;
|
||||
};
|
||||
|
||||
var<private> gl_FragCoord : vec4<f32>;
|
||||
|
||||
[[group(0), binding(0)]] var<uniform> x_24 : buf0;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn cross2d_vf2_vf2_(a : ptr<function, vec2<f32>>, b : ptr<function, vec2<f32>>) -> f32 {
|
||||
let x_79 : f32 = (*(a)).x;
|
||||
let x_81 : f32 = (*(b)).y;
|
||||
let x_84 : f32 = (*(b)).x;
|
||||
let x_86 : f32 = (*(a)).y;
|
||||
return ((x_79 * x_81) - (x_84 * x_86));
|
||||
}
|
||||
|
||||
fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr<function, vec2<f32>>, a_1 : ptr<function, vec2<f32>>, b_1 : ptr<function, vec2<f32>>, c : ptr<function, vec2<f32>>) -> i32 {
|
||||
var x_90 : bool = false;
|
||||
var x_91 : i32;
|
||||
var pab : f32;
|
||||
var param : vec2<f32>;
|
||||
var param_1 : vec2<f32>;
|
||||
var pbc : f32;
|
||||
var param_2 : vec2<f32>;
|
||||
var param_3 : vec2<f32>;
|
||||
var pca : f32;
|
||||
var param_4 : vec2<f32>;
|
||||
var param_5 : vec2<f32>;
|
||||
var x_140 : bool;
|
||||
var x_168 : bool;
|
||||
var x_141_phi : bool;
|
||||
var x_169_phi : bool;
|
||||
var x_173_phi : i32;
|
||||
switch(0u) {
|
||||
default: {
|
||||
let x_94 : ptr<function, f32> = &((*(p)).x);
|
||||
let x_95 : f32 = *(x_94);
|
||||
let x_96 : ptr<function, f32> = &((*(a_1)).x);
|
||||
let x_97 : f32 = *(x_96);
|
||||
let x_99 : ptr<function, f32> = &((*(p)).y);
|
||||
let x_100 : f32 = *(x_99);
|
||||
let x_101 : ptr<function, f32> = &((*(a_1)).y);
|
||||
let x_102 : f32 = *(x_101);
|
||||
let x_105 : ptr<function, f32> = &((*(b_1)).x);
|
||||
let x_106 : f32 = *(x_105);
|
||||
let x_107 : f32 = *(x_96);
|
||||
let x_109 : ptr<function, f32> = &((*(b_1)).y);
|
||||
let x_110 : f32 = *(x_109);
|
||||
let x_111 : f32 = *(x_101);
|
||||
param = vec2<f32>((x_95 - x_97), (x_100 - x_102));
|
||||
param_1 = vec2<f32>((x_106 - x_107), (x_110 - x_111));
|
||||
let x_114 : f32 = cross2d_vf2_vf2_(&(param), &(param_1));
|
||||
pab = x_114;
|
||||
let x_115 : f32 = *(x_94);
|
||||
let x_116 : f32 = *(x_105);
|
||||
let x_118 : f32 = *(x_99);
|
||||
let x_119 : f32 = *(x_109);
|
||||
let x_122 : ptr<function, f32> = &((*(c)).x);
|
||||
let x_123 : f32 = *(x_122);
|
||||
let x_124 : f32 = *(x_105);
|
||||
let x_126 : ptr<function, f32> = &((*(c)).y);
|
||||
let x_127 : f32 = *(x_126);
|
||||
let x_128 : f32 = *(x_109);
|
||||
param_2 = vec2<f32>((x_115 - x_116), (x_118 - x_119));
|
||||
param_3 = vec2<f32>((x_123 - x_124), (x_127 - x_128));
|
||||
let x_131 : f32 = cross2d_vf2_vf2_(&(param_2), &(param_3));
|
||||
pbc = x_131;
|
||||
let x_134 : bool = ((x_114 < 0.0) && (x_131 < 0.0));
|
||||
x_141_phi = x_134;
|
||||
if (!(x_134)) {
|
||||
x_140 = ((x_114 >= 0.0) && (x_131 >= 0.0));
|
||||
x_141_phi = x_140;
|
||||
}
|
||||
let x_141 : bool = x_141_phi;
|
||||
if (!(x_141)) {
|
||||
x_90 = true;
|
||||
x_91 = 0;
|
||||
x_173_phi = 0;
|
||||
break;
|
||||
}
|
||||
let x_145 : f32 = *(x_94);
|
||||
let x_146 : f32 = *(x_122);
|
||||
let x_148 : f32 = *(x_99);
|
||||
let x_149 : f32 = *(x_126);
|
||||
let x_152 : f32 = *(x_96);
|
||||
let x_153 : f32 = *(x_122);
|
||||
let x_155 : f32 = *(x_101);
|
||||
let x_156 : f32 = *(x_126);
|
||||
param_4 = vec2<f32>((x_145 - x_146), (x_148 - x_149));
|
||||
param_5 = vec2<f32>((x_152 - x_153), (x_155 - x_156));
|
||||
let x_159 : f32 = cross2d_vf2_vf2_(&(param_4), &(param_5));
|
||||
pca = x_159;
|
||||
let x_162 : bool = ((x_114 < 0.0) && (x_159 < 0.0));
|
||||
x_169_phi = x_162;
|
||||
if (!(x_162)) {
|
||||
x_168 = ((x_114 >= 0.0) && (x_159 >= 0.0));
|
||||
x_169_phi = x_168;
|
||||
}
|
||||
let x_169 : bool = x_169_phi;
|
||||
if (!(x_169)) {
|
||||
x_90 = true;
|
||||
x_91 = 0;
|
||||
x_173_phi = 0;
|
||||
break;
|
||||
}
|
||||
x_90 = true;
|
||||
x_91 = 1;
|
||||
x_173_phi = 1;
|
||||
}
|
||||
}
|
||||
let x_173 : i32 = x_173_phi;
|
||||
return x_173;
|
||||
}
|
||||
|
||||
fn main_1() {
|
||||
var pos : vec2<f32>;
|
||||
var param_6 : vec2<f32>;
|
||||
var param_7 : vec2<f32>;
|
||||
var param_8 : vec2<f32>;
|
||||
var param_9 : vec2<f32>;
|
||||
let x_67 : vec4<f32> = gl_FragCoord;
|
||||
let x_70 : vec2<f32> = x_24.resolution;
|
||||
let x_71 : vec2<f32> = (vec2<f32>(x_67.x, x_67.y) / x_70);
|
||||
pos = x_71;
|
||||
param_6 = x_71;
|
||||
param_7 = vec2<f32>(0.699999988, 0.300000012);
|
||||
param_8 = vec2<f32>(0.5, 0.899999976);
|
||||
param_9 = vec2<f32>(0.100000001, 0.400000006);
|
||||
let x_72 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9));
|
||||
if ((x_72 == 1)) {
|
||||
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
} else {
|
||||
x_GLF_color = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
[[location(0)]]
|
||||
x_GLF_color_1 : vec4<f32>;
|
||||
};
|
||||
|
||||
[[stage(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);
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
[[block]]
|
||||
struct buf0 {
|
||||
resolution : vec2<f32>;
|
||||
};
|
||||
|
||||
var<private> gl_FragCoord : vec4<f32>;
|
||||
|
||||
[[group(0), binding(0)]] var<uniform> x_24 : buf0;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn cross2d_vf2_vf2_(a : ptr<function, vec2<f32>>, b : ptr<function, vec2<f32>>) -> f32 {
|
||||
let x_79 : f32 = (*(a)).x;
|
||||
let x_81 : f32 = (*(b)).y;
|
||||
let x_84 : f32 = (*(b)).x;
|
||||
let x_86 : f32 = (*(a)).y;
|
||||
return ((x_79 * x_81) - (x_84 * x_86));
|
||||
}
|
||||
|
||||
fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr<function, vec2<f32>>, a_1 : ptr<function, vec2<f32>>, b_1 : ptr<function, vec2<f32>>, c : ptr<function, vec2<f32>>) -> i32 {
|
||||
var x_90 : bool = false;
|
||||
var x_91 : i32;
|
||||
var pab : f32;
|
||||
var param : vec2<f32>;
|
||||
var param_1 : vec2<f32>;
|
||||
var pbc : f32;
|
||||
var param_2 : vec2<f32>;
|
||||
var param_3 : vec2<f32>;
|
||||
var pca : f32;
|
||||
var param_4 : vec2<f32>;
|
||||
var param_5 : vec2<f32>;
|
||||
var x_140 : bool;
|
||||
var x_168 : bool;
|
||||
var x_141_phi : bool;
|
||||
var x_169_phi : bool;
|
||||
var x_173_phi : i32;
|
||||
switch(0u) {
|
||||
default: {
|
||||
let x_94 : ptr<function, f32> = &((*(p)).x);
|
||||
let x_95 : f32 = *(x_94);
|
||||
let x_96 : ptr<function, f32> = &((*(a_1)).x);
|
||||
let x_97 : f32 = *(x_96);
|
||||
let x_99 : ptr<function, f32> = &((*(p)).y);
|
||||
let x_100 : f32 = *(x_99);
|
||||
let x_101 : ptr<function, f32> = &((*(a_1)).y);
|
||||
let x_102 : f32 = *(x_101);
|
||||
let x_105 : ptr<function, f32> = &((*(b_1)).x);
|
||||
let x_106 : f32 = *(x_105);
|
||||
let x_107 : f32 = *(x_96);
|
||||
let x_109 : ptr<function, f32> = &((*(b_1)).y);
|
||||
let x_110 : f32 = *(x_109);
|
||||
let x_111 : f32 = *(x_101);
|
||||
param = vec2<f32>((x_95 - x_97), (x_100 - x_102));
|
||||
param_1 = vec2<f32>((x_106 - x_107), (x_110 - x_111));
|
||||
let x_114 : f32 = cross2d_vf2_vf2_(&(param), &(param_1));
|
||||
pab = x_114;
|
||||
let x_115 : f32 = *(x_94);
|
||||
let x_116 : f32 = *(x_105);
|
||||
let x_118 : f32 = *(x_99);
|
||||
let x_119 : f32 = *(x_109);
|
||||
let x_122 : ptr<function, f32> = &((*(c)).x);
|
||||
let x_123 : f32 = *(x_122);
|
||||
let x_124 : f32 = *(x_105);
|
||||
let x_126 : ptr<function, f32> = &((*(c)).y);
|
||||
let x_127 : f32 = *(x_126);
|
||||
let x_128 : f32 = *(x_109);
|
||||
param_2 = vec2<f32>((x_115 - x_116), (x_118 - x_119));
|
||||
param_3 = vec2<f32>((x_123 - x_124), (x_127 - x_128));
|
||||
let x_131 : f32 = cross2d_vf2_vf2_(&(param_2), &(param_3));
|
||||
pbc = x_131;
|
||||
let x_134 : bool = ((x_114 < 0.0) && (x_131 < 0.0));
|
||||
x_141_phi = x_134;
|
||||
if (!(x_134)) {
|
||||
x_140 = ((x_114 >= 0.0) && (x_131 >= 0.0));
|
||||
x_141_phi = x_140;
|
||||
}
|
||||
let x_141 : bool = x_141_phi;
|
||||
if (!(x_141)) {
|
||||
x_90 = true;
|
||||
x_91 = 0;
|
||||
x_173_phi = 0;
|
||||
break;
|
||||
}
|
||||
let x_145 : f32 = *(x_94);
|
||||
let x_146 : f32 = *(x_122);
|
||||
let x_148 : f32 = *(x_99);
|
||||
let x_149 : f32 = *(x_126);
|
||||
let x_152 : f32 = *(x_96);
|
||||
let x_153 : f32 = *(x_122);
|
||||
let x_155 : f32 = *(x_101);
|
||||
let x_156 : f32 = *(x_126);
|
||||
param_4 = vec2<f32>((x_145 - x_146), (x_148 - x_149));
|
||||
param_5 = vec2<f32>((x_152 - x_153), (x_155 - x_156));
|
||||
let x_159 : f32 = cross2d_vf2_vf2_(&(param_4), &(param_5));
|
||||
pca = x_159;
|
||||
let x_162 : bool = ((x_114 < 0.0) && (x_159 < 0.0));
|
||||
x_169_phi = x_162;
|
||||
if (!(x_162)) {
|
||||
x_168 = ((x_114 >= 0.0) && (x_159 >= 0.0));
|
||||
x_169_phi = x_168;
|
||||
}
|
||||
let x_169 : bool = x_169_phi;
|
||||
if (!(x_169)) {
|
||||
x_90 = true;
|
||||
x_91 = 0;
|
||||
x_173_phi = 0;
|
||||
break;
|
||||
}
|
||||
x_90 = true;
|
||||
x_91 = 1;
|
||||
x_173_phi = 1;
|
||||
}
|
||||
}
|
||||
let x_173 : i32 = x_173_phi;
|
||||
return x_173;
|
||||
}
|
||||
|
||||
fn main_1() {
|
||||
var pos : vec2<f32>;
|
||||
var param_6 : vec2<f32>;
|
||||
var param_7 : vec2<f32>;
|
||||
var param_8 : vec2<f32>;
|
||||
var param_9 : vec2<f32>;
|
||||
let x_67 : vec4<f32> = gl_FragCoord;
|
||||
let x_70 : vec2<f32> = x_24.resolution;
|
||||
let x_71 : vec2<f32> = (vec2<f32>(x_67.x, x_67.y) / x_70);
|
||||
pos = x_71;
|
||||
param_6 = x_71;
|
||||
param_7 = vec2<f32>(0.699999988, 0.300000012);
|
||||
param_8 = vec2<f32>(0.5, 0.899999976);
|
||||
param_9 = vec2<f32>(0.100000001, 0.400000006);
|
||||
let x_72 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9));
|
||||
if ((x_72 == 1)) {
|
||||
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
} else {
|
||||
x_GLF_color = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
[[location(0)]]
|
||||
x_GLF_color_1 : vec4<f32>;
|
||||
};
|
||||
|
||||
[[stage(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);
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
cbuffer cbuffer_x_24 : register(b0, space0) {
|
||||
uint4 x_24[1];
|
||||
};
|
||||
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
float cross2d_vf2_vf2_(inout float2 a, inout float2 b) {
|
||||
const float x_79 = a.x;
|
||||
const float x_81 = b.y;
|
||||
const float x_84 = b.x;
|
||||
const float x_86 = a.y;
|
||||
return ((x_79 * x_81) - (x_84 * x_86));
|
||||
}
|
||||
|
||||
int pointInTriangle_vf2_vf2_vf2_vf2_(inout float2 p, inout float2 a_1, inout float2 b_1, inout float2 c) {
|
||||
bool x_90 = false;
|
||||
int x_91 = 0;
|
||||
float pab = 0.0f;
|
||||
float2 param = float2(0.0f, 0.0f);
|
||||
float2 param_1 = float2(0.0f, 0.0f);
|
||||
float pbc = 0.0f;
|
||||
float2 param_2 = float2(0.0f, 0.0f);
|
||||
float2 param_3 = float2(0.0f, 0.0f);
|
||||
float pca = 0.0f;
|
||||
float2 param_4 = float2(0.0f, 0.0f);
|
||||
float2 param_5 = float2(0.0f, 0.0f);
|
||||
bool x_140 = false;
|
||||
bool x_168 = false;
|
||||
bool x_141_phi = false;
|
||||
bool x_169_phi = false;
|
||||
int x_173_phi = 0;
|
||||
switch(0u) {
|
||||
default: {
|
||||
const float x_95 = p.x;
|
||||
const float x_97 = a_1.x;
|
||||
const float x_100 = p.y;
|
||||
const float x_102 = a_1.y;
|
||||
const float x_106 = b_1.x;
|
||||
const float x_107 = a_1.x;
|
||||
const float x_110 = b_1.y;
|
||||
const float x_111 = a_1.y;
|
||||
param = float2((x_95 - x_97), (x_100 - x_102));
|
||||
param_1 = float2((x_106 - x_107), (x_110 - x_111));
|
||||
const float x_114 = cross2d_vf2_vf2_(param, param_1);
|
||||
pab = x_114;
|
||||
const float x_115 = p.x;
|
||||
const float x_116 = b_1.x;
|
||||
const float x_118 = p.y;
|
||||
const float x_119 = b_1.y;
|
||||
const float x_123 = c.x;
|
||||
const float x_124 = b_1.x;
|
||||
const float x_127 = c.y;
|
||||
const float x_128 = b_1.y;
|
||||
param_2 = float2((x_115 - x_116), (x_118 - x_119));
|
||||
param_3 = float2((x_123 - x_124), (x_127 - x_128));
|
||||
const float x_131 = cross2d_vf2_vf2_(param_2, param_3);
|
||||
pbc = x_131;
|
||||
bool tint_tmp = (x_114 < 0.0f);
|
||||
if (tint_tmp) {
|
||||
tint_tmp = (x_131 < 0.0f);
|
||||
}
|
||||
const bool x_134 = (tint_tmp);
|
||||
x_141_phi = x_134;
|
||||
if (!(x_134)) {
|
||||
bool tint_tmp_1 = (x_114 >= 0.0f);
|
||||
if (tint_tmp_1) {
|
||||
tint_tmp_1 = (x_131 >= 0.0f);
|
||||
}
|
||||
x_140 = (tint_tmp_1);
|
||||
x_141_phi = x_140;
|
||||
}
|
||||
if (!(x_141_phi)) {
|
||||
x_90 = true;
|
||||
x_91 = 0;
|
||||
x_173_phi = 0;
|
||||
break;
|
||||
}
|
||||
const float x_145 = p.x;
|
||||
const float x_146 = c.x;
|
||||
const float x_148 = p.y;
|
||||
const float x_149 = c.y;
|
||||
const float x_152 = a_1.x;
|
||||
const float x_153 = c.x;
|
||||
const float x_155 = a_1.y;
|
||||
const float x_156 = c.y;
|
||||
param_4 = float2((x_145 - x_146), (x_148 - x_149));
|
||||
param_5 = float2((x_152 - x_153), (x_155 - x_156));
|
||||
const float x_159 = cross2d_vf2_vf2_(param_4, param_5);
|
||||
pca = x_159;
|
||||
bool tint_tmp_2 = (x_114 < 0.0f);
|
||||
if (tint_tmp_2) {
|
||||
tint_tmp_2 = (x_159 < 0.0f);
|
||||
}
|
||||
const bool x_162 = (tint_tmp_2);
|
||||
x_169_phi = x_162;
|
||||
if (!(x_162)) {
|
||||
bool tint_tmp_3 = (x_114 >= 0.0f);
|
||||
if (tint_tmp_3) {
|
||||
tint_tmp_3 = (x_159 >= 0.0f);
|
||||
}
|
||||
x_168 = (tint_tmp_3);
|
||||
x_169_phi = x_168;
|
||||
}
|
||||
if (!(x_169_phi)) {
|
||||
x_90 = true;
|
||||
x_91 = 0;
|
||||
x_173_phi = 0;
|
||||
break;
|
||||
}
|
||||
x_90 = true;
|
||||
x_91 = 1;
|
||||
x_173_phi = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return x_173_phi;
|
||||
}
|
||||
|
||||
void main_1() {
|
||||
float2 pos = float2(0.0f, 0.0f);
|
||||
float2 param_6 = float2(0.0f, 0.0f);
|
||||
float2 param_7 = float2(0.0f, 0.0f);
|
||||
float2 param_8 = float2(0.0f, 0.0f);
|
||||
float2 param_9 = float2(0.0f, 0.0f);
|
||||
const float4 x_67 = gl_FragCoord;
|
||||
const float2 x_70 = asfloat(x_24[0].xy);
|
||||
const float2 x_71 = (float2(x_67.x, x_67.y) / x_70);
|
||||
pos = x_71;
|
||||
param_6 = x_71;
|
||||
param_7 = float2(0.699999988f, 0.300000012f);
|
||||
param_8 = float2(0.5f, 0.899999976f);
|
||||
param_9 = float2(0.100000001f, 0.400000006f);
|
||||
const int x_72 = pointInTriangle_vf2_vf2_vf2_vf2_(param_6, param_7, param_8, param_9);
|
||||
if ((x_72 == 1)) {
|
||||
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
} else {
|
||||
x_GLF_color = float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol_1 {
|
||||
float4 gl_FragCoord_param : SV_Position;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float4 x_GLF_color_1 : SV_Target0;
|
||||
};
|
||||
|
||||
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
||||
const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param;
|
||||
gl_FragCoord = gl_FragCoord_param;
|
||||
main_1();
|
||||
const main_out tint_symbol_3 = {x_GLF_color};
|
||||
const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct buf0 {
|
||||
/* 0x0000 */ packed_float2 resolution;
|
||||
};
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float4 x_GLF_color_1 [[color(0)]];
|
||||
};
|
||||
|
||||
float cross2d_vf2_vf2_(thread float2* const a, thread float2* const b) {
|
||||
float const x_79 = (*(a)).x;
|
||||
float const x_81 = (*(b)).y;
|
||||
float const x_84 = (*(b)).x;
|
||||
float const x_86 = (*(a)).y;
|
||||
return ((x_79 * x_81) - (x_84 * x_86));
|
||||
}
|
||||
|
||||
int pointInTriangle_vf2_vf2_vf2_vf2_(thread float2* const p, thread float2* const a_1, thread float2* const b_1, thread float2* const c) {
|
||||
bool x_90 = false;
|
||||
int x_91 = 0;
|
||||
float pab = 0.0f;
|
||||
float2 param = 0.0f;
|
||||
float2 param_1 = 0.0f;
|
||||
float pbc = 0.0f;
|
||||
float2 param_2 = 0.0f;
|
||||
float2 param_3 = 0.0f;
|
||||
float pca = 0.0f;
|
||||
float2 param_4 = 0.0f;
|
||||
float2 param_5 = 0.0f;
|
||||
bool x_140 = false;
|
||||
bool x_168 = false;
|
||||
bool x_141_phi = false;
|
||||
bool x_169_phi = false;
|
||||
int x_173_phi = 0;
|
||||
switch(0u) {
|
||||
default: {
|
||||
float const x_95 = (*(p)).x;
|
||||
float const x_97 = (*(a_1)).x;
|
||||
float const x_100 = (*(p)).y;
|
||||
float const x_102 = (*(a_1)).y;
|
||||
float const x_106 = (*(b_1)).x;
|
||||
float const x_107 = (*(a_1)).x;
|
||||
float const x_110 = (*(b_1)).y;
|
||||
float const x_111 = (*(a_1)).y;
|
||||
param = float2((x_95 - x_97), (x_100 - x_102));
|
||||
param_1 = float2((x_106 - x_107), (x_110 - x_111));
|
||||
float const x_114 = cross2d_vf2_vf2_(&(param), &(param_1));
|
||||
pab = x_114;
|
||||
float const x_115 = (*(p)).x;
|
||||
float const x_116 = (*(b_1)).x;
|
||||
float const x_118 = (*(p)).y;
|
||||
float const x_119 = (*(b_1)).y;
|
||||
float const x_123 = (*(c)).x;
|
||||
float const x_124 = (*(b_1)).x;
|
||||
float const x_127 = (*(c)).y;
|
||||
float const x_128 = (*(b_1)).y;
|
||||
param_2 = float2((x_115 - x_116), (x_118 - x_119));
|
||||
param_3 = float2((x_123 - x_124), (x_127 - x_128));
|
||||
float const x_131 = cross2d_vf2_vf2_(&(param_2), &(param_3));
|
||||
pbc = x_131;
|
||||
bool const x_134 = ((x_114 < 0.0f) && (x_131 < 0.0f));
|
||||
x_141_phi = x_134;
|
||||
if (!(x_134)) {
|
||||
x_140 = ((x_114 >= 0.0f) && (x_131 >= 0.0f));
|
||||
x_141_phi = x_140;
|
||||
}
|
||||
bool const x_141 = x_141_phi;
|
||||
if (!(x_141)) {
|
||||
x_90 = true;
|
||||
x_91 = 0;
|
||||
x_173_phi = 0;
|
||||
break;
|
||||
}
|
||||
float const x_145 = (*(p)).x;
|
||||
float const x_146 = (*(c)).x;
|
||||
float const x_148 = (*(p)).y;
|
||||
float const x_149 = (*(c)).y;
|
||||
float const x_152 = (*(a_1)).x;
|
||||
float const x_153 = (*(c)).x;
|
||||
float const x_155 = (*(a_1)).y;
|
||||
float const x_156 = (*(c)).y;
|
||||
param_4 = float2((x_145 - x_146), (x_148 - x_149));
|
||||
param_5 = float2((x_152 - x_153), (x_155 - x_156));
|
||||
float const x_159 = cross2d_vf2_vf2_(&(param_4), &(param_5));
|
||||
pca = x_159;
|
||||
bool const x_162 = ((x_114 < 0.0f) && (x_159 < 0.0f));
|
||||
x_169_phi = x_162;
|
||||
if (!(x_162)) {
|
||||
x_168 = ((x_114 >= 0.0f) && (x_159 >= 0.0f));
|
||||
x_169_phi = x_168;
|
||||
}
|
||||
bool const x_169 = x_169_phi;
|
||||
if (!(x_169)) {
|
||||
x_90 = true;
|
||||
x_91 = 0;
|
||||
x_173_phi = 0;
|
||||
break;
|
||||
}
|
||||
x_90 = true;
|
||||
x_91 = 1;
|
||||
x_173_phi = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int const x_173 = x_173_phi;
|
||||
return x_173;
|
||||
}
|
||||
|
||||
void main_1(constant buf0& x_24, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) {
|
||||
float2 pos = 0.0f;
|
||||
float2 param_6 = 0.0f;
|
||||
float2 param_7 = 0.0f;
|
||||
float2 param_8 = 0.0f;
|
||||
float2 param_9 = 0.0f;
|
||||
float4 const x_67 = *(tint_symbol_5);
|
||||
float2 const x_70 = x_24.resolution;
|
||||
float2 const x_71 = (float2(x_67.x, x_67.y) / x_70);
|
||||
pos = x_71;
|
||||
param_6 = x_71;
|
||||
param_7 = float2(0.699999988f, 0.300000012f);
|
||||
param_8 = float2(0.5f, 0.899999976f);
|
||||
param_9 = float2(0.100000001f, 0.400000006f);
|
||||
int const x_72 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9));
|
||||
if ((x_72 == 1)) {
|
||||
*(tint_symbol_6) = float4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
} else {
|
||||
*(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_24 [[buffer(0)]]) {
|
||||
thread float4 tint_symbol_7 = 0.0f;
|
||||
thread float4 tint_symbol_8 = 0.0f;
|
||||
tint_symbol_7 = gl_FragCoord_param;
|
||||
main_1(x_24, &(tint_symbol_7), &(tint_symbol_8));
|
||||
main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_8};
|
||||
tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
|
||||
return tint_symbol_4;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,360 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 265
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %gl_FragCoord "gl_FragCoord"
|
||||
OpName %buf0 "buf0"
|
||||
OpMemberName %buf0 0 "resolution"
|
||||
OpName %x_24 "x_24"
|
||||
OpName %x_GLF_color "x_GLF_color"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %cross2d_vf2_vf2_ "cross2d_vf2_vf2_"
|
||||
OpName %a "a"
|
||||
OpName %b "b"
|
||||
OpName %pointInTriangle_vf2_vf2_vf2_vf2_ "pointInTriangle_vf2_vf2_vf2_vf2_"
|
||||
OpName %p "p"
|
||||
OpName %a_1 "a_1"
|
||||
OpName %b_1 "b_1"
|
||||
OpName %c "c"
|
||||
OpName %x_90 "x_90"
|
||||
OpName %x_91 "x_91"
|
||||
OpName %pab "pab"
|
||||
OpName %param "param"
|
||||
OpName %param_1 "param_1"
|
||||
OpName %pbc "pbc"
|
||||
OpName %param_2 "param_2"
|
||||
OpName %param_3 "param_3"
|
||||
OpName %pca "pca"
|
||||
OpName %param_4 "param_4"
|
||||
OpName %param_5 "param_5"
|
||||
OpName %x_140 "x_140"
|
||||
OpName %x_168 "x_168"
|
||||
OpName %x_141_phi "x_141_phi"
|
||||
OpName %x_169_phi "x_169_phi"
|
||||
OpName %x_173_phi "x_173_phi"
|
||||
OpName %main_1 "main_1"
|
||||
OpName %pos "pos"
|
||||
OpName %param_6 "param_6"
|
||||
OpName %param_7 "param_7"
|
||||
OpName %param_8 "param_8"
|
||||
OpName %param_9 "param_9"
|
||||
OpName %main_out "main_out"
|
||||
OpMemberName %main_out 0 "x_GLF_color_1"
|
||||
OpName %tint_symbol_3 "tint_symbol_3"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %main "main"
|
||||
OpDecorate %buf0 Block
|
||||
OpMemberDecorate %buf0 0 Offset 0
|
||||
OpDecorate %x_24 NonWritable
|
||||
OpDecorate %x_24 DescriptorSet 0
|
||||
OpDecorate %x_24 Binding 0
|
||||
OpDecorate %tint_symbol BuiltIn FragCoord
|
||||
OpDecorate %tint_symbol_2 Location 0
|
||||
OpMemberDecorate %main_out 0 Offset 0
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Private_v4float = OpTypePointer Private %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5
|
||||
%v2float = OpTypeVector %float 2
|
||||
%buf0 = OpTypeStruct %v2float
|
||||
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
|
||||
%x_24 = OpVariable %_ptr_Uniform_buf0 Uniform
|
||||
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%tint_symbol = OpVariable %_ptr_Input_v4float Input
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%15 = OpTypeFunction %float %_ptr_Function_v2float %_ptr_Function_v2float
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%int = OpTypeInt 32 1
|
||||
%40 = OpTypeFunction %int %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float %_ptr_Function_v2float
|
||||
%bool = OpTypeBool
|
||||
%false = OpConstantFalse %bool
|
||||
%_ptr_Function_bool = OpTypePointer Function %bool
|
||||
%52 = OpConstantNull %bool
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%55 = OpConstantNull %int
|
||||
%57 = OpConstantNull %float
|
||||
%59 = OpConstantNull %v2float
|
||||
%float_0 = OpConstant %float 0
|
||||
%true = OpConstantTrue %bool
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%void = OpTypeVoid
|
||||
%214 = OpTypeFunction %void
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%float_0_699999988 = OpConstant %float 0.699999988
|
||||
%float_0_300000012 = OpConstant %float 0.300000012
|
||||
%233 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%float_0_899999976 = OpConstant %float 0.899999976
|
||||
%236 = OpConstantComposite %v2float %float_0_5 %float_0_899999976
|
||||
%float_0_100000001 = OpConstant %float 0.100000001
|
||||
%float_0_400000006 = OpConstant %float 0.400000006
|
||||
%239 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006
|
||||
%float_1 = OpConstant %float 1
|
||||
%250 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
|
||||
%251 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%252 = OpTypeFunction %void %main_out
|
||||
%cross2d_vf2_vf2_ = OpFunction %float None %15
|
||||
%a = OpFunctionParameter %_ptr_Function_v2float
|
||||
%b = OpFunctionParameter %_ptr_Function_v2float
|
||||
%20 = OpLabel
|
||||
%25 = OpAccessChain %_ptr_Function_float %a %uint_0
|
||||
%26 = OpLoad %float %25
|
||||
%29 = OpAccessChain %_ptr_Function_float %b %uint_1
|
||||
%30 = OpLoad %float %29
|
||||
%32 = OpAccessChain %_ptr_Function_float %b %uint_0
|
||||
%33 = OpLoad %float %32
|
||||
%35 = OpAccessChain %_ptr_Function_float %a %uint_1
|
||||
%36 = OpLoad %float %35
|
||||
%37 = OpFMul %float %26 %30
|
||||
%38 = OpFMul %float %33 %36
|
||||
%39 = OpFSub %float %37 %38
|
||||
OpReturnValue %39
|
||||
OpFunctionEnd
|
||||
%pointInTriangle_vf2_vf2_vf2_vf2_ = OpFunction %int None %40
|
||||
%p = OpFunctionParameter %_ptr_Function_v2float
|
||||
%a_1 = OpFunctionParameter %_ptr_Function_v2float
|
||||
%b_1 = OpFunctionParameter %_ptr_Function_v2float
|
||||
%c = OpFunctionParameter %_ptr_Function_v2float
|
||||
%47 = OpLabel
|
||||
%x_90 = OpVariable %_ptr_Function_bool Function %52
|
||||
%x_91 = OpVariable %_ptr_Function_int Function %55
|
||||
%pab = OpVariable %_ptr_Function_float Function %57
|
||||
%param = OpVariable %_ptr_Function_v2float Function %59
|
||||
%param_1 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%pbc = OpVariable %_ptr_Function_float Function %57
|
||||
%param_2 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%param_3 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%pca = OpVariable %_ptr_Function_float Function %57
|
||||
%param_4 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%param_5 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%x_140 = OpVariable %_ptr_Function_bool Function %52
|
||||
%x_168 = OpVariable %_ptr_Function_bool Function %52
|
||||
%x_141_phi = OpVariable %_ptr_Function_bool Function %52
|
||||
%x_169_phi = OpVariable %_ptr_Function_bool Function %52
|
||||
%x_173_phi = OpVariable %_ptr_Function_int Function %55
|
||||
OpStore %x_90 %false
|
||||
OpSelectionMerge %72 None
|
||||
OpSwitch %uint_0 %73
|
||||
%73 = OpLabel
|
||||
%75 = OpAccessChain %_ptr_Function_float %p %uint_0
|
||||
%76 = OpLoad %float %75
|
||||
%78 = OpAccessChain %_ptr_Function_float %a_1 %uint_0
|
||||
%79 = OpLoad %float %78
|
||||
%81 = OpAccessChain %_ptr_Function_float %p %uint_1
|
||||
%82 = OpLoad %float %81
|
||||
%84 = OpAccessChain %_ptr_Function_float %a_1 %uint_1
|
||||
%85 = OpLoad %float %84
|
||||
%87 = OpAccessChain %_ptr_Function_float %b_1 %uint_0
|
||||
%88 = OpLoad %float %87
|
||||
%90 = OpAccessChain %_ptr_Function_float %a_1 %uint_0
|
||||
%91 = OpLoad %float %90
|
||||
%93 = OpAccessChain %_ptr_Function_float %b_1 %uint_1
|
||||
%94 = OpLoad %float %93
|
||||
%96 = OpAccessChain %_ptr_Function_float %a_1 %uint_1
|
||||
%97 = OpLoad %float %96
|
||||
%98 = OpFSub %float %76 %79
|
||||
%99 = OpFSub %float %82 %85
|
||||
%100 = OpCompositeConstruct %v2float %98 %99
|
||||
OpStore %param %100
|
||||
%101 = OpFSub %float %88 %91
|
||||
%102 = OpFSub %float %94 %97
|
||||
%103 = OpCompositeConstruct %v2float %101 %102
|
||||
OpStore %param_1 %103
|
||||
%104 = OpFunctionCall %float %cross2d_vf2_vf2_ %param %param_1
|
||||
OpStore %pab %104
|
||||
%108 = OpAccessChain %_ptr_Function_float %p %uint_0
|
||||
%109 = OpLoad %float %108
|
||||
%111 = OpAccessChain %_ptr_Function_float %b_1 %uint_0
|
||||
%112 = OpLoad %float %111
|
||||
%114 = OpAccessChain %_ptr_Function_float %p %uint_1
|
||||
%115 = OpLoad %float %114
|
||||
%117 = OpAccessChain %_ptr_Function_float %b_1 %uint_1
|
||||
%118 = OpLoad %float %117
|
||||
%120 = OpAccessChain %_ptr_Function_float %c %uint_0
|
||||
%121 = OpLoad %float %120
|
||||
%123 = OpAccessChain %_ptr_Function_float %b_1 %uint_0
|
||||
%124 = OpLoad %float %123
|
||||
%126 = OpAccessChain %_ptr_Function_float %c %uint_1
|
||||
%127 = OpLoad %float %126
|
||||
%129 = OpAccessChain %_ptr_Function_float %b_1 %uint_1
|
||||
%130 = OpLoad %float %129
|
||||
%131 = OpFSub %float %109 %112
|
||||
%132 = OpFSub %float %115 %118
|
||||
%133 = OpCompositeConstruct %v2float %131 %132
|
||||
OpStore %param_2 %133
|
||||
%134 = OpFSub %float %121 %124
|
||||
%135 = OpFSub %float %127 %130
|
||||
%136 = OpCompositeConstruct %v2float %134 %135
|
||||
OpStore %param_3 %136
|
||||
%137 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_2 %param_3
|
||||
OpStore %pbc %137
|
||||
%141 = OpFOrdLessThan %bool %104 %float_0
|
||||
OpSelectionMerge %142 None
|
||||
OpBranchConditional %141 %143 %142
|
||||
%143 = OpLabel
|
||||
%144 = OpFOrdLessThan %bool %137 %float_0
|
||||
OpBranch %142
|
||||
%142 = OpLabel
|
||||
%145 = OpPhi %bool %141 %73 %144 %143
|
||||
OpStore %x_141_phi %145
|
||||
%146 = OpLogicalNot %bool %145
|
||||
OpSelectionMerge %147 None
|
||||
OpBranchConditional %146 %148 %147
|
||||
%148 = OpLabel
|
||||
%149 = OpFOrdGreaterThanEqual %bool %104 %float_0
|
||||
OpSelectionMerge %150 None
|
||||
OpBranchConditional %149 %151 %150
|
||||
%151 = OpLabel
|
||||
%152 = OpFOrdGreaterThanEqual %bool %137 %float_0
|
||||
OpBranch %150
|
||||
%150 = OpLabel
|
||||
%153 = OpPhi %bool %149 %148 %152 %151
|
||||
OpStore %x_140 %153
|
||||
%154 = OpLoad %bool %x_140
|
||||
OpStore %x_141_phi %154
|
||||
OpBranch %147
|
||||
%147 = OpLabel
|
||||
%155 = OpLoad %bool %x_141_phi
|
||||
%156 = OpLogicalNot %bool %155
|
||||
OpSelectionMerge %157 None
|
||||
OpBranchConditional %156 %158 %157
|
||||
%158 = OpLabel
|
||||
OpStore %x_90 %true
|
||||
OpStore %x_91 %int_0
|
||||
OpStore %x_173_phi %int_0
|
||||
OpBranch %72
|
||||
%157 = OpLabel
|
||||
%162 = OpAccessChain %_ptr_Function_float %p %uint_0
|
||||
%163 = OpLoad %float %162
|
||||
%165 = OpAccessChain %_ptr_Function_float %c %uint_0
|
||||
%166 = OpLoad %float %165
|
||||
%168 = OpAccessChain %_ptr_Function_float %p %uint_1
|
||||
%169 = OpLoad %float %168
|
||||
%171 = OpAccessChain %_ptr_Function_float %c %uint_1
|
||||
%172 = OpLoad %float %171
|
||||
%174 = OpAccessChain %_ptr_Function_float %a_1 %uint_0
|
||||
%175 = OpLoad %float %174
|
||||
%177 = OpAccessChain %_ptr_Function_float %c %uint_0
|
||||
%178 = OpLoad %float %177
|
||||
%180 = OpAccessChain %_ptr_Function_float %a_1 %uint_1
|
||||
%181 = OpLoad %float %180
|
||||
%183 = OpAccessChain %_ptr_Function_float %c %uint_1
|
||||
%184 = OpLoad %float %183
|
||||
%185 = OpFSub %float %163 %166
|
||||
%186 = OpFSub %float %169 %172
|
||||
%187 = OpCompositeConstruct %v2float %185 %186
|
||||
OpStore %param_4 %187
|
||||
%188 = OpFSub %float %175 %178
|
||||
%189 = OpFSub %float %181 %184
|
||||
%190 = OpCompositeConstruct %v2float %188 %189
|
||||
OpStore %param_5 %190
|
||||
%191 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_4 %param_5
|
||||
OpStore %pca %191
|
||||
%194 = OpFOrdLessThan %bool %104 %float_0
|
||||
OpSelectionMerge %195 None
|
||||
OpBranchConditional %194 %196 %195
|
||||
%196 = OpLabel
|
||||
%197 = OpFOrdLessThan %bool %191 %float_0
|
||||
OpBranch %195
|
||||
%195 = OpLabel
|
||||
%198 = OpPhi %bool %194 %157 %197 %196
|
||||
OpStore %x_169_phi %198
|
||||
%199 = OpLogicalNot %bool %198
|
||||
OpSelectionMerge %200 None
|
||||
OpBranchConditional %199 %201 %200
|
||||
%201 = OpLabel
|
||||
%202 = OpFOrdGreaterThanEqual %bool %104 %float_0
|
||||
OpSelectionMerge %203 None
|
||||
OpBranchConditional %202 %204 %203
|
||||
%204 = OpLabel
|
||||
%205 = OpFOrdGreaterThanEqual %bool %191 %float_0
|
||||
OpBranch %203
|
||||
%203 = OpLabel
|
||||
%206 = OpPhi %bool %202 %201 %205 %204
|
||||
OpStore %x_168 %206
|
||||
%207 = OpLoad %bool %x_168
|
||||
OpStore %x_169_phi %207
|
||||
OpBranch %200
|
||||
%200 = OpLabel
|
||||
%208 = OpLoad %bool %x_169_phi
|
||||
%209 = OpLogicalNot %bool %208
|
||||
OpSelectionMerge %210 None
|
||||
OpBranchConditional %209 %211 %210
|
||||
%211 = OpLabel
|
||||
OpStore %x_90 %true
|
||||
OpStore %x_91 %int_0
|
||||
OpStore %x_173_phi %int_0
|
||||
OpBranch %72
|
||||
%210 = OpLabel
|
||||
OpStore %x_90 %true
|
||||
OpStore %x_91 %int_1
|
||||
OpStore %x_173_phi %int_1
|
||||
OpBranch %72
|
||||
%72 = OpLabel
|
||||
%213 = OpLoad %int %x_173_phi
|
||||
OpReturnValue %213
|
||||
OpFunctionEnd
|
||||
%main_1 = OpFunction %void None %214
|
||||
%217 = OpLabel
|
||||
%pos = OpVariable %_ptr_Function_v2float Function %59
|
||||
%param_6 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%param_7 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%param_8 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%param_9 = OpVariable %_ptr_Function_v2float Function %59
|
||||
%223 = OpLoad %v4float %gl_FragCoord
|
||||
%225 = OpAccessChain %_ptr_Uniform_v2float %x_24 %uint_0
|
||||
%226 = OpLoad %v2float %225
|
||||
%227 = OpCompositeExtract %float %223 0
|
||||
%228 = OpCompositeExtract %float %223 1
|
||||
%229 = OpCompositeConstruct %v2float %227 %228
|
||||
%230 = OpFDiv %v2float %229 %226
|
||||
OpStore %pos %230
|
||||
OpStore %param_6 %230
|
||||
OpStore %param_7 %233
|
||||
OpStore %param_8 %236
|
||||
OpStore %param_9 %239
|
||||
%240 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_6 %param_7 %param_8 %param_9
|
||||
%245 = OpIEqual %bool %240 %int_1
|
||||
OpSelectionMerge %246 None
|
||||
OpBranchConditional %245 %247 %248
|
||||
%247 = OpLabel
|
||||
OpStore %x_GLF_color %250
|
||||
OpBranch %246
|
||||
%248 = OpLabel
|
||||
OpStore %x_GLF_color %251
|
||||
OpBranch %246
|
||||
%246 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_3 = OpFunction %void None %252
|
||||
%tint_symbol_1 = OpFunctionParameter %main_out
|
||||
%256 = OpLabel
|
||||
%257 = OpCompositeExtract %v4float %tint_symbol_1 0
|
||||
OpStore %tint_symbol_2 %257
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %214
|
||||
%259 = OpLabel
|
||||
%260 = OpLoad %v4float %tint_symbol
|
||||
OpStore %gl_FragCoord %260
|
||||
%261 = OpFunctionCall %void %main_1
|
||||
%263 = OpLoad %v4float %x_GLF_color
|
||||
%264 = OpCompositeConstruct %main_out %263
|
||||
%262 = OpFunctionCall %void %tint_symbol_3 %264
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,151 @@
|
||||
[[block]]
|
||||
struct buf0 {
|
||||
resolution : vec2<f32>;
|
||||
};
|
||||
|
||||
var<private> gl_FragCoord : vec4<f32>;
|
||||
|
||||
[[group(0), binding(0)]] var<uniform> x_24 : buf0;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn cross2d_vf2_vf2_(a : ptr<function, vec2<f32>>, b : ptr<function, vec2<f32>>) -> f32 {
|
||||
let x_79 : f32 = (*(a)).x;
|
||||
let x_81 : f32 = (*(b)).y;
|
||||
let x_84 : f32 = (*(b)).x;
|
||||
let x_86 : f32 = (*(a)).y;
|
||||
return ((x_79 * x_81) - (x_84 * x_86));
|
||||
}
|
||||
|
||||
fn pointInTriangle_vf2_vf2_vf2_vf2_(p : ptr<function, vec2<f32>>, a_1 : ptr<function, vec2<f32>>, b_1 : ptr<function, vec2<f32>>, c : ptr<function, vec2<f32>>) -> i32 {
|
||||
var x_90 : bool = false;
|
||||
var x_91 : i32;
|
||||
var pab : f32;
|
||||
var param : vec2<f32>;
|
||||
var param_1 : vec2<f32>;
|
||||
var pbc : f32;
|
||||
var param_2 : vec2<f32>;
|
||||
var param_3 : vec2<f32>;
|
||||
var pca : f32;
|
||||
var param_4 : vec2<f32>;
|
||||
var param_5 : vec2<f32>;
|
||||
var x_140 : bool;
|
||||
var x_168 : bool;
|
||||
var x_141_phi : bool;
|
||||
var x_169_phi : bool;
|
||||
var x_173_phi : i32;
|
||||
switch(0u) {
|
||||
default: {
|
||||
let x_94 : ptr<function, f32> = &((*(p)).x);
|
||||
let x_95 : f32 = *(x_94);
|
||||
let x_96 : ptr<function, f32> = &((*(a_1)).x);
|
||||
let x_97 : f32 = *(x_96);
|
||||
let x_99 : ptr<function, f32> = &((*(p)).y);
|
||||
let x_100 : f32 = *(x_99);
|
||||
let x_101 : ptr<function, f32> = &((*(a_1)).y);
|
||||
let x_102 : f32 = *(x_101);
|
||||
let x_105 : ptr<function, f32> = &((*(b_1)).x);
|
||||
let x_106 : f32 = *(x_105);
|
||||
let x_107 : f32 = *(x_96);
|
||||
let x_109 : ptr<function, f32> = &((*(b_1)).y);
|
||||
let x_110 : f32 = *(x_109);
|
||||
let x_111 : f32 = *(x_101);
|
||||
param = vec2<f32>((x_95 - x_97), (x_100 - x_102));
|
||||
param_1 = vec2<f32>((x_106 - x_107), (x_110 - x_111));
|
||||
let x_114 : f32 = cross2d_vf2_vf2_(&(param), &(param_1));
|
||||
pab = x_114;
|
||||
let x_115 : f32 = *(x_94);
|
||||
let x_116 : f32 = *(x_105);
|
||||
let x_118 : f32 = *(x_99);
|
||||
let x_119 : f32 = *(x_109);
|
||||
let x_122 : ptr<function, f32> = &((*(c)).x);
|
||||
let x_123 : f32 = *(x_122);
|
||||
let x_124 : f32 = *(x_105);
|
||||
let x_126 : ptr<function, f32> = &((*(c)).y);
|
||||
let x_127 : f32 = *(x_126);
|
||||
let x_128 : f32 = *(x_109);
|
||||
param_2 = vec2<f32>((x_115 - x_116), (x_118 - x_119));
|
||||
param_3 = vec2<f32>((x_123 - x_124), (x_127 - x_128));
|
||||
let x_131 : f32 = cross2d_vf2_vf2_(&(param_2), &(param_3));
|
||||
pbc = x_131;
|
||||
let x_134 : bool = ((x_114 < 0.0) && (x_131 < 0.0));
|
||||
x_141_phi = x_134;
|
||||
if (!(x_134)) {
|
||||
x_140 = ((x_114 >= 0.0) && (x_131 >= 0.0));
|
||||
x_141_phi = x_140;
|
||||
}
|
||||
let x_141 : bool = x_141_phi;
|
||||
if (!(x_141)) {
|
||||
x_90 = true;
|
||||
x_91 = 0;
|
||||
x_173_phi = 0;
|
||||
break;
|
||||
}
|
||||
let x_145 : f32 = *(x_94);
|
||||
let x_146 : f32 = *(x_122);
|
||||
let x_148 : f32 = *(x_99);
|
||||
let x_149 : f32 = *(x_126);
|
||||
let x_152 : f32 = *(x_96);
|
||||
let x_153 : f32 = *(x_122);
|
||||
let x_155 : f32 = *(x_101);
|
||||
let x_156 : f32 = *(x_126);
|
||||
param_4 = vec2<f32>((x_145 - x_146), (x_148 - x_149));
|
||||
param_5 = vec2<f32>((x_152 - x_153), (x_155 - x_156));
|
||||
let x_159 : f32 = cross2d_vf2_vf2_(&(param_4), &(param_5));
|
||||
pca = x_159;
|
||||
let x_162 : bool = ((x_114 < 0.0) && (x_159 < 0.0));
|
||||
x_169_phi = x_162;
|
||||
if (!(x_162)) {
|
||||
x_168 = ((x_114 >= 0.0) && (x_159 >= 0.0));
|
||||
x_169_phi = x_168;
|
||||
}
|
||||
let x_169 : bool = x_169_phi;
|
||||
if (!(x_169)) {
|
||||
x_90 = true;
|
||||
x_91 = 0;
|
||||
x_173_phi = 0;
|
||||
break;
|
||||
}
|
||||
x_90 = true;
|
||||
x_91 = 1;
|
||||
x_173_phi = 1;
|
||||
}
|
||||
}
|
||||
let x_173 : i32 = x_173_phi;
|
||||
return x_173;
|
||||
}
|
||||
|
||||
fn main_1() {
|
||||
var pos : vec2<f32>;
|
||||
var param_6 : vec2<f32>;
|
||||
var param_7 : vec2<f32>;
|
||||
var param_8 : vec2<f32>;
|
||||
var param_9 : vec2<f32>;
|
||||
let x_67 : vec4<f32> = gl_FragCoord;
|
||||
let x_70 : vec2<f32> = x_24.resolution;
|
||||
let x_71 : vec2<f32> = (vec2<f32>(x_67.x, x_67.y) / x_70);
|
||||
pos = x_71;
|
||||
param_6 = x_71;
|
||||
param_7 = vec2<f32>(0.699999988, 0.300000012);
|
||||
param_8 = vec2<f32>(0.5, 0.899999976);
|
||||
param_9 = vec2<f32>(0.100000001, 0.400000006);
|
||||
let x_72 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9));
|
||||
if ((x_72 == 1)) {
|
||||
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
} else {
|
||||
x_GLF_color = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
[[location(0)]]
|
||||
x_GLF_color_1 : vec4<f32>;
|
||||
};
|
||||
|
||||
[[stage(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