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,145 @@
|
||||
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 %m "m"
|
||||
OpName %buf0 "buf0"
|
||||
OpMemberName %buf0 0 "_GLF_uniform_int_values"
|
||||
OpName %_ ""
|
||||
OpName %a "a"
|
||||
OpName %buf1 "buf1"
|
||||
OpMemberName %buf1 0 "_GLF_uniform_float_values"
|
||||
OpName %__0 ""
|
||||
OpName %arr "arr"
|
||||
OpName %v "v"
|
||||
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 %_arr_float_uint_2 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
|
||||
%15 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v3float = OpTypeVector %float 3
|
||||
%mat3v3float = OpTypeMatrix %v3float 3
|
||||
%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
|
||||
%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
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%buf1 = OpTypeStruct %_arr_float_uint_2
|
||||
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
|
||||
%__0 = OpVariable %_ptr_Uniform_buf1 Uniform
|
||||
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%_arr_v3float_uint_2 = OpTypeArray %v3float %uint_2
|
||||
%_ptr_Function__arr_v3float_uint_2 = OpTypePointer Function %_arr_v3float_uint_2
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%int_2 = OpConstant %int 2
|
||||
%bool = OpTypeBool
|
||||
%v3bool = OpTypeVector %bool 3
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_GLF_color = OpVariable %_ptr_Output_v4float Output
|
||||
%int_3 = OpConstant %int 3
|
||||
%main = OpFunction %void None %15
|
||||
%43 = OpLabel
|
||||
%m = OpVariable %_ptr_Function_mat3v3float Function
|
||||
%a = OpVariable %_ptr_Function_int Function
|
||||
%arr = OpVariable %_ptr_Function__arr_v3float_uint_2 Function
|
||||
%v = OpVariable %_ptr_Function_v3float Function
|
||||
%44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
|
||||
%45 = OpLoad %int %44
|
||||
%46 = OpConvertSToF %float %45
|
||||
%47 = OpCompositeConstruct %v3float %46 %float_0 %float_0
|
||||
%48 = OpCompositeConstruct %v3float %float_0 %46 %float_0
|
||||
%49 = OpCompositeConstruct %v3float %float_0 %float_0 %46
|
||||
%50 = OpCompositeConstruct %mat3v3float %47 %48 %49
|
||||
OpStore %m %50
|
||||
%51 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
|
||||
%52 = OpLoad %int %51
|
||||
OpStore %a %52
|
||||
%53 = OpLoad %int %a
|
||||
%54 = OpLoad %int %a
|
||||
%55 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0
|
||||
%56 = OpLoad %float %55
|
||||
%57 = OpAccessChain %_ptr_Function_float %m %53 %54
|
||||
OpStore %57 %56
|
||||
%58 = OpAccessChain %_ptr_Function_v3float %m %int_1
|
||||
%59 = OpLoad %v3float %58
|
||||
%60 = OpAccessChain %_ptr_Function_v3float %m %int_1
|
||||
%61 = OpLoad %v3float %60
|
||||
%62 = OpCompositeConstruct %_arr_v3float_uint_2 %59 %61
|
||||
OpStore %arr %62
|
||||
%63 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1
|
||||
%64 = OpLoad %float %63
|
||||
%65 = OpCompositeConstruct %v3float %64 %64 %64
|
||||
OpStore %v %65
|
||||
%66 = OpLoad %int %a
|
||||
%67 = OpAccessChain %_ptr_Function_v3float %arr %66
|
||||
%68 = OpLoad %v3float %67
|
||||
%69 = OpLoad %v3float %v
|
||||
%70 = OpFAdd %v3float %69 %68
|
||||
OpStore %v %70
|
||||
%71 = OpLoad %v3float %v
|
||||
%72 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
|
||||
%73 = OpLoad %int %72
|
||||
%74 = OpConvertSToF %float %73
|
||||
%75 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2
|
||||
%76 = OpLoad %int %75
|
||||
%77 = OpConvertSToF %float %76
|
||||
%78 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
|
||||
%79 = OpLoad %int %78
|
||||
%80 = OpConvertSToF %float %79
|
||||
%81 = OpCompositeConstruct %v3float %74 %77 %80
|
||||
%82 = OpFOrdEqual %v3bool %71 %81
|
||||
%83 = OpAll %bool %82
|
||||
OpSelectionMerge %84 None
|
||||
OpBranchConditional %83 %85 %86
|
||||
%85 = OpLabel
|
||||
%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 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3
|
||||
%94 = OpLoad %int %93
|
||||
%95 = OpConvertSToF %float %94
|
||||
%96 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
|
||||
%97 = OpLoad %int %96
|
||||
%98 = OpConvertSToF %float %97
|
||||
%99 = OpCompositeConstruct %v4float %89 %92 %95 %98
|
||||
OpStore %_GLF_color %99
|
||||
OpBranch %84
|
||||
%86 = OpLabel
|
||||
%100 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3
|
||||
%101 = OpLoad %int %100
|
||||
%102 = OpConvertSToF %float %101
|
||||
%103 = OpCompositeConstruct %v4float %102 %102 %102 %102
|
||||
OpStore %_GLF_color %103
|
||||
OpBranch %84
|
||||
%84 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,70 @@
|
||||
void set_float3(inout float3 vec, int idx, float val) {
|
||||
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
|
||||
}
|
||||
|
||||
cbuffer cbuffer_x_6 : register(b0, space0) {
|
||||
uint4 x_6[4];
|
||||
};
|
||||
cbuffer cbuffer_x_9 : register(b1, space0) {
|
||||
uint4 x_9[2];
|
||||
};
|
||||
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
void main_1() {
|
||||
float3x3 m = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
int a = 0;
|
||||
float3 arr[2] = (float3[2])0;
|
||||
float3 v = float3(0.0f, 0.0f, 0.0f);
|
||||
const uint scalar_offset = ((16u * uint(0))) / 4;
|
||||
const int x_45 = asint(x_6[scalar_offset / 4][scalar_offset % 4]);
|
||||
const float x_46 = float(x_45);
|
||||
m = float3x3(float3(x_46, 0.0f, 0.0f), float3(0.0f, x_46, 0.0f), float3(0.0f, 0.0f, x_46));
|
||||
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
|
||||
const int x_52 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]);
|
||||
a = x_52;
|
||||
const int x_53 = a;
|
||||
const int x_54 = a;
|
||||
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
|
||||
const float x_56 = asfloat(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]);
|
||||
set_float3(m[x_53], x_54, x_56);
|
||||
const float3 x_59 = m[1];
|
||||
const float3 x_61 = m[1];
|
||||
const float3 tint_symbol_4[2] = {x_59, x_61};
|
||||
arr = tint_symbol_4;
|
||||
const float x_64 = asfloat(x_9[1].x);
|
||||
v = float3(x_64, x_64, x_64);
|
||||
const float3 x_68 = arr[a];
|
||||
v = (v + x_68);
|
||||
const float3 x_71 = v;
|
||||
const int x_73 = asint(x_6[1].x);
|
||||
const int x_76 = asint(x_6[2].x);
|
||||
const int x_79 = asint(x_6[1].x);
|
||||
if (all((x_71 == float3(float(x_73), float(x_76), float(x_79))))) {
|
||||
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
|
||||
const int x_88 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]);
|
||||
const int x_91 = asint(x_6[3].x);
|
||||
const int x_94 = asint(x_6[3].x);
|
||||
const uint scalar_offset_4 = ((16u * uint(0))) / 4;
|
||||
const int x_97 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]);
|
||||
x_GLF_color = float4(float(x_88), float(x_91), float(x_94), float(x_97));
|
||||
} else {
|
||||
const int x_101 = asint(x_6[3].x);
|
||||
const float x_102 = float(x_101);
|
||||
x_GLF_color = float4(x_102, x_102, x_102, x_102);
|
||||
}
|
||||
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,83 @@
|
||||
#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 tint_padded_array_element_1 {
|
||||
/* 0x0000 */ float el;
|
||||
/* 0x0004 */ int8_t tint_pad_1[12];
|
||||
};
|
||||
struct tint_array_wrapper_1 {
|
||||
/* 0x0000 */ tint_padded_array_element_1 arr[2];
|
||||
};
|
||||
struct buf1 {
|
||||
/* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values;
|
||||
};
|
||||
struct tint_array_wrapper_2 {
|
||||
float3 arr[2];
|
||||
};
|
||||
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) {
|
||||
float3x3 m = float3x3(0.0f);
|
||||
int a = 0;
|
||||
tint_array_wrapper_2 arr = {};
|
||||
float3 v = 0.0f;
|
||||
int const x_45 = x_6.x_GLF_uniform_int_values.arr[0].el;
|
||||
float const x_46 = float(x_45);
|
||||
m = float3x3(float3(x_46, 0.0f, 0.0f), float3(0.0f, x_46, 0.0f), float3(0.0f, 0.0f, x_46));
|
||||
int const x_52 = x_6.x_GLF_uniform_int_values.arr[0].el;
|
||||
a = x_52;
|
||||
int const x_53 = a;
|
||||
int const x_54 = a;
|
||||
float const x_56 = x_9.x_GLF_uniform_float_values.arr[0].el;
|
||||
m[x_53][x_54] = x_56;
|
||||
float3 const x_59 = m[1];
|
||||
float3 const x_61 = m[1];
|
||||
tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_59, x_61}};
|
||||
arr = tint_symbol_3;
|
||||
float const x_64 = x_9.x_GLF_uniform_float_values.arr[1].el;
|
||||
v = float3(x_64, x_64, x_64);
|
||||
int const x_66 = a;
|
||||
float3 const x_68 = arr.arr[x_66];
|
||||
float3 const x_69 = v;
|
||||
v = (x_69 + x_68);
|
||||
float3 const x_71 = v;
|
||||
int const x_73 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_76 = x_6.x_GLF_uniform_int_values.arr[2].el;
|
||||
int const x_79 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
if (all((x_71 == float3(float(x_73), float(x_76), float(x_79))))) {
|
||||
int const x_88 = x_6.x_GLF_uniform_int_values.arr[0].el;
|
||||
int const x_91 = x_6.x_GLF_uniform_int_values.arr[3].el;
|
||||
int const x_94 = x_6.x_GLF_uniform_int_values.arr[3].el;
|
||||
int const x_97 = x_6.x_GLF_uniform_int_values.arr[0].el;
|
||||
*(tint_symbol_5) = float4(float(x_88), float(x_91), float(x_94), float(x_97));
|
||||
} else {
|
||||
int const x_101 = x_6.x_GLF_uniform_int_values.arr[3].el;
|
||||
float const x_102 = float(x_101);
|
||||
*(tint_symbol_5) = float4(x_102, x_102, x_102, x_102);
|
||||
}
|
||||
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,182 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 122
|
||||
; 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_6 "x_6"
|
||||
OpName %buf1 "buf1"
|
||||
OpMemberName %buf1 0 "x_GLF_uniform_float_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 %m "m"
|
||||
OpName %a "a"
|
||||
OpName %arr "arr"
|
||||
OpName %v "v"
|
||||
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_6 NonWritable
|
||||
OpDecorate %x_6 DescriptorSet 0
|
||||
OpDecorate %x_6 Binding 0
|
||||
OpDecorate %buf1 Block
|
||||
OpMemberDecorate %buf1 0 Offset 0
|
||||
OpDecorate %_arr_float_uint_2 ArrayStride 16
|
||||
OpDecorate %x_9 NonWritable
|
||||
OpDecorate %x_9 DescriptorSet 0
|
||||
OpDecorate %x_9 Binding 1
|
||||
OpDecorate %tint_symbol_1 Location 0
|
||||
OpDecorate %_arr_v3float_uint_2 ArrayStride 16
|
||||
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_6 = OpVariable %_ptr_Uniform_buf0 Uniform
|
||||
%float = OpTypeFloat 32
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%buf1 = OpTypeStruct %_arr_float_uint_2
|
||||
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
|
||||
%x_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
|
||||
%v3float = OpTypeVector %float 3
|
||||
%mat3v3float = OpTypeMatrix %v3float 3
|
||||
%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
|
||||
%28 = OpConstantNull %mat3v3float
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%31 = OpConstantNull %int
|
||||
%_arr_v3float_uint_2 = OpTypeArray %v3float %uint_2
|
||||
%_ptr_Function__arr_v3float_uint_2 = OpTypePointer Function %_arr_v3float_uint_2
|
||||
%35 = OpConstantNull %_arr_v3float_uint_2
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%38 = OpConstantNull %v3float
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%int_1 = OpConstant %int 1
|
||||
%int_2 = OpConstant %int 2
|
||||
%bool = OpTypeBool
|
||||
%v3bool = OpTypeVector %bool 3
|
||||
%int_3 = OpConstant %int 3
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%110 = OpTypeFunction %void %main_out
|
||||
%main_1 = OpFunction %void None %20
|
||||
%23 = OpLabel
|
||||
%m = OpVariable %_ptr_Function_mat3v3float Function %28
|
||||
%a = OpVariable %_ptr_Function_int Function %31
|
||||
%arr = OpVariable %_ptr_Function__arr_v3float_uint_2 Function %35
|
||||
%v = OpVariable %_ptr_Function_v3float Function %38
|
||||
%42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
|
||||
%43 = OpLoad %int %42
|
||||
%44 = OpConvertSToF %float %43
|
||||
%46 = OpCompositeConstruct %v3float %44 %float_0 %float_0
|
||||
%47 = OpCompositeConstruct %v3float %float_0 %44 %float_0
|
||||
%48 = OpCompositeConstruct %v3float %float_0 %float_0 %44
|
||||
%49 = OpCompositeConstruct %mat3v3float %46 %47 %48
|
||||
OpStore %m %49
|
||||
%50 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
|
||||
%51 = OpLoad %int %50
|
||||
OpStore %a %51
|
||||
%52 = OpLoad %int %a
|
||||
%53 = OpLoad %int %a
|
||||
%55 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0
|
||||
%56 = OpLoad %float %55
|
||||
%58 = OpAccessChain %_ptr_Function_float %m %52 %53
|
||||
OpStore %58 %56
|
||||
%60 = OpAccessChain %_ptr_Function_v3float %m %int_1
|
||||
%61 = OpLoad %v3float %60
|
||||
%62 = OpAccessChain %_ptr_Function_v3float %m %int_1
|
||||
%63 = OpLoad %v3float %62
|
||||
%64 = OpCompositeConstruct %_arr_v3float_uint_2 %61 %63
|
||||
OpStore %arr %64
|
||||
%65 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1
|
||||
%66 = OpLoad %float %65
|
||||
%67 = OpCompositeConstruct %v3float %66 %66 %66
|
||||
OpStore %v %67
|
||||
%68 = OpLoad %int %a
|
||||
%69 = OpAccessChain %_ptr_Function_v3float %arr %68
|
||||
%70 = OpLoad %v3float %69
|
||||
%71 = OpLoad %v3float %v
|
||||
%72 = OpFAdd %v3float %71 %70
|
||||
OpStore %v %72
|
||||
%73 = OpLoad %v3float %v
|
||||
%74 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%75 = OpLoad %int %74
|
||||
%77 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2
|
||||
%78 = OpLoad %int %77
|
||||
%79 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%80 = OpLoad %int %79
|
||||
%83 = OpConvertSToF %float %75
|
||||
%84 = OpConvertSToF %float %78
|
||||
%85 = OpConvertSToF %float %80
|
||||
%86 = OpCompositeConstruct %v3float %83 %84 %85
|
||||
%87 = OpFOrdEqual %v3bool %73 %86
|
||||
%81 = OpAll %bool %87
|
||||
OpSelectionMerge %89 None
|
||||
OpBranchConditional %81 %90 %91
|
||||
%90 = OpLabel
|
||||
%92 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
|
||||
%93 = OpLoad %int %92
|
||||
%95 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3
|
||||
%96 = OpLoad %int %95
|
||||
%97 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3
|
||||
%98 = OpLoad %int %97
|
||||
%99 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
|
||||
%100 = OpLoad %int %99
|
||||
%101 = OpConvertSToF %float %93
|
||||
%102 = OpConvertSToF %float %96
|
||||
%103 = OpConvertSToF %float %98
|
||||
%104 = OpConvertSToF %float %100
|
||||
%105 = OpCompositeConstruct %v4float %101 %102 %103 %104
|
||||
OpStore %x_GLF_color %105
|
||||
OpBranch %89
|
||||
%91 = OpLabel
|
||||
%106 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3
|
||||
%107 = OpLoad %int %106
|
||||
%108 = OpConvertSToF %float %107
|
||||
%109 = OpCompositeConstruct %v4float %108 %108 %108 %108
|
||||
OpStore %x_GLF_color %109
|
||||
OpBranch %89
|
||||
%89 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %110
|
||||
%tint_symbol = OpFunctionParameter %main_out
|
||||
%114 = OpLabel
|
||||
%115 = OpCompositeExtract %v4float %tint_symbol 0
|
||||
OpStore %tint_symbol_1 %115
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %20
|
||||
%117 = OpLabel
|
||||
%118 = OpFunctionCall %void %main_1
|
||||
%120 = OpLoad %v4float %x_GLF_color
|
||||
%121 = OpCompositeConstruct %main_out %120
|
||||
%119 = OpFunctionCall %void %tint_symbol_2 %121
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,71 @@
|
||||
type Arr = [[stride(16)]] array<i32, 4>;
|
||||
|
||||
[[block]]
|
||||
struct buf0 {
|
||||
x_GLF_uniform_int_values : Arr;
|
||||
};
|
||||
|
||||
type Arr_1 = [[stride(16)]] array<f32, 2>;
|
||||
|
||||
[[block]]
|
||||
struct buf1 {
|
||||
x_GLF_uniform_float_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 m : mat3x3<f32>;
|
||||
var a : i32;
|
||||
var arr : array<vec3<f32>, 2>;
|
||||
var v : vec3<f32>;
|
||||
let x_45 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
let x_46 : f32 = f32(x_45);
|
||||
m = mat3x3<f32>(vec3<f32>(x_46, 0.0, 0.0), vec3<f32>(0.0, x_46, 0.0), vec3<f32>(0.0, 0.0, x_46));
|
||||
let x_52 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
a = x_52;
|
||||
let x_53 : i32 = a;
|
||||
let x_54 : i32 = a;
|
||||
let x_56 : f32 = x_9.x_GLF_uniform_float_values[0];
|
||||
m[x_53][x_54] = x_56;
|
||||
let x_59 : vec3<f32> = m[1];
|
||||
let x_61 : vec3<f32> = m[1];
|
||||
arr = array<vec3<f32>, 2>(x_59, x_61);
|
||||
let x_64 : f32 = x_9.x_GLF_uniform_float_values[1];
|
||||
v = vec3<f32>(x_64, x_64, x_64);
|
||||
let x_66 : i32 = a;
|
||||
let x_68 : vec3<f32> = arr[x_66];
|
||||
let x_69 : vec3<f32> = v;
|
||||
v = (x_69 + x_68);
|
||||
let x_71 : vec3<f32> = v;
|
||||
let x_73 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_76 : i32 = x_6.x_GLF_uniform_int_values[2];
|
||||
let x_79 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
if (all((x_71 == vec3<f32>(f32(x_73), f32(x_76), f32(x_79))))) {
|
||||
let x_88 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
let x_91 : i32 = x_6.x_GLF_uniform_int_values[3];
|
||||
let x_94 : i32 = x_6.x_GLF_uniform_int_values[3];
|
||||
let x_97 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
x_GLF_color = vec4<f32>(f32(x_88), f32(x_91), f32(x_94), f32(x_97));
|
||||
} else {
|
||||
let x_101 : i32 = x_6.x_GLF_uniform_int_values[3];
|
||||
let x_102 : f32 = f32(x_101);
|
||||
x_GLF_color = vec4<f32>(x_102, x_102, x_102, x_102);
|
||||
}
|
||||
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,71 @@
|
||||
type Arr = [[stride(16)]] array<i32, 4>;
|
||||
|
||||
[[block]]
|
||||
struct buf0 {
|
||||
x_GLF_uniform_int_values : Arr;
|
||||
};
|
||||
|
||||
type Arr_1 = [[stride(16)]] array<f32, 2>;
|
||||
|
||||
[[block]]
|
||||
struct buf1 {
|
||||
x_GLF_uniform_float_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 m : mat3x3<f32>;
|
||||
var a : i32;
|
||||
var arr : array<vec3<f32>, 2>;
|
||||
var v : vec3<f32>;
|
||||
let x_45 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
let x_46 : f32 = f32(x_45);
|
||||
m = mat3x3<f32>(vec3<f32>(x_46, 0.0, 0.0), vec3<f32>(0.0, x_46, 0.0), vec3<f32>(0.0, 0.0, x_46));
|
||||
let x_52 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
a = x_52;
|
||||
let x_53 : i32 = a;
|
||||
let x_54 : i32 = a;
|
||||
let x_56 : f32 = x_9.x_GLF_uniform_float_values[0];
|
||||
m[x_53][x_54] = x_56;
|
||||
let x_59 : vec3<f32> = m[1];
|
||||
let x_61 : vec3<f32> = m[1];
|
||||
arr = array<vec3<f32>, 2>(x_59, x_61);
|
||||
let x_64 : f32 = x_9.x_GLF_uniform_float_values[1];
|
||||
v = vec3<f32>(x_64, x_64, x_64);
|
||||
let x_66 : i32 = a;
|
||||
let x_68 : vec3<f32> = arr[x_66];
|
||||
let x_69 : vec3<f32> = v;
|
||||
v = (x_69 + x_68);
|
||||
let x_71 : vec3<f32> = v;
|
||||
let x_73 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_76 : i32 = x_6.x_GLF_uniform_int_values[2];
|
||||
let x_79 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
if (all((x_71 == vec3<f32>(f32(x_73), f32(x_76), f32(x_79))))) {
|
||||
let x_88 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
let x_91 : i32 = x_6.x_GLF_uniform_int_values[3];
|
||||
let x_94 : i32 = x_6.x_GLF_uniform_int_values[3];
|
||||
let x_97 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
x_GLF_color = vec4<f32>(f32(x_88), f32(x_91), f32(x_94), f32(x_97));
|
||||
} else {
|
||||
let x_101 : i32 = x_6.x_GLF_uniform_int_values[3];
|
||||
let x_102 : f32 = f32(x_101);
|
||||
x_GLF_color = vec4<f32>(x_102, x_102, x_102, x_102);
|
||||
}
|
||||
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,70 @@
|
||||
void set_float3(inout float3 vec, int idx, float val) {
|
||||
vec = (idx.xxx == int3(0, 1, 2)) ? val.xxx : vec;
|
||||
}
|
||||
|
||||
cbuffer cbuffer_x_6 : register(b0, space0) {
|
||||
uint4 x_6[4];
|
||||
};
|
||||
cbuffer cbuffer_x_9 : register(b1, space0) {
|
||||
uint4 x_9[2];
|
||||
};
|
||||
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
void main_1() {
|
||||
float3x3 m = float3x3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
|
||||
int a = 0;
|
||||
float3 arr[2] = (float3[2])0;
|
||||
float3 v = float3(0.0f, 0.0f, 0.0f);
|
||||
const uint scalar_offset = ((16u * uint(0))) / 4;
|
||||
const int x_45 = asint(x_6[scalar_offset / 4][scalar_offset % 4]);
|
||||
const float x_46 = float(x_45);
|
||||
m = float3x3(float3(x_46, 0.0f, 0.0f), float3(0.0f, x_46, 0.0f), float3(0.0f, 0.0f, x_46));
|
||||
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
|
||||
const int x_52 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]);
|
||||
a = x_52;
|
||||
const int x_53 = a;
|
||||
const int x_54 = a;
|
||||
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
|
||||
const float x_56 = asfloat(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]);
|
||||
set_float3(m[x_53], x_54, x_56);
|
||||
const float3 x_59 = m[1];
|
||||
const float3 x_61 = m[1];
|
||||
const float3 tint_symbol_4[2] = {x_59, x_61};
|
||||
arr = tint_symbol_4;
|
||||
const float x_64 = asfloat(x_9[1].x);
|
||||
v = float3(x_64, x_64, x_64);
|
||||
const float3 x_68 = arr[a];
|
||||
v = (v + x_68);
|
||||
const float3 x_71 = v;
|
||||
const int x_73 = asint(x_6[1].x);
|
||||
const int x_76 = asint(x_6[2].x);
|
||||
const int x_79 = asint(x_6[1].x);
|
||||
if (all((x_71 == float3(float(x_73), float(x_76), float(x_79))))) {
|
||||
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
|
||||
const int x_88 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]);
|
||||
const int x_91 = asint(x_6[3].x);
|
||||
const int x_94 = asint(x_6[3].x);
|
||||
const uint scalar_offset_4 = ((16u * uint(0))) / 4;
|
||||
const int x_97 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]);
|
||||
x_GLF_color = float4(float(x_88), float(x_91), float(x_94), float(x_97));
|
||||
} else {
|
||||
const int x_101 = asint(x_6[3].x);
|
||||
const float x_102 = float(x_101);
|
||||
x_GLF_color = float4(x_102, x_102, x_102, x_102);
|
||||
}
|
||||
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,83 @@
|
||||
#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 tint_padded_array_element_1 {
|
||||
/* 0x0000 */ float el;
|
||||
/* 0x0004 */ int8_t tint_pad_1[12];
|
||||
};
|
||||
struct tint_array_wrapper_1 {
|
||||
/* 0x0000 */ tint_padded_array_element_1 arr[2];
|
||||
};
|
||||
struct buf1 {
|
||||
/* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values;
|
||||
};
|
||||
struct tint_array_wrapper_2 {
|
||||
float3 arr[2];
|
||||
};
|
||||
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) {
|
||||
float3x3 m = float3x3(0.0f);
|
||||
int a = 0;
|
||||
tint_array_wrapper_2 arr = {};
|
||||
float3 v = 0.0f;
|
||||
int const x_45 = x_6.x_GLF_uniform_int_values.arr[0].el;
|
||||
float const x_46 = float(x_45);
|
||||
m = float3x3(float3(x_46, 0.0f, 0.0f), float3(0.0f, x_46, 0.0f), float3(0.0f, 0.0f, x_46));
|
||||
int const x_52 = x_6.x_GLF_uniform_int_values.arr[0].el;
|
||||
a = x_52;
|
||||
int const x_53 = a;
|
||||
int const x_54 = a;
|
||||
float const x_56 = x_9.x_GLF_uniform_float_values.arr[0].el;
|
||||
m[x_53][x_54] = x_56;
|
||||
float3 const x_59 = m[1];
|
||||
float3 const x_61 = m[1];
|
||||
tint_array_wrapper_2 const tint_symbol_3 = {.arr={x_59, x_61}};
|
||||
arr = tint_symbol_3;
|
||||
float const x_64 = x_9.x_GLF_uniform_float_values.arr[1].el;
|
||||
v = float3(x_64, x_64, x_64);
|
||||
int const x_66 = a;
|
||||
float3 const x_68 = arr.arr[x_66];
|
||||
float3 const x_69 = v;
|
||||
v = (x_69 + x_68);
|
||||
float3 const x_71 = v;
|
||||
int const x_73 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_76 = x_6.x_GLF_uniform_int_values.arr[2].el;
|
||||
int const x_79 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
if (all((x_71 == float3(float(x_73), float(x_76), float(x_79))))) {
|
||||
int const x_88 = x_6.x_GLF_uniform_int_values.arr[0].el;
|
||||
int const x_91 = x_6.x_GLF_uniform_int_values.arr[3].el;
|
||||
int const x_94 = x_6.x_GLF_uniform_int_values.arr[3].el;
|
||||
int const x_97 = x_6.x_GLF_uniform_int_values.arr[0].el;
|
||||
*(tint_symbol_5) = float4(float(x_88), float(x_91), float(x_94), float(x_97));
|
||||
} else {
|
||||
int const x_101 = x_6.x_GLF_uniform_int_values.arr[3].el;
|
||||
float const x_102 = float(x_101);
|
||||
*(tint_symbol_5) = float4(x_102, x_102, x_102, x_102);
|
||||
}
|
||||
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,182 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 122
|
||||
; 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_6 "x_6"
|
||||
OpName %buf1 "buf1"
|
||||
OpMemberName %buf1 0 "x_GLF_uniform_float_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 %m "m"
|
||||
OpName %a "a"
|
||||
OpName %arr "arr"
|
||||
OpName %v "v"
|
||||
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_6 NonWritable
|
||||
OpDecorate %x_6 DescriptorSet 0
|
||||
OpDecorate %x_6 Binding 0
|
||||
OpDecorate %buf1 Block
|
||||
OpMemberDecorate %buf1 0 Offset 0
|
||||
OpDecorate %_arr_float_uint_2 ArrayStride 16
|
||||
OpDecorate %x_9 NonWritable
|
||||
OpDecorate %x_9 DescriptorSet 0
|
||||
OpDecorate %x_9 Binding 1
|
||||
OpDecorate %tint_symbol_1 Location 0
|
||||
OpDecorate %_arr_v3float_uint_2 ArrayStride 16
|
||||
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_6 = OpVariable %_ptr_Uniform_buf0 Uniform
|
||||
%float = OpTypeFloat 32
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%buf1 = OpTypeStruct %_arr_float_uint_2
|
||||
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
|
||||
%x_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
|
||||
%v3float = OpTypeVector %float 3
|
||||
%mat3v3float = OpTypeMatrix %v3float 3
|
||||
%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
|
||||
%28 = OpConstantNull %mat3v3float
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%31 = OpConstantNull %int
|
||||
%_arr_v3float_uint_2 = OpTypeArray %v3float %uint_2
|
||||
%_ptr_Function__arr_v3float_uint_2 = OpTypePointer Function %_arr_v3float_uint_2
|
||||
%35 = OpConstantNull %_arr_v3float_uint_2
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%38 = OpConstantNull %v3float
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%int_1 = OpConstant %int 1
|
||||
%int_2 = OpConstant %int 2
|
||||
%bool = OpTypeBool
|
||||
%v3bool = OpTypeVector %bool 3
|
||||
%int_3 = OpConstant %int 3
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%110 = OpTypeFunction %void %main_out
|
||||
%main_1 = OpFunction %void None %20
|
||||
%23 = OpLabel
|
||||
%m = OpVariable %_ptr_Function_mat3v3float Function %28
|
||||
%a = OpVariable %_ptr_Function_int Function %31
|
||||
%arr = OpVariable %_ptr_Function__arr_v3float_uint_2 Function %35
|
||||
%v = OpVariable %_ptr_Function_v3float Function %38
|
||||
%42 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
|
||||
%43 = OpLoad %int %42
|
||||
%44 = OpConvertSToF %float %43
|
||||
%46 = OpCompositeConstruct %v3float %44 %float_0 %float_0
|
||||
%47 = OpCompositeConstruct %v3float %float_0 %44 %float_0
|
||||
%48 = OpCompositeConstruct %v3float %float_0 %float_0 %44
|
||||
%49 = OpCompositeConstruct %mat3v3float %46 %47 %48
|
||||
OpStore %m %49
|
||||
%50 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
|
||||
%51 = OpLoad %int %50
|
||||
OpStore %a %51
|
||||
%52 = OpLoad %int %a
|
||||
%53 = OpLoad %int %a
|
||||
%55 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0
|
||||
%56 = OpLoad %float %55
|
||||
%58 = OpAccessChain %_ptr_Function_float %m %52 %53
|
||||
OpStore %58 %56
|
||||
%60 = OpAccessChain %_ptr_Function_v3float %m %int_1
|
||||
%61 = OpLoad %v3float %60
|
||||
%62 = OpAccessChain %_ptr_Function_v3float %m %int_1
|
||||
%63 = OpLoad %v3float %62
|
||||
%64 = OpCompositeConstruct %_arr_v3float_uint_2 %61 %63
|
||||
OpStore %arr %64
|
||||
%65 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1
|
||||
%66 = OpLoad %float %65
|
||||
%67 = OpCompositeConstruct %v3float %66 %66 %66
|
||||
OpStore %v %67
|
||||
%68 = OpLoad %int %a
|
||||
%69 = OpAccessChain %_ptr_Function_v3float %arr %68
|
||||
%70 = OpLoad %v3float %69
|
||||
%71 = OpLoad %v3float %v
|
||||
%72 = OpFAdd %v3float %71 %70
|
||||
OpStore %v %72
|
||||
%73 = OpLoad %v3float %v
|
||||
%74 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%75 = OpLoad %int %74
|
||||
%77 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2
|
||||
%78 = OpLoad %int %77
|
||||
%79 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%80 = OpLoad %int %79
|
||||
%83 = OpConvertSToF %float %75
|
||||
%84 = OpConvertSToF %float %78
|
||||
%85 = OpConvertSToF %float %80
|
||||
%86 = OpCompositeConstruct %v3float %83 %84 %85
|
||||
%87 = OpFOrdEqual %v3bool %73 %86
|
||||
%81 = OpAll %bool %87
|
||||
OpSelectionMerge %89 None
|
||||
OpBranchConditional %81 %90 %91
|
||||
%90 = OpLabel
|
||||
%92 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
|
||||
%93 = OpLoad %int %92
|
||||
%95 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3
|
||||
%96 = OpLoad %int %95
|
||||
%97 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3
|
||||
%98 = OpLoad %int %97
|
||||
%99 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
|
||||
%100 = OpLoad %int %99
|
||||
%101 = OpConvertSToF %float %93
|
||||
%102 = OpConvertSToF %float %96
|
||||
%103 = OpConvertSToF %float %98
|
||||
%104 = OpConvertSToF %float %100
|
||||
%105 = OpCompositeConstruct %v4float %101 %102 %103 %104
|
||||
OpStore %x_GLF_color %105
|
||||
OpBranch %89
|
||||
%91 = OpLabel
|
||||
%106 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3
|
||||
%107 = OpLoad %int %106
|
||||
%108 = OpConvertSToF %float %107
|
||||
%109 = OpCompositeConstruct %v4float %108 %108 %108 %108
|
||||
OpStore %x_GLF_color %109
|
||||
OpBranch %89
|
||||
%89 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %110
|
||||
%tint_symbol = OpFunctionParameter %main_out
|
||||
%114 = OpLabel
|
||||
%115 = OpCompositeExtract %v4float %tint_symbol 0
|
||||
OpStore %tint_symbol_1 %115
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %20
|
||||
%117 = OpLabel
|
||||
%118 = OpFunctionCall %void %main_1
|
||||
%120 = OpLoad %v4float %x_GLF_color
|
||||
%121 = OpCompositeConstruct %main_out %120
|
||||
%119 = OpFunctionCall %void %tint_symbol_2 %121
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,71 @@
|
||||
type Arr = [[stride(16)]] array<i32, 4>;
|
||||
|
||||
[[block]]
|
||||
struct buf0 {
|
||||
x_GLF_uniform_int_values : Arr;
|
||||
};
|
||||
|
||||
type Arr_1 = [[stride(16)]] array<f32, 2>;
|
||||
|
||||
[[block]]
|
||||
struct buf1 {
|
||||
x_GLF_uniform_float_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 m : mat3x3<f32>;
|
||||
var a : i32;
|
||||
var arr : array<vec3<f32>, 2>;
|
||||
var v : vec3<f32>;
|
||||
let x_45 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
let x_46 : f32 = f32(x_45);
|
||||
m = mat3x3<f32>(vec3<f32>(x_46, 0.0, 0.0), vec3<f32>(0.0, x_46, 0.0), vec3<f32>(0.0, 0.0, x_46));
|
||||
let x_52 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
a = x_52;
|
||||
let x_53 : i32 = a;
|
||||
let x_54 : i32 = a;
|
||||
let x_56 : f32 = x_9.x_GLF_uniform_float_values[0];
|
||||
m[x_53][x_54] = x_56;
|
||||
let x_59 : vec3<f32> = m[1];
|
||||
let x_61 : vec3<f32> = m[1];
|
||||
arr = array<vec3<f32>, 2>(x_59, x_61);
|
||||
let x_64 : f32 = x_9.x_GLF_uniform_float_values[1];
|
||||
v = vec3<f32>(x_64, x_64, x_64);
|
||||
let x_66 : i32 = a;
|
||||
let x_68 : vec3<f32> = arr[x_66];
|
||||
let x_69 : vec3<f32> = v;
|
||||
v = (x_69 + x_68);
|
||||
let x_71 : vec3<f32> = v;
|
||||
let x_73 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_76 : i32 = x_6.x_GLF_uniform_int_values[2];
|
||||
let x_79 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
if (all((x_71 == vec3<f32>(f32(x_73), f32(x_76), f32(x_79))))) {
|
||||
let x_88 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
let x_91 : i32 = x_6.x_GLF_uniform_int_values[3];
|
||||
let x_94 : i32 = x_6.x_GLF_uniform_int_values[3];
|
||||
let x_97 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
x_GLF_color = vec4<f32>(f32(x_88), f32(x_91), f32(x_94), f32(x_97));
|
||||
} else {
|
||||
let x_101 : i32 = x_6.x_GLF_uniform_int_values[3];
|
||||
let x_102 : f32 = f32(x_101);
|
||||
x_GLF_color = vec4<f32>(x_102, x_102, x_102, x_102);
|
||||
}
|
||||
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