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,180 @@
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color
OpExecutionMode %main OriginUpperLeft
OpSource ESSL 310
OpName %main "main"
OpName %data "data"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "_GLF_uniform_float_values"
OpName %_ ""
OpName %b "b"
OpName %buf1 "buf1"
OpMemberName %buf1 0 "_GLF_uniform_int_values"
OpName %__0 ""
OpName %y "y"
OpName %gl_FragCoord "gl_FragCoord"
OpName %i "i"
OpName %_GLF_color "_GLF_color"
OpDecorate %_arr_float_uint_1 ArrayStride 16
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %buf0 Block
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
OpDecorate %_arr_int_uint_4 ArrayStride 16
OpMemberDecorate %buf1 0 Offset 0
OpDecorate %buf1 Block
OpDecorate %__0 DescriptorSet 0
OpDecorate %__0 Binding 1
OpDecorate %gl_FragCoord BuiltIn FragCoord
OpDecorate %_GLF_color Location 0
%void = OpTypeVoid
%16 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%uint = OpTypeInt 32 0
%uint_2 = OpConstant %uint 2
%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2
%_ptr_Function__arr_v4float_uint_2 = OpTypePointer Function %_arr_v4float_uint_2
%uint_1 = OpConstant %uint 1
%_arr_float_uint_1 = OpTypeArray %float %uint_1
%buf0 = OpTypeStruct %_arr_float_uint_1
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%_ = OpVariable %_ptr_Uniform_buf0 Uniform
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%_ptr_Uniform_float = OpTypePointer Uniform %float
%_ptr_Function_int = OpTypePointer Function %int
%uint_4 = OpConstant %uint 4
%_arr_int_uint_4 = OpTypeArray %int %uint_4
%buf1 = OpTypeStruct %_arr_int_uint_4
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
%__0 = OpVariable %_ptr_Uniform_buf1 Uniform
%int_1 = OpConstant %int 1
%_ptr_Uniform_int = OpTypePointer Uniform %int
%_ptr_Input_v4float = OpTypePointer Input %v4float
%gl_FragCoord = OpVariable %_ptr_Input_v4float Input
%_ptr_Input_float = OpTypePointer Input %float
%bool = OpTypeBool
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%_ptr_Function_v4float = OpTypePointer Function %v4float
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_GLF_color = OpVariable %_ptr_Output_v4float Output
%main = OpFunction %void None %16
%40 = OpLabel
%data = OpVariable %_ptr_Function__arr_v4float_uint_2 Function
%b = OpVariable %_ptr_Function_int Function
%y = OpVariable %_ptr_Function_int Function
%i = OpVariable %_ptr_Function_int Function
%41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0
%42 = OpLoad %float %41
%43 = OpCompositeConstruct %v4float %42 %42 %42 %42
%44 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0
%45 = OpLoad %float %44
%46 = OpCompositeConstruct %v4float %45 %45 %45 %45
%47 = OpCompositeConstruct %_arr_v4float_uint_2 %43 %46
OpStore %data %47
%48 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1
%49 = OpLoad %int %48
OpStore %b %49
%50 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1
%51 = OpLoad %float %50
%52 = OpConvertFToS %int %51
%53 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1
%54 = OpLoad %int %53
%55 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_1
%56 = OpLoad %float %55
%57 = OpConvertFToS %int %56
%58 = OpBitwiseOr %int %54 %57
%59 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1
%60 = OpLoad %int %59
%61 = OpExtInst %int %1 SClamp %52 %58 %60
OpStore %y %61
%62 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1
%63 = OpLoad %int %62
OpStore %i %63
OpBranch %64
%64 = OpLabel
OpLoopMerge %65 %66 None
OpBranch %67
%67 = OpLabel
%68 = OpLoad %int %i
%69 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0
%70 = OpLoad %int %69
%71 = OpSLessThan %bool %68 %70
OpBranchConditional %71 %72 %65
%72 = OpLabel
%73 = OpLoad %int %b
%74 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0
%75 = OpLoad %int %74
%76 = OpSGreaterThan %bool %73 %75
OpSelectionMerge %77 None
OpBranchConditional %76 %78 %77
%78 = OpLabel
%79 = OpLoad %int %y
%80 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1
%81 = OpLoad %int %80
%82 = OpSGreaterThan %bool %79 %81
OpBranch %77
%77 = OpLabel
%83 = OpPhi %bool %76 %72 %82 %78
OpSelectionMerge %84 None
OpBranchConditional %83 %85 %84
%85 = OpLabel
OpBranch %65
%84 = OpLabel
%86 = OpLoad %int %b
%87 = OpIAdd %int %86 %int_1
OpStore %b %87
OpBranch %66
%66 = OpLabel
%88 = OpLoad %int %i
%89 = OpIAdd %int %88 %int_1
OpStore %i %89
OpBranch %64
%65 = OpLabel
%90 = OpLoad %int %b
%91 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0
%92 = OpLoad %int %91
%93 = OpIEqual %bool %90 %92
OpSelectionMerge %94 None
OpBranchConditional %93 %95 %94
%95 = OpLabel
%96 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2
%97 = OpLoad %int %96
%98 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1
%99 = OpLoad %int %98
%100 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3
%101 = OpLoad %int %100
%102 = OpExtInst %int %1 SClamp %97 %99 %101
%103 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1
%104 = OpLoad %int %103
%105 = OpConvertSToF %float %104
%106 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2
%107 = OpLoad %int %106
%108 = OpConvertSToF %float %107
%109 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2
%110 = OpLoad %int %109
%111 = OpConvertSToF %float %110
%112 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1
%113 = OpLoad %int %112
%114 = OpConvertSToF %float %113
%115 = OpCompositeConstruct %v4float %105 %108 %111 %114
%116 = OpAccessChain %_ptr_Function_v4float %data %102
OpStore %116 %115
OpBranch %94
%94 = OpLabel
%117 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1
%118 = OpLoad %int %117
%119 = OpAccessChain %_ptr_Function_v4float %data %118
%120 = OpLoad %v4float %119
%121 = OpCompositeExtract %float %120 0
%122 = OpCompositeExtract %float %120 1
%123 = OpCompositeExtract %float %120 2
%124 = OpCompositeExtract %float %120 3
%125 = OpCompositeConstruct %v4float %121 %122 %123 %124
OpStore %_GLF_color %125
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,95 @@
cbuffer cbuffer_x_7 : register(b0, space0) {
uint4 x_7[1];
};
cbuffer cbuffer_x_10 : register(b1, space0) {
uint4 x_10[4];
};
static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
float4 data[2] = (float4[2])0;
int b = 0;
int y = 0;
int i = 0;
const uint scalar_offset = ((16u * uint(0))) / 4;
const float x_42 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]);
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
const float x_45 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]);
const float4 tint_symbol_6[2] = {float4(x_42, x_42, x_42, x_42), float4(x_45, x_45, x_45, x_45)};
data = tint_symbol_6;
const int x_49 = asint(x_10[1].x);
b = x_49;
const float x_51 = gl_FragCoord.y;
const int x_54 = asint(x_10[1].x);
const float x_56 = gl_FragCoord.y;
const int x_60 = asint(x_10[1].x);
y = clamp(int(x_51), (x_54 | int(x_56)), x_60);
const int x_63 = asint(x_10[1].x);
i = x_63;
while (true) {
bool x_82 = false;
bool x_83_phi = false;
const int x_68 = i;
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
const int x_70 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]);
if ((x_68 < x_70)) {
} else {
break;
}
const int x_73 = b;
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
const int x_75 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]);
const bool x_76 = (x_73 > x_75);
x_83_phi = x_76;
if (x_76) {
const int x_79 = y;
const int x_81 = asint(x_10[1].x);
x_82 = (x_79 > x_81);
x_83_phi = x_82;
}
if (x_83_phi) {
break;
}
b = (b + 1);
{
i = (i + 1);
}
}
const int x_90 = b;
const uint scalar_offset_4 = ((16u * uint(0))) / 4;
const int x_92 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]);
if ((x_90 == x_92)) {
const int x_97 = asint(x_10[2].x);
const int x_99 = asint(x_10[1].x);
const int x_101 = asint(x_10[3].x);
const int x_104 = asint(x_10[1].x);
const int x_107 = asint(x_10[2].x);
const int x_110 = asint(x_10[2].x);
const int x_113 = asint(x_10[1].x);
data[clamp(x_97, x_99, x_101)] = float4(float(x_104), float(x_107), float(x_110), float(x_113));
}
const int x_118 = asint(x_10[1].x);
const float4 x_120 = data[x_118];
x_GLF_color = float4(x_120.x, x_120.y, x_120.z, x_120.w);
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 gl_FragCoord_param : SV_Position;
};
struct tint_symbol_2 {
float4 x_GLF_color_1 : SV_Target0;
};
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param;
gl_FragCoord = gl_FragCoord_param;
main_1();
const main_out tint_symbol_3 = {x_GLF_color};
const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1};
return tint_symbol_7;
}

View File

@@ -0,0 +1,109 @@
#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[1];
};
struct buf0 {
/* 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 buf1 {
/* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values;
};
struct tint_array_wrapper_2 {
float4 arr[2];
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_2 {
float4 x_GLF_color_1 [[color(0)]];
};
void main_1(constant buf0& x_7, constant buf1& x_10, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) {
tint_array_wrapper_2 data = {};
int b = 0;
int y = 0;
int i = 0;
float const x_42 = x_7.x_GLF_uniform_float_values.arr[0].el;
float const x_45 = x_7.x_GLF_uniform_float_values.arr[0].el;
tint_array_wrapper_2 const tint_symbol_4 = {.arr={float4(x_42, x_42, x_42, x_42), float4(x_45, x_45, x_45, x_45)}};
data = tint_symbol_4;
int const x_49 = x_10.x_GLF_uniform_int_values.arr[1].el;
b = x_49;
float const x_51 = (*(tint_symbol_6)).y;
int const x_54 = x_10.x_GLF_uniform_int_values.arr[1].el;
float const x_56 = (*(tint_symbol_6)).y;
int const x_60 = x_10.x_GLF_uniform_int_values.arr[1].el;
y = clamp(int(x_51), (x_54 | int(x_56)), x_60);
int const x_63 = x_10.x_GLF_uniform_int_values.arr[1].el;
i = x_63;
while (true) {
bool x_82 = false;
bool x_83_phi = false;
int const x_68 = i;
int const x_70 = x_10.x_GLF_uniform_int_values.arr[0].el;
if ((x_68 < x_70)) {
} else {
break;
}
int const x_73 = b;
int const x_75 = x_10.x_GLF_uniform_int_values.arr[0].el;
bool const x_76 = (x_73 > x_75);
x_83_phi = x_76;
if (x_76) {
int const x_79 = y;
int const x_81 = x_10.x_GLF_uniform_int_values.arr[1].el;
x_82 = (x_79 > x_81);
x_83_phi = x_82;
}
bool const x_83 = x_83_phi;
if (x_83) {
break;
}
int const x_86 = b;
b = (x_86 + 1);
{
int const x_88 = i;
i = (x_88 + 1);
}
}
int const x_90 = b;
int const x_92 = x_10.x_GLF_uniform_int_values.arr[0].el;
if ((x_90 == x_92)) {
int const x_97 = x_10.x_GLF_uniform_int_values.arr[2].el;
int const x_99 = x_10.x_GLF_uniform_int_values.arr[1].el;
int const x_101 = x_10.x_GLF_uniform_int_values.arr[3].el;
int const x_104 = x_10.x_GLF_uniform_int_values.arr[1].el;
int const x_107 = x_10.x_GLF_uniform_int_values.arr[2].el;
int const x_110 = x_10.x_GLF_uniform_int_values.arr[2].el;
int const x_113 = x_10.x_GLF_uniform_int_values.arr[1].el;
data.arr[clamp(x_97, x_99, x_101)] = float4(float(x_104), float(x_107), float(x_110), float(x_113));
}
int const x_118 = x_10.x_GLF_uniform_int_values.arr[1].el;
float4 const x_120 = data.arr[x_118];
*(tint_symbol_7) = float4(x_120.x, x_120.y, x_120.z, x_120.w);
return;
}
fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) {
thread float4 tint_symbol_8 = 0.0f;
thread float4 tint_symbol_9 = 0.0f;
tint_symbol_8 = gl_FragCoord_param;
main_1(x_7, x_10, &(tint_symbol_8), &(tint_symbol_9));
main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9};
tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
return tint_symbol_5;
}

View File

@@ -0,0 +1,236 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 153
; Schema: 0
OpCapability Shader
%61 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2
OpExecutionMode %main OriginUpperLeft
OpName %buf0 "buf0"
OpMemberName %buf0 0 "x_GLF_uniform_float_values"
OpName %x_7 "x_7"
OpName %buf1 "buf1"
OpMemberName %buf1 0 "x_GLF_uniform_int_values"
OpName %x_10 "x_10"
OpName %gl_FragCoord "gl_FragCoord"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol "tint_symbol"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %main_1 "main_1"
OpName %data "data"
OpName %b "b"
OpName %y "y"
OpName %i "i"
OpName %x_82 "x_82"
OpName %x_83_phi "x_83_phi"
OpName %main_out "main_out"
OpMemberName %main_out 0 "x_GLF_color_1"
OpName %tint_symbol_3 "tint_symbol_3"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main "main"
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %_arr_float_uint_1 ArrayStride 16
OpDecorate %x_7 NonWritable
OpDecorate %x_7 DescriptorSet 0
OpDecorate %x_7 Binding 0
OpDecorate %buf1 Block
OpMemberDecorate %buf1 0 Offset 0
OpDecorate %_arr_int_uint_4 ArrayStride 16
OpDecorate %x_10 NonWritable
OpDecorate %x_10 DescriptorSet 0
OpDecorate %x_10 Binding 1
OpDecorate %tint_symbol BuiltIn FragCoord
OpDecorate %tint_symbol_2 Location 0
OpDecorate %_arr_v4float_uint_2 ArrayStride 16
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_arr_float_uint_1 = OpTypeArray %float %uint_1
%buf0 = OpTypeStruct %_arr_float_uint_1
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_7 = OpVariable %_ptr_Uniform_buf0 Uniform
%int = OpTypeInt 32 1
%uint_4 = OpConstant %uint 4
%_arr_int_uint_4 = OpTypeArray %int %uint_4
%buf1 = OpTypeStruct %_arr_int_uint_4
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
%x_10 = OpVariable %_ptr_Uniform_buf1 Uniform
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%17 = OpConstantNull %v4float
%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17
%_ptr_Input_v4float = OpTypePointer Input %v4float
%tint_symbol = OpVariable %_ptr_Input_v4float Input
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17
%void = OpTypeVoid
%23 = OpTypeFunction %void
%uint_2 = OpConstant %uint 2
%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2
%_ptr_Function__arr_v4float_uint_2 = OpTypePointer Function %_arr_v4float_uint_2
%31 = OpConstantNull %_arr_v4float_uint_2
%_ptr_Function_int = OpTypePointer Function %int
%34 = OpConstantNull %int
%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
%_ptr_Private_float = OpTypePointer Private %float
%bool = OpTypeBool
%_ptr_Function_bool = OpTypePointer Function %bool
%74 = OpConstantNull %bool
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%_ptr_Function_v4float = OpTypePointer Function %v4float
%main_out = OpTypeStruct %v4float
%140 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %23
%26 = OpLabel
%data = OpVariable %_ptr_Function__arr_v4float_uint_2 Function %31
%b = OpVariable %_ptr_Function_int Function %34
%y = OpVariable %_ptr_Function_int Function %34
%i = OpVariable %_ptr_Function_int Function %34
%x_82 = OpVariable %_ptr_Function_bool Function %74
%x_83_phi = OpVariable %_ptr_Function_bool Function %74
%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 = OpCompositeConstruct %v4float %41 %41 %41 %41
%45 = OpCompositeConstruct %v4float %43 %43 %43 %43
%46 = OpCompositeConstruct %_arr_v4float_uint_2 %44 %45
OpStore %data %46
%49 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
%50 = OpLoad %int %49
OpStore %b %50
%52 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%53 = OpLoad %float %52
%54 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
%55 = OpLoad %int %54
%56 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%57 = OpLoad %float %56
%58 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
%59 = OpLoad %int %58
%62 = OpConvertFToS %int %53
%63 = OpConvertFToS %int %57
%64 = OpBitwiseOr %int %55 %63
%60 = OpExtInst %int %61 SClamp %62 %64 %59
OpStore %y %60
%65 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
%66 = OpLoad %int %65
OpStore %i %66
OpBranch %67
%67 = OpLabel
OpLoopMerge %68 %69 None
OpBranch %70
%70 = OpLabel
%76 = OpLoad %int %i
%77 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0
%78 = OpLoad %int %77
%79 = OpSLessThan %bool %76 %78
OpSelectionMerge %80 None
OpBranchConditional %79 %81 %82
%81 = OpLabel
OpBranch %80
%82 = OpLabel
OpBranch %68
%80 = OpLabel
%83 = OpLoad %int %b
%84 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0
%85 = OpLoad %int %84
%86 = OpSGreaterThan %bool %83 %85
OpStore %x_83_phi %86
OpSelectionMerge %87 None
OpBranchConditional %86 %88 %87
%88 = OpLabel
%89 = OpLoad %int %y
%90 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
%91 = OpLoad %int %90
%92 = OpSGreaterThan %bool %89 %91
OpStore %x_82 %92
%93 = OpLoad %bool %x_82
OpStore %x_83_phi %93
OpBranch %87
%87 = OpLabel
%94 = OpLoad %bool %x_83_phi
OpSelectionMerge %95 None
OpBranchConditional %94 %96 %95
%96 = OpLabel
OpBranch %68
%95 = OpLabel
%97 = OpLoad %int %b
%98 = OpIAdd %int %97 %int_1
OpStore %b %98
OpBranch %69
%69 = OpLabel
%99 = OpLoad %int %i
%100 = OpIAdd %int %99 %int_1
OpStore %i %100
OpBranch %67
%68 = OpLabel
%101 = OpLoad %int %b
%102 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0
%103 = OpLoad %int %102
%104 = OpIEqual %bool %101 %103
OpSelectionMerge %105 None
OpBranchConditional %104 %106 %105
%106 = OpLabel
%108 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2
%109 = OpLoad %int %108
%110 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
%111 = OpLoad %int %110
%113 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3
%114 = OpLoad %int %113
%115 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
%116 = OpLoad %int %115
%117 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2
%118 = OpLoad %int %117
%119 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2
%120 = OpLoad %int %119
%121 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
%122 = OpLoad %int %121
%123 = OpExtInst %int %61 SClamp %109 %111 %114
%125 = OpAccessChain %_ptr_Function_v4float %data %123
%126 = OpConvertSToF %float %116
%127 = OpConvertSToF %float %118
%128 = OpConvertSToF %float %120
%129 = OpConvertSToF %float %122
%130 = OpCompositeConstruct %v4float %126 %127 %128 %129
OpStore %125 %130
OpBranch %105
%105 = OpLabel
%131 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
%132 = OpLoad %int %131
%133 = OpAccessChain %_ptr_Function_v4float %data %132
%134 = OpLoad %v4float %133
%135 = OpCompositeExtract %float %134 0
%136 = OpCompositeExtract %float %134 1
%137 = OpCompositeExtract %float %134 2
%138 = OpCompositeExtract %float %134 3
%139 = OpCompositeConstruct %v4float %135 %136 %137 %138
OpStore %x_GLF_color %139
OpReturn
OpFunctionEnd
%tint_symbol_3 = OpFunction %void None %140
%tint_symbol_1 = OpFunctionParameter %main_out
%144 = OpLabel
%145 = OpCompositeExtract %v4float %tint_symbol_1 0
OpStore %tint_symbol_2 %145
OpReturn
OpFunctionEnd
%main = OpFunction %void None %23
%147 = OpLabel
%148 = OpLoad %v4float %tint_symbol
OpStore %gl_FragCoord %148
%149 = OpFunctionCall %void %main_1
%151 = OpLoad %v4float %x_GLF_color
%152 = OpCompositeConstruct %main_out %151
%150 = OpFunctionCall %void %tint_symbol_3 %152
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,99 @@
type Arr = [[stride(16)]] array<f32, 1>;
[[block]]
struct buf0 {
x_GLF_uniform_float_values : Arr;
};
type Arr_1 = [[stride(16)]] array<i32, 4>;
[[block]]
struct buf1 {
x_GLF_uniform_int_values : Arr_1;
};
[[group(0), binding(0)]] var<uniform> x_7 : buf0;
[[group(0), binding(1)]] var<uniform> x_10 : buf1;
var<private> gl_FragCoord : vec4<f32>;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var data : array<vec4<f32>, 2>;
var b : i32;
var y : i32;
var i : i32;
let x_42 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_45 : f32 = x_7.x_GLF_uniform_float_values[0];
data = array<vec4<f32>, 2>(vec4<f32>(x_42, x_42, x_42, x_42), vec4<f32>(x_45, x_45, x_45, x_45));
let x_49 : i32 = x_10.x_GLF_uniform_int_values[1];
b = x_49;
let x_51 : f32 = gl_FragCoord.y;
let x_54 : i32 = x_10.x_GLF_uniform_int_values[1];
let x_56 : f32 = gl_FragCoord.y;
let x_60 : i32 = x_10.x_GLF_uniform_int_values[1];
y = clamp(i32(x_51), (x_54 | i32(x_56)), x_60);
let x_63 : i32 = x_10.x_GLF_uniform_int_values[1];
i = x_63;
loop {
var x_82 : bool;
var x_83_phi : bool;
let x_68 : i32 = i;
let x_70 : i32 = x_10.x_GLF_uniform_int_values[0];
if ((x_68 < x_70)) {
} else {
break;
}
let x_73 : i32 = b;
let x_75 : i32 = x_10.x_GLF_uniform_int_values[0];
let x_76 : bool = (x_73 > x_75);
x_83_phi = x_76;
if (x_76) {
let x_79 : i32 = y;
let x_81 : i32 = x_10.x_GLF_uniform_int_values[1];
x_82 = (x_79 > x_81);
x_83_phi = x_82;
}
let x_83 : bool = x_83_phi;
if (x_83) {
break;
}
let x_86 : i32 = b;
b = (x_86 + 1);
continuing {
let x_88 : i32 = i;
i = (x_88 + 1);
}
}
let x_90 : i32 = b;
let x_92 : i32 = x_10.x_GLF_uniform_int_values[0];
if ((x_90 == x_92)) {
let x_97 : i32 = x_10.x_GLF_uniform_int_values[2];
let x_99 : i32 = x_10.x_GLF_uniform_int_values[1];
let x_101 : i32 = x_10.x_GLF_uniform_int_values[3];
let x_104 : i32 = x_10.x_GLF_uniform_int_values[1];
let x_107 : i32 = x_10.x_GLF_uniform_int_values[2];
let x_110 : i32 = x_10.x_GLF_uniform_int_values[2];
let x_113 : i32 = x_10.x_GLF_uniform_int_values[1];
data[clamp(x_97, x_99, x_101)] = vec4<f32>(f32(x_104), f32(x_107), f32(x_110), f32(x_113));
}
let x_118 : i32 = x_10.x_GLF_uniform_int_values[1];
let x_120 : vec4<f32> = data[x_118];
x_GLF_color = vec4<f32>(x_120.x, x_120.y, x_120.z, x_120.w);
return;
}
struct main_out {
[[location(0)]]
x_GLF_color_1 : vec4<f32>;
};
[[stage(fragment)]]
fn main([[builtin(position)]] gl_FragCoord_param : vec4<f32>) -> main_out {
gl_FragCoord = gl_FragCoord_param;
main_1();
return main_out(x_GLF_color);
}

View File

@@ -0,0 +1,99 @@
type Arr = [[stride(16)]] array<f32, 1>;
[[block]]
struct buf0 {
x_GLF_uniform_float_values : Arr;
};
type Arr_1 = [[stride(16)]] array<i32, 4>;
[[block]]
struct buf1 {
x_GLF_uniform_int_values : Arr_1;
};
[[group(0), binding(0)]] var<uniform> x_7 : buf0;
[[group(0), binding(1)]] var<uniform> x_10 : buf1;
var<private> gl_FragCoord : vec4<f32>;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var data : array<vec4<f32>, 2>;
var b : i32;
var y : i32;
var i : i32;
let x_42 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_45 : f32 = x_7.x_GLF_uniform_float_values[0];
data = array<vec4<f32>, 2>(vec4<f32>(x_42, x_42, x_42, x_42), vec4<f32>(x_45, x_45, x_45, x_45));
let x_49 : i32 = x_10.x_GLF_uniform_int_values[1];
b = x_49;
let x_51 : f32 = gl_FragCoord.y;
let x_54 : i32 = x_10.x_GLF_uniform_int_values[1];
let x_56 : f32 = gl_FragCoord.y;
let x_60 : i32 = x_10.x_GLF_uniform_int_values[1];
y = clamp(i32(x_51), (x_54 | i32(x_56)), x_60);
let x_63 : i32 = x_10.x_GLF_uniform_int_values[1];
i = x_63;
loop {
var x_82 : bool;
var x_83_phi : bool;
let x_68 : i32 = i;
let x_70 : i32 = x_10.x_GLF_uniform_int_values[0];
if ((x_68 < x_70)) {
} else {
break;
}
let x_73 : i32 = b;
let x_75 : i32 = x_10.x_GLF_uniform_int_values[0];
let x_76 : bool = (x_73 > x_75);
x_83_phi = x_76;
if (x_76) {
let x_79 : i32 = y;
let x_81 : i32 = x_10.x_GLF_uniform_int_values[1];
x_82 = (x_79 > x_81);
x_83_phi = x_82;
}
let x_83 : bool = x_83_phi;
if (x_83) {
break;
}
let x_86 : i32 = b;
b = (x_86 + 1);
continuing {
let x_88 : i32 = i;
i = (x_88 + 1);
}
}
let x_90 : i32 = b;
let x_92 : i32 = x_10.x_GLF_uniform_int_values[0];
if ((x_90 == x_92)) {
let x_97 : i32 = x_10.x_GLF_uniform_int_values[2];
let x_99 : i32 = x_10.x_GLF_uniform_int_values[1];
let x_101 : i32 = x_10.x_GLF_uniform_int_values[3];
let x_104 : i32 = x_10.x_GLF_uniform_int_values[1];
let x_107 : i32 = x_10.x_GLF_uniform_int_values[2];
let x_110 : i32 = x_10.x_GLF_uniform_int_values[2];
let x_113 : i32 = x_10.x_GLF_uniform_int_values[1];
data[clamp(x_97, x_99, x_101)] = vec4<f32>(f32(x_104), f32(x_107), f32(x_110), f32(x_113));
}
let x_118 : i32 = x_10.x_GLF_uniform_int_values[1];
let x_120 : vec4<f32> = data[x_118];
x_GLF_color = vec4<f32>(x_120.x, x_120.y, x_120.z, x_120.w);
return;
}
struct main_out {
[[location(0)]]
x_GLF_color_1 : vec4<f32>;
};
[[stage(fragment)]]
fn main([[builtin(position)]] gl_FragCoord_param : vec4<f32>) -> main_out {
gl_FragCoord = gl_FragCoord_param;
main_1();
return main_out(x_GLF_color);
}

View File

@@ -0,0 +1,95 @@
cbuffer cbuffer_x_7 : register(b0, space0) {
uint4 x_7[1];
};
cbuffer cbuffer_x_10 : register(b1, space0) {
uint4 x_10[4];
};
static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
float4 data[2] = (float4[2])0;
int b = 0;
int y = 0;
int i = 0;
const uint scalar_offset = ((16u * uint(0))) / 4;
const float x_42 = asfloat(x_7[scalar_offset / 4][scalar_offset % 4]);
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
const float x_45 = asfloat(x_7[scalar_offset_1 / 4][scalar_offset_1 % 4]);
const float4 tint_symbol_6[2] = {float4(x_42, x_42, x_42, x_42), float4(x_45, x_45, x_45, x_45)};
data = tint_symbol_6;
const int x_49 = asint(x_10[1].x);
b = x_49;
const float x_51 = gl_FragCoord.y;
const int x_54 = asint(x_10[1].x);
const float x_56 = gl_FragCoord.y;
const int x_60 = asint(x_10[1].x);
y = clamp(int(x_51), (x_54 | int(x_56)), x_60);
const int x_63 = asint(x_10[1].x);
i = x_63;
while (true) {
bool x_82 = false;
bool x_83_phi = false;
const int x_68 = i;
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
const int x_70 = asint(x_10[scalar_offset_2 / 4][scalar_offset_2 % 4]);
if ((x_68 < x_70)) {
} else {
break;
}
const int x_73 = b;
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
const int x_75 = asint(x_10[scalar_offset_3 / 4][scalar_offset_3 % 4]);
const bool x_76 = (x_73 > x_75);
x_83_phi = x_76;
if (x_76) {
const int x_79 = y;
const int x_81 = asint(x_10[1].x);
x_82 = (x_79 > x_81);
x_83_phi = x_82;
}
if (x_83_phi) {
break;
}
b = (b + 1);
{
i = (i + 1);
}
}
const int x_90 = b;
const uint scalar_offset_4 = ((16u * uint(0))) / 4;
const int x_92 = asint(x_10[scalar_offset_4 / 4][scalar_offset_4 % 4]);
if ((x_90 == x_92)) {
const int x_97 = asint(x_10[2].x);
const int x_99 = asint(x_10[1].x);
const int x_101 = asint(x_10[3].x);
const int x_104 = asint(x_10[1].x);
const int x_107 = asint(x_10[2].x);
const int x_110 = asint(x_10[2].x);
const int x_113 = asint(x_10[1].x);
data[clamp(x_97, x_99, x_101)] = float4(float(x_104), float(x_107), float(x_110), float(x_113));
}
const int x_118 = asint(x_10[1].x);
const float4 x_120 = data[x_118];
x_GLF_color = float4(x_120.x, x_120.y, x_120.z, x_120.w);
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 gl_FragCoord_param : SV_Position;
};
struct tint_symbol_2 {
float4 x_GLF_color_1 : SV_Target0;
};
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param;
gl_FragCoord = gl_FragCoord_param;
main_1();
const main_out tint_symbol_3 = {x_GLF_color};
const tint_symbol_2 tint_symbol_7 = {tint_symbol_3.x_GLF_color_1};
return tint_symbol_7;
}

View File

@@ -0,0 +1,109 @@
#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[1];
};
struct buf0 {
/* 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 buf1 {
/* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values;
};
struct tint_array_wrapper_2 {
float4 arr[2];
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_2 {
float4 x_GLF_color_1 [[color(0)]];
};
void main_1(constant buf0& x_7, constant buf1& x_10, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) {
tint_array_wrapper_2 data = {};
int b = 0;
int y = 0;
int i = 0;
float const x_42 = x_7.x_GLF_uniform_float_values.arr[0].el;
float const x_45 = x_7.x_GLF_uniform_float_values.arr[0].el;
tint_array_wrapper_2 const tint_symbol_4 = {.arr={float4(x_42, x_42, x_42, x_42), float4(x_45, x_45, x_45, x_45)}};
data = tint_symbol_4;
int const x_49 = x_10.x_GLF_uniform_int_values.arr[1].el;
b = x_49;
float const x_51 = (*(tint_symbol_6)).y;
int const x_54 = x_10.x_GLF_uniform_int_values.arr[1].el;
float const x_56 = (*(tint_symbol_6)).y;
int const x_60 = x_10.x_GLF_uniform_int_values.arr[1].el;
y = clamp(int(x_51), (x_54 | int(x_56)), x_60);
int const x_63 = x_10.x_GLF_uniform_int_values.arr[1].el;
i = x_63;
while (true) {
bool x_82 = false;
bool x_83_phi = false;
int const x_68 = i;
int const x_70 = x_10.x_GLF_uniform_int_values.arr[0].el;
if ((x_68 < x_70)) {
} else {
break;
}
int const x_73 = b;
int const x_75 = x_10.x_GLF_uniform_int_values.arr[0].el;
bool const x_76 = (x_73 > x_75);
x_83_phi = x_76;
if (x_76) {
int const x_79 = y;
int const x_81 = x_10.x_GLF_uniform_int_values.arr[1].el;
x_82 = (x_79 > x_81);
x_83_phi = x_82;
}
bool const x_83 = x_83_phi;
if (x_83) {
break;
}
int const x_86 = b;
b = (x_86 + 1);
{
int const x_88 = i;
i = (x_88 + 1);
}
}
int const x_90 = b;
int const x_92 = x_10.x_GLF_uniform_int_values.arr[0].el;
if ((x_90 == x_92)) {
int const x_97 = x_10.x_GLF_uniform_int_values.arr[2].el;
int const x_99 = x_10.x_GLF_uniform_int_values.arr[1].el;
int const x_101 = x_10.x_GLF_uniform_int_values.arr[3].el;
int const x_104 = x_10.x_GLF_uniform_int_values.arr[1].el;
int const x_107 = x_10.x_GLF_uniform_int_values.arr[2].el;
int const x_110 = x_10.x_GLF_uniform_int_values.arr[2].el;
int const x_113 = x_10.x_GLF_uniform_int_values.arr[1].el;
data.arr[clamp(x_97, x_99, x_101)] = float4(float(x_104), float(x_107), float(x_110), float(x_113));
}
int const x_118 = x_10.x_GLF_uniform_int_values.arr[1].el;
float4 const x_120 = data.arr[x_118];
*(tint_symbol_7) = float4(x_120.x, x_120.y, x_120.z, x_120.w);
return;
}
fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) {
thread float4 tint_symbol_8 = 0.0f;
thread float4 tint_symbol_9 = 0.0f;
tint_symbol_8 = gl_FragCoord_param;
main_1(x_7, x_10, &(tint_symbol_8), &(tint_symbol_9));
main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9};
tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
return tint_symbol_5;
}

View File

@@ -0,0 +1,236 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 153
; Schema: 0
OpCapability Shader
%61 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2
OpExecutionMode %main OriginUpperLeft
OpName %buf0 "buf0"
OpMemberName %buf0 0 "x_GLF_uniform_float_values"
OpName %x_7 "x_7"
OpName %buf1 "buf1"
OpMemberName %buf1 0 "x_GLF_uniform_int_values"
OpName %x_10 "x_10"
OpName %gl_FragCoord "gl_FragCoord"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol "tint_symbol"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %main_1 "main_1"
OpName %data "data"
OpName %b "b"
OpName %y "y"
OpName %i "i"
OpName %x_82 "x_82"
OpName %x_83_phi "x_83_phi"
OpName %main_out "main_out"
OpMemberName %main_out 0 "x_GLF_color_1"
OpName %tint_symbol_3 "tint_symbol_3"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main "main"
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %_arr_float_uint_1 ArrayStride 16
OpDecorate %x_7 NonWritable
OpDecorate %x_7 DescriptorSet 0
OpDecorate %x_7 Binding 0
OpDecorate %buf1 Block
OpMemberDecorate %buf1 0 Offset 0
OpDecorate %_arr_int_uint_4 ArrayStride 16
OpDecorate %x_10 NonWritable
OpDecorate %x_10 DescriptorSet 0
OpDecorate %x_10 Binding 1
OpDecorate %tint_symbol BuiltIn FragCoord
OpDecorate %tint_symbol_2 Location 0
OpDecorate %_arr_v4float_uint_2 ArrayStride 16
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_arr_float_uint_1 = OpTypeArray %float %uint_1
%buf0 = OpTypeStruct %_arr_float_uint_1
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_7 = OpVariable %_ptr_Uniform_buf0 Uniform
%int = OpTypeInt 32 1
%uint_4 = OpConstant %uint 4
%_arr_int_uint_4 = OpTypeArray %int %uint_4
%buf1 = OpTypeStruct %_arr_int_uint_4
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
%x_10 = OpVariable %_ptr_Uniform_buf1 Uniform
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%17 = OpConstantNull %v4float
%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %17
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %17
%_ptr_Input_v4float = OpTypePointer Input %v4float
%tint_symbol = OpVariable %_ptr_Input_v4float Input
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %17
%void = OpTypeVoid
%23 = OpTypeFunction %void
%uint_2 = OpConstant %uint 2
%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2
%_ptr_Function__arr_v4float_uint_2 = OpTypePointer Function %_arr_v4float_uint_2
%31 = OpConstantNull %_arr_v4float_uint_2
%_ptr_Function_int = OpTypePointer Function %int
%34 = OpConstantNull %int
%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
%_ptr_Private_float = OpTypePointer Private %float
%bool = OpTypeBool
%_ptr_Function_bool = OpTypePointer Function %bool
%74 = OpConstantNull %bool
%int_2 = OpConstant %int 2
%int_3 = OpConstant %int 3
%_ptr_Function_v4float = OpTypePointer Function %v4float
%main_out = OpTypeStruct %v4float
%140 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %23
%26 = OpLabel
%data = OpVariable %_ptr_Function__arr_v4float_uint_2 Function %31
%b = OpVariable %_ptr_Function_int Function %34
%y = OpVariable %_ptr_Function_int Function %34
%i = OpVariable %_ptr_Function_int Function %34
%x_82 = OpVariable %_ptr_Function_bool Function %74
%x_83_phi = OpVariable %_ptr_Function_bool Function %74
%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 = OpCompositeConstruct %v4float %41 %41 %41 %41
%45 = OpCompositeConstruct %v4float %43 %43 %43 %43
%46 = OpCompositeConstruct %_arr_v4float_uint_2 %44 %45
OpStore %data %46
%49 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
%50 = OpLoad %int %49
OpStore %b %50
%52 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%53 = OpLoad %float %52
%54 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
%55 = OpLoad %int %54
%56 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_1
%57 = OpLoad %float %56
%58 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
%59 = OpLoad %int %58
%62 = OpConvertFToS %int %53
%63 = OpConvertFToS %int %57
%64 = OpBitwiseOr %int %55 %63
%60 = OpExtInst %int %61 SClamp %62 %64 %59
OpStore %y %60
%65 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
%66 = OpLoad %int %65
OpStore %i %66
OpBranch %67
%67 = OpLabel
OpLoopMerge %68 %69 None
OpBranch %70
%70 = OpLabel
%76 = OpLoad %int %i
%77 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0
%78 = OpLoad %int %77
%79 = OpSLessThan %bool %76 %78
OpSelectionMerge %80 None
OpBranchConditional %79 %81 %82
%81 = OpLabel
OpBranch %80
%82 = OpLabel
OpBranch %68
%80 = OpLabel
%83 = OpLoad %int %b
%84 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0
%85 = OpLoad %int %84
%86 = OpSGreaterThan %bool %83 %85
OpStore %x_83_phi %86
OpSelectionMerge %87 None
OpBranchConditional %86 %88 %87
%88 = OpLabel
%89 = OpLoad %int %y
%90 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
%91 = OpLoad %int %90
%92 = OpSGreaterThan %bool %89 %91
OpStore %x_82 %92
%93 = OpLoad %bool %x_82
OpStore %x_83_phi %93
OpBranch %87
%87 = OpLabel
%94 = OpLoad %bool %x_83_phi
OpSelectionMerge %95 None
OpBranchConditional %94 %96 %95
%96 = OpLabel
OpBranch %68
%95 = OpLabel
%97 = OpLoad %int %b
%98 = OpIAdd %int %97 %int_1
OpStore %b %98
OpBranch %69
%69 = OpLabel
%99 = OpLoad %int %i
%100 = OpIAdd %int %99 %int_1
OpStore %i %100
OpBranch %67
%68 = OpLabel
%101 = OpLoad %int %b
%102 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0
%103 = OpLoad %int %102
%104 = OpIEqual %bool %101 %103
OpSelectionMerge %105 None
OpBranchConditional %104 %106 %105
%106 = OpLabel
%108 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2
%109 = OpLoad %int %108
%110 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
%111 = OpLoad %int %110
%113 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3
%114 = OpLoad %int %113
%115 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
%116 = OpLoad %int %115
%117 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2
%118 = OpLoad %int %117
%119 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2
%120 = OpLoad %int %119
%121 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
%122 = OpLoad %int %121
%123 = OpExtInst %int %61 SClamp %109 %111 %114
%125 = OpAccessChain %_ptr_Function_v4float %data %123
%126 = OpConvertSToF %float %116
%127 = OpConvertSToF %float %118
%128 = OpConvertSToF %float %120
%129 = OpConvertSToF %float %122
%130 = OpCompositeConstruct %v4float %126 %127 %128 %129
OpStore %125 %130
OpBranch %105
%105 = OpLabel
%131 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
%132 = OpLoad %int %131
%133 = OpAccessChain %_ptr_Function_v4float %data %132
%134 = OpLoad %v4float %133
%135 = OpCompositeExtract %float %134 0
%136 = OpCompositeExtract %float %134 1
%137 = OpCompositeExtract %float %134 2
%138 = OpCompositeExtract %float %134 3
%139 = OpCompositeConstruct %v4float %135 %136 %137 %138
OpStore %x_GLF_color %139
OpReturn
OpFunctionEnd
%tint_symbol_3 = OpFunction %void None %140
%tint_symbol_1 = OpFunctionParameter %main_out
%144 = OpLabel
%145 = OpCompositeExtract %v4float %tint_symbol_1 0
OpStore %tint_symbol_2 %145
OpReturn
OpFunctionEnd
%main = OpFunction %void None %23
%147 = OpLabel
%148 = OpLoad %v4float %tint_symbol
OpStore %gl_FragCoord %148
%149 = OpFunctionCall %void %main_1
%151 = OpLoad %v4float %x_GLF_color
%152 = OpCompositeConstruct %main_out %151
%150 = OpFunctionCall %void %tint_symbol_3 %152
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,99 @@
type Arr = [[stride(16)]] array<f32, 1>;
[[block]]
struct buf0 {
x_GLF_uniform_float_values : Arr;
};
type Arr_1 = [[stride(16)]] array<i32, 4>;
[[block]]
struct buf1 {
x_GLF_uniform_int_values : Arr_1;
};
[[group(0), binding(0)]] var<uniform> x_7 : buf0;
[[group(0), binding(1)]] var<uniform> x_10 : buf1;
var<private> gl_FragCoord : vec4<f32>;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var data : array<vec4<f32>, 2>;
var b : i32;
var y : i32;
var i : i32;
let x_42 : f32 = x_7.x_GLF_uniform_float_values[0];
let x_45 : f32 = x_7.x_GLF_uniform_float_values[0];
data = array<vec4<f32>, 2>(vec4<f32>(x_42, x_42, x_42, x_42), vec4<f32>(x_45, x_45, x_45, x_45));
let x_49 : i32 = x_10.x_GLF_uniform_int_values[1];
b = x_49;
let x_51 : f32 = gl_FragCoord.y;
let x_54 : i32 = x_10.x_GLF_uniform_int_values[1];
let x_56 : f32 = gl_FragCoord.y;
let x_60 : i32 = x_10.x_GLF_uniform_int_values[1];
y = clamp(i32(x_51), (x_54 | i32(x_56)), x_60);
let x_63 : i32 = x_10.x_GLF_uniform_int_values[1];
i = x_63;
loop {
var x_82 : bool;
var x_83_phi : bool;
let x_68 : i32 = i;
let x_70 : i32 = x_10.x_GLF_uniform_int_values[0];
if ((x_68 < x_70)) {
} else {
break;
}
let x_73 : i32 = b;
let x_75 : i32 = x_10.x_GLF_uniform_int_values[0];
let x_76 : bool = (x_73 > x_75);
x_83_phi = x_76;
if (x_76) {
let x_79 : i32 = y;
let x_81 : i32 = x_10.x_GLF_uniform_int_values[1];
x_82 = (x_79 > x_81);
x_83_phi = x_82;
}
let x_83 : bool = x_83_phi;
if (x_83) {
break;
}
let x_86 : i32 = b;
b = (x_86 + 1);
continuing {
let x_88 : i32 = i;
i = (x_88 + 1);
}
}
let x_90 : i32 = b;
let x_92 : i32 = x_10.x_GLF_uniform_int_values[0];
if ((x_90 == x_92)) {
let x_97 : i32 = x_10.x_GLF_uniform_int_values[2];
let x_99 : i32 = x_10.x_GLF_uniform_int_values[1];
let x_101 : i32 = x_10.x_GLF_uniform_int_values[3];
let x_104 : i32 = x_10.x_GLF_uniform_int_values[1];
let x_107 : i32 = x_10.x_GLF_uniform_int_values[2];
let x_110 : i32 = x_10.x_GLF_uniform_int_values[2];
let x_113 : i32 = x_10.x_GLF_uniform_int_values[1];
data[clamp(x_97, x_99, x_101)] = vec4<f32>(f32(x_104), f32(x_107), f32(x_110), f32(x_113));
}
let x_118 : i32 = x_10.x_GLF_uniform_int_values[1];
let x_120 : vec4<f32> = data[x_118];
x_GLF_color = vec4<f32>(x_120.x, x_120.y, x_120.z, x_120.w);
return;
}
struct main_out {
[[location(0)]]
x_GLF_color_1 : vec4<f32>;
};
[[stage(fragment)]]
fn main([[builtin(position)]] gl_FragCoord_param : vec4<f32>) -> main_out {
gl_FragCoord = gl_FragCoord_param;
main_1();
return main_out(x_GLF_color);
}