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,175 @@
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 %func_i1_ "func(i1;"
OpName %x "x"
OpName %a "a"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "_GLF_uniform_int_values"
OpName %_ ""
OpName %i "i"
OpName %indexable "indexable"
OpName %a_0 "a"
OpName %param "param"
OpName %param_0 "param"
OpName %_GLF_color "_GLF_color"
OpDecorate %_arr_int_uint_5 ArrayStride 16
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %buf0 Block
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
OpDecorate %_GLF_color Location 0
%void = OpTypeVoid
%16 = OpTypeFunction %void
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%19 = OpTypeFunction %int %_ptr_Function_int
%uint = OpTypeInt 32 0
%uint_5 = OpConstant %uint 5
%_arr_int_uint_5 = OpTypeArray %int %uint_5
%buf0 = OpTypeStruct %_arr_int_uint_5
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%_ = OpVariable %_ptr_Uniform_buf0 Uniform
%int_0 = OpConstant %int 0
%_ptr_Uniform_int = OpTypePointer Uniform %int
%int_1 = OpConstant %int 1
%bool = OpTypeBool
%int_3 = OpConstant %int 3
%uint_4 = OpConstant %uint 4
%_arr_int_uint_4 = OpTypeArray %int %uint_4
%_ptr_Function__arr_int_uint_4 = OpTypePointer Function %_arr_int_uint_4
%true = OpConstantTrue %bool
%int_4 = OpConstant %int 4
%int_2 = OpConstant %int 2
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_GLF_color = OpVariable %_ptr_Output_v4float Output
%main = OpFunction %void None %16
%37 = OpLabel
%a_0 = OpVariable %_ptr_Function_int Function
%param = OpVariable %_ptr_Function_int Function
%param_0 = OpVariable %_ptr_Function_int Function
%38 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
%39 = OpLoad %int %38
OpStore %param %39
%40 = OpFunctionCall %int %func_i1_ %param
OpStore %a_0 %40
%41 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3
%42 = OpLoad %int %41
OpStore %param_0 %42
%43 = OpFunctionCall %int %func_i1_ %param_0
%44 = OpLoad %int %a_0
%45 = OpIAdd %int %44 %43
OpStore %a_0 %45
%46 = OpLoad %int %a_0
%47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2
%48 = OpLoad %int %47
%49 = OpIEqual %bool %46 %48
OpSelectionMerge %50 None
OpBranchConditional %49 %51 %52
%51 = OpLabel
%53 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3
%54 = OpLoad %int %53
%55 = OpConvertSToF %float %54
%56 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
%57 = OpLoad %int %56
%58 = OpConvertSToF %float %57
%59 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
%60 = OpLoad %int %59
%61 = OpConvertSToF %float %60
%62 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3
%63 = OpLoad %int %62
%64 = OpConvertSToF %float %63
%65 = OpCompositeConstruct %v4float %55 %58 %61 %64
OpStore %_GLF_color %65
OpBranch %50
%52 = OpLabel
%66 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
%67 = OpLoad %int %66
%68 = OpConvertSToF %float %67
%69 = OpCompositeConstruct %v4float %68 %68 %68 %68
OpStore %_GLF_color %69
OpBranch %50
%50 = OpLabel
OpReturn
OpFunctionEnd
%func_i1_ = OpFunction %int None %19
%x = OpFunctionParameter %_ptr_Function_int
%70 = OpLabel
%a = OpVariable %_ptr_Function_int Function
%i = OpVariable %_ptr_Function_int Function
%indexable = OpVariable %_ptr_Function__arr_int_uint_4 Function
%71 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
%72 = OpLoad %int %71
OpStore %a %72
%73 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
%74 = OpLoad %int %73
OpStore %i %74
OpBranch %75
%75 = OpLabel
OpLoopMerge %76 %77 None
OpBranch %78
%78 = OpLabel
%79 = OpLoad %int %i
%80 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
%81 = OpLoad %int %80
%82 = OpSLessThan %bool %79 %81
OpBranchConditional %82 %83 %76
%83 = OpLabel
%84 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3
%85 = OpLoad %int %84
%86 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3
%87 = OpLoad %int %86
%88 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3
%89 = OpLoad %int %88
%90 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3
%91 = OpLoad %int %90
%92 = OpCompositeConstruct %_arr_int_uint_4 %85 %87 %89 %91
%93 = OpLoad %int %a
OpStore %indexable %92
%94 = OpAccessChain %_ptr_Function_int %indexable %93
%95 = OpLoad %int %94
%96 = OpLoad %int %x
%97 = OpSGreaterThan %bool %95 %96
OpSelectionMerge %98 None
OpBranchConditional %97 %99 %100
%99 = OpLabel
OpSelectionMerge %101 None
OpBranchConditional %true %102 %103
%102 = OpLabel
%104 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3
%105 = OpLoad %int %104
OpReturnValue %105
%103 = OpLabel
%106 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3
%107 = OpLoad %int %106
OpStore %a %107
OpBranch %101
%101 = OpLabel
OpBranch %98
%100 = OpLabel
OpSelectionMerge %108 None
OpBranchConditional %true %109 %108
%109 = OpLabel
%110 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4
%111 = OpLoad %int %110
OpReturnValue %111
%108 = OpLabel
OpBranch %98
%98 = OpLabel
OpBranch %77
%77 = OpLabel
%112 = OpLoad %int %i
%113 = OpIAdd %int %112 %int_1
OpStore %i %113
OpBranch %75
%76 = OpLabel
%114 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
%115 = OpLoad %int %114
OpReturnValue %115
OpFunctionEnd

View File

@@ -0,0 +1,99 @@
cbuffer cbuffer_x_8 : register(b0, space0) {
uint4 x_8[5];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
int func_i1_(inout int x) {
int a = 0;
int i = 0;
int indexable[4] = (int[4])0;
const uint scalar_offset = ((16u * uint(0))) / 4;
const int x_72 = asint(x_8[scalar_offset / 4][scalar_offset % 4]);
a = x_72;
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
const int x_74 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]);
i = x_74;
while (true) {
const int x_79 = i;
const int x_81 = asint(x_8[1].x);
if ((x_79 < x_81)) {
} else {
break;
}
const int x_85 = asint(x_8[3].x);
const int x_87 = asint(x_8[3].x);
const int x_89 = asint(x_8[3].x);
const int x_91 = asint(x_8[3].x);
const int x_93 = a;
const int tint_symbol_3[4] = {x_85, x_87, x_89, x_91};
indexable = tint_symbol_3;
const int x_95 = indexable[x_93];
const int x_96 = x;
if ((x_95 > x_96)) {
if (true) {
const int x_105 = asint(x_8[3].x);
return x_105;
} else {
const int x_107 = asint(x_8[3].x);
a = x_107;
}
} else {
if (true) {
const int x_111 = asint(x_8[4].x);
return x_111;
}
}
{
i = (i + 1);
}
}
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
const int x_115 = asint(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]);
return x_115;
}
void main_1() {
int a_1 = 0;
int param = 0;
int param_1 = 0;
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
const int x_39 = asint(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]);
param = x_39;
const int x_40 = func_i1_(param);
a_1 = x_40;
const int x_42 = asint(x_8[3].x);
param_1 = x_42;
const int x_43 = func_i1_(param_1);
a_1 = (a_1 + x_43);
const int x_46 = a_1;
const int x_48 = asint(x_8[2].x);
if ((x_46 == x_48)) {
const int x_54 = asint(x_8[3].x);
const uint scalar_offset_4 = ((16u * uint(0))) / 4;
const int x_57 = asint(x_8[scalar_offset_4 / 4][scalar_offset_4 % 4]);
const uint scalar_offset_5 = ((16u * uint(0))) / 4;
const int x_60 = asint(x_8[scalar_offset_5 / 4][scalar_offset_5 % 4]);
const int x_63 = asint(x_8[3].x);
x_GLF_color = float4(float(x_54), float(x_57), float(x_60), float(x_63));
} else {
const uint scalar_offset_6 = ((16u * uint(0))) / 4;
const int x_67 = asint(x_8[scalar_offset_6 / 4][scalar_offset_6 % 4]);
const float x_68 = float(x_67);
x_GLF_color = float4(x_68, x_68, x_68, x_68);
}
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_4 = {tint_symbol_1.x_GLF_color_1};
return tint_symbol_4;
}

View File

@@ -0,0 +1,107 @@
#include <metal_stdlib>
using namespace metal;
struct tint_padded_array_element {
/* 0x0000 */ int el;
/* 0x0004 */ int8_t tint_pad[12];
};
struct tint_array_wrapper {
/* 0x0000 */ tint_padded_array_element arr[5];
};
struct buf0 {
/* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values;
};
struct tint_array_wrapper_1 {
int arr[4];
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
int func_i1_(constant buf0& x_8, thread int* const x) {
int a = 0;
int i = 0;
tint_array_wrapper_1 indexable = {};
int const x_72 = x_8.x_GLF_uniform_int_values.arr[0].el;
a = x_72;
int const x_74 = x_8.x_GLF_uniform_int_values.arr[0].el;
i = x_74;
while (true) {
int const x_79 = i;
int const x_81 = x_8.x_GLF_uniform_int_values.arr[1].el;
if ((x_79 < x_81)) {
} else {
break;
}
int const x_85 = x_8.x_GLF_uniform_int_values.arr[3].el;
int const x_87 = x_8.x_GLF_uniform_int_values.arr[3].el;
int const x_89 = x_8.x_GLF_uniform_int_values.arr[3].el;
int const x_91 = x_8.x_GLF_uniform_int_values.arr[3].el;
int const x_93 = a;
tint_array_wrapper_1 const tint_symbol_3 = {.arr={x_85, x_87, x_89, x_91}};
indexable = tint_symbol_3;
int const x_95 = indexable.arr[x_93];
int const x_96 = *(x);
if ((x_95 > x_96)) {
if (true) {
int const x_105 = x_8.x_GLF_uniform_int_values.arr[3].el;
return x_105;
} else {
int const x_107 = x_8.x_GLF_uniform_int_values.arr[3].el;
a = x_107;
}
} else {
if (true) {
int const x_111 = x_8.x_GLF_uniform_int_values.arr[4].el;
return x_111;
}
}
{
int const x_112 = i;
i = (x_112 + 1);
}
}
int const x_115 = x_8.x_GLF_uniform_int_values.arr[0].el;
return x_115;
}
void main_1(constant buf0& x_8, thread float4* const tint_symbol_5) {
int a_1 = 0;
int param = 0;
int param_1 = 0;
int const x_39 = x_8.x_GLF_uniform_int_values.arr[0].el;
param = x_39;
int const x_40 = func_i1_(x_8, &(param));
a_1 = x_40;
int const x_42 = x_8.x_GLF_uniform_int_values.arr[3].el;
param_1 = x_42;
int const x_43 = func_i1_(x_8, &(param_1));
int const x_44 = a_1;
a_1 = (x_44 + x_43);
int const x_46 = a_1;
int const x_48 = x_8.x_GLF_uniform_int_values.arr[2].el;
if ((x_46 == x_48)) {
int const x_54 = x_8.x_GLF_uniform_int_values.arr[3].el;
int const x_57 = x_8.x_GLF_uniform_int_values.arr[0].el;
int const x_60 = x_8.x_GLF_uniform_int_values.arr[0].el;
int const x_63 = x_8.x_GLF_uniform_int_values.arr[3].el;
*(tint_symbol_5) = float4(float(x_54), float(x_57), float(x_60), float(x_63));
} else {
int const x_67 = x_8.x_GLF_uniform_int_values.arr[0].el;
float const x_68 = float(x_67);
*(tint_symbol_5) = float4(x_68, x_68, x_68, x_68);
}
return;
}
fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) {
thread float4 tint_symbol_6 = 0.0f;
main_1(x_8, &(tint_symbol_6));
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6};
tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
return tint_symbol_4;
}

View File

@@ -0,0 +1,215 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 138
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %buf0 "buf0"
OpMemberName %buf0 0 "x_GLF_uniform_int_values"
OpName %x_8 "x_8"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %func_i1_ "func_i1_"
OpName %x "x"
OpName %a "a"
OpName %i "i"
OpName %indexable "indexable"
OpName %main_1 "main_1"
OpName %a_1 "a_1"
OpName %param "param"
OpName %param_1 "param_1"
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 %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %_arr_int_uint_5 ArrayStride 16
OpDecorate %x_8 NonWritable
OpDecorate %x_8 DescriptorSet 0
OpDecorate %x_8 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpDecorate %_arr_int_uint_4 ArrayStride 4
OpMemberDecorate %main_out 0 Offset 0
%int = OpTypeInt 32 1
%uint = OpTypeInt 32 0
%uint_5 = OpConstant %uint 5
%_arr_int_uint_5 = OpTypeArray %int %uint_5
%buf0 = OpTypeStruct %_arr_int_uint_5
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_8 = OpVariable %_ptr_Uniform_buf0 Uniform
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%12 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12
%_ptr_Function_int = OpTypePointer Function %int
%15 = OpTypeFunction %int %_ptr_Function_int
%21 = OpConstantNull %int
%uint_4 = OpConstant %uint 4
%_arr_int_uint_4 = OpTypeArray %int %uint_4
%_ptr_Function__arr_int_uint_4 = OpTypePointer Function %_arr_int_uint_4
%27 = OpConstantNull %_arr_int_uint_4
%uint_0 = OpConstant %uint 0
%int_0 = OpConstant %int 0
%_ptr_Uniform_int = OpTypePointer Uniform %int
%int_1 = OpConstant %int 1
%bool = OpTypeBool
%int_3 = OpConstant %int 3
%true = OpConstantTrue %bool
%int_4 = OpConstant %int 4
%void = OpTypeVoid
%84 = OpTypeFunction %void
%int_2 = OpConstant %int 2
%main_out = OpTypeStruct %v4float
%126 = OpTypeFunction %void %main_out
%func_i1_ = OpFunction %int None %15
%x = OpFunctionParameter %_ptr_Function_int
%19 = OpLabel
%a = OpVariable %_ptr_Function_int Function %21
%i = OpVariable %_ptr_Function_int Function %21
%indexable = OpVariable %_ptr_Function__arr_int_uint_4 Function %27
%31 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
%32 = OpLoad %int %31
OpStore %a %32
%33 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
%34 = OpLoad %int %33
OpStore %i %34
OpBranch %35
%35 = OpLabel
OpLoopMerge %36 %37 None
OpBranch %38
%38 = OpLabel
%39 = OpLoad %int %i
%41 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1
%42 = OpLoad %int %41
%43 = OpSLessThan %bool %39 %42
OpSelectionMerge %45 None
OpBranchConditional %43 %46 %47
%46 = OpLabel
OpBranch %45
%47 = OpLabel
OpBranch %36
%45 = OpLabel
%49 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3
%50 = OpLoad %int %49
%51 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3
%52 = OpLoad %int %51
%53 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3
%54 = OpLoad %int %53
%55 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3
%56 = OpLoad %int %55
%57 = OpLoad %int %a
%58 = OpCompositeConstruct %_arr_int_uint_4 %50 %52 %54 %56
OpStore %indexable %58
%59 = OpAccessChain %_ptr_Function_int %indexable %57
%60 = OpLoad %int %59
%62 = OpLoad %int %x
%63 = OpSGreaterThan %bool %60 %62
OpSelectionMerge %64 None
OpBranchConditional %63 %65 %66
%65 = OpLabel
OpSelectionMerge %68 None
OpBranchConditional %true %69 %70
%69 = OpLabel
%71 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3
%72 = OpLoad %int %71
OpReturnValue %72
%70 = OpLabel
%73 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3
%74 = OpLoad %int %73
OpStore %a %74
OpBranch %68
%68 = OpLabel
OpBranch %64
%66 = OpLabel
OpSelectionMerge %75 None
OpBranchConditional %true %76 %75
%76 = OpLabel
%78 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_4
%79 = OpLoad %int %78
OpReturnValue %79
%75 = OpLabel
OpBranch %64
%64 = OpLabel
OpBranch %37
%37 = OpLabel
%80 = OpLoad %int %i
%81 = OpIAdd %int %80 %int_1
OpStore %i %81
OpBranch %35
%36 = OpLabel
%82 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
%83 = OpLoad %int %82
OpReturnValue %83
OpFunctionEnd
%main_1 = OpFunction %void None %84
%87 = OpLabel
%a_1 = OpVariable %_ptr_Function_int Function %21
%param = OpVariable %_ptr_Function_int Function %21
%param_1 = OpVariable %_ptr_Function_int Function %21
%91 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
%92 = OpLoad %int %91
OpStore %param %92
%93 = OpFunctionCall %int %func_i1_ %param
OpStore %a_1 %93
%95 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3
%96 = OpLoad %int %95
OpStore %param_1 %96
%97 = OpFunctionCall %int %func_i1_ %param_1
%99 = OpLoad %int %a_1
%100 = OpIAdd %int %99 %97
OpStore %a_1 %100
%101 = OpLoad %int %a_1
%103 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2
%104 = OpLoad %int %103
%105 = OpIEqual %bool %101 %104
OpSelectionMerge %106 None
OpBranchConditional %105 %107 %108
%107 = OpLabel
%109 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3
%110 = OpLoad %int %109
%111 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
%112 = OpLoad %int %111
%113 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
%114 = OpLoad %int %113
%115 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3
%116 = OpLoad %int %115
%117 = OpConvertSToF %float %110
%118 = OpConvertSToF %float %112
%119 = OpConvertSToF %float %114
%120 = OpConvertSToF %float %116
%121 = OpCompositeConstruct %v4float %117 %118 %119 %120
OpStore %x_GLF_color %121
OpBranch %106
%108 = OpLabel
%122 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
%123 = OpLoad %int %122
%124 = OpConvertSToF %float %123
%125 = OpCompositeConstruct %v4float %124 %124 %124 %124
OpStore %x_GLF_color %125
OpBranch %106
%106 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %126
%tint_symbol = OpFunctionParameter %main_out
%130 = OpLabel
%131 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %131
OpReturn
OpFunctionEnd
%main = OpFunction %void None %84
%133 = OpLabel
%134 = OpFunctionCall %void %main_1
%136 = OpLoad %v4float %x_GLF_color
%137 = OpCompositeConstruct %main_out %136
%135 = OpFunctionCall %void %tint_symbol_2 %137
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,97 @@
type Arr = [[stride(16)]] array<i32, 5>;
[[block]]
struct buf0 {
x_GLF_uniform_int_values : Arr;
};
[[group(0), binding(0)]] var<uniform> x_8 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn func_i1_(x : ptr<function, i32>) -> i32 {
var a : i32;
var i : i32;
var indexable : array<i32, 4>;
let x_72 : i32 = x_8.x_GLF_uniform_int_values[0];
a = x_72;
let x_74 : i32 = x_8.x_GLF_uniform_int_values[0];
i = x_74;
loop {
let x_79 : i32 = i;
let x_81 : i32 = x_8.x_GLF_uniform_int_values[1];
if ((x_79 < x_81)) {
} else {
break;
}
let x_85 : i32 = x_8.x_GLF_uniform_int_values[3];
let x_87 : i32 = x_8.x_GLF_uniform_int_values[3];
let x_89 : i32 = x_8.x_GLF_uniform_int_values[3];
let x_91 : i32 = x_8.x_GLF_uniform_int_values[3];
let x_93 : i32 = a;
indexable = array<i32, 4>(x_85, x_87, x_89, x_91);
let x_95 : i32 = indexable[x_93];
let x_96 : i32 = *(x);
if ((x_95 > x_96)) {
if (true) {
let x_105 : i32 = x_8.x_GLF_uniform_int_values[3];
return x_105;
} else {
let x_107 : i32 = x_8.x_GLF_uniform_int_values[3];
a = x_107;
}
} else {
if (true) {
let x_111 : i32 = x_8.x_GLF_uniform_int_values[4];
return x_111;
}
}
continuing {
let x_112 : i32 = i;
i = (x_112 + 1);
}
}
let x_115 : i32 = x_8.x_GLF_uniform_int_values[0];
return x_115;
}
fn main_1() {
var a_1 : i32;
var param : i32;
var param_1 : i32;
let x_39 : i32 = x_8.x_GLF_uniform_int_values[0];
param = x_39;
let x_40 : i32 = func_i1_(&(param));
a_1 = x_40;
let x_42 : i32 = x_8.x_GLF_uniform_int_values[3];
param_1 = x_42;
let x_43 : i32 = func_i1_(&(param_1));
let x_44 : i32 = a_1;
a_1 = (x_44 + x_43);
let x_46 : i32 = a_1;
let x_48 : i32 = x_8.x_GLF_uniform_int_values[2];
if ((x_46 == x_48)) {
let x_54 : i32 = x_8.x_GLF_uniform_int_values[3];
let x_57 : i32 = x_8.x_GLF_uniform_int_values[0];
let x_60 : i32 = x_8.x_GLF_uniform_int_values[0];
let x_63 : i32 = x_8.x_GLF_uniform_int_values[3];
x_GLF_color = vec4<f32>(f32(x_54), f32(x_57), f32(x_60), f32(x_63));
} else {
let x_67 : i32 = x_8.x_GLF_uniform_int_values[0];
let x_68 : f32 = f32(x_67);
x_GLF_color = vec4<f32>(x_68, x_68, x_68, x_68);
}
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,97 @@
type Arr = [[stride(16)]] array<i32, 5>;
[[block]]
struct buf0 {
x_GLF_uniform_int_values : Arr;
};
[[group(0), binding(0)]] var<uniform> x_8 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn func_i1_(x : ptr<function, i32>) -> i32 {
var a : i32;
var i : i32;
var indexable : array<i32, 4>;
let x_72 : i32 = x_8.x_GLF_uniform_int_values[0];
a = x_72;
let x_74 : i32 = x_8.x_GLF_uniform_int_values[0];
i = x_74;
loop {
let x_79 : i32 = i;
let x_81 : i32 = x_8.x_GLF_uniform_int_values[1];
if ((x_79 < x_81)) {
} else {
break;
}
let x_85 : i32 = x_8.x_GLF_uniform_int_values[3];
let x_87 : i32 = x_8.x_GLF_uniform_int_values[3];
let x_89 : i32 = x_8.x_GLF_uniform_int_values[3];
let x_91 : i32 = x_8.x_GLF_uniform_int_values[3];
let x_93 : i32 = a;
indexable = array<i32, 4>(x_85, x_87, x_89, x_91);
let x_95 : i32 = indexable[x_93];
let x_96 : i32 = *(x);
if ((x_95 > x_96)) {
if (true) {
let x_105 : i32 = x_8.x_GLF_uniform_int_values[3];
return x_105;
} else {
let x_107 : i32 = x_8.x_GLF_uniform_int_values[3];
a = x_107;
}
} else {
if (true) {
let x_111 : i32 = x_8.x_GLF_uniform_int_values[4];
return x_111;
}
}
continuing {
let x_112 : i32 = i;
i = (x_112 + 1);
}
}
let x_115 : i32 = x_8.x_GLF_uniform_int_values[0];
return x_115;
}
fn main_1() {
var a_1 : i32;
var param : i32;
var param_1 : i32;
let x_39 : i32 = x_8.x_GLF_uniform_int_values[0];
param = x_39;
let x_40 : i32 = func_i1_(&(param));
a_1 = x_40;
let x_42 : i32 = x_8.x_GLF_uniform_int_values[3];
param_1 = x_42;
let x_43 : i32 = func_i1_(&(param_1));
let x_44 : i32 = a_1;
a_1 = (x_44 + x_43);
let x_46 : i32 = a_1;
let x_48 : i32 = x_8.x_GLF_uniform_int_values[2];
if ((x_46 == x_48)) {
let x_54 : i32 = x_8.x_GLF_uniform_int_values[3];
let x_57 : i32 = x_8.x_GLF_uniform_int_values[0];
let x_60 : i32 = x_8.x_GLF_uniform_int_values[0];
let x_63 : i32 = x_8.x_GLF_uniform_int_values[3];
x_GLF_color = vec4<f32>(f32(x_54), f32(x_57), f32(x_60), f32(x_63));
} else {
let x_67 : i32 = x_8.x_GLF_uniform_int_values[0];
let x_68 : f32 = f32(x_67);
x_GLF_color = vec4<f32>(x_68, x_68, x_68, x_68);
}
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,99 @@
cbuffer cbuffer_x_8 : register(b0, space0) {
uint4 x_8[5];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
int func_i1_(inout int x) {
int a = 0;
int i = 0;
int indexable[4] = (int[4])0;
const uint scalar_offset = ((16u * uint(0))) / 4;
const int x_72 = asint(x_8[scalar_offset / 4][scalar_offset % 4]);
a = x_72;
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
const int x_74 = asint(x_8[scalar_offset_1 / 4][scalar_offset_1 % 4]);
i = x_74;
while (true) {
const int x_79 = i;
const int x_81 = asint(x_8[1].x);
if ((x_79 < x_81)) {
} else {
break;
}
const int x_85 = asint(x_8[3].x);
const int x_87 = asint(x_8[3].x);
const int x_89 = asint(x_8[3].x);
const int x_91 = asint(x_8[3].x);
const int x_93 = a;
const int tint_symbol_3[4] = {x_85, x_87, x_89, x_91};
indexable = tint_symbol_3;
const int x_95 = indexable[x_93];
const int x_96 = x;
if ((x_95 > x_96)) {
if (true) {
const int x_105 = asint(x_8[3].x);
return x_105;
} else {
const int x_107 = asint(x_8[3].x);
a = x_107;
}
} else {
if (true) {
const int x_111 = asint(x_8[4].x);
return x_111;
}
}
{
i = (i + 1);
}
}
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
const int x_115 = asint(x_8[scalar_offset_2 / 4][scalar_offset_2 % 4]);
return x_115;
}
void main_1() {
int a_1 = 0;
int param = 0;
int param_1 = 0;
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
const int x_39 = asint(x_8[scalar_offset_3 / 4][scalar_offset_3 % 4]);
param = x_39;
const int x_40 = func_i1_(param);
a_1 = x_40;
const int x_42 = asint(x_8[3].x);
param_1 = x_42;
const int x_43 = func_i1_(param_1);
a_1 = (a_1 + x_43);
const int x_46 = a_1;
const int x_48 = asint(x_8[2].x);
if ((x_46 == x_48)) {
const int x_54 = asint(x_8[3].x);
const uint scalar_offset_4 = ((16u * uint(0))) / 4;
const int x_57 = asint(x_8[scalar_offset_4 / 4][scalar_offset_4 % 4]);
const uint scalar_offset_5 = ((16u * uint(0))) / 4;
const int x_60 = asint(x_8[scalar_offset_5 / 4][scalar_offset_5 % 4]);
const int x_63 = asint(x_8[3].x);
x_GLF_color = float4(float(x_54), float(x_57), float(x_60), float(x_63));
} else {
const uint scalar_offset_6 = ((16u * uint(0))) / 4;
const int x_67 = asint(x_8[scalar_offset_6 / 4][scalar_offset_6 % 4]);
const float x_68 = float(x_67);
x_GLF_color = float4(x_68, x_68, x_68, x_68);
}
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_4 = {tint_symbol_1.x_GLF_color_1};
return tint_symbol_4;
}

View File

@@ -0,0 +1,107 @@
#include <metal_stdlib>
using namespace metal;
struct tint_padded_array_element {
/* 0x0000 */ int el;
/* 0x0004 */ int8_t tint_pad[12];
};
struct tint_array_wrapper {
/* 0x0000 */ tint_padded_array_element arr[5];
};
struct buf0 {
/* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values;
};
struct tint_array_wrapper_1 {
int arr[4];
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
int func_i1_(constant buf0& x_8, thread int* const x) {
int a = 0;
int i = 0;
tint_array_wrapper_1 indexable = {};
int const x_72 = x_8.x_GLF_uniform_int_values.arr[0].el;
a = x_72;
int const x_74 = x_8.x_GLF_uniform_int_values.arr[0].el;
i = x_74;
while (true) {
int const x_79 = i;
int const x_81 = x_8.x_GLF_uniform_int_values.arr[1].el;
if ((x_79 < x_81)) {
} else {
break;
}
int const x_85 = x_8.x_GLF_uniform_int_values.arr[3].el;
int const x_87 = x_8.x_GLF_uniform_int_values.arr[3].el;
int const x_89 = x_8.x_GLF_uniform_int_values.arr[3].el;
int const x_91 = x_8.x_GLF_uniform_int_values.arr[3].el;
int const x_93 = a;
tint_array_wrapper_1 const tint_symbol_3 = {.arr={x_85, x_87, x_89, x_91}};
indexable = tint_symbol_3;
int const x_95 = indexable.arr[x_93];
int const x_96 = *(x);
if ((x_95 > x_96)) {
if (true) {
int const x_105 = x_8.x_GLF_uniform_int_values.arr[3].el;
return x_105;
} else {
int const x_107 = x_8.x_GLF_uniform_int_values.arr[3].el;
a = x_107;
}
} else {
if (true) {
int const x_111 = x_8.x_GLF_uniform_int_values.arr[4].el;
return x_111;
}
}
{
int const x_112 = i;
i = (x_112 + 1);
}
}
int const x_115 = x_8.x_GLF_uniform_int_values.arr[0].el;
return x_115;
}
void main_1(constant buf0& x_8, thread float4* const tint_symbol_5) {
int a_1 = 0;
int param = 0;
int param_1 = 0;
int const x_39 = x_8.x_GLF_uniform_int_values.arr[0].el;
param = x_39;
int const x_40 = func_i1_(x_8, &(param));
a_1 = x_40;
int const x_42 = x_8.x_GLF_uniform_int_values.arr[3].el;
param_1 = x_42;
int const x_43 = func_i1_(x_8, &(param_1));
int const x_44 = a_1;
a_1 = (x_44 + x_43);
int const x_46 = a_1;
int const x_48 = x_8.x_GLF_uniform_int_values.arr[2].el;
if ((x_46 == x_48)) {
int const x_54 = x_8.x_GLF_uniform_int_values.arr[3].el;
int const x_57 = x_8.x_GLF_uniform_int_values.arr[0].el;
int const x_60 = x_8.x_GLF_uniform_int_values.arr[0].el;
int const x_63 = x_8.x_GLF_uniform_int_values.arr[3].el;
*(tint_symbol_5) = float4(float(x_54), float(x_57), float(x_60), float(x_63));
} else {
int const x_67 = x_8.x_GLF_uniform_int_values.arr[0].el;
float const x_68 = float(x_67);
*(tint_symbol_5) = float4(x_68, x_68, x_68, x_68);
}
return;
}
fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) {
thread float4 tint_symbol_6 = 0.0f;
main_1(x_8, &(tint_symbol_6));
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6};
tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
return tint_symbol_4;
}

View File

@@ -0,0 +1,215 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 138
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %buf0 "buf0"
OpMemberName %buf0 0 "x_GLF_uniform_int_values"
OpName %x_8 "x_8"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %func_i1_ "func_i1_"
OpName %x "x"
OpName %a "a"
OpName %i "i"
OpName %indexable "indexable"
OpName %main_1 "main_1"
OpName %a_1 "a_1"
OpName %param "param"
OpName %param_1 "param_1"
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 %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %_arr_int_uint_5 ArrayStride 16
OpDecorate %x_8 NonWritable
OpDecorate %x_8 DescriptorSet 0
OpDecorate %x_8 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpDecorate %_arr_int_uint_4 ArrayStride 4
OpMemberDecorate %main_out 0 Offset 0
%int = OpTypeInt 32 1
%uint = OpTypeInt 32 0
%uint_5 = OpConstant %uint 5
%_arr_int_uint_5 = OpTypeArray %int %uint_5
%buf0 = OpTypeStruct %_arr_int_uint_5
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_8 = OpVariable %_ptr_Uniform_buf0 Uniform
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%12 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12
%_ptr_Function_int = OpTypePointer Function %int
%15 = OpTypeFunction %int %_ptr_Function_int
%21 = OpConstantNull %int
%uint_4 = OpConstant %uint 4
%_arr_int_uint_4 = OpTypeArray %int %uint_4
%_ptr_Function__arr_int_uint_4 = OpTypePointer Function %_arr_int_uint_4
%27 = OpConstantNull %_arr_int_uint_4
%uint_0 = OpConstant %uint 0
%int_0 = OpConstant %int 0
%_ptr_Uniform_int = OpTypePointer Uniform %int
%int_1 = OpConstant %int 1
%bool = OpTypeBool
%int_3 = OpConstant %int 3
%true = OpConstantTrue %bool
%int_4 = OpConstant %int 4
%void = OpTypeVoid
%84 = OpTypeFunction %void
%int_2 = OpConstant %int 2
%main_out = OpTypeStruct %v4float
%126 = OpTypeFunction %void %main_out
%func_i1_ = OpFunction %int None %15
%x = OpFunctionParameter %_ptr_Function_int
%19 = OpLabel
%a = OpVariable %_ptr_Function_int Function %21
%i = OpVariable %_ptr_Function_int Function %21
%indexable = OpVariable %_ptr_Function__arr_int_uint_4 Function %27
%31 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
%32 = OpLoad %int %31
OpStore %a %32
%33 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
%34 = OpLoad %int %33
OpStore %i %34
OpBranch %35
%35 = OpLabel
OpLoopMerge %36 %37 None
OpBranch %38
%38 = OpLabel
%39 = OpLoad %int %i
%41 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_1
%42 = OpLoad %int %41
%43 = OpSLessThan %bool %39 %42
OpSelectionMerge %45 None
OpBranchConditional %43 %46 %47
%46 = OpLabel
OpBranch %45
%47 = OpLabel
OpBranch %36
%45 = OpLabel
%49 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3
%50 = OpLoad %int %49
%51 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3
%52 = OpLoad %int %51
%53 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3
%54 = OpLoad %int %53
%55 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3
%56 = OpLoad %int %55
%57 = OpLoad %int %a
%58 = OpCompositeConstruct %_arr_int_uint_4 %50 %52 %54 %56
OpStore %indexable %58
%59 = OpAccessChain %_ptr_Function_int %indexable %57
%60 = OpLoad %int %59
%62 = OpLoad %int %x
%63 = OpSGreaterThan %bool %60 %62
OpSelectionMerge %64 None
OpBranchConditional %63 %65 %66
%65 = OpLabel
OpSelectionMerge %68 None
OpBranchConditional %true %69 %70
%69 = OpLabel
%71 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3
%72 = OpLoad %int %71
OpReturnValue %72
%70 = OpLabel
%73 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3
%74 = OpLoad %int %73
OpStore %a %74
OpBranch %68
%68 = OpLabel
OpBranch %64
%66 = OpLabel
OpSelectionMerge %75 None
OpBranchConditional %true %76 %75
%76 = OpLabel
%78 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_4
%79 = OpLoad %int %78
OpReturnValue %79
%75 = OpLabel
OpBranch %64
%64 = OpLabel
OpBranch %37
%37 = OpLabel
%80 = OpLoad %int %i
%81 = OpIAdd %int %80 %int_1
OpStore %i %81
OpBranch %35
%36 = OpLabel
%82 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
%83 = OpLoad %int %82
OpReturnValue %83
OpFunctionEnd
%main_1 = OpFunction %void None %84
%87 = OpLabel
%a_1 = OpVariable %_ptr_Function_int Function %21
%param = OpVariable %_ptr_Function_int Function %21
%param_1 = OpVariable %_ptr_Function_int Function %21
%91 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
%92 = OpLoad %int %91
OpStore %param %92
%93 = OpFunctionCall %int %func_i1_ %param
OpStore %a_1 %93
%95 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3
%96 = OpLoad %int %95
OpStore %param_1 %96
%97 = OpFunctionCall %int %func_i1_ %param_1
%99 = OpLoad %int %a_1
%100 = OpIAdd %int %99 %97
OpStore %a_1 %100
%101 = OpLoad %int %a_1
%103 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_2
%104 = OpLoad %int %103
%105 = OpIEqual %bool %101 %104
OpSelectionMerge %106 None
OpBranchConditional %105 %107 %108
%107 = OpLabel
%109 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3
%110 = OpLoad %int %109
%111 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
%112 = OpLoad %int %111
%113 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
%114 = OpLoad %int %113
%115 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_3
%116 = OpLoad %int %115
%117 = OpConvertSToF %float %110
%118 = OpConvertSToF %float %112
%119 = OpConvertSToF %float %114
%120 = OpConvertSToF %float %116
%121 = OpCompositeConstruct %v4float %117 %118 %119 %120
OpStore %x_GLF_color %121
OpBranch %106
%108 = OpLabel
%122 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0 %int_0
%123 = OpLoad %int %122
%124 = OpConvertSToF %float %123
%125 = OpCompositeConstruct %v4float %124 %124 %124 %124
OpStore %x_GLF_color %125
OpBranch %106
%106 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %126
%tint_symbol = OpFunctionParameter %main_out
%130 = OpLabel
%131 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %131
OpReturn
OpFunctionEnd
%main = OpFunction %void None %84
%133 = OpLabel
%134 = OpFunctionCall %void %main_1
%136 = OpLoad %v4float %x_GLF_color
%137 = OpCompositeConstruct %main_out %136
%135 = OpFunctionCall %void %tint_symbol_2 %137
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,97 @@
type Arr = [[stride(16)]] array<i32, 5>;
[[block]]
struct buf0 {
x_GLF_uniform_int_values : Arr;
};
[[group(0), binding(0)]] var<uniform> x_8 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn func_i1_(x : ptr<function, i32>) -> i32 {
var a : i32;
var i : i32;
var indexable : array<i32, 4>;
let x_72 : i32 = x_8.x_GLF_uniform_int_values[0];
a = x_72;
let x_74 : i32 = x_8.x_GLF_uniform_int_values[0];
i = x_74;
loop {
let x_79 : i32 = i;
let x_81 : i32 = x_8.x_GLF_uniform_int_values[1];
if ((x_79 < x_81)) {
} else {
break;
}
let x_85 : i32 = x_8.x_GLF_uniform_int_values[3];
let x_87 : i32 = x_8.x_GLF_uniform_int_values[3];
let x_89 : i32 = x_8.x_GLF_uniform_int_values[3];
let x_91 : i32 = x_8.x_GLF_uniform_int_values[3];
let x_93 : i32 = a;
indexable = array<i32, 4>(x_85, x_87, x_89, x_91);
let x_95 : i32 = indexable[x_93];
let x_96 : i32 = *(x);
if ((x_95 > x_96)) {
if (true) {
let x_105 : i32 = x_8.x_GLF_uniform_int_values[3];
return x_105;
} else {
let x_107 : i32 = x_8.x_GLF_uniform_int_values[3];
a = x_107;
}
} else {
if (true) {
let x_111 : i32 = x_8.x_GLF_uniform_int_values[4];
return x_111;
}
}
continuing {
let x_112 : i32 = i;
i = (x_112 + 1);
}
}
let x_115 : i32 = x_8.x_GLF_uniform_int_values[0];
return x_115;
}
fn main_1() {
var a_1 : i32;
var param : i32;
var param_1 : i32;
let x_39 : i32 = x_8.x_GLF_uniform_int_values[0];
param = x_39;
let x_40 : i32 = func_i1_(&(param));
a_1 = x_40;
let x_42 : i32 = x_8.x_GLF_uniform_int_values[3];
param_1 = x_42;
let x_43 : i32 = func_i1_(&(param_1));
let x_44 : i32 = a_1;
a_1 = (x_44 + x_43);
let x_46 : i32 = a_1;
let x_48 : i32 = x_8.x_GLF_uniform_int_values[2];
if ((x_46 == x_48)) {
let x_54 : i32 = x_8.x_GLF_uniform_int_values[3];
let x_57 : i32 = x_8.x_GLF_uniform_int_values[0];
let x_60 : i32 = x_8.x_GLF_uniform_int_values[0];
let x_63 : i32 = x_8.x_GLF_uniform_int_values[3];
x_GLF_color = vec4<f32>(f32(x_54), f32(x_57), f32(x_60), f32(x_63));
} else {
let x_67 : i32 = x_8.x_GLF_uniform_int_values[0];
let x_68 : f32 = f32(x_67);
x_GLF_color = vec4<f32>(x_68, x_68, x_68, x_68);
}
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);
}