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,267 @@
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %_GLF_color
OpExecutionMode %main OriginUpperLeft
OpSource ESSL 320
OpName %main "main"
OpName %_GLF_global_loop_count "_GLF_global_loop_count"
OpName %m "m"
OpName %buf1 "buf1"
OpMemberName %buf1 0 "_GLF_uniform_float_values"
OpName %_ ""
OpName %v "v"
OpName %f "f"
OpName %a "a"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "_GLF_uniform_int_values"
OpName %__0 ""
OpName %b "b"
OpName %buf2 "buf2"
OpMemberName %buf2 0 "one"
OpName %__1 ""
OpName %zero "zero"
OpName %_GLF_color "_GLF_color"
OpDecorate %_arr_float_uint_18 ArrayStride 16
OpMemberDecorate %buf1 0 Offset 0
OpDecorate %buf1 Block
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 1
OpDecorate %_arr_int_uint_4 ArrayStride 16
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %buf0 Block
OpDecorate %__0 DescriptorSet 0
OpDecorate %__0 Binding 0
OpMemberDecorate %buf2 0 Offset 0
OpDecorate %buf2 Block
OpDecorate %__1 DescriptorSet 0
OpDecorate %__1 Binding 2
OpDecorate %_GLF_color Location 0
%void = OpTypeVoid
%20 = OpTypeFunction %void
%int = OpTypeInt 32 1
%_ptr_Private_int = OpTypePointer Private %int
%_GLF_global_loop_count = OpVariable %_ptr_Private_int Private
%int_0 = OpConstant %int 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%mat4v4float = OpTypeMatrix %v4float 4
%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float
%uint = OpTypeInt 32 0
%uint_18 = OpConstant %uint 18
%_arr_float_uint_18 = OpTypeArray %float %uint_18
%buf1 = OpTypeStruct %_arr_float_uint_18
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
%_ = OpVariable %_ptr_Uniform_buf1 Uniform
%int_1 = OpConstant %int 1
%_ptr_Uniform_float = OpTypePointer Uniform %float
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%int_4 = OpConstant %int 4
%int_5 = OpConstant %int 5
%int_6 = OpConstant %int 6
%int_7 = OpConstant %int 7
%int_8 = OpConstant %int 8
%int_9 = OpConstant %int 9
%int_10 = OpConstant %int 10
%int_11 = OpConstant %int 11
%int_12 = OpConstant %int 12
%int_13 = OpConstant %int 13
%int_14 = OpConstant %int 14
%int_15 = OpConstant %int 15
%int_16 = OpConstant %int 16
%float_1 = OpConstant %float 1
%float_0 = OpConstant %float 0
%_ptr_Function_v4float = OpTypePointer Function %v4float
%_ptr_Function_float = OpTypePointer Function %float
%_ptr_Function_int = OpTypePointer Function %int
%uint_4 = OpConstant %uint 4
%_arr_int_uint_4 = OpTypeArray %int %uint_4
%buf0 = OpTypeStruct %_arr_int_uint_4
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%__0 = OpVariable %_ptr_Uniform_buf0 Uniform
%_ptr_Uniform_int = OpTypePointer Uniform %int
%bool = OpTypeBool
%buf2 = OpTypeStruct %int
%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2
%__1 = OpVariable %_ptr_Uniform_buf2 Uniform
%int_17 = OpConstant %int 17
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_GLF_color = OpVariable %_ptr_Output_v4float Output
%main = OpFunction %void None %20
%60 = OpLabel
%m = OpVariable %_ptr_Function_mat4v4float Function
%v = OpVariable %_ptr_Function_v4float Function
%f = OpVariable %_ptr_Function_float Function
%a = OpVariable %_ptr_Function_int Function
%b = OpVariable %_ptr_Function_int Function
%zero = OpVariable %_ptr_Function_float Function
OpStore %_GLF_global_loop_count %int_0
%61 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1
%62 = OpLoad %float %61
%63 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2
%64 = OpLoad %float %63
%65 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3
%66 = OpLoad %float %65
%67 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_4
%68 = OpLoad %float %67
%69 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_5
%70 = OpLoad %float %69
%71 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_6
%72 = OpLoad %float %71
%73 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_7
%74 = OpLoad %float %73
%75 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_8
%76 = OpLoad %float %75
%77 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_9
%78 = OpLoad %float %77
%79 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_10
%80 = OpLoad %float %79
%81 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_11
%82 = OpLoad %float %81
%83 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_12
%84 = OpLoad %float %83
%85 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_13
%86 = OpLoad %float %85
%87 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_14
%88 = OpLoad %float %87
%89 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_15
%90 = OpLoad %float %89
%91 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_16
%92 = OpLoad %float %91
%93 = OpCompositeConstruct %v4float %62 %64 %66 %68
%94 = OpCompositeConstruct %v4float %70 %72 %74 %76
%95 = OpCompositeConstruct %v4float %78 %80 %82 %84
%96 = OpCompositeConstruct %v4float %86 %88 %90 %92
%97 = OpCompositeConstruct %mat4v4float %93 %94 %95 %96
OpStore %m %97
%98 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1
%99 = OpLoad %float %98
%100 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_2
%101 = OpLoad %float %100
%102 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_3
%103 = OpLoad %float %102
%104 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_4
%105 = OpLoad %float %104
%106 = OpCompositeConstruct %v4float %99 %101 %103 %105
OpStore %v %106
%107 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1
%108 = OpLoad %float %107
OpStore %f %108
%109 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0
%110 = OpLoad %int %109
OpStore %a %110
OpBranch %111
%111 = OpLabel
OpLoopMerge %112 %113 None
OpBranch %114
%114 = OpLabel
%115 = OpLoad %int %_GLF_global_loop_count
%116 = OpSLessThan %bool %115 %int_10
OpBranchConditional %116 %117 %112
%117 = OpLabel
%118 = OpLoad %int %_GLF_global_loop_count
%119 = OpIAdd %int %118 %int_1
OpStore %_GLF_global_loop_count %119
%120 = OpLoad %int %a
%121 = OpExtInst %int %1 SClamp %120 %int_0 %int_3
%122 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1
%123 = OpLoad %float %122
%124 = OpAccessChain %_ptr_Function_float %v %121
%125 = OpLoad %float %124
%126 = OpFAdd %float %125 %123
%127 = OpAccessChain %_ptr_Function_float %v %121
OpStore %127 %126
%128 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2
%129 = OpLoad %int %128
OpStore %b %129
OpBranch %130
%130 = OpLabel
OpLoopMerge %131 %132 None
OpBranch %133
%133 = OpLabel
%134 = OpLoad %int %_GLF_global_loop_count
%135 = OpSLessThan %bool %134 %int_10
OpBranchConditional %135 %136 %131
%136 = OpLabel
%137 = OpLoad %int %_GLF_global_loop_count
%138 = OpIAdd %int %137 %int_1
OpStore %_GLF_global_loop_count %138
%139 = OpLoad %int %b
%140 = OpExtInst %int %1 SClamp %139 %int_0 %int_3
%141 = OpAccessChain %_ptr_Function_float %v %140
%142 = OpLoad %float %141
%143 = OpLoad %int %b
%144 = OpExtInst %int %1 SClamp %143 %int_0 %int_3
%145 = OpLoad %int %a
%146 = OpAccessChain %_ptr_Function_float %m %144 %145
%147 = OpLoad %float %146
%148 = OpFMul %float %142 %147
%149 = OpLoad %float %f
%150 = OpFAdd %float %149 %148
OpStore %f %150
OpBranch %132
%132 = OpLabel
%151 = OpLoad %int %b
%152 = OpISub %int %151 %int_1
OpStore %b %152
OpBranch %130
%131 = OpLabel
%153 = OpLoad %int %a
%154 = OpExtInst %int %1 SClamp %153 %int_0 %int_3
%155 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1
%156 = OpLoad %float %155
%157 = OpAccessChain %_ptr_Function_float %m %int_1 %154
OpStore %157 %156
%158 = OpAccessChain %_ptr_Uniform_int %__1 %int_0
%159 = OpLoad %int %158
%160 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0
%161 = OpLoad %int %160
%162 = OpIEqual %bool %159 %161
OpSelectionMerge %163 None
OpBranchConditional %162 %164 %163
%164 = OpLabel
OpKill
%163 = OpLabel
%165 = OpAccessChain %_ptr_Uniform_int %__1 %int_0
%166 = OpLoad %int %165
%167 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1
%168 = OpLoad %int %167
%169 = OpIEqual %bool %166 %168
OpSelectionMerge %170 None
OpBranchConditional %169 %171 %170
%171 = OpLabel
OpKill
%170 = OpLabel
OpBranch %113
%113 = OpLabel
%172 = OpLoad %int %a
%173 = OpIAdd %int %172 %int_1
OpStore %a %173
OpBranch %111
%112 = OpLabel
%174 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0
%175 = OpLoad %float %174
OpStore %zero %175
%176 = OpLoad %float %f
%177 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_17
%178 = OpLoad %float %177
%179 = OpFUnordNotEqual %bool %176 %178
OpSelectionMerge %180 None
OpBranchConditional %179 %181 %180
%181 = OpLabel
%182 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1
%183 = OpLoad %float %182
OpStore %zero %183
OpBranch %180
%180 = OpLabel
%184 = OpLoad %float %f
%185 = OpLoad %float %zero
%186 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0
%187 = OpLoad %int %186
%188 = OpConvertSToF %float %187
%189 = OpLoad %float %f
%190 = OpCompositeConstruct %v4float %184 %185 %188 %189
OpStore %_GLF_color %190
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,114 @@
void set_float4(inout float4 vec, int idx, float val) {
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
}
static int x_GLF_global_loop_count = 0;
cbuffer cbuffer_x_7 : register(b1, space0) {
uint4 x_7[18];
};
cbuffer cbuffer_x_12 : register(b0, space0) {
uint4 x_12[4];
};
cbuffer cbuffer_x_15 : register(b2, space0) {
uint4 x_15[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
float4x4 m = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f);
float f = 0.0f;
int a = 0;
int b = 0;
float zero = 0.0f;
x_GLF_global_loop_count = 0;
const float x_62 = asfloat(x_7[1].x);
const float x_64 = asfloat(x_7[2].x);
const float x_66 = asfloat(x_7[3].x);
const float x_68 = asfloat(x_7[4].x);
const float x_70 = asfloat(x_7[5].x);
const float x_72 = asfloat(x_7[6].x);
const float x_74 = asfloat(x_7[7].x);
const float x_76 = asfloat(x_7[8].x);
const float x_78 = asfloat(x_7[9].x);
const float x_80 = asfloat(x_7[10].x);
const float x_82 = asfloat(x_7[11].x);
const float x_84 = asfloat(x_7[12].x);
const float x_86 = asfloat(x_7[13].x);
const float x_88 = asfloat(x_7[14].x);
const float x_90 = asfloat(x_7[15].x);
const float x_92 = asfloat(x_7[16].x);
m = float4x4(float4(x_62, x_64, x_66, x_68), float4(x_70, x_72, x_74, x_76), float4(x_78, x_80, x_82, x_84), float4(x_86, x_88, x_90, x_92));
const float x_99 = asfloat(x_7[1].x);
const float x_101 = asfloat(x_7[2].x);
const float x_103 = asfloat(x_7[3].x);
const float x_105 = asfloat(x_7[4].x);
v = float4(x_99, x_101, x_103, x_105);
const float x_108 = asfloat(x_7[1].x);
f = x_108;
const uint scalar_offset = ((16u * uint(0))) / 4;
const int x_110 = asint(x_12[scalar_offset / 4][scalar_offset % 4]);
a = x_110;
{
for(; (x_GLF_global_loop_count < 10); a = (a + 1)) {
x_GLF_global_loop_count = (x_GLF_global_loop_count + 1);
const int x_121 = clamp(a, 0, 3);
const float x_123 = asfloat(x_7[1].x);
const float x_125 = v[x_121];
set_float4(v, x_121, (x_125 + x_123));
const int x_129 = asint(x_12[2].x);
b = x_129;
{
for(; (x_GLF_global_loop_count < 10); b = (b - 1)) {
x_GLF_global_loop_count = (x_GLF_global_loop_count + 1);
const float x_142 = v[clamp(b, 0, 3)];
const float x_147 = m[clamp(b, 0, 3)][a];
f = (f + (x_142 * x_147));
}
}
const int x_153 = a;
const float x_156 = asfloat(x_7[1].x);
set_float4(m[1], clamp(x_153, 0, 3), x_156);
const int x_159 = asint(x_15[0].x);
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
const int x_161 = asint(x_12[scalar_offset_1 / 4][scalar_offset_1 % 4]);
if ((x_159 == x_161)) {
discard;
}
const int x_166 = asint(x_15[0].x);
const int x_168 = asint(x_12[1].x);
if ((x_166 == x_168)) {
discard;
}
}
}
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
const float x_175 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]);
zero = x_175;
const float x_176 = f;
const float x_178 = asfloat(x_7[17].x);
if (!((x_176 == x_178))) {
const float x_183 = asfloat(x_7[1].x);
zero = x_183;
}
const float x_184 = f;
const float x_185 = zero;
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
const int x_187 = asint(x_12[scalar_offset_3 / 4][scalar_offset_3 % 4]);
x_GLF_color = float4(x_184, x_185, float(x_187), f);
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol {
float4 x_GLF_color_1 : SV_Target0;
};
tint_symbol main() {
main_1();
const main_out tint_symbol_1 = {x_GLF_color};
const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1};
return tint_symbol_5;
}

View File

@@ -0,0 +1,145 @@
#include <metal_stdlib>
using namespace metal;
struct tint_padded_array_element {
/* 0x0000 */ float el;
/* 0x0004 */ int8_t tint_pad[12];
};
struct tint_array_wrapper {
/* 0x0000 */ tint_padded_array_element arr[18];
};
struct buf1 {
/* 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 buf0 {
/* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values;
};
struct buf2 {
/* 0x0000 */ int one;
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
void main_1(constant buf1& x_7, constant buf0& x_12, constant buf2& x_15, thread int* const tint_symbol_4, thread float4* const tint_symbol_5) {
float4x4 m = float4x4(0.0f);
float4 v = 0.0f;
float f = 0.0f;
int a = 0;
int b = 0;
float zero = 0.0f;
*(tint_symbol_4) = 0;
float const x_62 = x_7.x_GLF_uniform_float_values.arr[1].el;
float const x_64 = x_7.x_GLF_uniform_float_values.arr[2].el;
float const x_66 = x_7.x_GLF_uniform_float_values.arr[3].el;
float const x_68 = x_7.x_GLF_uniform_float_values.arr[4].el;
float const x_70 = x_7.x_GLF_uniform_float_values.arr[5].el;
float const x_72 = x_7.x_GLF_uniform_float_values.arr[6].el;
float const x_74 = x_7.x_GLF_uniform_float_values.arr[7].el;
float const x_76 = x_7.x_GLF_uniform_float_values.arr[8].el;
float const x_78 = x_7.x_GLF_uniform_float_values.arr[9].el;
float const x_80 = x_7.x_GLF_uniform_float_values.arr[10].el;
float const x_82 = x_7.x_GLF_uniform_float_values.arr[11].el;
float const x_84 = x_7.x_GLF_uniform_float_values.arr[12].el;
float const x_86 = x_7.x_GLF_uniform_float_values.arr[13].el;
float const x_88 = x_7.x_GLF_uniform_float_values.arr[14].el;
float const x_90 = x_7.x_GLF_uniform_float_values.arr[15].el;
float const x_92 = x_7.x_GLF_uniform_float_values.arr[16].el;
m = float4x4(float4(x_62, x_64, x_66, x_68), float4(x_70, x_72, x_74, x_76), float4(x_78, x_80, x_82, x_84), float4(x_86, x_88, x_90, x_92));
float const x_99 = x_7.x_GLF_uniform_float_values.arr[1].el;
float const x_101 = x_7.x_GLF_uniform_float_values.arr[2].el;
float const x_103 = x_7.x_GLF_uniform_float_values.arr[3].el;
float const x_105 = x_7.x_GLF_uniform_float_values.arr[4].el;
v = float4(x_99, x_101, x_103, x_105);
float const x_108 = x_7.x_GLF_uniform_float_values.arr[1].el;
f = x_108;
int const x_110 = x_12.x_GLF_uniform_int_values.arr[0].el;
a = x_110;
while (true) {
int const x_115 = *(tint_symbol_4);
if ((x_115 < 10)) {
} else {
break;
}
int const x_118 = *(tint_symbol_4);
*(tint_symbol_4) = (x_118 + 1);
int const x_120 = a;
int const x_121 = clamp(x_120, 0, 3);
float const x_123 = x_7.x_GLF_uniform_float_values.arr[1].el;
float const x_125 = v[x_121];
v[x_121] = (x_125 + x_123);
int const x_129 = x_12.x_GLF_uniform_int_values.arr[2].el;
b = x_129;
while (true) {
int const x_134 = *(tint_symbol_4);
if ((x_134 < 10)) {
} else {
break;
}
int const x_137 = *(tint_symbol_4);
*(tint_symbol_4) = (x_137 + 1);
int const x_139 = b;
float const x_142 = v[clamp(x_139, 0, 3)];
int const x_143 = b;
int const x_145 = a;
float const x_147 = m[clamp(x_143, 0, 3)][x_145];
float const x_149 = f;
f = (x_149 + (x_142 * x_147));
{
int const x_151 = b;
b = (x_151 - 1);
}
}
int const x_153 = a;
float const x_156 = x_7.x_GLF_uniform_float_values.arr[1].el;
m[1][clamp(x_153, 0, 3)] = x_156;
int const x_159 = x_15.one;
int const x_161 = x_12.x_GLF_uniform_int_values.arr[0].el;
if ((x_159 == x_161)) {
discard_fragment();
}
int const x_166 = x_15.one;
int const x_168 = x_12.x_GLF_uniform_int_values.arr[1].el;
if ((x_166 == x_168)) {
discard_fragment();
}
{
int const x_172 = a;
a = (x_172 + 1);
}
}
float const x_175 = x_7.x_GLF_uniform_float_values.arr[0].el;
zero = x_175;
float const x_176 = f;
float const x_178 = x_7.x_GLF_uniform_float_values.arr[17].el;
if (!((x_176 == x_178))) {
float const x_183 = x_7.x_GLF_uniform_float_values.arr[1].el;
zero = x_183;
}
float const x_184 = f;
float const x_185 = zero;
int const x_187 = x_12.x_GLF_uniform_int_values.arr[0].el;
float const x_189 = f;
*(tint_symbol_5) = float4(x_184, x_185, float(x_187), x_189);
return;
}
fragment tint_symbol_1 tint_symbol(constant buf1& x_7 [[buffer(1)]], constant buf0& x_12 [[buffer(0)]], constant buf2& x_15 [[buffer(2)]]) {
thread int tint_symbol_6 = 0;
thread float4 tint_symbol_7 = 0.0f;
main_1(x_7, x_12, x_15, &(tint_symbol_6), &(tint_symbol_7));
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7};
tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
return tint_symbol_3;
}

View File

@@ -0,0 +1,314 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 213
; Schema: 0
OpCapability Shader
%127 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %x_GLF_global_loop_count "x_GLF_global_loop_count"
OpName %buf1 "buf1"
OpMemberName %buf1 0 "x_GLF_uniform_float_values"
OpName %x_7 "x_7"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "x_GLF_uniform_int_values"
OpName %x_12 "x_12"
OpName %buf2 "buf2"
OpMemberName %buf2 0 "one"
OpName %x_15 "x_15"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
OpName %m "m"
OpName %v "v"
OpName %f "f"
OpName %a "a"
OpName %b "b"
OpName %zero "zero"
OpName %main_out "main_out"
OpMemberName %main_out 0 "x_GLF_color_1"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol "tint_symbol"
OpName %main "main"
OpDecorate %buf1 Block
OpMemberDecorate %buf1 0 Offset 0
OpDecorate %_arr_float_uint_18 ArrayStride 16
OpDecorate %x_7 NonWritable
OpDecorate %x_7 DescriptorSet 0
OpDecorate %x_7 Binding 1
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %_arr_int_uint_4 ArrayStride 16
OpDecorate %x_12 NonWritable
OpDecorate %x_12 DescriptorSet 0
OpDecorate %x_12 Binding 0
OpDecorate %buf2 Block
OpMemberDecorate %buf2 0 Offset 0
OpDecorate %x_15 NonWritable
OpDecorate %x_15 DescriptorSet 0
OpDecorate %x_15 Binding 2
OpDecorate %tint_symbol_1 Location 0
OpMemberDecorate %main_out 0 Offset 0
%int = OpTypeInt 32 1
%_ptr_Private_int = OpTypePointer Private %int
%4 = OpConstantNull %int
%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4
%float = OpTypeFloat 32
%uint = OpTypeInt 32 0
%uint_18 = OpConstant %uint 18
%_arr_float_uint_18 = OpTypeArray %float %uint_18
%buf1 = OpTypeStruct %_arr_float_uint_18
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
%x_7 = OpVariable %_ptr_Uniform_buf1 Uniform
%uint_4 = OpConstant %uint 4
%_arr_int_uint_4 = OpTypeArray %int %uint_4
%buf0 = OpTypeStruct %_arr_int_uint_4
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_12 = OpVariable %_ptr_Uniform_buf0 Uniform
%buf2 = OpTypeStruct %int
%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2
%x_15 = OpVariable %_ptr_Uniform_buf2 Uniform
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%23 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %23
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %23
%void = OpTypeVoid
%26 = OpTypeFunction %void
%mat4v4float = OpTypeMatrix %v4float 4
%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float
%33 = OpConstantNull %mat4v4float
%_ptr_Function_v4float = OpTypePointer Function %v4float
%_ptr_Function_float = OpTypePointer Function %float
%38 = OpConstantNull %float
%_ptr_Function_int = OpTypePointer Function %int
%int_0 = OpConstant %int 0
%uint_0 = OpConstant %uint 0
%int_1 = OpConstant %int 1
%_ptr_Uniform_float = OpTypePointer Uniform %float
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%int_4 = OpConstant %int 4
%int_5 = OpConstant %int 5
%int_6 = OpConstant %int 6
%int_7 = OpConstant %int 7
%int_8 = OpConstant %int 8
%int_9 = OpConstant %int 9
%int_10 = OpConstant %int 10
%int_11 = OpConstant %int 11
%int_12 = OpConstant %int 12
%int_13 = OpConstant %int 13
%int_14 = OpConstant %int 14
%int_15 = OpConstant %int 15
%int_16 = OpConstant %int 16
%_ptr_Uniform_int = OpTypePointer Uniform %int
%bool = OpTypeBool
%int_17 = OpConstant %int 17
%main_out = OpTypeStruct %v4float
%201 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %26
%29 = OpLabel
%m = OpVariable %_ptr_Function_mat4v4float Function %33
%v = OpVariable %_ptr_Function_v4float Function %23
%f = OpVariable %_ptr_Function_float Function %38
%a = OpVariable %_ptr_Function_int Function %4
%b = OpVariable %_ptr_Function_int Function %4
%zero = OpVariable %_ptr_Function_float Function %38
OpStore %x_GLF_global_loop_count %int_0
%47 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1
%48 = OpLoad %float %47
%50 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_2
%51 = OpLoad %float %50
%53 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_3
%54 = OpLoad %float %53
%56 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_4
%57 = OpLoad %float %56
%59 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_5
%60 = OpLoad %float %59
%62 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_6
%63 = OpLoad %float %62
%65 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_7
%66 = OpLoad %float %65
%68 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_8
%69 = OpLoad %float %68
%71 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_9
%72 = OpLoad %float %71
%74 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_10
%75 = OpLoad %float %74
%77 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_11
%78 = OpLoad %float %77
%80 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_12
%81 = OpLoad %float %80
%83 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_13
%84 = OpLoad %float %83
%86 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_14
%87 = OpLoad %float %86
%89 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_15
%90 = OpLoad %float %89
%92 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_16
%93 = OpLoad %float %92
%94 = OpCompositeConstruct %v4float %48 %51 %54 %57
%95 = OpCompositeConstruct %v4float %60 %63 %66 %69
%96 = OpCompositeConstruct %v4float %72 %75 %78 %81
%97 = OpCompositeConstruct %v4float %84 %87 %90 %93
%98 = OpCompositeConstruct %mat4v4float %94 %95 %96 %97
OpStore %m %98
%99 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1
%100 = OpLoad %float %99
%101 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_2
%102 = OpLoad %float %101
%103 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_3
%104 = OpLoad %float %103
%105 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_4
%106 = OpLoad %float %105
%107 = OpCompositeConstruct %v4float %100 %102 %104 %106
OpStore %v %107
%108 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1
%109 = OpLoad %float %108
OpStore %f %109
%111 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0
%112 = OpLoad %int %111
OpStore %a %112
OpBranch %113
%113 = OpLabel
OpLoopMerge %114 %115 None
OpBranch %116
%116 = OpLabel
%117 = OpLoad %int %x_GLF_global_loop_count
%118 = OpSLessThan %bool %117 %int_10
OpSelectionMerge %120 None
OpBranchConditional %118 %121 %122
%121 = OpLabel
OpBranch %120
%122 = OpLabel
OpBranch %114
%120 = OpLabel
%123 = OpLoad %int %x_GLF_global_loop_count
%124 = OpIAdd %int %123 %int_1
OpStore %x_GLF_global_loop_count %124
%125 = OpLoad %int %a
%126 = OpExtInst %int %127 SClamp %125 %int_0 %int_3
%128 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1
%129 = OpLoad %float %128
%130 = OpAccessChain %_ptr_Function_float %v %126
%131 = OpLoad %float %130
%132 = OpAccessChain %_ptr_Function_float %v %126
%133 = OpFAdd %float %131 %129
OpStore %132 %133
%134 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_2
%135 = OpLoad %int %134
OpStore %b %135
OpBranch %136
%136 = OpLabel
OpLoopMerge %137 %138 None
OpBranch %139
%139 = OpLabel
%140 = OpLoad %int %x_GLF_global_loop_count
%141 = OpSLessThan %bool %140 %int_10
OpSelectionMerge %142 None
OpBranchConditional %141 %143 %144
%143 = OpLabel
OpBranch %142
%144 = OpLabel
OpBranch %137
%142 = OpLabel
%145 = OpLoad %int %x_GLF_global_loop_count
%146 = OpIAdd %int %145 %int_1
OpStore %x_GLF_global_loop_count %146
%147 = OpLoad %int %b
%148 = OpExtInst %int %127 SClamp %147 %int_0 %int_3
%149 = OpAccessChain %_ptr_Function_float %v %148
%150 = OpLoad %float %149
%151 = OpLoad %int %b
%152 = OpLoad %int %a
%153 = OpExtInst %int %127 SClamp %151 %int_0 %int_3
%154 = OpAccessChain %_ptr_Function_float %m %153 %152
%155 = OpLoad %float %154
%156 = OpLoad %float %f
%157 = OpFMul %float %150 %155
%158 = OpFAdd %float %156 %157
OpStore %f %158
OpBranch %138
%138 = OpLabel
%159 = OpLoad %int %b
%160 = OpISub %int %159 %int_1
OpStore %b %160
OpBranch %136
%137 = OpLabel
%161 = OpLoad %int %a
%162 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1
%163 = OpLoad %float %162
%164 = OpExtInst %int %127 SClamp %161 %int_0 %int_3
%165 = OpAccessChain %_ptr_Function_float %m %int_1 %164
OpStore %165 %163
%166 = OpAccessChain %_ptr_Uniform_int %x_15 %uint_0
%167 = OpLoad %int %166
%168 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0
%169 = OpLoad %int %168
%170 = OpIEqual %bool %167 %169
OpSelectionMerge %171 None
OpBranchConditional %170 %172 %171
%172 = OpLabel
OpKill
%171 = OpLabel
%173 = OpAccessChain %_ptr_Uniform_int %x_15 %uint_0
%174 = OpLoad %int %173
%175 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1
%176 = OpLoad %int %175
%177 = OpIEqual %bool %174 %176
OpSelectionMerge %178 None
OpBranchConditional %177 %179 %178
%179 = OpLabel
OpKill
%178 = OpLabel
OpBranch %115
%115 = OpLabel
%180 = OpLoad %int %a
%181 = OpIAdd %int %180 %int_1
OpStore %a %181
OpBranch %113
%114 = OpLabel
%182 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0
%183 = OpLoad %float %182
OpStore %zero %183
%184 = OpLoad %float %f
%186 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_17
%187 = OpLoad %float %186
%189 = OpFOrdEqual %bool %184 %187
%188 = OpLogicalNot %bool %189
OpSelectionMerge %190 None
OpBranchConditional %188 %191 %190
%191 = OpLabel
%192 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1
%193 = OpLoad %float %192
OpStore %zero %193
OpBranch %190
%190 = OpLabel
%194 = OpLoad %float %f
%195 = OpLoad %float %zero
%196 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0
%197 = OpLoad %int %196
%198 = OpLoad %float %f
%199 = OpConvertSToF %float %197
%200 = OpCompositeConstruct %v4float %194 %195 %199 %198
OpStore %x_GLF_color %200
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %201
%tint_symbol = OpFunctionParameter %main_out
%205 = OpLabel
%206 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %206
OpReturn
OpFunctionEnd
%main = OpFunction %void None %26
%208 = OpLabel
%209 = OpFunctionCall %void %main_1
%211 = OpLoad %v4float %x_GLF_color
%212 = OpCompositeConstruct %main_out %211
%210 = OpFunctionCall %void %tint_symbol_2 %212
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,144 @@
type Arr = [[stride(16)]] array<f32, 18>;
[[block]]
struct buf1 {
x_GLF_uniform_float_values : Arr;
};
type Arr_1 = [[stride(16)]] array<i32, 4>;
[[block]]
struct buf0 {
x_GLF_uniform_int_values : Arr_1;
};
[[block]]
struct buf2 {
one : i32;
};
var<private> x_GLF_global_loop_count : i32;
[[group(0), binding(1)]] var<uniform> x_7 : buf1;
[[group(0), binding(0)]] var<uniform> x_12 : buf0;
[[group(0), binding(2)]] var<uniform> x_15 : buf2;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var m : mat4x4<f32>;
var v : vec4<f32>;
var f : f32;
var a : i32;
var b : i32;
var zero : f32;
x_GLF_global_loop_count = 0;
let x_62 : f32 = x_7.x_GLF_uniform_float_values[1];
let x_64 : f32 = x_7.x_GLF_uniform_float_values[2];
let x_66 : f32 = x_7.x_GLF_uniform_float_values[3];
let x_68 : f32 = x_7.x_GLF_uniform_float_values[4];
let x_70 : f32 = x_7.x_GLF_uniform_float_values[5];
let x_72 : f32 = x_7.x_GLF_uniform_float_values[6];
let x_74 : f32 = x_7.x_GLF_uniform_float_values[7];
let x_76 : f32 = x_7.x_GLF_uniform_float_values[8];
let x_78 : f32 = x_7.x_GLF_uniform_float_values[9];
let x_80 : f32 = x_7.x_GLF_uniform_float_values[10];
let x_82 : f32 = x_7.x_GLF_uniform_float_values[11];
let x_84 : f32 = x_7.x_GLF_uniform_float_values[12];
let x_86 : f32 = x_7.x_GLF_uniform_float_values[13];
let x_88 : f32 = x_7.x_GLF_uniform_float_values[14];
let x_90 : f32 = x_7.x_GLF_uniform_float_values[15];
let x_92 : f32 = x_7.x_GLF_uniform_float_values[16];
m = mat4x4<f32>(vec4<f32>(x_62, x_64, x_66, x_68), vec4<f32>(x_70, x_72, x_74, x_76), vec4<f32>(x_78, x_80, x_82, x_84), vec4<f32>(x_86, x_88, x_90, x_92));
let x_99 : f32 = x_7.x_GLF_uniform_float_values[1];
let x_101 : f32 = x_7.x_GLF_uniform_float_values[2];
let x_103 : f32 = x_7.x_GLF_uniform_float_values[3];
let x_105 : f32 = x_7.x_GLF_uniform_float_values[4];
v = vec4<f32>(x_99, x_101, x_103, x_105);
let x_108 : f32 = x_7.x_GLF_uniform_float_values[1];
f = x_108;
let x_110 : i32 = x_12.x_GLF_uniform_int_values[0];
a = x_110;
loop {
let x_115 : i32 = x_GLF_global_loop_count;
if ((x_115 < 10)) {
} else {
break;
}
let x_118 : i32 = x_GLF_global_loop_count;
x_GLF_global_loop_count = (x_118 + 1);
let x_120 : i32 = a;
let x_121 : i32 = clamp(x_120, 0, 3);
let x_123 : f32 = x_7.x_GLF_uniform_float_values[1];
let x_125 : f32 = v[x_121];
v[x_121] = (x_125 + x_123);
let x_129 : i32 = x_12.x_GLF_uniform_int_values[2];
b = x_129;
loop {
let x_134 : i32 = x_GLF_global_loop_count;
if ((x_134 < 10)) {
} else {
break;
}
let x_137 : i32 = x_GLF_global_loop_count;
x_GLF_global_loop_count = (x_137 + 1);
let x_139 : i32 = b;
let x_142 : f32 = v[clamp(x_139, 0, 3)];
let x_143 : i32 = b;
let x_145 : i32 = a;
let x_147 : f32 = m[clamp(x_143, 0, 3)][x_145];
let x_149 : f32 = f;
f = (x_149 + (x_142 * x_147));
continuing {
let x_151 : i32 = b;
b = (x_151 - 1);
}
}
let x_153 : i32 = a;
let x_156 : f32 = x_7.x_GLF_uniform_float_values[1];
m[1][clamp(x_153, 0, 3)] = x_156;
let x_159 : i32 = x_15.one;
let x_161 : i32 = x_12.x_GLF_uniform_int_values[0];
if ((x_159 == x_161)) {
discard;
}
let x_166 : i32 = x_15.one;
let x_168 : i32 = x_12.x_GLF_uniform_int_values[1];
if ((x_166 == x_168)) {
discard;
}
continuing {
let x_172 : i32 = a;
a = (x_172 + 1);
}
}
let x_175 : f32 = x_7.x_GLF_uniform_float_values[0];
zero = x_175;
let x_176 : f32 = f;
let x_178 : f32 = x_7.x_GLF_uniform_float_values[17];
if (!((x_176 == x_178))) {
let x_183 : f32 = x_7.x_GLF_uniform_float_values[1];
zero = x_183;
}
let x_184 : f32 = f;
let x_185 : f32 = zero;
let x_187 : i32 = x_12.x_GLF_uniform_int_values[0];
let x_189 : f32 = f;
x_GLF_color = vec4<f32>(x_184, x_185, f32(x_187), x_189);
return;
}
struct main_out {
[[location(0)]]
x_GLF_color_1 : vec4<f32>;
};
[[stage(fragment)]]
fn main() -> main_out {
main_1();
return main_out(x_GLF_color);
}

View File

@@ -0,0 +1,144 @@
type Arr = [[stride(16)]] array<f32, 18>;
[[block]]
struct buf1 {
x_GLF_uniform_float_values : Arr;
};
type Arr_1 = [[stride(16)]] array<i32, 4>;
[[block]]
struct buf0 {
x_GLF_uniform_int_values : Arr_1;
};
[[block]]
struct buf2 {
one : i32;
};
var<private> x_GLF_global_loop_count : i32;
[[group(0), binding(1)]] var<uniform> x_7 : buf1;
[[group(0), binding(0)]] var<uniform> x_12 : buf0;
[[group(0), binding(2)]] var<uniform> x_15 : buf2;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var m : mat4x4<f32>;
var v : vec4<f32>;
var f : f32;
var a : i32;
var b : i32;
var zero : f32;
x_GLF_global_loop_count = 0;
let x_62 : f32 = x_7.x_GLF_uniform_float_values[1];
let x_64 : f32 = x_7.x_GLF_uniform_float_values[2];
let x_66 : f32 = x_7.x_GLF_uniform_float_values[3];
let x_68 : f32 = x_7.x_GLF_uniform_float_values[4];
let x_70 : f32 = x_7.x_GLF_uniform_float_values[5];
let x_72 : f32 = x_7.x_GLF_uniform_float_values[6];
let x_74 : f32 = x_7.x_GLF_uniform_float_values[7];
let x_76 : f32 = x_7.x_GLF_uniform_float_values[8];
let x_78 : f32 = x_7.x_GLF_uniform_float_values[9];
let x_80 : f32 = x_7.x_GLF_uniform_float_values[10];
let x_82 : f32 = x_7.x_GLF_uniform_float_values[11];
let x_84 : f32 = x_7.x_GLF_uniform_float_values[12];
let x_86 : f32 = x_7.x_GLF_uniform_float_values[13];
let x_88 : f32 = x_7.x_GLF_uniform_float_values[14];
let x_90 : f32 = x_7.x_GLF_uniform_float_values[15];
let x_92 : f32 = x_7.x_GLF_uniform_float_values[16];
m = mat4x4<f32>(vec4<f32>(x_62, x_64, x_66, x_68), vec4<f32>(x_70, x_72, x_74, x_76), vec4<f32>(x_78, x_80, x_82, x_84), vec4<f32>(x_86, x_88, x_90, x_92));
let x_99 : f32 = x_7.x_GLF_uniform_float_values[1];
let x_101 : f32 = x_7.x_GLF_uniform_float_values[2];
let x_103 : f32 = x_7.x_GLF_uniform_float_values[3];
let x_105 : f32 = x_7.x_GLF_uniform_float_values[4];
v = vec4<f32>(x_99, x_101, x_103, x_105);
let x_108 : f32 = x_7.x_GLF_uniform_float_values[1];
f = x_108;
let x_110 : i32 = x_12.x_GLF_uniform_int_values[0];
a = x_110;
loop {
let x_115 : i32 = x_GLF_global_loop_count;
if ((x_115 < 10)) {
} else {
break;
}
let x_118 : i32 = x_GLF_global_loop_count;
x_GLF_global_loop_count = (x_118 + 1);
let x_120 : i32 = a;
let x_121 : i32 = clamp(x_120, 0, 3);
let x_123 : f32 = x_7.x_GLF_uniform_float_values[1];
let x_125 : f32 = v[x_121];
v[x_121] = (x_125 + x_123);
let x_129 : i32 = x_12.x_GLF_uniform_int_values[2];
b = x_129;
loop {
let x_134 : i32 = x_GLF_global_loop_count;
if ((x_134 < 10)) {
} else {
break;
}
let x_137 : i32 = x_GLF_global_loop_count;
x_GLF_global_loop_count = (x_137 + 1);
let x_139 : i32 = b;
let x_142 : f32 = v[clamp(x_139, 0, 3)];
let x_143 : i32 = b;
let x_145 : i32 = a;
let x_147 : f32 = m[clamp(x_143, 0, 3)][x_145];
let x_149 : f32 = f;
f = (x_149 + (x_142 * x_147));
continuing {
let x_151 : i32 = b;
b = (x_151 - 1);
}
}
let x_153 : i32 = a;
let x_156 : f32 = x_7.x_GLF_uniform_float_values[1];
m[1][clamp(x_153, 0, 3)] = x_156;
let x_159 : i32 = x_15.one;
let x_161 : i32 = x_12.x_GLF_uniform_int_values[0];
if ((x_159 == x_161)) {
discard;
}
let x_166 : i32 = x_15.one;
let x_168 : i32 = x_12.x_GLF_uniform_int_values[1];
if ((x_166 == x_168)) {
discard;
}
continuing {
let x_172 : i32 = a;
a = (x_172 + 1);
}
}
let x_175 : f32 = x_7.x_GLF_uniform_float_values[0];
zero = x_175;
let x_176 : f32 = f;
let x_178 : f32 = x_7.x_GLF_uniform_float_values[17];
if (!((x_176 == x_178))) {
let x_183 : f32 = x_7.x_GLF_uniform_float_values[1];
zero = x_183;
}
let x_184 : f32 = f;
let x_185 : f32 = zero;
let x_187 : i32 = x_12.x_GLF_uniform_int_values[0];
let x_189 : f32 = f;
x_GLF_color = vec4<f32>(x_184, x_185, f32(x_187), x_189);
return;
}
struct main_out {
[[location(0)]]
x_GLF_color_1 : vec4<f32>;
};
[[stage(fragment)]]
fn main() -> main_out {
main_1();
return main_out(x_GLF_color);
}

View File

@@ -0,0 +1,114 @@
void set_float4(inout float4 vec, int idx, float val) {
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
}
static int x_GLF_global_loop_count = 0;
cbuffer cbuffer_x_7 : register(b1, space0) {
uint4 x_7[18];
};
cbuffer cbuffer_x_12 : register(b0, space0) {
uint4 x_12[4];
};
cbuffer cbuffer_x_15 : register(b2, space0) {
uint4 x_15[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
float4x4 m = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f);
float f = 0.0f;
int a = 0;
int b = 0;
float zero = 0.0f;
x_GLF_global_loop_count = 0;
const float x_62 = asfloat(x_7[1].x);
const float x_64 = asfloat(x_7[2].x);
const float x_66 = asfloat(x_7[3].x);
const float x_68 = asfloat(x_7[4].x);
const float x_70 = asfloat(x_7[5].x);
const float x_72 = asfloat(x_7[6].x);
const float x_74 = asfloat(x_7[7].x);
const float x_76 = asfloat(x_7[8].x);
const float x_78 = asfloat(x_7[9].x);
const float x_80 = asfloat(x_7[10].x);
const float x_82 = asfloat(x_7[11].x);
const float x_84 = asfloat(x_7[12].x);
const float x_86 = asfloat(x_7[13].x);
const float x_88 = asfloat(x_7[14].x);
const float x_90 = asfloat(x_7[15].x);
const float x_92 = asfloat(x_7[16].x);
m = float4x4(float4(x_62, x_64, x_66, x_68), float4(x_70, x_72, x_74, x_76), float4(x_78, x_80, x_82, x_84), float4(x_86, x_88, x_90, x_92));
const float x_99 = asfloat(x_7[1].x);
const float x_101 = asfloat(x_7[2].x);
const float x_103 = asfloat(x_7[3].x);
const float x_105 = asfloat(x_7[4].x);
v = float4(x_99, x_101, x_103, x_105);
const float x_108 = asfloat(x_7[1].x);
f = x_108;
const uint scalar_offset = ((16u * uint(0))) / 4;
const int x_110 = asint(x_12[scalar_offset / 4][scalar_offset % 4]);
a = x_110;
{
for(; (x_GLF_global_loop_count < 10); a = (a + 1)) {
x_GLF_global_loop_count = (x_GLF_global_loop_count + 1);
const int x_121 = clamp(a, 0, 3);
const float x_123 = asfloat(x_7[1].x);
const float x_125 = v[x_121];
set_float4(v, x_121, (x_125 + x_123));
const int x_129 = asint(x_12[2].x);
b = x_129;
{
for(; (x_GLF_global_loop_count < 10); b = (b - 1)) {
x_GLF_global_loop_count = (x_GLF_global_loop_count + 1);
const float x_142 = v[clamp(b, 0, 3)];
const float x_147 = m[clamp(b, 0, 3)][a];
f = (f + (x_142 * x_147));
}
}
const int x_153 = a;
const float x_156 = asfloat(x_7[1].x);
set_float4(m[1], clamp(x_153, 0, 3), x_156);
const int x_159 = asint(x_15[0].x);
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
const int x_161 = asint(x_12[scalar_offset_1 / 4][scalar_offset_1 % 4]);
if ((x_159 == x_161)) {
discard;
}
const int x_166 = asint(x_15[0].x);
const int x_168 = asint(x_12[1].x);
if ((x_166 == x_168)) {
discard;
}
}
}
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
const float x_175 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]);
zero = x_175;
const float x_176 = f;
const float x_178 = asfloat(x_7[17].x);
if (!((x_176 == x_178))) {
const float x_183 = asfloat(x_7[1].x);
zero = x_183;
}
const float x_184 = f;
const float x_185 = zero;
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
const int x_187 = asint(x_12[scalar_offset_3 / 4][scalar_offset_3 % 4]);
x_GLF_color = float4(x_184, x_185, float(x_187), f);
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol {
float4 x_GLF_color_1 : SV_Target0;
};
tint_symbol main() {
main_1();
const main_out tint_symbol_1 = {x_GLF_color};
const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1};
return tint_symbol_5;
}

View File

@@ -0,0 +1,145 @@
#include <metal_stdlib>
using namespace metal;
struct tint_padded_array_element {
/* 0x0000 */ float el;
/* 0x0004 */ int8_t tint_pad[12];
};
struct tint_array_wrapper {
/* 0x0000 */ tint_padded_array_element arr[18];
};
struct buf1 {
/* 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 buf0 {
/* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values;
};
struct buf2 {
/* 0x0000 */ int one;
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
void main_1(constant buf1& x_7, constant buf0& x_12, constant buf2& x_15, thread int* const tint_symbol_4, thread float4* const tint_symbol_5) {
float4x4 m = float4x4(0.0f);
float4 v = 0.0f;
float f = 0.0f;
int a = 0;
int b = 0;
float zero = 0.0f;
*(tint_symbol_4) = 0;
float const x_62 = x_7.x_GLF_uniform_float_values.arr[1].el;
float const x_64 = x_7.x_GLF_uniform_float_values.arr[2].el;
float const x_66 = x_7.x_GLF_uniform_float_values.arr[3].el;
float const x_68 = x_7.x_GLF_uniform_float_values.arr[4].el;
float const x_70 = x_7.x_GLF_uniform_float_values.arr[5].el;
float const x_72 = x_7.x_GLF_uniform_float_values.arr[6].el;
float const x_74 = x_7.x_GLF_uniform_float_values.arr[7].el;
float const x_76 = x_7.x_GLF_uniform_float_values.arr[8].el;
float const x_78 = x_7.x_GLF_uniform_float_values.arr[9].el;
float const x_80 = x_7.x_GLF_uniform_float_values.arr[10].el;
float const x_82 = x_7.x_GLF_uniform_float_values.arr[11].el;
float const x_84 = x_7.x_GLF_uniform_float_values.arr[12].el;
float const x_86 = x_7.x_GLF_uniform_float_values.arr[13].el;
float const x_88 = x_7.x_GLF_uniform_float_values.arr[14].el;
float const x_90 = x_7.x_GLF_uniform_float_values.arr[15].el;
float const x_92 = x_7.x_GLF_uniform_float_values.arr[16].el;
m = float4x4(float4(x_62, x_64, x_66, x_68), float4(x_70, x_72, x_74, x_76), float4(x_78, x_80, x_82, x_84), float4(x_86, x_88, x_90, x_92));
float const x_99 = x_7.x_GLF_uniform_float_values.arr[1].el;
float const x_101 = x_7.x_GLF_uniform_float_values.arr[2].el;
float const x_103 = x_7.x_GLF_uniform_float_values.arr[3].el;
float const x_105 = x_7.x_GLF_uniform_float_values.arr[4].el;
v = float4(x_99, x_101, x_103, x_105);
float const x_108 = x_7.x_GLF_uniform_float_values.arr[1].el;
f = x_108;
int const x_110 = x_12.x_GLF_uniform_int_values.arr[0].el;
a = x_110;
while (true) {
int const x_115 = *(tint_symbol_4);
if ((x_115 < 10)) {
} else {
break;
}
int const x_118 = *(tint_symbol_4);
*(tint_symbol_4) = (x_118 + 1);
int const x_120 = a;
int const x_121 = clamp(x_120, 0, 3);
float const x_123 = x_7.x_GLF_uniform_float_values.arr[1].el;
float const x_125 = v[x_121];
v[x_121] = (x_125 + x_123);
int const x_129 = x_12.x_GLF_uniform_int_values.arr[2].el;
b = x_129;
while (true) {
int const x_134 = *(tint_symbol_4);
if ((x_134 < 10)) {
} else {
break;
}
int const x_137 = *(tint_symbol_4);
*(tint_symbol_4) = (x_137 + 1);
int const x_139 = b;
float const x_142 = v[clamp(x_139, 0, 3)];
int const x_143 = b;
int const x_145 = a;
float const x_147 = m[clamp(x_143, 0, 3)][x_145];
float const x_149 = f;
f = (x_149 + (x_142 * x_147));
{
int const x_151 = b;
b = (x_151 - 1);
}
}
int const x_153 = a;
float const x_156 = x_7.x_GLF_uniform_float_values.arr[1].el;
m[1][clamp(x_153, 0, 3)] = x_156;
int const x_159 = x_15.one;
int const x_161 = x_12.x_GLF_uniform_int_values.arr[0].el;
if ((x_159 == x_161)) {
discard_fragment();
}
int const x_166 = x_15.one;
int const x_168 = x_12.x_GLF_uniform_int_values.arr[1].el;
if ((x_166 == x_168)) {
discard_fragment();
}
{
int const x_172 = a;
a = (x_172 + 1);
}
}
float const x_175 = x_7.x_GLF_uniform_float_values.arr[0].el;
zero = x_175;
float const x_176 = f;
float const x_178 = x_7.x_GLF_uniform_float_values.arr[17].el;
if (!((x_176 == x_178))) {
float const x_183 = x_7.x_GLF_uniform_float_values.arr[1].el;
zero = x_183;
}
float const x_184 = f;
float const x_185 = zero;
int const x_187 = x_12.x_GLF_uniform_int_values.arr[0].el;
float const x_189 = f;
*(tint_symbol_5) = float4(x_184, x_185, float(x_187), x_189);
return;
}
fragment tint_symbol_1 tint_symbol(constant buf1& x_7 [[buffer(1)]], constant buf0& x_12 [[buffer(0)]], constant buf2& x_15 [[buffer(2)]]) {
thread int tint_symbol_6 = 0;
thread float4 tint_symbol_7 = 0.0f;
main_1(x_7, x_12, x_15, &(tint_symbol_6), &(tint_symbol_7));
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7};
tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
return tint_symbol_3;
}

View File

@@ -0,0 +1,314 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 213
; Schema: 0
OpCapability Shader
%127 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %x_GLF_global_loop_count "x_GLF_global_loop_count"
OpName %buf1 "buf1"
OpMemberName %buf1 0 "x_GLF_uniform_float_values"
OpName %x_7 "x_7"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "x_GLF_uniform_int_values"
OpName %x_12 "x_12"
OpName %buf2 "buf2"
OpMemberName %buf2 0 "one"
OpName %x_15 "x_15"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
OpName %m "m"
OpName %v "v"
OpName %f "f"
OpName %a "a"
OpName %b "b"
OpName %zero "zero"
OpName %main_out "main_out"
OpMemberName %main_out 0 "x_GLF_color_1"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol "tint_symbol"
OpName %main "main"
OpDecorate %buf1 Block
OpMemberDecorate %buf1 0 Offset 0
OpDecorate %_arr_float_uint_18 ArrayStride 16
OpDecorate %x_7 NonWritable
OpDecorate %x_7 DescriptorSet 0
OpDecorate %x_7 Binding 1
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %_arr_int_uint_4 ArrayStride 16
OpDecorate %x_12 NonWritable
OpDecorate %x_12 DescriptorSet 0
OpDecorate %x_12 Binding 0
OpDecorate %buf2 Block
OpMemberDecorate %buf2 0 Offset 0
OpDecorate %x_15 NonWritable
OpDecorate %x_15 DescriptorSet 0
OpDecorate %x_15 Binding 2
OpDecorate %tint_symbol_1 Location 0
OpMemberDecorate %main_out 0 Offset 0
%int = OpTypeInt 32 1
%_ptr_Private_int = OpTypePointer Private %int
%4 = OpConstantNull %int
%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4
%float = OpTypeFloat 32
%uint = OpTypeInt 32 0
%uint_18 = OpConstant %uint 18
%_arr_float_uint_18 = OpTypeArray %float %uint_18
%buf1 = OpTypeStruct %_arr_float_uint_18
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
%x_7 = OpVariable %_ptr_Uniform_buf1 Uniform
%uint_4 = OpConstant %uint 4
%_arr_int_uint_4 = OpTypeArray %int %uint_4
%buf0 = OpTypeStruct %_arr_int_uint_4
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_12 = OpVariable %_ptr_Uniform_buf0 Uniform
%buf2 = OpTypeStruct %int
%_ptr_Uniform_buf2 = OpTypePointer Uniform %buf2
%x_15 = OpVariable %_ptr_Uniform_buf2 Uniform
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%23 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %23
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %23
%void = OpTypeVoid
%26 = OpTypeFunction %void
%mat4v4float = OpTypeMatrix %v4float 4
%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float
%33 = OpConstantNull %mat4v4float
%_ptr_Function_v4float = OpTypePointer Function %v4float
%_ptr_Function_float = OpTypePointer Function %float
%38 = OpConstantNull %float
%_ptr_Function_int = OpTypePointer Function %int
%int_0 = OpConstant %int 0
%uint_0 = OpConstant %uint 0
%int_1 = OpConstant %int 1
%_ptr_Uniform_float = OpTypePointer Uniform %float
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%int_4 = OpConstant %int 4
%int_5 = OpConstant %int 5
%int_6 = OpConstant %int 6
%int_7 = OpConstant %int 7
%int_8 = OpConstant %int 8
%int_9 = OpConstant %int 9
%int_10 = OpConstant %int 10
%int_11 = OpConstant %int 11
%int_12 = OpConstant %int 12
%int_13 = OpConstant %int 13
%int_14 = OpConstant %int 14
%int_15 = OpConstant %int 15
%int_16 = OpConstant %int 16
%_ptr_Uniform_int = OpTypePointer Uniform %int
%bool = OpTypeBool
%int_17 = OpConstant %int 17
%main_out = OpTypeStruct %v4float
%201 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %26
%29 = OpLabel
%m = OpVariable %_ptr_Function_mat4v4float Function %33
%v = OpVariable %_ptr_Function_v4float Function %23
%f = OpVariable %_ptr_Function_float Function %38
%a = OpVariable %_ptr_Function_int Function %4
%b = OpVariable %_ptr_Function_int Function %4
%zero = OpVariable %_ptr_Function_float Function %38
OpStore %x_GLF_global_loop_count %int_0
%47 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1
%48 = OpLoad %float %47
%50 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_2
%51 = OpLoad %float %50
%53 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_3
%54 = OpLoad %float %53
%56 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_4
%57 = OpLoad %float %56
%59 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_5
%60 = OpLoad %float %59
%62 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_6
%63 = OpLoad %float %62
%65 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_7
%66 = OpLoad %float %65
%68 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_8
%69 = OpLoad %float %68
%71 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_9
%72 = OpLoad %float %71
%74 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_10
%75 = OpLoad %float %74
%77 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_11
%78 = OpLoad %float %77
%80 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_12
%81 = OpLoad %float %80
%83 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_13
%84 = OpLoad %float %83
%86 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_14
%87 = OpLoad %float %86
%89 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_15
%90 = OpLoad %float %89
%92 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_16
%93 = OpLoad %float %92
%94 = OpCompositeConstruct %v4float %48 %51 %54 %57
%95 = OpCompositeConstruct %v4float %60 %63 %66 %69
%96 = OpCompositeConstruct %v4float %72 %75 %78 %81
%97 = OpCompositeConstruct %v4float %84 %87 %90 %93
%98 = OpCompositeConstruct %mat4v4float %94 %95 %96 %97
OpStore %m %98
%99 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1
%100 = OpLoad %float %99
%101 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_2
%102 = OpLoad %float %101
%103 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_3
%104 = OpLoad %float %103
%105 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_4
%106 = OpLoad %float %105
%107 = OpCompositeConstruct %v4float %100 %102 %104 %106
OpStore %v %107
%108 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1
%109 = OpLoad %float %108
OpStore %f %109
%111 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0
%112 = OpLoad %int %111
OpStore %a %112
OpBranch %113
%113 = OpLabel
OpLoopMerge %114 %115 None
OpBranch %116
%116 = OpLabel
%117 = OpLoad %int %x_GLF_global_loop_count
%118 = OpSLessThan %bool %117 %int_10
OpSelectionMerge %120 None
OpBranchConditional %118 %121 %122
%121 = OpLabel
OpBranch %120
%122 = OpLabel
OpBranch %114
%120 = OpLabel
%123 = OpLoad %int %x_GLF_global_loop_count
%124 = OpIAdd %int %123 %int_1
OpStore %x_GLF_global_loop_count %124
%125 = OpLoad %int %a
%126 = OpExtInst %int %127 SClamp %125 %int_0 %int_3
%128 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1
%129 = OpLoad %float %128
%130 = OpAccessChain %_ptr_Function_float %v %126
%131 = OpLoad %float %130
%132 = OpAccessChain %_ptr_Function_float %v %126
%133 = OpFAdd %float %131 %129
OpStore %132 %133
%134 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_2
%135 = OpLoad %int %134
OpStore %b %135
OpBranch %136
%136 = OpLabel
OpLoopMerge %137 %138 None
OpBranch %139
%139 = OpLabel
%140 = OpLoad %int %x_GLF_global_loop_count
%141 = OpSLessThan %bool %140 %int_10
OpSelectionMerge %142 None
OpBranchConditional %141 %143 %144
%143 = OpLabel
OpBranch %142
%144 = OpLabel
OpBranch %137
%142 = OpLabel
%145 = OpLoad %int %x_GLF_global_loop_count
%146 = OpIAdd %int %145 %int_1
OpStore %x_GLF_global_loop_count %146
%147 = OpLoad %int %b
%148 = OpExtInst %int %127 SClamp %147 %int_0 %int_3
%149 = OpAccessChain %_ptr_Function_float %v %148
%150 = OpLoad %float %149
%151 = OpLoad %int %b
%152 = OpLoad %int %a
%153 = OpExtInst %int %127 SClamp %151 %int_0 %int_3
%154 = OpAccessChain %_ptr_Function_float %m %153 %152
%155 = OpLoad %float %154
%156 = OpLoad %float %f
%157 = OpFMul %float %150 %155
%158 = OpFAdd %float %156 %157
OpStore %f %158
OpBranch %138
%138 = OpLabel
%159 = OpLoad %int %b
%160 = OpISub %int %159 %int_1
OpStore %b %160
OpBranch %136
%137 = OpLabel
%161 = OpLoad %int %a
%162 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1
%163 = OpLoad %float %162
%164 = OpExtInst %int %127 SClamp %161 %int_0 %int_3
%165 = OpAccessChain %_ptr_Function_float %m %int_1 %164
OpStore %165 %163
%166 = OpAccessChain %_ptr_Uniform_int %x_15 %uint_0
%167 = OpLoad %int %166
%168 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0
%169 = OpLoad %int %168
%170 = OpIEqual %bool %167 %169
OpSelectionMerge %171 None
OpBranchConditional %170 %172 %171
%172 = OpLabel
OpKill
%171 = OpLabel
%173 = OpAccessChain %_ptr_Uniform_int %x_15 %uint_0
%174 = OpLoad %int %173
%175 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_1
%176 = OpLoad %int %175
%177 = OpIEqual %bool %174 %176
OpSelectionMerge %178 None
OpBranchConditional %177 %179 %178
%179 = OpLabel
OpKill
%178 = OpLabel
OpBranch %115
%115 = OpLabel
%180 = OpLoad %int %a
%181 = OpIAdd %int %180 %int_1
OpStore %a %181
OpBranch %113
%114 = OpLabel
%182 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0
%183 = OpLoad %float %182
OpStore %zero %183
%184 = OpLoad %float %f
%186 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_17
%187 = OpLoad %float %186
%189 = OpFOrdEqual %bool %184 %187
%188 = OpLogicalNot %bool %189
OpSelectionMerge %190 None
OpBranchConditional %188 %191 %190
%191 = OpLabel
%192 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1
%193 = OpLoad %float %192
OpStore %zero %193
OpBranch %190
%190 = OpLabel
%194 = OpLoad %float %f
%195 = OpLoad %float %zero
%196 = OpAccessChain %_ptr_Uniform_int %x_12 %uint_0 %int_0
%197 = OpLoad %int %196
%198 = OpLoad %float %f
%199 = OpConvertSToF %float %197
%200 = OpCompositeConstruct %v4float %194 %195 %199 %198
OpStore %x_GLF_color %200
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %201
%tint_symbol = OpFunctionParameter %main_out
%205 = OpLabel
%206 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %206
OpReturn
OpFunctionEnd
%main = OpFunction %void None %26
%208 = OpLabel
%209 = OpFunctionCall %void %main_1
%211 = OpLoad %v4float %x_GLF_color
%212 = OpCompositeConstruct %main_out %211
%210 = OpFunctionCall %void %tint_symbol_2 %212
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,144 @@
type Arr = [[stride(16)]] array<f32, 18>;
[[block]]
struct buf1 {
x_GLF_uniform_float_values : Arr;
};
type Arr_1 = [[stride(16)]] array<i32, 4>;
[[block]]
struct buf0 {
x_GLF_uniform_int_values : Arr_1;
};
[[block]]
struct buf2 {
one : i32;
};
var<private> x_GLF_global_loop_count : i32;
[[group(0), binding(1)]] var<uniform> x_7 : buf1;
[[group(0), binding(0)]] var<uniform> x_12 : buf0;
[[group(0), binding(2)]] var<uniform> x_15 : buf2;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var m : mat4x4<f32>;
var v : vec4<f32>;
var f : f32;
var a : i32;
var b : i32;
var zero : f32;
x_GLF_global_loop_count = 0;
let x_62 : f32 = x_7.x_GLF_uniform_float_values[1];
let x_64 : f32 = x_7.x_GLF_uniform_float_values[2];
let x_66 : f32 = x_7.x_GLF_uniform_float_values[3];
let x_68 : f32 = x_7.x_GLF_uniform_float_values[4];
let x_70 : f32 = x_7.x_GLF_uniform_float_values[5];
let x_72 : f32 = x_7.x_GLF_uniform_float_values[6];
let x_74 : f32 = x_7.x_GLF_uniform_float_values[7];
let x_76 : f32 = x_7.x_GLF_uniform_float_values[8];
let x_78 : f32 = x_7.x_GLF_uniform_float_values[9];
let x_80 : f32 = x_7.x_GLF_uniform_float_values[10];
let x_82 : f32 = x_7.x_GLF_uniform_float_values[11];
let x_84 : f32 = x_7.x_GLF_uniform_float_values[12];
let x_86 : f32 = x_7.x_GLF_uniform_float_values[13];
let x_88 : f32 = x_7.x_GLF_uniform_float_values[14];
let x_90 : f32 = x_7.x_GLF_uniform_float_values[15];
let x_92 : f32 = x_7.x_GLF_uniform_float_values[16];
m = mat4x4<f32>(vec4<f32>(x_62, x_64, x_66, x_68), vec4<f32>(x_70, x_72, x_74, x_76), vec4<f32>(x_78, x_80, x_82, x_84), vec4<f32>(x_86, x_88, x_90, x_92));
let x_99 : f32 = x_7.x_GLF_uniform_float_values[1];
let x_101 : f32 = x_7.x_GLF_uniform_float_values[2];
let x_103 : f32 = x_7.x_GLF_uniform_float_values[3];
let x_105 : f32 = x_7.x_GLF_uniform_float_values[4];
v = vec4<f32>(x_99, x_101, x_103, x_105);
let x_108 : f32 = x_7.x_GLF_uniform_float_values[1];
f = x_108;
let x_110 : i32 = x_12.x_GLF_uniform_int_values[0];
a = x_110;
loop {
let x_115 : i32 = x_GLF_global_loop_count;
if ((x_115 < 10)) {
} else {
break;
}
let x_118 : i32 = x_GLF_global_loop_count;
x_GLF_global_loop_count = (x_118 + 1);
let x_120 : i32 = a;
let x_121 : i32 = clamp(x_120, 0, 3);
let x_123 : f32 = x_7.x_GLF_uniform_float_values[1];
let x_125 : f32 = v[x_121];
v[x_121] = (x_125 + x_123);
let x_129 : i32 = x_12.x_GLF_uniform_int_values[2];
b = x_129;
loop {
let x_134 : i32 = x_GLF_global_loop_count;
if ((x_134 < 10)) {
} else {
break;
}
let x_137 : i32 = x_GLF_global_loop_count;
x_GLF_global_loop_count = (x_137 + 1);
let x_139 : i32 = b;
let x_142 : f32 = v[clamp(x_139, 0, 3)];
let x_143 : i32 = b;
let x_145 : i32 = a;
let x_147 : f32 = m[clamp(x_143, 0, 3)][x_145];
let x_149 : f32 = f;
f = (x_149 + (x_142 * x_147));
continuing {
let x_151 : i32 = b;
b = (x_151 - 1);
}
}
let x_153 : i32 = a;
let x_156 : f32 = x_7.x_GLF_uniform_float_values[1];
m[1][clamp(x_153, 0, 3)] = x_156;
let x_159 : i32 = x_15.one;
let x_161 : i32 = x_12.x_GLF_uniform_int_values[0];
if ((x_159 == x_161)) {
discard;
}
let x_166 : i32 = x_15.one;
let x_168 : i32 = x_12.x_GLF_uniform_int_values[1];
if ((x_166 == x_168)) {
discard;
}
continuing {
let x_172 : i32 = a;
a = (x_172 + 1);
}
}
let x_175 : f32 = x_7.x_GLF_uniform_float_values[0];
zero = x_175;
let x_176 : f32 = f;
let x_178 : f32 = x_7.x_GLF_uniform_float_values[17];
if (!((x_176 == x_178))) {
let x_183 : f32 = x_7.x_GLF_uniform_float_values[1];
zero = x_183;
}
let x_184 : f32 = f;
let x_185 : f32 = zero;
let x_187 : i32 = x_12.x_GLF_uniform_int_values[0];
let x_189 : f32 = f;
x_GLF_color = vec4<f32>(x_184, x_185, f32(x_187), x_189);
return;
}
struct main_out {
[[location(0)]]
x_GLF_color_1 : vec4<f32>;
};
[[stage(fragment)]]
fn main() -> main_out {
main_1();
return main_out(x_GLF_color);
}