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,122 @@
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 %f "f"
OpName %arr "arr"
OpName %buf1 "buf1"
OpMemberName %buf1 0 "_GLF_uniform_float_values"
OpName %_ ""
OpName %buf0 "buf0"
OpMemberName %buf0 0 "_GLF_uniform_int_values"
OpName %__0 ""
OpName %_GLF_color "_GLF_color"
OpDecorate %_arr_float_uint_2 ArrayStride 16
OpMemberDecorate %buf1 0 Offset 0
OpDecorate %buf1 Block
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 1
OpDecorate %_arr_int_uint_4 ArrayStride 16
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %buf0 Block
OpDecorate %__0 DescriptorSet 0
OpDecorate %__0 Binding 0
OpDecorate %_GLF_color Location 0
%void = OpTypeVoid
%13 = OpTypeFunction %void
%float = OpTypeFloat 32
%_ptr_Function_float = OpTypePointer Function %float
%float_2 = OpConstant %float 2
%uint = OpTypeInt 32 0
%uint_10 = OpConstant %uint 10
%_arr_float_uint_10 = OpTypeArray %float %uint_10
%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10
%uint_2 = OpConstant %uint 2
%_arr_float_uint_2 = OpTypeArray %float %uint_2
%buf1 = OpTypeStruct %_arr_float_uint_2
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
%_ = OpVariable %_ptr_Uniform_buf1 Uniform
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%_ptr_Uniform_float = OpTypePointer Uniform %float
%int_1 = OpConstant %int 1
%uint_4 = OpConstant %uint 4
%_arr_int_uint_4 = OpTypeArray %int %uint_4
%buf0 = OpTypeStruct %_arr_int_uint_4
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%__0 = OpVariable %_ptr_Uniform_buf0 Uniform
%_ptr_Uniform_int = OpTypePointer Uniform %int
%int_3 = OpConstant %int 3
%bool = OpTypeBool
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_GLF_color = OpVariable %_ptr_Output_v4float Output
%int_2 = OpConstant %int 2
%main = OpFunction %void None %13
%35 = OpLabel
%f = OpVariable %_ptr_Function_float Function
%arr = OpVariable %_ptr_Function__arr_float_uint_10 Function
OpStore %f %float_2
%36 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0
%37 = OpLoad %float %36
%38 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0
%39 = OpLoad %float %38
%40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0
%41 = OpLoad %float %40
%42 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0
%43 = OpLoad %float %42
%44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0
%45 = OpLoad %float %44
%46 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0
%47 = OpLoad %float %46
%48 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0
%49 = OpLoad %float %48
%50 = OpLoad %float %f
%51 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1
%52 = OpLoad %float %51
%53 = OpExtInst %float %1 Pow %50 %52
%54 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0
%55 = OpLoad %float %54
%56 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0
%57 = OpLoad %float %56
%58 = OpCompositeConstruct %_arr_float_uint_10 %37 %39 %41 %43 %45 %47 %49 %53 %55 %57
OpStore %arr %58
%59 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0
%60 = OpLoad %int %59
%61 = OpAccessChain %_ptr_Function_float %arr %60
%62 = OpLoad %float %61
%63 = OpConvertFToS %int %62
%64 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3
%65 = OpLoad %int %64
%66 = OpIEqual %bool %63 %65
OpSelectionMerge %67 None
OpBranchConditional %66 %68 %69
%68 = OpLabel
%70 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1
%71 = OpLoad %int %70
%72 = OpConvertSToF %float %71
%73 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2
%74 = OpLoad %int %73
%75 = OpConvertSToF %float %74
%76 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2
%77 = OpLoad %int %76
%78 = OpConvertSToF %float %77
%79 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1
%80 = OpLoad %int %79
%81 = OpConvertSToF %float %80
%82 = OpCompositeConstruct %v4float %72 %75 %78 %81
OpStore %_GLF_color %82
OpBranch %67
%69 = OpLabel
%83 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2
%84 = OpLoad %int %83
%85 = OpConvertSToF %float %84
%86 = OpCompositeConstruct %v4float %85 %85 %85 %85
OpStore %_GLF_color %86
OpBranch %67
%67 = OpLabel
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,65 @@
cbuffer cbuffer_x_7 : register(b1, space0) {
uint4 x_7[2];
};
cbuffer cbuffer_x_9 : register(b0, space0) {
uint4 x_9[4];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
float f = 0.0f;
float arr[10] = (float[10])0;
f = 2.0f;
const uint scalar_offset = ((16u * uint(0))) / 4;
const float x_37 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]);
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
const float x_39 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]);
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
const float x_41 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]);
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
const float x_43 = asfloat(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]);
const uint scalar_offset_4 = ((16u * uint(0))) / 4;
const float x_45 = asfloat(x_7[scalar_offset_4 / 4][scalar_offset_4 % 4]);
const uint scalar_offset_5 = ((16u * uint(0))) / 4;
const float x_47 = asfloat(x_7[scalar_offset_5 / 4][scalar_offset_5 % 4]);
const uint scalar_offset_6 = ((16u * uint(0))) / 4;
const float x_49 = asfloat(x_7[scalar_offset_6 / 4][scalar_offset_6 % 4]);
const float x_50 = f;
const float x_52 = asfloat(x_7[1].x);
const uint scalar_offset_7 = ((16u * uint(0))) / 4;
const float x_55 = asfloat(x_7[scalar_offset_7 / 4][scalar_offset_7 % 4]);
const uint scalar_offset_8 = ((16u * uint(0))) / 4;
const float x_57 = asfloat(x_7[scalar_offset_8 / 4][scalar_offset_8 % 4]);
const float tint_symbol_4[10] = {x_37, x_39, x_41, x_43, x_45, x_47, x_49, pow(x_50, x_52), x_55, x_57};
arr = tint_symbol_4;
const uint scalar_offset_9 = ((16u * uint(0))) / 4;
const int x_60 = asint(x_9[scalar_offset_9 / 4][scalar_offset_9 % 4]);
const float x_62 = arr[x_60];
const int x_65 = asint(x_9[3].x);
if ((int(x_62) == x_65)) {
const int x_71 = asint(x_9[1].x);
const int x_74 = asint(x_9[2].x);
const int x_77 = asint(x_9[2].x);
const int x_80 = asint(x_9[1].x);
x_GLF_color = float4(float(x_71), float(x_74), float(x_77), float(x_80));
} else {
const int x_84 = asint(x_9[2].x);
const float x_85 = float(x_84);
x_GLF_color = float4(x_85, x_85, x_85, x_85);
}
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol {
float4 x_GLF_color_1 : SV_Target0;
};
tint_symbol main() {
main_1();
const main_out tint_symbol_1 = {x_GLF_color};
const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1};
return tint_symbol_5;
}

View File

@@ -0,0 +1,75 @@
#include <metal_stdlib>
using namespace metal;
struct tint_padded_array_element {
/* 0x0000 */ float el;
/* 0x0004 */ int8_t tint_pad[12];
};
struct tint_array_wrapper {
/* 0x0000 */ tint_padded_array_element arr[2];
};
struct buf1 {
/* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values;
};
struct tint_padded_array_element_1 {
/* 0x0000 */ int el;
/* 0x0004 */ int8_t tint_pad_1[12];
};
struct tint_array_wrapper_1 {
/* 0x0000 */ tint_padded_array_element_1 arr[4];
};
struct buf0 {
/* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values;
};
struct tint_array_wrapper_2 {
float arr[10];
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
void main_1(constant buf1& x_7, constant buf0& x_9, thread float4* const tint_symbol_5) {
float f = 0.0f;
tint_array_wrapper_2 arr = {};
f = 2.0f;
float const x_37 = x_7.x_GLF_uniform_float_values.arr[0].el;
float const x_39 = x_7.x_GLF_uniform_float_values.arr[0].el;
float const x_41 = x_7.x_GLF_uniform_float_values.arr[0].el;
float const x_43 = x_7.x_GLF_uniform_float_values.arr[0].el;
float const x_45 = x_7.x_GLF_uniform_float_values.arr[0].el;
float const x_47 = x_7.x_GLF_uniform_float_values.arr[0].el;
float const x_49 = x_7.x_GLF_uniform_float_values.arr[0].el;
float const x_50 = f;
float const x_52 = x_7.x_GLF_uniform_float_values.arr[1].el;
float const x_55 = x_7.x_GLF_uniform_float_values.arr[0].el;
float const x_57 = x_7.x_GLF_uniform_float_values.arr[0].el;
tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_37, x_39, x_41, x_43, x_45, x_47, x_49, pow(x_50, x_52), x_55, x_57}};
arr = tint_symbol_3;
int const x_60 = x_9.x_GLF_uniform_int_values.arr[0].el;
float const x_62 = arr.arr[x_60];
int const x_65 = x_9.x_GLF_uniform_int_values.arr[3].el;
if ((int(x_62) == x_65)) {
int const x_71 = x_9.x_GLF_uniform_int_values.arr[1].el;
int const x_74 = x_9.x_GLF_uniform_int_values.arr[2].el;
int const x_77 = x_9.x_GLF_uniform_int_values.arr[2].el;
int const x_80 = x_9.x_GLF_uniform_int_values.arr[1].el;
*(tint_symbol_5) = float4(float(x_71), float(x_74), float(x_77), float(x_80));
} else {
int const x_84 = x_9.x_GLF_uniform_int_values.arr[2].el;
float const x_85 = float(x_84);
*(tint_symbol_5) = float4(x_85, x_85, x_85, x_85);
}
return;
}
fragment tint_symbol_1 tint_symbol(constant buf1& x_7 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) {
thread float4 tint_symbol_6 = 0.0f;
main_1(x_7, x_9, &(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,159 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 105
; Schema: 0
OpCapability Shader
%59 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %buf1 "buf1"
OpMemberName %buf1 0 "x_GLF_uniform_float_values"
OpName %x_7 "x_7"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "x_GLF_uniform_int_values"
OpName %x_9 "x_9"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
OpName %f "f"
OpName %arr "arr"
OpName %main_out "main_out"
OpMemberName %main_out 0 "x_GLF_color_1"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol "tint_symbol"
OpName %main "main"
OpDecorate %buf1 Block
OpMemberDecorate %buf1 0 Offset 0
OpDecorate %_arr_float_uint_2 ArrayStride 16
OpDecorate %x_7 NonWritable
OpDecorate %x_7 DescriptorSet 0
OpDecorate %x_7 Binding 1
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %_arr_int_uint_4 ArrayStride 16
OpDecorate %x_9 NonWritable
OpDecorate %x_9 DescriptorSet 0
OpDecorate %x_9 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpDecorate %_arr_float_uint_10 ArrayStride 4
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%uint = OpTypeInt 32 0
%uint_2 = OpConstant %uint 2
%_arr_float_uint_2 = OpTypeArray %float %uint_2
%buf1 = OpTypeStruct %_arr_float_uint_2
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
%x_7 = OpVariable %_ptr_Uniform_buf1 Uniform
%int = OpTypeInt 32 1
%uint_4 = OpConstant %uint 4
%_arr_int_uint_4 = OpTypeArray %int %uint_4
%buf0 = OpTypeStruct %_arr_int_uint_4
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_9 = OpVariable %_ptr_Uniform_buf0 Uniform
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%17 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17
%void = OpTypeVoid
%20 = OpTypeFunction %void
%_ptr_Function_float = OpTypePointer Function %float
%26 = OpConstantNull %float
%uint_10 = OpConstant %uint 10
%_arr_float_uint_10 = OpTypeArray %float %uint_10
%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10
%31 = OpConstantNull %_arr_float_uint_10
%float_2 = OpConstant %float 2
%uint_0 = OpConstant %uint 0
%int_0 = OpConstant %int 0
%_ptr_Uniform_float = OpTypePointer Uniform %float
%int_1 = OpConstant %int 1
%_ptr_Uniform_int = OpTypePointer Uniform %int
%int_3 = OpConstant %int 3
%bool = OpTypeBool
%int_2 = OpConstant %int 2
%main_out = OpTypeStruct %v4float
%93 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %20
%23 = OpLabel
%f = OpVariable %_ptr_Function_float Function %26
%arr = OpVariable %_ptr_Function__arr_float_uint_10 Function %31
OpStore %f %float_2
%36 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0
%37 = OpLoad %float %36
%38 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0
%39 = OpLoad %float %38
%40 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0
%41 = OpLoad %float %40
%42 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0
%43 = OpLoad %float %42
%44 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0
%45 = OpLoad %float %44
%46 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0
%47 = OpLoad %float %46
%48 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0
%49 = OpLoad %float %48
%50 = OpLoad %float %f
%52 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1
%53 = OpLoad %float %52
%54 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0
%55 = OpLoad %float %54
%56 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0
%57 = OpLoad %float %56
%58 = OpExtInst %float %59 Pow %50 %53
%60 = OpCompositeConstruct %_arr_float_uint_10 %37 %39 %41 %43 %45 %47 %49 %58 %55 %57
OpStore %arr %60
%62 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0
%63 = OpLoad %int %62
%64 = OpAccessChain %_ptr_Function_float %arr %63
%65 = OpLoad %float %64
%67 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_3
%68 = OpLoad %int %67
%69 = OpConvertFToS %int %65
%70 = OpIEqual %bool %69 %68
OpSelectionMerge %72 None
OpBranchConditional %70 %73 %74
%73 = OpLabel
%75 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1
%76 = OpLoad %int %75
%78 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2
%79 = OpLoad %int %78
%80 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2
%81 = OpLoad %int %80
%82 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1
%83 = OpLoad %int %82
%84 = OpConvertSToF %float %76
%85 = OpConvertSToF %float %79
%86 = OpConvertSToF %float %81
%87 = OpConvertSToF %float %83
%88 = OpCompositeConstruct %v4float %84 %85 %86 %87
OpStore %x_GLF_color %88
OpBranch %72
%74 = OpLabel
%89 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2
%90 = OpLoad %int %89
%91 = OpConvertSToF %float %90
%92 = OpCompositeConstruct %v4float %91 %91 %91 %91
OpStore %x_GLF_color %92
OpBranch %72
%72 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %93
%tint_symbol = OpFunctionParameter %main_out
%97 = OpLabel
%98 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %98
OpReturn
OpFunctionEnd
%main = OpFunction %void None %20
%100 = OpLabel
%101 = OpFunctionCall %void %main_1
%103 = OpLoad %v4float %x_GLF_color
%104 = OpCompositeConstruct %main_out %103
%102 = OpFunctionCall %void %tint_symbol_2 %104
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,63 @@
type Arr = [[stride(16)]] array<f32, 2>;
[[block]]
struct buf1 {
x_GLF_uniform_float_values : Arr;
};
type Arr_1 = [[stride(16)]] array<i32, 4>;
[[block]]
struct buf0 {
x_GLF_uniform_int_values : Arr_1;
};
[[group(0), binding(1)]] var<uniform> x_7 : buf1;
[[group(0), binding(0)]] var<uniform> x_9 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var f : f32;
var arr : array<f32, 10>;
f = 2.0;
let x_37 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_39 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_41 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_43 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_45 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_47 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_49 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_50 : f32 = f;
let x_52 : f32 = x_7.x_GLF_uniform_float_values[1];
let x_55 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_57 : f32 = x_7.x_GLF_uniform_float_values[0];
arr = array<f32, 10>(x_37, x_39, x_41, x_43, x_45, x_47, x_49, pow(x_50, x_52), x_55, x_57);
let x_60 : i32 = x_9.x_GLF_uniform_int_values[0];
let x_62 : f32 = arr[x_60];
let x_65 : i32 = x_9.x_GLF_uniform_int_values[3];
if ((i32(x_62) == x_65)) {
let x_71 : i32 = x_9.x_GLF_uniform_int_values[1];
let x_74 : i32 = x_9.x_GLF_uniform_int_values[2];
let x_77 : i32 = x_9.x_GLF_uniform_int_values[2];
let x_80 : i32 = x_9.x_GLF_uniform_int_values[1];
x_GLF_color = vec4<f32>(f32(x_71), f32(x_74), f32(x_77), f32(x_80));
} else {
let x_84 : i32 = x_9.x_GLF_uniform_int_values[2];
let x_85 : f32 = f32(x_84);
x_GLF_color = vec4<f32>(x_85, x_85, x_85, x_85);
}
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,63 @@
type Arr = [[stride(16)]] array<f32, 2>;
[[block]]
struct buf1 {
x_GLF_uniform_float_values : Arr;
};
type Arr_1 = [[stride(16)]] array<i32, 4>;
[[block]]
struct buf0 {
x_GLF_uniform_int_values : Arr_1;
};
[[group(0), binding(1)]] var<uniform> x_7 : buf1;
[[group(0), binding(0)]] var<uniform> x_9 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var f : f32;
var arr : array<f32, 10>;
f = 2.0;
let x_37 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_39 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_41 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_43 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_45 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_47 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_49 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_50 : f32 = f;
let x_52 : f32 = x_7.x_GLF_uniform_float_values[1];
let x_55 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_57 : f32 = x_7.x_GLF_uniform_float_values[0];
arr = array<f32, 10>(x_37, x_39, x_41, x_43, x_45, x_47, x_49, pow(x_50, x_52), x_55, x_57);
let x_60 : i32 = x_9.x_GLF_uniform_int_values[0];
let x_62 : f32 = arr[x_60];
let x_65 : i32 = x_9.x_GLF_uniform_int_values[3];
if ((i32(x_62) == x_65)) {
let x_71 : i32 = x_9.x_GLF_uniform_int_values[1];
let x_74 : i32 = x_9.x_GLF_uniform_int_values[2];
let x_77 : i32 = x_9.x_GLF_uniform_int_values[2];
let x_80 : i32 = x_9.x_GLF_uniform_int_values[1];
x_GLF_color = vec4<f32>(f32(x_71), f32(x_74), f32(x_77), f32(x_80));
} else {
let x_84 : i32 = x_9.x_GLF_uniform_int_values[2];
let x_85 : f32 = f32(x_84);
x_GLF_color = vec4<f32>(x_85, x_85, x_85, x_85);
}
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,65 @@
cbuffer cbuffer_x_7 : register(b1, space0) {
uint4 x_7[2];
};
cbuffer cbuffer_x_9 : register(b0, space0) {
uint4 x_9[4];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
float f = 0.0f;
float arr[10] = (float[10])0;
f = 2.0f;
const uint scalar_offset = ((16u * uint(0))) / 4;
const float x_37 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]);
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
const float x_39 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]);
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
const float x_41 = asfloat(x_7[scalar_offset_2 / 4][scalar_offset_2 % 4]);
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
const float x_43 = asfloat(x_7[scalar_offset_3 / 4][scalar_offset_3 % 4]);
const uint scalar_offset_4 = ((16u * uint(0))) / 4;
const float x_45 = asfloat(x_7[scalar_offset_4 / 4][scalar_offset_4 % 4]);
const uint scalar_offset_5 = ((16u * uint(0))) / 4;
const float x_47 = asfloat(x_7[scalar_offset_5 / 4][scalar_offset_5 % 4]);
const uint scalar_offset_6 = ((16u * uint(0))) / 4;
const float x_49 = asfloat(x_7[scalar_offset_6 / 4][scalar_offset_6 % 4]);
const float x_50 = f;
const float x_52 = asfloat(x_7[1].x);
const uint scalar_offset_7 = ((16u * uint(0))) / 4;
const float x_55 = asfloat(x_7[scalar_offset_7 / 4][scalar_offset_7 % 4]);
const uint scalar_offset_8 = ((16u * uint(0))) / 4;
const float x_57 = asfloat(x_7[scalar_offset_8 / 4][scalar_offset_8 % 4]);
const float tint_symbol_4[10] = {x_37, x_39, x_41, x_43, x_45, x_47, x_49, pow(x_50, x_52), x_55, x_57};
arr = tint_symbol_4;
const uint scalar_offset_9 = ((16u * uint(0))) / 4;
const int x_60 = asint(x_9[scalar_offset_9 / 4][scalar_offset_9 % 4]);
const float x_62 = arr[x_60];
const int x_65 = asint(x_9[3].x);
if ((int(x_62) == x_65)) {
const int x_71 = asint(x_9[1].x);
const int x_74 = asint(x_9[2].x);
const int x_77 = asint(x_9[2].x);
const int x_80 = asint(x_9[1].x);
x_GLF_color = float4(float(x_71), float(x_74), float(x_77), float(x_80));
} else {
const int x_84 = asint(x_9[2].x);
const float x_85 = float(x_84);
x_GLF_color = float4(x_85, x_85, x_85, x_85);
}
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol {
float4 x_GLF_color_1 : SV_Target0;
};
tint_symbol main() {
main_1();
const main_out tint_symbol_1 = {x_GLF_color};
const tint_symbol tint_symbol_5 = {tint_symbol_1.x_GLF_color_1};
return tint_symbol_5;
}

View File

@@ -0,0 +1,75 @@
#include <metal_stdlib>
using namespace metal;
struct tint_padded_array_element {
/* 0x0000 */ float el;
/* 0x0004 */ int8_t tint_pad[12];
};
struct tint_array_wrapper {
/* 0x0000 */ tint_padded_array_element arr[2];
};
struct buf1 {
/* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values;
};
struct tint_padded_array_element_1 {
/* 0x0000 */ int el;
/* 0x0004 */ int8_t tint_pad_1[12];
};
struct tint_array_wrapper_1 {
/* 0x0000 */ tint_padded_array_element_1 arr[4];
};
struct buf0 {
/* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values;
};
struct tint_array_wrapper_2 {
float arr[10];
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
void main_1(constant buf1& x_7, constant buf0& x_9, thread float4* const tint_symbol_5) {
float f = 0.0f;
tint_array_wrapper_2 arr = {};
f = 2.0f;
float const x_37 = x_7.x_GLF_uniform_float_values.arr[0].el;
float const x_39 = x_7.x_GLF_uniform_float_values.arr[0].el;
float const x_41 = x_7.x_GLF_uniform_float_values.arr[0].el;
float const x_43 = x_7.x_GLF_uniform_float_values.arr[0].el;
float const x_45 = x_7.x_GLF_uniform_float_values.arr[0].el;
float const x_47 = x_7.x_GLF_uniform_float_values.arr[0].el;
float const x_49 = x_7.x_GLF_uniform_float_values.arr[0].el;
float const x_50 = f;
float const x_52 = x_7.x_GLF_uniform_float_values.arr[1].el;
float const x_55 = x_7.x_GLF_uniform_float_values.arr[0].el;
float const x_57 = x_7.x_GLF_uniform_float_values.arr[0].el;
tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_37, x_39, x_41, x_43, x_45, x_47, x_49, pow(x_50, x_52), x_55, x_57}};
arr = tint_symbol_3;
int const x_60 = x_9.x_GLF_uniform_int_values.arr[0].el;
float const x_62 = arr.arr[x_60];
int const x_65 = x_9.x_GLF_uniform_int_values.arr[3].el;
if ((int(x_62) == x_65)) {
int const x_71 = x_9.x_GLF_uniform_int_values.arr[1].el;
int const x_74 = x_9.x_GLF_uniform_int_values.arr[2].el;
int const x_77 = x_9.x_GLF_uniform_int_values.arr[2].el;
int const x_80 = x_9.x_GLF_uniform_int_values.arr[1].el;
*(tint_symbol_5) = float4(float(x_71), float(x_74), float(x_77), float(x_80));
} else {
int const x_84 = x_9.x_GLF_uniform_int_values.arr[2].el;
float const x_85 = float(x_84);
*(tint_symbol_5) = float4(x_85, x_85, x_85, x_85);
}
return;
}
fragment tint_symbol_1 tint_symbol(constant buf1& x_7 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) {
thread float4 tint_symbol_6 = 0.0f;
main_1(x_7, x_9, &(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,159 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 105
; Schema: 0
OpCapability Shader
%59 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %buf1 "buf1"
OpMemberName %buf1 0 "x_GLF_uniform_float_values"
OpName %x_7 "x_7"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "x_GLF_uniform_int_values"
OpName %x_9 "x_9"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
OpName %f "f"
OpName %arr "arr"
OpName %main_out "main_out"
OpMemberName %main_out 0 "x_GLF_color_1"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol "tint_symbol"
OpName %main "main"
OpDecorate %buf1 Block
OpMemberDecorate %buf1 0 Offset 0
OpDecorate %_arr_float_uint_2 ArrayStride 16
OpDecorate %x_7 NonWritable
OpDecorate %x_7 DescriptorSet 0
OpDecorate %x_7 Binding 1
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %_arr_int_uint_4 ArrayStride 16
OpDecorate %x_9 NonWritable
OpDecorate %x_9 DescriptorSet 0
OpDecorate %x_9 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpDecorate %_arr_float_uint_10 ArrayStride 4
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%uint = OpTypeInt 32 0
%uint_2 = OpConstant %uint 2
%_arr_float_uint_2 = OpTypeArray %float %uint_2
%buf1 = OpTypeStruct %_arr_float_uint_2
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
%x_7 = OpVariable %_ptr_Uniform_buf1 Uniform
%int = OpTypeInt 32 1
%uint_4 = OpConstant %uint 4
%_arr_int_uint_4 = OpTypeArray %int %uint_4
%buf0 = OpTypeStruct %_arr_int_uint_4
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_9 = OpVariable %_ptr_Uniform_buf0 Uniform
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%17 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %17
%void = OpTypeVoid
%20 = OpTypeFunction %void
%_ptr_Function_float = OpTypePointer Function %float
%26 = OpConstantNull %float
%uint_10 = OpConstant %uint 10
%_arr_float_uint_10 = OpTypeArray %float %uint_10
%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10
%31 = OpConstantNull %_arr_float_uint_10
%float_2 = OpConstant %float 2
%uint_0 = OpConstant %uint 0
%int_0 = OpConstant %int 0
%_ptr_Uniform_float = OpTypePointer Uniform %float
%int_1 = OpConstant %int 1
%_ptr_Uniform_int = OpTypePointer Uniform %int
%int_3 = OpConstant %int 3
%bool = OpTypeBool
%int_2 = OpConstant %int 2
%main_out = OpTypeStruct %v4float
%93 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %20
%23 = OpLabel
%f = OpVariable %_ptr_Function_float Function %26
%arr = OpVariable %_ptr_Function__arr_float_uint_10 Function %31
OpStore %f %float_2
%36 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0
%37 = OpLoad %float %36
%38 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0
%39 = OpLoad %float %38
%40 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0
%41 = OpLoad %float %40
%42 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0
%43 = OpLoad %float %42
%44 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0
%45 = OpLoad %float %44
%46 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0
%47 = OpLoad %float %46
%48 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0
%49 = OpLoad %float %48
%50 = OpLoad %float %f
%52 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_1
%53 = OpLoad %float %52
%54 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0
%55 = OpLoad %float %54
%56 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %int_0
%57 = OpLoad %float %56
%58 = OpExtInst %float %59 Pow %50 %53
%60 = OpCompositeConstruct %_arr_float_uint_10 %37 %39 %41 %43 %45 %47 %49 %58 %55 %57
OpStore %arr %60
%62 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0
%63 = OpLoad %int %62
%64 = OpAccessChain %_ptr_Function_float %arr %63
%65 = OpLoad %float %64
%67 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_3
%68 = OpLoad %int %67
%69 = OpConvertFToS %int %65
%70 = OpIEqual %bool %69 %68
OpSelectionMerge %72 None
OpBranchConditional %70 %73 %74
%73 = OpLabel
%75 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1
%76 = OpLoad %int %75
%78 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2
%79 = OpLoad %int %78
%80 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2
%81 = OpLoad %int %80
%82 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1
%83 = OpLoad %int %82
%84 = OpConvertSToF %float %76
%85 = OpConvertSToF %float %79
%86 = OpConvertSToF %float %81
%87 = OpConvertSToF %float %83
%88 = OpCompositeConstruct %v4float %84 %85 %86 %87
OpStore %x_GLF_color %88
OpBranch %72
%74 = OpLabel
%89 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2
%90 = OpLoad %int %89
%91 = OpConvertSToF %float %90
%92 = OpCompositeConstruct %v4float %91 %91 %91 %91
OpStore %x_GLF_color %92
OpBranch %72
%72 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %93
%tint_symbol = OpFunctionParameter %main_out
%97 = OpLabel
%98 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %98
OpReturn
OpFunctionEnd
%main = OpFunction %void None %20
%100 = OpLabel
%101 = OpFunctionCall %void %main_1
%103 = OpLoad %v4float %x_GLF_color
%104 = OpCompositeConstruct %main_out %103
%102 = OpFunctionCall %void %tint_symbol_2 %104
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,63 @@
type Arr = [[stride(16)]] array<f32, 2>;
[[block]]
struct buf1 {
x_GLF_uniform_float_values : Arr;
};
type Arr_1 = [[stride(16)]] array<i32, 4>;
[[block]]
struct buf0 {
x_GLF_uniform_int_values : Arr_1;
};
[[group(0), binding(1)]] var<uniform> x_7 : buf1;
[[group(0), binding(0)]] var<uniform> x_9 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var f : f32;
var arr : array<f32, 10>;
f = 2.0;
let x_37 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_39 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_41 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_43 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_45 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_47 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_49 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_50 : f32 = f;
let x_52 : f32 = x_7.x_GLF_uniform_float_values[1];
let x_55 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_57 : f32 = x_7.x_GLF_uniform_float_values[0];
arr = array<f32, 10>(x_37, x_39, x_41, x_43, x_45, x_47, x_49, pow(x_50, x_52), x_55, x_57);
let x_60 : i32 = x_9.x_GLF_uniform_int_values[0];
let x_62 : f32 = arr[x_60];
let x_65 : i32 = x_9.x_GLF_uniform_int_values[3];
if ((i32(x_62) == x_65)) {
let x_71 : i32 = x_9.x_GLF_uniform_int_values[1];
let x_74 : i32 = x_9.x_GLF_uniform_int_values[2];
let x_77 : i32 = x_9.x_GLF_uniform_int_values[2];
let x_80 : i32 = x_9.x_GLF_uniform_int_values[1];
x_GLF_color = vec4<f32>(f32(x_71), f32(x_74), f32(x_77), f32(x_80));
} else {
let x_84 : i32 = x_9.x_GLF_uniform_int_values[2];
let x_85 : f32 = f32(x_84);
x_GLF_color = vec4<f32>(x_85, x_85, x_85, x_85);
}
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);
}