test: Remove many expected files

For these tests, we only really care that we can successfully consume
them and generate valid output for each backend. Having the expected
files in the tree generates significant churn for any change to how we
generate backend code, which makes it hard to inspect diffs.

Change-Id: Ic98c248081144c0fb1791f1303eaf6d459548e3d
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/62720
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
This commit is contained in:
James Price
2021-08-24 22:49:42 +00:00
committed by Tint LUCI CQ
parent 568136dd10
commit 87cce20f67
8526 changed files with 12 additions and 613699 deletions

View File

@@ -1,130 +0,0 @@
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;
const bool x_137 = ((pab < 0.0f) & (pbc < 0.0f));
x_146_phi = x_137;
if (!(x_137)) {
x_145 = ((pab >= 0.0f) & (pbc >= 0.0f));
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;
const bool x_177 = ((pab < 0.0f) & (pca < 0.0f));
x_186_phi = x_177;
if (!(x_177)) {
x_185 = ((pab >= 0.0f) & (pca >= 0.0f));
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;
};
main_out main_inner(float4 gl_FragCoord_param) {
gl_FragCoord = gl_FragCoord_param;
main_1();
const main_out tint_symbol_4 = {x_GLF_color};
return tint_symbol_4;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}

View File

@@ -1,141 +0,0 @@
#include <metal_stdlib>
using namespace metal;
struct buf0 {
/* 0x0000 */ float2 resolution;
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
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_3, thread float4* const tint_symbol_4) {
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_3);
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_4) = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
*(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 1.0f);
}
return;
}
main_out tint_symbol_inner(constant buf0& x_24, float4 gl_FragCoord_param, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) {
*(tint_symbol_5) = gl_FragCoord_param;
main_1(x_24, tint_symbol_5, tint_symbol_6);
main_out const tint_symbol_2 = {.x_GLF_color_1=*(tint_symbol_6)};
return tint_symbol_2;
}
fragment tint_symbol_1 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;
main_out const inner_result = tint_symbol_inner(x_24, gl_FragCoord_param, &(tint_symbol_7), &(tint_symbol_8));
tint_symbol_1 wrapper_result = {};
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}

View File

@@ -1,323 +0,0 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 256
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %gl_FragCoord_param_1 %x_GLF_color_1_1
OpExecutionMode %main OriginUpperLeft
OpName %gl_FragCoord_param_1 "gl_FragCoord_param_1"
OpName %x_GLF_color_1_1 "x_GLF_color_1_1"
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 %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 %main_inner "main_inner"
OpName %gl_FragCoord_param "gl_FragCoord_param"
OpName %main "main"
OpDecorate %gl_FragCoord_param_1 BuiltIn FragCoord
OpDecorate %x_GLF_color_1_1 Location 0
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %x_24 NonWritable
OpDecorate %x_24 DescriptorSet 0
OpDecorate %x_24 Binding 0
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Input_v4float = OpTypePointer Input %v4float
%gl_FragCoord_param_1 = OpVariable %_ptr_Input_v4float Input
%_ptr_Output_v4float = OpTypePointer Output %v4float
%7 = OpConstantNull %v4float
%x_GLF_color_1_1 = OpVariable %_ptr_Output_v4float Output %7
%_ptr_Private_v4float = OpTypePointer Private %v4float
%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %7
%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 %7
%_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
%204 = OpTypeFunction %void
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%float_0_699999988 = OpConstant %float 0.699999988
%float_0_300000012 = OpConstant %float 0.300000012
%224 = OpConstantComposite %v2float %float_0_699999988 %float_0_300000012
%float_0_5 = OpConstant %float 0.5
%float_0_899999976 = OpConstant %float 0.899999976
%227 = OpConstantComposite %v2float %float_0_5 %float_0_899999976
%float_0_100000001 = OpConstant %float 0.100000001
%float_0_400000006 = OpConstant %float 0.400000006
%230 = OpConstantComposite %v2float %float_0_100000001 %float_0_400000006
%float_1 = OpConstant %float 1
%241 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%242 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1
%main_out = OpTypeStruct %v4float
%243 = OpTypeFunction %main_out %v4float
%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
%136 = OpFOrdLessThan %bool %133 %float_0
%137 = OpLogicalAnd %bool %135 %136
OpStore %x_146_phi %137
%138 = OpLogicalNot %bool %137
OpSelectionMerge %139 None
OpBranchConditional %138 %140 %139
%140 = OpLabel
%141 = OpLoad %float %pab
%142 = OpLoad %float %pbc
%143 = OpFOrdGreaterThanEqual %bool %141 %float_0
%144 = OpFOrdGreaterThanEqual %bool %142 %float_0
%145 = OpLogicalAnd %bool %143 %144
OpStore %x_145 %145
%146 = OpLoad %bool %x_145
OpStore %x_146_phi %146
OpBranch %139
%139 = OpLabel
%147 = OpLoad %bool %x_146_phi
%148 = OpLogicalNot %bool %147
OpSelectionMerge %149 None
OpBranchConditional %148 %150 %149
%150 = OpLabel
OpReturnValue %int_0
%149 = OpLabel
%153 = OpAccessChain %_ptr_Function_float %p %uint_0
%154 = OpLoad %float %153
%156 = OpAccessChain %_ptr_Function_float %c %uint_0
%157 = OpLoad %float %156
%159 = OpAccessChain %_ptr_Function_float %p %uint_1
%160 = OpLoad %float %159
%162 = OpAccessChain %_ptr_Function_float %c %uint_1
%163 = OpLoad %float %162
%165 = OpAccessChain %_ptr_Function_float %a_1 %uint_0
%166 = OpLoad %float %165
%168 = OpAccessChain %_ptr_Function_float %c %uint_0
%169 = OpLoad %float %168
%171 = OpAccessChain %_ptr_Function_float %a_1 %uint_1
%172 = OpLoad %float %171
%174 = OpAccessChain %_ptr_Function_float %c %uint_1
%175 = OpLoad %float %174
%176 = OpFSub %float %154 %157
%177 = OpFSub %float %160 %163
%178 = OpCompositeConstruct %v2float %176 %177
OpStore %param_4 %178
%179 = OpFSub %float %166 %169
%180 = OpFSub %float %172 %175
%181 = OpCompositeConstruct %v2float %179 %180
OpStore %param_5 %181
%182 = OpFunctionCall %float %cross2d_vf2_vf2_ %param_4 %param_5
OpStore %pca %182
%185 = OpLoad %float %pab
%186 = OpLoad %float %pca
%187 = OpFOrdLessThan %bool %185 %float_0
%188 = OpFOrdLessThan %bool %186 %float_0
%189 = OpLogicalAnd %bool %187 %188
OpStore %x_186_phi %189
%190 = OpLogicalNot %bool %189
OpSelectionMerge %191 None
OpBranchConditional %190 %192 %191
%192 = OpLabel
%193 = OpLoad %float %pab
%194 = OpLoad %float %pca
%195 = OpFOrdGreaterThanEqual %bool %193 %float_0
%196 = OpFOrdGreaterThanEqual %bool %194 %float_0
%197 = OpLogicalAnd %bool %195 %196
OpStore %x_185 %197
%198 = OpLoad %bool %x_185
OpStore %x_186_phi %198
OpBranch %191
%191 = OpLabel
%199 = OpLoad %bool %x_186_phi
%200 = OpLogicalNot %bool %199
OpSelectionMerge %201 None
OpBranchConditional %200 %202 %201
%202 = OpLabel
OpReturnValue %int_0
%201 = OpLabel
OpReturnValue %int_1
OpFunctionEnd
%main_1 = OpFunction %void None %204
%207 = 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
%213 = OpLoad %v4float %gl_FragCoord
%215 = OpAccessChain %_ptr_Uniform_v2float %x_24 %uint_0
%216 = OpLoad %v2float %215
%217 = OpCompositeExtract %float %213 0
%218 = OpCompositeExtract %float %213 1
%219 = OpCompositeConstruct %v2float %217 %218
%220 = OpFDiv %v2float %219 %216
OpStore %pos %220
%221 = OpLoad %v2float %pos
OpStore %param_6 %221
OpStore %param_7 %224
OpStore %param_8 %227
OpStore %param_9 %230
%231 = OpFunctionCall %int %pointInTriangle_vf2_vf2_vf2_vf2_ %param_6 %param_7 %param_8 %param_9
%236 = OpIEqual %bool %231 %int_1
OpSelectionMerge %237 None
OpBranchConditional %236 %238 %239
%238 = OpLabel
OpStore %x_GLF_color %241
OpBranch %237
%239 = OpLabel
OpStore %x_GLF_color %242
OpBranch %237
%237 = OpLabel
OpReturn
OpFunctionEnd
%main_inner = OpFunction %main_out None %243
%gl_FragCoord_param = OpFunctionParameter %v4float
%247 = OpLabel
OpStore %gl_FragCoord %gl_FragCoord_param
%248 = OpFunctionCall %void %main_1
%249 = OpLoad %v4float %x_GLF_color
%250 = OpCompositeConstruct %main_out %249
OpReturnValue %250
OpFunctionEnd
%main = OpFunction %void None %204
%252 = OpLabel
%254 = OpLoad %v4float %gl_FragCoord_param_1
%253 = OpFunctionCall %main_out %main_inner %254
%255 = OpCompositeExtract %v4float %253 0
OpStore %x_GLF_color_1_1 %255
OpReturn
OpFunctionEnd

View File

@@ -1,134 +0,0 @@
[[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);
}

View File

@@ -1,146 +0,0 @@
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;
};
main_out main_inner(float4 gl_FragCoord_param) {
gl_FragCoord = gl_FragCoord_param;
main_1();
const main_out tint_symbol_4 = {x_GLF_color};
return tint_symbol_4;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.gl_FragCoord_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}

View File

@@ -1,141 +0,0 @@
#include <metal_stdlib>
using namespace metal;
struct buf0 {
/* 0x0000 */ float2 resolution;
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
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_3, thread float4* const tint_symbol_4) {
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_3);
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_4) = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
*(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 1.0f);
}
return;
}
main_out tint_symbol_inner(constant buf0& x_24, float4 gl_FragCoord_param, thread float4* const tint_symbol_5, thread float4* const tint_symbol_6) {
*(tint_symbol_5) = gl_FragCoord_param;
main_1(x_24, tint_symbol_5, tint_symbol_6);
main_out const tint_symbol_2 = {.x_GLF_color_1=*(tint_symbol_6)};
return tint_symbol_2;
}
fragment tint_symbol_1 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;
main_out const inner_result = tint_symbol_inner(x_24, gl_FragCoord_param, &(tint_symbol_7), &(tint_symbol_8));
tint_symbol_1 wrapper_result = {};
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}

View File

@@ -1,343 +0,0 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 264
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %gl_FragCoord_param_1 %x_GLF_color_1_1
OpExecutionMode %main OriginUpperLeft
OpName %gl_FragCoord_param_1 "gl_FragCoord_param_1"
OpName %x_GLF_color_1_1 "x_GLF_color_1_1"
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 %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 %main_inner "main_inner"
OpName %gl_FragCoord_param "gl_FragCoord_param"
OpName %main "main"
OpDecorate %gl_FragCoord_param_1 BuiltIn FragCoord
OpDecorate %x_GLF_color_1_1 Location 0
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %x_24 NonWritable
OpDecorate %x_24 DescriptorSet 0
OpDecorate %x_24 Binding 0
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Input_v4float = OpTypePointer Input %v4float
%gl_FragCoord_param_1 = OpVariable %_ptr_Input_v4float Input
%_ptr_Output_v4float = OpTypePointer Output %v4float
%7 = OpConstantNull %v4float
%x_GLF_color_1_1 = OpVariable %_ptr_Output_v4float Output %7
%_ptr_Private_v4float = OpTypePointer Private %v4float
%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %7
%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 %7
%_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 %main_out %v4float
%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
%main_inner = OpFunction %main_out None %251
%gl_FragCoord_param = OpFunctionParameter %v4float
%255 = OpLabel
OpStore %gl_FragCoord %gl_FragCoord_param
%256 = OpFunctionCall %void %main_1
%257 = OpLoad %v4float %x_GLF_color
%258 = OpCompositeConstruct %main_out %257
OpReturnValue %258
OpFunctionEnd
%main = OpFunction %void None %212
%260 = OpLabel
%262 = OpLoad %v4float %gl_FragCoord_param_1
%261 = OpFunctionCall %main_out %main_inner %262
%263 = OpCompositeExtract %v4float %261 0
OpStore %x_GLF_color_1_1 %263
OpReturn
OpFunctionEnd

View File

@@ -1,134 +0,0 @@
[[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);
}