mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 18:29:23 +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,173 @@
|
||||
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 %buf0 "buf0"
|
||||
OpMemberName %buf0 0 "_GLF_uniform_int_values"
|
||||
OpName %_ ""
|
||||
OpName %m "m"
|
||||
OpName %f "f"
|
||||
OpName %i "i"
|
||||
OpName %j "j"
|
||||
OpName %_GLF_color "_GLF_color"
|
||||
OpDecorate %_arr_int_uint_4 ArrayStride 16
|
||||
OpMemberDecorate %buf0 0 Offset 0
|
||||
OpDecorate %buf0 Block
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %_GLF_color Location 0
|
||||
%void = OpTypeVoid
|
||||
%12 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_int_uint_4 = OpTypeArray %int %uint_4
|
||||
%buf0 = OpTypeStruct %_arr_int_uint_4
|
||||
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
|
||||
%_ = OpVariable %_ptr_Uniform_buf0 Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%bool = OpTypeBool
|
||||
%float = OpTypeFloat 32
|
||||
%v2float = OpTypeVector %float 2
|
||||
%mat2v2float = OpTypeMatrix %v2float 2
|
||||
%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%v2bool = OpTypeVector %bool 2
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_GLF_color = OpVariable %_ptr_Output_v4float Output
|
||||
%main = OpFunction %void None %12
|
||||
%34 = OpLabel
|
||||
%m = OpVariable %_ptr_Function_mat2v2float Function
|
||||
%f = OpVariable %_ptr_Function_float Function
|
||||
%i = OpVariable %_ptr_Function_int Function
|
||||
%j = OpVariable %_ptr_Function_int Function
|
||||
%35 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
|
||||
%36 = OpLoad %int %35
|
||||
%37 = OpIEqual %bool %36 %int_1
|
||||
OpSelectionMerge %38 None
|
||||
OpBranchConditional %37 %39 %38
|
||||
%39 = OpLabel
|
||||
%40 = OpLoad %float %f
|
||||
%41 = OpCompositeConstruct %v2float %40 %float_0
|
||||
%42 = OpCompositeConstruct %v2float %float_0 %40
|
||||
%43 = OpCompositeConstruct %mat2v2float %41 %42
|
||||
OpStore %m %43
|
||||
OpBranch %38
|
||||
%38 = OpLabel
|
||||
%44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
|
||||
%45 = OpLoad %int %44
|
||||
OpStore %i %45
|
||||
OpBranch %46
|
||||
%46 = OpLabel
|
||||
OpLoopMerge %47 %48 None
|
||||
OpBranch %49
|
||||
%49 = OpLabel
|
||||
%50 = OpLoad %int %i
|
||||
%51 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
|
||||
%52 = OpLoad %int %51
|
||||
%53 = OpSLessThan %bool %50 %52
|
||||
OpBranchConditional %53 %54 %47
|
||||
%54 = OpLabel
|
||||
%55 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
|
||||
%56 = OpLoad %int %55
|
||||
OpStore %j %56
|
||||
OpBranch %57
|
||||
%57 = OpLabel
|
||||
OpLoopMerge %58 %59 None
|
||||
OpBranch %60
|
||||
%60 = OpLabel
|
||||
%61 = OpLoad %int %j
|
||||
%62 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
|
||||
%63 = OpLoad %int %62
|
||||
%64 = OpSLessThan %bool %61 %63
|
||||
OpBranchConditional %64 %65 %58
|
||||
%65 = OpLabel
|
||||
%66 = OpLoad %int %i
|
||||
%67 = OpLoad %int %j
|
||||
%68 = OpLoad %int %i
|
||||
%69 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
|
||||
%70 = OpLoad %int %69
|
||||
%71 = OpIMul %int %68 %70
|
||||
%72 = OpLoad %int %j
|
||||
%73 = OpIAdd %int %71 %72
|
||||
%74 = OpConvertSToF %float %73
|
||||
%75 = OpAccessChain %_ptr_Function_float %m %66 %67
|
||||
OpStore %75 %74
|
||||
OpBranch %59
|
||||
%59 = OpLabel
|
||||
%76 = OpLoad %int %j
|
||||
%77 = OpIAdd %int %76 %int_1
|
||||
OpStore %j %77
|
||||
OpBranch %57
|
||||
%58 = OpLabel
|
||||
OpBranch %48
|
||||
%48 = OpLabel
|
||||
%78 = OpLoad %int %i
|
||||
%79 = OpIAdd %int %78 %int_1
|
||||
OpStore %i %79
|
||||
OpBranch %46
|
||||
%47 = OpLabel
|
||||
%80 = OpLoad %mat2v2float %m
|
||||
%81 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
|
||||
%82 = OpLoad %int %81
|
||||
%83 = OpConvertSToF %float %82
|
||||
%84 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2
|
||||
%85 = OpLoad %int %84
|
||||
%86 = OpConvertSToF %float %85
|
||||
%87 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
|
||||
%88 = OpLoad %int %87
|
||||
%89 = OpConvertSToF %float %88
|
||||
%90 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3
|
||||
%91 = OpLoad %int %90
|
||||
%92 = OpConvertSToF %float %91
|
||||
%93 = OpCompositeConstruct %v2float %83 %86
|
||||
%94 = OpCompositeConstruct %v2float %89 %92
|
||||
%95 = OpCompositeConstruct %mat2v2float %93 %94
|
||||
%96 = OpCompositeExtract %v2float %80 0
|
||||
%97 = OpCompositeExtract %v2float %95 0
|
||||
%98 = OpFOrdEqual %v2bool %96 %97
|
||||
%99 = OpAll %bool %98
|
||||
%100 = OpCompositeExtract %v2float %80 1
|
||||
%101 = OpCompositeExtract %v2float %95 1
|
||||
%102 = OpFOrdEqual %v2bool %100 %101
|
||||
%103 = OpAll %bool %102
|
||||
%104 = OpLogicalAnd %bool %99 %103
|
||||
OpSelectionMerge %105 None
|
||||
OpBranchConditional %104 %106 %107
|
||||
%106 = OpLabel
|
||||
%108 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2
|
||||
%109 = OpLoad %int %108
|
||||
%110 = OpConvertSToF %float %109
|
||||
%111 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
|
||||
%112 = OpLoad %int %111
|
||||
%113 = OpConvertSToF %float %112
|
||||
%114 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
|
||||
%115 = OpLoad %int %114
|
||||
%116 = OpConvertSToF %float %115
|
||||
%117 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2
|
||||
%118 = OpLoad %int %117
|
||||
%119 = OpConvertSToF %float %118
|
||||
%120 = OpCompositeConstruct %v4float %110 %113 %116 %119
|
||||
OpStore %_GLF_color %120
|
||||
OpBranch %105
|
||||
%107 = OpLabel
|
||||
%121 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
|
||||
%122 = OpLoad %int %121
|
||||
%123 = OpConvertSToF %float %122
|
||||
%124 = OpCompositeConstruct %v4float %123 %123 %123 %123
|
||||
OpStore %_GLF_color %124
|
||||
OpBranch %105
|
||||
%105 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,91 @@
|
||||
void set_float2(inout float2 vec, int idx, float val) {
|
||||
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
|
||||
}
|
||||
|
||||
cbuffer cbuffer_x_5 : register(b0, space0) {
|
||||
uint4 x_5[4];
|
||||
};
|
||||
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
void main_1() {
|
||||
float2x2 m = float2x2(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
float f = 0.0f;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
const int x_36 = asint(x_5[1].x);
|
||||
if ((x_36 == 1)) {
|
||||
const float x_40 = f;
|
||||
m = float2x2(float2(x_40, 0.0f), float2(0.0f, x_40));
|
||||
}
|
||||
const int x_45 = asint(x_5[1].x);
|
||||
i = x_45;
|
||||
while (true) {
|
||||
const int x_50 = i;
|
||||
const uint scalar_offset = ((16u * uint(0))) / 4;
|
||||
const int x_52 = asint(x_5[scalar_offset / 4][scalar_offset % 4]);
|
||||
if ((x_50 < x_52)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
const int x_56 = asint(x_5[1].x);
|
||||
j = x_56;
|
||||
while (true) {
|
||||
const int x_61 = j;
|
||||
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
|
||||
const int x_63 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]);
|
||||
if ((x_61 < x_63)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
const int x_66 = i;
|
||||
const int x_67 = j;
|
||||
const int x_68 = i;
|
||||
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
|
||||
const int x_70 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]);
|
||||
set_float2(m[x_66], x_67, float(((x_68 * x_70) + j)));
|
||||
{
|
||||
j = (j + 1);
|
||||
}
|
||||
}
|
||||
{
|
||||
i = (i + 1);
|
||||
}
|
||||
}
|
||||
const float2x2 x_80 = m;
|
||||
const int x_82 = asint(x_5[1].x);
|
||||
const int x_85 = asint(x_5[2].x);
|
||||
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
|
||||
const int x_88 = asint(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]);
|
||||
const int x_91 = asint(x_5[3].x);
|
||||
const float2x2 x_95 = float2x2(float2(float(x_82), float(x_85)), float2(float(x_88), float(x_91)));
|
||||
bool tint_tmp = all((x_80[0u] == x_95[0u]));
|
||||
if (tint_tmp) {
|
||||
tint_tmp = all((x_80[1u] == x_95[1u]));
|
||||
}
|
||||
if ((tint_tmp)) {
|
||||
const int x_109 = asint(x_5[2].x);
|
||||
const int x_112 = asint(x_5[1].x);
|
||||
const int x_115 = asint(x_5[1].x);
|
||||
const int x_118 = asint(x_5[2].x);
|
||||
x_GLF_color = float4(float(x_109), float(x_112), float(x_115), float(x_118));
|
||||
} else {
|
||||
const int x_122 = asint(x_5[1].x);
|
||||
const float x_123 = float(x_122);
|
||||
x_GLF_color = float4(x_123, x_123, x_123, x_123);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol {
|
||||
float4 x_GLF_color_1 : SV_Target0;
|
||||
};
|
||||
|
||||
tint_symbol main() {
|
||||
main_1();
|
||||
const main_out tint_symbol_1 = {x_GLF_color};
|
||||
const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
|
||||
return tint_symbol_3;
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_padded_array_element {
|
||||
/* 0x0000 */ int el;
|
||||
/* 0x0004 */ int8_t tint_pad[12];
|
||||
};
|
||||
struct tint_array_wrapper {
|
||||
/* 0x0000 */ tint_padded_array_element arr[4];
|
||||
};
|
||||
struct buf0 {
|
||||
/* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values;
|
||||
};
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol_1 {
|
||||
float4 x_GLF_color_1 [[color(0)]];
|
||||
};
|
||||
|
||||
void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) {
|
||||
float2x2 m = float2x2(0.0f);
|
||||
float f = 0.0f;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int const x_36 = x_5.x_GLF_uniform_int_values.arr[1].el;
|
||||
if ((x_36 == 1)) {
|
||||
float const x_40 = f;
|
||||
m = float2x2(float2(x_40, 0.0f), float2(0.0f, x_40));
|
||||
}
|
||||
int const x_45 = x_5.x_GLF_uniform_int_values.arr[1].el;
|
||||
i = x_45;
|
||||
while (true) {
|
||||
int const x_50 = i;
|
||||
int const x_52 = x_5.x_GLF_uniform_int_values.arr[0].el;
|
||||
if ((x_50 < x_52)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
int const x_56 = x_5.x_GLF_uniform_int_values.arr[1].el;
|
||||
j = x_56;
|
||||
while (true) {
|
||||
int const x_61 = j;
|
||||
int const x_63 = x_5.x_GLF_uniform_int_values.arr[0].el;
|
||||
if ((x_61 < x_63)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
int const x_66 = i;
|
||||
int const x_67 = j;
|
||||
int const x_68 = i;
|
||||
int const x_70 = x_5.x_GLF_uniform_int_values.arr[0].el;
|
||||
int const x_72 = j;
|
||||
m[x_66][x_67] = float(((x_68 * x_70) + x_72));
|
||||
{
|
||||
int const x_76 = j;
|
||||
j = (x_76 + 1);
|
||||
}
|
||||
}
|
||||
{
|
||||
int const x_78 = i;
|
||||
i = (x_78 + 1);
|
||||
}
|
||||
}
|
||||
float2x2 const x_80 = m;
|
||||
int const x_82 = x_5.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_85 = x_5.x_GLF_uniform_int_values.arr[2].el;
|
||||
int const x_88 = x_5.x_GLF_uniform_int_values.arr[0].el;
|
||||
int const x_91 = x_5.x_GLF_uniform_int_values.arr[3].el;
|
||||
float2x2 const x_95 = float2x2(float2(float(x_82), float(x_85)), float2(float(x_88), float(x_91)));
|
||||
if ((all((x_80[0u] == x_95[0u])) && all((x_80[1u] == x_95[1u])))) {
|
||||
int const x_109 = x_5.x_GLF_uniform_int_values.arr[2].el;
|
||||
int const x_112 = x_5.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_115 = x_5.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_118 = x_5.x_GLF_uniform_int_values.arr[2].el;
|
||||
*(tint_symbol_4) = float4(float(x_109), float(x_112), float(x_115), float(x_118));
|
||||
} else {
|
||||
int const x_122 = x_5.x_GLF_uniform_int_values.arr[1].el;
|
||||
float const x_123 = float(x_122);
|
||||
*(tint_symbol_4) = float4(x_123, x_123, x_123, x_123);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) {
|
||||
thread float4 tint_symbol_5 = 0.0f;
|
||||
main_1(x_5, &(tint_symbol_5));
|
||||
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5};
|
||||
tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
|
||||
return tint_symbol_3;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 149
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %tint_symbol_1
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %buf0 "buf0"
|
||||
OpMemberName %buf0 0 "x_GLF_uniform_int_values"
|
||||
OpName %x_5 "x_5"
|
||||
OpName %x_GLF_color "x_GLF_color"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %main_1 "main_1"
|
||||
OpName %m "m"
|
||||
OpName %f "f"
|
||||
OpName %i "i"
|
||||
OpName %j "j"
|
||||
OpName %main_out "main_out"
|
||||
OpMemberName %main_out 0 "x_GLF_color_1"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %main "main"
|
||||
OpDecorate %buf0 Block
|
||||
OpMemberDecorate %buf0 0 Offset 0
|
||||
OpDecorate %_arr_int_uint_4 ArrayStride 16
|
||||
OpDecorate %x_5 NonWritable
|
||||
OpDecorate %x_5 DescriptorSet 0
|
||||
OpDecorate %x_5 Binding 0
|
||||
OpDecorate %tint_symbol_1 Location 0
|
||||
OpMemberDecorate %main_out 0 Offset 0
|
||||
%int = OpTypeInt 32 1
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_int_uint_4 = OpTypeArray %int %uint_4
|
||||
%buf0 = OpTypeStruct %_arr_int_uint_4
|
||||
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
|
||||
%x_5 = OpVariable %_ptr_Uniform_buf0 Uniform
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Private_v4float = OpTypePointer Private %v4float
|
||||
%12 = OpConstantNull %v4float
|
||||
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12
|
||||
%void = OpTypeVoid
|
||||
%15 = OpTypeFunction %void
|
||||
%v2float = OpTypeVector %float 2
|
||||
%mat2v2float = OpTypeMatrix %v2float 2
|
||||
%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float
|
||||
%23 = OpConstantNull %mat2v2float
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%26 = OpConstantNull %float
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%29 = OpConstantNull %int
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%bool = OpTypeBool
|
||||
%float_0 = OpConstant %float 0
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%v2bool = OpTypeVector %bool 2
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%137 = OpTypeFunction %void %main_out
|
||||
%main_1 = OpFunction %void None %15
|
||||
%18 = OpLabel
|
||||
%m = OpVariable %_ptr_Function_mat2v2float Function %23
|
||||
%f = OpVariable %_ptr_Function_float Function %26
|
||||
%i = OpVariable %_ptr_Function_int Function %29
|
||||
%j = OpVariable %_ptr_Function_int Function %29
|
||||
%34 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1
|
||||
%35 = OpLoad %int %34
|
||||
%36 = OpIEqual %bool %35 %int_1
|
||||
OpSelectionMerge %38 None
|
||||
OpBranchConditional %36 %39 %38
|
||||
%39 = OpLabel
|
||||
%40 = OpLoad %float %f
|
||||
%42 = OpCompositeConstruct %v2float %40 %float_0
|
||||
%43 = OpCompositeConstruct %v2float %float_0 %40
|
||||
%44 = OpCompositeConstruct %mat2v2float %42 %43
|
||||
OpStore %m %44
|
||||
OpBranch %38
|
||||
%38 = OpLabel
|
||||
%45 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1
|
||||
%46 = OpLoad %int %45
|
||||
OpStore %i %46
|
||||
OpBranch %47
|
||||
%47 = OpLabel
|
||||
OpLoopMerge %48 %49 None
|
||||
OpBranch %50
|
||||
%50 = OpLabel
|
||||
%51 = OpLoad %int %i
|
||||
%53 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0
|
||||
%54 = OpLoad %int %53
|
||||
%55 = OpSLessThan %bool %51 %54
|
||||
OpSelectionMerge %56 None
|
||||
OpBranchConditional %55 %57 %58
|
||||
%57 = OpLabel
|
||||
OpBranch %56
|
||||
%58 = OpLabel
|
||||
OpBranch %48
|
||||
%56 = OpLabel
|
||||
%59 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1
|
||||
%60 = OpLoad %int %59
|
||||
OpStore %j %60
|
||||
OpBranch %61
|
||||
%61 = OpLabel
|
||||
OpLoopMerge %62 %63 None
|
||||
OpBranch %64
|
||||
%64 = OpLabel
|
||||
%65 = OpLoad %int %j
|
||||
%66 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0
|
||||
%67 = OpLoad %int %66
|
||||
%68 = OpSLessThan %bool %65 %67
|
||||
OpSelectionMerge %69 None
|
||||
OpBranchConditional %68 %70 %71
|
||||
%70 = OpLabel
|
||||
OpBranch %69
|
||||
%71 = OpLabel
|
||||
OpBranch %62
|
||||
%69 = OpLabel
|
||||
%72 = OpLoad %int %i
|
||||
%73 = OpLoad %int %j
|
||||
%74 = OpLoad %int %i
|
||||
%75 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0
|
||||
%76 = OpLoad %int %75
|
||||
%77 = OpLoad %int %j
|
||||
%78 = OpAccessChain %_ptr_Function_float %m %72 %73
|
||||
%80 = OpIMul %int %74 %76
|
||||
%81 = OpIAdd %int %80 %77
|
||||
%79 = OpConvertSToF %float %81
|
||||
OpStore %78 %79
|
||||
OpBranch %63
|
||||
%63 = OpLabel
|
||||
%82 = OpLoad %int %j
|
||||
%83 = OpIAdd %int %82 %int_1
|
||||
OpStore %j %83
|
||||
OpBranch %61
|
||||
%62 = OpLabel
|
||||
OpBranch %49
|
||||
%49 = OpLabel
|
||||
%84 = OpLoad %int %i
|
||||
%85 = OpIAdd %int %84 %int_1
|
||||
OpStore %i %85
|
||||
OpBranch %47
|
||||
%48 = OpLabel
|
||||
%86 = OpLoad %mat2v2float %m
|
||||
%87 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1
|
||||
%88 = OpLoad %int %87
|
||||
%90 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2
|
||||
%91 = OpLoad %int %90
|
||||
%92 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0
|
||||
%93 = OpLoad %int %92
|
||||
%95 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_3
|
||||
%96 = OpLoad %int %95
|
||||
%97 = OpConvertSToF %float %88
|
||||
%98 = OpConvertSToF %float %91
|
||||
%99 = OpCompositeConstruct %v2float %97 %98
|
||||
%100 = OpConvertSToF %float %93
|
||||
%101 = OpConvertSToF %float %96
|
||||
%102 = OpCompositeConstruct %v2float %100 %101
|
||||
%103 = OpCompositeConstruct %mat2v2float %99 %102
|
||||
%105 = OpCompositeExtract %v2float %86 0
|
||||
%106 = OpCompositeExtract %v2float %103 0
|
||||
%107 = OpFOrdEqual %v2bool %105 %106
|
||||
%104 = OpAll %bool %107
|
||||
OpSelectionMerge %109 None
|
||||
OpBranchConditional %104 %110 %109
|
||||
%110 = OpLabel
|
||||
%113 = OpCompositeExtract %v2float %86 1
|
||||
%114 = OpCompositeExtract %v2float %103 1
|
||||
%115 = OpFOrdEqual %v2bool %113 %114
|
||||
%111 = OpAll %bool %115
|
||||
OpBranch %109
|
||||
%109 = OpLabel
|
||||
%116 = OpPhi %bool %104 %48 %111 %110
|
||||
OpSelectionMerge %117 None
|
||||
OpBranchConditional %116 %118 %119
|
||||
%118 = OpLabel
|
||||
%120 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2
|
||||
%121 = OpLoad %int %120
|
||||
%122 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1
|
||||
%123 = OpLoad %int %122
|
||||
%124 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1
|
||||
%125 = OpLoad %int %124
|
||||
%126 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2
|
||||
%127 = OpLoad %int %126
|
||||
%128 = OpConvertSToF %float %121
|
||||
%129 = OpConvertSToF %float %123
|
||||
%130 = OpConvertSToF %float %125
|
||||
%131 = OpConvertSToF %float %127
|
||||
%132 = OpCompositeConstruct %v4float %128 %129 %130 %131
|
||||
OpStore %x_GLF_color %132
|
||||
OpBranch %117
|
||||
%119 = OpLabel
|
||||
%133 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1
|
||||
%134 = OpLoad %int %133
|
||||
%135 = OpConvertSToF %float %134
|
||||
%136 = OpCompositeConstruct %v4float %135 %135 %135 %135
|
||||
OpStore %x_GLF_color %136
|
||||
OpBranch %117
|
||||
%117 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %137
|
||||
%tint_symbol = OpFunctionParameter %main_out
|
||||
%141 = OpLabel
|
||||
%142 = OpCompositeExtract %v4float %tint_symbol 0
|
||||
OpStore %tint_symbol_1 %142
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %15
|
||||
%144 = OpLabel
|
||||
%145 = OpFunctionCall %void %main_1
|
||||
%147 = OpLoad %v4float %x_GLF_color
|
||||
%148 = OpCompositeConstruct %main_out %147
|
||||
%146 = OpFunctionCall %void %tint_symbol_2 %148
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,87 @@
|
||||
type Arr = [[stride(16)]] array<i32, 4>;
|
||||
|
||||
[[block]]
|
||||
struct buf0 {
|
||||
x_GLF_uniform_int_values : Arr;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]] var<uniform> x_5 : buf0;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var m : mat2x2<f32>;
|
||||
var f : f32;
|
||||
var i : i32;
|
||||
var j : i32;
|
||||
let x_36 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
if ((x_36 == 1)) {
|
||||
let x_40 : f32 = f;
|
||||
m = mat2x2<f32>(vec2<f32>(x_40, 0.0), vec2<f32>(0.0, x_40));
|
||||
}
|
||||
let x_45 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
i = x_45;
|
||||
loop {
|
||||
let x_50 : i32 = i;
|
||||
let x_52 : i32 = x_5.x_GLF_uniform_int_values[0];
|
||||
if ((x_50 < x_52)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_56 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
j = x_56;
|
||||
loop {
|
||||
let x_61 : i32 = j;
|
||||
let x_63 : i32 = x_5.x_GLF_uniform_int_values[0];
|
||||
if ((x_61 < x_63)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_66 : i32 = i;
|
||||
let x_67 : i32 = j;
|
||||
let x_68 : i32 = i;
|
||||
let x_70 : i32 = x_5.x_GLF_uniform_int_values[0];
|
||||
let x_72 : i32 = j;
|
||||
m[x_66][x_67] = f32(((x_68 * x_70) + x_72));
|
||||
|
||||
continuing {
|
||||
let x_76 : i32 = j;
|
||||
j = (x_76 + 1);
|
||||
}
|
||||
}
|
||||
|
||||
continuing {
|
||||
let x_78 : i32 = i;
|
||||
i = (x_78 + 1);
|
||||
}
|
||||
}
|
||||
let x_80 : mat2x2<f32> = m;
|
||||
let x_82 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
let x_85 : i32 = x_5.x_GLF_uniform_int_values[2];
|
||||
let x_88 : i32 = x_5.x_GLF_uniform_int_values[0];
|
||||
let x_91 : i32 = x_5.x_GLF_uniform_int_values[3];
|
||||
let x_95 : mat2x2<f32> = mat2x2<f32>(vec2<f32>(f32(x_82), f32(x_85)), vec2<f32>(f32(x_88), f32(x_91)));
|
||||
if ((all((x_80[0u] == x_95[0u])) && all((x_80[1u] == x_95[1u])))) {
|
||||
let x_109 : i32 = x_5.x_GLF_uniform_int_values[2];
|
||||
let x_112 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
let x_115 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
let x_118 : i32 = x_5.x_GLF_uniform_int_values[2];
|
||||
x_GLF_color = vec4<f32>(f32(x_109), f32(x_112), f32(x_115), f32(x_118));
|
||||
} else {
|
||||
let x_122 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
let x_123 : f32 = f32(x_122);
|
||||
x_GLF_color = vec4<f32>(x_123, x_123, x_123, x_123);
|
||||
}
|
||||
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,87 @@
|
||||
type Arr = [[stride(16)]] array<i32, 4>;
|
||||
|
||||
[[block]]
|
||||
struct buf0 {
|
||||
x_GLF_uniform_int_values : Arr;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]] var<uniform> x_5 : buf0;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var m : mat2x2<f32>;
|
||||
var f : f32;
|
||||
var i : i32;
|
||||
var j : i32;
|
||||
let x_36 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
if ((x_36 == 1)) {
|
||||
let x_40 : f32 = f;
|
||||
m = mat2x2<f32>(vec2<f32>(x_40, 0.0), vec2<f32>(0.0, x_40));
|
||||
}
|
||||
let x_45 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
i = x_45;
|
||||
loop {
|
||||
let x_50 : i32 = i;
|
||||
let x_52 : i32 = x_5.x_GLF_uniform_int_values[0];
|
||||
if ((x_50 < x_52)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_56 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
j = x_56;
|
||||
loop {
|
||||
let x_61 : i32 = j;
|
||||
let x_63 : i32 = x_5.x_GLF_uniform_int_values[0];
|
||||
if ((x_61 < x_63)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_66 : i32 = i;
|
||||
let x_67 : i32 = j;
|
||||
let x_68 : i32 = i;
|
||||
let x_70 : i32 = x_5.x_GLF_uniform_int_values[0];
|
||||
let x_72 : i32 = j;
|
||||
m[x_66][x_67] = f32(((x_68 * x_70) + x_72));
|
||||
|
||||
continuing {
|
||||
let x_76 : i32 = j;
|
||||
j = (x_76 + 1);
|
||||
}
|
||||
}
|
||||
|
||||
continuing {
|
||||
let x_78 : i32 = i;
|
||||
i = (x_78 + 1);
|
||||
}
|
||||
}
|
||||
let x_80 : mat2x2<f32> = m;
|
||||
let x_82 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
let x_85 : i32 = x_5.x_GLF_uniform_int_values[2];
|
||||
let x_88 : i32 = x_5.x_GLF_uniform_int_values[0];
|
||||
let x_91 : i32 = x_5.x_GLF_uniform_int_values[3];
|
||||
let x_95 : mat2x2<f32> = mat2x2<f32>(vec2<f32>(f32(x_82), f32(x_85)), vec2<f32>(f32(x_88), f32(x_91)));
|
||||
if ((all((x_80[0u] == x_95[0u])) && all((x_80[1u] == x_95[1u])))) {
|
||||
let x_109 : i32 = x_5.x_GLF_uniform_int_values[2];
|
||||
let x_112 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
let x_115 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
let x_118 : i32 = x_5.x_GLF_uniform_int_values[2];
|
||||
x_GLF_color = vec4<f32>(f32(x_109), f32(x_112), f32(x_115), f32(x_118));
|
||||
} else {
|
||||
let x_122 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
let x_123 : f32 = f32(x_122);
|
||||
x_GLF_color = vec4<f32>(x_123, x_123, x_123, x_123);
|
||||
}
|
||||
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,91 @@
|
||||
void set_float2(inout float2 vec, int idx, float val) {
|
||||
vec = (idx.xx == int2(0, 1)) ? val.xx : vec;
|
||||
}
|
||||
|
||||
cbuffer cbuffer_x_5 : register(b0, space0) {
|
||||
uint4 x_5[4];
|
||||
};
|
||||
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
void main_1() {
|
||||
float2x2 m = float2x2(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
float f = 0.0f;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
const int x_36 = asint(x_5[1].x);
|
||||
if ((x_36 == 1)) {
|
||||
const float x_40 = f;
|
||||
m = float2x2(float2(x_40, 0.0f), float2(0.0f, x_40));
|
||||
}
|
||||
const int x_45 = asint(x_5[1].x);
|
||||
i = x_45;
|
||||
while (true) {
|
||||
const int x_50 = i;
|
||||
const uint scalar_offset = ((16u * uint(0))) / 4;
|
||||
const int x_52 = asint(x_5[scalar_offset / 4][scalar_offset % 4]);
|
||||
if ((x_50 < x_52)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
const int x_56 = asint(x_5[1].x);
|
||||
j = x_56;
|
||||
while (true) {
|
||||
const int x_61 = j;
|
||||
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
|
||||
const int x_63 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]);
|
||||
if ((x_61 < x_63)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
const int x_66 = i;
|
||||
const int x_67 = j;
|
||||
const int x_68 = i;
|
||||
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
|
||||
const int x_70 = asint(x_5[scalar_offset_2 / 4][scalar_offset_2 % 4]);
|
||||
set_float2(m[x_66], x_67, float(((x_68 * x_70) + j)));
|
||||
{
|
||||
j = (j + 1);
|
||||
}
|
||||
}
|
||||
{
|
||||
i = (i + 1);
|
||||
}
|
||||
}
|
||||
const float2x2 x_80 = m;
|
||||
const int x_82 = asint(x_5[1].x);
|
||||
const int x_85 = asint(x_5[2].x);
|
||||
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
|
||||
const int x_88 = asint(x_5[scalar_offset_3 / 4][scalar_offset_3 % 4]);
|
||||
const int x_91 = asint(x_5[3].x);
|
||||
const float2x2 x_95 = float2x2(float2(float(x_82), float(x_85)), float2(float(x_88), float(x_91)));
|
||||
bool tint_tmp = all((x_80[0u] == x_95[0u]));
|
||||
if (tint_tmp) {
|
||||
tint_tmp = all((x_80[1u] == x_95[1u]));
|
||||
}
|
||||
if ((tint_tmp)) {
|
||||
const int x_109 = asint(x_5[2].x);
|
||||
const int x_112 = asint(x_5[1].x);
|
||||
const int x_115 = asint(x_5[1].x);
|
||||
const int x_118 = asint(x_5[2].x);
|
||||
x_GLF_color = float4(float(x_109), float(x_112), float(x_115), float(x_118));
|
||||
} else {
|
||||
const int x_122 = asint(x_5[1].x);
|
||||
const float x_123 = float(x_122);
|
||||
x_GLF_color = float4(x_123, x_123, x_123, x_123);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol {
|
||||
float4 x_GLF_color_1 : SV_Target0;
|
||||
};
|
||||
|
||||
tint_symbol main() {
|
||||
main_1();
|
||||
const main_out tint_symbol_1 = {x_GLF_color};
|
||||
const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
|
||||
return tint_symbol_3;
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_padded_array_element {
|
||||
/* 0x0000 */ int el;
|
||||
/* 0x0004 */ int8_t tint_pad[12];
|
||||
};
|
||||
struct tint_array_wrapper {
|
||||
/* 0x0000 */ tint_padded_array_element arr[4];
|
||||
};
|
||||
struct buf0 {
|
||||
/* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values;
|
||||
};
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol_1 {
|
||||
float4 x_GLF_color_1 [[color(0)]];
|
||||
};
|
||||
|
||||
void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) {
|
||||
float2x2 m = float2x2(0.0f);
|
||||
float f = 0.0f;
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int const x_36 = x_5.x_GLF_uniform_int_values.arr[1].el;
|
||||
if ((x_36 == 1)) {
|
||||
float const x_40 = f;
|
||||
m = float2x2(float2(x_40, 0.0f), float2(0.0f, x_40));
|
||||
}
|
||||
int const x_45 = x_5.x_GLF_uniform_int_values.arr[1].el;
|
||||
i = x_45;
|
||||
while (true) {
|
||||
int const x_50 = i;
|
||||
int const x_52 = x_5.x_GLF_uniform_int_values.arr[0].el;
|
||||
if ((x_50 < x_52)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
int const x_56 = x_5.x_GLF_uniform_int_values.arr[1].el;
|
||||
j = x_56;
|
||||
while (true) {
|
||||
int const x_61 = j;
|
||||
int const x_63 = x_5.x_GLF_uniform_int_values.arr[0].el;
|
||||
if ((x_61 < x_63)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
int const x_66 = i;
|
||||
int const x_67 = j;
|
||||
int const x_68 = i;
|
||||
int const x_70 = x_5.x_GLF_uniform_int_values.arr[0].el;
|
||||
int const x_72 = j;
|
||||
m[x_66][x_67] = float(((x_68 * x_70) + x_72));
|
||||
{
|
||||
int const x_76 = j;
|
||||
j = (x_76 + 1);
|
||||
}
|
||||
}
|
||||
{
|
||||
int const x_78 = i;
|
||||
i = (x_78 + 1);
|
||||
}
|
||||
}
|
||||
float2x2 const x_80 = m;
|
||||
int const x_82 = x_5.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_85 = x_5.x_GLF_uniform_int_values.arr[2].el;
|
||||
int const x_88 = x_5.x_GLF_uniform_int_values.arr[0].el;
|
||||
int const x_91 = x_5.x_GLF_uniform_int_values.arr[3].el;
|
||||
float2x2 const x_95 = float2x2(float2(float(x_82), float(x_85)), float2(float(x_88), float(x_91)));
|
||||
if ((all((x_80[0u] == x_95[0u])) && all((x_80[1u] == x_95[1u])))) {
|
||||
int const x_109 = x_5.x_GLF_uniform_int_values.arr[2].el;
|
||||
int const x_112 = x_5.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_115 = x_5.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_118 = x_5.x_GLF_uniform_int_values.arr[2].el;
|
||||
*(tint_symbol_4) = float4(float(x_109), float(x_112), float(x_115), float(x_118));
|
||||
} else {
|
||||
int const x_122 = x_5.x_GLF_uniform_int_values.arr[1].el;
|
||||
float const x_123 = float(x_122);
|
||||
*(tint_symbol_4) = float4(x_123, x_123, x_123, x_123);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) {
|
||||
thread float4 tint_symbol_5 = 0.0f;
|
||||
main_1(x_5, &(tint_symbol_5));
|
||||
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5};
|
||||
tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
|
||||
return tint_symbol_3;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 149
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %tint_symbol_1
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %buf0 "buf0"
|
||||
OpMemberName %buf0 0 "x_GLF_uniform_int_values"
|
||||
OpName %x_5 "x_5"
|
||||
OpName %x_GLF_color "x_GLF_color"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %main_1 "main_1"
|
||||
OpName %m "m"
|
||||
OpName %f "f"
|
||||
OpName %i "i"
|
||||
OpName %j "j"
|
||||
OpName %main_out "main_out"
|
||||
OpMemberName %main_out 0 "x_GLF_color_1"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %main "main"
|
||||
OpDecorate %buf0 Block
|
||||
OpMemberDecorate %buf0 0 Offset 0
|
||||
OpDecorate %_arr_int_uint_4 ArrayStride 16
|
||||
OpDecorate %x_5 NonWritable
|
||||
OpDecorate %x_5 DescriptorSet 0
|
||||
OpDecorate %x_5 Binding 0
|
||||
OpDecorate %tint_symbol_1 Location 0
|
||||
OpMemberDecorate %main_out 0 Offset 0
|
||||
%int = OpTypeInt 32 1
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_int_uint_4 = OpTypeArray %int %uint_4
|
||||
%buf0 = OpTypeStruct %_arr_int_uint_4
|
||||
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
|
||||
%x_5 = OpVariable %_ptr_Uniform_buf0 Uniform
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Private_v4float = OpTypePointer Private %v4float
|
||||
%12 = OpConstantNull %v4float
|
||||
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12
|
||||
%void = OpTypeVoid
|
||||
%15 = OpTypeFunction %void
|
||||
%v2float = OpTypeVector %float 2
|
||||
%mat2v2float = OpTypeMatrix %v2float 2
|
||||
%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float
|
||||
%23 = OpConstantNull %mat2v2float
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%26 = OpConstantNull %float
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%29 = OpConstantNull %int
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%bool = OpTypeBool
|
||||
%float_0 = OpConstant %float 0
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%v2bool = OpTypeVector %bool 2
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%137 = OpTypeFunction %void %main_out
|
||||
%main_1 = OpFunction %void None %15
|
||||
%18 = OpLabel
|
||||
%m = OpVariable %_ptr_Function_mat2v2float Function %23
|
||||
%f = OpVariable %_ptr_Function_float Function %26
|
||||
%i = OpVariable %_ptr_Function_int Function %29
|
||||
%j = OpVariable %_ptr_Function_int Function %29
|
||||
%34 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1
|
||||
%35 = OpLoad %int %34
|
||||
%36 = OpIEqual %bool %35 %int_1
|
||||
OpSelectionMerge %38 None
|
||||
OpBranchConditional %36 %39 %38
|
||||
%39 = OpLabel
|
||||
%40 = OpLoad %float %f
|
||||
%42 = OpCompositeConstruct %v2float %40 %float_0
|
||||
%43 = OpCompositeConstruct %v2float %float_0 %40
|
||||
%44 = OpCompositeConstruct %mat2v2float %42 %43
|
||||
OpStore %m %44
|
||||
OpBranch %38
|
||||
%38 = OpLabel
|
||||
%45 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1
|
||||
%46 = OpLoad %int %45
|
||||
OpStore %i %46
|
||||
OpBranch %47
|
||||
%47 = OpLabel
|
||||
OpLoopMerge %48 %49 None
|
||||
OpBranch %50
|
||||
%50 = OpLabel
|
||||
%51 = OpLoad %int %i
|
||||
%53 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0
|
||||
%54 = OpLoad %int %53
|
||||
%55 = OpSLessThan %bool %51 %54
|
||||
OpSelectionMerge %56 None
|
||||
OpBranchConditional %55 %57 %58
|
||||
%57 = OpLabel
|
||||
OpBranch %56
|
||||
%58 = OpLabel
|
||||
OpBranch %48
|
||||
%56 = OpLabel
|
||||
%59 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1
|
||||
%60 = OpLoad %int %59
|
||||
OpStore %j %60
|
||||
OpBranch %61
|
||||
%61 = OpLabel
|
||||
OpLoopMerge %62 %63 None
|
||||
OpBranch %64
|
||||
%64 = OpLabel
|
||||
%65 = OpLoad %int %j
|
||||
%66 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0
|
||||
%67 = OpLoad %int %66
|
||||
%68 = OpSLessThan %bool %65 %67
|
||||
OpSelectionMerge %69 None
|
||||
OpBranchConditional %68 %70 %71
|
||||
%70 = OpLabel
|
||||
OpBranch %69
|
||||
%71 = OpLabel
|
||||
OpBranch %62
|
||||
%69 = OpLabel
|
||||
%72 = OpLoad %int %i
|
||||
%73 = OpLoad %int %j
|
||||
%74 = OpLoad %int %i
|
||||
%75 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0
|
||||
%76 = OpLoad %int %75
|
||||
%77 = OpLoad %int %j
|
||||
%78 = OpAccessChain %_ptr_Function_float %m %72 %73
|
||||
%80 = OpIMul %int %74 %76
|
||||
%81 = OpIAdd %int %80 %77
|
||||
%79 = OpConvertSToF %float %81
|
||||
OpStore %78 %79
|
||||
OpBranch %63
|
||||
%63 = OpLabel
|
||||
%82 = OpLoad %int %j
|
||||
%83 = OpIAdd %int %82 %int_1
|
||||
OpStore %j %83
|
||||
OpBranch %61
|
||||
%62 = OpLabel
|
||||
OpBranch %49
|
||||
%49 = OpLabel
|
||||
%84 = OpLoad %int %i
|
||||
%85 = OpIAdd %int %84 %int_1
|
||||
OpStore %i %85
|
||||
OpBranch %47
|
||||
%48 = OpLabel
|
||||
%86 = OpLoad %mat2v2float %m
|
||||
%87 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1
|
||||
%88 = OpLoad %int %87
|
||||
%90 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2
|
||||
%91 = OpLoad %int %90
|
||||
%92 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0
|
||||
%93 = OpLoad %int %92
|
||||
%95 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_3
|
||||
%96 = OpLoad %int %95
|
||||
%97 = OpConvertSToF %float %88
|
||||
%98 = OpConvertSToF %float %91
|
||||
%99 = OpCompositeConstruct %v2float %97 %98
|
||||
%100 = OpConvertSToF %float %93
|
||||
%101 = OpConvertSToF %float %96
|
||||
%102 = OpCompositeConstruct %v2float %100 %101
|
||||
%103 = OpCompositeConstruct %mat2v2float %99 %102
|
||||
%105 = OpCompositeExtract %v2float %86 0
|
||||
%106 = OpCompositeExtract %v2float %103 0
|
||||
%107 = OpFOrdEqual %v2bool %105 %106
|
||||
%104 = OpAll %bool %107
|
||||
OpSelectionMerge %109 None
|
||||
OpBranchConditional %104 %110 %109
|
||||
%110 = OpLabel
|
||||
%113 = OpCompositeExtract %v2float %86 1
|
||||
%114 = OpCompositeExtract %v2float %103 1
|
||||
%115 = OpFOrdEqual %v2bool %113 %114
|
||||
%111 = OpAll %bool %115
|
||||
OpBranch %109
|
||||
%109 = OpLabel
|
||||
%116 = OpPhi %bool %104 %48 %111 %110
|
||||
OpSelectionMerge %117 None
|
||||
OpBranchConditional %116 %118 %119
|
||||
%118 = OpLabel
|
||||
%120 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2
|
||||
%121 = OpLoad %int %120
|
||||
%122 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1
|
||||
%123 = OpLoad %int %122
|
||||
%124 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1
|
||||
%125 = OpLoad %int %124
|
||||
%126 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2
|
||||
%127 = OpLoad %int %126
|
||||
%128 = OpConvertSToF %float %121
|
||||
%129 = OpConvertSToF %float %123
|
||||
%130 = OpConvertSToF %float %125
|
||||
%131 = OpConvertSToF %float %127
|
||||
%132 = OpCompositeConstruct %v4float %128 %129 %130 %131
|
||||
OpStore %x_GLF_color %132
|
||||
OpBranch %117
|
||||
%119 = OpLabel
|
||||
%133 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1
|
||||
%134 = OpLoad %int %133
|
||||
%135 = OpConvertSToF %float %134
|
||||
%136 = OpCompositeConstruct %v4float %135 %135 %135 %135
|
||||
OpStore %x_GLF_color %136
|
||||
OpBranch %117
|
||||
%117 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %137
|
||||
%tint_symbol = OpFunctionParameter %main_out
|
||||
%141 = OpLabel
|
||||
%142 = OpCompositeExtract %v4float %tint_symbol 0
|
||||
OpStore %tint_symbol_1 %142
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %15
|
||||
%144 = OpLabel
|
||||
%145 = OpFunctionCall %void %main_1
|
||||
%147 = OpLoad %v4float %x_GLF_color
|
||||
%148 = OpCompositeConstruct %main_out %147
|
||||
%146 = OpFunctionCall %void %tint_symbol_2 %148
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,87 @@
|
||||
type Arr = [[stride(16)]] array<i32, 4>;
|
||||
|
||||
[[block]]
|
||||
struct buf0 {
|
||||
x_GLF_uniform_int_values : Arr;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]] var<uniform> x_5 : buf0;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var m : mat2x2<f32>;
|
||||
var f : f32;
|
||||
var i : i32;
|
||||
var j : i32;
|
||||
let x_36 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
if ((x_36 == 1)) {
|
||||
let x_40 : f32 = f;
|
||||
m = mat2x2<f32>(vec2<f32>(x_40, 0.0), vec2<f32>(0.0, x_40));
|
||||
}
|
||||
let x_45 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
i = x_45;
|
||||
loop {
|
||||
let x_50 : i32 = i;
|
||||
let x_52 : i32 = x_5.x_GLF_uniform_int_values[0];
|
||||
if ((x_50 < x_52)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_56 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
j = x_56;
|
||||
loop {
|
||||
let x_61 : i32 = j;
|
||||
let x_63 : i32 = x_5.x_GLF_uniform_int_values[0];
|
||||
if ((x_61 < x_63)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_66 : i32 = i;
|
||||
let x_67 : i32 = j;
|
||||
let x_68 : i32 = i;
|
||||
let x_70 : i32 = x_5.x_GLF_uniform_int_values[0];
|
||||
let x_72 : i32 = j;
|
||||
m[x_66][x_67] = f32(((x_68 * x_70) + x_72));
|
||||
|
||||
continuing {
|
||||
let x_76 : i32 = j;
|
||||
j = (x_76 + 1);
|
||||
}
|
||||
}
|
||||
|
||||
continuing {
|
||||
let x_78 : i32 = i;
|
||||
i = (x_78 + 1);
|
||||
}
|
||||
}
|
||||
let x_80 : mat2x2<f32> = m;
|
||||
let x_82 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
let x_85 : i32 = x_5.x_GLF_uniform_int_values[2];
|
||||
let x_88 : i32 = x_5.x_GLF_uniform_int_values[0];
|
||||
let x_91 : i32 = x_5.x_GLF_uniform_int_values[3];
|
||||
let x_95 : mat2x2<f32> = mat2x2<f32>(vec2<f32>(f32(x_82), f32(x_85)), vec2<f32>(f32(x_88), f32(x_91)));
|
||||
if ((all((x_80[0u] == x_95[0u])) && all((x_80[1u] == x_95[1u])))) {
|
||||
let x_109 : i32 = x_5.x_GLF_uniform_int_values[2];
|
||||
let x_112 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
let x_115 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
let x_118 : i32 = x_5.x_GLF_uniform_int_values[2];
|
||||
x_GLF_color = vec4<f32>(f32(x_109), f32(x_112), f32(x_115), f32(x_118));
|
||||
} else {
|
||||
let x_122 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
let x_123 : f32 = f32(x_122);
|
||||
x_GLF_color = vec4<f32>(x_123, x_123, x_123, x_123);
|
||||
}
|
||||
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