mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-10 05:57:51 +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,148 @@
|
||||
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 %sums "sums"
|
||||
OpName %buf0 "buf0"
|
||||
OpMemberName %buf0 0 "_GLF_uniform_float_values"
|
||||
OpName %_ ""
|
||||
OpName %i "i"
|
||||
OpName %buf1 "buf1"
|
||||
OpMemberName %buf1 0 "_GLF_uniform_int_values"
|
||||
OpName %__0 ""
|
||||
OpName %indexable "indexable"
|
||||
OpName %_GLF_color "_GLF_color"
|
||||
OpDecorate %_arr_float_uint_2 ArrayStride 16
|
||||
OpMemberDecorate %buf0 0 Offset 0
|
||||
OpDecorate %buf0 Block
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %_arr_int_uint_3 ArrayStride 16
|
||||
OpMemberDecorate %buf1 0 Offset 0
|
||||
OpDecorate %buf1 Block
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 1
|
||||
OpDecorate %_GLF_color Location 0
|
||||
%void = OpTypeVoid
|
||||
%14 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_float_uint_3 = OpTypeArray %float %uint_3
|
||||
%_ptr_Function__arr_float_uint_3 = OpTypePointer Function %_arr_float_uint_3
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%buf0 = OpTypeStruct %_arr_float_uint_2
|
||||
%_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
|
||||
%_arr_int_uint_3 = OpTypeArray %int %uint_3
|
||||
%buf1 = OpTypeStruct %_arr_int_uint_3
|
||||
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
|
||||
%__0 = OpVariable %_ptr_Uniform_buf1 Uniform
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%int_2 = OpConstant %int 2
|
||||
%bool = OpTypeBool
|
||||
%v4float = OpTypeVector %float 4
|
||||
%mat2v4float = OpTypeMatrix %v4float 2
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_0 = OpConstant %float 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_GLF_color = OpVariable %_ptr_Output_v4float Output
|
||||
%main = OpFunction %void None %14
|
||||
%38 = OpLabel
|
||||
%sums = OpVariable %_ptr_Function__arr_float_uint_3 Function
|
||||
%i = OpVariable %_ptr_Function_int Function
|
||||
%indexable = OpVariable %_ptr_Function_mat2v4float Function
|
||||
%39 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0
|
||||
%40 = OpLoad %float %39
|
||||
%41 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0
|
||||
%42 = OpLoad %float %41
|
||||
%43 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0
|
||||
%44 = OpLoad %float %43
|
||||
%45 = OpCompositeConstruct %_arr_float_uint_3 %40 %42 %44
|
||||
OpStore %sums %45
|
||||
OpStore %i %int_0
|
||||
OpBranch %46
|
||||
%46 = OpLabel
|
||||
OpLoopMerge %47 %48 None
|
||||
OpBranch %49
|
||||
%49 = OpLabel
|
||||
%50 = OpLoad %int %i
|
||||
%51 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0
|
||||
%52 = OpLoad %int %51
|
||||
%53 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0
|
||||
%54 = OpLoad %int %53
|
||||
%55 = OpExtInst %int %1 SClamp %52 %54 %int_2
|
||||
%56 = OpSLessThan %bool %50 %55
|
||||
OpBranchConditional %56 %57 %47
|
||||
%57 = OpLabel
|
||||
%58 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2
|
||||
%59 = OpLoad %int %58
|
||||
%60 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0
|
||||
%61 = OpLoad %float %60
|
||||
%62 = OpCompositeConstruct %v4float %61 %float_0 %float_0 %float_0
|
||||
%63 = OpCompositeConstruct %v4float %float_0 %61 %float_0 %float_0
|
||||
%64 = OpCompositeConstruct %mat2v4float %62 %63
|
||||
%65 = OpLoad %int %i
|
||||
%66 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1
|
||||
%67 = OpLoad %int %66
|
||||
OpStore %indexable %64
|
||||
%68 = OpAccessChain %_ptr_Function_float %indexable %65 %67
|
||||
%69 = OpLoad %float %68
|
||||
%70 = OpAccessChain %_ptr_Function_float %sums %59
|
||||
%71 = OpLoad %float %70
|
||||
%72 = OpFAdd %float %71 %69
|
||||
%73 = OpAccessChain %_ptr_Function_float %sums %59
|
||||
OpStore %73 %72
|
||||
OpBranch %48
|
||||
%48 = OpLabel
|
||||
%74 = OpLoad %int %i
|
||||
%75 = OpIAdd %int %74 %int_1
|
||||
OpStore %i %75
|
||||
OpBranch %46
|
||||
%47 = OpLabel
|
||||
%76 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2
|
||||
%77 = OpLoad %int %76
|
||||
%78 = OpAccessChain %_ptr_Function_float %sums %77
|
||||
%79 = OpLoad %float %78
|
||||
%80 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1
|
||||
%81 = OpLoad %float %80
|
||||
%82 = OpFOrdEqual %bool %79 %81
|
||||
OpSelectionMerge %83 None
|
||||
OpBranchConditional %82 %84 %85
|
||||
%84 = OpLabel
|
||||
%86 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0
|
||||
%87 = OpLoad %int %86
|
||||
%88 = OpConvertSToF %float %87
|
||||
%89 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1
|
||||
%90 = OpLoad %int %89
|
||||
%91 = OpConvertSToF %float %90
|
||||
%92 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1
|
||||
%93 = OpLoad %int %92
|
||||
%94 = OpConvertSToF %float %93
|
||||
%95 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0
|
||||
%96 = OpLoad %int %95
|
||||
%97 = OpConvertSToF %float %96
|
||||
%98 = OpCompositeConstruct %v4float %88 %91 %94 %97
|
||||
OpStore %_GLF_color %98
|
||||
OpBranch %83
|
||||
%85 = OpLabel
|
||||
%99 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1
|
||||
%100 = OpLoad %int %99
|
||||
%101 = OpConvertSToF %float %100
|
||||
%102 = OpCompositeConstruct %v4float %101 %101 %101 %101
|
||||
OpStore %_GLF_color %102
|
||||
OpBranch %83
|
||||
%83 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,76 @@
|
||||
cbuffer cbuffer_x_6 : register(b0, space0) {
|
||||
uint4 x_6[2];
|
||||
};
|
||||
cbuffer cbuffer_x_9 : register(b1, space0) {
|
||||
uint4 x_9[3];
|
||||
};
|
||||
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
void main_1() {
|
||||
float sums[3] = (float[3])0;
|
||||
int i = 0;
|
||||
float2x4 indexable = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
const uint scalar_offset = ((16u * uint(0))) / 4;
|
||||
const float x_40 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]);
|
||||
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
|
||||
const float x_42 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]);
|
||||
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
|
||||
const float x_44 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]);
|
||||
const float tint_symbol_4[3] = {x_40, x_42, x_44};
|
||||
sums = tint_symbol_4;
|
||||
i = 0;
|
||||
while (true) {
|
||||
const int x_50 = i;
|
||||
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
|
||||
const int x_52 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]);
|
||||
const uint scalar_offset_4 = ((16u * uint(0))) / 4;
|
||||
const int x_54 = asint(x_9[scalar_offset_4 / 4][scalar_offset_4 % 4]);
|
||||
if ((x_50 < clamp(x_52, x_54, 2))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
const int x_59 = asint(x_9[2].x);
|
||||
const uint scalar_offset_5 = ((16u * uint(0))) / 4;
|
||||
const float x_61 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]);
|
||||
const int x_65 = i;
|
||||
const int x_67 = asint(x_9[1].x);
|
||||
indexable = float2x4(float4(x_61, 0.0f, 0.0f, 0.0f), float4(0.0f, x_61, 0.0f, 0.0f));
|
||||
const float x_69 = indexable[x_65][x_67];
|
||||
const float x_71 = sums[x_59];
|
||||
sums[x_59] = (x_71 + x_69);
|
||||
{
|
||||
i = (i + 1);
|
||||
}
|
||||
}
|
||||
const int x_77 = asint(x_9[2].x);
|
||||
const float x_79 = sums[x_77];
|
||||
const float x_81 = asfloat(x_6[1].x);
|
||||
if ((x_79 == x_81)) {
|
||||
const uint scalar_offset_6 = ((16u * uint(0))) / 4;
|
||||
const int x_87 = asint(x_9[scalar_offset_6 / 4][scalar_offset_6 % 4]);
|
||||
const int x_90 = asint(x_9[1].x);
|
||||
const int x_93 = asint(x_9[1].x);
|
||||
const uint scalar_offset_7 = ((16u * uint(0))) / 4;
|
||||
const int x_96 = asint(x_9[scalar_offset_7 / 4][scalar_offset_7 % 4]);
|
||||
x_GLF_color = float4(float(x_87), float(x_90), float(x_93), float(x_96));
|
||||
} else {
|
||||
const int x_100 = asint(x_9[1].x);
|
||||
const float x_101 = float(x_100);
|
||||
x_GLF_color = float4(x_101, x_101, x_101, x_101);
|
||||
}
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
#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 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[3];
|
||||
};
|
||||
struct buf1 {
|
||||
/* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values;
|
||||
};
|
||||
struct tint_array_wrapper_2 {
|
||||
float arr[3];
|
||||
};
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol_1 {
|
||||
float4 x_GLF_color_1 [[color(0)]];
|
||||
};
|
||||
|
||||
void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_5) {
|
||||
tint_array_wrapper_2 sums = {};
|
||||
int i = 0;
|
||||
float2x4 indexable = float2x4(0.0f);
|
||||
float const x_40 = x_6.x_GLF_uniform_float_values.arr[0].el;
|
||||
float const x_42 = x_6.x_GLF_uniform_float_values.arr[0].el;
|
||||
float const x_44 = x_6.x_GLF_uniform_float_values.arr[0].el;
|
||||
tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_40, x_42, x_44}};
|
||||
sums = tint_symbol_3;
|
||||
i = 0;
|
||||
while (true) {
|
||||
int const x_50 = i;
|
||||
int const x_52 = x_9.x_GLF_uniform_int_values.arr[0].el;
|
||||
int const x_54 = x_9.x_GLF_uniform_int_values.arr[0].el;
|
||||
if ((x_50 < clamp(x_52, x_54, 2))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
int const x_59 = x_9.x_GLF_uniform_int_values.arr[2].el;
|
||||
float const x_61 = x_6.x_GLF_uniform_float_values.arr[0].el;
|
||||
int const x_65 = i;
|
||||
int const x_67 = x_9.x_GLF_uniform_int_values.arr[1].el;
|
||||
indexable = float2x4(float4(x_61, 0.0f, 0.0f, 0.0f), float4(0.0f, x_61, 0.0f, 0.0f));
|
||||
float const x_69 = indexable[x_65][x_67];
|
||||
float const x_71 = sums.arr[x_59];
|
||||
sums.arr[x_59] = (x_71 + x_69);
|
||||
{
|
||||
int const x_74 = i;
|
||||
i = (x_74 + 1);
|
||||
}
|
||||
}
|
||||
int const x_77 = x_9.x_GLF_uniform_int_values.arr[2].el;
|
||||
float const x_79 = sums.arr[x_77];
|
||||
float const x_81 = x_6.x_GLF_uniform_float_values.arr[1].el;
|
||||
if ((x_79 == x_81)) {
|
||||
int const x_87 = x_9.x_GLF_uniform_int_values.arr[0].el;
|
||||
int const x_90 = x_9.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_93 = x_9.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_96 = x_9.x_GLF_uniform_int_values.arr[0].el;
|
||||
*(tint_symbol_5) = float4(float(x_87), float(x_90), float(x_93), float(x_96));
|
||||
} else {
|
||||
int const x_100 = x_9.x_GLF_uniform_int_values.arr[1].el;
|
||||
float const x_101 = float(x_100);
|
||||
*(tint_symbol_5) = float4(x_101, x_101, x_101, x_101);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) {
|
||||
thread float4 tint_symbol_6 = 0.0f;
|
||||
main_1(x_6, 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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 123
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%56 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %tint_symbol_1
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %buf0 "buf0"
|
||||
OpMemberName %buf0 0 "x_GLF_uniform_float_values"
|
||||
OpName %x_6 "x_6"
|
||||
OpName %buf1 "buf1"
|
||||
OpMemberName %buf1 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 %sums "sums"
|
||||
OpName %i "i"
|
||||
OpName %indexable "indexable"
|
||||
OpName %main_out "main_out"
|
||||
OpMemberName %main_out 0 "x_GLF_color_1"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %main "main"
|
||||
OpDecorate %buf0 Block
|
||||
OpMemberDecorate %buf0 0 Offset 0
|
||||
OpDecorate %_arr_float_uint_2 ArrayStride 16
|
||||
OpDecorate %x_6 NonWritable
|
||||
OpDecorate %x_6 DescriptorSet 0
|
||||
OpDecorate %x_6 Binding 0
|
||||
OpDecorate %buf1 Block
|
||||
OpMemberDecorate %buf1 0 Offset 0
|
||||
OpDecorate %_arr_int_uint_3 ArrayStride 16
|
||||
OpDecorate %x_9 NonWritable
|
||||
OpDecorate %x_9 DescriptorSet 0
|
||||
OpDecorate %x_9 Binding 1
|
||||
OpDecorate %tint_symbol_1 Location 0
|
||||
OpDecorate %_arr_float_uint_3 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
|
||||
%buf0 = OpTypeStruct %_arr_float_uint_2
|
||||
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
|
||||
%x_6 = OpVariable %_ptr_Uniform_buf0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_int_uint_3 = OpTypeArray %int %uint_3
|
||||
%buf1 = OpTypeStruct %_arr_int_uint_3
|
||||
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
|
||||
%x_9 = OpVariable %_ptr_Uniform_buf1 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
|
||||
%_arr_float_uint_3 = OpTypeArray %float %uint_3
|
||||
%_ptr_Function__arr_float_uint_3 = OpTypePointer Function %_arr_float_uint_3
|
||||
%27 = OpConstantNull %_arr_float_uint_3
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%30 = OpConstantNull %int
|
||||
%mat2v4float = OpTypeMatrix %v4float 2
|
||||
%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float
|
||||
%34 = OpConstantNull %mat2v4float
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%int_2 = OpConstant %int 2
|
||||
%bool = OpTypeBool
|
||||
%int_1 = OpConstant %int 1
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%111 = OpTypeFunction %void %main_out
|
||||
%main_1 = OpFunction %void None %20
|
||||
%23 = OpLabel
|
||||
%sums = OpVariable %_ptr_Function__arr_float_uint_3 Function %27
|
||||
%i = OpVariable %_ptr_Function_int Function %30
|
||||
%indexable = OpVariable %_ptr_Function_mat2v4float Function %34
|
||||
%38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0
|
||||
%39 = OpLoad %float %38
|
||||
%40 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0
|
||||
%41 = OpLoad %float %40
|
||||
%42 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0
|
||||
%43 = OpLoad %float %42
|
||||
%44 = OpCompositeConstruct %_arr_float_uint_3 %39 %41 %43
|
||||
OpStore %sums %44
|
||||
OpStore %i %int_0
|
||||
OpBranch %45
|
||||
%45 = OpLabel
|
||||
OpLoopMerge %46 %47 None
|
||||
OpBranch %48
|
||||
%48 = OpLabel
|
||||
%49 = OpLoad %int %i
|
||||
%51 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0
|
||||
%52 = OpLoad %int %51
|
||||
%53 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0
|
||||
%54 = OpLoad %int %53
|
||||
%55 = OpExtInst %int %56 SClamp %52 %54 %int_2
|
||||
%58 = OpSLessThan %bool %49 %55
|
||||
OpSelectionMerge %60 None
|
||||
OpBranchConditional %58 %61 %62
|
||||
%61 = OpLabel
|
||||
OpBranch %60
|
||||
%62 = OpLabel
|
||||
OpBranch %46
|
||||
%60 = OpLabel
|
||||
%63 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2
|
||||
%64 = OpLoad %int %63
|
||||
%65 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0
|
||||
%66 = OpLoad %float %65
|
||||
%67 = OpLoad %int %i
|
||||
%69 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1
|
||||
%70 = OpLoad %int %69
|
||||
%72 = OpCompositeConstruct %v4float %66 %float_0 %float_0 %float_0
|
||||
%73 = OpCompositeConstruct %v4float %float_0 %66 %float_0 %float_0
|
||||
%74 = OpCompositeConstruct %mat2v4float %72 %73
|
||||
OpStore %indexable %74
|
||||
%76 = OpAccessChain %_ptr_Function_float %indexable %67 %70
|
||||
%77 = OpLoad %float %76
|
||||
%78 = OpAccessChain %_ptr_Function_float %sums %64
|
||||
%79 = OpLoad %float %78
|
||||
%80 = OpAccessChain %_ptr_Function_float %sums %64
|
||||
%81 = OpFAdd %float %79 %77
|
||||
OpStore %80 %81
|
||||
OpBranch %47
|
||||
%47 = OpLabel
|
||||
%82 = OpLoad %int %i
|
||||
%83 = OpIAdd %int %82 %int_1
|
||||
OpStore %i %83
|
||||
OpBranch %45
|
||||
%46 = OpLabel
|
||||
%84 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2
|
||||
%85 = OpLoad %int %84
|
||||
%86 = OpAccessChain %_ptr_Function_float %sums %85
|
||||
%87 = OpLoad %float %86
|
||||
%88 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1
|
||||
%89 = OpLoad %float %88
|
||||
%90 = OpFOrdEqual %bool %87 %89
|
||||
OpSelectionMerge %91 None
|
||||
OpBranchConditional %90 %92 %93
|
||||
%92 = OpLabel
|
||||
%94 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0
|
||||
%95 = OpLoad %int %94
|
||||
%96 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1
|
||||
%97 = OpLoad %int %96
|
||||
%98 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1
|
||||
%99 = OpLoad %int %98
|
||||
%100 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0
|
||||
%101 = OpLoad %int %100
|
||||
%102 = OpConvertSToF %float %95
|
||||
%103 = OpConvertSToF %float %97
|
||||
%104 = OpConvertSToF %float %99
|
||||
%105 = OpConvertSToF %float %101
|
||||
%106 = OpCompositeConstruct %v4float %102 %103 %104 %105
|
||||
OpStore %x_GLF_color %106
|
||||
OpBranch %91
|
||||
%93 = OpLabel
|
||||
%107 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1
|
||||
%108 = OpLoad %int %107
|
||||
%109 = OpConvertSToF %float %108
|
||||
%110 = OpCompositeConstruct %v4float %109 %109 %109 %109
|
||||
OpStore %x_GLF_color %110
|
||||
OpBranch %91
|
||||
%91 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %111
|
||||
%tint_symbol = OpFunctionParameter %main_out
|
||||
%115 = OpLabel
|
||||
%116 = OpCompositeExtract %v4float %tint_symbol 0
|
||||
OpStore %tint_symbol_1 %116
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %20
|
||||
%118 = OpLabel
|
||||
%119 = OpFunctionCall %void %main_1
|
||||
%121 = OpLoad %v4float %x_GLF_color
|
||||
%122 = OpCompositeConstruct %main_out %121
|
||||
%120 = OpFunctionCall %void %tint_symbol_2 %122
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,78 @@
|
||||
type Arr = [[stride(16)]] array<f32, 2>;
|
||||
|
||||
[[block]]
|
||||
struct buf0 {
|
||||
x_GLF_uniform_float_values : Arr;
|
||||
};
|
||||
|
||||
type Arr_1 = [[stride(16)]] array<i32, 3>;
|
||||
|
||||
[[block]]
|
||||
struct buf1 {
|
||||
x_GLF_uniform_int_values : Arr_1;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]] var<uniform> x_6 : buf0;
|
||||
|
||||
[[group(0), binding(1)]] var<uniform> x_9 : buf1;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var sums : array<f32, 3>;
|
||||
var i : i32;
|
||||
var indexable : mat2x4<f32>;
|
||||
let x_40 : f32 = x_6.x_GLF_uniform_float_values[0];
|
||||
let x_42 : f32 = x_6.x_GLF_uniform_float_values[0];
|
||||
let x_44 : f32 = x_6.x_GLF_uniform_float_values[0];
|
||||
sums = array<f32, 3>(x_40, x_42, x_44);
|
||||
i = 0;
|
||||
loop {
|
||||
let x_50 : i32 = i;
|
||||
let x_52 : i32 = x_9.x_GLF_uniform_int_values[0];
|
||||
let x_54 : i32 = x_9.x_GLF_uniform_int_values[0];
|
||||
if ((x_50 < clamp(x_52, x_54, 2))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_59 : i32 = x_9.x_GLF_uniform_int_values[2];
|
||||
let x_61 : f32 = x_6.x_GLF_uniform_float_values[0];
|
||||
let x_65 : i32 = i;
|
||||
let x_67 : i32 = x_9.x_GLF_uniform_int_values[1];
|
||||
indexable = mat2x4<f32>(vec4<f32>(x_61, 0.0, 0.0, 0.0), vec4<f32>(0.0, x_61, 0.0, 0.0));
|
||||
let x_69 : f32 = indexable[x_65][x_67];
|
||||
let x_71 : f32 = sums[x_59];
|
||||
sums[x_59] = (x_71 + x_69);
|
||||
|
||||
continuing {
|
||||
let x_74 : i32 = i;
|
||||
i = (x_74 + 1);
|
||||
}
|
||||
}
|
||||
let x_77 : i32 = x_9.x_GLF_uniform_int_values[2];
|
||||
let x_79 : f32 = sums[x_77];
|
||||
let x_81 : f32 = x_6.x_GLF_uniform_float_values[1];
|
||||
if ((x_79 == x_81)) {
|
||||
let x_87 : i32 = x_9.x_GLF_uniform_int_values[0];
|
||||
let x_90 : i32 = x_9.x_GLF_uniform_int_values[1];
|
||||
let x_93 : i32 = x_9.x_GLF_uniform_int_values[1];
|
||||
let x_96 : i32 = x_9.x_GLF_uniform_int_values[0];
|
||||
x_GLF_color = vec4<f32>(f32(x_87), f32(x_90), f32(x_93), f32(x_96));
|
||||
} else {
|
||||
let x_100 : i32 = x_9.x_GLF_uniform_int_values[1];
|
||||
let x_101 : f32 = f32(x_100);
|
||||
x_GLF_color = vec4<f32>(x_101, x_101, x_101, x_101);
|
||||
}
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
type Arr = [[stride(16)]] array<f32, 2>;
|
||||
|
||||
[[block]]
|
||||
struct buf0 {
|
||||
x_GLF_uniform_float_values : Arr;
|
||||
};
|
||||
|
||||
type Arr_1 = [[stride(16)]] array<i32, 3>;
|
||||
|
||||
[[block]]
|
||||
struct buf1 {
|
||||
x_GLF_uniform_int_values : Arr_1;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]] var<uniform> x_6 : buf0;
|
||||
|
||||
[[group(0), binding(1)]] var<uniform> x_9 : buf1;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var sums : array<f32, 3>;
|
||||
var i : i32;
|
||||
var indexable : mat2x4<f32>;
|
||||
let x_40 : f32 = x_6.x_GLF_uniform_float_values[0];
|
||||
let x_42 : f32 = x_6.x_GLF_uniform_float_values[0];
|
||||
let x_44 : f32 = x_6.x_GLF_uniform_float_values[0];
|
||||
sums = array<f32, 3>(x_40, x_42, x_44);
|
||||
i = 0;
|
||||
loop {
|
||||
let x_50 : i32 = i;
|
||||
let x_52 : i32 = x_9.x_GLF_uniform_int_values[0];
|
||||
let x_54 : i32 = x_9.x_GLF_uniform_int_values[0];
|
||||
if ((x_50 < clamp(x_52, x_54, 2))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_59 : i32 = x_9.x_GLF_uniform_int_values[2];
|
||||
let x_61 : f32 = x_6.x_GLF_uniform_float_values[0];
|
||||
let x_65 : i32 = i;
|
||||
let x_67 : i32 = x_9.x_GLF_uniform_int_values[1];
|
||||
indexable = mat2x4<f32>(vec4<f32>(x_61, 0.0, 0.0, 0.0), vec4<f32>(0.0, x_61, 0.0, 0.0));
|
||||
let x_69 : f32 = indexable[x_65][x_67];
|
||||
let x_71 : f32 = sums[x_59];
|
||||
sums[x_59] = (x_71 + x_69);
|
||||
|
||||
continuing {
|
||||
let x_74 : i32 = i;
|
||||
i = (x_74 + 1);
|
||||
}
|
||||
}
|
||||
let x_77 : i32 = x_9.x_GLF_uniform_int_values[2];
|
||||
let x_79 : f32 = sums[x_77];
|
||||
let x_81 : f32 = x_6.x_GLF_uniform_float_values[1];
|
||||
if ((x_79 == x_81)) {
|
||||
let x_87 : i32 = x_9.x_GLF_uniform_int_values[0];
|
||||
let x_90 : i32 = x_9.x_GLF_uniform_int_values[1];
|
||||
let x_93 : i32 = x_9.x_GLF_uniform_int_values[1];
|
||||
let x_96 : i32 = x_9.x_GLF_uniform_int_values[0];
|
||||
x_GLF_color = vec4<f32>(f32(x_87), f32(x_90), f32(x_93), f32(x_96));
|
||||
} else {
|
||||
let x_100 : i32 = x_9.x_GLF_uniform_int_values[1];
|
||||
let x_101 : f32 = f32(x_100);
|
||||
x_GLF_color = vec4<f32>(x_101, x_101, x_101, x_101);
|
||||
}
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
cbuffer cbuffer_x_6 : register(b0, space0) {
|
||||
uint4 x_6[2];
|
||||
};
|
||||
cbuffer cbuffer_x_9 : register(b1, space0) {
|
||||
uint4 x_9[3];
|
||||
};
|
||||
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
void main_1() {
|
||||
float sums[3] = (float[3])0;
|
||||
int i = 0;
|
||||
float2x4 indexable = float2x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
const uint scalar_offset = ((16u * uint(0))) / 4;
|
||||
const float x_40 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]);
|
||||
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
|
||||
const float x_42 = asfloat(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]);
|
||||
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
|
||||
const float x_44 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]);
|
||||
const float tint_symbol_4[3] = {x_40, x_42, x_44};
|
||||
sums = tint_symbol_4;
|
||||
i = 0;
|
||||
while (true) {
|
||||
const int x_50 = i;
|
||||
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
|
||||
const int x_52 = asint(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]);
|
||||
const uint scalar_offset_4 = ((16u * uint(0))) / 4;
|
||||
const int x_54 = asint(x_9[scalar_offset_4 / 4][scalar_offset_4 % 4]);
|
||||
if ((x_50 < clamp(x_52, x_54, 2))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
const int x_59 = asint(x_9[2].x);
|
||||
const uint scalar_offset_5 = ((16u * uint(0))) / 4;
|
||||
const float x_61 = asfloat(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]);
|
||||
const int x_65 = i;
|
||||
const int x_67 = asint(x_9[1].x);
|
||||
indexable = float2x4(float4(x_61, 0.0f, 0.0f, 0.0f), float4(0.0f, x_61, 0.0f, 0.0f));
|
||||
const float x_69 = indexable[x_65][x_67];
|
||||
const float x_71 = sums[x_59];
|
||||
sums[x_59] = (x_71 + x_69);
|
||||
{
|
||||
i = (i + 1);
|
||||
}
|
||||
}
|
||||
const int x_77 = asint(x_9[2].x);
|
||||
const float x_79 = sums[x_77];
|
||||
const float x_81 = asfloat(x_6[1].x);
|
||||
if ((x_79 == x_81)) {
|
||||
const uint scalar_offset_6 = ((16u * uint(0))) / 4;
|
||||
const int x_87 = asint(x_9[scalar_offset_6 / 4][scalar_offset_6 % 4]);
|
||||
const int x_90 = asint(x_9[1].x);
|
||||
const int x_93 = asint(x_9[1].x);
|
||||
const uint scalar_offset_7 = ((16u * uint(0))) / 4;
|
||||
const int x_96 = asint(x_9[scalar_offset_7 / 4][scalar_offset_7 % 4]);
|
||||
x_GLF_color = float4(float(x_87), float(x_90), float(x_93), float(x_96));
|
||||
} else {
|
||||
const int x_100 = asint(x_9[1].x);
|
||||
const float x_101 = float(x_100);
|
||||
x_GLF_color = float4(x_101, x_101, x_101, x_101);
|
||||
}
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
#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 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[3];
|
||||
};
|
||||
struct buf1 {
|
||||
/* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_int_values;
|
||||
};
|
||||
struct tint_array_wrapper_2 {
|
||||
float arr[3];
|
||||
};
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol_1 {
|
||||
float4 x_GLF_color_1 [[color(0)]];
|
||||
};
|
||||
|
||||
void main_1(constant buf0& x_6, constant buf1& x_9, thread float4* const tint_symbol_5) {
|
||||
tint_array_wrapper_2 sums = {};
|
||||
int i = 0;
|
||||
float2x4 indexable = float2x4(0.0f);
|
||||
float const x_40 = x_6.x_GLF_uniform_float_values.arr[0].el;
|
||||
float const x_42 = x_6.x_GLF_uniform_float_values.arr[0].el;
|
||||
float const x_44 = x_6.x_GLF_uniform_float_values.arr[0].el;
|
||||
tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_40, x_42, x_44}};
|
||||
sums = tint_symbol_3;
|
||||
i = 0;
|
||||
while (true) {
|
||||
int const x_50 = i;
|
||||
int const x_52 = x_9.x_GLF_uniform_int_values.arr[0].el;
|
||||
int const x_54 = x_9.x_GLF_uniform_int_values.arr[0].el;
|
||||
if ((x_50 < clamp(x_52, x_54, 2))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
int const x_59 = x_9.x_GLF_uniform_int_values.arr[2].el;
|
||||
float const x_61 = x_6.x_GLF_uniform_float_values.arr[0].el;
|
||||
int const x_65 = i;
|
||||
int const x_67 = x_9.x_GLF_uniform_int_values.arr[1].el;
|
||||
indexable = float2x4(float4(x_61, 0.0f, 0.0f, 0.0f), float4(0.0f, x_61, 0.0f, 0.0f));
|
||||
float const x_69 = indexable[x_65][x_67];
|
||||
float const x_71 = sums.arr[x_59];
|
||||
sums.arr[x_59] = (x_71 + x_69);
|
||||
{
|
||||
int const x_74 = i;
|
||||
i = (x_74 + 1);
|
||||
}
|
||||
}
|
||||
int const x_77 = x_9.x_GLF_uniform_int_values.arr[2].el;
|
||||
float const x_79 = sums.arr[x_77];
|
||||
float const x_81 = x_6.x_GLF_uniform_float_values.arr[1].el;
|
||||
if ((x_79 == x_81)) {
|
||||
int const x_87 = x_9.x_GLF_uniform_int_values.arr[0].el;
|
||||
int const x_90 = x_9.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_93 = x_9.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_96 = x_9.x_GLF_uniform_int_values.arr[0].el;
|
||||
*(tint_symbol_5) = float4(float(x_87), float(x_90), float(x_93), float(x_96));
|
||||
} else {
|
||||
int const x_100 = x_9.x_GLF_uniform_int_values.arr[1].el;
|
||||
float const x_101 = float(x_100);
|
||||
*(tint_symbol_5) = float4(x_101, x_101, x_101, x_101);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
fragment tint_symbol_1 tint_symbol(constant buf0& x_6 [[buffer(0)]], constant buf1& x_9 [[buffer(1)]]) {
|
||||
thread float4 tint_symbol_6 = 0.0f;
|
||||
main_1(x_6, 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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 123
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%56 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %tint_symbol_1
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %buf0 "buf0"
|
||||
OpMemberName %buf0 0 "x_GLF_uniform_float_values"
|
||||
OpName %x_6 "x_6"
|
||||
OpName %buf1 "buf1"
|
||||
OpMemberName %buf1 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 %sums "sums"
|
||||
OpName %i "i"
|
||||
OpName %indexable "indexable"
|
||||
OpName %main_out "main_out"
|
||||
OpMemberName %main_out 0 "x_GLF_color_1"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %main "main"
|
||||
OpDecorate %buf0 Block
|
||||
OpMemberDecorate %buf0 0 Offset 0
|
||||
OpDecorate %_arr_float_uint_2 ArrayStride 16
|
||||
OpDecorate %x_6 NonWritable
|
||||
OpDecorate %x_6 DescriptorSet 0
|
||||
OpDecorate %x_6 Binding 0
|
||||
OpDecorate %buf1 Block
|
||||
OpMemberDecorate %buf1 0 Offset 0
|
||||
OpDecorate %_arr_int_uint_3 ArrayStride 16
|
||||
OpDecorate %x_9 NonWritable
|
||||
OpDecorate %x_9 DescriptorSet 0
|
||||
OpDecorate %x_9 Binding 1
|
||||
OpDecorate %tint_symbol_1 Location 0
|
||||
OpDecorate %_arr_float_uint_3 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
|
||||
%buf0 = OpTypeStruct %_arr_float_uint_2
|
||||
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
|
||||
%x_6 = OpVariable %_ptr_Uniform_buf0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%uint_3 = OpConstant %uint 3
|
||||
%_arr_int_uint_3 = OpTypeArray %int %uint_3
|
||||
%buf1 = OpTypeStruct %_arr_int_uint_3
|
||||
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
|
||||
%x_9 = OpVariable %_ptr_Uniform_buf1 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
|
||||
%_arr_float_uint_3 = OpTypeArray %float %uint_3
|
||||
%_ptr_Function__arr_float_uint_3 = OpTypePointer Function %_arr_float_uint_3
|
||||
%27 = OpConstantNull %_arr_float_uint_3
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%30 = OpConstantNull %int
|
||||
%mat2v4float = OpTypeMatrix %v4float 2
|
||||
%_ptr_Function_mat2v4float = OpTypePointer Function %mat2v4float
|
||||
%34 = OpConstantNull %mat2v4float
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%int_2 = OpConstant %int 2
|
||||
%bool = OpTypeBool
|
||||
%int_1 = OpConstant %int 1
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%111 = OpTypeFunction %void %main_out
|
||||
%main_1 = OpFunction %void None %20
|
||||
%23 = OpLabel
|
||||
%sums = OpVariable %_ptr_Function__arr_float_uint_3 Function %27
|
||||
%i = OpVariable %_ptr_Function_int Function %30
|
||||
%indexable = OpVariable %_ptr_Function_mat2v4float Function %34
|
||||
%38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0
|
||||
%39 = OpLoad %float %38
|
||||
%40 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0
|
||||
%41 = OpLoad %float %40
|
||||
%42 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0
|
||||
%43 = OpLoad %float %42
|
||||
%44 = OpCompositeConstruct %_arr_float_uint_3 %39 %41 %43
|
||||
OpStore %sums %44
|
||||
OpStore %i %int_0
|
||||
OpBranch %45
|
||||
%45 = OpLabel
|
||||
OpLoopMerge %46 %47 None
|
||||
OpBranch %48
|
||||
%48 = OpLabel
|
||||
%49 = OpLoad %int %i
|
||||
%51 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0
|
||||
%52 = OpLoad %int %51
|
||||
%53 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0
|
||||
%54 = OpLoad %int %53
|
||||
%55 = OpExtInst %int %56 SClamp %52 %54 %int_2
|
||||
%58 = OpSLessThan %bool %49 %55
|
||||
OpSelectionMerge %60 None
|
||||
OpBranchConditional %58 %61 %62
|
||||
%61 = OpLabel
|
||||
OpBranch %60
|
||||
%62 = OpLabel
|
||||
OpBranch %46
|
||||
%60 = OpLabel
|
||||
%63 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2
|
||||
%64 = OpLoad %int %63
|
||||
%65 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0
|
||||
%66 = OpLoad %float %65
|
||||
%67 = OpLoad %int %i
|
||||
%69 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1
|
||||
%70 = OpLoad %int %69
|
||||
%72 = OpCompositeConstruct %v4float %66 %float_0 %float_0 %float_0
|
||||
%73 = OpCompositeConstruct %v4float %float_0 %66 %float_0 %float_0
|
||||
%74 = OpCompositeConstruct %mat2v4float %72 %73
|
||||
OpStore %indexable %74
|
||||
%76 = OpAccessChain %_ptr_Function_float %indexable %67 %70
|
||||
%77 = OpLoad %float %76
|
||||
%78 = OpAccessChain %_ptr_Function_float %sums %64
|
||||
%79 = OpLoad %float %78
|
||||
%80 = OpAccessChain %_ptr_Function_float %sums %64
|
||||
%81 = OpFAdd %float %79 %77
|
||||
OpStore %80 %81
|
||||
OpBranch %47
|
||||
%47 = OpLabel
|
||||
%82 = OpLoad %int %i
|
||||
%83 = OpIAdd %int %82 %int_1
|
||||
OpStore %i %83
|
||||
OpBranch %45
|
||||
%46 = OpLabel
|
||||
%84 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_2
|
||||
%85 = OpLoad %int %84
|
||||
%86 = OpAccessChain %_ptr_Function_float %sums %85
|
||||
%87 = OpLoad %float %86
|
||||
%88 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1
|
||||
%89 = OpLoad %float %88
|
||||
%90 = OpFOrdEqual %bool %87 %89
|
||||
OpSelectionMerge %91 None
|
||||
OpBranchConditional %90 %92 %93
|
||||
%92 = OpLabel
|
||||
%94 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0
|
||||
%95 = OpLoad %int %94
|
||||
%96 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1
|
||||
%97 = OpLoad %int %96
|
||||
%98 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1
|
||||
%99 = OpLoad %int %98
|
||||
%100 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_0
|
||||
%101 = OpLoad %int %100
|
||||
%102 = OpConvertSToF %float %95
|
||||
%103 = OpConvertSToF %float %97
|
||||
%104 = OpConvertSToF %float %99
|
||||
%105 = OpConvertSToF %float %101
|
||||
%106 = OpCompositeConstruct %v4float %102 %103 %104 %105
|
||||
OpStore %x_GLF_color %106
|
||||
OpBranch %91
|
||||
%93 = OpLabel
|
||||
%107 = OpAccessChain %_ptr_Uniform_int %x_9 %uint_0 %int_1
|
||||
%108 = OpLoad %int %107
|
||||
%109 = OpConvertSToF %float %108
|
||||
%110 = OpCompositeConstruct %v4float %109 %109 %109 %109
|
||||
OpStore %x_GLF_color %110
|
||||
OpBranch %91
|
||||
%91 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %111
|
||||
%tint_symbol = OpFunctionParameter %main_out
|
||||
%115 = OpLabel
|
||||
%116 = OpCompositeExtract %v4float %tint_symbol 0
|
||||
OpStore %tint_symbol_1 %116
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %20
|
||||
%118 = OpLabel
|
||||
%119 = OpFunctionCall %void %main_1
|
||||
%121 = OpLoad %v4float %x_GLF_color
|
||||
%122 = OpCompositeConstruct %main_out %121
|
||||
%120 = OpFunctionCall %void %tint_symbol_2 %122
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,78 @@
|
||||
type Arr = [[stride(16)]] array<f32, 2>;
|
||||
|
||||
[[block]]
|
||||
struct buf0 {
|
||||
x_GLF_uniform_float_values : Arr;
|
||||
};
|
||||
|
||||
type Arr_1 = [[stride(16)]] array<i32, 3>;
|
||||
|
||||
[[block]]
|
||||
struct buf1 {
|
||||
x_GLF_uniform_int_values : Arr_1;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]] var<uniform> x_6 : buf0;
|
||||
|
||||
[[group(0), binding(1)]] var<uniform> x_9 : buf1;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var sums : array<f32, 3>;
|
||||
var i : i32;
|
||||
var indexable : mat2x4<f32>;
|
||||
let x_40 : f32 = x_6.x_GLF_uniform_float_values[0];
|
||||
let x_42 : f32 = x_6.x_GLF_uniform_float_values[0];
|
||||
let x_44 : f32 = x_6.x_GLF_uniform_float_values[0];
|
||||
sums = array<f32, 3>(x_40, x_42, x_44);
|
||||
i = 0;
|
||||
loop {
|
||||
let x_50 : i32 = i;
|
||||
let x_52 : i32 = x_9.x_GLF_uniform_int_values[0];
|
||||
let x_54 : i32 = x_9.x_GLF_uniform_int_values[0];
|
||||
if ((x_50 < clamp(x_52, x_54, 2))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_59 : i32 = x_9.x_GLF_uniform_int_values[2];
|
||||
let x_61 : f32 = x_6.x_GLF_uniform_float_values[0];
|
||||
let x_65 : i32 = i;
|
||||
let x_67 : i32 = x_9.x_GLF_uniform_int_values[1];
|
||||
indexable = mat2x4<f32>(vec4<f32>(x_61, 0.0, 0.0, 0.0), vec4<f32>(0.0, x_61, 0.0, 0.0));
|
||||
let x_69 : f32 = indexable[x_65][x_67];
|
||||
let x_71 : f32 = sums[x_59];
|
||||
sums[x_59] = (x_71 + x_69);
|
||||
|
||||
continuing {
|
||||
let x_74 : i32 = i;
|
||||
i = (x_74 + 1);
|
||||
}
|
||||
}
|
||||
let x_77 : i32 = x_9.x_GLF_uniform_int_values[2];
|
||||
let x_79 : f32 = sums[x_77];
|
||||
let x_81 : f32 = x_6.x_GLF_uniform_float_values[1];
|
||||
if ((x_79 == x_81)) {
|
||||
let x_87 : i32 = x_9.x_GLF_uniform_int_values[0];
|
||||
let x_90 : i32 = x_9.x_GLF_uniform_int_values[1];
|
||||
let x_93 : i32 = x_9.x_GLF_uniform_int_values[1];
|
||||
let x_96 : i32 = x_9.x_GLF_uniform_int_values[0];
|
||||
x_GLF_color = vec4<f32>(f32(x_87), f32(x_90), f32(x_93), f32(x_96));
|
||||
} else {
|
||||
let x_100 : i32 = x_9.x_GLF_uniform_int_values[1];
|
||||
let x_101 : f32 = f32(x_100);
|
||||
x_GLF_color = vec4<f32>(x_101, x_101, x_101, x_101);
|
||||
}
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user