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,213 @@
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %_GLF_color
OpExecutionMode %main OriginUpperLeft
OpSource ESSL 310
OpName %main "main"
OpName %m43 "m43"
OpName %ll1 "ll1"
OpName %rows "rows"
OpName %_GLF_color "_GLF_color"
OpName %ll4 "ll4"
OpName %ll2 "ll2"
OpName %c "c"
OpName %tempm43 "tempm43"
OpName %ll3 "ll3"
OpName %d "d"
OpName %r "r"
OpName %sums "sums"
OpName %idx "idx"
OpDecorate %ll1 RelaxedPrecision
OpDecorate %rows RelaxedPrecision
OpDecorate %_GLF_color Location 0
OpDecorate %16 RelaxedPrecision
OpDecorate %17 RelaxedPrecision
OpDecorate %18 RelaxedPrecision
OpDecorate %ll4 RelaxedPrecision
OpDecorate %ll2 RelaxedPrecision
OpDecorate %c RelaxedPrecision
OpDecorate %19 RelaxedPrecision
OpDecorate %20 RelaxedPrecision
OpDecorate %21 RelaxedPrecision
OpDecorate %22 RelaxedPrecision
OpDecorate %ll3 RelaxedPrecision
OpDecorate %d RelaxedPrecision
OpDecorate %23 RelaxedPrecision
OpDecorate %24 RelaxedPrecision
OpDecorate %25 RelaxedPrecision
OpDecorate %26 RelaxedPrecision
OpDecorate %r RelaxedPrecision
OpDecorate %27 RelaxedPrecision
OpDecorate %28 RelaxedPrecision
OpDecorate %29 RelaxedPrecision
OpDecorate %30 RelaxedPrecision
OpDecorate %31 RelaxedPrecision
OpDecorate %idx RelaxedPrecision
OpDecorate %32 RelaxedPrecision
OpDecorate %33 RelaxedPrecision
OpDecorate %34 RelaxedPrecision
OpDecorate %35 RelaxedPrecision
OpDecorate %36 RelaxedPrecision
OpDecorate %37 RelaxedPrecision
OpDecorate %38 RelaxedPrecision
OpDecorate %39 RelaxedPrecision
%void = OpTypeVoid
%41 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat4v3float = OpTypeMatrix %v3float 4
%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float
%float_1 = OpConstant %float 1
%float_0 = OpConstant %float 0
%48 = OpConstantComposite %v3float %float_1 %float_0 %float_0
%49 = OpConstantComposite %v3float %float_0 %float_1 %float_0
%50 = OpConstantComposite %v3float %float_0 %float_0 %float_1
%51 = OpConstantComposite %v3float %float_0 %float_0 %float_0
%52 = OpConstantComposite %mat4v3float %48 %49 %50 %51
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%int_0 = OpConstant %int 0
%int_2 = OpConstant %int 2
%bool = OpTypeBool
%true = OpConstantTrue %bool
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_GLF_color = OpVariable %_ptr_Output_v4float Output
%61 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%int_5 = OpConstant %int 5
%int_1 = OpConstant %int 1
%int_10 = OpConstant %int 10
%int_4 = OpConstant %int 4
%int_3 = OpConstant %int 3
%_ptr_Function_float = OpTypePointer Function %float
%uint = OpTypeInt 32 0
%uint_9 = OpConstant %uint 9
%_arr_float_uint_9 = OpTypeArray %float %uint_9
%_ptr_Function__arr_float_uint_9 = OpTypePointer Function %_arr_float_uint_9
%int_9 = OpConstant %int 9
%uint_1 = OpConstant %uint 1
%main = OpFunction %void None %41
%74 = OpLabel
%m43 = OpVariable %_ptr_Function_mat4v3float Function
%ll1 = OpVariable %_ptr_Function_int Function
%rows = OpVariable %_ptr_Function_int Function
%ll4 = OpVariable %_ptr_Function_int Function
%ll2 = OpVariable %_ptr_Function_int Function
%c = OpVariable %_ptr_Function_int Function
%tempm43 = OpVariable %_ptr_Function_mat4v3float Function
%ll3 = OpVariable %_ptr_Function_int Function
%d = OpVariable %_ptr_Function_int Function
%r = OpVariable %_ptr_Function_int Function
%sums = OpVariable %_ptr_Function__arr_float_uint_9 Function
%idx = OpVariable %_ptr_Function_int Function
OpStore %m43 %52
OpStore %ll1 %int_0
OpStore %rows %int_2
OpBranch %75
%75 = OpLabel
OpLoopMerge %76 %77 None
OpBranch %78
%78 = OpLabel
OpBranchConditional %true %79 %76
%79 = OpLabel
OpStore %_GLF_color %61
%16 = OpLoad %int %ll1
%80 = OpSGreaterThanEqual %bool %16 %int_5
OpSelectionMerge %81 None
OpBranchConditional %80 %82 %81
%82 = OpLabel
OpBranch %76
%81 = OpLabel
%17 = OpLoad %int %ll1
%18 = OpIAdd %int %17 %int_1
OpStore %ll1 %18
OpStore %ll4 %int_10
OpStore %ll2 %int_0
OpStore %c %int_0
OpBranch %83
%83 = OpLabel
OpLoopMerge %84 %85 None
OpBranch %86
%86 = OpLabel
%19 = OpLoad %int %c
%87 = OpSLessThan %bool %19 %int_1
OpBranchConditional %87 %88 %84
%88 = OpLabel
%20 = OpLoad %int %ll2
%89 = OpSGreaterThanEqual %bool %20 %int_0
OpSelectionMerge %90 None
OpBranchConditional %89 %91 %90
%91 = OpLabel
OpBranch %84
%90 = OpLabel
%21 = OpLoad %int %ll2
%22 = OpIAdd %int %21 %int_1
OpStore %ll2 %22
%92 = OpLoad %mat4v3float %m43
OpStore %tempm43 %92
OpStore %ll3 %int_0
OpStore %d %int_0
OpBranch %93
%93 = OpLabel
OpLoopMerge %94 %95 None
OpBranch %96
%96 = OpLabel
%23 = OpLoad %int %ll4
%97 = OpSLessThan %bool %int_1 %23
OpBranchConditional %97 %98 %94
%98 = OpLabel
%24 = OpLoad %int %d
%99 = OpSGreaterThanEqual %bool %24 %int_0
%25 = OpLoad %int %d
%100 = OpSLessThan %bool %25 %int_4
%101 = OpLogicalAnd %bool %99 %100
%26 = OpLoad %int %d
%102 = OpSelect %int %101 %26 %int_0
%27 = OpLoad %int %r
%103 = OpSGreaterThanEqual %bool %27 %int_0
%28 = OpLoad %int %r
%104 = OpSLessThan %bool %28 %int_3
%105 = OpLogicalAnd %bool %103 %104
%29 = OpLoad %int %r
%106 = OpSelect %int %105 %29 %int_0
%107 = OpAccessChain %_ptr_Function_float %tempm43 %102 %106
OpStore %107 %float_1
OpBranch %95
%95 = OpLabel
%30 = OpLoad %int %d
%31 = OpIAdd %int %30 %int_1
OpStore %d %31
OpBranch %93
%94 = OpLabel
%32 = OpLoad %int %idx
%108 = OpSGreaterThanEqual %bool %32 %int_0
%33 = OpLoad %int %idx
%109 = OpSLessThan %bool %33 %int_9
%110 = OpLogicalAnd %bool %108 %109
%34 = OpLoad %int %idx
%111 = OpSelect %int %110 %34 %int_0
%35 = OpLoad %int %c
%112 = OpAccessChain %_ptr_Function_float %m43 %35 %uint_1
%113 = OpLoad %float %112
%114 = OpAccessChain %_ptr_Function_float %sums %111
%115 = OpLoad %float %114
%116 = OpFAdd %float %115 %113
%117 = OpAccessChain %_ptr_Function_float %sums %111
OpStore %117 %116
OpBranch %85
%85 = OpLabel
%36 = OpLoad %int %c
%37 = OpIAdd %int %36 %int_1
OpStore %c %37
OpBranch %83
%84 = OpLabel
%38 = OpLoad %int %idx
%39 = OpIAdd %int %38 %int_1
OpStore %idx %39
OpBranch %77
%77 = OpLabel
OpBranch %75
%76 = OpLabel
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,85 @@
void set_float3(inout float3 vec, int idx, float val) {
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
}
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
int ll1 = 0;
int rows = 0;
int ll4 = 0;
int ll2 = 0;
int c = 0;
float4x3 tempm43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
int ll3 = 0;
int d = 0;
int r = 0;
float sums[9] = (float[9])0;
int idx = 0;
m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f));
ll1 = 0;
rows = 2;
while (true) {
if (true) {
} else {
break;
}
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
if ((ll1 >= 5)) {
break;
}
ll1 = (ll1 + 1);
ll4 = 10;
ll2 = 0;
c = 0;
{
for(; (c < 1); c = (c + 1)) {
if ((ll2 >= 0)) {
break;
}
ll2 = (ll2 + 1);
tempm43 = m43;
ll3 = 0;
d = 0;
{
for(; (1 < ll4); d = (d + 1)) {
bool tint_tmp = (d >= 0);
if (tint_tmp) {
tint_tmp = (d < 4);
}
bool tint_tmp_1 = (r >= 0);
if (tint_tmp_1) {
tint_tmp_1 = (r < 3);
}
set_float3(tempm43[((tint_tmp) ? d : 0)], ((tint_tmp_1) ? r : 0), 1.0f);
}
}
bool tint_tmp_2 = (idx >= 0);
if (tint_tmp_2) {
tint_tmp_2 = (idx < 9);
}
const int x_111 = ((tint_tmp_2) ? idx : 0);
const float x_113 = m43[c].y;
const float x_115 = sums[x_111];
sums[x_111] = (x_115 + x_113);
}
}
idx = (idx + 1);
}
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_2 = {tint_symbol_1.x_GLF_color_1};
return tint_symbol_2;
}

View File

@@ -0,0 +1,105 @@
#include <metal_stdlib>
using namespace metal;
struct tint_array_wrapper {
float arr[9];
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
void main_1(thread float4* const tint_symbol_4) {
float4x3 m43 = float4x3(0.0f);
int ll1 = 0;
int rows = 0;
int ll4 = 0;
int ll2 = 0;
int c = 0;
float4x3 tempm43 = float4x3(0.0f);
int ll3 = 0;
int d = 0;
int r = 0;
tint_array_wrapper sums = {};
int idx = 0;
m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f));
ll1 = 0;
rows = 2;
while (true) {
if (true) {
} else {
break;
}
*(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f);
int const x_16 = ll1;
if ((x_16 >= 5)) {
break;
}
int const x_17 = ll1;
ll1 = (x_17 + 1);
ll4 = 10;
ll2 = 0;
c = 0;
while (true) {
int const x_19 = c;
if ((x_19 < 1)) {
} else {
break;
}
int const x_20 = ll2;
if ((x_20 >= 0)) {
break;
}
int const x_21 = ll2;
ll2 = (x_21 + 1);
float4x3 const x_92 = m43;
tempm43 = x_92;
ll3 = 0;
d = 0;
while (true) {
int const x_23 = ll4;
if ((1 < x_23)) {
} else {
break;
}
int const x_24 = d;
int const x_25 = d;
int const x_26 = d;
int const x_27 = r;
int const x_28 = r;
int const x_29 = r;
tempm43[select(0, x_26, ((x_24 >= 0) && (x_25 < 4)))][select(0, x_29, ((x_27 >= 0) && (x_28 < 3)))] = 1.0f;
{
int const x_30 = d;
d = (x_30 + 1);
}
}
int const x_32 = idx;
int const x_33 = idx;
int const x_34 = idx;
int const x_111 = select(0, x_34, ((x_32 >= 0) && (x_33 < 9)));
int const x_35 = c;
float const x_113 = m43[x_35].y;
float const x_115 = sums.arr[x_111];
sums.arr[x_111] = (x_115 + x_113);
{
int const x_36 = c;
c = (x_36 + 1);
}
}
int const x_38 = idx;
idx = (x_38 + 1);
}
return;
}
fragment tint_symbol_1 tint_symbol() {
thread float4 tint_symbol_5 = 0.0f;
main_1(&(tint_symbol_5));
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5};
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,244 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 147
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
OpName %m43 "m43"
OpName %ll1 "ll1"
OpName %rows "rows"
OpName %ll4 "ll4"
OpName %ll2 "ll2"
OpName %c "c"
OpName %tempm43 "tempm43"
OpName %ll3 "ll3"
OpName %d "d"
OpName %r "r"
OpName %sums "sums"
OpName %idx "idx"
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 %tint_symbol_1 Location 0
OpDecorate %_arr_float_uint_9 ArrayStride 4
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%5 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5
%void = OpTypeVoid
%8 = OpTypeFunction %void
%v3float = OpTypeVector %float 3
%mat4v3float = OpTypeMatrix %v3float 4
%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float
%16 = OpConstantNull %mat4v3float
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%20 = OpConstantNull %int
%uint = OpTypeInt 32 0
%uint_9 = OpConstant %uint 9
%_arr_float_uint_9 = OpTypeArray %float %uint_9
%_ptr_Function__arr_float_uint_9 = OpTypePointer Function %_arr_float_uint_9
%34 = OpConstantNull %_arr_float_uint_9
%float_1 = OpConstant %float 1
%float_0 = OpConstant %float 0
%38 = OpConstantComposite %v3float %float_1 %float_0 %float_0
%39 = OpConstantComposite %v3float %float_0 %float_1 %float_0
%40 = OpConstantComposite %v3float %float_0 %float_0 %float_1
%41 = OpConstantComposite %v3float %float_0 %float_0 %float_0
%42 = OpConstantComposite %mat4v3float %38 %39 %40 %41
%int_0 = OpConstant %int 0
%int_2 = OpConstant %int 2
%bool = OpTypeBool
%true = OpConstantTrue %bool
%54 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%int_5 = OpConstant %int 5
%int_1 = OpConstant %int 1
%int_10 = OpConstant %int 10
%int_4 = OpConstant %int 4
%int_3 = OpConstant %int 3
%_ptr_Function_float = OpTypePointer Function %float
%int_9 = OpConstant %int 9
%uint_1 = OpConstant %uint 1
%main_out = OpTypeStruct %v4float
%135 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %8
%11 = OpLabel
%m43 = OpVariable %_ptr_Function_mat4v3float Function %16
%ll1 = OpVariable %_ptr_Function_int Function %20
%rows = OpVariable %_ptr_Function_int Function %20
%ll4 = OpVariable %_ptr_Function_int Function %20
%ll2 = OpVariable %_ptr_Function_int Function %20
%c = OpVariable %_ptr_Function_int Function %20
%tempm43 = OpVariable %_ptr_Function_mat4v3float Function %16
%ll3 = OpVariable %_ptr_Function_int Function %20
%d = OpVariable %_ptr_Function_int Function %20
%r = OpVariable %_ptr_Function_int Function %20
%sums = OpVariable %_ptr_Function__arr_float_uint_9 Function %34
%idx = OpVariable %_ptr_Function_int Function %20
OpStore %m43 %42
OpStore %ll1 %int_0
OpStore %rows %int_2
OpBranch %45
%45 = OpLabel
OpLoopMerge %46 %47 None
OpBranch %48
%48 = OpLabel
OpSelectionMerge %51 None
OpBranchConditional %true %52 %53
%52 = OpLabel
OpBranch %51
%53 = OpLabel
OpBranch %46
%51 = OpLabel
OpStore %x_GLF_color %54
%55 = OpLoad %int %ll1
%57 = OpSGreaterThanEqual %bool %55 %int_5
OpSelectionMerge %58 None
OpBranchConditional %57 %59 %58
%59 = OpLabel
OpBranch %46
%58 = OpLabel
%60 = OpLoad %int %ll1
%62 = OpIAdd %int %60 %int_1
OpStore %ll1 %62
OpStore %ll4 %int_10
OpStore %ll2 %int_0
OpStore %c %int_0
OpBranch %64
%64 = OpLabel
OpLoopMerge %65 %66 None
OpBranch %67
%67 = OpLabel
%68 = OpLoad %int %c
%69 = OpSLessThan %bool %68 %int_1
OpSelectionMerge %70 None
OpBranchConditional %69 %71 %72
%71 = OpLabel
OpBranch %70
%72 = OpLabel
OpBranch %65
%70 = OpLabel
%73 = OpLoad %int %ll2
%74 = OpSGreaterThanEqual %bool %73 %int_0
OpSelectionMerge %75 None
OpBranchConditional %74 %76 %75
%76 = OpLabel
OpBranch %65
%75 = OpLabel
%77 = OpLoad %int %ll2
%78 = OpIAdd %int %77 %int_1
OpStore %ll2 %78
%79 = OpLoad %mat4v3float %m43
OpStore %tempm43 %79
OpStore %ll3 %int_0
OpStore %d %int_0
OpBranch %80
%80 = OpLabel
OpLoopMerge %81 %82 None
OpBranch %83
%83 = OpLabel
%84 = OpLoad %int %ll4
%85 = OpSLessThan %bool %int_1 %84
OpSelectionMerge %86 None
OpBranchConditional %85 %87 %88
%87 = OpLabel
OpBranch %86
%88 = OpLabel
OpBranch %81
%86 = OpLabel
%89 = OpLoad %int %d
%90 = OpLoad %int %d
%91 = OpLoad %int %d
%92 = OpLoad %int %r
%93 = OpLoad %int %r
%94 = OpLoad %int %r
%96 = OpSGreaterThanEqual %bool %89 %int_0
OpSelectionMerge %97 None
OpBranchConditional %96 %98 %97
%98 = OpLabel
%100 = OpSLessThan %bool %90 %int_4
OpBranch %97
%97 = OpLabel
%101 = OpPhi %bool %96 %86 %100 %98
%95 = OpSelect %int %101 %91 %int_0
%103 = OpSGreaterThanEqual %bool %92 %int_0
OpSelectionMerge %104 None
OpBranchConditional %103 %105 %104
%105 = OpLabel
%107 = OpSLessThan %bool %93 %int_3
OpBranch %104
%104 = OpLabel
%108 = OpPhi %bool %103 %97 %107 %105
%102 = OpSelect %int %108 %94 %int_0
%110 = OpAccessChain %_ptr_Function_float %tempm43 %95 %102
OpStore %110 %float_1
OpBranch %82
%82 = OpLabel
%111 = OpLoad %int %d
%112 = OpIAdd %int %111 %int_1
OpStore %d %112
OpBranch %80
%81 = OpLabel
%113 = OpLoad %int %idx
%114 = OpLoad %int %idx
%115 = OpLoad %int %idx
%117 = OpSGreaterThanEqual %bool %113 %int_0
OpSelectionMerge %118 None
OpBranchConditional %117 %119 %118
%119 = OpLabel
%121 = OpSLessThan %bool %114 %int_9
OpBranch %118
%118 = OpLabel
%122 = OpPhi %bool %117 %81 %121 %119
%116 = OpSelect %int %122 %115 %int_0
%123 = OpLoad %int %c
%125 = OpAccessChain %_ptr_Function_float %m43 %123 %uint_1
%126 = OpLoad %float %125
%127 = OpAccessChain %_ptr_Function_float %sums %116
%128 = OpLoad %float %127
%129 = OpAccessChain %_ptr_Function_float %sums %116
%130 = OpFAdd %float %128 %126
OpStore %129 %130
OpBranch %66
%66 = OpLabel
%131 = OpLoad %int %c
%132 = OpIAdd %int %131 %int_1
OpStore %c %132
OpBranch %64
%65 = OpLabel
%133 = OpLoad %int %idx
%134 = OpIAdd %int %133 %int_1
OpStore %idx %134
OpBranch %47
%47 = OpLabel
OpBranch %45
%46 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %135
%tint_symbol = OpFunctionParameter %main_out
%139 = OpLabel
%140 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %140
OpReturn
OpFunctionEnd
%main = OpFunction %void None %8
%142 = OpLabel
%143 = OpFunctionCall %void %main_1
%145 = OpLoad %v4float %x_GLF_color
%146 = OpCompositeConstruct %main_out %145
%144 = OpFunctionCall %void %tint_symbol_2 %146
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,98 @@
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var m43 : mat4x3<f32>;
var ll1 : i32;
var rows : i32;
var ll4 : i32;
var ll2 : i32;
var c : i32;
var tempm43 : mat4x3<f32>;
var ll3 : i32;
var d : i32;
var r : i32;
var sums : array<f32, 9>;
var idx : i32;
m43 = mat4x3<f32>(vec3<f32>(1.0, 0.0, 0.0), vec3<f32>(0.0, 1.0, 0.0), vec3<f32>(0.0, 0.0, 1.0), vec3<f32>(0.0, 0.0, 0.0));
ll1 = 0;
rows = 2;
loop {
if (true) {
} else {
break;
}
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
let x_16 : i32 = ll1;
if ((x_16 >= 5)) {
break;
}
let x_17 : i32 = ll1;
ll1 = (x_17 + 1);
ll4 = 10;
ll2 = 0;
c = 0;
loop {
let x_19 : i32 = c;
if ((x_19 < 1)) {
} else {
break;
}
let x_20 : i32 = ll2;
if ((x_20 >= 0)) {
break;
}
let x_21 : i32 = ll2;
ll2 = (x_21 + 1);
let x_92 : mat4x3<f32> = m43;
tempm43 = x_92;
ll3 = 0;
d = 0;
loop {
let x_23 : i32 = ll4;
if ((1 < x_23)) {
} else {
break;
}
let x_24 : i32 = d;
let x_25 : i32 = d;
let x_26 : i32 = d;
let x_27 : i32 = r;
let x_28 : i32 = r;
let x_29 : i32 = r;
tempm43[select(0, x_26, ((x_24 >= 0) && (x_25 < 4)))][select(0, x_29, ((x_27 >= 0) && (x_28 < 3)))] = 1.0;
continuing {
let x_30 : i32 = d;
d = (x_30 + 1);
}
}
let x_32 : i32 = idx;
let x_33 : i32 = idx;
let x_34 : i32 = idx;
let x_111 : i32 = select(0, x_34, ((x_32 >= 0) && (x_33 < 9)));
let x_35 : i32 = c;
let x_113 : f32 = m43[x_35].y;
let x_115 : f32 = sums[x_111];
sums[x_111] = (x_115 + x_113);
continuing {
let x_36 : i32 = c;
c = (x_36 + 1);
}
}
let x_38 : i32 = idx;
idx = (x_38 + 1);
}
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,98 @@
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var m43 : mat4x3<f32>;
var ll1 : i32;
var rows : i32;
var ll4 : i32;
var ll2 : i32;
var c : i32;
var tempm43 : mat4x3<f32>;
var ll3 : i32;
var d : i32;
var r : i32;
var sums : array<f32, 9>;
var idx : i32;
m43 = mat4x3<f32>(vec3<f32>(1.0, 0.0, 0.0), vec3<f32>(0.0, 1.0, 0.0), vec3<f32>(0.0, 0.0, 1.0), vec3<f32>(0.0, 0.0, 0.0));
ll1 = 0;
rows = 2;
loop {
if (true) {
} else {
break;
}
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
let x_16 : i32 = ll1;
if ((x_16 >= 5)) {
break;
}
let x_17 : i32 = ll1;
ll1 = (x_17 + 1);
ll4 = 10;
ll2 = 0;
c = 0;
loop {
let x_19 : i32 = c;
if ((x_19 < 1)) {
} else {
break;
}
let x_20 : i32 = ll2;
if ((x_20 >= 0)) {
break;
}
let x_21 : i32 = ll2;
ll2 = (x_21 + 1);
let x_92 : mat4x3<f32> = m43;
tempm43 = x_92;
ll3 = 0;
d = 0;
loop {
let x_23 : i32 = ll4;
if ((1 < x_23)) {
} else {
break;
}
let x_24 : i32 = d;
let x_25 : i32 = d;
let x_26 : i32 = d;
let x_27 : i32 = r;
let x_28 : i32 = r;
let x_29 : i32 = r;
tempm43[select(0, x_26, ((x_24 >= 0) && (x_25 < 4)))][select(0, x_29, ((x_27 >= 0) && (x_28 < 3)))] = 1.0;
continuing {
let x_30 : i32 = d;
d = (x_30 + 1);
}
}
let x_32 : i32 = idx;
let x_33 : i32 = idx;
let x_34 : i32 = idx;
let x_111 : i32 = select(0, x_34, ((x_32 >= 0) && (x_33 < 9)));
let x_35 : i32 = c;
let x_113 : f32 = m43[x_35].y;
let x_115 : f32 = sums[x_111];
sums[x_111] = (x_115 + x_113);
continuing {
let x_36 : i32 = c;
c = (x_36 + 1);
}
}
let x_38 : i32 = idx;
idx = (x_38 + 1);
}
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,85 @@
void set_float3(inout float3 vec, int idx, float val) {
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
}
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
float4x3 m43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
int ll1 = 0;
int rows = 0;
int ll4 = 0;
int ll2 = 0;
int c = 0;
float4x3 tempm43 = float4x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
int ll3 = 0;
int d = 0;
int r = 0;
float sums[9] = (float[9])0;
int idx = 0;
m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f));
ll1 = 0;
rows = 2;
while (true) {
if (true) {
} else {
break;
}
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
if ((ll1 >= 5)) {
break;
}
ll1 = (ll1 + 1);
ll4 = 10;
ll2 = 0;
c = 0;
{
for(; (c < 1); c = (c + 1)) {
if ((ll2 >= 0)) {
break;
}
ll2 = (ll2 + 1);
tempm43 = m43;
ll3 = 0;
d = 0;
{
for(; (1 < ll4); d = (d + 1)) {
bool tint_tmp = (d >= 0);
if (tint_tmp) {
tint_tmp = (d < 4);
}
bool tint_tmp_1 = (r >= 0);
if (tint_tmp_1) {
tint_tmp_1 = (r < 3);
}
set_float3(tempm43[((tint_tmp) ? d : 0)], ((tint_tmp_1) ? r : 0), 1.0f);
}
}
bool tint_tmp_2 = (idx >= 0);
if (tint_tmp_2) {
tint_tmp_2 = (idx < 9);
}
const int x_111 = ((tint_tmp_2) ? idx : 0);
const float x_113 = m43[c].y;
const float x_115 = sums[x_111];
sums[x_111] = (x_115 + x_113);
}
}
idx = (idx + 1);
}
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_2 = {tint_symbol_1.x_GLF_color_1};
return tint_symbol_2;
}

View File

@@ -0,0 +1,105 @@
#include <metal_stdlib>
using namespace metal;
struct tint_array_wrapper {
float arr[9];
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
void main_1(thread float4* const tint_symbol_4) {
float4x3 m43 = float4x3(0.0f);
int ll1 = 0;
int rows = 0;
int ll4 = 0;
int ll2 = 0;
int c = 0;
float4x3 tempm43 = float4x3(0.0f);
int ll3 = 0;
int d = 0;
int r = 0;
tint_array_wrapper sums = {};
int idx = 0;
m43 = float4x3(float3(1.0f, 0.0f, 0.0f), float3(0.0f, 1.0f, 0.0f), float3(0.0f, 0.0f, 1.0f), float3(0.0f, 0.0f, 0.0f));
ll1 = 0;
rows = 2;
while (true) {
if (true) {
} else {
break;
}
*(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f);
int const x_16 = ll1;
if ((x_16 >= 5)) {
break;
}
int const x_17 = ll1;
ll1 = (x_17 + 1);
ll4 = 10;
ll2 = 0;
c = 0;
while (true) {
int const x_19 = c;
if ((x_19 < 1)) {
} else {
break;
}
int const x_20 = ll2;
if ((x_20 >= 0)) {
break;
}
int const x_21 = ll2;
ll2 = (x_21 + 1);
float4x3 const x_92 = m43;
tempm43 = x_92;
ll3 = 0;
d = 0;
while (true) {
int const x_23 = ll4;
if ((1 < x_23)) {
} else {
break;
}
int const x_24 = d;
int const x_25 = d;
int const x_26 = d;
int const x_27 = r;
int const x_28 = r;
int const x_29 = r;
tempm43[select(0, x_26, ((x_24 >= 0) && (x_25 < 4)))][select(0, x_29, ((x_27 >= 0) && (x_28 < 3)))] = 1.0f;
{
int const x_30 = d;
d = (x_30 + 1);
}
}
int const x_32 = idx;
int const x_33 = idx;
int const x_34 = idx;
int const x_111 = select(0, x_34, ((x_32 >= 0) && (x_33 < 9)));
int const x_35 = c;
float const x_113 = m43[x_35].y;
float const x_115 = sums.arr[x_111];
sums.arr[x_111] = (x_115 + x_113);
{
int const x_36 = c;
c = (x_36 + 1);
}
}
int const x_38 = idx;
idx = (x_38 + 1);
}
return;
}
fragment tint_symbol_1 tint_symbol() {
thread float4 tint_symbol_5 = 0.0f;
main_1(&(tint_symbol_5));
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5};
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,244 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 147
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
OpName %m43 "m43"
OpName %ll1 "ll1"
OpName %rows "rows"
OpName %ll4 "ll4"
OpName %ll2 "ll2"
OpName %c "c"
OpName %tempm43 "tempm43"
OpName %ll3 "ll3"
OpName %d "d"
OpName %r "r"
OpName %sums "sums"
OpName %idx "idx"
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 %tint_symbol_1 Location 0
OpDecorate %_arr_float_uint_9 ArrayStride 4
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%5 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5
%void = OpTypeVoid
%8 = OpTypeFunction %void
%v3float = OpTypeVector %float 3
%mat4v3float = OpTypeMatrix %v3float 4
%_ptr_Function_mat4v3float = OpTypePointer Function %mat4v3float
%16 = OpConstantNull %mat4v3float
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%20 = OpConstantNull %int
%uint = OpTypeInt 32 0
%uint_9 = OpConstant %uint 9
%_arr_float_uint_9 = OpTypeArray %float %uint_9
%_ptr_Function__arr_float_uint_9 = OpTypePointer Function %_arr_float_uint_9
%34 = OpConstantNull %_arr_float_uint_9
%float_1 = OpConstant %float 1
%float_0 = OpConstant %float 0
%38 = OpConstantComposite %v3float %float_1 %float_0 %float_0
%39 = OpConstantComposite %v3float %float_0 %float_1 %float_0
%40 = OpConstantComposite %v3float %float_0 %float_0 %float_1
%41 = OpConstantComposite %v3float %float_0 %float_0 %float_0
%42 = OpConstantComposite %mat4v3float %38 %39 %40 %41
%int_0 = OpConstant %int 0
%int_2 = OpConstant %int 2
%bool = OpTypeBool
%true = OpConstantTrue %bool
%54 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%int_5 = OpConstant %int 5
%int_1 = OpConstant %int 1
%int_10 = OpConstant %int 10
%int_4 = OpConstant %int 4
%int_3 = OpConstant %int 3
%_ptr_Function_float = OpTypePointer Function %float
%int_9 = OpConstant %int 9
%uint_1 = OpConstant %uint 1
%main_out = OpTypeStruct %v4float
%135 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %8
%11 = OpLabel
%m43 = OpVariable %_ptr_Function_mat4v3float Function %16
%ll1 = OpVariable %_ptr_Function_int Function %20
%rows = OpVariable %_ptr_Function_int Function %20
%ll4 = OpVariable %_ptr_Function_int Function %20
%ll2 = OpVariable %_ptr_Function_int Function %20
%c = OpVariable %_ptr_Function_int Function %20
%tempm43 = OpVariable %_ptr_Function_mat4v3float Function %16
%ll3 = OpVariable %_ptr_Function_int Function %20
%d = OpVariable %_ptr_Function_int Function %20
%r = OpVariable %_ptr_Function_int Function %20
%sums = OpVariable %_ptr_Function__arr_float_uint_9 Function %34
%idx = OpVariable %_ptr_Function_int Function %20
OpStore %m43 %42
OpStore %ll1 %int_0
OpStore %rows %int_2
OpBranch %45
%45 = OpLabel
OpLoopMerge %46 %47 None
OpBranch %48
%48 = OpLabel
OpSelectionMerge %51 None
OpBranchConditional %true %52 %53
%52 = OpLabel
OpBranch %51
%53 = OpLabel
OpBranch %46
%51 = OpLabel
OpStore %x_GLF_color %54
%55 = OpLoad %int %ll1
%57 = OpSGreaterThanEqual %bool %55 %int_5
OpSelectionMerge %58 None
OpBranchConditional %57 %59 %58
%59 = OpLabel
OpBranch %46
%58 = OpLabel
%60 = OpLoad %int %ll1
%62 = OpIAdd %int %60 %int_1
OpStore %ll1 %62
OpStore %ll4 %int_10
OpStore %ll2 %int_0
OpStore %c %int_0
OpBranch %64
%64 = OpLabel
OpLoopMerge %65 %66 None
OpBranch %67
%67 = OpLabel
%68 = OpLoad %int %c
%69 = OpSLessThan %bool %68 %int_1
OpSelectionMerge %70 None
OpBranchConditional %69 %71 %72
%71 = OpLabel
OpBranch %70
%72 = OpLabel
OpBranch %65
%70 = OpLabel
%73 = OpLoad %int %ll2
%74 = OpSGreaterThanEqual %bool %73 %int_0
OpSelectionMerge %75 None
OpBranchConditional %74 %76 %75
%76 = OpLabel
OpBranch %65
%75 = OpLabel
%77 = OpLoad %int %ll2
%78 = OpIAdd %int %77 %int_1
OpStore %ll2 %78
%79 = OpLoad %mat4v3float %m43
OpStore %tempm43 %79
OpStore %ll3 %int_0
OpStore %d %int_0
OpBranch %80
%80 = OpLabel
OpLoopMerge %81 %82 None
OpBranch %83
%83 = OpLabel
%84 = OpLoad %int %ll4
%85 = OpSLessThan %bool %int_1 %84
OpSelectionMerge %86 None
OpBranchConditional %85 %87 %88
%87 = OpLabel
OpBranch %86
%88 = OpLabel
OpBranch %81
%86 = OpLabel
%89 = OpLoad %int %d
%90 = OpLoad %int %d
%91 = OpLoad %int %d
%92 = OpLoad %int %r
%93 = OpLoad %int %r
%94 = OpLoad %int %r
%96 = OpSGreaterThanEqual %bool %89 %int_0
OpSelectionMerge %97 None
OpBranchConditional %96 %98 %97
%98 = OpLabel
%100 = OpSLessThan %bool %90 %int_4
OpBranch %97
%97 = OpLabel
%101 = OpPhi %bool %96 %86 %100 %98
%95 = OpSelect %int %101 %91 %int_0
%103 = OpSGreaterThanEqual %bool %92 %int_0
OpSelectionMerge %104 None
OpBranchConditional %103 %105 %104
%105 = OpLabel
%107 = OpSLessThan %bool %93 %int_3
OpBranch %104
%104 = OpLabel
%108 = OpPhi %bool %103 %97 %107 %105
%102 = OpSelect %int %108 %94 %int_0
%110 = OpAccessChain %_ptr_Function_float %tempm43 %95 %102
OpStore %110 %float_1
OpBranch %82
%82 = OpLabel
%111 = OpLoad %int %d
%112 = OpIAdd %int %111 %int_1
OpStore %d %112
OpBranch %80
%81 = OpLabel
%113 = OpLoad %int %idx
%114 = OpLoad %int %idx
%115 = OpLoad %int %idx
%117 = OpSGreaterThanEqual %bool %113 %int_0
OpSelectionMerge %118 None
OpBranchConditional %117 %119 %118
%119 = OpLabel
%121 = OpSLessThan %bool %114 %int_9
OpBranch %118
%118 = OpLabel
%122 = OpPhi %bool %117 %81 %121 %119
%116 = OpSelect %int %122 %115 %int_0
%123 = OpLoad %int %c
%125 = OpAccessChain %_ptr_Function_float %m43 %123 %uint_1
%126 = OpLoad %float %125
%127 = OpAccessChain %_ptr_Function_float %sums %116
%128 = OpLoad %float %127
%129 = OpAccessChain %_ptr_Function_float %sums %116
%130 = OpFAdd %float %128 %126
OpStore %129 %130
OpBranch %66
%66 = OpLabel
%131 = OpLoad %int %c
%132 = OpIAdd %int %131 %int_1
OpStore %c %132
OpBranch %64
%65 = OpLabel
%133 = OpLoad %int %idx
%134 = OpIAdd %int %133 %int_1
OpStore %idx %134
OpBranch %47
%47 = OpLabel
OpBranch %45
%46 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %135
%tint_symbol = OpFunctionParameter %main_out
%139 = OpLabel
%140 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %140
OpReturn
OpFunctionEnd
%main = OpFunction %void None %8
%142 = OpLabel
%143 = OpFunctionCall %void %main_1
%145 = OpLoad %v4float %x_GLF_color
%146 = OpCompositeConstruct %main_out %145
%144 = OpFunctionCall %void %tint_symbol_2 %146
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,98 @@
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var m43 : mat4x3<f32>;
var ll1 : i32;
var rows : i32;
var ll4 : i32;
var ll2 : i32;
var c : i32;
var tempm43 : mat4x3<f32>;
var ll3 : i32;
var d : i32;
var r : i32;
var sums : array<f32, 9>;
var idx : i32;
m43 = mat4x3<f32>(vec3<f32>(1.0, 0.0, 0.0), vec3<f32>(0.0, 1.0, 0.0), vec3<f32>(0.0, 0.0, 1.0), vec3<f32>(0.0, 0.0, 0.0));
ll1 = 0;
rows = 2;
loop {
if (true) {
} else {
break;
}
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
let x_16 : i32 = ll1;
if ((x_16 >= 5)) {
break;
}
let x_17 : i32 = ll1;
ll1 = (x_17 + 1);
ll4 = 10;
ll2 = 0;
c = 0;
loop {
let x_19 : i32 = c;
if ((x_19 < 1)) {
} else {
break;
}
let x_20 : i32 = ll2;
if ((x_20 >= 0)) {
break;
}
let x_21 : i32 = ll2;
ll2 = (x_21 + 1);
let x_92 : mat4x3<f32> = m43;
tempm43 = x_92;
ll3 = 0;
d = 0;
loop {
let x_23 : i32 = ll4;
if ((1 < x_23)) {
} else {
break;
}
let x_24 : i32 = d;
let x_25 : i32 = d;
let x_26 : i32 = d;
let x_27 : i32 = r;
let x_28 : i32 = r;
let x_29 : i32 = r;
tempm43[select(0, x_26, ((x_24 >= 0) && (x_25 < 4)))][select(0, x_29, ((x_27 >= 0) && (x_28 < 3)))] = 1.0;
continuing {
let x_30 : i32 = d;
d = (x_30 + 1);
}
}
let x_32 : i32 = idx;
let x_33 : i32 = idx;
let x_34 : i32 = idx;
let x_111 : i32 = select(0, x_34, ((x_32 >= 0) && (x_33 < 9)));
let x_35 : i32 = c;
let x_113 : f32 = m43[x_35].y;
let x_115 : f32 = sums[x_111];
sums[x_111] = (x_115 + x_113);
continuing {
let x_36 : i32 = c;
c = (x_36 + 1);
}
}
let x_38 : i32 = idx;
idx = (x_38 + 1);
}
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);
}