mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-10 14:08: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,266 @@
|
||||
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
|
||||
%main = OpFunction %void None %30
|
||||
%62 = 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
|
||||
%63 = OpLoad %v4float %gl_FragCoord
|
||||
%64 = OpVectorShuffle %v2float %63 %63 0 1
|
||||
%65 = OpAccessChain %_ptr_Uniform_v2float %_ %int_0
|
||||
%66 = OpLoad %v2float %65
|
||||
%67 = OpFDiv %v2float %64 %66
|
||||
OpStore %pos %67
|
||||
%68 = OpLoad %v2float %pos
|
||||
OpStore %param_5 %68
|
||||
OpStore %param_6 %51
|
||||
OpStore %param_7 %54
|
||||
OpStore %param_8 %57
|
||||
%69 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_5 %param_6 %param_7 %param_8
|
||||
%70 = OpIEqual %bool %69 %int_1
|
||||
OpSelectionMerge %71 None
|
||||
OpBranchConditional %70 %72 %73
|
||||
%72 = OpLabel
|
||||
OpStore %_GLF_color %60
|
||||
OpBranch %71
|
||||
%73 = OpLabel
|
||||
OpStore %_GLF_color %61
|
||||
OpBranch %71
|
||||
%71 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%cross2d_vf2_vf2_ = OpFunction %float None %34
|
||||
%a = OpFunctionParameter %_ptr_Function_v2float
|
||||
%b = OpFunctionParameter %_ptr_Function_v2float
|
||||
%74 = OpLabel
|
||||
%75 = OpAccessChain %_ptr_Function_float %a %uint_0
|
||||
%76 = OpLoad %float %75
|
||||
%77 = OpAccessChain %_ptr_Function_float %b %uint_1
|
||||
%78 = OpLoad %float %77
|
||||
%79 = OpFMul %float %76 %78
|
||||
%80 = OpAccessChain %_ptr_Function_float %b %uint_0
|
||||
%81 = OpLoad %float %80
|
||||
%82 = OpAccessChain %_ptr_Function_float %a %uint_1
|
||||
%83 = OpLoad %float %82
|
||||
%84 = OpFMul %float %81 %83
|
||||
%85 = OpFSub %float %79 %84
|
||||
OpReturnValue %85
|
||||
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
|
||||
%86 = OpLabel
|
||||
%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
|
||||
%87 = OpAccessChain %_ptr_Function_float %p %uint_0
|
||||
%88 = OpLoad %float %87
|
||||
%89 = OpAccessChain %_ptr_Function_float %a_0 %uint_0
|
||||
%90 = OpLoad %float %89
|
||||
%91 = OpFSub %float %88 %90
|
||||
%92 = OpAccessChain %_ptr_Function_float %p %uint_1
|
||||
%93 = OpLoad %float %92
|
||||
%94 = OpAccessChain %_ptr_Function_float %a_0 %uint_1
|
||||
%95 = OpLoad %float %94
|
||||
%96 = OpFSub %float %93 %95
|
||||
%97 = OpCompositeConstruct %v2float %91 %96
|
||||
%98 = OpAccessChain %_ptr_Function_float %b_0 %uint_0
|
||||
%99 = OpLoad %float %98
|
||||
%100 = OpAccessChain %_ptr_Function_float %a_0 %uint_0
|
||||
%101 = OpLoad %float %100
|
||||
%102 = OpFSub %float %99 %101
|
||||
%103 = OpAccessChain %_ptr_Function_float %b_0 %uint_1
|
||||
%104 = OpLoad %float %103
|
||||
%105 = OpAccessChain %_ptr_Function_float %a_0 %uint_1
|
||||
%106 = OpLoad %float %105
|
||||
%107 = OpFSub %float %104 %106
|
||||
%108 = OpCompositeConstruct %v2float %102 %107
|
||||
OpStore %param %97
|
||||
OpStore %param_0 %108
|
||||
%109 = OpFunctionCall %float %cross2d_vf2_vf2_ %param %param_0
|
||||
OpStore %pab %109
|
||||
%110 = OpAccessChain %_ptr_Function_float %p %uint_0
|
||||
%111 = OpLoad %float %110
|
||||
%112 = OpAccessChain %_ptr_Function_float %b_0 %uint_0
|
||||
%113 = OpLoad %float %112
|
||||
%114 = OpFSub %float %111 %113
|
||||
%115 = OpAccessChain %_ptr_Function_float %p %uint_1
|
||||
%116 = OpLoad %float %115
|
||||
%117 = OpAccessChain %_ptr_Function_float %b_0 %uint_1
|
||||
%118 = OpLoad %float %117
|
||||
%119 = OpFSub %float %116 %118
|
||||
%120 = OpCompositeConstruct %v2float %114 %119
|
||||
%121 = OpAccessChain %_ptr_Function_float %c %uint_0
|
||||
%122 = OpLoad %float %121
|
||||
%123 = OpAccessChain %_ptr_Function_float %b_0 %uint_0
|
||||
%124 = OpLoad %float %123
|
||||
%125 = OpFSub %float %122 %124
|
||||
%126 = OpAccessChain %_ptr_Function_float %c %uint_1
|
||||
%127 = OpLoad %float %126
|
||||
%128 = OpAccessChain %_ptr_Function_float %b_0 %uint_1
|
||||
%129 = OpLoad %float %128
|
||||
%130 = OpFSub %float %127 %129
|
||||
%131 = OpCompositeConstruct %v2float %125 %130
|
||||
OpStore %param_1 %120
|
||||
OpStore %param_2 %131
|
||||
%132 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_1 %param_2
|
||||
OpStore %pbc %132
|
||||
%133 = OpLoad %float %pab
|
||||
%134 = OpFOrdLessThan %bool %133 %float_0
|
||||
%135 = OpLoad %float %pbc
|
||||
%136 = OpFOrdLessThan %bool %135 %float_0
|
||||
%137 = OpLogicalAnd %bool %134 %136
|
||||
%138 = OpLogicalNot %bool %137
|
||||
OpSelectionMerge %139 None
|
||||
OpBranchConditional %138 %140 %139
|
||||
%140 = OpLabel
|
||||
%141 = OpLoad %float %pab
|
||||
%142 = OpFOrdGreaterThanEqual %bool %141 %float_0
|
||||
%143 = OpLoad %float %pbc
|
||||
%144 = OpFOrdGreaterThanEqual %bool %143 %float_0
|
||||
%145 = OpLogicalAnd %bool %142 %144
|
||||
OpBranch %139
|
||||
%139 = OpLabel
|
||||
%146 = OpPhi %bool %137 %86 %145 %140
|
||||
%147 = OpLogicalNot %bool %146
|
||||
OpSelectionMerge %148 None
|
||||
OpBranchConditional %147 %149 %148
|
||||
%149 = OpLabel
|
||||
OpReturnValue %int_0
|
||||
%148 = OpLabel
|
||||
%150 = OpAccessChain %_ptr_Function_float %p %uint_0
|
||||
%151 = OpLoad %float %150
|
||||
%152 = OpAccessChain %_ptr_Function_float %c %uint_0
|
||||
%153 = OpLoad %float %152
|
||||
%154 = OpFSub %float %151 %153
|
||||
%155 = OpAccessChain %_ptr_Function_float %p %uint_1
|
||||
%156 = OpLoad %float %155
|
||||
%157 = OpAccessChain %_ptr_Function_float %c %uint_1
|
||||
%158 = OpLoad %float %157
|
||||
%159 = OpFSub %float %156 %158
|
||||
%160 = OpCompositeConstruct %v2float %154 %159
|
||||
%161 = OpAccessChain %_ptr_Function_float %a_0 %uint_0
|
||||
%162 = OpLoad %float %161
|
||||
%163 = OpAccessChain %_ptr_Function_float %c %uint_0
|
||||
%164 = OpLoad %float %163
|
||||
%165 = OpFSub %float %162 %164
|
||||
%166 = OpAccessChain %_ptr_Function_float %a_0 %uint_1
|
||||
%167 = OpLoad %float %166
|
||||
%168 = OpAccessChain %_ptr_Function_float %c %uint_1
|
||||
%169 = OpLoad %float %168
|
||||
%170 = OpFSub %float %167 %169
|
||||
%171 = OpCompositeConstruct %v2float %165 %170
|
||||
OpStore %param_3 %160
|
||||
OpStore %param_4 %171
|
||||
%172 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_3 %param_4
|
||||
OpStore %pca %172
|
||||
%173 = OpLoad %float %pab
|
||||
%174 = OpFOrdLessThan %bool %173 %float_0
|
||||
%175 = OpLoad %float %pca
|
||||
%176 = OpFOrdLessThan %bool %175 %float_0
|
||||
%177 = OpLogicalAnd %bool %174 %176
|
||||
%178 = OpLogicalNot %bool %177
|
||||
OpSelectionMerge %179 None
|
||||
OpBranchConditional %178 %180 %179
|
||||
%180 = OpLabel
|
||||
%181 = OpLoad %float %pab
|
||||
%182 = OpFOrdGreaterThanEqual %bool %181 %float_0
|
||||
%183 = OpLoad %float %pca
|
||||
%184 = OpFOrdGreaterThanEqual %bool %183 %float_0
|
||||
%185 = OpLogicalAnd %bool %182 %184
|
||||
OpBranch %179
|
||||
%179 = OpLabel
|
||||
%186 = OpPhi %bool %177 %148 %185 %180
|
||||
%187 = OpLogicalNot %bool %186
|
||||
OpSelectionMerge %188 None
|
||||
OpBranchConditional %187 %189 %188
|
||||
%189 = OpLabel
|
||||
OpReturnValue %int_0
|
||||
%188 = OpLabel
|
||||
OpReturnValue %int_1
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,141 @@
|
||||
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_76 = a.x;
|
||||
const float x_78 = b.y;
|
||||
const float x_81 = b.x;
|
||||
const float x_83 = a.y;
|
||||
return ((x_76 * x_78) - (x_81 * x_83));
|
||||
}
|
||||
|
||||
int pointInTriangle_vf2_vf2_vf2_vf2_(inout float2 p, inout float2 a_1, inout float2 b_1, inout float2 c) {
|
||||
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_145 = false;
|
||||
bool x_185 = false;
|
||||
bool x_146_phi = false;
|
||||
bool x_186_phi = false;
|
||||
const float x_88 = p.x;
|
||||
const float x_90 = a_1.x;
|
||||
const float x_93 = p.y;
|
||||
const float x_95 = a_1.y;
|
||||
const float x_99 = b_1.x;
|
||||
const float x_101 = a_1.x;
|
||||
const float x_104 = b_1.y;
|
||||
const float x_106 = a_1.y;
|
||||
param = float2((x_88 - x_90), (x_93 - x_95));
|
||||
param_1 = float2((x_99 - x_101), (x_104 - x_106));
|
||||
const float x_109 = cross2d_vf2_vf2_(param, param_1);
|
||||
pab = x_109;
|
||||
const float x_111 = p.x;
|
||||
const float x_113 = b_1.x;
|
||||
const float x_116 = p.y;
|
||||
const float x_118 = b_1.y;
|
||||
const float x_122 = c.x;
|
||||
const float x_124 = b_1.x;
|
||||
const float x_127 = c.y;
|
||||
const float x_129 = b_1.y;
|
||||
param_2 = float2((x_111 - x_113), (x_116 - x_118));
|
||||
param_3 = float2((x_122 - x_124), (x_127 - x_129));
|
||||
const float x_132 = cross2d_vf2_vf2_(param_2, param_3);
|
||||
pbc = x_132;
|
||||
bool tint_tmp = (pab < 0.0f);
|
||||
if (tint_tmp) {
|
||||
tint_tmp = (pbc < 0.0f);
|
||||
}
|
||||
const bool x_137 = (tint_tmp);
|
||||
x_146_phi = x_137;
|
||||
if (!(x_137)) {
|
||||
bool tint_tmp_1 = (pab >= 0.0f);
|
||||
if (tint_tmp_1) {
|
||||
tint_tmp_1 = (pbc >= 0.0f);
|
||||
}
|
||||
x_145 = (tint_tmp_1);
|
||||
x_146_phi = x_145;
|
||||
}
|
||||
if (!(x_146_phi)) {
|
||||
return 0;
|
||||
}
|
||||
const float x_151 = p.x;
|
||||
const float x_153 = c.x;
|
||||
const float x_156 = p.y;
|
||||
const float x_158 = c.y;
|
||||
const float x_162 = a_1.x;
|
||||
const float x_164 = c.x;
|
||||
const float x_167 = a_1.y;
|
||||
const float x_169 = c.y;
|
||||
param_4 = float2((x_151 - x_153), (x_156 - x_158));
|
||||
param_5 = float2((x_162 - x_164), (x_167 - x_169));
|
||||
const float x_172 = cross2d_vf2_vf2_(param_4, param_5);
|
||||
pca = x_172;
|
||||
bool tint_tmp_2 = (pab < 0.0f);
|
||||
if (tint_tmp_2) {
|
||||
tint_tmp_2 = (pca < 0.0f);
|
||||
}
|
||||
const bool x_177 = (tint_tmp_2);
|
||||
x_186_phi = x_177;
|
||||
if (!(x_177)) {
|
||||
bool tint_tmp_3 = (pab >= 0.0f);
|
||||
if (tint_tmp_3) {
|
||||
tint_tmp_3 = (pca >= 0.0f);
|
||||
}
|
||||
x_185 = (tint_tmp_3);
|
||||
x_186_phi = x_185;
|
||||
}
|
||||
if (!(x_186_phi)) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
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_63 = gl_FragCoord;
|
||||
const float2 x_66 = asfloat(x_24[0].xy);
|
||||
pos = (float2(x_63.x, x_63.y) / x_66);
|
||||
param_6 = pos;
|
||||
param_7 = float2(0.699999988f, 0.300000012f);
|
||||
param_8 = float2(0.5f, 0.899999976f);
|
||||
param_9 = float2(0.100000001f, 0.400000006f);
|
||||
const int x_69 = pointInTriangle_vf2_vf2_vf2_vf2_(param_6, param_7, param_8, param_9);
|
||||
if ((x_69 == 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,135 @@
|
||||
#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_76 = (*(a)).x;
|
||||
float const x_78 = (*(b)).y;
|
||||
float const x_81 = (*(b)).x;
|
||||
float const x_83 = (*(a)).y;
|
||||
return ((x_76 * x_78) - (x_81 * x_83));
|
||||
}
|
||||
|
||||
int pointInTriangle_vf2_vf2_vf2_vf2_(thread float2* const p, thread float2* const a_1, thread float2* const b_1, thread float2* const c) {
|
||||
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_145 = false;
|
||||
bool x_185 = false;
|
||||
bool x_146_phi = false;
|
||||
bool x_186_phi = false;
|
||||
float const x_88 = (*(p)).x;
|
||||
float const x_90 = (*(a_1)).x;
|
||||
float const x_93 = (*(p)).y;
|
||||
float const x_95 = (*(a_1)).y;
|
||||
float const x_99 = (*(b_1)).x;
|
||||
float const x_101 = (*(a_1)).x;
|
||||
float const x_104 = (*(b_1)).y;
|
||||
float const x_106 = (*(a_1)).y;
|
||||
param = float2((x_88 - x_90), (x_93 - x_95));
|
||||
param_1 = float2((x_99 - x_101), (x_104 - x_106));
|
||||
float const x_109 = cross2d_vf2_vf2_(&(param), &(param_1));
|
||||
pab = x_109;
|
||||
float const x_111 = (*(p)).x;
|
||||
float const x_113 = (*(b_1)).x;
|
||||
float const x_116 = (*(p)).y;
|
||||
float const x_118 = (*(b_1)).y;
|
||||
float const x_122 = (*(c)).x;
|
||||
float const x_124 = (*(b_1)).x;
|
||||
float const x_127 = (*(c)).y;
|
||||
float const x_129 = (*(b_1)).y;
|
||||
param_2 = float2((x_111 - x_113), (x_116 - x_118));
|
||||
param_3 = float2((x_122 - x_124), (x_127 - x_129));
|
||||
float const x_132 = cross2d_vf2_vf2_(&(param_2), &(param_3));
|
||||
pbc = x_132;
|
||||
float const x_133 = pab;
|
||||
float const x_135 = pbc;
|
||||
bool const x_137 = ((x_133 < 0.0f) && (x_135 < 0.0f));
|
||||
x_146_phi = x_137;
|
||||
if (!(x_137)) {
|
||||
float const x_141 = pab;
|
||||
float const x_143 = pbc;
|
||||
x_145 = ((x_141 >= 0.0f) && (x_143 >= 0.0f));
|
||||
x_146_phi = x_145;
|
||||
}
|
||||
bool const x_146 = x_146_phi;
|
||||
if (!(x_146)) {
|
||||
return 0;
|
||||
}
|
||||
float const x_151 = (*(p)).x;
|
||||
float const x_153 = (*(c)).x;
|
||||
float const x_156 = (*(p)).y;
|
||||
float const x_158 = (*(c)).y;
|
||||
float const x_162 = (*(a_1)).x;
|
||||
float const x_164 = (*(c)).x;
|
||||
float const x_167 = (*(a_1)).y;
|
||||
float const x_169 = (*(c)).y;
|
||||
param_4 = float2((x_151 - x_153), (x_156 - x_158));
|
||||
param_5 = float2((x_162 - x_164), (x_167 - x_169));
|
||||
float const x_172 = cross2d_vf2_vf2_(&(param_4), &(param_5));
|
||||
pca = x_172;
|
||||
float const x_173 = pab;
|
||||
float const x_175 = pca;
|
||||
bool const x_177 = ((x_173 < 0.0f) && (x_175 < 0.0f));
|
||||
x_186_phi = x_177;
|
||||
if (!(x_177)) {
|
||||
float const x_181 = pab;
|
||||
float const x_183 = pca;
|
||||
x_185 = ((x_181 >= 0.0f) && (x_183 >= 0.0f));
|
||||
x_186_phi = x_185;
|
||||
}
|
||||
bool const x_186 = x_186_phi;
|
||||
if (!(x_186)) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
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_63 = *(tint_symbol_5);
|
||||
float2 const x_66 = x_24.resolution;
|
||||
pos = (float2(x_63.x, x_63.y) / x_66);
|
||||
float2 const x_68 = pos;
|
||||
param_6 = x_68;
|
||||
param_7 = float2(0.699999988f, 0.300000012f);
|
||||
param_8 = float2(0.5f, 0.899999976f);
|
||||
param_9 = float2(0.100000001f, 0.400000006f);
|
||||
int const x_69 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9));
|
||||
if ((x_69 == 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,343 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 264
|
||||
; 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 %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_145 "x_145"
|
||||
OpName %x_185 "x_185"
|
||||
OpName %x_146_phi "x_146_phi"
|
||||
OpName %x_186_phi "x_186_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
|
||||
%49 = OpConstantNull %float
|
||||
%51 = OpConstantNull %v2float
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Function_bool = OpTypePointer Function %bool
|
||||
%62 = OpConstantNull %bool
|
||||
%float_0 = OpConstant %float 0
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%void = OpTypeVoid
|
||||
%212 = OpTypeFunction %void
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%float_0_699999988 = OpConstant %float 0.699999988
|
||||
%float_0_300000012 = OpConstant %float 0.300000012
|
||||
%232 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%float_0_899999976 = OpConstant %float 0.899999976
|
||||
%235 = OpConstantComposite %v2float %float_0_5 %float_0_899999976
|
||||
%float_0_100000001 = OpConstant %float 0.100000001
|
||||
%float_0_400000006 = OpConstant %float 0.400000006
|
||||
%238 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006
|
||||
%float_1 = OpConstant %float 1
|
||||
%249 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
|
||||
%250 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%251 = 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
|
||||
%pab = OpVariable %_ptr_Function_float Function %49
|
||||
%param = OpVariable %_ptr_Function_v2float Function %51
|
||||
%param_1 = OpVariable %_ptr_Function_v2float Function %51
|
||||
%pbc = OpVariable %_ptr_Function_float Function %49
|
||||
%param_2 = OpVariable %_ptr_Function_v2float Function %51
|
||||
%param_3 = OpVariable %_ptr_Function_v2float Function %51
|
||||
%pca = OpVariable %_ptr_Function_float Function %49
|
||||
%param_4 = OpVariable %_ptr_Function_v2float Function %51
|
||||
%param_5 = OpVariable %_ptr_Function_v2float Function %51
|
||||
%x_145 = OpVariable %_ptr_Function_bool Function %62
|
||||
%x_185 = OpVariable %_ptr_Function_bool Function %62
|
||||
%x_146_phi = OpVariable %_ptr_Function_bool Function %62
|
||||
%x_186_phi = OpVariable %_ptr_Function_bool Function %62
|
||||
%67 = OpAccessChain %_ptr_Function_float %p %uint_0
|
||||
%68 = OpLoad %float %67
|
||||
%70 = OpAccessChain %_ptr_Function_float %a_1 %uint_0
|
||||
%71 = OpLoad %float %70
|
||||
%73 = OpAccessChain %_ptr_Function_float %p %uint_1
|
||||
%74 = OpLoad %float %73
|
||||
%76 = OpAccessChain %_ptr_Function_float %a_1 %uint_1
|
||||
%77 = OpLoad %float %76
|
||||
%79 = OpAccessChain %_ptr_Function_float %b_1 %uint_0
|
||||
%80 = OpLoad %float %79
|
||||
%82 = OpAccessChain %_ptr_Function_float %a_1 %uint_0
|
||||
%83 = OpLoad %float %82
|
||||
%85 = OpAccessChain %_ptr_Function_float %b_1 %uint_1
|
||||
%86 = OpLoad %float %85
|
||||
%88 = OpAccessChain %_ptr_Function_float %a_1 %uint_1
|
||||
%89 = OpLoad %float %88
|
||||
%90 = OpFSub %float %68 %71
|
||||
%91 = OpFSub %float %74 %77
|
||||
%92 = OpCompositeConstruct %v2float %90 %91
|
||||
OpStore %param %92
|
||||
%93 = OpFSub %float %80 %83
|
||||
%94 = OpFSub %float %86 %89
|
||||
%95 = OpCompositeConstruct %v2float %93 %94
|
||||
OpStore %param_1 %95
|
||||
%96 = OpFunctionCall %float %cross2d_vf2_vf2_ %param %param_1
|
||||
OpStore %pab %96
|
||||
%100 = OpAccessChain %_ptr_Function_float %p %uint_0
|
||||
%101 = OpLoad %float %100
|
||||
%103 = OpAccessChain %_ptr_Function_float %b_1 %uint_0
|
||||
%104 = OpLoad %float %103
|
||||
%106 = OpAccessChain %_ptr_Function_float %p %uint_1
|
||||
%107 = OpLoad %float %106
|
||||
%109 = OpAccessChain %_ptr_Function_float %b_1 %uint_1
|
||||
%110 = OpLoad %float %109
|
||||
%112 = OpAccessChain %_ptr_Function_float %c %uint_0
|
||||
%113 = OpLoad %float %112
|
||||
%115 = OpAccessChain %_ptr_Function_float %b_1 %uint_0
|
||||
%116 = OpLoad %float %115
|
||||
%118 = OpAccessChain %_ptr_Function_float %c %uint_1
|
||||
%119 = OpLoad %float %118
|
||||
%121 = OpAccessChain %_ptr_Function_float %b_1 %uint_1
|
||||
%122 = OpLoad %float %121
|
||||
%123 = OpFSub %float %101 %104
|
||||
%124 = OpFSub %float %107 %110
|
||||
%125 = OpCompositeConstruct %v2float %123 %124
|
||||
OpStore %param_2 %125
|
||||
%126 = OpFSub %float %113 %116
|
||||
%127 = OpFSub %float %119 %122
|
||||
%128 = OpCompositeConstruct %v2float %126 %127
|
||||
OpStore %param_3 %128
|
||||
%129 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_2 %param_3
|
||||
OpStore %pbc %129
|
||||
%132 = OpLoad %float %pab
|
||||
%133 = OpLoad %float %pbc
|
||||
%135 = OpFOrdLessThan %bool %132 %float_0
|
||||
OpSelectionMerge %136 None
|
||||
OpBranchConditional %135 %137 %136
|
||||
%137 = OpLabel
|
||||
%138 = OpFOrdLessThan %bool %133 %float_0
|
||||
OpBranch %136
|
||||
%136 = OpLabel
|
||||
%139 = OpPhi %bool %135 %47 %138 %137
|
||||
OpStore %x_146_phi %139
|
||||
%140 = OpLogicalNot %bool %139
|
||||
OpSelectionMerge %141 None
|
||||
OpBranchConditional %140 %142 %141
|
||||
%142 = OpLabel
|
||||
%143 = OpLoad %float %pab
|
||||
%144 = OpLoad %float %pbc
|
||||
%145 = OpFOrdGreaterThanEqual %bool %143 %float_0
|
||||
OpSelectionMerge %146 None
|
||||
OpBranchConditional %145 %147 %146
|
||||
%147 = OpLabel
|
||||
%148 = OpFOrdGreaterThanEqual %bool %144 %float_0
|
||||
OpBranch %146
|
||||
%146 = OpLabel
|
||||
%149 = OpPhi %bool %145 %142 %148 %147
|
||||
OpStore %x_145 %149
|
||||
%150 = OpLoad %bool %x_145
|
||||
OpStore %x_146_phi %150
|
||||
OpBranch %141
|
||||
%141 = OpLabel
|
||||
%151 = OpLoad %bool %x_146_phi
|
||||
%152 = OpLogicalNot %bool %151
|
||||
OpSelectionMerge %153 None
|
||||
OpBranchConditional %152 %154 %153
|
||||
%154 = OpLabel
|
||||
OpReturnValue %int_0
|
||||
%153 = OpLabel
|
||||
%157 = OpAccessChain %_ptr_Function_float %p %uint_0
|
||||
%158 = OpLoad %float %157
|
||||
%160 = OpAccessChain %_ptr_Function_float %c %uint_0
|
||||
%161 = OpLoad %float %160
|
||||
%163 = OpAccessChain %_ptr_Function_float %p %uint_1
|
||||
%164 = OpLoad %float %163
|
||||
%166 = OpAccessChain %_ptr_Function_float %c %uint_1
|
||||
%167 = OpLoad %float %166
|
||||
%169 = OpAccessChain %_ptr_Function_float %a_1 %uint_0
|
||||
%170 = OpLoad %float %169
|
||||
%172 = OpAccessChain %_ptr_Function_float %c %uint_0
|
||||
%173 = OpLoad %float %172
|
||||
%175 = OpAccessChain %_ptr_Function_float %a_1 %uint_1
|
||||
%176 = OpLoad %float %175
|
||||
%178 = OpAccessChain %_ptr_Function_float %c %uint_1
|
||||
%179 = OpLoad %float %178
|
||||
%180 = OpFSub %float %158 %161
|
||||
%181 = OpFSub %float %164 %167
|
||||
%182 = OpCompositeConstruct %v2float %180 %181
|
||||
OpStore %param_4 %182
|
||||
%183 = OpFSub %float %170 %173
|
||||
%184 = OpFSub %float %176 %179
|
||||
%185 = OpCompositeConstruct %v2float %183 %184
|
||||
OpStore %param_5 %185
|
||||
%186 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_4 %param_5
|
||||
OpStore %pca %186
|
||||
%189 = OpLoad %float %pab
|
||||
%190 = OpLoad %float %pca
|
||||
%191 = OpFOrdLessThan %bool %189 %float_0
|
||||
OpSelectionMerge %192 None
|
||||
OpBranchConditional %191 %193 %192
|
||||
%193 = OpLabel
|
||||
%194 = OpFOrdLessThan %bool %190 %float_0
|
||||
OpBranch %192
|
||||
%192 = OpLabel
|
||||
%195 = OpPhi %bool %191 %153 %194 %193
|
||||
OpStore %x_186_phi %195
|
||||
%196 = OpLogicalNot %bool %195
|
||||
OpSelectionMerge %197 None
|
||||
OpBranchConditional %196 %198 %197
|
||||
%198 = OpLabel
|
||||
%199 = OpLoad %float %pab
|
||||
%200 = OpLoad %float %pca
|
||||
%201 = OpFOrdGreaterThanEqual %bool %199 %float_0
|
||||
OpSelectionMerge %202 None
|
||||
OpBranchConditional %201 %203 %202
|
||||
%203 = OpLabel
|
||||
%204 = OpFOrdGreaterThanEqual %bool %200 %float_0
|
||||
OpBranch %202
|
||||
%202 = OpLabel
|
||||
%205 = OpPhi %bool %201 %198 %204 %203
|
||||
OpStore %x_185 %205
|
||||
%206 = OpLoad %bool %x_185
|
||||
OpStore %x_186_phi %206
|
||||
OpBranch %197
|
||||
%197 = OpLabel
|
||||
%207 = OpLoad %bool %x_186_phi
|
||||
%208 = OpLogicalNot %bool %207
|
||||
OpSelectionMerge %209 None
|
||||
OpBranchConditional %208 %210 %209
|
||||
%210 = OpLabel
|
||||
OpReturnValue %int_0
|
||||
%209 = OpLabel
|
||||
OpReturnValue %int_1
|
||||
OpFunctionEnd
|
||||
%main_1 = OpFunction %void None %212
|
||||
%215 = OpLabel
|
||||
%pos = OpVariable %_ptr_Function_v2float Function %51
|
||||
%param_6 = OpVariable %_ptr_Function_v2float Function %51
|
||||
%param_7 = OpVariable %_ptr_Function_v2float Function %51
|
||||
%param_8 = OpVariable %_ptr_Function_v2float Function %51
|
||||
%param_9 = OpVariable %_ptr_Function_v2float Function %51
|
||||
%221 = OpLoad %v4float %gl_FragCoord
|
||||
%223 = OpAccessChain %_ptr_Uniform_v2float %x_24 %uint_0
|
||||
%224 = OpLoad %v2float %223
|
||||
%225 = OpCompositeExtract %float %221 0
|
||||
%226 = OpCompositeExtract %float %221 1
|
||||
%227 = OpCompositeConstruct %v2float %225 %226
|
||||
%228 = OpFDiv %v2float %227 %224
|
||||
OpStore %pos %228
|
||||
%229 = OpLoad %v2float %pos
|
||||
OpStore %param_6 %229
|
||||
OpStore %param_7 %232
|
||||
OpStore %param_8 %235
|
||||
OpStore %param_9 %238
|
||||
%239 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_6 %param_7 %param_8 %param_9
|
||||
%244 = OpIEqual %bool %239 %int_1
|
||||
OpSelectionMerge %245 None
|
||||
OpBranchConditional %244 %246 %247
|
||||
%246 = OpLabel
|
||||
OpStore %x_GLF_color %249
|
||||
OpBranch %245
|
||||
%247 = OpLabel
|
||||
OpStore %x_GLF_color %250
|
||||
OpBranch %245
|
||||
%245 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_3 = OpFunction %void None %251
|
||||
%tint_symbol_1 = OpFunctionParameter %main_out
|
||||
%255 = OpLabel
|
||||
%256 = OpCompositeExtract %v4float %tint_symbol_1 0
|
||||
OpStore %tint_symbol_2 %256
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %212
|
||||
%258 = OpLabel
|
||||
%259 = OpLoad %v4float %tint_symbol
|
||||
OpStore %gl_FragCoord %259
|
||||
%260 = OpFunctionCall %void %main_1
|
||||
%262 = OpLoad %v4float %x_GLF_color
|
||||
%263 = OpCompositeConstruct %main_out %262
|
||||
%261 = OpFunctionCall %void %tint_symbol_3 %263
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,134 @@
|
||||
[[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_76 : f32 = (*(a)).x;
|
||||
let x_78 : f32 = (*(b)).y;
|
||||
let x_81 : f32 = (*(b)).x;
|
||||
let x_83 : f32 = (*(a)).y;
|
||||
return ((x_76 * x_78) - (x_81 * x_83));
|
||||
}
|
||||
|
||||
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 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_145 : bool;
|
||||
var x_185 : bool;
|
||||
var x_146_phi : bool;
|
||||
var x_186_phi : bool;
|
||||
let x_88 : f32 = (*(p)).x;
|
||||
let x_90 : f32 = (*(a_1)).x;
|
||||
let x_93 : f32 = (*(p)).y;
|
||||
let x_95 : f32 = (*(a_1)).y;
|
||||
let x_99 : f32 = (*(b_1)).x;
|
||||
let x_101 : f32 = (*(a_1)).x;
|
||||
let x_104 : f32 = (*(b_1)).y;
|
||||
let x_106 : f32 = (*(a_1)).y;
|
||||
param = vec2<f32>((x_88 - x_90), (x_93 - x_95));
|
||||
param_1 = vec2<f32>((x_99 - x_101), (x_104 - x_106));
|
||||
let x_109 : f32 = cross2d_vf2_vf2_(&(param), &(param_1));
|
||||
pab = x_109;
|
||||
let x_111 : f32 = (*(p)).x;
|
||||
let x_113 : f32 = (*(b_1)).x;
|
||||
let x_116 : f32 = (*(p)).y;
|
||||
let x_118 : f32 = (*(b_1)).y;
|
||||
let x_122 : f32 = (*(c)).x;
|
||||
let x_124 : f32 = (*(b_1)).x;
|
||||
let x_127 : f32 = (*(c)).y;
|
||||
let x_129 : f32 = (*(b_1)).y;
|
||||
param_2 = vec2<f32>((x_111 - x_113), (x_116 - x_118));
|
||||
param_3 = vec2<f32>((x_122 - x_124), (x_127 - x_129));
|
||||
let x_132 : f32 = cross2d_vf2_vf2_(&(param_2), &(param_3));
|
||||
pbc = x_132;
|
||||
let x_133 : f32 = pab;
|
||||
let x_135 : f32 = pbc;
|
||||
let x_137 : bool = ((x_133 < 0.0) && (x_135 < 0.0));
|
||||
x_146_phi = x_137;
|
||||
if (!(x_137)) {
|
||||
let x_141 : f32 = pab;
|
||||
let x_143 : f32 = pbc;
|
||||
x_145 = ((x_141 >= 0.0) && (x_143 >= 0.0));
|
||||
x_146_phi = x_145;
|
||||
}
|
||||
let x_146 : bool = x_146_phi;
|
||||
if (!(x_146)) {
|
||||
return 0;
|
||||
}
|
||||
let x_151 : f32 = (*(p)).x;
|
||||
let x_153 : f32 = (*(c)).x;
|
||||
let x_156 : f32 = (*(p)).y;
|
||||
let x_158 : f32 = (*(c)).y;
|
||||
let x_162 : f32 = (*(a_1)).x;
|
||||
let x_164 : f32 = (*(c)).x;
|
||||
let x_167 : f32 = (*(a_1)).y;
|
||||
let x_169 : f32 = (*(c)).y;
|
||||
param_4 = vec2<f32>((x_151 - x_153), (x_156 - x_158));
|
||||
param_5 = vec2<f32>((x_162 - x_164), (x_167 - x_169));
|
||||
let x_172 : f32 = cross2d_vf2_vf2_(&(param_4), &(param_5));
|
||||
pca = x_172;
|
||||
let x_173 : f32 = pab;
|
||||
let x_175 : f32 = pca;
|
||||
let x_177 : bool = ((x_173 < 0.0) && (x_175 < 0.0));
|
||||
x_186_phi = x_177;
|
||||
if (!(x_177)) {
|
||||
let x_181 : f32 = pab;
|
||||
let x_183 : f32 = pca;
|
||||
x_185 = ((x_181 >= 0.0) && (x_183 >= 0.0));
|
||||
x_186_phi = x_185;
|
||||
}
|
||||
let x_186 : bool = x_186_phi;
|
||||
if (!(x_186)) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
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_63 : vec4<f32> = gl_FragCoord;
|
||||
let x_66 : vec2<f32> = x_24.resolution;
|
||||
pos = (vec2<f32>(x_63.x, x_63.y) / x_66);
|
||||
let x_68 : vec2<f32> = pos;
|
||||
param_6 = x_68;
|
||||
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_69 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9));
|
||||
if ((x_69 == 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,134 @@
|
||||
[[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_76 : f32 = (*(a)).x;
|
||||
let x_78 : f32 = (*(b)).y;
|
||||
let x_81 : f32 = (*(b)).x;
|
||||
let x_83 : f32 = (*(a)).y;
|
||||
return ((x_76 * x_78) - (x_81 * x_83));
|
||||
}
|
||||
|
||||
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 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_145 : bool;
|
||||
var x_185 : bool;
|
||||
var x_146_phi : bool;
|
||||
var x_186_phi : bool;
|
||||
let x_88 : f32 = (*(p)).x;
|
||||
let x_90 : f32 = (*(a_1)).x;
|
||||
let x_93 : f32 = (*(p)).y;
|
||||
let x_95 : f32 = (*(a_1)).y;
|
||||
let x_99 : f32 = (*(b_1)).x;
|
||||
let x_101 : f32 = (*(a_1)).x;
|
||||
let x_104 : f32 = (*(b_1)).y;
|
||||
let x_106 : f32 = (*(a_1)).y;
|
||||
param = vec2<f32>((x_88 - x_90), (x_93 - x_95));
|
||||
param_1 = vec2<f32>((x_99 - x_101), (x_104 - x_106));
|
||||
let x_109 : f32 = cross2d_vf2_vf2_(&(param), &(param_1));
|
||||
pab = x_109;
|
||||
let x_111 : f32 = (*(p)).x;
|
||||
let x_113 : f32 = (*(b_1)).x;
|
||||
let x_116 : f32 = (*(p)).y;
|
||||
let x_118 : f32 = (*(b_1)).y;
|
||||
let x_122 : f32 = (*(c)).x;
|
||||
let x_124 : f32 = (*(b_1)).x;
|
||||
let x_127 : f32 = (*(c)).y;
|
||||
let x_129 : f32 = (*(b_1)).y;
|
||||
param_2 = vec2<f32>((x_111 - x_113), (x_116 - x_118));
|
||||
param_3 = vec2<f32>((x_122 - x_124), (x_127 - x_129));
|
||||
let x_132 : f32 = cross2d_vf2_vf2_(&(param_2), &(param_3));
|
||||
pbc = x_132;
|
||||
let x_133 : f32 = pab;
|
||||
let x_135 : f32 = pbc;
|
||||
let x_137 : bool = ((x_133 < 0.0) && (x_135 < 0.0));
|
||||
x_146_phi = x_137;
|
||||
if (!(x_137)) {
|
||||
let x_141 : f32 = pab;
|
||||
let x_143 : f32 = pbc;
|
||||
x_145 = ((x_141 >= 0.0) && (x_143 >= 0.0));
|
||||
x_146_phi = x_145;
|
||||
}
|
||||
let x_146 : bool = x_146_phi;
|
||||
if (!(x_146)) {
|
||||
return 0;
|
||||
}
|
||||
let x_151 : f32 = (*(p)).x;
|
||||
let x_153 : f32 = (*(c)).x;
|
||||
let x_156 : f32 = (*(p)).y;
|
||||
let x_158 : f32 = (*(c)).y;
|
||||
let x_162 : f32 = (*(a_1)).x;
|
||||
let x_164 : f32 = (*(c)).x;
|
||||
let x_167 : f32 = (*(a_1)).y;
|
||||
let x_169 : f32 = (*(c)).y;
|
||||
param_4 = vec2<f32>((x_151 - x_153), (x_156 - x_158));
|
||||
param_5 = vec2<f32>((x_162 - x_164), (x_167 - x_169));
|
||||
let x_172 : f32 = cross2d_vf2_vf2_(&(param_4), &(param_5));
|
||||
pca = x_172;
|
||||
let x_173 : f32 = pab;
|
||||
let x_175 : f32 = pca;
|
||||
let x_177 : bool = ((x_173 < 0.0) && (x_175 < 0.0));
|
||||
x_186_phi = x_177;
|
||||
if (!(x_177)) {
|
||||
let x_181 : f32 = pab;
|
||||
let x_183 : f32 = pca;
|
||||
x_185 = ((x_181 >= 0.0) && (x_183 >= 0.0));
|
||||
x_186_phi = x_185;
|
||||
}
|
||||
let x_186 : bool = x_186_phi;
|
||||
if (!(x_186)) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
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_63 : vec4<f32> = gl_FragCoord;
|
||||
let x_66 : vec2<f32> = x_24.resolution;
|
||||
pos = (vec2<f32>(x_63.x, x_63.y) / x_66);
|
||||
let x_68 : vec2<f32> = pos;
|
||||
param_6 = x_68;
|
||||
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_69 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9));
|
||||
if ((x_69 == 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,141 @@
|
||||
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_76 = a.x;
|
||||
const float x_78 = b.y;
|
||||
const float x_81 = b.x;
|
||||
const float x_83 = a.y;
|
||||
return ((x_76 * x_78) - (x_81 * x_83));
|
||||
}
|
||||
|
||||
int pointInTriangle_vf2_vf2_vf2_vf2_(inout float2 p, inout float2 a_1, inout float2 b_1, inout float2 c) {
|
||||
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_145 = false;
|
||||
bool x_185 = false;
|
||||
bool x_146_phi = false;
|
||||
bool x_186_phi = false;
|
||||
const float x_88 = p.x;
|
||||
const float x_90 = a_1.x;
|
||||
const float x_93 = p.y;
|
||||
const float x_95 = a_1.y;
|
||||
const float x_99 = b_1.x;
|
||||
const float x_101 = a_1.x;
|
||||
const float x_104 = b_1.y;
|
||||
const float x_106 = a_1.y;
|
||||
param = float2((x_88 - x_90), (x_93 - x_95));
|
||||
param_1 = float2((x_99 - x_101), (x_104 - x_106));
|
||||
const float x_109 = cross2d_vf2_vf2_(param, param_1);
|
||||
pab = x_109;
|
||||
const float x_111 = p.x;
|
||||
const float x_113 = b_1.x;
|
||||
const float x_116 = p.y;
|
||||
const float x_118 = b_1.y;
|
||||
const float x_122 = c.x;
|
||||
const float x_124 = b_1.x;
|
||||
const float x_127 = c.y;
|
||||
const float x_129 = b_1.y;
|
||||
param_2 = float2((x_111 - x_113), (x_116 - x_118));
|
||||
param_3 = float2((x_122 - x_124), (x_127 - x_129));
|
||||
const float x_132 = cross2d_vf2_vf2_(param_2, param_3);
|
||||
pbc = x_132;
|
||||
bool tint_tmp = (pab < 0.0f);
|
||||
if (tint_tmp) {
|
||||
tint_tmp = (pbc < 0.0f);
|
||||
}
|
||||
const bool x_137 = (tint_tmp);
|
||||
x_146_phi = x_137;
|
||||
if (!(x_137)) {
|
||||
bool tint_tmp_1 = (pab >= 0.0f);
|
||||
if (tint_tmp_1) {
|
||||
tint_tmp_1 = (pbc >= 0.0f);
|
||||
}
|
||||
x_145 = (tint_tmp_1);
|
||||
x_146_phi = x_145;
|
||||
}
|
||||
if (!(x_146_phi)) {
|
||||
return 0;
|
||||
}
|
||||
const float x_151 = p.x;
|
||||
const float x_153 = c.x;
|
||||
const float x_156 = p.y;
|
||||
const float x_158 = c.y;
|
||||
const float x_162 = a_1.x;
|
||||
const float x_164 = c.x;
|
||||
const float x_167 = a_1.y;
|
||||
const float x_169 = c.y;
|
||||
param_4 = float2((x_151 - x_153), (x_156 - x_158));
|
||||
param_5 = float2((x_162 - x_164), (x_167 - x_169));
|
||||
const float x_172 = cross2d_vf2_vf2_(param_4, param_5);
|
||||
pca = x_172;
|
||||
bool tint_tmp_2 = (pab < 0.0f);
|
||||
if (tint_tmp_2) {
|
||||
tint_tmp_2 = (pca < 0.0f);
|
||||
}
|
||||
const bool x_177 = (tint_tmp_2);
|
||||
x_186_phi = x_177;
|
||||
if (!(x_177)) {
|
||||
bool tint_tmp_3 = (pab >= 0.0f);
|
||||
if (tint_tmp_3) {
|
||||
tint_tmp_3 = (pca >= 0.0f);
|
||||
}
|
||||
x_185 = (tint_tmp_3);
|
||||
x_186_phi = x_185;
|
||||
}
|
||||
if (!(x_186_phi)) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
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_63 = gl_FragCoord;
|
||||
const float2 x_66 = asfloat(x_24[0].xy);
|
||||
pos = (float2(x_63.x, x_63.y) / x_66);
|
||||
param_6 = pos;
|
||||
param_7 = float2(0.699999988f, 0.300000012f);
|
||||
param_8 = float2(0.5f, 0.899999976f);
|
||||
param_9 = float2(0.100000001f, 0.400000006f);
|
||||
const int x_69 = pointInTriangle_vf2_vf2_vf2_vf2_(param_6, param_7, param_8, param_9);
|
||||
if ((x_69 == 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,135 @@
|
||||
#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_76 = (*(a)).x;
|
||||
float const x_78 = (*(b)).y;
|
||||
float const x_81 = (*(b)).x;
|
||||
float const x_83 = (*(a)).y;
|
||||
return ((x_76 * x_78) - (x_81 * x_83));
|
||||
}
|
||||
|
||||
int pointInTriangle_vf2_vf2_vf2_vf2_(thread float2* const p, thread float2* const a_1, thread float2* const b_1, thread float2* const c) {
|
||||
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_145 = false;
|
||||
bool x_185 = false;
|
||||
bool x_146_phi = false;
|
||||
bool x_186_phi = false;
|
||||
float const x_88 = (*(p)).x;
|
||||
float const x_90 = (*(a_1)).x;
|
||||
float const x_93 = (*(p)).y;
|
||||
float const x_95 = (*(a_1)).y;
|
||||
float const x_99 = (*(b_1)).x;
|
||||
float const x_101 = (*(a_1)).x;
|
||||
float const x_104 = (*(b_1)).y;
|
||||
float const x_106 = (*(a_1)).y;
|
||||
param = float2((x_88 - x_90), (x_93 - x_95));
|
||||
param_1 = float2((x_99 - x_101), (x_104 - x_106));
|
||||
float const x_109 = cross2d_vf2_vf2_(&(param), &(param_1));
|
||||
pab = x_109;
|
||||
float const x_111 = (*(p)).x;
|
||||
float const x_113 = (*(b_1)).x;
|
||||
float const x_116 = (*(p)).y;
|
||||
float const x_118 = (*(b_1)).y;
|
||||
float const x_122 = (*(c)).x;
|
||||
float const x_124 = (*(b_1)).x;
|
||||
float const x_127 = (*(c)).y;
|
||||
float const x_129 = (*(b_1)).y;
|
||||
param_2 = float2((x_111 - x_113), (x_116 - x_118));
|
||||
param_3 = float2((x_122 - x_124), (x_127 - x_129));
|
||||
float const x_132 = cross2d_vf2_vf2_(&(param_2), &(param_3));
|
||||
pbc = x_132;
|
||||
float const x_133 = pab;
|
||||
float const x_135 = pbc;
|
||||
bool const x_137 = ((x_133 < 0.0f) && (x_135 < 0.0f));
|
||||
x_146_phi = x_137;
|
||||
if (!(x_137)) {
|
||||
float const x_141 = pab;
|
||||
float const x_143 = pbc;
|
||||
x_145 = ((x_141 >= 0.0f) && (x_143 >= 0.0f));
|
||||
x_146_phi = x_145;
|
||||
}
|
||||
bool const x_146 = x_146_phi;
|
||||
if (!(x_146)) {
|
||||
return 0;
|
||||
}
|
||||
float const x_151 = (*(p)).x;
|
||||
float const x_153 = (*(c)).x;
|
||||
float const x_156 = (*(p)).y;
|
||||
float const x_158 = (*(c)).y;
|
||||
float const x_162 = (*(a_1)).x;
|
||||
float const x_164 = (*(c)).x;
|
||||
float const x_167 = (*(a_1)).y;
|
||||
float const x_169 = (*(c)).y;
|
||||
param_4 = float2((x_151 - x_153), (x_156 - x_158));
|
||||
param_5 = float2((x_162 - x_164), (x_167 - x_169));
|
||||
float const x_172 = cross2d_vf2_vf2_(&(param_4), &(param_5));
|
||||
pca = x_172;
|
||||
float const x_173 = pab;
|
||||
float const x_175 = pca;
|
||||
bool const x_177 = ((x_173 < 0.0f) && (x_175 < 0.0f));
|
||||
x_186_phi = x_177;
|
||||
if (!(x_177)) {
|
||||
float const x_181 = pab;
|
||||
float const x_183 = pca;
|
||||
x_185 = ((x_181 >= 0.0f) && (x_183 >= 0.0f));
|
||||
x_186_phi = x_185;
|
||||
}
|
||||
bool const x_186 = x_186_phi;
|
||||
if (!(x_186)) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
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_63 = *(tint_symbol_5);
|
||||
float2 const x_66 = x_24.resolution;
|
||||
pos = (float2(x_63.x, x_63.y) / x_66);
|
||||
float2 const x_68 = pos;
|
||||
param_6 = x_68;
|
||||
param_7 = float2(0.699999988f, 0.300000012f);
|
||||
param_8 = float2(0.5f, 0.899999976f);
|
||||
param_9 = float2(0.100000001f, 0.400000006f);
|
||||
int const x_69 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9));
|
||||
if ((x_69 == 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,343 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 264
|
||||
; 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 %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_145 "x_145"
|
||||
OpName %x_185 "x_185"
|
||||
OpName %x_146_phi "x_146_phi"
|
||||
OpName %x_186_phi "x_186_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
|
||||
%49 = OpConstantNull %float
|
||||
%51 = OpConstantNull %v2float
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Function_bool = OpTypePointer Function %bool
|
||||
%62 = OpConstantNull %bool
|
||||
%float_0 = OpConstant %float 0
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%void = OpTypeVoid
|
||||
%212 = OpTypeFunction %void
|
||||
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
|
||||
%float_0_699999988 = OpConstant %float 0.699999988
|
||||
%float_0_300000012 = OpConstant %float 0.300000012
|
||||
%232 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%float_0_899999976 = OpConstant %float 0.899999976
|
||||
%235 = OpConstantComposite %v2float %float_0_5 %float_0_899999976
|
||||
%float_0_100000001 = OpConstant %float 0.100000001
|
||||
%float_0_400000006 = OpConstant %float 0.400000006
|
||||
%238 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006
|
||||
%float_1 = OpConstant %float 1
|
||||
%249 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
|
||||
%250 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%251 = 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
|
||||
%pab = OpVariable %_ptr_Function_float Function %49
|
||||
%param = OpVariable %_ptr_Function_v2float Function %51
|
||||
%param_1 = OpVariable %_ptr_Function_v2float Function %51
|
||||
%pbc = OpVariable %_ptr_Function_float Function %49
|
||||
%param_2 = OpVariable %_ptr_Function_v2float Function %51
|
||||
%param_3 = OpVariable %_ptr_Function_v2float Function %51
|
||||
%pca = OpVariable %_ptr_Function_float Function %49
|
||||
%param_4 = OpVariable %_ptr_Function_v2float Function %51
|
||||
%param_5 = OpVariable %_ptr_Function_v2float Function %51
|
||||
%x_145 = OpVariable %_ptr_Function_bool Function %62
|
||||
%x_185 = OpVariable %_ptr_Function_bool Function %62
|
||||
%x_146_phi = OpVariable %_ptr_Function_bool Function %62
|
||||
%x_186_phi = OpVariable %_ptr_Function_bool Function %62
|
||||
%67 = OpAccessChain %_ptr_Function_float %p %uint_0
|
||||
%68 = OpLoad %float %67
|
||||
%70 = OpAccessChain %_ptr_Function_float %a_1 %uint_0
|
||||
%71 = OpLoad %float %70
|
||||
%73 = OpAccessChain %_ptr_Function_float %p %uint_1
|
||||
%74 = OpLoad %float %73
|
||||
%76 = OpAccessChain %_ptr_Function_float %a_1 %uint_1
|
||||
%77 = OpLoad %float %76
|
||||
%79 = OpAccessChain %_ptr_Function_float %b_1 %uint_0
|
||||
%80 = OpLoad %float %79
|
||||
%82 = OpAccessChain %_ptr_Function_float %a_1 %uint_0
|
||||
%83 = OpLoad %float %82
|
||||
%85 = OpAccessChain %_ptr_Function_float %b_1 %uint_1
|
||||
%86 = OpLoad %float %85
|
||||
%88 = OpAccessChain %_ptr_Function_float %a_1 %uint_1
|
||||
%89 = OpLoad %float %88
|
||||
%90 = OpFSub %float %68 %71
|
||||
%91 = OpFSub %float %74 %77
|
||||
%92 = OpCompositeConstruct %v2float %90 %91
|
||||
OpStore %param %92
|
||||
%93 = OpFSub %float %80 %83
|
||||
%94 = OpFSub %float %86 %89
|
||||
%95 = OpCompositeConstruct %v2float %93 %94
|
||||
OpStore %param_1 %95
|
||||
%96 = OpFunctionCall %float %cross2d_vf2_vf2_ %param %param_1
|
||||
OpStore %pab %96
|
||||
%100 = OpAccessChain %_ptr_Function_float %p %uint_0
|
||||
%101 = OpLoad %float %100
|
||||
%103 = OpAccessChain %_ptr_Function_float %b_1 %uint_0
|
||||
%104 = OpLoad %float %103
|
||||
%106 = OpAccessChain %_ptr_Function_float %p %uint_1
|
||||
%107 = OpLoad %float %106
|
||||
%109 = OpAccessChain %_ptr_Function_float %b_1 %uint_1
|
||||
%110 = OpLoad %float %109
|
||||
%112 = OpAccessChain %_ptr_Function_float %c %uint_0
|
||||
%113 = OpLoad %float %112
|
||||
%115 = OpAccessChain %_ptr_Function_float %b_1 %uint_0
|
||||
%116 = OpLoad %float %115
|
||||
%118 = OpAccessChain %_ptr_Function_float %c %uint_1
|
||||
%119 = OpLoad %float %118
|
||||
%121 = OpAccessChain %_ptr_Function_float %b_1 %uint_1
|
||||
%122 = OpLoad %float %121
|
||||
%123 = OpFSub %float %101 %104
|
||||
%124 = OpFSub %float %107 %110
|
||||
%125 = OpCompositeConstruct %v2float %123 %124
|
||||
OpStore %param_2 %125
|
||||
%126 = OpFSub %float %113 %116
|
||||
%127 = OpFSub %float %119 %122
|
||||
%128 = OpCompositeConstruct %v2float %126 %127
|
||||
OpStore %param_3 %128
|
||||
%129 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_2 %param_3
|
||||
OpStore %pbc %129
|
||||
%132 = OpLoad %float %pab
|
||||
%133 = OpLoad %float %pbc
|
||||
%135 = OpFOrdLessThan %bool %132 %float_0
|
||||
OpSelectionMerge %136 None
|
||||
OpBranchConditional %135 %137 %136
|
||||
%137 = OpLabel
|
||||
%138 = OpFOrdLessThan %bool %133 %float_0
|
||||
OpBranch %136
|
||||
%136 = OpLabel
|
||||
%139 = OpPhi %bool %135 %47 %138 %137
|
||||
OpStore %x_146_phi %139
|
||||
%140 = OpLogicalNot %bool %139
|
||||
OpSelectionMerge %141 None
|
||||
OpBranchConditional %140 %142 %141
|
||||
%142 = OpLabel
|
||||
%143 = OpLoad %float %pab
|
||||
%144 = OpLoad %float %pbc
|
||||
%145 = OpFOrdGreaterThanEqual %bool %143 %float_0
|
||||
OpSelectionMerge %146 None
|
||||
OpBranchConditional %145 %147 %146
|
||||
%147 = OpLabel
|
||||
%148 = OpFOrdGreaterThanEqual %bool %144 %float_0
|
||||
OpBranch %146
|
||||
%146 = OpLabel
|
||||
%149 = OpPhi %bool %145 %142 %148 %147
|
||||
OpStore %x_145 %149
|
||||
%150 = OpLoad %bool %x_145
|
||||
OpStore %x_146_phi %150
|
||||
OpBranch %141
|
||||
%141 = OpLabel
|
||||
%151 = OpLoad %bool %x_146_phi
|
||||
%152 = OpLogicalNot %bool %151
|
||||
OpSelectionMerge %153 None
|
||||
OpBranchConditional %152 %154 %153
|
||||
%154 = OpLabel
|
||||
OpReturnValue %int_0
|
||||
%153 = OpLabel
|
||||
%157 = OpAccessChain %_ptr_Function_float %p %uint_0
|
||||
%158 = OpLoad %float %157
|
||||
%160 = OpAccessChain %_ptr_Function_float %c %uint_0
|
||||
%161 = OpLoad %float %160
|
||||
%163 = OpAccessChain %_ptr_Function_float %p %uint_1
|
||||
%164 = OpLoad %float %163
|
||||
%166 = OpAccessChain %_ptr_Function_float %c %uint_1
|
||||
%167 = OpLoad %float %166
|
||||
%169 = OpAccessChain %_ptr_Function_float %a_1 %uint_0
|
||||
%170 = OpLoad %float %169
|
||||
%172 = OpAccessChain %_ptr_Function_float %c %uint_0
|
||||
%173 = OpLoad %float %172
|
||||
%175 = OpAccessChain %_ptr_Function_float %a_1 %uint_1
|
||||
%176 = OpLoad %float %175
|
||||
%178 = OpAccessChain %_ptr_Function_float %c %uint_1
|
||||
%179 = OpLoad %float %178
|
||||
%180 = OpFSub %float %158 %161
|
||||
%181 = OpFSub %float %164 %167
|
||||
%182 = OpCompositeConstruct %v2float %180 %181
|
||||
OpStore %param_4 %182
|
||||
%183 = OpFSub %float %170 %173
|
||||
%184 = OpFSub %float %176 %179
|
||||
%185 = OpCompositeConstruct %v2float %183 %184
|
||||
OpStore %param_5 %185
|
||||
%186 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_4 %param_5
|
||||
OpStore %pca %186
|
||||
%189 = OpLoad %float %pab
|
||||
%190 = OpLoad %float %pca
|
||||
%191 = OpFOrdLessThan %bool %189 %float_0
|
||||
OpSelectionMerge %192 None
|
||||
OpBranchConditional %191 %193 %192
|
||||
%193 = OpLabel
|
||||
%194 = OpFOrdLessThan %bool %190 %float_0
|
||||
OpBranch %192
|
||||
%192 = OpLabel
|
||||
%195 = OpPhi %bool %191 %153 %194 %193
|
||||
OpStore %x_186_phi %195
|
||||
%196 = OpLogicalNot %bool %195
|
||||
OpSelectionMerge %197 None
|
||||
OpBranchConditional %196 %198 %197
|
||||
%198 = OpLabel
|
||||
%199 = OpLoad %float %pab
|
||||
%200 = OpLoad %float %pca
|
||||
%201 = OpFOrdGreaterThanEqual %bool %199 %float_0
|
||||
OpSelectionMerge %202 None
|
||||
OpBranchConditional %201 %203 %202
|
||||
%203 = OpLabel
|
||||
%204 = OpFOrdGreaterThanEqual %bool %200 %float_0
|
||||
OpBranch %202
|
||||
%202 = OpLabel
|
||||
%205 = OpPhi %bool %201 %198 %204 %203
|
||||
OpStore %x_185 %205
|
||||
%206 = OpLoad %bool %x_185
|
||||
OpStore %x_186_phi %206
|
||||
OpBranch %197
|
||||
%197 = OpLabel
|
||||
%207 = OpLoad %bool %x_186_phi
|
||||
%208 = OpLogicalNot %bool %207
|
||||
OpSelectionMerge %209 None
|
||||
OpBranchConditional %208 %210 %209
|
||||
%210 = OpLabel
|
||||
OpReturnValue %int_0
|
||||
%209 = OpLabel
|
||||
OpReturnValue %int_1
|
||||
OpFunctionEnd
|
||||
%main_1 = OpFunction %void None %212
|
||||
%215 = OpLabel
|
||||
%pos = OpVariable %_ptr_Function_v2float Function %51
|
||||
%param_6 = OpVariable %_ptr_Function_v2float Function %51
|
||||
%param_7 = OpVariable %_ptr_Function_v2float Function %51
|
||||
%param_8 = OpVariable %_ptr_Function_v2float Function %51
|
||||
%param_9 = OpVariable %_ptr_Function_v2float Function %51
|
||||
%221 = OpLoad %v4float %gl_FragCoord
|
||||
%223 = OpAccessChain %_ptr_Uniform_v2float %x_24 %uint_0
|
||||
%224 = OpLoad %v2float %223
|
||||
%225 = OpCompositeExtract %float %221 0
|
||||
%226 = OpCompositeExtract %float %221 1
|
||||
%227 = OpCompositeConstruct %v2float %225 %226
|
||||
%228 = OpFDiv %v2float %227 %224
|
||||
OpStore %pos %228
|
||||
%229 = OpLoad %v2float %pos
|
||||
OpStore %param_6 %229
|
||||
OpStore %param_7 %232
|
||||
OpStore %param_8 %235
|
||||
OpStore %param_9 %238
|
||||
%239 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_6 %param_7 %param_8 %param_9
|
||||
%244 = OpIEqual %bool %239 %int_1
|
||||
OpSelectionMerge %245 None
|
||||
OpBranchConditional %244 %246 %247
|
||||
%246 = OpLabel
|
||||
OpStore %x_GLF_color %249
|
||||
OpBranch %245
|
||||
%247 = OpLabel
|
||||
OpStore %x_GLF_color %250
|
||||
OpBranch %245
|
||||
%245 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_3 = OpFunction %void None %251
|
||||
%tint_symbol_1 = OpFunctionParameter %main_out
|
||||
%255 = OpLabel
|
||||
%256 = OpCompositeExtract %v4float %tint_symbol_1 0
|
||||
OpStore %tint_symbol_2 %256
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %212
|
||||
%258 = OpLabel
|
||||
%259 = OpLoad %v4float %tint_symbol
|
||||
OpStore %gl_FragCoord %259
|
||||
%260 = OpFunctionCall %void %main_1
|
||||
%262 = OpLoad %v4float %x_GLF_color
|
||||
%263 = OpCompositeConstruct %main_out %262
|
||||
%261 = OpFunctionCall %void %tint_symbol_3 %263
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,134 @@
|
||||
[[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_76 : f32 = (*(a)).x;
|
||||
let x_78 : f32 = (*(b)).y;
|
||||
let x_81 : f32 = (*(b)).x;
|
||||
let x_83 : f32 = (*(a)).y;
|
||||
return ((x_76 * x_78) - (x_81 * x_83));
|
||||
}
|
||||
|
||||
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 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_145 : bool;
|
||||
var x_185 : bool;
|
||||
var x_146_phi : bool;
|
||||
var x_186_phi : bool;
|
||||
let x_88 : f32 = (*(p)).x;
|
||||
let x_90 : f32 = (*(a_1)).x;
|
||||
let x_93 : f32 = (*(p)).y;
|
||||
let x_95 : f32 = (*(a_1)).y;
|
||||
let x_99 : f32 = (*(b_1)).x;
|
||||
let x_101 : f32 = (*(a_1)).x;
|
||||
let x_104 : f32 = (*(b_1)).y;
|
||||
let x_106 : f32 = (*(a_1)).y;
|
||||
param = vec2<f32>((x_88 - x_90), (x_93 - x_95));
|
||||
param_1 = vec2<f32>((x_99 - x_101), (x_104 - x_106));
|
||||
let x_109 : f32 = cross2d_vf2_vf2_(&(param), &(param_1));
|
||||
pab = x_109;
|
||||
let x_111 : f32 = (*(p)).x;
|
||||
let x_113 : f32 = (*(b_1)).x;
|
||||
let x_116 : f32 = (*(p)).y;
|
||||
let x_118 : f32 = (*(b_1)).y;
|
||||
let x_122 : f32 = (*(c)).x;
|
||||
let x_124 : f32 = (*(b_1)).x;
|
||||
let x_127 : f32 = (*(c)).y;
|
||||
let x_129 : f32 = (*(b_1)).y;
|
||||
param_2 = vec2<f32>((x_111 - x_113), (x_116 - x_118));
|
||||
param_3 = vec2<f32>((x_122 - x_124), (x_127 - x_129));
|
||||
let x_132 : f32 = cross2d_vf2_vf2_(&(param_2), &(param_3));
|
||||
pbc = x_132;
|
||||
let x_133 : f32 = pab;
|
||||
let x_135 : f32 = pbc;
|
||||
let x_137 : bool = ((x_133 < 0.0) && (x_135 < 0.0));
|
||||
x_146_phi = x_137;
|
||||
if (!(x_137)) {
|
||||
let x_141 : f32 = pab;
|
||||
let x_143 : f32 = pbc;
|
||||
x_145 = ((x_141 >= 0.0) && (x_143 >= 0.0));
|
||||
x_146_phi = x_145;
|
||||
}
|
||||
let x_146 : bool = x_146_phi;
|
||||
if (!(x_146)) {
|
||||
return 0;
|
||||
}
|
||||
let x_151 : f32 = (*(p)).x;
|
||||
let x_153 : f32 = (*(c)).x;
|
||||
let x_156 : f32 = (*(p)).y;
|
||||
let x_158 : f32 = (*(c)).y;
|
||||
let x_162 : f32 = (*(a_1)).x;
|
||||
let x_164 : f32 = (*(c)).x;
|
||||
let x_167 : f32 = (*(a_1)).y;
|
||||
let x_169 : f32 = (*(c)).y;
|
||||
param_4 = vec2<f32>((x_151 - x_153), (x_156 - x_158));
|
||||
param_5 = vec2<f32>((x_162 - x_164), (x_167 - x_169));
|
||||
let x_172 : f32 = cross2d_vf2_vf2_(&(param_4), &(param_5));
|
||||
pca = x_172;
|
||||
let x_173 : f32 = pab;
|
||||
let x_175 : f32 = pca;
|
||||
let x_177 : bool = ((x_173 < 0.0) && (x_175 < 0.0));
|
||||
x_186_phi = x_177;
|
||||
if (!(x_177)) {
|
||||
let x_181 : f32 = pab;
|
||||
let x_183 : f32 = pca;
|
||||
x_185 = ((x_181 >= 0.0) && (x_183 >= 0.0));
|
||||
x_186_phi = x_185;
|
||||
}
|
||||
let x_186 : bool = x_186_phi;
|
||||
if (!(x_186)) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
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_63 : vec4<f32> = gl_FragCoord;
|
||||
let x_66 : vec2<f32> = x_24.resolution;
|
||||
pos = (vec2<f32>(x_63.x, x_63.y) / x_66);
|
||||
let x_68 : vec2<f32> = pos;
|
||||
param_6 = x_68;
|
||||
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_69 : i32 = pointInTriangle_vf2_vf2_vf2_vf2_(&(param_6), &(param_7), &(param_8), &(param_9));
|
||||
if ((x_69 == 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