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,133 @@
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 %highSigned "highSigned"
OpName %highUnsigned "highUnsigned"
OpName %i "i"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "zero"
OpName %_ ""
OpName %data "data"
OpName %i_0 "i"
OpName %_GLF_color "_GLF_color"
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %buf0 Block
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
OpDecorate %_GLF_color Location 0
%void = OpTypeVoid
%12 = OpTypeFunction %void
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%int_1 = OpConstant %int 1
%uint = OpTypeInt 32 0
%_ptr_Function_uint = OpTypePointer Function %uint
%uint_2 = OpConstant %uint 2
%int_0 = OpConstant %int 0
%int_10 = OpConstant %int 10
%buf0 = OpTypeStruct %int
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%_ = OpVariable %_ptr_Uniform_buf0 Uniform
%_ptr_Uniform_int = OpTypePointer Uniform %int
%bool = OpTypeBool
%_arr_int_uint_2 = OpTypeArray %int %uint_2
%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2
%int_5 = OpConstant %int 5
%uint_1 = OpConstant %uint 1
%uint_10 = OpConstant %uint 10
%int_6 = OpConstant %int 6
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_GLF_color = OpVariable %_ptr_Output_v4float Output
%float_1 = OpConstant %float 1
%float_0 = OpConstant %float 0
%35 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%36 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
%main = OpFunction %void None %12
%37 = OpLabel
%highSigned = OpVariable %_ptr_Function_int Function
%highUnsigned = OpVariable %_ptr_Function_uint Function
%i = OpVariable %_ptr_Function_int Function
%data = OpVariable %_ptr_Function__arr_int_uint_2 Function
%i_0 = OpVariable %_ptr_Function_uint Function
OpStore %highSigned %int_1
OpStore %highUnsigned %uint_2
OpStore %i %int_0
OpBranch %38
%38 = OpLabel
OpLoopMerge %39 %40 None
OpBranch %41
%41 = OpLabel
%42 = OpLoad %int %i
%43 = OpLoad %int %highSigned
%44 = OpExtInst %int %1 SMin %int_10 %43
%45 = OpAccessChain %_ptr_Uniform_int %_ %int_0
%46 = OpLoad %int %45
%47 = OpIAdd %int %44 %46
%48 = OpSLessThan %bool %42 %47
OpBranchConditional %48 %49 %39
%49 = OpLabel
%50 = OpLoad %int %i
%51 = OpAccessChain %_ptr_Function_int %data %50
OpStore %51 %int_5
OpBranch %40
%40 = OpLabel
%52 = OpLoad %int %i
%53 = OpIAdd %int %52 %int_1
OpStore %i %53
OpBranch %38
%39 = OpLabel
OpStore %i_0 %uint_1
OpBranch %54
%54 = OpLabel
OpLoopMerge %55 %56 None
OpBranch %57
%57 = OpLabel
%58 = OpLoad %uint %i_0
%59 = OpLoad %uint %highUnsigned
%60 = OpExtInst %uint %1 UMin %uint_10 %59
%61 = OpAccessChain %_ptr_Uniform_int %_ %int_0
%62 = OpLoad %int %61
%63 = OpBitcast %uint %62
%64 = OpIAdd %uint %60 %63
%65 = OpULessThan %bool %58 %64
OpBranchConditional %65 %66 %55
%66 = OpLabel
%67 = OpLoad %uint %i_0
%68 = OpAccessChain %_ptr_Function_int %data %67
OpStore %68 %int_6
OpBranch %56
%56 = OpLabel
%69 = OpLoad %uint %i_0
%70 = OpIAdd %uint %69 %int_1
OpStore %i_0 %70
OpBranch %54
%55 = OpLabel
%71 = OpAccessChain %_ptr_Function_int %data %int_0
%72 = OpLoad %int %71
%73 = OpIEqual %bool %72 %int_5
OpSelectionMerge %74 None
OpBranchConditional %73 %75 %74
%75 = OpLabel
%76 = OpAccessChain %_ptr_Function_int %data %int_1
%77 = OpLoad %int %76
%78 = OpIEqual %bool %77 %int_6
OpBranch %74
%74 = OpLabel
%79 = OpPhi %bool %73 %55 %78 %75
OpSelectionMerge %80 None
OpBranchConditional %79 %81 %82
%81 = OpLabel
OpStore %_GLF_color %35
OpBranch %80
%82 = OpLabel
OpStore %_GLF_color %36
OpBranch %80
%80 = OpLabel
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,72 @@
cbuffer cbuffer_x_8 : register(b0, space0) {
uint4 x_8[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
int highSigned = 0;
uint highUnsigned = 0u;
int i = 0;
int data[2] = (int[2])0;
uint i_1 = 0u;
bool x_78 = false;
bool x_79_phi = false;
highSigned = 1;
highUnsigned = 2u;
i = 0;
while (true) {
const int x_42 = i;
const int x_43 = highSigned;
const int x_46 = asint(x_8[0].x);
if ((x_42 < (min(10, x_43) + x_46))) {
} else {
break;
}
data[i] = 5;
{
i = (i + 1);
}
}
i_1 = 1u;
while (true) {
const uint x_58 = i_1;
const uint x_59 = highUnsigned;
const int x_62 = asint(x_8[0].x);
if ((x_58 < (min(10u, x_59) + asuint(x_62)))) {
} else {
break;
}
data[i_1] = 6;
{
i_1 = (i_1 + asuint(1));
}
}
const int x_72 = data[0];
const bool x_73 = (x_72 == 5);
x_79_phi = x_73;
if (x_73) {
const int x_77 = data[1];
x_78 = (x_77 == 6);
x_79_phi = x_78;
}
if (x_79_phi) {
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
}
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_3 = {tint_symbol_1.x_GLF_color_1};
return tint_symbol_3;
}

View File

@@ -0,0 +1,83 @@
#include <metal_stdlib>
using namespace metal;
struct buf0 {
/* 0x0000 */ int zero;
};
struct tint_array_wrapper {
int arr[2];
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) {
int highSigned = 0;
uint highUnsigned = 0u;
int i = 0;
tint_array_wrapper data = {};
uint i_1 = 0u;
bool x_78 = false;
bool x_79_phi = false;
highSigned = 1;
highUnsigned = 2u;
i = 0;
while (true) {
int const x_42 = i;
int const x_43 = highSigned;
int const x_46 = x_8.zero;
if ((x_42 < (min(10, x_43) + x_46))) {
} else {
break;
}
int const x_50 = i;
data.arr[x_50] = 5;
{
int const x_52 = i;
i = (x_52 + 1);
}
}
i_1 = 1u;
while (true) {
uint const x_58 = i_1;
uint const x_59 = highUnsigned;
int const x_62 = x_8.zero;
if ((x_58 < (min(10u, x_59) + as_type<uint>(x_62)))) {
} else {
break;
}
uint const x_67 = i_1;
data.arr[x_67] = 6;
{
uint const x_69 = i_1;
i_1 = (x_69 + as_type<uint>(1));
}
}
int const x_72 = data.arr[0];
bool const x_73 = (x_72 == 5);
x_79_phi = x_73;
if (x_73) {
int const x_77 = data.arr[1];
x_78 = (x_77 == 6);
x_79_phi = x_78;
}
bool const x_79 = x_79_phi;
if (x_79) {
*(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
*(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f);
}
return;
}
fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) {
thread float4 tint_symbol_5 = 0.0f;
main_1(x_8, &(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,191 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 112
; Schema: 0
OpCapability Shader
%48 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %buf0 "buf0"
OpMemberName %buf0 0 "zero"
OpName %x_8 "x_8"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
OpName %highSigned "highSigned"
OpName %highUnsigned "highUnsigned"
OpName %i "i"
OpName %data "data"
OpName %i_1 "i_1"
OpName %x_78 "x_78"
OpName %x_79_phi "x_79_phi"
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 %x_8 NonWritable
OpDecorate %x_8 DescriptorSet 0
OpDecorate %x_8 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpDecorate %_arr_int_uint_2 ArrayStride 4
OpMemberDecorate %main_out 0 Offset 0
%int = OpTypeInt 32 1
%buf0 = OpTypeStruct %int
%_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
%9 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9
%void = OpTypeVoid
%12 = OpTypeFunction %void
%_ptr_Function_int = OpTypePointer Function %int
%18 = OpConstantNull %int
%uint = OpTypeInt 32 0
%_ptr_Function_uint = OpTypePointer Function %uint
%22 = OpConstantNull %uint
%uint_2 = OpConstant %uint 2
%_arr_int_uint_2 = OpTypeArray %int %uint_2
%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2
%28 = OpConstantNull %_arr_int_uint_2
%bool = OpTypeBool
%_ptr_Function_bool = OpTypePointer Function %bool
%33 = OpConstantNull %bool
%int_1 = OpConstant %int 1
%int_0 = OpConstant %int 0
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_int = OpTypePointer Uniform %int
%int_10 = OpConstant %int 10
%int_5 = OpConstant %int 5
%uint_1 = OpConstant %uint 1
%uint_10 = OpConstant %uint 10
%int_6 = OpConstant %int 6
%float_1 = OpConstant %float 1
%float_0 = OpConstant %float 0
%98 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%99 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
%main_out = OpTypeStruct %v4float
%100 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %12
%15 = OpLabel
%highSigned = OpVariable %_ptr_Function_int Function %18
%highUnsigned = OpVariable %_ptr_Function_uint Function %22
%i = OpVariable %_ptr_Function_int Function %18
%data = OpVariable %_ptr_Function__arr_int_uint_2 Function %28
%i_1 = OpVariable %_ptr_Function_uint Function %22
%x_78 = OpVariable %_ptr_Function_bool Function %33
%x_79_phi = OpVariable %_ptr_Function_bool Function %33
OpStore %highSigned %int_1
OpStore %highUnsigned %uint_2
OpStore %i %int_0
OpBranch %37
%37 = OpLabel
OpLoopMerge %38 %39 None
OpBranch %40
%40 = OpLabel
%41 = OpLoad %int %i
%42 = OpLoad %int %highSigned
%45 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0
%46 = OpLoad %int %45
%47 = OpExtInst %int %48 SMin %int_10 %42
%50 = OpIAdd %int %47 %46
%51 = OpSLessThan %bool %41 %50
OpSelectionMerge %52 None
OpBranchConditional %51 %53 %54
%53 = OpLabel
OpBranch %52
%54 = OpLabel
OpBranch %38
%52 = OpLabel
%55 = OpLoad %int %i
%56 = OpAccessChain %_ptr_Function_int %data %55
OpStore %56 %int_5
OpBranch %39
%39 = OpLabel
%58 = OpLoad %int %i
%59 = OpIAdd %int %58 %int_1
OpStore %i %59
OpBranch %37
%38 = OpLabel
OpStore %i_1 %uint_1
OpBranch %61
%61 = OpLabel
OpLoopMerge %62 %63 None
OpBranch %64
%64 = OpLabel
%65 = OpLoad %uint %i_1
%66 = OpLoad %uint %highUnsigned
%67 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0
%68 = OpLoad %int %67
%69 = OpExtInst %uint %48 UMin %uint_10 %66
%71 = OpBitcast %uint %68
%72 = OpIAdd %uint %69 %71
%73 = OpULessThan %bool %65 %72
OpSelectionMerge %74 None
OpBranchConditional %73 %75 %76
%75 = OpLabel
OpBranch %74
%76 = OpLabel
OpBranch %62
%74 = OpLabel
%77 = OpLoad %uint %i_1
%78 = OpAccessChain %_ptr_Function_int %data %77
OpStore %78 %int_6
OpBranch %63
%63 = OpLabel
%80 = OpLoad %uint %i_1
%81 = OpBitcast %uint %int_1
%82 = OpIAdd %uint %80 %81
OpStore %i_1 %82
OpBranch %61
%62 = OpLabel
%83 = OpAccessChain %_ptr_Function_int %data %int_0
%84 = OpLoad %int %83
%85 = OpIEqual %bool %84 %int_5
OpStore %x_79_phi %85
OpSelectionMerge %86 None
OpBranchConditional %85 %87 %86
%87 = OpLabel
%88 = OpAccessChain %_ptr_Function_int %data %int_1
%89 = OpLoad %int %88
%90 = OpIEqual %bool %89 %int_6
OpStore %x_78 %90
%91 = OpLoad %bool %x_78
OpStore %x_79_phi %91
OpBranch %86
%86 = OpLabel
%92 = OpLoad %bool %x_79_phi
OpSelectionMerge %93 None
OpBranchConditional %92 %94 %95
%94 = OpLabel
OpStore %x_GLF_color %98
OpBranch %93
%95 = OpLabel
OpStore %x_GLF_color %99
OpBranch %93
%93 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %100
%tint_symbol = OpFunctionParameter %main_out
%104 = OpLabel
%105 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %105
OpReturn
OpFunctionEnd
%main = OpFunction %void None %12
%107 = OpLabel
%108 = OpFunctionCall %void %main_1
%110 = OpLoad %v4float %x_GLF_color
%111 = OpCompositeConstruct %main_out %110
%109 = OpFunctionCall %void %tint_symbol_2 %111
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,80 @@
[[block]]
struct buf0 {
zero : i32;
};
[[group(0), binding(0)]] var<uniform> x_8 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var highSigned : i32;
var highUnsigned : u32;
var i : i32;
var data : array<i32, 2>;
var i_1 : u32;
var x_78 : bool;
var x_79_phi : bool;
highSigned = 1;
highUnsigned = 2u;
i = 0;
loop {
let x_42 : i32 = i;
let x_43 : i32 = highSigned;
let x_46 : i32 = x_8.zero;
if ((x_42 < (min(10, x_43) + x_46))) {
} else {
break;
}
let x_50 : i32 = i;
data[x_50] = 5;
continuing {
let x_52 : i32 = i;
i = (x_52 + 1);
}
}
i_1 = 1u;
loop {
let x_58 : u32 = i_1;
let x_59 : u32 = highUnsigned;
let x_62 : i32 = x_8.zero;
if ((x_58 < (min(10u, x_59) + bitcast<u32>(x_62)))) {
} else {
break;
}
let x_67 : u32 = i_1;
data[x_67] = 6;
continuing {
let x_69 : u32 = i_1;
i_1 = (x_69 + bitcast<u32>(1));
}
}
let x_72 : i32 = data[0];
let x_73 : bool = (x_72 == 5);
x_79_phi = x_73;
if (x_73) {
let x_77 : i32 = data[1];
x_78 = (x_77 == 6);
x_79_phi = x_78;
}
let x_79 : bool = x_79_phi;
if (x_79) {
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
} else {
x_GLF_color = vec4<f32>(0.0, 0.0, 0.0, 0.0);
}
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,80 @@
[[block]]
struct buf0 {
zero : i32;
};
[[group(0), binding(0)]] var<uniform> x_8 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var highSigned : i32;
var highUnsigned : u32;
var i : i32;
var data : array<i32, 2>;
var i_1 : u32;
var x_78 : bool;
var x_79_phi : bool;
highSigned = 1;
highUnsigned = 2u;
i = 0;
loop {
let x_42 : i32 = i;
let x_43 : i32 = highSigned;
let x_46 : i32 = x_8.zero;
if ((x_42 < (min(10, x_43) + x_46))) {
} else {
break;
}
let x_50 : i32 = i;
data[x_50] = 5;
continuing {
let x_52 : i32 = i;
i = (x_52 + 1);
}
}
i_1 = 1u;
loop {
let x_58 : u32 = i_1;
let x_59 : u32 = highUnsigned;
let x_62 : i32 = x_8.zero;
if ((x_58 < (min(10u, x_59) + bitcast<u32>(x_62)))) {
} else {
break;
}
let x_67 : u32 = i_1;
data[x_67] = 6;
continuing {
let x_69 : u32 = i_1;
i_1 = (x_69 + bitcast<u32>(1));
}
}
let x_72 : i32 = data[0];
let x_73 : bool = (x_72 == 5);
x_79_phi = x_73;
if (x_73) {
let x_77 : i32 = data[1];
x_78 = (x_77 == 6);
x_79_phi = x_78;
}
let x_79 : bool = x_79_phi;
if (x_79) {
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
} else {
x_GLF_color = vec4<f32>(0.0, 0.0, 0.0, 0.0);
}
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,72 @@
cbuffer cbuffer_x_8 : register(b0, space0) {
uint4 x_8[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
int highSigned = 0;
uint highUnsigned = 0u;
int i = 0;
int data[2] = (int[2])0;
uint i_1 = 0u;
bool x_78 = false;
bool x_79_phi = false;
highSigned = 1;
highUnsigned = 2u;
i = 0;
while (true) {
const int x_42 = i;
const int x_43 = highSigned;
const int x_46 = asint(x_8[0].x);
if ((x_42 < (min(10, x_43) + x_46))) {
} else {
break;
}
data[i] = 5;
{
i = (i + 1);
}
}
i_1 = 1u;
while (true) {
const uint x_58 = i_1;
const uint x_59 = highUnsigned;
const int x_62 = asint(x_8[0].x);
if ((x_58 < (min(10u, x_59) + asuint(x_62)))) {
} else {
break;
}
data[i_1] = 6;
{
i_1 = (i_1 + asuint(1));
}
}
const int x_72 = data[0];
const bool x_73 = (x_72 == 5);
x_79_phi = x_73;
if (x_73) {
const int x_77 = data[1];
x_78 = (x_77 == 6);
x_79_phi = x_78;
}
if (x_79_phi) {
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
}
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_3 = {tint_symbol_1.x_GLF_color_1};
return tint_symbol_3;
}

View File

@@ -0,0 +1,83 @@
#include <metal_stdlib>
using namespace metal;
struct buf0 {
/* 0x0000 */ int zero;
};
struct tint_array_wrapper {
int arr[2];
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
void main_1(constant buf0& x_8, thread float4* const tint_symbol_4) {
int highSigned = 0;
uint highUnsigned = 0u;
int i = 0;
tint_array_wrapper data = {};
uint i_1 = 0u;
bool x_78 = false;
bool x_79_phi = false;
highSigned = 1;
highUnsigned = 2u;
i = 0;
while (true) {
int const x_42 = i;
int const x_43 = highSigned;
int const x_46 = x_8.zero;
if ((x_42 < (min(10, x_43) + x_46))) {
} else {
break;
}
int const x_50 = i;
data.arr[x_50] = 5;
{
int const x_52 = i;
i = (x_52 + 1);
}
}
i_1 = 1u;
while (true) {
uint const x_58 = i_1;
uint const x_59 = highUnsigned;
int const x_62 = x_8.zero;
if ((x_58 < (min(10u, x_59) + as_type<uint>(x_62)))) {
} else {
break;
}
uint const x_67 = i_1;
data.arr[x_67] = 6;
{
uint const x_69 = i_1;
i_1 = (x_69 + as_type<uint>(1));
}
}
int const x_72 = data.arr[0];
bool const x_73 = (x_72 == 5);
x_79_phi = x_73;
if (x_73) {
int const x_77 = data.arr[1];
x_78 = (x_77 == 6);
x_79_phi = x_78;
}
bool const x_79 = x_79_phi;
if (x_79) {
*(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
*(tint_symbol_4) = float4(0.0f, 0.0f, 0.0f, 0.0f);
}
return;
}
fragment tint_symbol_1 tint_symbol(constant buf0& x_8 [[buffer(0)]]) {
thread float4 tint_symbol_5 = 0.0f;
main_1(x_8, &(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,191 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 112
; Schema: 0
OpCapability Shader
%48 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %buf0 "buf0"
OpMemberName %buf0 0 "zero"
OpName %x_8 "x_8"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
OpName %highSigned "highSigned"
OpName %highUnsigned "highUnsigned"
OpName %i "i"
OpName %data "data"
OpName %i_1 "i_1"
OpName %x_78 "x_78"
OpName %x_79_phi "x_79_phi"
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 %x_8 NonWritable
OpDecorate %x_8 DescriptorSet 0
OpDecorate %x_8 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpDecorate %_arr_int_uint_2 ArrayStride 4
OpMemberDecorate %main_out 0 Offset 0
%int = OpTypeInt 32 1
%buf0 = OpTypeStruct %int
%_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
%9 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9
%void = OpTypeVoid
%12 = OpTypeFunction %void
%_ptr_Function_int = OpTypePointer Function %int
%18 = OpConstantNull %int
%uint = OpTypeInt 32 0
%_ptr_Function_uint = OpTypePointer Function %uint
%22 = OpConstantNull %uint
%uint_2 = OpConstant %uint 2
%_arr_int_uint_2 = OpTypeArray %int %uint_2
%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2
%28 = OpConstantNull %_arr_int_uint_2
%bool = OpTypeBool
%_ptr_Function_bool = OpTypePointer Function %bool
%33 = OpConstantNull %bool
%int_1 = OpConstant %int 1
%int_0 = OpConstant %int 0
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_int = OpTypePointer Uniform %int
%int_10 = OpConstant %int 10
%int_5 = OpConstant %int 5
%uint_1 = OpConstant %uint 1
%uint_10 = OpConstant %uint 10
%int_6 = OpConstant %int 6
%float_1 = OpConstant %float 1
%float_0 = OpConstant %float 0
%98 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%99 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
%main_out = OpTypeStruct %v4float
%100 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %12
%15 = OpLabel
%highSigned = OpVariable %_ptr_Function_int Function %18
%highUnsigned = OpVariable %_ptr_Function_uint Function %22
%i = OpVariable %_ptr_Function_int Function %18
%data = OpVariable %_ptr_Function__arr_int_uint_2 Function %28
%i_1 = OpVariable %_ptr_Function_uint Function %22
%x_78 = OpVariable %_ptr_Function_bool Function %33
%x_79_phi = OpVariable %_ptr_Function_bool Function %33
OpStore %highSigned %int_1
OpStore %highUnsigned %uint_2
OpStore %i %int_0
OpBranch %37
%37 = OpLabel
OpLoopMerge %38 %39 None
OpBranch %40
%40 = OpLabel
%41 = OpLoad %int %i
%42 = OpLoad %int %highSigned
%45 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0
%46 = OpLoad %int %45
%47 = OpExtInst %int %48 SMin %int_10 %42
%50 = OpIAdd %int %47 %46
%51 = OpSLessThan %bool %41 %50
OpSelectionMerge %52 None
OpBranchConditional %51 %53 %54
%53 = OpLabel
OpBranch %52
%54 = OpLabel
OpBranch %38
%52 = OpLabel
%55 = OpLoad %int %i
%56 = OpAccessChain %_ptr_Function_int %data %55
OpStore %56 %int_5
OpBranch %39
%39 = OpLabel
%58 = OpLoad %int %i
%59 = OpIAdd %int %58 %int_1
OpStore %i %59
OpBranch %37
%38 = OpLabel
OpStore %i_1 %uint_1
OpBranch %61
%61 = OpLabel
OpLoopMerge %62 %63 None
OpBranch %64
%64 = OpLabel
%65 = OpLoad %uint %i_1
%66 = OpLoad %uint %highUnsigned
%67 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0
%68 = OpLoad %int %67
%69 = OpExtInst %uint %48 UMin %uint_10 %66
%71 = OpBitcast %uint %68
%72 = OpIAdd %uint %69 %71
%73 = OpULessThan %bool %65 %72
OpSelectionMerge %74 None
OpBranchConditional %73 %75 %76
%75 = OpLabel
OpBranch %74
%76 = OpLabel
OpBranch %62
%74 = OpLabel
%77 = OpLoad %uint %i_1
%78 = OpAccessChain %_ptr_Function_int %data %77
OpStore %78 %int_6
OpBranch %63
%63 = OpLabel
%80 = OpLoad %uint %i_1
%81 = OpBitcast %uint %int_1
%82 = OpIAdd %uint %80 %81
OpStore %i_1 %82
OpBranch %61
%62 = OpLabel
%83 = OpAccessChain %_ptr_Function_int %data %int_0
%84 = OpLoad %int %83
%85 = OpIEqual %bool %84 %int_5
OpStore %x_79_phi %85
OpSelectionMerge %86 None
OpBranchConditional %85 %87 %86
%87 = OpLabel
%88 = OpAccessChain %_ptr_Function_int %data %int_1
%89 = OpLoad %int %88
%90 = OpIEqual %bool %89 %int_6
OpStore %x_78 %90
%91 = OpLoad %bool %x_78
OpStore %x_79_phi %91
OpBranch %86
%86 = OpLabel
%92 = OpLoad %bool %x_79_phi
OpSelectionMerge %93 None
OpBranchConditional %92 %94 %95
%94 = OpLabel
OpStore %x_GLF_color %98
OpBranch %93
%95 = OpLabel
OpStore %x_GLF_color %99
OpBranch %93
%93 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %100
%tint_symbol = OpFunctionParameter %main_out
%104 = OpLabel
%105 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %105
OpReturn
OpFunctionEnd
%main = OpFunction %void None %12
%107 = OpLabel
%108 = OpFunctionCall %void %main_1
%110 = OpLoad %v4float %x_GLF_color
%111 = OpCompositeConstruct %main_out %110
%109 = OpFunctionCall %void %tint_symbol_2 %111
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,80 @@
[[block]]
struct buf0 {
zero : i32;
};
[[group(0), binding(0)]] var<uniform> x_8 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var highSigned : i32;
var highUnsigned : u32;
var i : i32;
var data : array<i32, 2>;
var i_1 : u32;
var x_78 : bool;
var x_79_phi : bool;
highSigned = 1;
highUnsigned = 2u;
i = 0;
loop {
let x_42 : i32 = i;
let x_43 : i32 = highSigned;
let x_46 : i32 = x_8.zero;
if ((x_42 < (min(10, x_43) + x_46))) {
} else {
break;
}
let x_50 : i32 = i;
data[x_50] = 5;
continuing {
let x_52 : i32 = i;
i = (x_52 + 1);
}
}
i_1 = 1u;
loop {
let x_58 : u32 = i_1;
let x_59 : u32 = highUnsigned;
let x_62 : i32 = x_8.zero;
if ((x_58 < (min(10u, x_59) + bitcast<u32>(x_62)))) {
} else {
break;
}
let x_67 : u32 = i_1;
data[x_67] = 6;
continuing {
let x_69 : u32 = i_1;
i_1 = (x_69 + bitcast<u32>(1));
}
}
let x_72 : i32 = data[0];
let x_73 : bool = (x_72 == 5);
x_79_phi = x_73;
if (x_73) {
let x_77 : i32 = data[1];
x_78 = (x_77 == 6);
x_79_phi = x_78;
}
let x_79 : bool = x_79_phi;
if (x_79) {
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
} else {
x_GLF_color = vec4<f32>(0.0, 0.0, 0.0, 0.0);
}
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);
}