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,127 @@
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_ "func("
OpName %_GLF_global_loop_count "_GLF_global_loop_count"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "_GLF_uniform_int_values"
OpName %_ ""
OpName %a "a"
OpName %_GLF_color "_GLF_color"
OpDecorate %_arr_int_uint_3 ArrayStride 16
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %buf0 Block
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
OpDecorate %_GLF_color Location 0
%void = OpTypeVoid
%11 = OpTypeFunction %void
%int = OpTypeInt 32 1
%13 = OpTypeFunction %int
%_ptr_Private_int = OpTypePointer Private %int
%_GLF_global_loop_count = OpVariable %_ptr_Private_int Private
%int_0 = OpConstant %int 0
%int_100 = OpConstant %int 100
%bool = OpTypeBool
%int_1 = OpConstant %int 1
%uint = OpTypeInt 32 0
%uint_3 = OpConstant %uint 3
%_arr_int_uint_3 = OpTypeArray %int %uint_3
%buf0 = OpTypeStruct %_arr_int_uint_3
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%_ = OpVariable %_ptr_Uniform_buf0 Uniform
%_ptr_Uniform_int = OpTypePointer Uniform %int
%int_2 = OpConstant %int 2
%false = OpConstantFalse %bool
%true = OpConstantTrue %bool
%_ptr_Function_int = OpTypePointer Function %int
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_GLF_color = OpVariable %_ptr_Output_v4float Output
%main = OpFunction %void None %11
%30 = OpLabel
%a = OpVariable %_ptr_Function_int Function
OpStore %_GLF_global_loop_count %int_0
OpBranch %31
%31 = OpLabel
OpLoopMerge %32 %33 None
OpBranch %34
%34 = OpLabel
%35 = OpLoad %int %_GLF_global_loop_count
%36 = OpIAdd %int %35 %int_1
OpStore %_GLF_global_loop_count %36
OpSelectionMerge %37 None
OpBranchConditional %false %38 %37
%38 = OpLabel
OpReturn
%37 = OpLabel
OpBranch %33
%33 = OpLabel
%39 = OpLoad %int %_GLF_global_loop_count
%40 = OpSLessThan %bool %39 %int_100
%41 = OpLogicalAnd %bool %true %40
OpBranchConditional %41 %31 %32
%32 = OpLabel
%42 = OpFunctionCall %int %func_
OpStore %a %42
%43 = OpLoad %int %a
%44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2
%45 = OpLoad %int %44
%46 = OpIEqual %bool %43 %45
OpSelectionMerge %47 None
OpBranchConditional %46 %48 %49
%48 = OpLabel
%50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
%51 = OpLoad %int %50
%52 = OpConvertSToF %float %51
%53 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
%54 = OpLoad %int %53
%55 = OpConvertSToF %float %54
%56 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
%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 = OpCompositeConstruct %v4float %52 %55 %58 %61
OpStore %_GLF_color %62
OpBranch %47
%49 = OpLabel
%63 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
%64 = OpLoad %int %63
%65 = OpConvertSToF %float %64
%66 = OpCompositeConstruct %v4float %65 %65 %65 %65
OpStore %_GLF_color %66
OpBranch %47
%47 = OpLabel
OpReturn
OpFunctionEnd
%func_ = OpFunction %int None %13
%67 = OpLabel
OpBranch %68
%68 = OpLabel
OpLoopMerge %69 %70 None
OpBranch %71
%71 = OpLabel
%72 = OpLoad %int %_GLF_global_loop_count
%73 = OpSLessThan %bool %72 %int_100
OpBranchConditional %73 %74 %69
%74 = OpLabel
%75 = OpLoad %int %_GLF_global_loop_count
%76 = OpIAdd %int %75 %int_1
OpStore %_GLF_global_loop_count %76
%77 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
%78 = OpLoad %int %77
OpReturnValue %78
%70 = OpLabel
OpBranch %68
%69 = OpLabel
%79 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2
%80 = OpLoad %int %79
OpReturnValue %80
OpFunctionEnd

View File

@@ -0,0 +1,73 @@
static int x_GLF_global_loop_count = 0;
cbuffer cbuffer_x_7 : register(b0, space0) {
uint4 x_7[3];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
int func_() {
while (true) {
if ((x_GLF_global_loop_count < 100)) {
} else {
break;
}
x_GLF_global_loop_count = (x_GLF_global_loop_count + 1);
const uint scalar_offset = ((16u * uint(0))) / 4;
const int x_78 = asint(x_7[scalar_offset / 4][scalar_offset % 4]);
return x_78;
}
const int x_80 = asint(x_7[2].x);
return x_80;
}
void main_1() {
int a = 0;
x_GLF_global_loop_count = 0;
while (true) {
x_GLF_global_loop_count = (x_GLF_global_loop_count + 1);
if (false) {
return;
}
{
bool tint_tmp = true;
if (tint_tmp) {
tint_tmp = (x_GLF_global_loop_count < 100);
}
if ((tint_tmp)) {
} else {
break;
}
}
}
const int x_42 = func_();
a = x_42;
const int x_43 = a;
const int x_45 = asint(x_7[2].x);
if ((x_43 == x_45)) {
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
const int x_51 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]);
const int x_54 = asint(x_7[1].x);
const int x_57 = asint(x_7[1].x);
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
const int x_60 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]);
x_GLF_color = float4(float(x_51), float(x_54), float(x_57), float(x_60));
} else {
const int x_64 = asint(x_7[1].x);
const float x_65 = float(x_64);
x_GLF_color = float4(x_65, x_65, x_65, x_65);
}
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,80 @@
#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[3];
};
struct buf0 {
/* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values;
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
int func_(constant buf0& x_7, thread int* const tint_symbol_4) {
while (true) {
int const x_72 = *(tint_symbol_4);
if ((x_72 < 100)) {
} else {
break;
}
int const x_75 = *(tint_symbol_4);
*(tint_symbol_4) = (x_75 + 1);
int const x_78 = x_7.x_GLF_uniform_int_values.arr[0].el;
return x_78;
}
int const x_80 = x_7.x_GLF_uniform_int_values.arr[2].el;
return x_80;
}
void main_1(constant buf0& x_7, thread int* const tint_symbol_5, thread float4* const tint_symbol_6) {
int a = 0;
*(tint_symbol_5) = 0;
while (true) {
int const x_35 = *(tint_symbol_5);
*(tint_symbol_5) = (x_35 + 1);
if (false) {
return;
}
{
int const x_39 = *(tint_symbol_5);
if ((true && (x_39 < 100))) {
} else {
break;
}
}
}
int const x_42 = func_(x_7, tint_symbol_5);
a = x_42;
int const x_43 = a;
int const x_45 = x_7.x_GLF_uniform_int_values.arr[2].el;
if ((x_43 == x_45)) {
int const x_51 = x_7.x_GLF_uniform_int_values.arr[0].el;
int const x_54 = x_7.x_GLF_uniform_int_values.arr[1].el;
int const x_57 = x_7.x_GLF_uniform_int_values.arr[1].el;
int const x_60 = x_7.x_GLF_uniform_int_values.arr[0].el;
*(tint_symbol_6) = float4(float(x_51), float(x_54), float(x_57), float(x_60));
} else {
int const x_64 = x_7.x_GLF_uniform_int_values.arr[1].el;
float const x_65 = float(x_64);
*(tint_symbol_6) = float4(x_65, x_65, x_65, x_65);
}
return;
}
fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) {
thread int tint_symbol_7 = 0;
thread float4 tint_symbol_8 = 0.0f;
main_1(x_7, &(tint_symbol_7), &(tint_symbol_8));
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_8};
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,182 @@
SKIP: FAILED
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 104
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %x_GLF_global_loop_count "x_GLF_global_loop_count"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "x_GLF_uniform_int_values"
OpName %x_7 "x_7"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %func_ "func_"
OpName %main_1 "main_1"
OpName %a "a"
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_3 ArrayStride 16
OpDecorate %x_7 NonWritable
OpDecorate %x_7 DescriptorSet 0
OpDecorate %x_7 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpMemberDecorate %main_out 0 Offset 0
%int = OpTypeInt 32 1
%_ptr_Private_int = OpTypePointer Private %int
%4 = OpConstantNull %int
%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4
%uint = OpTypeInt 32 0
%uint_3 = OpConstant %uint 3
%_arr_int_uint_3 = OpTypeArray %int %uint_3
%buf0 = OpTypeStruct %_arr_int_uint_3
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_7 = OpVariable %_ptr_Uniform_buf0 Uniform
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%15 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %15
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %15
%18 = OpTypeFunction %int
%int_100 = OpConstant %int 100
%bool = OpTypeBool
%int_1 = OpConstant %int 1
%uint_0 = OpConstant %uint 0
%int_0 = OpConstant %int 0
%_ptr_Uniform_int = OpTypePointer Uniform %int
%int_2 = OpConstant %int 2
%void = OpTypeVoid
%43 = OpTypeFunction %void
%_ptr_Function_int = OpTypePointer Function %int
%false = OpConstantFalse %bool
%true = OpConstantTrue %bool
%main_out = OpTypeStruct %v4float
%92 = OpTypeFunction %void %main_out
%func_ = OpFunction %int None %18
%20 = OpLabel
OpBranch %21
%21 = OpLabel
OpLoopMerge %22 %23 None
OpBranch %24
%24 = OpLabel
%25 = OpLoad %int %x_GLF_global_loop_count
%27 = OpSLessThan %bool %25 %int_100
OpSelectionMerge %29 None
OpBranchConditional %27 %30 %31
%30 = OpLabel
OpBranch %29
%31 = OpLabel
OpBranch %22
%29 = OpLabel
%32 = OpLoad %int %x_GLF_global_loop_count
%34 = OpIAdd %int %32 %int_1
OpStore %x_GLF_global_loop_count %34
%38 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0
%39 = OpLoad %int %38
OpReturnValue %39
%23 = OpLabel
OpBranch %21
%22 = OpLabel
%41 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2
%42 = OpLoad %int %41
OpReturnValue %42
OpFunctionEnd
%main_1 = OpFunction %void None %43
%46 = OpLabel
%a = OpVariable %_ptr_Function_int Function %4
OpStore %x_GLF_global_loop_count %int_0
OpBranch %49
%49 = OpLabel
OpLoopMerge %50 %51 None
OpBranch %52
%52 = OpLabel
%53 = OpLoad %int %x_GLF_global_loop_count
%54 = OpIAdd %int %53 %int_1
OpStore %x_GLF_global_loop_count %54
OpSelectionMerge %56 None
OpBranchConditional %false %57 %56
%57 = OpLabel
OpReturn
%56 = OpLabel
OpBranch %51
%51 = OpLabel
%58 = OpLoad %int %x_GLF_global_loop_count
OpSelectionMerge %60 None
OpBranchConditional %true %61 %60
%61 = OpLabel
%62 = OpSLessThan %bool %58 %int_100
OpBranch %60
%60 = OpLabel
%63 = OpPhi %bool %true %51 %62 %61
OpSelectionMerge %64 None
OpBranchConditional %63 %65 %66
%65 = OpLabel
OpBranch %64
%66 = OpLabel
OpBranch %50
%64 = OpLabel
OpBranch %49
%50 = OpLabel
%67 = OpFunctionCall %int %func_
OpStore %a %67
%68 = OpLoad %int %a
%69 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2
%70 = OpLoad %int %69
%71 = OpIEqual %bool %68 %70
OpSelectionMerge %72 None
OpBranchConditional %71 %73 %74
%73 = OpLabel
%75 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0
%76 = OpLoad %int %75
%77 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1
%78 = OpLoad %int %77
%79 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1
%80 = OpLoad %int %79
%81 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0
%82 = OpLoad %int %81
%83 = OpConvertSToF %float %76
%84 = OpConvertSToF %float %78
%85 = OpConvertSToF %float %80
%86 = OpConvertSToF %float %82
%87 = OpCompositeConstruct %v4float %83 %84 %85 %86
OpStore %x_GLF_color %87
OpBranch %72
%74 = OpLabel
%88 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1
%89 = OpLoad %int %88
%90 = OpConvertSToF %float %89
%91 = OpCompositeConstruct %v4float %90 %90 %90 %90
OpStore %x_GLF_color %91
OpBranch %72
%72 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %92
%tint_symbol = OpFunctionParameter %main_out
%96 = OpLabel
%97 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %97
OpReturn
OpFunctionEnd
%main = OpFunction %void None %43
%99 = OpLabel
%100 = OpFunctionCall %void %main_1
%102 = OpLoad %v4float %x_GLF_color
%103 = OpCompositeConstruct %main_out %102
%101 = OpFunctionCall %void %tint_symbol_2 %103
OpReturn
OpFunctionEnd
1:1: The continue construct with the continue target 51[%51] is not post dominated by the back-edge block 64[%64]
%64 = OpLabel

View File

@@ -0,0 +1,75 @@
type Arr = [[stride(16)]] array<i32, 3>;
[[block]]
struct buf0 {
x_GLF_uniform_int_values : Arr;
};
var<private> x_GLF_global_loop_count : i32;
[[group(0), binding(0)]] var<uniform> x_7 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn func_() -> i32 {
loop {
let x_72 : i32 = x_GLF_global_loop_count;
if ((x_72 < 100)) {
} else {
break;
}
let x_75 : i32 = x_GLF_global_loop_count;
x_GLF_global_loop_count = (x_75 + 1);
let x_78 : i32 = x_7.x_GLF_uniform_int_values[0];
return x_78;
}
let x_80 : i32 = x_7.x_GLF_uniform_int_values[2];
return x_80;
}
fn main_1() {
var a : i32;
x_GLF_global_loop_count = 0;
loop {
let x_35 : i32 = x_GLF_global_loop_count;
x_GLF_global_loop_count = (x_35 + 1);
if (false) {
return;
}
continuing {
let x_39 : i32 = x_GLF_global_loop_count;
if ((true && (x_39 < 100))) {
} else {
break;
}
}
}
let x_42 : i32 = func_();
a = x_42;
let x_43 : i32 = a;
let x_45 : i32 = x_7.x_GLF_uniform_int_values[2];
if ((x_43 == x_45)) {
let x_51 : i32 = x_7.x_GLF_uniform_int_values[0];
let x_54 : i32 = x_7.x_GLF_uniform_int_values[1];
let x_57 : i32 = x_7.x_GLF_uniform_int_values[1];
let x_60 : i32 = x_7.x_GLF_uniform_int_values[0];
x_GLF_color = vec4<f32>(f32(x_51), f32(x_54), f32(x_57), f32(x_60));
} else {
let x_64 : i32 = x_7.x_GLF_uniform_int_values[1];
let x_65 : f32 = f32(x_64);
x_GLF_color = vec4<f32>(x_65, x_65, x_65, x_65);
}
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,75 @@
type Arr = [[stride(16)]] array<i32, 3>;
[[block]]
struct buf0 {
x_GLF_uniform_int_values : Arr;
};
var<private> x_GLF_global_loop_count : i32;
[[group(0), binding(0)]] var<uniform> x_7 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn func_() -> i32 {
loop {
let x_72 : i32 = x_GLF_global_loop_count;
if ((x_72 < 100)) {
} else {
break;
}
let x_75 : i32 = x_GLF_global_loop_count;
x_GLF_global_loop_count = (x_75 + 1);
let x_78 : i32 = x_7.x_GLF_uniform_int_values[0];
return x_78;
}
let x_80 : i32 = x_7.x_GLF_uniform_int_values[2];
return x_80;
}
fn main_1() {
var a : i32;
x_GLF_global_loop_count = 0;
loop {
let x_35 : i32 = x_GLF_global_loop_count;
x_GLF_global_loop_count = (x_35 + 1);
if (false) {
return;
}
continuing {
let x_39 : i32 = x_GLF_global_loop_count;
if ((true && (x_39 < 100))) {
} else {
break;
}
}
}
let x_42 : i32 = func_();
a = x_42;
let x_43 : i32 = a;
let x_45 : i32 = x_7.x_GLF_uniform_int_values[2];
if ((x_43 == x_45)) {
let x_51 : i32 = x_7.x_GLF_uniform_int_values[0];
let x_54 : i32 = x_7.x_GLF_uniform_int_values[1];
let x_57 : i32 = x_7.x_GLF_uniform_int_values[1];
let x_60 : i32 = x_7.x_GLF_uniform_int_values[0];
x_GLF_color = vec4<f32>(f32(x_51), f32(x_54), f32(x_57), f32(x_60));
} else {
let x_64 : i32 = x_7.x_GLF_uniform_int_values[1];
let x_65 : f32 = f32(x_64);
x_GLF_color = vec4<f32>(x_65, x_65, x_65, x_65);
}
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,73 @@
static int x_GLF_global_loop_count = 0;
cbuffer cbuffer_x_7 : register(b0, space0) {
uint4 x_7[3];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
int func_() {
while (true) {
if ((x_GLF_global_loop_count < 100)) {
} else {
break;
}
x_GLF_global_loop_count = (x_GLF_global_loop_count + 1);
const uint scalar_offset = ((16u * uint(0))) / 4;
const int x_78 = asint(x_7[scalar_offset / 4][scalar_offset % 4]);
return x_78;
}
const int x_80 = asint(x_7[2].x);
return x_80;
}
void main_1() {
int a = 0;
x_GLF_global_loop_count = 0;
while (true) {
x_GLF_global_loop_count = (x_GLF_global_loop_count + 1);
if (false) {
return;
}
{
bool tint_tmp = true;
if (tint_tmp) {
tint_tmp = (x_GLF_global_loop_count < 100);
}
if ((tint_tmp)) {
} else {
break;
}
}
}
const int x_42 = func_();
a = x_42;
const int x_43 = a;
const int x_45 = asint(x_7[2].x);
if ((x_43 == x_45)) {
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
const int x_51 = asint(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]);
const int x_54 = asint(x_7[1].x);
const int x_57 = asint(x_7[1].x);
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
const int x_60 = asint(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]);
x_GLF_color = float4(float(x_51), float(x_54), float(x_57), float(x_60));
} else {
const int x_64 = asint(x_7[1].x);
const float x_65 = float(x_64);
x_GLF_color = float4(x_65, x_65, x_65, x_65);
}
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,80 @@
#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[3];
};
struct buf0 {
/* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values;
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
int func_(constant buf0& x_7, thread int* const tint_symbol_4) {
while (true) {
int const x_72 = *(tint_symbol_4);
if ((x_72 < 100)) {
} else {
break;
}
int const x_75 = *(tint_symbol_4);
*(tint_symbol_4) = (x_75 + 1);
int const x_78 = x_7.x_GLF_uniform_int_values.arr[0].el;
return x_78;
}
int const x_80 = x_7.x_GLF_uniform_int_values.arr[2].el;
return x_80;
}
void main_1(constant buf0& x_7, thread int* const tint_symbol_5, thread float4* const tint_symbol_6) {
int a = 0;
*(tint_symbol_5) = 0;
while (true) {
int const x_35 = *(tint_symbol_5);
*(tint_symbol_5) = (x_35 + 1);
if (false) {
return;
}
{
int const x_39 = *(tint_symbol_5);
if ((true && (x_39 < 100))) {
} else {
break;
}
}
}
int const x_42 = func_(x_7, tint_symbol_5);
a = x_42;
int const x_43 = a;
int const x_45 = x_7.x_GLF_uniform_int_values.arr[2].el;
if ((x_43 == x_45)) {
int const x_51 = x_7.x_GLF_uniform_int_values.arr[0].el;
int const x_54 = x_7.x_GLF_uniform_int_values.arr[1].el;
int const x_57 = x_7.x_GLF_uniform_int_values.arr[1].el;
int const x_60 = x_7.x_GLF_uniform_int_values.arr[0].el;
*(tint_symbol_6) = float4(float(x_51), float(x_54), float(x_57), float(x_60));
} else {
int const x_64 = x_7.x_GLF_uniform_int_values.arr[1].el;
float const x_65 = float(x_64);
*(tint_symbol_6) = float4(x_65, x_65, x_65, x_65);
}
return;
}
fragment tint_symbol_1 tint_symbol(constant buf0& x_7 [[buffer(0)]]) {
thread int tint_symbol_7 = 0;
thread float4 tint_symbol_8 = 0.0f;
main_1(x_7, &(tint_symbol_7), &(tint_symbol_8));
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_8};
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,182 @@
SKIP: FAILED
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 104
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %x_GLF_global_loop_count "x_GLF_global_loop_count"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "x_GLF_uniform_int_values"
OpName %x_7 "x_7"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %func_ "func_"
OpName %main_1 "main_1"
OpName %a "a"
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_3 ArrayStride 16
OpDecorate %x_7 NonWritable
OpDecorate %x_7 DescriptorSet 0
OpDecorate %x_7 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpMemberDecorate %main_out 0 Offset 0
%int = OpTypeInt 32 1
%_ptr_Private_int = OpTypePointer Private %int
%4 = OpConstantNull %int
%x_GLF_global_loop_count = OpVariable %_ptr_Private_int Private %4
%uint = OpTypeInt 32 0
%uint_3 = OpConstant %uint 3
%_arr_int_uint_3 = OpTypeArray %int %uint_3
%buf0 = OpTypeStruct %_arr_int_uint_3
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_7 = OpVariable %_ptr_Uniform_buf0 Uniform
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%15 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %15
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %15
%18 = OpTypeFunction %int
%int_100 = OpConstant %int 100
%bool = OpTypeBool
%int_1 = OpConstant %int 1
%uint_0 = OpConstant %uint 0
%int_0 = OpConstant %int 0
%_ptr_Uniform_int = OpTypePointer Uniform %int
%int_2 = OpConstant %int 2
%void = OpTypeVoid
%43 = OpTypeFunction %void
%_ptr_Function_int = OpTypePointer Function %int
%false = OpConstantFalse %bool
%true = OpConstantTrue %bool
%main_out = OpTypeStruct %v4float
%92 = OpTypeFunction %void %main_out
%func_ = OpFunction %int None %18
%20 = OpLabel
OpBranch %21
%21 = OpLabel
OpLoopMerge %22 %23 None
OpBranch %24
%24 = OpLabel
%25 = OpLoad %int %x_GLF_global_loop_count
%27 = OpSLessThan %bool %25 %int_100
OpSelectionMerge %29 None
OpBranchConditional %27 %30 %31
%30 = OpLabel
OpBranch %29
%31 = OpLabel
OpBranch %22
%29 = OpLabel
%32 = OpLoad %int %x_GLF_global_loop_count
%34 = OpIAdd %int %32 %int_1
OpStore %x_GLF_global_loop_count %34
%38 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0
%39 = OpLoad %int %38
OpReturnValue %39
%23 = OpLabel
OpBranch %21
%22 = OpLabel
%41 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2
%42 = OpLoad %int %41
OpReturnValue %42
OpFunctionEnd
%main_1 = OpFunction %void None %43
%46 = OpLabel
%a = OpVariable %_ptr_Function_int Function %4
OpStore %x_GLF_global_loop_count %int_0
OpBranch %49
%49 = OpLabel
OpLoopMerge %50 %51 None
OpBranch %52
%52 = OpLabel
%53 = OpLoad %int %x_GLF_global_loop_count
%54 = OpIAdd %int %53 %int_1
OpStore %x_GLF_global_loop_count %54
OpSelectionMerge %56 None
OpBranchConditional %false %57 %56
%57 = OpLabel
OpReturn
%56 = OpLabel
OpBranch %51
%51 = OpLabel
%58 = OpLoad %int %x_GLF_global_loop_count
OpSelectionMerge %60 None
OpBranchConditional %true %61 %60
%61 = OpLabel
%62 = OpSLessThan %bool %58 %int_100
OpBranch %60
%60 = OpLabel
%63 = OpPhi %bool %true %51 %62 %61
OpSelectionMerge %64 None
OpBranchConditional %63 %65 %66
%65 = OpLabel
OpBranch %64
%66 = OpLabel
OpBranch %50
%64 = OpLabel
OpBranch %49
%50 = OpLabel
%67 = OpFunctionCall %int %func_
OpStore %a %67
%68 = OpLoad %int %a
%69 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_2
%70 = OpLoad %int %69
%71 = OpIEqual %bool %68 %70
OpSelectionMerge %72 None
OpBranchConditional %71 %73 %74
%73 = OpLabel
%75 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0
%76 = OpLoad %int %75
%77 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1
%78 = OpLoad %int %77
%79 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1
%80 = OpLoad %int %79
%81 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_0
%82 = OpLoad %int %81
%83 = OpConvertSToF %float %76
%84 = OpConvertSToF %float %78
%85 = OpConvertSToF %float %80
%86 = OpConvertSToF %float %82
%87 = OpCompositeConstruct %v4float %83 %84 %85 %86
OpStore %x_GLF_color %87
OpBranch %72
%74 = OpLabel
%88 = OpAccessChain %_ptr_Uniform_int %x_7 %uint_0 %int_1
%89 = OpLoad %int %88
%90 = OpConvertSToF %float %89
%91 = OpCompositeConstruct %v4float %90 %90 %90 %90
OpStore %x_GLF_color %91
OpBranch %72
%72 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %92
%tint_symbol = OpFunctionParameter %main_out
%96 = OpLabel
%97 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %97
OpReturn
OpFunctionEnd
%main = OpFunction %void None %43
%99 = OpLabel
%100 = OpFunctionCall %void %main_1
%102 = OpLoad %v4float %x_GLF_color
%103 = OpCompositeConstruct %main_out %102
%101 = OpFunctionCall %void %tint_symbol_2 %103
OpReturn
OpFunctionEnd
1:1: The continue construct with the continue target 51[%51] is not post dominated by the back-edge block 64[%64]
%64 = OpLabel

View File

@@ -0,0 +1,75 @@
type Arr = [[stride(16)]] array<i32, 3>;
[[block]]
struct buf0 {
x_GLF_uniform_int_values : Arr;
};
var<private> x_GLF_global_loop_count : i32;
[[group(0), binding(0)]] var<uniform> x_7 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn func_() -> i32 {
loop {
let x_72 : i32 = x_GLF_global_loop_count;
if ((x_72 < 100)) {
} else {
break;
}
let x_75 : i32 = x_GLF_global_loop_count;
x_GLF_global_loop_count = (x_75 + 1);
let x_78 : i32 = x_7.x_GLF_uniform_int_values[0];
return x_78;
}
let x_80 : i32 = x_7.x_GLF_uniform_int_values[2];
return x_80;
}
fn main_1() {
var a : i32;
x_GLF_global_loop_count = 0;
loop {
let x_35 : i32 = x_GLF_global_loop_count;
x_GLF_global_loop_count = (x_35 + 1);
if (false) {
return;
}
continuing {
let x_39 : i32 = x_GLF_global_loop_count;
if ((true && (x_39 < 100))) {
} else {
break;
}
}
}
let x_42 : i32 = func_();
a = x_42;
let x_43 : i32 = a;
let x_45 : i32 = x_7.x_GLF_uniform_int_values[2];
if ((x_43 == x_45)) {
let x_51 : i32 = x_7.x_GLF_uniform_int_values[0];
let x_54 : i32 = x_7.x_GLF_uniform_int_values[1];
let x_57 : i32 = x_7.x_GLF_uniform_int_values[1];
let x_60 : i32 = x_7.x_GLF_uniform_int_values[0];
x_GLF_color = vec4<f32>(f32(x_51), f32(x_54), f32(x_57), f32(x_60));
} else {
let x_64 : i32 = x_7.x_GLF_uniform_int_values[1];
let x_65 : f32 = f32(x_64);
x_GLF_color = vec4<f32>(x_65, x_65, x_65, x_65);
}
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);
}