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:
Alastair Donaldson
2021-07-23 13:10:12 +00:00
committed by Tint LUCI CQ
parent bd3edb564f
commit f7e73d4ee3
5160 changed files with 621458 additions and 0 deletions

View File

@@ -0,0 +1,246 @@
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 %func0_i1_ "func0(i1;"
OpName %x "x"
OpName %func1_ "func1("
OpName %m "m"
OpName %buf2 "buf2"
OpMemberName %buf2 0 "one"
OpName %_ ""
OpName %buf0 "buf0"
OpMemberName %buf0 0 "_GLF_uniform_float_values"
OpName %__0 ""
OpName %i "i"
OpName %gl_FragCoord "gl_FragCoord"
OpName %param "param"
OpName %buf1 "buf1"
OpMemberName %buf1 0 "_GLF_uniform_int_values"
OpName %__1 ""
OpName %_GLF_color "_GLF_color"
OpMemberDecorate %buf2 0 Offset 0
OpDecorate %buf2 Block
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 2
OpDecorate %_arr_float_uint_1 ArrayStride 16
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %buf0 Block
OpDecorate %__0 DescriptorSet 0
OpDecorate %__0 Binding 0
OpDecorate %gl_FragCoord BuiltIn FragCoord
OpDecorate %_arr_int_uint_4 ArrayStride 16
OpMemberDecorate %buf1 0 Offset 0
OpDecorate %buf1 Block
OpDecorate %__1 DescriptorSet 0
OpDecorate %__1 Binding 1
OpDecorate %_GLF_color Location 0
%void = OpTypeVoid
%20 = OpTypeFunction %void
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%23 = OpTypeFunction %void %_ptr_Function_int
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat4v2float = OpTypeMatrix %v2float 4
%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float
%m = OpVariable %_ptr_Private_mat4v2float Private
%float_0 = OpConstant %float 0
%29 = OpConstantComposite %v2float %float_0 %float_0
%30 = OpConstantComposite %mat4v2float %29 %29 %29 %29
%bool = OpTypeBool
%int_1 = OpConstant %int 1
%buf2 = OpTypeStruct %float
%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2
%_ = OpVariable %_ptr_Uniform_buf2 Uniform
%int_0 = OpConstant %int 0
%_ptr_Uniform_float = OpTypePointer Uniform %float
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_arr_float_uint_1 = OpTypeArray %float %uint_1
%buf0 = OpTypeStruct %_arr_float_uint_1
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%__0 = OpVariable %_ptr_Uniform_buf0 Uniform
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%_ptr_Private_float = OpTypePointer Private %float
%v4float = OpTypeVector %float 4
%_ptr_Input_v4float = OpTypePointer Input %v4float
%gl_FragCoord = OpVariable %_ptr_Input_v4float Input
%_ptr_Input_float = OpTypePointer Input %float
%uint_4 = OpConstant %uint 4
%_arr_int_uint_4 = OpTypeArray %int %uint_4
%buf1 = OpTypeStruct %_arr_int_uint_4
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
%__1 = OpVariable %_ptr_Uniform_buf1 Uniform
%_ptr_Uniform_int = OpTypePointer Uniform %int
%float_1 = OpConstant %float 1
%v2bool = OpTypeVector %bool 2
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_GLF_color = OpVariable %_ptr_Output_v4float Output
%main = OpFunction %void None %20
%51 = OpLabel
OpStore %m %30
%52 = OpFunctionCall %void %func1_
%53 = OpFunctionCall %void %func1_
%54 = OpLoad %mat4v2float %m
%55 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0
%56 = OpLoad %int %55
%57 = OpConvertSToF %float %56
%58 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0
%59 = OpLoad %int %58
%60 = OpConvertSToF %float %59
%61 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1
%62 = OpLoad %int %61
%63 = OpConvertSToF %float %62
%64 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_1
%65 = OpLoad %int %64
%66 = OpConvertSToF %float %65
%67 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0
%68 = OpLoad %int %67
%69 = OpConvertSToF %float %68
%70 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0
%71 = OpLoad %int %70
%72 = OpConvertSToF %float %71
%73 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0
%74 = OpLoad %int %73
%75 = OpConvertSToF %float %74
%76 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0
%77 = OpLoad %int %76
%78 = OpConvertSToF %float %77
%79 = OpCompositeConstruct %v2float %57 %60
%80 = OpCompositeConstruct %v2float %63 %66
%81 = OpCompositeConstruct %v2float %69 %72
%82 = OpCompositeConstruct %v2float %75 %78
%83 = OpCompositeConstruct %mat4v2float %79 %80 %81 %82
%84 = OpCompositeExtract %v2float %54 0
%85 = OpCompositeExtract %v2float %83 0
%86 = OpFOrdEqual %v2bool %84 %85
%87 = OpAll %bool %86
%88 = OpCompositeExtract %v2float %54 1
%89 = OpCompositeExtract %v2float %83 1
%90 = OpFOrdEqual %v2bool %88 %89
%91 = OpAll %bool %90
%92 = OpLogicalAnd %bool %87 %91
%93 = OpCompositeExtract %v2float %54 2
%94 = OpCompositeExtract %v2float %83 2
%95 = OpFOrdEqual %v2bool %93 %94
%96 = OpAll %bool %95
%97 = OpLogicalAnd %bool %92 %96
%98 = OpCompositeExtract %v2float %54 3
%99 = OpCompositeExtract %v2float %83 3
%100 = OpFOrdEqual %v2bool %98 %99
%101 = OpAll %bool %100
%102 = OpLogicalAnd %bool %97 %101
OpSelectionMerge %103 None
OpBranchConditional %102 %104 %105
%104 = OpLabel
%106 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_3
%107 = OpLoad %int %106
%108 = OpConvertSToF %float %107
%109 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0
%110 = OpLoad %int %109
%111 = OpConvertSToF %float %110
%112 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0
%113 = OpLoad %int %112
%114 = OpConvertSToF %float %113
%115 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_3
%116 = OpLoad %int %115
%117 = OpConvertSToF %float %116
%118 = OpCompositeConstruct %v4float %108 %111 %114 %117
OpStore %_GLF_color %118
OpBranch %103
%105 = OpLabel
%119 = OpAccessChain %_ptr_Uniform_int %__1 %int_0 %int_0
%120 = OpLoad %int %119
%121 = OpConvertSToF %float %120
%122 = OpCompositeConstruct %v4float %121 %121 %121 %121
OpStore %_GLF_color %122
OpBranch %103
%103 = OpLabel
OpReturn
OpFunctionEnd
%func0_i1_ = OpFunction %void None %23
%x = OpFunctionParameter %_ptr_Function_int
%123 = OpLabel
%i = OpVariable %_ptr_Function_int Function
%124 = OpLoad %int %x
%125 = OpSLessThan %bool %124 %int_1
%126 = OpLogicalNot %bool %125
OpSelectionMerge %127 None
OpBranchConditional %126 %128 %127
%128 = OpLabel
%129 = OpLoad %int %x
%130 = OpSGreaterThan %bool %129 %int_1
OpSelectionMerge %131 None
OpBranchConditional %130 %132 %131
%132 = OpLabel
%133 = OpAccessChain %_ptr_Uniform_float %_ %int_0
%134 = OpLoad %float %133
%135 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0
%136 = OpLoad %float %135
%137 = OpFOrdGreaterThan %bool %134 %136
OpBranch %131
%131 = OpLabel
%138 = OpPhi %bool %130 %128 %137 %132
OpBranch %127
%127 = OpLabel
%139 = OpPhi %bool %125 %123 %138 %131
OpSelectionMerge %140 None
OpBranchConditional %139 %141 %140
%141 = OpLabel
OpReturn
%140 = OpLabel
%142 = OpAccessChain %_ptr_Uniform_float %_ %int_0
%143 = OpLoad %float %142
%144 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0
%145 = OpLoad %float %144
%146 = OpFOrdEqual %bool %143 %145
OpSelectionMerge %147 None
OpBranchConditional %146 %148 %147
%148 = OpLabel
OpStore %i %int_0
OpBranch %149
%149 = OpLabel
%150 = OpLoad %int %i
%151 = OpSLessThan %bool %150 %int_2
OpLoopMerge %152 %153 None
OpBranchConditional %151 %153 %152
%153 = OpLabel
%154 = OpLoad %int %x
%155 = OpExtInst %int %1 SClamp %154 %int_0 %int_3
%156 = OpLoad %int %i
%157 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0
%158 = OpLoad %float %157
%159 = OpAccessChain %_ptr_Private_float %m %155 %156
%160 = OpLoad %float %159
%161 = OpFAdd %float %160 %158
%162 = OpAccessChain %_ptr_Private_float %m %155 %156
OpStore %162 %161
%163 = OpLoad %int %i
%164 = OpIAdd %int %163 %int_1
OpStore %i %164
OpBranch %149
%152 = OpLabel
OpBranch %147
%147 = OpLabel
OpReturn
OpFunctionEnd
%func1_ = OpFunction %void None %20
%165 = OpLabel
%param = OpVariable %_ptr_Function_int Function
%166 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1
%167 = OpLoad %float %166
%168 = OpFOrdLessThan %bool %167 %float_0
OpSelectionMerge %169 None
OpBranchConditional %168 %170 %169
%170 = OpLabel
OpReturn
%169 = OpLabel
OpStore %param %int_1
%171 = OpFunctionCall %void %func0_i1_ %param
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,146 @@
void set_float2(inout float2 vec, int idx, float val) {
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
}
static float4x2 m = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_10 : register(b2, space0) {
uint4 x_10[1];
};
cbuffer cbuffer_x_12 : register(b0, space0) {
uint4 x_12[1];
};
static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_16 : register(b1, space0) {
uint4 x_16[4];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void func0_i1_(inout int x) {
int i = 0;
bool x_137 = false;
bool x_138 = false;
bool x_138_phi = false;
bool x_139_phi = false;
const int x_124 = x;
const bool x_125 = (x_124 < 1);
x_139_phi = x_125;
if (!(x_125)) {
const int x_129 = x;
const bool x_130 = (x_129 > 1);
x_138_phi = x_130;
if (x_130) {
const float x_134 = asfloat(x_10[0].x);
const uint scalar_offset = ((16u * uint(0))) / 4;
const float x_136 = asfloat(x_12[scalar_offset / 4][scalar_offset % 4]);
x_137 = (x_134 > x_136);
x_138_phi = x_137;
}
x_138 = x_138_phi;
x_139_phi = x_138;
}
if (x_139_phi) {
return;
}
const float x_143 = asfloat(x_10[0].x);
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
const float x_145 = asfloat(x_12[scalar_offset_1 / 4][scalar_offset_1 % 4]);
if ((x_143 == x_145)) {
i = 0;
while (true) {
if ((i < 2)) {
} else {
break;
}
{
const int x_154 = x;
const int x_155 = clamp(x_154, 0, 3);
const int x_156 = i;
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
const float x_158 = asfloat(x_12[scalar_offset_2 / 4][scalar_offset_2 % 4]);
const float x_160 = m[x_155][x_156];
set_float2(m[x_155], x_156, (x_160 + x_158));
i = (i + 1);
}
}
}
return;
}
void func1_() {
int param = 0;
const float x_167 = gl_FragCoord.y;
if ((x_167 < 0.0f)) {
return;
}
param = 1;
func0_i1_(param);
return;
}
void main_1() {
m = float4x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f));
func1_();
func1_();
const float4x2 x_54 = m;
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
const int x_56 = asint(x_16[scalar_offset_3 / 4][scalar_offset_3 % 4]);
const uint scalar_offset_4 = ((16u * uint(0))) / 4;
const int x_59 = asint(x_16[scalar_offset_4 / 4][scalar_offset_4 % 4]);
const int x_62 = asint(x_16[1].x);
const int x_65 = asint(x_16[1].x);
const uint scalar_offset_5 = ((16u * uint(0))) / 4;
const int x_68 = asint(x_16[scalar_offset_5 / 4][scalar_offset_5 % 4]);
const uint scalar_offset_6 = ((16u * uint(0))) / 4;
const int x_71 = asint(x_16[scalar_offset_6 / 4][scalar_offset_6 % 4]);
const uint scalar_offset_7 = ((16u * uint(0))) / 4;
const int x_74 = asint(x_16[scalar_offset_7 / 4][scalar_offset_7 % 4]);
const uint scalar_offset_8 = ((16u * uint(0))) / 4;
const int x_77 = asint(x_16[scalar_offset_8 / 4][scalar_offset_8 % 4]);
const float4x2 x_83 = float4x2(float2(float(x_56), float(x_59)), float2(float(x_62), float(x_65)), float2(float(x_68), float(x_71)), float2(float(x_74), float(x_77)));
bool tint_tmp_2 = all((x_54[0u] == x_83[0u]));
if (tint_tmp_2) {
tint_tmp_2 = all((x_54[1u] == x_83[1u]));
}
bool tint_tmp_1 = (tint_tmp_2);
if (tint_tmp_1) {
tint_tmp_1 = all((x_54[2u] == x_83[2u]));
}
bool tint_tmp = (tint_tmp_1);
if (tint_tmp) {
tint_tmp = all((x_54[3u] == x_83[3u]));
}
if ((tint_tmp)) {
const int x_107 = asint(x_16[3].x);
const uint scalar_offset_9 = ((16u * uint(0))) / 4;
const int x_110 = asint(x_16[scalar_offset_9 / 4][scalar_offset_9 % 4]);
const uint scalar_offset_10 = ((16u * uint(0))) / 4;
const int x_113 = asint(x_16[scalar_offset_10 / 4][scalar_offset_10 % 4]);
const int x_116 = asint(x_16[3].x);
x_GLF_color = float4(float(x_107), float(x_110), float(x_113), float(x_116));
} else {
const uint scalar_offset_11 = ((16u * uint(0))) / 4;
const int x_120 = asint(x_16[scalar_offset_11 / 4][scalar_offset_11 % 4]);
const float x_121 = float(x_120);
x_GLF_color = float4(x_121, x_121, x_121, x_121);
}
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_7 = {tint_symbol_3.x_GLF_color_1};
return tint_symbol_7;
}

View File

@@ -0,0 +1,134 @@
#include <metal_stdlib>
using namespace metal;
struct buf2 {
/* 0x0000 */ float one;
};
struct tint_padded_array_element {
/* 0x0000 */ float el;
/* 0x0004 */ int8_t tint_pad[12];
};
struct tint_array_wrapper {
/* 0x0000 */ tint_padded_array_element arr[1];
};
struct buf0 {
/* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values;
};
struct tint_padded_array_element_1 {
/* 0x0000 */ int el;
/* 0x0004 */ int8_t tint_pad_1[12];
};
struct tint_array_wrapper_1 {
/* 0x0000 */ tint_padded_array_element_1 arr[4];
};
struct buf1 {
/* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values;
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_2 {
float4 x_GLF_color_1 [[color(0)]];
};
void func0_i1_(constant buf2& x_10, constant buf0& x_12, thread int* const x, thread float4x2* const tint_symbol_5) {
int i = 0;
bool x_137 = false;
bool x_138 = false;
bool x_138_phi = false;
bool x_139_phi = false;
int const x_124 = *(x);
bool const x_125 = (x_124 < 1);
x_139_phi = x_125;
if (!(x_125)) {
int const x_129 = *(x);
bool const x_130 = (x_129 > 1);
x_138_phi = x_130;
if (x_130) {
float const x_134 = x_10.one;
float const x_136 = x_12.x_GLF_uniform_float_values.arr[0].el;
x_137 = (x_134 > x_136);
x_138_phi = x_137;
}
x_138 = x_138_phi;
x_139_phi = x_138;
}
bool const x_139 = x_139_phi;
if (x_139) {
return;
}
float const x_143 = x_10.one;
float const x_145 = x_12.x_GLF_uniform_float_values.arr[0].el;
if ((x_143 == x_145)) {
i = 0;
while (true) {
int const x_150 = i;
if ((x_150 < 2)) {
} else {
break;
}
{
int const x_154 = *(x);
int const x_155 = clamp(x_154, 0, 3);
int const x_156 = i;
float const x_158 = x_12.x_GLF_uniform_float_values.arr[0].el;
float const x_160 = (*(tint_symbol_5))[x_155][x_156];
(*(tint_symbol_5))[x_155][x_156] = (x_160 + x_158);
int const x_163 = i;
i = (x_163 + 1);
}
}
}
return;
}
void func1_(constant buf2& x_10, constant buf0& x_12, thread float4* const tint_symbol_6, thread float4x2* const tint_symbol_7) {
int param = 0;
float const x_167 = (*(tint_symbol_6)).y;
if ((x_167 < 0.0f)) {
return;
}
param = 1;
func0_i1_(x_10, x_12, &(param), tint_symbol_7);
return;
}
void main_1(constant buf2& x_10, constant buf0& x_12, constant buf1& x_16, thread float4x2* const tint_symbol_8, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) {
*(tint_symbol_8) = float4x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f));
func1_(x_10, x_12, tint_symbol_9, tint_symbol_8);
func1_(x_10, x_12, tint_symbol_9, tint_symbol_8);
float4x2 const x_54 = *(tint_symbol_8);
int const x_56 = x_16.x_GLF_uniform_int_values.arr[0].el;
int const x_59 = x_16.x_GLF_uniform_int_values.arr[0].el;
int const x_62 = x_16.x_GLF_uniform_int_values.arr[1].el;
int const x_65 = x_16.x_GLF_uniform_int_values.arr[1].el;
int const x_68 = x_16.x_GLF_uniform_int_values.arr[0].el;
int const x_71 = x_16.x_GLF_uniform_int_values.arr[0].el;
int const x_74 = x_16.x_GLF_uniform_int_values.arr[0].el;
int const x_77 = x_16.x_GLF_uniform_int_values.arr[0].el;
float4x2 const x_83 = float4x2(float2(float(x_56), float(x_59)), float2(float(x_62), float(x_65)), float2(float(x_68), float(x_71)), float2(float(x_74), float(x_77)));
if ((((all((x_54[0u] == x_83[0u])) && all((x_54[1u] == x_83[1u]))) && all((x_54[2u] == x_83[2u]))) && all((x_54[3u] == x_83[3u])))) {
int const x_107 = x_16.x_GLF_uniform_int_values.arr[3].el;
int const x_110 = x_16.x_GLF_uniform_int_values.arr[0].el;
int const x_113 = x_16.x_GLF_uniform_int_values.arr[0].el;
int const x_116 = x_16.x_GLF_uniform_int_values.arr[3].el;
*(tint_symbol_10) = float4(float(x_107), float(x_110), float(x_113), float(x_116));
} else {
int const x_120 = x_16.x_GLF_uniform_int_values.arr[0].el;
float const x_121 = float(x_120);
*(tint_symbol_10) = float4(x_121, x_121, x_121, x_121);
}
return;
}
fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf2& x_10 [[buffer(2)]], constant buf0& x_12 [[buffer(0)]], constant buf1& x_16 [[buffer(1)]]) {
thread float4 tint_symbol_11 = 0.0f;
thread float4x2 tint_symbol_12 = float4x2(0.0f);
thread float4 tint_symbol_13 = 0.0f;
tint_symbol_11 = gl_FragCoord_param;
main_1(x_10, x_12, x_16, &(tint_symbol_12), &(tint_symbol_11), &(tint_symbol_13));
main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_13};
tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
return tint_symbol_4;
}

View File

@@ -0,0 +1,329 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 214
; Schema: 0
OpCapability Shader
%92 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2
OpExecutionMode %main OriginUpperLeft
OpName %m "m"
OpName %buf2 "buf2"
OpMemberName %buf2 0 "one"
OpName %x_10 "x_10"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "x_GLF_uniform_float_values"
OpName %x_12 "x_12"
OpName %gl_FragCoord "gl_FragCoord"
OpName %buf1 "buf1"
OpMemberName %buf1 0 "x_GLF_uniform_int_values"
OpName %x_16 "x_16"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol "tint_symbol"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %func0_i1_ "func0_i1_"
OpName %x "x"
OpName %i "i"
OpName %x_137 "x_137"
OpName %x_138 "x_138"
OpName %x_138_phi "x_138_phi"
OpName %x_139_phi "x_139_phi"
OpName %func1_ "func1_"
OpName %param "param"
OpName %main_1 "main_1"
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 %buf2 Block
OpMemberDecorate %buf2 0 Offset 0
OpDecorate %x_10 NonWritable
OpDecorate %x_10 DescriptorSet 0
OpDecorate %x_10 Binding 2
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %_arr_float_uint_1 ArrayStride 16
OpDecorate %x_12 NonWritable
OpDecorate %x_12 DescriptorSet 0
OpDecorate %x_12 Binding 0
OpDecorate %buf1 Block
OpMemberDecorate %buf1 0 Offset 0
OpDecorate %_arr_int_uint_4 ArrayStride 16
OpDecorate %x_16 NonWritable
OpDecorate %x_16 DescriptorSet 0
OpDecorate %x_16 Binding 1
OpDecorate %tint_symbol BuiltIn FragCoord
OpDecorate %tint_symbol_2 Location 0
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat4v2float = OpTypeMatrix %v2float 4
%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float
%6 = OpConstantNull %mat4v2float
%m = OpVariable %_ptr_Private_mat4v2float Private %6
%buf2 = OpTypeStruct %float
%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2
%x_10 = OpVariable %_ptr_Uniform_buf2 Uniform
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_arr_float_uint_1 = OpTypeArray %float %uint_1
%buf0 = OpTypeStruct %_arr_float_uint_1
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_12 = OpVariable %_ptr_Uniform_buf0 Uniform
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%19 = OpConstantNull %v4float
%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %19
%int = OpTypeInt 32 1
%uint_4 = OpConstant %uint 4
%_arr_int_uint_4 = OpTypeArray %int %uint_4
%buf1 = OpTypeStruct %_arr_int_uint_4
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
%x_16 = OpVariable %_ptr_Uniform_buf1 Uniform
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %19
%_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 %19
%void = OpTypeVoid
%_ptr_Function_int = OpTypePointer Function %int
%31 = OpTypeFunction %void %_ptr_Function_int
%38 = OpConstantNull %int
%bool = OpTypeBool
%_ptr_Function_bool = OpTypePointer Function %bool
%42 = OpConstantNull %bool
%int_1 = OpConstant %int 1
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_float = OpTypePointer Uniform %float
%int_0 = OpConstant %int 0
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%_ptr_Private_float = OpTypePointer Private %float
%104 = OpTypeFunction %void
%float_0 = OpConstant %float 0
%118 = OpConstantComposite %v2float %float_0 %float_0
%119 = OpConstantComposite %mat4v2float %118 %118 %118 %118
%_ptr_Uniform_int = OpTypePointer Uniform %int
%v2bool = OpTypeVector %bool 2
%uint_2 = OpConstant %uint 2
%uint_3 = OpConstant %uint 3
%main_out = OpTypeStruct %v4float
%201 = OpTypeFunction %void %main_out
%func0_i1_ = OpFunction %void None %31
%x = OpFunctionParameter %_ptr_Function_int
%36 = OpLabel
%i = OpVariable %_ptr_Function_int Function %38
%x_137 = OpVariable %_ptr_Function_bool Function %42
%x_138 = OpVariable %_ptr_Function_bool Function %42
%x_138_phi = OpVariable %_ptr_Function_bool Function %42
%x_139_phi = OpVariable %_ptr_Function_bool Function %42
%47 = OpLoad %int %x
%49 = OpSLessThan %bool %47 %int_1
OpStore %x_139_phi %49
%50 = OpLogicalNot %bool %49
OpSelectionMerge %51 None
OpBranchConditional %50 %52 %51
%52 = OpLabel
%54 = OpLoad %int %x
%55 = OpSGreaterThan %bool %54 %int_1
OpStore %x_138_phi %55
OpSelectionMerge %56 None
OpBranchConditional %55 %57 %56
%57 = OpLabel
%60 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0
%61 = OpLoad %float %60
%63 = OpAccessChain %_ptr_Uniform_float %x_12 %uint_0 %int_0
%64 = OpLoad %float %63
%65 = OpFOrdGreaterThan %bool %61 %64
OpStore %x_137 %65
%66 = OpLoad %bool %x_137
OpStore %x_138_phi %66
OpBranch %56
%56 = OpLabel
%67 = OpLoad %bool %x_138_phi
OpStore %x_138 %67
%68 = OpLoad %bool %x_138
OpStore %x_139_phi %68
OpBranch %51
%51 = OpLabel
%69 = OpLoad %bool %x_139_phi
OpSelectionMerge %70 None
OpBranchConditional %69 %71 %70
%71 = OpLabel
OpReturn
%70 = OpLabel
%72 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0
%73 = OpLoad %float %72
%74 = OpAccessChain %_ptr_Uniform_float %x_12 %uint_0 %int_0
%75 = OpLoad %float %74
%76 = OpFOrdEqual %bool %73 %75
OpSelectionMerge %77 None
OpBranchConditional %76 %78 %77
%78 = OpLabel
OpStore %i %int_0
OpBranch %79
%79 = OpLabel
OpLoopMerge %80 %81 None
OpBranch %82
%82 = OpLabel
%83 = OpLoad %int %i
%85 = OpSLessThan %bool %83 %int_2
OpSelectionMerge %86 None
OpBranchConditional %85 %87 %88
%87 = OpLabel
OpBranch %86
%88 = OpLabel
OpBranch %80
%86 = OpLabel
OpBranch %81
%81 = OpLabel
%90 = OpLoad %int %x
%91 = OpExtInst %int %92 SClamp %90 %int_0 %int_3
%94 = OpLoad %int %i
%95 = OpAccessChain %_ptr_Uniform_float %x_12 %uint_0 %int_0
%96 = OpLoad %float %95
%98 = OpAccessChain %_ptr_Private_float %m %91 %94
%99 = OpLoad %float %98
%100 = OpAccessChain %_ptr_Private_float %m %91 %94
%101 = OpFAdd %float %99 %96
OpStore %100 %101
%102 = OpLoad %int %i
%103 = OpIAdd %int %102 %int_1
OpStore %i %103
OpBranch %79
%80 = OpLabel
OpBranch %77
%77 = OpLabel
OpReturn
OpFunctionEnd
%func1_ = OpFunction %void None %104
%106 = OpLabel
%param = OpVariable %_ptr_Function_int Function %38
%108 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%109 = OpLoad %float %108
%111 = OpFOrdLessThan %bool %109 %float_0
OpSelectionMerge %112 None
OpBranchConditional %111 %113 %112
%113 = OpLabel
OpReturn
%112 = OpLabel
OpStore %param %int_1
%114 = OpFunctionCall %void %func0_i1_ %param
OpReturn
OpFunctionEnd
%main_1 = OpFunction %void None %104
%117 = OpLabel
OpStore %m %119
%120 = OpFunctionCall %void %func1_
%121 = OpFunctionCall %void %func1_
%122 = OpLoad %mat4v2float %m
%124 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0
%125 = OpLoad %int %124
%126 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0
%127 = OpLoad %int %126
%128 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_1
%129 = OpLoad %int %128
%130 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_1
%131 = OpLoad %int %130
%132 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0
%133 = OpLoad %int %132
%134 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0
%135 = OpLoad %int %134
%136 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0
%137 = OpLoad %int %136
%138 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0
%139 = OpLoad %int %138
%140 = OpConvertSToF %float %125
%141 = OpConvertSToF %float %127
%142 = OpCompositeConstruct %v2float %140 %141
%143 = OpConvertSToF %float %129
%144 = OpConvertSToF %float %131
%145 = OpCompositeConstruct %v2float %143 %144
%146 = OpConvertSToF %float %133
%147 = OpConvertSToF %float %135
%148 = OpCompositeConstruct %v2float %146 %147
%149 = OpConvertSToF %float %137
%150 = OpConvertSToF %float %139
%151 = OpCompositeConstruct %v2float %149 %150
%152 = OpCompositeConstruct %mat4v2float %142 %145 %148 %151
%154 = OpCompositeExtract %v2float %122 0
%155 = OpCompositeExtract %v2float %152 0
%156 = OpFOrdEqual %v2bool %154 %155
%153 = OpAll %bool %156
OpSelectionMerge %158 None
OpBranchConditional %153 %159 %158
%159 = OpLabel
%161 = OpCompositeExtract %v2float %122 1
%162 = OpCompositeExtract %v2float %152 1
%163 = OpFOrdEqual %v2bool %161 %162
%160 = OpAll %bool %163
OpBranch %158
%158 = OpLabel
%164 = OpPhi %bool %153 %117 %160 %159
OpSelectionMerge %165 None
OpBranchConditional %164 %166 %165
%166 = OpLabel
%169 = OpCompositeExtract %v2float %122 2
%170 = OpCompositeExtract %v2float %152 2
%171 = OpFOrdEqual %v2bool %169 %170
%167 = OpAll %bool %171
OpBranch %165
%165 = OpLabel
%172 = OpPhi %bool %164 %158 %167 %166
OpSelectionMerge %173 None
OpBranchConditional %172 %174 %173
%174 = OpLabel
%177 = OpCompositeExtract %v2float %122 3
%178 = OpCompositeExtract %v2float %152 3
%179 = OpFOrdEqual %v2bool %177 %178
%175 = OpAll %bool %179
OpBranch %173
%173 = OpLabel
%180 = OpPhi %bool %172 %165 %175 %174
OpSelectionMerge %181 None
OpBranchConditional %180 %182 %183
%182 = OpLabel
%184 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_3
%185 = OpLoad %int %184
%186 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0
%187 = OpLoad %int %186
%188 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0
%189 = OpLoad %int %188
%190 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_3
%191 = OpLoad %int %190
%192 = OpConvertSToF %float %185
%193 = OpConvertSToF %float %187
%194 = OpConvertSToF %float %189
%195 = OpConvertSToF %float %191
%196 = OpCompositeConstruct %v4float %192 %193 %194 %195
OpStore %x_GLF_color %196
OpBranch %181
%183 = OpLabel
%197 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0
%198 = OpLoad %int %197
%199 = OpConvertSToF %float %198
%200 = OpCompositeConstruct %v4float %199 %199 %199 %199
OpStore %x_GLF_color %200
OpBranch %181
%181 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_3 = OpFunction %void None %201
%tint_symbol_1 = OpFunctionParameter %main_out
%205 = OpLabel
%206 = OpCompositeExtract %v4float %tint_symbol_1 0
OpStore %tint_symbol_2 %206
OpReturn
OpFunctionEnd
%main = OpFunction %void None %104
%208 = OpLabel
%209 = OpLoad %v4float %tint_symbol
OpStore %gl_FragCoord %209
%210 = OpFunctionCall %void %main_1
%212 = OpLoad %v4float %x_GLF_color
%213 = OpCompositeConstruct %main_out %212
%211 = OpFunctionCall %void %tint_symbol_3 %213
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,133 @@
[[block]]
struct buf2 {
one : f32;
};
type Arr = [[stride(16)]] array<f32, 1>;
[[block]]
struct buf0 {
x_GLF_uniform_float_values : Arr;
};
type Arr_1 = [[stride(16)]] array<i32, 4>;
[[block]]
struct buf1 {
x_GLF_uniform_int_values : Arr_1;
};
var<private> m : mat4x2<f32>;
[[group(0), binding(2)]] var<uniform> x_10 : buf2;
[[group(0), binding(0)]] var<uniform> x_12 : buf0;
var<private> gl_FragCoord : vec4<f32>;
[[group(0), binding(1)]] var<uniform> x_16 : buf1;
var<private> x_GLF_color : vec4<f32>;
fn func0_i1_(x : ptr<function, i32>) {
var i : i32;
var x_137 : bool;
var x_138 : bool;
var x_138_phi : bool;
var x_139_phi : bool;
let x_124 : i32 = *(x);
let x_125 : bool = (x_124 < 1);
x_139_phi = x_125;
if (!(x_125)) {
let x_129 : i32 = *(x);
let x_130 : bool = (x_129 > 1);
x_138_phi = x_130;
if (x_130) {
let x_134 : f32 = x_10.one;
let x_136 : f32 = x_12.x_GLF_uniform_float_values[0];
x_137 = (x_134 > x_136);
x_138_phi = x_137;
}
x_138 = x_138_phi;
x_139_phi = x_138;
}
let x_139 : bool = x_139_phi;
if (x_139) {
return;
}
let x_143 : f32 = x_10.one;
let x_145 : f32 = x_12.x_GLF_uniform_float_values[0];
if ((x_143 == x_145)) {
i = 0;
loop {
let x_150 : i32 = i;
if ((x_150 < 2)) {
} else {
break;
}
continuing {
let x_154 : i32 = *(x);
let x_155 : i32 = clamp(x_154, 0, 3);
let x_156 : i32 = i;
let x_158 : f32 = x_12.x_GLF_uniform_float_values[0];
let x_160 : f32 = m[x_155][x_156];
m[x_155][x_156] = (x_160 + x_158);
let x_163 : i32 = i;
i = (x_163 + 1);
}
}
}
return;
}
fn func1_() {
var param : i32;
let x_167 : f32 = gl_FragCoord.y;
if ((x_167 < 0.0)) {
return;
}
param = 1;
func0_i1_(&(param));
return;
}
fn main_1() {
m = mat4x2<f32>(vec2<f32>(0.0, 0.0), vec2<f32>(0.0, 0.0), vec2<f32>(0.0, 0.0), vec2<f32>(0.0, 0.0));
func1_();
func1_();
let x_54 : mat4x2<f32> = m;
let x_56 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_59 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_62 : i32 = x_16.x_GLF_uniform_int_values[1];
let x_65 : i32 = x_16.x_GLF_uniform_int_values[1];
let x_68 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_71 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_74 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_77 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_83 : mat4x2<f32> = mat4x2<f32>(vec2<f32>(f32(x_56), f32(x_59)), vec2<f32>(f32(x_62), f32(x_65)), vec2<f32>(f32(x_68), f32(x_71)), vec2<f32>(f32(x_74), f32(x_77)));
if ((((all((x_54[0u] == x_83[0u])) && all((x_54[1u] == x_83[1u]))) && all((x_54[2u] == x_83[2u]))) && all((x_54[3u] == x_83[3u])))) {
let x_107 : i32 = x_16.x_GLF_uniform_int_values[3];
let x_110 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_113 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_116 : i32 = x_16.x_GLF_uniform_int_values[3];
x_GLF_color = vec4<f32>(f32(x_107), f32(x_110), f32(x_113), f32(x_116));
} else {
let x_120 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_121 : f32 = f32(x_120);
x_GLF_color = vec4<f32>(x_121, x_121, x_121, x_121);
}
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

@@ -0,0 +1,133 @@
[[block]]
struct buf2 {
one : f32;
};
type Arr = [[stride(16)]] array<f32, 1>;
[[block]]
struct buf0 {
x_GLF_uniform_float_values : Arr;
};
type Arr_1 = [[stride(16)]] array<i32, 4>;
[[block]]
struct buf1 {
x_GLF_uniform_int_values : Arr_1;
};
var<private> m : mat4x2<f32>;
[[group(0), binding(2)]] var<uniform> x_10 : buf2;
[[group(0), binding(0)]] var<uniform> x_12 : buf0;
var<private> gl_FragCoord : vec4<f32>;
[[group(0), binding(1)]] var<uniform> x_16 : buf1;
var<private> x_GLF_color : vec4<f32>;
fn func0_i1_(x : ptr<function, i32>) {
var i : i32;
var x_137 : bool;
var x_138 : bool;
var x_138_phi : bool;
var x_139_phi : bool;
let x_124 : i32 = *(x);
let x_125 : bool = (x_124 < 1);
x_139_phi = x_125;
if (!(x_125)) {
let x_129 : i32 = *(x);
let x_130 : bool = (x_129 > 1);
x_138_phi = x_130;
if (x_130) {
let x_134 : f32 = x_10.one;
let x_136 : f32 = x_12.x_GLF_uniform_float_values[0];
x_137 = (x_134 > x_136);
x_138_phi = x_137;
}
x_138 = x_138_phi;
x_139_phi = x_138;
}
let x_139 : bool = x_139_phi;
if (x_139) {
return;
}
let x_143 : f32 = x_10.one;
let x_145 : f32 = x_12.x_GLF_uniform_float_values[0];
if ((x_143 == x_145)) {
i = 0;
loop {
let x_150 : i32 = i;
if ((x_150 < 2)) {
} else {
break;
}
continuing {
let x_154 : i32 = *(x);
let x_155 : i32 = clamp(x_154, 0, 3);
let x_156 : i32 = i;
let x_158 : f32 = x_12.x_GLF_uniform_float_values[0];
let x_160 : f32 = m[x_155][x_156];
m[x_155][x_156] = (x_160 + x_158);
let x_163 : i32 = i;
i = (x_163 + 1);
}
}
}
return;
}
fn func1_() {
var param : i32;
let x_167 : f32 = gl_FragCoord.y;
if ((x_167 < 0.0)) {
return;
}
param = 1;
func0_i1_(&(param));
return;
}
fn main_1() {
m = mat4x2<f32>(vec2<f32>(0.0, 0.0), vec2<f32>(0.0, 0.0), vec2<f32>(0.0, 0.0), vec2<f32>(0.0, 0.0));
func1_();
func1_();
let x_54 : mat4x2<f32> = m;
let x_56 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_59 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_62 : i32 = x_16.x_GLF_uniform_int_values[1];
let x_65 : i32 = x_16.x_GLF_uniform_int_values[1];
let x_68 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_71 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_74 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_77 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_83 : mat4x2<f32> = mat4x2<f32>(vec2<f32>(f32(x_56), f32(x_59)), vec2<f32>(f32(x_62), f32(x_65)), vec2<f32>(f32(x_68), f32(x_71)), vec2<f32>(f32(x_74), f32(x_77)));
if ((((all((x_54[0u] == x_83[0u])) && all((x_54[1u] == x_83[1u]))) && all((x_54[2u] == x_83[2u]))) && all((x_54[3u] == x_83[3u])))) {
let x_107 : i32 = x_16.x_GLF_uniform_int_values[3];
let x_110 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_113 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_116 : i32 = x_16.x_GLF_uniform_int_values[3];
x_GLF_color = vec4<f32>(f32(x_107), f32(x_110), f32(x_113), f32(x_116));
} else {
let x_120 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_121 : f32 = f32(x_120);
x_GLF_color = vec4<f32>(x_121, x_121, x_121, x_121);
}
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

@@ -0,0 +1,146 @@
void set_float2(inout float2 vec, int idx, float val) {
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
}
static float4x2 m = float4x2(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_10 : register(b2, space0) {
uint4 x_10[1];
};
cbuffer cbuffer_x_12 : register(b0, space0) {
uint4 x_12[1];
};
static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_16 : register(b1, space0) {
uint4 x_16[4];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void func0_i1_(inout int x) {
int i = 0;
bool x_137 = false;
bool x_138 = false;
bool x_138_phi = false;
bool x_139_phi = false;
const int x_124 = x;
const bool x_125 = (x_124 < 1);
x_139_phi = x_125;
if (!(x_125)) {
const int x_129 = x;
const bool x_130 = (x_129 > 1);
x_138_phi = x_130;
if (x_130) {
const float x_134 = asfloat(x_10[0].x);
const uint scalar_offset = ((16u * uint(0))) / 4;
const float x_136 = asfloat(x_12[scalar_offset / 4][scalar_offset % 4]);
x_137 = (x_134 > x_136);
x_138_phi = x_137;
}
x_138 = x_138_phi;
x_139_phi = x_138;
}
if (x_139_phi) {
return;
}
const float x_143 = asfloat(x_10[0].x);
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
const float x_145 = asfloat(x_12[scalar_offset_1 / 4][scalar_offset_1 % 4]);
if ((x_143 == x_145)) {
i = 0;
while (true) {
if ((i < 2)) {
} else {
break;
}
{
const int x_154 = x;
const int x_155 = clamp(x_154, 0, 3);
const int x_156 = i;
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
const float x_158 = asfloat(x_12[scalar_offset_2 / 4][scalar_offset_2 % 4]);
const float x_160 = m[x_155][x_156];
set_float2(m[x_155], x_156, (x_160 + x_158));
i = (i + 1);
}
}
}
return;
}
void func1_() {
int param = 0;
const float x_167 = gl_FragCoord.y;
if ((x_167 < 0.0f)) {
return;
}
param = 1;
func0_i1_(param);
return;
}
void main_1() {
m = float4x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f));
func1_();
func1_();
const float4x2 x_54 = m;
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
const int x_56 = asint(x_16[scalar_offset_3 / 4][scalar_offset_3 % 4]);
const uint scalar_offset_4 = ((16u * uint(0))) / 4;
const int x_59 = asint(x_16[scalar_offset_4 / 4][scalar_offset_4 % 4]);
const int x_62 = asint(x_16[1].x);
const int x_65 = asint(x_16[1].x);
const uint scalar_offset_5 = ((16u * uint(0))) / 4;
const int x_68 = asint(x_16[scalar_offset_5 / 4][scalar_offset_5 % 4]);
const uint scalar_offset_6 = ((16u * uint(0))) / 4;
const int x_71 = asint(x_16[scalar_offset_6 / 4][scalar_offset_6 % 4]);
const uint scalar_offset_7 = ((16u * uint(0))) / 4;
const int x_74 = asint(x_16[scalar_offset_7 / 4][scalar_offset_7 % 4]);
const uint scalar_offset_8 = ((16u * uint(0))) / 4;
const int x_77 = asint(x_16[scalar_offset_8 / 4][scalar_offset_8 % 4]);
const float4x2 x_83 = float4x2(float2(float(x_56), float(x_59)), float2(float(x_62), float(x_65)), float2(float(x_68), float(x_71)), float2(float(x_74), float(x_77)));
bool tint_tmp_2 = all((x_54[0u] == x_83[0u]));
if (tint_tmp_2) {
tint_tmp_2 = all((x_54[1u] == x_83[1u]));
}
bool tint_tmp_1 = (tint_tmp_2);
if (tint_tmp_1) {
tint_tmp_1 = all((x_54[2u] == x_83[2u]));
}
bool tint_tmp = (tint_tmp_1);
if (tint_tmp) {
tint_tmp = all((x_54[3u] == x_83[3u]));
}
if ((tint_tmp)) {
const int x_107 = asint(x_16[3].x);
const uint scalar_offset_9 = ((16u * uint(0))) / 4;
const int x_110 = asint(x_16[scalar_offset_9 / 4][scalar_offset_9 % 4]);
const uint scalar_offset_10 = ((16u * uint(0))) / 4;
const int x_113 = asint(x_16[scalar_offset_10 / 4][scalar_offset_10 % 4]);
const int x_116 = asint(x_16[3].x);
x_GLF_color = float4(float(x_107), float(x_110), float(x_113), float(x_116));
} else {
const uint scalar_offset_11 = ((16u * uint(0))) / 4;
const int x_120 = asint(x_16[scalar_offset_11 / 4][scalar_offset_11 % 4]);
const float x_121 = float(x_120);
x_GLF_color = float4(x_121, x_121, x_121, x_121);
}
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_7 = {tint_symbol_3.x_GLF_color_1};
return tint_symbol_7;
}

View File

@@ -0,0 +1,134 @@
#include <metal_stdlib>
using namespace metal;
struct buf2 {
/* 0x0000 */ float one;
};
struct tint_padded_array_element {
/* 0x0000 */ float el;
/* 0x0004 */ int8_t tint_pad[12];
};
struct tint_array_wrapper {
/* 0x0000 */ tint_padded_array_element arr[1];
};
struct buf0 {
/* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values;
};
struct tint_padded_array_element_1 {
/* 0x0000 */ int el;
/* 0x0004 */ int8_t tint_pad_1[12];
};
struct tint_array_wrapper_1 {
/* 0x0000 */ tint_padded_array_element_1 arr[4];
};
struct buf1 {
/* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values;
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_2 {
float4 x_GLF_color_1 [[color(0)]];
};
void func0_i1_(constant buf2& x_10, constant buf0& x_12, thread int* const x, thread float4x2* const tint_symbol_5) {
int i = 0;
bool x_137 = false;
bool x_138 = false;
bool x_138_phi = false;
bool x_139_phi = false;
int const x_124 = *(x);
bool const x_125 = (x_124 < 1);
x_139_phi = x_125;
if (!(x_125)) {
int const x_129 = *(x);
bool const x_130 = (x_129 > 1);
x_138_phi = x_130;
if (x_130) {
float const x_134 = x_10.one;
float const x_136 = x_12.x_GLF_uniform_float_values.arr[0].el;
x_137 = (x_134 > x_136);
x_138_phi = x_137;
}
x_138 = x_138_phi;
x_139_phi = x_138;
}
bool const x_139 = x_139_phi;
if (x_139) {
return;
}
float const x_143 = x_10.one;
float const x_145 = x_12.x_GLF_uniform_float_values.arr[0].el;
if ((x_143 == x_145)) {
i = 0;
while (true) {
int const x_150 = i;
if ((x_150 < 2)) {
} else {
break;
}
{
int const x_154 = *(x);
int const x_155 = clamp(x_154, 0, 3);
int const x_156 = i;
float const x_158 = x_12.x_GLF_uniform_float_values.arr[0].el;
float const x_160 = (*(tint_symbol_5))[x_155][x_156];
(*(tint_symbol_5))[x_155][x_156] = (x_160 + x_158);
int const x_163 = i;
i = (x_163 + 1);
}
}
}
return;
}
void func1_(constant buf2& x_10, constant buf0& x_12, thread float4* const tint_symbol_6, thread float4x2* const tint_symbol_7) {
int param = 0;
float const x_167 = (*(tint_symbol_6)).y;
if ((x_167 < 0.0f)) {
return;
}
param = 1;
func0_i1_(x_10, x_12, &(param), tint_symbol_7);
return;
}
void main_1(constant buf2& x_10, constant buf0& x_12, constant buf1& x_16, thread float4x2* const tint_symbol_8, thread float4* const tint_symbol_9, thread float4* const tint_symbol_10) {
*(tint_symbol_8) = float4x2(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f));
func1_(x_10, x_12, tint_symbol_9, tint_symbol_8);
func1_(x_10, x_12, tint_symbol_9, tint_symbol_8);
float4x2 const x_54 = *(tint_symbol_8);
int const x_56 = x_16.x_GLF_uniform_int_values.arr[0].el;
int const x_59 = x_16.x_GLF_uniform_int_values.arr[0].el;
int const x_62 = x_16.x_GLF_uniform_int_values.arr[1].el;
int const x_65 = x_16.x_GLF_uniform_int_values.arr[1].el;
int const x_68 = x_16.x_GLF_uniform_int_values.arr[0].el;
int const x_71 = x_16.x_GLF_uniform_int_values.arr[0].el;
int const x_74 = x_16.x_GLF_uniform_int_values.arr[0].el;
int const x_77 = x_16.x_GLF_uniform_int_values.arr[0].el;
float4x2 const x_83 = float4x2(float2(float(x_56), float(x_59)), float2(float(x_62), float(x_65)), float2(float(x_68), float(x_71)), float2(float(x_74), float(x_77)));
if ((((all((x_54[0u] == x_83[0u])) && all((x_54[1u] == x_83[1u]))) && all((x_54[2u] == x_83[2u]))) && all((x_54[3u] == x_83[3u])))) {
int const x_107 = x_16.x_GLF_uniform_int_values.arr[3].el;
int const x_110 = x_16.x_GLF_uniform_int_values.arr[0].el;
int const x_113 = x_16.x_GLF_uniform_int_values.arr[0].el;
int const x_116 = x_16.x_GLF_uniform_int_values.arr[3].el;
*(tint_symbol_10) = float4(float(x_107), float(x_110), float(x_113), float(x_116));
} else {
int const x_120 = x_16.x_GLF_uniform_int_values.arr[0].el;
float const x_121 = float(x_120);
*(tint_symbol_10) = float4(x_121, x_121, x_121, x_121);
}
return;
}
fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf2& x_10 [[buffer(2)]], constant buf0& x_12 [[buffer(0)]], constant buf1& x_16 [[buffer(1)]]) {
thread float4 tint_symbol_11 = 0.0f;
thread float4x2 tint_symbol_12 = float4x2(0.0f);
thread float4 tint_symbol_13 = 0.0f;
tint_symbol_11 = gl_FragCoord_param;
main_1(x_10, x_12, x_16, &(tint_symbol_12), &(tint_symbol_11), &(tint_symbol_13));
main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_13};
tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
return tint_symbol_4;
}

View File

@@ -0,0 +1,329 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 214
; Schema: 0
OpCapability Shader
%92 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2
OpExecutionMode %main OriginUpperLeft
OpName %m "m"
OpName %buf2 "buf2"
OpMemberName %buf2 0 "one"
OpName %x_10 "x_10"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "x_GLF_uniform_float_values"
OpName %x_12 "x_12"
OpName %gl_FragCoord "gl_FragCoord"
OpName %buf1 "buf1"
OpMemberName %buf1 0 "x_GLF_uniform_int_values"
OpName %x_16 "x_16"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol "tint_symbol"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %func0_i1_ "func0_i1_"
OpName %x "x"
OpName %i "i"
OpName %x_137 "x_137"
OpName %x_138 "x_138"
OpName %x_138_phi "x_138_phi"
OpName %x_139_phi "x_139_phi"
OpName %func1_ "func1_"
OpName %param "param"
OpName %main_1 "main_1"
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 %buf2 Block
OpMemberDecorate %buf2 0 Offset 0
OpDecorate %x_10 NonWritable
OpDecorate %x_10 DescriptorSet 0
OpDecorate %x_10 Binding 2
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %_arr_float_uint_1 ArrayStride 16
OpDecorate %x_12 NonWritable
OpDecorate %x_12 DescriptorSet 0
OpDecorate %x_12 Binding 0
OpDecorate %buf1 Block
OpMemberDecorate %buf1 0 Offset 0
OpDecorate %_arr_int_uint_4 ArrayStride 16
OpDecorate %x_16 NonWritable
OpDecorate %x_16 DescriptorSet 0
OpDecorate %x_16 Binding 1
OpDecorate %tint_symbol BuiltIn FragCoord
OpDecorate %tint_symbol_2 Location 0
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%mat4v2float = OpTypeMatrix %v2float 4
%_ptr_Private_mat4v2float = OpTypePointer Private %mat4v2float
%6 = OpConstantNull %mat4v2float
%m = OpVariable %_ptr_Private_mat4v2float Private %6
%buf2 = OpTypeStruct %float
%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2
%x_10 = OpVariable %_ptr_Uniform_buf2 Uniform
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_arr_float_uint_1 = OpTypeArray %float %uint_1
%buf0 = OpTypeStruct %_arr_float_uint_1
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_12 = OpVariable %_ptr_Uniform_buf0 Uniform
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%19 = OpConstantNull %v4float
%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %19
%int = OpTypeInt 32 1
%uint_4 = OpConstant %uint 4
%_arr_int_uint_4 = OpTypeArray %int %uint_4
%buf1 = OpTypeStruct %_arr_int_uint_4
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
%x_16 = OpVariable %_ptr_Uniform_buf1 Uniform
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %19
%_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 %19
%void = OpTypeVoid
%_ptr_Function_int = OpTypePointer Function %int
%31 = OpTypeFunction %void %_ptr_Function_int
%38 = OpConstantNull %int
%bool = OpTypeBool
%_ptr_Function_bool = OpTypePointer Function %bool
%42 = OpConstantNull %bool
%int_1 = OpConstant %int 1
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_float = OpTypePointer Uniform %float
%int_0 = OpConstant %int 0
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%_ptr_Private_float = OpTypePointer Private %float
%104 = OpTypeFunction %void
%float_0 = OpConstant %float 0
%118 = OpConstantComposite %v2float %float_0 %float_0
%119 = OpConstantComposite %mat4v2float %118 %118 %118 %118
%_ptr_Uniform_int = OpTypePointer Uniform %int
%v2bool = OpTypeVector %bool 2
%uint_2 = OpConstant %uint 2
%uint_3 = OpConstant %uint 3
%main_out = OpTypeStruct %v4float
%201 = OpTypeFunction %void %main_out
%func0_i1_ = OpFunction %void None %31
%x = OpFunctionParameter %_ptr_Function_int
%36 = OpLabel
%i = OpVariable %_ptr_Function_int Function %38
%x_137 = OpVariable %_ptr_Function_bool Function %42
%x_138 = OpVariable %_ptr_Function_bool Function %42
%x_138_phi = OpVariable %_ptr_Function_bool Function %42
%x_139_phi = OpVariable %_ptr_Function_bool Function %42
%47 = OpLoad %int %x
%49 = OpSLessThan %bool %47 %int_1
OpStore %x_139_phi %49
%50 = OpLogicalNot %bool %49
OpSelectionMerge %51 None
OpBranchConditional %50 %52 %51
%52 = OpLabel
%54 = OpLoad %int %x
%55 = OpSGreaterThan %bool %54 %int_1
OpStore %x_138_phi %55
OpSelectionMerge %56 None
OpBranchConditional %55 %57 %56
%57 = OpLabel
%60 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0
%61 = OpLoad %float %60
%63 = OpAccessChain %_ptr_Uniform_float %x_12 %uint_0 %int_0
%64 = OpLoad %float %63
%65 = OpFOrdGreaterThan %bool %61 %64
OpStore %x_137 %65
%66 = OpLoad %bool %x_137
OpStore %x_138_phi %66
OpBranch %56
%56 = OpLabel
%67 = OpLoad %bool %x_138_phi
OpStore %x_138 %67
%68 = OpLoad %bool %x_138
OpStore %x_139_phi %68
OpBranch %51
%51 = OpLabel
%69 = OpLoad %bool %x_139_phi
OpSelectionMerge %70 None
OpBranchConditional %69 %71 %70
%71 = OpLabel
OpReturn
%70 = OpLabel
%72 = OpAccessChain %_ptr_Uniform_float %x_10 %uint_0
%73 = OpLoad %float %72
%74 = OpAccessChain %_ptr_Uniform_float %x_12 %uint_0 %int_0
%75 = OpLoad %float %74
%76 = OpFOrdEqual %bool %73 %75
OpSelectionMerge %77 None
OpBranchConditional %76 %78 %77
%78 = OpLabel
OpStore %i %int_0
OpBranch %79
%79 = OpLabel
OpLoopMerge %80 %81 None
OpBranch %82
%82 = OpLabel
%83 = OpLoad %int %i
%85 = OpSLessThan %bool %83 %int_2
OpSelectionMerge %86 None
OpBranchConditional %85 %87 %88
%87 = OpLabel
OpBranch %86
%88 = OpLabel
OpBranch %80
%86 = OpLabel
OpBranch %81
%81 = OpLabel
%90 = OpLoad %int %x
%91 = OpExtInst %int %92 SClamp %90 %int_0 %int_3
%94 = OpLoad %int %i
%95 = OpAccessChain %_ptr_Uniform_float %x_12 %uint_0 %int_0
%96 = OpLoad %float %95
%98 = OpAccessChain %_ptr_Private_float %m %91 %94
%99 = OpLoad %float %98
%100 = OpAccessChain %_ptr_Private_float %m %91 %94
%101 = OpFAdd %float %99 %96
OpStore %100 %101
%102 = OpLoad %int %i
%103 = OpIAdd %int %102 %int_1
OpStore %i %103
OpBranch %79
%80 = OpLabel
OpBranch %77
%77 = OpLabel
OpReturn
OpFunctionEnd
%func1_ = OpFunction %void None %104
%106 = OpLabel
%param = OpVariable %_ptr_Function_int Function %38
%108 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%109 = OpLoad %float %108
%111 = OpFOrdLessThan %bool %109 %float_0
OpSelectionMerge %112 None
OpBranchConditional %111 %113 %112
%113 = OpLabel
OpReturn
%112 = OpLabel
OpStore %param %int_1
%114 = OpFunctionCall %void %func0_i1_ %param
OpReturn
OpFunctionEnd
%main_1 = OpFunction %void None %104
%117 = OpLabel
OpStore %m %119
%120 = OpFunctionCall %void %func1_
%121 = OpFunctionCall %void %func1_
%122 = OpLoad %mat4v2float %m
%124 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0
%125 = OpLoad %int %124
%126 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0
%127 = OpLoad %int %126
%128 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_1
%129 = OpLoad %int %128
%130 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_1
%131 = OpLoad %int %130
%132 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0
%133 = OpLoad %int %132
%134 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0
%135 = OpLoad %int %134
%136 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0
%137 = OpLoad %int %136
%138 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0
%139 = OpLoad %int %138
%140 = OpConvertSToF %float %125
%141 = OpConvertSToF %float %127
%142 = OpCompositeConstruct %v2float %140 %141
%143 = OpConvertSToF %float %129
%144 = OpConvertSToF %float %131
%145 = OpCompositeConstruct %v2float %143 %144
%146 = OpConvertSToF %float %133
%147 = OpConvertSToF %float %135
%148 = OpCompositeConstruct %v2float %146 %147
%149 = OpConvertSToF %float %137
%150 = OpConvertSToF %float %139
%151 = OpCompositeConstruct %v2float %149 %150
%152 = OpCompositeConstruct %mat4v2float %142 %145 %148 %151
%154 = OpCompositeExtract %v2float %122 0
%155 = OpCompositeExtract %v2float %152 0
%156 = OpFOrdEqual %v2bool %154 %155
%153 = OpAll %bool %156
OpSelectionMerge %158 None
OpBranchConditional %153 %159 %158
%159 = OpLabel
%161 = OpCompositeExtract %v2float %122 1
%162 = OpCompositeExtract %v2float %152 1
%163 = OpFOrdEqual %v2bool %161 %162
%160 = OpAll %bool %163
OpBranch %158
%158 = OpLabel
%164 = OpPhi %bool %153 %117 %160 %159
OpSelectionMerge %165 None
OpBranchConditional %164 %166 %165
%166 = OpLabel
%169 = OpCompositeExtract %v2float %122 2
%170 = OpCompositeExtract %v2float %152 2
%171 = OpFOrdEqual %v2bool %169 %170
%167 = OpAll %bool %171
OpBranch %165
%165 = OpLabel
%172 = OpPhi %bool %164 %158 %167 %166
OpSelectionMerge %173 None
OpBranchConditional %172 %174 %173
%174 = OpLabel
%177 = OpCompositeExtract %v2float %122 3
%178 = OpCompositeExtract %v2float %152 3
%179 = OpFOrdEqual %v2bool %177 %178
%175 = OpAll %bool %179
OpBranch %173
%173 = OpLabel
%180 = OpPhi %bool %172 %165 %175 %174
OpSelectionMerge %181 None
OpBranchConditional %180 %182 %183
%182 = OpLabel
%184 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_3
%185 = OpLoad %int %184
%186 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0
%187 = OpLoad %int %186
%188 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0
%189 = OpLoad %int %188
%190 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_3
%191 = OpLoad %int %190
%192 = OpConvertSToF %float %185
%193 = OpConvertSToF %float %187
%194 = OpConvertSToF %float %189
%195 = OpConvertSToF %float %191
%196 = OpCompositeConstruct %v4float %192 %193 %194 %195
OpStore %x_GLF_color %196
OpBranch %181
%183 = OpLabel
%197 = OpAccessChain %_ptr_Uniform_int %x_16 %uint_0 %int_0
%198 = OpLoad %int %197
%199 = OpConvertSToF %float %198
%200 = OpCompositeConstruct %v4float %199 %199 %199 %199
OpStore %x_GLF_color %200
OpBranch %181
%181 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_3 = OpFunction %void None %201
%tint_symbol_1 = OpFunctionParameter %main_out
%205 = OpLabel
%206 = OpCompositeExtract %v4float %tint_symbol_1 0
OpStore %tint_symbol_2 %206
OpReturn
OpFunctionEnd
%main = OpFunction %void None %104
%208 = OpLabel
%209 = OpLoad %v4float %tint_symbol
OpStore %gl_FragCoord %209
%210 = OpFunctionCall %void %main_1
%212 = OpLoad %v4float %x_GLF_color
%213 = OpCompositeConstruct %main_out %212
%211 = OpFunctionCall %void %tint_symbol_3 %213
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,133 @@
[[block]]
struct buf2 {
one : f32;
};
type Arr = [[stride(16)]] array<f32, 1>;
[[block]]
struct buf0 {
x_GLF_uniform_float_values : Arr;
};
type Arr_1 = [[stride(16)]] array<i32, 4>;
[[block]]
struct buf1 {
x_GLF_uniform_int_values : Arr_1;
};
var<private> m : mat4x2<f32>;
[[group(0), binding(2)]] var<uniform> x_10 : buf2;
[[group(0), binding(0)]] var<uniform> x_12 : buf0;
var<private> gl_FragCoord : vec4<f32>;
[[group(0), binding(1)]] var<uniform> x_16 : buf1;
var<private> x_GLF_color : vec4<f32>;
fn func0_i1_(x : ptr<function, i32>) {
var i : i32;
var x_137 : bool;
var x_138 : bool;
var x_138_phi : bool;
var x_139_phi : bool;
let x_124 : i32 = *(x);
let x_125 : bool = (x_124 < 1);
x_139_phi = x_125;
if (!(x_125)) {
let x_129 : i32 = *(x);
let x_130 : bool = (x_129 > 1);
x_138_phi = x_130;
if (x_130) {
let x_134 : f32 = x_10.one;
let x_136 : f32 = x_12.x_GLF_uniform_float_values[0];
x_137 = (x_134 > x_136);
x_138_phi = x_137;
}
x_138 = x_138_phi;
x_139_phi = x_138;
}
let x_139 : bool = x_139_phi;
if (x_139) {
return;
}
let x_143 : f32 = x_10.one;
let x_145 : f32 = x_12.x_GLF_uniform_float_values[0];
if ((x_143 == x_145)) {
i = 0;
loop {
let x_150 : i32 = i;
if ((x_150 < 2)) {
} else {
break;
}
continuing {
let x_154 : i32 = *(x);
let x_155 : i32 = clamp(x_154, 0, 3);
let x_156 : i32 = i;
let x_158 : f32 = x_12.x_GLF_uniform_float_values[0];
let x_160 : f32 = m[x_155][x_156];
m[x_155][x_156] = (x_160 + x_158);
let x_163 : i32 = i;
i = (x_163 + 1);
}
}
}
return;
}
fn func1_() {
var param : i32;
let x_167 : f32 = gl_FragCoord.y;
if ((x_167 < 0.0)) {
return;
}
param = 1;
func0_i1_(&(param));
return;
}
fn main_1() {
m = mat4x2<f32>(vec2<f32>(0.0, 0.0), vec2<f32>(0.0, 0.0), vec2<f32>(0.0, 0.0), vec2<f32>(0.0, 0.0));
func1_();
func1_();
let x_54 : mat4x2<f32> = m;
let x_56 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_59 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_62 : i32 = x_16.x_GLF_uniform_int_values[1];
let x_65 : i32 = x_16.x_GLF_uniform_int_values[1];
let x_68 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_71 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_74 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_77 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_83 : mat4x2<f32> = mat4x2<f32>(vec2<f32>(f32(x_56), f32(x_59)), vec2<f32>(f32(x_62), f32(x_65)), vec2<f32>(f32(x_68), f32(x_71)), vec2<f32>(f32(x_74), f32(x_77)));
if ((((all((x_54[0u] == x_83[0u])) && all((x_54[1u] == x_83[1u]))) && all((x_54[2u] == x_83[2u]))) && all((x_54[3u] == x_83[3u])))) {
let x_107 : i32 = x_16.x_GLF_uniform_int_values[3];
let x_110 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_113 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_116 : i32 = x_16.x_GLF_uniform_int_values[3];
x_GLF_color = vec4<f32>(f32(x_107), f32(x_110), f32(x_113), f32(x_116));
} else {
let x_120 : i32 = x_16.x_GLF_uniform_int_values[0];
let x_121 : f32 = f32(x_120);
x_GLF_color = vec4<f32>(x_121, x_121, x_121, x_121);
}
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);
}