mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-11 14:41:50 +00:00
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:
committed by
Tint LUCI CQ
parent
bd3edb564f
commit
f7e73d4ee3
@@ -0,0 +1,194 @@
|
||||
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 %func_i1_ "func(i1;"
|
||||
OpName %a "a"
|
||||
OpName %b "b"
|
||||
OpName %data "data"
|
||||
OpName %gl_FragCoord "gl_FragCoord"
|
||||
OpName %temp "temp"
|
||||
OpName %i "i"
|
||||
OpName %i_0 "i"
|
||||
OpName %param "param"
|
||||
OpName %param_0 "param"
|
||||
OpName %_GLF_color "_GLF_color"
|
||||
OpDecorate %gl_FragCoord BuiltIn FragCoord
|
||||
OpDecorate %_GLF_color Location 0
|
||||
%void = OpTypeVoid
|
||||
%15 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%float = OpTypeFloat 32
|
||||
%19 = OpTypeFunction %float %_ptr_Function_int
|
||||
%int_0 = OpConstant %int 0
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_9 = OpConstant %uint 9
|
||||
%_arr_int_uint_9 = OpTypeArray %int %uint_9
|
||||
%_ptr_Private__arr_int_uint_9 = OpTypePointer Private %_arr_int_uint_9
|
||||
%data = OpVariable %_ptr_Private__arr_int_uint_9 Private
|
||||
%int_5 = OpConstant %int 5
|
||||
%_ptr_Private_int = OpTypePointer Private %int
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_4 = OpConstant %int 4
|
||||
%int_6 = OpConstant %int 6
|
||||
%int_8 = OpConstant %int 8
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%gl_FragCoord = OpVariable %_ptr_Input_v4float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_0 = OpConstant %float 0
|
||||
%bool = OpTypeBool
|
||||
%uint_7 = OpConstant %uint 7
|
||||
%_arr_int_uint_7 = OpTypeArray %int %uint_7
|
||||
%_ptr_Private__arr_int_uint_7 = OpTypePointer Private %_arr_int_uint_7
|
||||
%temp = OpVariable %_ptr_Private__arr_int_uint_7 Private
|
||||
%int_3 = OpConstant %int 3
|
||||
%int_1 = OpConstant %int 1
|
||||
%float_1 = OpConstant %float 1
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_GLF_color = OpVariable %_ptr_Output_v4float Output
|
||||
%44 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
|
||||
%45 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
|
||||
%main = OpFunction %void None %15
|
||||
%46 = OpLabel
|
||||
%i_0 = OpVariable %_ptr_Function_int Function
|
||||
%param = OpVariable %_ptr_Function_int Function
|
||||
%param_0 = OpVariable %_ptr_Function_int Function
|
||||
OpStore %i_0 %int_0
|
||||
OpBranch %47
|
||||
%47 = OpLabel
|
||||
OpLoopMerge %48 %49 None
|
||||
OpBranch %50
|
||||
%50 = OpLabel
|
||||
%51 = OpLoad %int %i_0
|
||||
%52 = OpSLessThan %bool %51 %int_6
|
||||
OpBranchConditional %52 %53 %48
|
||||
%53 = OpLabel
|
||||
%54 = OpLoad %int %i_0
|
||||
OpStore %param %54
|
||||
%55 = OpFunctionCall %float %func_i1_ %param
|
||||
%56 = OpLoad %int %i_0
|
||||
OpStore %param_0 %56
|
||||
%57 = OpFunctionCall %float %func_i1_ %param_0
|
||||
%58 = OpFOrdEqual %bool %57 %float_1
|
||||
OpSelectionMerge %59 None
|
||||
OpBranchConditional %58 %60 %61
|
||||
%60 = OpLabel
|
||||
OpStore %_GLF_color %44
|
||||
OpBranch %59
|
||||
%61 = OpLabel
|
||||
OpStore %_GLF_color %45
|
||||
OpBranch %59
|
||||
%59 = OpLabel
|
||||
OpBranch %49
|
||||
%49 = OpLabel
|
||||
%62 = OpLoad %int %i_0
|
||||
%63 = OpIAdd %int %62 %int_1
|
||||
OpStore %i_0 %63
|
||||
OpBranch %47
|
||||
%48 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%func_i1_ = OpFunction %float None %19
|
||||
%a = OpFunctionParameter %_ptr_Function_int
|
||||
%64 = OpLabel
|
||||
%b = OpVariable %_ptr_Function_int Function
|
||||
%i = OpVariable %_ptr_Function_int Function
|
||||
OpStore %b %int_0
|
||||
%65 = OpAccessChain %_ptr_Private_int %data %int_0
|
||||
OpStore %65 %int_5
|
||||
%66 = OpAccessChain %_ptr_Private_int %data %int_2
|
||||
OpStore %66 %int_0
|
||||
%67 = OpAccessChain %_ptr_Private_int %data %int_4
|
||||
OpStore %67 %int_0
|
||||
%68 = OpAccessChain %_ptr_Private_int %data %int_6
|
||||
OpStore %68 %int_0
|
||||
%69 = OpAccessChain %_ptr_Private_int %data %int_8
|
||||
OpStore %69 %int_0
|
||||
%70 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0
|
||||
%71 = OpLoad %float %70
|
||||
%72 = OpFOrdGreaterThanEqual %bool %71 %float_0
|
||||
OpSelectionMerge %73 None
|
||||
OpBranchConditional %72 %74 %73
|
||||
%74 = OpLabel
|
||||
OpBranch %75
|
||||
%75 = OpLabel
|
||||
OpLoopMerge %76 %77 None
|
||||
OpBranch %78
|
||||
%78 = OpLabel
|
||||
%79 = OpLoad %int %b
|
||||
%80 = OpLoad %int %a
|
||||
%81 = OpSLessThanEqual %bool %79 %80
|
||||
OpBranchConditional %81 %82 %76
|
||||
%82 = OpLabel
|
||||
%83 = OpLoad %int %b
|
||||
%84 = OpSLessThanEqual %bool %83 %int_5
|
||||
OpSelectionMerge %85 None
|
||||
OpBranchConditional %84 %86 %85
|
||||
%86 = OpLabel
|
||||
%87 = OpLoad %int %b
|
||||
%88 = OpLoad %int %b
|
||||
%89 = OpAccessChain %_ptr_Private_int %data %88
|
||||
%90 = OpLoad %int %89
|
||||
%91 = OpAccessChain %_ptr_Private_int %temp %87
|
||||
OpStore %91 %90
|
||||
%92 = OpLoad %int %b
|
||||
%93 = OpIAdd %int %92 %int_2
|
||||
OpStore %b %93
|
||||
OpBranch %85
|
||||
%85 = OpLabel
|
||||
OpBranch %77
|
||||
%77 = OpLabel
|
||||
OpBranch %75
|
||||
%76 = OpLabel
|
||||
OpBranch %73
|
||||
%73 = OpLabel
|
||||
OpStore %i %int_0
|
||||
OpBranch %94
|
||||
%94 = OpLabel
|
||||
OpLoopMerge %95 %96 None
|
||||
OpBranch %97
|
||||
%97 = OpLabel
|
||||
%98 = OpLoad %int %i
|
||||
%99 = OpSLessThan %bool %98 %int_3
|
||||
OpBranchConditional %99 %100 %95
|
||||
%100 = OpLabel
|
||||
%101 = OpLoad %int %i
|
||||
%102 = OpAccessChain %_ptr_Private_int %temp %int_0
|
||||
%103 = OpLoad %int %102
|
||||
%104 = OpIAdd %int %103 %int_1
|
||||
%105 = OpAccessChain %_ptr_Private_int %data %101
|
||||
OpStore %105 %104
|
||||
OpBranch %96
|
||||
%96 = OpLabel
|
||||
%106 = OpLoad %int %i
|
||||
%107 = OpIAdd %int %106 %int_1
|
||||
OpStore %i %107
|
||||
OpBranch %94
|
||||
%95 = OpLabel
|
||||
%108 = OpAccessChain %_ptr_Private_int %temp %int_0
|
||||
%109 = OpLoad %int %108
|
||||
%110 = OpIEqual %bool %109 %int_5
|
||||
OpSelectionMerge %111 None
|
||||
OpBranchConditional %110 %112 %111
|
||||
%112 = OpLabel
|
||||
%113 = OpAccessChain %_ptr_Private_int %data %int_0
|
||||
%114 = OpLoad %int %113
|
||||
%115 = OpIEqual %bool %114 %int_6
|
||||
OpBranch %111
|
||||
%111 = OpLabel
|
||||
%116 = OpPhi %bool %110 %95 %115 %112
|
||||
OpSelectionMerge %117 None
|
||||
OpBranchConditional %116 %118 %119
|
||||
%118 = OpLabel
|
||||
OpReturnValue %float_1
|
||||
%119 = OpLabel
|
||||
OpReturnValue %float_0
|
||||
%117 = OpLabel
|
||||
OpUnreachable
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,96 @@
|
||||
static int data[9] = (int[9])0;
|
||||
static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
static int temp[7] = (int[7])0;
|
||||
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
float func_i1_(inout int a) {
|
||||
int b = 0;
|
||||
int i = 0;
|
||||
bool x_115 = false;
|
||||
bool x_116_phi = false;
|
||||
b = 0;
|
||||
data[0] = 5;
|
||||
data[2] = 0;
|
||||
data[4] = 0;
|
||||
data[6] = 0;
|
||||
data[8] = 0;
|
||||
const float x_71 = gl_FragCoord.x;
|
||||
if ((x_71 >= 0.0f)) {
|
||||
while (true) {
|
||||
const int x_79 = b;
|
||||
const int x_80 = a;
|
||||
if ((x_79 <= x_80)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
if ((b <= 5)) {
|
||||
const int x_87 = b;
|
||||
const int x_90 = data[b];
|
||||
temp[x_87] = x_90;
|
||||
b = (b + 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
{
|
||||
for(; (i < 3); i = (i + 1)) {
|
||||
const int x_101 = i;
|
||||
const int x_103 = temp[0];
|
||||
data[x_101] = (x_103 + 1);
|
||||
}
|
||||
}
|
||||
const int x_109 = temp[0];
|
||||
const bool x_110 = (x_109 == 5);
|
||||
x_116_phi = x_110;
|
||||
if (x_110) {
|
||||
const int x_114 = data[0];
|
||||
x_115 = (x_114 == 6);
|
||||
x_116_phi = x_115;
|
||||
}
|
||||
if (x_116_phi) {
|
||||
return 1.0f;
|
||||
} else {
|
||||
return 0.0f;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
void main_1() {
|
||||
int i_1 = 0;
|
||||
int param = 0;
|
||||
int param_1 = 0;
|
||||
i_1 = 0;
|
||||
{
|
||||
for(; (i_1 < 6); i_1 = (i_1 + 1)) {
|
||||
param = i_1;
|
||||
const float x_55 = func_i1_(param);
|
||||
param_1 = i_1;
|
||||
const float x_57 = func_i1_(param_1);
|
||||
if ((x_57 == 1.0f)) {
|
||||
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
} else {
|
||||
x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol_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_4 = {tint_symbol_3.x_GLF_color_1};
|
||||
return tint_symbol_4;
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_array_wrapper {
|
||||
int arr[9];
|
||||
};
|
||||
struct tint_array_wrapper_1 {
|
||||
int arr[7];
|
||||
};
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float4 x_GLF_color_1 [[color(0)]];
|
||||
};
|
||||
|
||||
float func_i1_(thread int* const a, thread tint_array_wrapper* const tint_symbol_5, thread float4* const tint_symbol_6, thread tint_array_wrapper_1* const tint_symbol_7) {
|
||||
int b = 0;
|
||||
int i = 0;
|
||||
bool x_115 = false;
|
||||
bool x_116_phi = false;
|
||||
b = 0;
|
||||
(*(tint_symbol_5)).arr[0] = 5;
|
||||
(*(tint_symbol_5)).arr[2] = 0;
|
||||
(*(tint_symbol_5)).arr[4] = 0;
|
||||
(*(tint_symbol_5)).arr[6] = 0;
|
||||
(*(tint_symbol_5)).arr[8] = 0;
|
||||
float const x_71 = (*(tint_symbol_6)).x;
|
||||
if ((x_71 >= 0.0f)) {
|
||||
while (true) {
|
||||
int const x_79 = b;
|
||||
int const x_80 = *(a);
|
||||
if ((x_79 <= x_80)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
int const x_83 = b;
|
||||
if ((x_83 <= 5)) {
|
||||
int const x_87 = b;
|
||||
int const x_88 = b;
|
||||
int const x_90 = (*(tint_symbol_5)).arr[x_88];
|
||||
(*(tint_symbol_7)).arr[x_87] = x_90;
|
||||
int const x_92 = b;
|
||||
b = (x_92 + 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
while (true) {
|
||||
int const x_98 = i;
|
||||
if ((x_98 < 3)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
int const x_101 = i;
|
||||
int const x_103 = (*(tint_symbol_7)).arr[0];
|
||||
(*(tint_symbol_5)).arr[x_101] = (x_103 + 1);
|
||||
{
|
||||
int const x_106 = i;
|
||||
i = (x_106 + 1);
|
||||
}
|
||||
}
|
||||
int const x_109 = (*(tint_symbol_7)).arr[0];
|
||||
bool const x_110 = (x_109 == 5);
|
||||
x_116_phi = x_110;
|
||||
if (x_110) {
|
||||
int const x_114 = (*(tint_symbol_5)).arr[0];
|
||||
x_115 = (x_114 == 6);
|
||||
x_116_phi = x_115;
|
||||
}
|
||||
bool const x_116 = x_116_phi;
|
||||
if (x_116) {
|
||||
return 1.0f;
|
||||
} else {
|
||||
return 0.0f;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
void main_1(thread tint_array_wrapper* const tint_symbol_8, thread float4* const tint_symbol_9, thread tint_array_wrapper_1* const tint_symbol_10, thread float4* const tint_symbol_11) {
|
||||
int i_1 = 0;
|
||||
int param = 0;
|
||||
int param_1 = 0;
|
||||
i_1 = 0;
|
||||
while (true) {
|
||||
int const x_51 = i_1;
|
||||
if ((x_51 < 6)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
int const x_54 = i_1;
|
||||
param = x_54;
|
||||
float const x_55 = func_i1_(&(param), tint_symbol_8, tint_symbol_9, tint_symbol_10);
|
||||
int const x_56 = i_1;
|
||||
param_1 = x_56;
|
||||
float const x_57 = func_i1_(&(param_1), tint_symbol_8, tint_symbol_9, tint_symbol_10);
|
||||
if ((x_57 == 1.0f)) {
|
||||
*(tint_symbol_11) = float4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
} else {
|
||||
*(tint_symbol_11) = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
{
|
||||
int const x_62 = i_1;
|
||||
i_1 = (x_62 + 1);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) {
|
||||
thread float4 tint_symbol_12 = 0.0f;
|
||||
thread tint_array_wrapper tint_symbol_13 = {};
|
||||
thread tint_array_wrapper_1 tint_symbol_14 = {};
|
||||
thread float4 tint_symbol_15 = 0.0f;
|
||||
tint_symbol_12 = gl_FragCoord_param;
|
||||
main_1(&(tint_symbol_13), &(tint_symbol_12), &(tint_symbol_14), &(tint_symbol_15));
|
||||
main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_15};
|
||||
tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
|
||||
return tint_symbol_4;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,258 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 153
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %data "data"
|
||||
OpName %gl_FragCoord "gl_FragCoord"
|
||||
OpName %temp "temp"
|
||||
OpName %x_GLF_color "x_GLF_color"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %func_i1_ "func_i1_"
|
||||
OpName %a "a"
|
||||
OpName %b "b"
|
||||
OpName %i "i"
|
||||
OpName %x_115 "x_115"
|
||||
OpName %x_116_phi "x_116_phi"
|
||||
OpName %main_1 "main_1"
|
||||
OpName %i_1 "i_1"
|
||||
OpName %param "param"
|
||||
OpName %param_1 "param_1"
|
||||
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 %_arr_int_uint_9 ArrayStride 4
|
||||
OpDecorate %_arr_int_uint_7 ArrayStride 4
|
||||
OpDecorate %tint_symbol BuiltIn FragCoord
|
||||
OpDecorate %tint_symbol_2 Location 0
|
||||
OpMemberDecorate %main_out 0 Offset 0
|
||||
%int = OpTypeInt 32 1
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_9 = OpConstant %uint 9
|
||||
%_arr_int_uint_9 = OpTypeArray %int %uint_9
|
||||
%_ptr_Private__arr_int_uint_9 = OpTypePointer Private %_arr_int_uint_9
|
||||
%7 = OpConstantNull %_arr_int_uint_9
|
||||
%data = OpVariable %_ptr_Private__arr_int_uint_9 Private %7
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Private_v4float = OpTypePointer Private %v4float
|
||||
%12 = OpConstantNull %v4float
|
||||
%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %12
|
||||
%uint_7 = OpConstant %uint 7
|
||||
%_arr_int_uint_7 = OpTypeArray %int %uint_7
|
||||
%_ptr_Private__arr_int_uint_7 = OpTypePointer Private %_arr_int_uint_7
|
||||
%17 = OpConstantNull %_arr_int_uint_7
|
||||
%temp = OpVariable %_ptr_Private__arr_int_uint_7 Private %17
|
||||
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12
|
||||
%_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 %12
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%23 = OpTypeFunction %float %_ptr_Function_int
|
||||
%29 = OpConstantNull %int
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Function_bool = OpTypePointer Function %bool
|
||||
%34 = OpConstantNull %bool
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Private_int = OpTypePointer Private %int
|
||||
%int_5 = OpConstant %int 5
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_4 = OpConstant %int 4
|
||||
%int_6 = OpConstant %int 6
|
||||
%int_8 = OpConstant %int 8
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Private_float = OpTypePointer Private %float
|
||||
%float_0 = OpConstant %float 0
|
||||
%int_3 = OpConstant %int 3
|
||||
%int_1 = OpConstant %int 1
|
||||
%float_1 = OpConstant %float 1
|
||||
%void = OpTypeVoid
|
||||
%110 = OpTypeFunction %void
|
||||
%136 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
|
||||
%137 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%140 = OpTypeFunction %void %main_out
|
||||
%func_i1_ = OpFunction %float None %23
|
||||
%a = OpFunctionParameter %_ptr_Function_int
|
||||
%27 = OpLabel
|
||||
%b = OpVariable %_ptr_Function_int Function %29
|
||||
%i = OpVariable %_ptr_Function_int Function %29
|
||||
%x_115 = OpVariable %_ptr_Function_bool Function %34
|
||||
%x_116_phi = OpVariable %_ptr_Function_bool Function %34
|
||||
OpStore %b %int_0
|
||||
%38 = OpAccessChain %_ptr_Private_int %data %int_0
|
||||
OpStore %38 %int_5
|
||||
%41 = OpAccessChain %_ptr_Private_int %data %int_2
|
||||
OpStore %41 %int_0
|
||||
%43 = OpAccessChain %_ptr_Private_int %data %int_4
|
||||
OpStore %43 %int_0
|
||||
%45 = OpAccessChain %_ptr_Private_int %data %int_6
|
||||
OpStore %45 %int_0
|
||||
%47 = OpAccessChain %_ptr_Private_int %data %int_8
|
||||
OpStore %47 %int_0
|
||||
%50 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0
|
||||
%51 = OpLoad %float %50
|
||||
%53 = OpFOrdGreaterThanEqual %bool %51 %float_0
|
||||
OpSelectionMerge %54 None
|
||||
OpBranchConditional %53 %55 %54
|
||||
%55 = OpLabel
|
||||
OpBranch %56
|
||||
%56 = OpLabel
|
||||
OpLoopMerge %57 %58 None
|
||||
OpBranch %59
|
||||
%59 = OpLabel
|
||||
%60 = OpLoad %int %b
|
||||
%62 = OpLoad %int %a
|
||||
%63 = OpSLessThanEqual %bool %60 %62
|
||||
OpSelectionMerge %64 None
|
||||
OpBranchConditional %63 %65 %66
|
||||
%65 = OpLabel
|
||||
OpBranch %64
|
||||
%66 = OpLabel
|
||||
OpBranch %57
|
||||
%64 = OpLabel
|
||||
%67 = OpLoad %int %b
|
||||
%68 = OpSLessThanEqual %bool %67 %int_5
|
||||
OpSelectionMerge %69 None
|
||||
OpBranchConditional %68 %70 %69
|
||||
%70 = OpLabel
|
||||
%71 = OpLoad %int %b
|
||||
%72 = OpLoad %int %b
|
||||
%73 = OpAccessChain %_ptr_Private_int %data %72
|
||||
%74 = OpLoad %int %73
|
||||
%75 = OpAccessChain %_ptr_Private_int %temp %71
|
||||
OpStore %75 %74
|
||||
%76 = OpLoad %int %b
|
||||
%77 = OpIAdd %int %76 %int_2
|
||||
OpStore %b %77
|
||||
OpBranch %69
|
||||
%69 = OpLabel
|
||||
OpBranch %58
|
||||
%58 = OpLabel
|
||||
OpBranch %56
|
||||
%57 = OpLabel
|
||||
OpBranch %54
|
||||
%54 = OpLabel
|
||||
OpStore %i %int_0
|
||||
OpBranch %78
|
||||
%78 = OpLabel
|
||||
OpLoopMerge %79 %80 None
|
||||
OpBranch %81
|
||||
%81 = OpLabel
|
||||
%82 = OpLoad %int %i
|
||||
%84 = OpSLessThan %bool %82 %int_3
|
||||
OpSelectionMerge %85 None
|
||||
OpBranchConditional %84 %86 %87
|
||||
%86 = OpLabel
|
||||
OpBranch %85
|
||||
%87 = OpLabel
|
||||
OpBranch %79
|
||||
%85 = OpLabel
|
||||
%88 = OpLoad %int %i
|
||||
%89 = OpAccessChain %_ptr_Private_int %temp %int_0
|
||||
%90 = OpLoad %int %89
|
||||
%91 = OpAccessChain %_ptr_Private_int %data %88
|
||||
%93 = OpIAdd %int %90 %int_1
|
||||
OpStore %91 %93
|
||||
OpBranch %80
|
||||
%80 = OpLabel
|
||||
%94 = OpLoad %int %i
|
||||
%95 = OpIAdd %int %94 %int_1
|
||||
OpStore %i %95
|
||||
OpBranch %78
|
||||
%79 = OpLabel
|
||||
%96 = OpAccessChain %_ptr_Private_int %temp %int_0
|
||||
%97 = OpLoad %int %96
|
||||
%98 = OpIEqual %bool %97 %int_5
|
||||
OpStore %x_116_phi %98
|
||||
OpSelectionMerge %99 None
|
||||
OpBranchConditional %98 %100 %99
|
||||
%100 = OpLabel
|
||||
%101 = OpAccessChain %_ptr_Private_int %data %int_0
|
||||
%102 = OpLoad %int %101
|
||||
%103 = OpIEqual %bool %102 %int_6
|
||||
OpStore %x_115 %103
|
||||
%104 = OpLoad %bool %x_115
|
||||
OpStore %x_116_phi %104
|
||||
OpBranch %99
|
||||
%99 = OpLabel
|
||||
%105 = OpLoad %bool %x_116_phi
|
||||
OpSelectionMerge %106 None
|
||||
OpBranchConditional %105 %107 %108
|
||||
%107 = OpLabel
|
||||
OpReturnValue %float_1
|
||||
%108 = OpLabel
|
||||
OpReturnValue %float_0
|
||||
%106 = OpLabel
|
||||
OpReturnValue %float_0
|
||||
OpFunctionEnd
|
||||
%main_1 = OpFunction %void None %110
|
||||
%113 = OpLabel
|
||||
%i_1 = OpVariable %_ptr_Function_int Function %29
|
||||
%param = OpVariable %_ptr_Function_int Function %29
|
||||
%param_1 = OpVariable %_ptr_Function_int Function %29
|
||||
OpStore %i_1 %int_0
|
||||
OpBranch %117
|
||||
%117 = OpLabel
|
||||
OpLoopMerge %118 %119 None
|
||||
OpBranch %120
|
||||
%120 = OpLabel
|
||||
%121 = OpLoad %int %i_1
|
||||
%122 = OpSLessThan %bool %121 %int_6
|
||||
OpSelectionMerge %123 None
|
||||
OpBranchConditional %122 %124 %125
|
||||
%124 = OpLabel
|
||||
OpBranch %123
|
||||
%125 = OpLabel
|
||||
OpBranch %118
|
||||
%123 = OpLabel
|
||||
%126 = OpLoad %int %i_1
|
||||
OpStore %param %126
|
||||
%127 = OpFunctionCall %float %func_i1_ %param
|
||||
%129 = OpLoad %int %i_1
|
||||
OpStore %param_1 %129
|
||||
%130 = OpFunctionCall %float %func_i1_ %param_1
|
||||
%132 = OpFOrdEqual %bool %130 %float_1
|
||||
OpSelectionMerge %133 None
|
||||
OpBranchConditional %132 %134 %135
|
||||
%134 = OpLabel
|
||||
OpStore %x_GLF_color %136
|
||||
OpBranch %133
|
||||
%135 = OpLabel
|
||||
OpStore %x_GLF_color %137
|
||||
OpBranch %133
|
||||
%133 = OpLabel
|
||||
OpBranch %119
|
||||
%119 = OpLabel
|
||||
%138 = OpLoad %int %i_1
|
||||
%139 = OpIAdd %int %138 %int_1
|
||||
OpStore %i_1 %139
|
||||
OpBranch %117
|
||||
%118 = OpLabel
|
||||
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 %110
|
||||
%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
|
||||
@@ -0,0 +1,114 @@
|
||||
var<private> data : array<i32, 9>;
|
||||
|
||||
var<private> gl_FragCoord : vec4<f32>;
|
||||
|
||||
var<private> temp : array<i32, 7>;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn func_i1_(a : ptr<function, i32>) -> f32 {
|
||||
var b : i32;
|
||||
var i : i32;
|
||||
var x_115 : bool;
|
||||
var x_116_phi : bool;
|
||||
b = 0;
|
||||
data[0] = 5;
|
||||
data[2] = 0;
|
||||
data[4] = 0;
|
||||
data[6] = 0;
|
||||
data[8] = 0;
|
||||
let x_71 : f32 = gl_FragCoord.x;
|
||||
if ((x_71 >= 0.0)) {
|
||||
loop {
|
||||
let x_79 : i32 = b;
|
||||
let x_80 : i32 = *(a);
|
||||
if ((x_79 <= x_80)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_83 : i32 = b;
|
||||
if ((x_83 <= 5)) {
|
||||
let x_87 : i32 = b;
|
||||
let x_88 : i32 = b;
|
||||
let x_90 : i32 = data[x_88];
|
||||
temp[x_87] = x_90;
|
||||
let x_92 : i32 = b;
|
||||
b = (x_92 + 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
loop {
|
||||
let x_98 : i32 = i;
|
||||
if ((x_98 < 3)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_101 : i32 = i;
|
||||
let x_103 : i32 = temp[0];
|
||||
data[x_101] = (x_103 + 1);
|
||||
|
||||
continuing {
|
||||
let x_106 : i32 = i;
|
||||
i = (x_106 + 1);
|
||||
}
|
||||
}
|
||||
let x_109 : i32 = temp[0];
|
||||
let x_110 : bool = (x_109 == 5);
|
||||
x_116_phi = x_110;
|
||||
if (x_110) {
|
||||
let x_114 : i32 = data[0];
|
||||
x_115 = (x_114 == 6);
|
||||
x_116_phi = x_115;
|
||||
}
|
||||
let x_116 : bool = x_116_phi;
|
||||
if (x_116) {
|
||||
return 1.0;
|
||||
} else {
|
||||
return 0.0;
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
fn main_1() {
|
||||
var i_1 : i32;
|
||||
var param : i32;
|
||||
var param_1 : i32;
|
||||
i_1 = 0;
|
||||
loop {
|
||||
let x_51 : i32 = i_1;
|
||||
if ((x_51 < 6)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_54 : i32 = i_1;
|
||||
param = x_54;
|
||||
let x_55 : f32 = func_i1_(&(param));
|
||||
let x_56 : i32 = i_1;
|
||||
param_1 = x_56;
|
||||
let x_57 : f32 = func_i1_(&(param_1));
|
||||
if ((x_57 == 1.0)) {
|
||||
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
} else {
|
||||
x_GLF_color = vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
continuing {
|
||||
let x_62 : i32 = i_1;
|
||||
i_1 = (x_62 + 1);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
var<private> data : array<i32, 9>;
|
||||
|
||||
var<private> gl_FragCoord : vec4<f32>;
|
||||
|
||||
var<private> temp : array<i32, 7>;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn func_i1_(a : ptr<function, i32>) -> f32 {
|
||||
var b : i32;
|
||||
var i : i32;
|
||||
var x_115 : bool;
|
||||
var x_116_phi : bool;
|
||||
b = 0;
|
||||
data[0] = 5;
|
||||
data[2] = 0;
|
||||
data[4] = 0;
|
||||
data[6] = 0;
|
||||
data[8] = 0;
|
||||
let x_71 : f32 = gl_FragCoord.x;
|
||||
if ((x_71 >= 0.0)) {
|
||||
loop {
|
||||
let x_79 : i32 = b;
|
||||
let x_80 : i32 = *(a);
|
||||
if ((x_79 <= x_80)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_83 : i32 = b;
|
||||
if ((x_83 <= 5)) {
|
||||
let x_87 : i32 = b;
|
||||
let x_88 : i32 = b;
|
||||
let x_90 : i32 = data[x_88];
|
||||
temp[x_87] = x_90;
|
||||
let x_92 : i32 = b;
|
||||
b = (x_92 + 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
loop {
|
||||
let x_98 : i32 = i;
|
||||
if ((x_98 < 3)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_101 : i32 = i;
|
||||
let x_103 : i32 = temp[0];
|
||||
data[x_101] = (x_103 + 1);
|
||||
|
||||
continuing {
|
||||
let x_106 : i32 = i;
|
||||
i = (x_106 + 1);
|
||||
}
|
||||
}
|
||||
let x_109 : i32 = temp[0];
|
||||
let x_110 : bool = (x_109 == 5);
|
||||
x_116_phi = x_110;
|
||||
if (x_110) {
|
||||
let x_114 : i32 = data[0];
|
||||
x_115 = (x_114 == 6);
|
||||
x_116_phi = x_115;
|
||||
}
|
||||
let x_116 : bool = x_116_phi;
|
||||
if (x_116) {
|
||||
return 1.0;
|
||||
} else {
|
||||
return 0.0;
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
fn main_1() {
|
||||
var i_1 : i32;
|
||||
var param : i32;
|
||||
var param_1 : i32;
|
||||
i_1 = 0;
|
||||
loop {
|
||||
let x_51 : i32 = i_1;
|
||||
if ((x_51 < 6)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_54 : i32 = i_1;
|
||||
param = x_54;
|
||||
let x_55 : f32 = func_i1_(&(param));
|
||||
let x_56 : i32 = i_1;
|
||||
param_1 = x_56;
|
||||
let x_57 : f32 = func_i1_(&(param_1));
|
||||
if ((x_57 == 1.0)) {
|
||||
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
} else {
|
||||
x_GLF_color = vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
continuing {
|
||||
let x_62 : i32 = i_1;
|
||||
i_1 = (x_62 + 1);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
static int data[9] = (int[9])0;
|
||||
static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
static int temp[7] = (int[7])0;
|
||||
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
float func_i1_(inout int a) {
|
||||
int b = 0;
|
||||
int i = 0;
|
||||
bool x_115 = false;
|
||||
bool x_116_phi = false;
|
||||
b = 0;
|
||||
data[0] = 5;
|
||||
data[2] = 0;
|
||||
data[4] = 0;
|
||||
data[6] = 0;
|
||||
data[8] = 0;
|
||||
const float x_71 = gl_FragCoord.x;
|
||||
if ((x_71 >= 0.0f)) {
|
||||
while (true) {
|
||||
const int x_79 = b;
|
||||
const int x_80 = a;
|
||||
if ((x_79 <= x_80)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
if ((b <= 5)) {
|
||||
const int x_87 = b;
|
||||
const int x_90 = data[b];
|
||||
temp[x_87] = x_90;
|
||||
b = (b + 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
{
|
||||
for(; (i < 3); i = (i + 1)) {
|
||||
const int x_101 = i;
|
||||
const int x_103 = temp[0];
|
||||
data[x_101] = (x_103 + 1);
|
||||
}
|
||||
}
|
||||
const int x_109 = temp[0];
|
||||
const bool x_110 = (x_109 == 5);
|
||||
x_116_phi = x_110;
|
||||
if (x_110) {
|
||||
const int x_114 = data[0];
|
||||
x_115 = (x_114 == 6);
|
||||
x_116_phi = x_115;
|
||||
}
|
||||
if (x_116_phi) {
|
||||
return 1.0f;
|
||||
} else {
|
||||
return 0.0f;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
void main_1() {
|
||||
int i_1 = 0;
|
||||
int param = 0;
|
||||
int param_1 = 0;
|
||||
i_1 = 0;
|
||||
{
|
||||
for(; (i_1 < 6); i_1 = (i_1 + 1)) {
|
||||
param = i_1;
|
||||
const float x_55 = func_i1_(param);
|
||||
param_1 = i_1;
|
||||
const float x_57 = func_i1_(param_1);
|
||||
if ((x_57 == 1.0f)) {
|
||||
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
} else {
|
||||
x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol_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_4 = {tint_symbol_3.x_GLF_color_1};
|
||||
return tint_symbol_4;
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_array_wrapper {
|
||||
int arr[9];
|
||||
};
|
||||
struct tint_array_wrapper_1 {
|
||||
int arr[7];
|
||||
};
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float4 x_GLF_color_1 [[color(0)]];
|
||||
};
|
||||
|
||||
float func_i1_(thread int* const a, thread tint_array_wrapper* const tint_symbol_5, thread float4* const tint_symbol_6, thread tint_array_wrapper_1* const tint_symbol_7) {
|
||||
int b = 0;
|
||||
int i = 0;
|
||||
bool x_115 = false;
|
||||
bool x_116_phi = false;
|
||||
b = 0;
|
||||
(*(tint_symbol_5)).arr[0] = 5;
|
||||
(*(tint_symbol_5)).arr[2] = 0;
|
||||
(*(tint_symbol_5)).arr[4] = 0;
|
||||
(*(tint_symbol_5)).arr[6] = 0;
|
||||
(*(tint_symbol_5)).arr[8] = 0;
|
||||
float const x_71 = (*(tint_symbol_6)).x;
|
||||
if ((x_71 >= 0.0f)) {
|
||||
while (true) {
|
||||
int const x_79 = b;
|
||||
int const x_80 = *(a);
|
||||
if ((x_79 <= x_80)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
int const x_83 = b;
|
||||
if ((x_83 <= 5)) {
|
||||
int const x_87 = b;
|
||||
int const x_88 = b;
|
||||
int const x_90 = (*(tint_symbol_5)).arr[x_88];
|
||||
(*(tint_symbol_7)).arr[x_87] = x_90;
|
||||
int const x_92 = b;
|
||||
b = (x_92 + 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
while (true) {
|
||||
int const x_98 = i;
|
||||
if ((x_98 < 3)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
int const x_101 = i;
|
||||
int const x_103 = (*(tint_symbol_7)).arr[0];
|
||||
(*(tint_symbol_5)).arr[x_101] = (x_103 + 1);
|
||||
{
|
||||
int const x_106 = i;
|
||||
i = (x_106 + 1);
|
||||
}
|
||||
}
|
||||
int const x_109 = (*(tint_symbol_7)).arr[0];
|
||||
bool const x_110 = (x_109 == 5);
|
||||
x_116_phi = x_110;
|
||||
if (x_110) {
|
||||
int const x_114 = (*(tint_symbol_5)).arr[0];
|
||||
x_115 = (x_114 == 6);
|
||||
x_116_phi = x_115;
|
||||
}
|
||||
bool const x_116 = x_116_phi;
|
||||
if (x_116) {
|
||||
return 1.0f;
|
||||
} else {
|
||||
return 0.0f;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
void main_1(thread tint_array_wrapper* const tint_symbol_8, thread float4* const tint_symbol_9, thread tint_array_wrapper_1* const tint_symbol_10, thread float4* const tint_symbol_11) {
|
||||
int i_1 = 0;
|
||||
int param = 0;
|
||||
int param_1 = 0;
|
||||
i_1 = 0;
|
||||
while (true) {
|
||||
int const x_51 = i_1;
|
||||
if ((x_51 < 6)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
int const x_54 = i_1;
|
||||
param = x_54;
|
||||
float const x_55 = func_i1_(&(param), tint_symbol_8, tint_symbol_9, tint_symbol_10);
|
||||
int const x_56 = i_1;
|
||||
param_1 = x_56;
|
||||
float const x_57 = func_i1_(&(param_1), tint_symbol_8, tint_symbol_9, tint_symbol_10);
|
||||
if ((x_57 == 1.0f)) {
|
||||
*(tint_symbol_11) = float4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
} else {
|
||||
*(tint_symbol_11) = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
{
|
||||
int const x_62 = i_1;
|
||||
i_1 = (x_62 + 1);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) {
|
||||
thread float4 tint_symbol_12 = 0.0f;
|
||||
thread tint_array_wrapper tint_symbol_13 = {};
|
||||
thread tint_array_wrapper_1 tint_symbol_14 = {};
|
||||
thread float4 tint_symbol_15 = 0.0f;
|
||||
tint_symbol_12 = gl_FragCoord_param;
|
||||
main_1(&(tint_symbol_13), &(tint_symbol_12), &(tint_symbol_14), &(tint_symbol_15));
|
||||
main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_15};
|
||||
tint_symbol_2 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
|
||||
return tint_symbol_4;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,258 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 153
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %data "data"
|
||||
OpName %gl_FragCoord "gl_FragCoord"
|
||||
OpName %temp "temp"
|
||||
OpName %x_GLF_color "x_GLF_color"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %func_i1_ "func_i1_"
|
||||
OpName %a "a"
|
||||
OpName %b "b"
|
||||
OpName %i "i"
|
||||
OpName %x_115 "x_115"
|
||||
OpName %x_116_phi "x_116_phi"
|
||||
OpName %main_1 "main_1"
|
||||
OpName %i_1 "i_1"
|
||||
OpName %param "param"
|
||||
OpName %param_1 "param_1"
|
||||
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 %_arr_int_uint_9 ArrayStride 4
|
||||
OpDecorate %_arr_int_uint_7 ArrayStride 4
|
||||
OpDecorate %tint_symbol BuiltIn FragCoord
|
||||
OpDecorate %tint_symbol_2 Location 0
|
||||
OpMemberDecorate %main_out 0 Offset 0
|
||||
%int = OpTypeInt 32 1
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_9 = OpConstant %uint 9
|
||||
%_arr_int_uint_9 = OpTypeArray %int %uint_9
|
||||
%_ptr_Private__arr_int_uint_9 = OpTypePointer Private %_arr_int_uint_9
|
||||
%7 = OpConstantNull %_arr_int_uint_9
|
||||
%data = OpVariable %_ptr_Private__arr_int_uint_9 Private %7
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Private_v4float = OpTypePointer Private %v4float
|
||||
%12 = OpConstantNull %v4float
|
||||
%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %12
|
||||
%uint_7 = OpConstant %uint 7
|
||||
%_arr_int_uint_7 = OpTypeArray %int %uint_7
|
||||
%_ptr_Private__arr_int_uint_7 = OpTypePointer Private %_arr_int_uint_7
|
||||
%17 = OpConstantNull %_arr_int_uint_7
|
||||
%temp = OpVariable %_ptr_Private__arr_int_uint_7 Private %17
|
||||
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12
|
||||
%_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 %12
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%23 = OpTypeFunction %float %_ptr_Function_int
|
||||
%29 = OpConstantNull %int
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Function_bool = OpTypePointer Function %bool
|
||||
%34 = OpConstantNull %bool
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Private_int = OpTypePointer Private %int
|
||||
%int_5 = OpConstant %int 5
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_4 = OpConstant %int 4
|
||||
%int_6 = OpConstant %int 6
|
||||
%int_8 = OpConstant %int 8
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Private_float = OpTypePointer Private %float
|
||||
%float_0 = OpConstant %float 0
|
||||
%int_3 = OpConstant %int 3
|
||||
%int_1 = OpConstant %int 1
|
||||
%float_1 = OpConstant %float 1
|
||||
%void = OpTypeVoid
|
||||
%110 = OpTypeFunction %void
|
||||
%136 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
|
||||
%137 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%140 = OpTypeFunction %void %main_out
|
||||
%func_i1_ = OpFunction %float None %23
|
||||
%a = OpFunctionParameter %_ptr_Function_int
|
||||
%27 = OpLabel
|
||||
%b = OpVariable %_ptr_Function_int Function %29
|
||||
%i = OpVariable %_ptr_Function_int Function %29
|
||||
%x_115 = OpVariable %_ptr_Function_bool Function %34
|
||||
%x_116_phi = OpVariable %_ptr_Function_bool Function %34
|
||||
OpStore %b %int_0
|
||||
%38 = OpAccessChain %_ptr_Private_int %data %int_0
|
||||
OpStore %38 %int_5
|
||||
%41 = OpAccessChain %_ptr_Private_int %data %int_2
|
||||
OpStore %41 %int_0
|
||||
%43 = OpAccessChain %_ptr_Private_int %data %int_4
|
||||
OpStore %43 %int_0
|
||||
%45 = OpAccessChain %_ptr_Private_int %data %int_6
|
||||
OpStore %45 %int_0
|
||||
%47 = OpAccessChain %_ptr_Private_int %data %int_8
|
||||
OpStore %47 %int_0
|
||||
%50 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0
|
||||
%51 = OpLoad %float %50
|
||||
%53 = OpFOrdGreaterThanEqual %bool %51 %float_0
|
||||
OpSelectionMerge %54 None
|
||||
OpBranchConditional %53 %55 %54
|
||||
%55 = OpLabel
|
||||
OpBranch %56
|
||||
%56 = OpLabel
|
||||
OpLoopMerge %57 %58 None
|
||||
OpBranch %59
|
||||
%59 = OpLabel
|
||||
%60 = OpLoad %int %b
|
||||
%62 = OpLoad %int %a
|
||||
%63 = OpSLessThanEqual %bool %60 %62
|
||||
OpSelectionMerge %64 None
|
||||
OpBranchConditional %63 %65 %66
|
||||
%65 = OpLabel
|
||||
OpBranch %64
|
||||
%66 = OpLabel
|
||||
OpBranch %57
|
||||
%64 = OpLabel
|
||||
%67 = OpLoad %int %b
|
||||
%68 = OpSLessThanEqual %bool %67 %int_5
|
||||
OpSelectionMerge %69 None
|
||||
OpBranchConditional %68 %70 %69
|
||||
%70 = OpLabel
|
||||
%71 = OpLoad %int %b
|
||||
%72 = OpLoad %int %b
|
||||
%73 = OpAccessChain %_ptr_Private_int %data %72
|
||||
%74 = OpLoad %int %73
|
||||
%75 = OpAccessChain %_ptr_Private_int %temp %71
|
||||
OpStore %75 %74
|
||||
%76 = OpLoad %int %b
|
||||
%77 = OpIAdd %int %76 %int_2
|
||||
OpStore %b %77
|
||||
OpBranch %69
|
||||
%69 = OpLabel
|
||||
OpBranch %58
|
||||
%58 = OpLabel
|
||||
OpBranch %56
|
||||
%57 = OpLabel
|
||||
OpBranch %54
|
||||
%54 = OpLabel
|
||||
OpStore %i %int_0
|
||||
OpBranch %78
|
||||
%78 = OpLabel
|
||||
OpLoopMerge %79 %80 None
|
||||
OpBranch %81
|
||||
%81 = OpLabel
|
||||
%82 = OpLoad %int %i
|
||||
%84 = OpSLessThan %bool %82 %int_3
|
||||
OpSelectionMerge %85 None
|
||||
OpBranchConditional %84 %86 %87
|
||||
%86 = OpLabel
|
||||
OpBranch %85
|
||||
%87 = OpLabel
|
||||
OpBranch %79
|
||||
%85 = OpLabel
|
||||
%88 = OpLoad %int %i
|
||||
%89 = OpAccessChain %_ptr_Private_int %temp %int_0
|
||||
%90 = OpLoad %int %89
|
||||
%91 = OpAccessChain %_ptr_Private_int %data %88
|
||||
%93 = OpIAdd %int %90 %int_1
|
||||
OpStore %91 %93
|
||||
OpBranch %80
|
||||
%80 = OpLabel
|
||||
%94 = OpLoad %int %i
|
||||
%95 = OpIAdd %int %94 %int_1
|
||||
OpStore %i %95
|
||||
OpBranch %78
|
||||
%79 = OpLabel
|
||||
%96 = OpAccessChain %_ptr_Private_int %temp %int_0
|
||||
%97 = OpLoad %int %96
|
||||
%98 = OpIEqual %bool %97 %int_5
|
||||
OpStore %x_116_phi %98
|
||||
OpSelectionMerge %99 None
|
||||
OpBranchConditional %98 %100 %99
|
||||
%100 = OpLabel
|
||||
%101 = OpAccessChain %_ptr_Private_int %data %int_0
|
||||
%102 = OpLoad %int %101
|
||||
%103 = OpIEqual %bool %102 %int_6
|
||||
OpStore %x_115 %103
|
||||
%104 = OpLoad %bool %x_115
|
||||
OpStore %x_116_phi %104
|
||||
OpBranch %99
|
||||
%99 = OpLabel
|
||||
%105 = OpLoad %bool %x_116_phi
|
||||
OpSelectionMerge %106 None
|
||||
OpBranchConditional %105 %107 %108
|
||||
%107 = OpLabel
|
||||
OpReturnValue %float_1
|
||||
%108 = OpLabel
|
||||
OpReturnValue %float_0
|
||||
%106 = OpLabel
|
||||
OpReturnValue %float_0
|
||||
OpFunctionEnd
|
||||
%main_1 = OpFunction %void None %110
|
||||
%113 = OpLabel
|
||||
%i_1 = OpVariable %_ptr_Function_int Function %29
|
||||
%param = OpVariable %_ptr_Function_int Function %29
|
||||
%param_1 = OpVariable %_ptr_Function_int Function %29
|
||||
OpStore %i_1 %int_0
|
||||
OpBranch %117
|
||||
%117 = OpLabel
|
||||
OpLoopMerge %118 %119 None
|
||||
OpBranch %120
|
||||
%120 = OpLabel
|
||||
%121 = OpLoad %int %i_1
|
||||
%122 = OpSLessThan %bool %121 %int_6
|
||||
OpSelectionMerge %123 None
|
||||
OpBranchConditional %122 %124 %125
|
||||
%124 = OpLabel
|
||||
OpBranch %123
|
||||
%125 = OpLabel
|
||||
OpBranch %118
|
||||
%123 = OpLabel
|
||||
%126 = OpLoad %int %i_1
|
||||
OpStore %param %126
|
||||
%127 = OpFunctionCall %float %func_i1_ %param
|
||||
%129 = OpLoad %int %i_1
|
||||
OpStore %param_1 %129
|
||||
%130 = OpFunctionCall %float %func_i1_ %param_1
|
||||
%132 = OpFOrdEqual %bool %130 %float_1
|
||||
OpSelectionMerge %133 None
|
||||
OpBranchConditional %132 %134 %135
|
||||
%134 = OpLabel
|
||||
OpStore %x_GLF_color %136
|
||||
OpBranch %133
|
||||
%135 = OpLabel
|
||||
OpStore %x_GLF_color %137
|
||||
OpBranch %133
|
||||
%133 = OpLabel
|
||||
OpBranch %119
|
||||
%119 = OpLabel
|
||||
%138 = OpLoad %int %i_1
|
||||
%139 = OpIAdd %int %138 %int_1
|
||||
OpStore %i_1 %139
|
||||
OpBranch %117
|
||||
%118 = OpLabel
|
||||
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 %110
|
||||
%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
|
||||
@@ -0,0 +1,114 @@
|
||||
var<private> data : array<i32, 9>;
|
||||
|
||||
var<private> gl_FragCoord : vec4<f32>;
|
||||
|
||||
var<private> temp : array<i32, 7>;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn func_i1_(a : ptr<function, i32>) -> f32 {
|
||||
var b : i32;
|
||||
var i : i32;
|
||||
var x_115 : bool;
|
||||
var x_116_phi : bool;
|
||||
b = 0;
|
||||
data[0] = 5;
|
||||
data[2] = 0;
|
||||
data[4] = 0;
|
||||
data[6] = 0;
|
||||
data[8] = 0;
|
||||
let x_71 : f32 = gl_FragCoord.x;
|
||||
if ((x_71 >= 0.0)) {
|
||||
loop {
|
||||
let x_79 : i32 = b;
|
||||
let x_80 : i32 = *(a);
|
||||
if ((x_79 <= x_80)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_83 : i32 = b;
|
||||
if ((x_83 <= 5)) {
|
||||
let x_87 : i32 = b;
|
||||
let x_88 : i32 = b;
|
||||
let x_90 : i32 = data[x_88];
|
||||
temp[x_87] = x_90;
|
||||
let x_92 : i32 = b;
|
||||
b = (x_92 + 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
i = 0;
|
||||
loop {
|
||||
let x_98 : i32 = i;
|
||||
if ((x_98 < 3)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_101 : i32 = i;
|
||||
let x_103 : i32 = temp[0];
|
||||
data[x_101] = (x_103 + 1);
|
||||
|
||||
continuing {
|
||||
let x_106 : i32 = i;
|
||||
i = (x_106 + 1);
|
||||
}
|
||||
}
|
||||
let x_109 : i32 = temp[0];
|
||||
let x_110 : bool = (x_109 == 5);
|
||||
x_116_phi = x_110;
|
||||
if (x_110) {
|
||||
let x_114 : i32 = data[0];
|
||||
x_115 = (x_114 == 6);
|
||||
x_116_phi = x_115;
|
||||
}
|
||||
let x_116 : bool = x_116_phi;
|
||||
if (x_116) {
|
||||
return 1.0;
|
||||
} else {
|
||||
return 0.0;
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
fn main_1() {
|
||||
var i_1 : i32;
|
||||
var param : i32;
|
||||
var param_1 : i32;
|
||||
i_1 = 0;
|
||||
loop {
|
||||
let x_51 : i32 = i_1;
|
||||
if ((x_51 < 6)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_54 : i32 = i_1;
|
||||
param = x_54;
|
||||
let x_55 : f32 = func_i1_(&(param));
|
||||
let x_56 : i32 = i_1;
|
||||
param_1 = x_56;
|
||||
let x_57 : f32 = func_i1_(&(param_1));
|
||||
if ((x_57 == 1.0)) {
|
||||
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
} else {
|
||||
x_GLF_color = vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
continuing {
|
||||
let x_62 : i32 = i_1;
|
||||
i_1 = (x_62 + 1);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user