mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-14 15:46:28 +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,184 @@
|
||||
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 %v "v"
|
||||
OpName %buf1 "buf1"
|
||||
OpMemberName %buf1 0 "_GLF_uniform_int_values"
|
||||
OpName %_ ""
|
||||
OpName %i "i"
|
||||
OpName %buf0 "buf0"
|
||||
OpMemberName %buf0 0 "_GLF_uniform_float_values"
|
||||
OpName %__0 ""
|
||||
OpName %_GLF_color "_GLF_color"
|
||||
OpDecorate %_arr_int_uint_5 ArrayStride 16
|
||||
OpMemberDecorate %buf1 0 Offset 0
|
||||
OpDecorate %buf1 Block
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 1
|
||||
OpDecorate %_arr_float_uint_2 ArrayStride 16
|
||||
OpMemberDecorate %buf0 0 Offset 0
|
||||
OpDecorate %buf0 Block
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 0
|
||||
OpDecorate %_GLF_color Location 0
|
||||
%void = OpTypeVoid
|
||||
%13 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%int = OpTypeInt 32 1
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_5 = OpConstant %uint 5
|
||||
%_arr_int_uint_5 = OpTypeArray %int %uint_5
|
||||
%buf1 = OpTypeStruct %_arr_int_uint_5
|
||||
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
|
||||
%_ = OpVariable %_ptr_Uniform_buf1 Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_4 = OpConstant %int 4
|
||||
%bool = OpTypeBool
|
||||
%mat4v4float = OpTypeMatrix %v4float 4
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_0 = OpConstant %float 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
|
||||
%__0 = OpVariable %_ptr_Uniform_buf0 Uniform
|
||||
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%v4bool = OpTypeVector %bool 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_GLF_color = OpVariable %_ptr_Output_v4float Output
|
||||
%main = OpFunction %void None %13
|
||||
%38 = OpLabel
|
||||
%v = OpVariable %_ptr_Function_v4float Function
|
||||
%i = OpVariable %_ptr_Function_int Function
|
||||
%39 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
|
||||
%40 = OpLoad %int %39
|
||||
%41 = OpConvertSToF %float %40
|
||||
%42 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2
|
||||
%43 = OpLoad %int %42
|
||||
%44 = OpConvertSToF %float %43
|
||||
%45 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3
|
||||
%46 = OpLoad %int %45
|
||||
%47 = OpConvertSToF %float %46
|
||||
%48 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
|
||||
%49 = OpLoad %int %48
|
||||
%50 = OpConvertSToF %float %49
|
||||
%51 = OpCompositeConstruct %v4float %41 %44 %47 %50
|
||||
OpStore %v %51
|
||||
%52 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4
|
||||
%53 = OpLoad %int %52
|
||||
OpStore %i %53
|
||||
OpBranch %54
|
||||
%54 = OpLabel
|
||||
OpLoopMerge %55 %56 None
|
||||
OpBranch %57
|
||||
%57 = OpLabel
|
||||
%58 = OpLoad %int %i
|
||||
%59 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
|
||||
%60 = OpLoad %int %59
|
||||
%61 = OpSLessThan %bool %58 %60
|
||||
OpBranchConditional %61 %62 %55
|
||||
%62 = OpLabel
|
||||
%63 = OpLoad %v4float %v
|
||||
%64 = OpLoad %v4float %v
|
||||
%65 = OpLoad %v4float %v
|
||||
%66 = OpLoad %v4float %v
|
||||
%67 = OpCompositeExtract %float %63 0
|
||||
%68 = OpCompositeExtract %float %63 1
|
||||
%69 = OpCompositeExtract %float %63 2
|
||||
%70 = OpCompositeExtract %float %63 3
|
||||
%71 = OpCompositeExtract %float %64 0
|
||||
%72 = OpCompositeExtract %float %64 1
|
||||
%73 = OpCompositeExtract %float %64 2
|
||||
%74 = OpCompositeExtract %float %64 3
|
||||
%75 = OpCompositeExtract %float %65 0
|
||||
%76 = OpCompositeExtract %float %65 1
|
||||
%77 = OpCompositeExtract %float %65 2
|
||||
%78 = OpCompositeExtract %float %65 3
|
||||
%79 = OpCompositeExtract %float %66 0
|
||||
%80 = OpCompositeExtract %float %66 1
|
||||
%81 = OpCompositeExtract %float %66 2
|
||||
%82 = OpCompositeExtract %float %66 3
|
||||
%83 = OpCompositeConstruct %v4float %67 %68 %69 %70
|
||||
%84 = OpCompositeConstruct %v4float %71 %72 %73 %74
|
||||
%85 = OpCompositeConstruct %v4float %75 %76 %77 %78
|
||||
%86 = OpCompositeConstruct %v4float %79 %80 %81 %82
|
||||
%87 = OpCompositeConstruct %mat4v4float %83 %84 %85 %86
|
||||
%88 = OpLoad %int %i
|
||||
%89 = OpCompositeExtract %v4float %87 0
|
||||
%90 = OpVectorExtractDynamic %float %89 %88
|
||||
%91 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0
|
||||
%92 = OpLoad %float %91
|
||||
%93 = OpFOrdGreaterThan %bool %90 %92
|
||||
OpSelectionMerge %94 None
|
||||
OpBranchConditional %93 %95 %94
|
||||
%95 = OpLabel
|
||||
%96 = OpLoad %int %i
|
||||
%97 = OpLoad %v4float %v
|
||||
%98 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_1
|
||||
%99 = OpLoad %float %98
|
||||
%100 = OpCompositeConstruct %v4float %99 %99 %99 %99
|
||||
%101 = OpAccessChain %_ptr_Uniform_float %__0 %int_0 %int_0
|
||||
%102 = OpLoad %float %101
|
||||
%103 = OpCompositeConstruct %v4float %102 %102 %102 %102
|
||||
%104 = OpExtInst %v4float %1 FClamp %97 %100 %103
|
||||
%105 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
|
||||
%106 = OpLoad %int %105
|
||||
%107 = OpVectorExtractDynamic %float %104 %106
|
||||
%108 = OpAccessChain %_ptr_Function_float %v %96
|
||||
OpStore %108 %107
|
||||
OpBranch %94
|
||||
%94 = OpLabel
|
||||
OpBranch %56
|
||||
%56 = OpLabel
|
||||
%109 = OpLoad %int %i
|
||||
%110 = OpIAdd %int %109 %int_1
|
||||
OpStore %i %110
|
||||
OpBranch %54
|
||||
%55 = OpLabel
|
||||
%111 = OpLoad %v4float %v
|
||||
%112 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
|
||||
%113 = OpLoad %int %112
|
||||
%114 = OpConvertSToF %float %113
|
||||
%115 = OpCompositeConstruct %v4float %114 %114 %114 %114
|
||||
%116 = OpFOrdEqual %v4bool %111 %115
|
||||
%117 = OpAll %bool %116
|
||||
OpSelectionMerge %118 None
|
||||
OpBranchConditional %117 %119 %120
|
||||
%119 = OpLabel
|
||||
%121 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
|
||||
%122 = OpLoad %int %121
|
||||
%123 = OpConvertSToF %float %122
|
||||
%124 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4
|
||||
%125 = OpLoad %int %124
|
||||
%126 = OpConvertSToF %float %125
|
||||
%127 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4
|
||||
%128 = OpLoad %int %127
|
||||
%129 = OpConvertSToF %float %128
|
||||
%130 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
|
||||
%131 = OpLoad %int %130
|
||||
%132 = OpConvertSToF %float %131
|
||||
%133 = OpCompositeConstruct %v4float %123 %126 %129 %132
|
||||
OpStore %_GLF_color %133
|
||||
OpBranch %118
|
||||
%120 = OpLabel
|
||||
%134 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_4
|
||||
%135 = OpLoad %int %134
|
||||
%136 = OpConvertSToF %float %135
|
||||
%137 = OpCompositeConstruct %v4float %136 %136 %136 %136
|
||||
OpStore %_GLF_color %137
|
||||
OpBranch %118
|
||||
%118 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,81 @@
|
||||
void set_float4(inout float4 vec, int idx, float val) {
|
||||
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
|
||||
}
|
||||
|
||||
cbuffer cbuffer_x_6 : register(b1, space0) {
|
||||
uint4 x_6[5];
|
||||
};
|
||||
cbuffer cbuffer_x_9 : register(b0, space0) {
|
||||
uint4 x_9[2];
|
||||
};
|
||||
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
void main_1() {
|
||||
float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
int i = 0;
|
||||
const int x_40 = asint(x_6[1].x);
|
||||
const int x_43 = asint(x_6[2].x);
|
||||
const int x_46 = asint(x_6[3].x);
|
||||
const uint scalar_offset = ((16u * uint(0))) / 4;
|
||||
const int x_49 = asint(x_6[scalar_offset / 4][scalar_offset % 4]);
|
||||
v = float4(float(x_40), float(x_43), float(x_46), float(x_49));
|
||||
const int x_53 = asint(x_6[4].x);
|
||||
i = x_53;
|
||||
while (true) {
|
||||
const int x_58 = i;
|
||||
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
|
||||
const int x_60 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]);
|
||||
if ((x_58 < x_60)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
const float4 x_63 = v;
|
||||
const float4 x_64 = v;
|
||||
const float4 x_65 = v;
|
||||
const float4 x_66 = v;
|
||||
const int x_88 = i;
|
||||
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
|
||||
const float x_92 = asfloat(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]);
|
||||
if ((float4x4(float4(x_63.x, x_63.y, x_63.z, x_63.w), float4(x_64.x, x_64.y, x_64.z, x_64.w), float4(x_65.x, x_65.y, x_65.z, x_65.w), float4(x_66.x, x_66.y, x_66.z, x_66.w))[0u][x_88] > x_92)) {
|
||||
const int x_96 = i;
|
||||
const float4 x_97 = v;
|
||||
const float x_99 = asfloat(x_9[1].x);
|
||||
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
|
||||
const float x_102 = asfloat(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]);
|
||||
const int x_106 = asint(x_6[1].x);
|
||||
set_float4(v, x_96, clamp(x_97, float4(x_99, x_99, x_99, x_99), float4(x_102, x_102, x_102, x_102))[x_106]);
|
||||
}
|
||||
{
|
||||
i = (i + 1);
|
||||
}
|
||||
}
|
||||
const float4 x_111 = v;
|
||||
const int x_113 = asint(x_6[1].x);
|
||||
const float x_114 = float(x_113);
|
||||
if (all((x_111 == float4(x_114, x_114, x_114, x_114)))) {
|
||||
const int x_122 = asint(x_6[1].x);
|
||||
const int x_125 = asint(x_6[4].x);
|
||||
const int x_128 = asint(x_6[4].x);
|
||||
const int x_131 = asint(x_6[1].x);
|
||||
x_GLF_color = float4(float(x_122), float(x_125), float(x_128), float(x_131));
|
||||
} else {
|
||||
const int x_135 = asint(x_6[4].x);
|
||||
const float x_136 = float(x_135);
|
||||
x_GLF_color = float4(x_136, x_136, x_136, x_136);
|
||||
}
|
||||
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_4 = {tint_symbol_1.x_GLF_color_1};
|
||||
return tint_symbol_4;
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
#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[5];
|
||||
};
|
||||
struct buf1 {
|
||||
/* 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 buf0 {
|
||||
/* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values;
|
||||
};
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol_1 {
|
||||
float4 x_GLF_color_1 [[color(0)]];
|
||||
};
|
||||
|
||||
void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_4) {
|
||||
float4 v = 0.0f;
|
||||
int i = 0;
|
||||
int const x_40 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_43 = x_6.x_GLF_uniform_int_values.arr[2].el;
|
||||
int const x_46 = x_6.x_GLF_uniform_int_values.arr[3].el;
|
||||
int const x_49 = x_6.x_GLF_uniform_int_values.arr[0].el;
|
||||
v = float4(float(x_40), float(x_43), float(x_46), float(x_49));
|
||||
int const x_53 = x_6.x_GLF_uniform_int_values.arr[4].el;
|
||||
i = x_53;
|
||||
while (true) {
|
||||
int const x_58 = i;
|
||||
int const x_60 = x_6.x_GLF_uniform_int_values.arr[0].el;
|
||||
if ((x_58 < x_60)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
float4 const x_63 = v;
|
||||
float4 const x_64 = v;
|
||||
float4 const x_65 = v;
|
||||
float4 const x_66 = v;
|
||||
int const x_88 = i;
|
||||
float const x_92 = x_9.x_GLF_uniform_float_values.arr[0].el;
|
||||
if ((float4x4(float4(x_63.x, x_63.y, x_63.z, x_63.w), float4(x_64.x, x_64.y, x_64.z, x_64.w), float4(x_65.x, x_65.y, x_65.z, x_65.w), float4(x_66.x, x_66.y, x_66.z, x_66.w))[0u][x_88] > x_92)) {
|
||||
int const x_96 = i;
|
||||
float4 const x_97 = v;
|
||||
float const x_99 = x_9.x_GLF_uniform_float_values.arr[1].el;
|
||||
float const x_102 = x_9.x_GLF_uniform_float_values.arr[0].el;
|
||||
int const x_106 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
v[x_96] = clamp(x_97, float4(x_99, x_99, x_99, x_99), float4(x_102, x_102, x_102, x_102))[x_106];
|
||||
}
|
||||
{
|
||||
int const x_109 = i;
|
||||
i = (x_109 + 1);
|
||||
}
|
||||
}
|
||||
float4 const x_111 = v;
|
||||
int const x_113 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
float const x_114 = float(x_113);
|
||||
if (all((x_111 == float4(x_114, x_114, x_114, x_114)))) {
|
||||
int const x_122 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_125 = x_6.x_GLF_uniform_int_values.arr[4].el;
|
||||
int const x_128 = x_6.x_GLF_uniform_int_values.arr[4].el;
|
||||
int const x_131 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
*(tint_symbol_4) = float4(float(x_122), float(x_125), float(x_128), float(x_131));
|
||||
} else {
|
||||
int const x_135 = x_6.x_GLF_uniform_int_values.arr[4].el;
|
||||
float const x_136 = float(x_135);
|
||||
*(tint_symbol_4) = float4(x_136, x_136, x_136, x_136);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) {
|
||||
thread float4 tint_symbol_5 = 0.0f;
|
||||
main_1(x_6, x_9, &(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,222 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 155
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%109 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %tint_symbol_1
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %buf1 "buf1"
|
||||
OpMemberName %buf1 0 "x_GLF_uniform_int_values"
|
||||
OpName %x_6 "x_6"
|
||||
OpName %buf0 "buf0"
|
||||
OpMemberName %buf0 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 %v "v"
|
||||
OpName %i "i"
|
||||
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 %buf1 Block
|
||||
OpMemberDecorate %buf1 0 Offset 0
|
||||
OpDecorate %_arr_int_uint_5 ArrayStride 16
|
||||
OpDecorate %x_6 NonWritable
|
||||
OpDecorate %x_6 DescriptorSet 0
|
||||
OpDecorate %x_6 Binding 1
|
||||
OpDecorate %buf0 Block
|
||||
OpMemberDecorate %buf0 0 Offset 0
|
||||
OpDecorate %_arr_float_uint_2 ArrayStride 16
|
||||
OpDecorate %x_9 NonWritable
|
||||
OpDecorate %x_9 DescriptorSet 0
|
||||
OpDecorate %x_9 Binding 0
|
||||
OpDecorate %tint_symbol_1 Location 0
|
||||
OpMemberDecorate %main_out 0 Offset 0
|
||||
%int = OpTypeInt 32 1
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_5 = OpConstant %uint 5
|
||||
%_arr_int_uint_5 = OpTypeArray %int %uint_5
|
||||
%buf1 = OpTypeStruct %_arr_int_uint_5
|
||||
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
|
||||
%x_6 = OpVariable %_ptr_Uniform_buf1 Uniform
|
||||
%float = OpTypeFloat 32
|
||||
%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_9 = OpVariable %_ptr_Uniform_buf0 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
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%28 = OpConstantNull %int
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_4 = OpConstant %int 4
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
||||
%mat4v4float = OpTypeMatrix %v4float 4
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%v4bool = OpTypeVector %bool 4
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%143 = OpTypeFunction %void %main_out
|
||||
%main_1 = OpFunction %void None %20
|
||||
%23 = OpLabel
|
||||
%v = OpVariable %_ptr_Function_v4float Function %17
|
||||
%i = OpVariable %_ptr_Function_int Function %28
|
||||
%32 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%33 = OpLoad %int %32
|
||||
%35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2
|
||||
%36 = OpLoad %int %35
|
||||
%38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3
|
||||
%39 = OpLoad %int %38
|
||||
%41 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
|
||||
%42 = OpLoad %int %41
|
||||
%43 = OpConvertSToF %float %33
|
||||
%44 = OpConvertSToF %float %36
|
||||
%45 = OpConvertSToF %float %39
|
||||
%46 = OpConvertSToF %float %42
|
||||
%47 = OpCompositeConstruct %v4float %43 %44 %45 %46
|
||||
OpStore %v %47
|
||||
%49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4
|
||||
%50 = OpLoad %int %49
|
||||
OpStore %i %50
|
||||
OpBranch %51
|
||||
%51 = OpLabel
|
||||
OpLoopMerge %52 %53 None
|
||||
OpBranch %54
|
||||
%54 = OpLabel
|
||||
%55 = OpLoad %int %i
|
||||
%56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
|
||||
%57 = OpLoad %int %56
|
||||
%58 = OpSLessThan %bool %55 %57
|
||||
OpSelectionMerge %60 None
|
||||
OpBranchConditional %58 %61 %62
|
||||
%61 = OpLabel
|
||||
OpBranch %60
|
||||
%62 = OpLabel
|
||||
OpBranch %52
|
||||
%60 = OpLabel
|
||||
%63 = OpLoad %v4float %v
|
||||
%64 = OpLoad %v4float %v
|
||||
%65 = OpLoad %v4float %v
|
||||
%66 = OpLoad %v4float %v
|
||||
%67 = OpLoad %int %i
|
||||
%69 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0
|
||||
%70 = OpLoad %float %69
|
||||
%72 = OpCompositeExtract %float %63 0
|
||||
%73 = OpCompositeExtract %float %63 1
|
||||
%74 = OpCompositeExtract %float %63 2
|
||||
%75 = OpCompositeExtract %float %63 3
|
||||
%76 = OpCompositeConstruct %v4float %72 %73 %74 %75
|
||||
%77 = OpCompositeExtract %float %64 0
|
||||
%78 = OpCompositeExtract %float %64 1
|
||||
%79 = OpCompositeExtract %float %64 2
|
||||
%80 = OpCompositeExtract %float %64 3
|
||||
%81 = OpCompositeConstruct %v4float %77 %78 %79 %80
|
||||
%82 = OpCompositeExtract %float %65 0
|
||||
%83 = OpCompositeExtract %float %65 1
|
||||
%84 = OpCompositeExtract %float %65 2
|
||||
%85 = OpCompositeExtract %float %65 3
|
||||
%86 = OpCompositeConstruct %v4float %82 %83 %84 %85
|
||||
%87 = OpCompositeExtract %float %66 0
|
||||
%88 = OpCompositeExtract %float %66 1
|
||||
%89 = OpCompositeExtract %float %66 2
|
||||
%90 = OpCompositeExtract %float %66 3
|
||||
%91 = OpCompositeConstruct %v4float %87 %88 %89 %90
|
||||
%92 = OpCompositeConstruct %mat4v4float %76 %81 %86 %91
|
||||
%93 = OpCompositeExtract %v4float %92 0
|
||||
%94 = OpVectorExtractDynamic %float %93 %67
|
||||
%95 = OpFOrdGreaterThan %bool %94 %70
|
||||
OpSelectionMerge %96 None
|
||||
OpBranchConditional %95 %97 %96
|
||||
%97 = OpLabel
|
||||
%98 = OpLoad %int %i
|
||||
%99 = OpLoad %v4float %v
|
||||
%100 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1
|
||||
%101 = OpLoad %float %100
|
||||
%102 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0
|
||||
%103 = OpLoad %float %102
|
||||
%104 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%105 = OpLoad %int %104
|
||||
%107 = OpAccessChain %_ptr_Function_float %v %98
|
||||
%110 = OpCompositeConstruct %v4float %101 %101 %101 %101
|
||||
%111 = OpCompositeConstruct %v4float %103 %103 %103 %103
|
||||
%108 = OpExtInst %v4float %109 NClamp %99 %110 %111
|
||||
%112 = OpVectorExtractDynamic %float %108 %105
|
||||
OpStore %107 %112
|
||||
OpBranch %96
|
||||
%96 = OpLabel
|
||||
OpBranch %53
|
||||
%53 = OpLabel
|
||||
%113 = OpLoad %int %i
|
||||
%114 = OpIAdd %int %113 %int_1
|
||||
OpStore %i %114
|
||||
OpBranch %51
|
||||
%52 = OpLabel
|
||||
%115 = OpLoad %v4float %v
|
||||
%116 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%117 = OpLoad %int %116
|
||||
%118 = OpConvertSToF %float %117
|
||||
%120 = OpCompositeConstruct %v4float %118 %118 %118 %118
|
||||
%121 = OpFOrdEqual %v4bool %115 %120
|
||||
%119 = OpAll %bool %121
|
||||
OpSelectionMerge %123 None
|
||||
OpBranchConditional %119 %124 %125
|
||||
%124 = OpLabel
|
||||
%126 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%127 = OpLoad %int %126
|
||||
%128 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4
|
||||
%129 = OpLoad %int %128
|
||||
%130 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4
|
||||
%131 = OpLoad %int %130
|
||||
%132 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%133 = OpLoad %int %132
|
||||
%134 = OpConvertSToF %float %127
|
||||
%135 = OpConvertSToF %float %129
|
||||
%136 = OpConvertSToF %float %131
|
||||
%137 = OpConvertSToF %float %133
|
||||
%138 = OpCompositeConstruct %v4float %134 %135 %136 %137
|
||||
OpStore %x_GLF_color %138
|
||||
OpBranch %123
|
||||
%125 = OpLabel
|
||||
%139 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4
|
||||
%140 = OpLoad %int %139
|
||||
%141 = OpConvertSToF %float %140
|
||||
%142 = OpCompositeConstruct %v4float %141 %141 %141 %141
|
||||
OpStore %x_GLF_color %142
|
||||
OpBranch %123
|
||||
%123 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %143
|
||||
%tint_symbol = OpFunctionParameter %main_out
|
||||
%147 = OpLabel
|
||||
%148 = OpCompositeExtract %v4float %tint_symbol 0
|
||||
OpStore %tint_symbol_1 %148
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %20
|
||||
%150 = OpLabel
|
||||
%151 = OpFunctionCall %void %main_1
|
||||
%153 = OpLoad %v4float %x_GLF_color
|
||||
%154 = OpCompositeConstruct %main_out %153
|
||||
%152 = OpFunctionCall %void %tint_symbol_2 %154
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,84 @@
|
||||
type Arr = [[stride(16)]] array<i32, 5>;
|
||||
|
||||
[[block]]
|
||||
struct buf1 {
|
||||
x_GLF_uniform_int_values : Arr;
|
||||
};
|
||||
|
||||
type Arr_1 = [[stride(16)]] array<f32, 2>;
|
||||
|
||||
[[block]]
|
||||
struct buf0 {
|
||||
x_GLF_uniform_float_values : Arr_1;
|
||||
};
|
||||
|
||||
[[group(0), binding(1)]] var<uniform> x_6 : buf1;
|
||||
|
||||
[[group(0), binding(0)]] var<uniform> x_9 : buf0;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var v : vec4<f32>;
|
||||
var i : i32;
|
||||
let x_40 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_43 : i32 = x_6.x_GLF_uniform_int_values[2];
|
||||
let x_46 : i32 = x_6.x_GLF_uniform_int_values[3];
|
||||
let x_49 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
v = vec4<f32>(f32(x_40), f32(x_43), f32(x_46), f32(x_49));
|
||||
let x_53 : i32 = x_6.x_GLF_uniform_int_values[4];
|
||||
i = x_53;
|
||||
loop {
|
||||
let x_58 : i32 = i;
|
||||
let x_60 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
if ((x_58 < x_60)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_63 : vec4<f32> = v;
|
||||
let x_64 : vec4<f32> = v;
|
||||
let x_65 : vec4<f32> = v;
|
||||
let x_66 : vec4<f32> = v;
|
||||
let x_88 : i32 = i;
|
||||
let x_92 : f32 = x_9.x_GLF_uniform_float_values[0];
|
||||
if ((mat4x4<f32>(vec4<f32>(x_63.x, x_63.y, x_63.z, x_63.w), vec4<f32>(x_64.x, x_64.y, x_64.z, x_64.w), vec4<f32>(x_65.x, x_65.y, x_65.z, x_65.w), vec4<f32>(x_66.x, x_66.y, x_66.z, x_66.w))[0u][x_88] > x_92)) {
|
||||
let x_96 : i32 = i;
|
||||
let x_97 : vec4<f32> = v;
|
||||
let x_99 : f32 = x_9.x_GLF_uniform_float_values[1];
|
||||
let x_102 : f32 = x_9.x_GLF_uniform_float_values[0];
|
||||
let x_106 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
v[x_96] = clamp(x_97, vec4<f32>(x_99, x_99, x_99, x_99), vec4<f32>(x_102, x_102, x_102, x_102))[x_106];
|
||||
}
|
||||
|
||||
continuing {
|
||||
let x_109 : i32 = i;
|
||||
i = (x_109 + 1);
|
||||
}
|
||||
}
|
||||
let x_111 : vec4<f32> = v;
|
||||
let x_113 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_114 : f32 = f32(x_113);
|
||||
if (all((x_111 == vec4<f32>(x_114, x_114, x_114, x_114)))) {
|
||||
let x_122 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_125 : i32 = x_6.x_GLF_uniform_int_values[4];
|
||||
let x_128 : i32 = x_6.x_GLF_uniform_int_values[4];
|
||||
let x_131 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
x_GLF_color = vec4<f32>(f32(x_122), f32(x_125), f32(x_128), f32(x_131));
|
||||
} else {
|
||||
let x_135 : i32 = x_6.x_GLF_uniform_int_values[4];
|
||||
let x_136 : f32 = f32(x_135);
|
||||
x_GLF_color = vec4<f32>(x_136, x_136, x_136, x_136);
|
||||
}
|
||||
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,84 @@
|
||||
type Arr = [[stride(16)]] array<i32, 5>;
|
||||
|
||||
[[block]]
|
||||
struct buf1 {
|
||||
x_GLF_uniform_int_values : Arr;
|
||||
};
|
||||
|
||||
type Arr_1 = [[stride(16)]] array<f32, 2>;
|
||||
|
||||
[[block]]
|
||||
struct buf0 {
|
||||
x_GLF_uniform_float_values : Arr_1;
|
||||
};
|
||||
|
||||
[[group(0), binding(1)]] var<uniform> x_6 : buf1;
|
||||
|
||||
[[group(0), binding(0)]] var<uniform> x_9 : buf0;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var v : vec4<f32>;
|
||||
var i : i32;
|
||||
let x_40 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_43 : i32 = x_6.x_GLF_uniform_int_values[2];
|
||||
let x_46 : i32 = x_6.x_GLF_uniform_int_values[3];
|
||||
let x_49 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
v = vec4<f32>(f32(x_40), f32(x_43), f32(x_46), f32(x_49));
|
||||
let x_53 : i32 = x_6.x_GLF_uniform_int_values[4];
|
||||
i = x_53;
|
||||
loop {
|
||||
let x_58 : i32 = i;
|
||||
let x_60 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
if ((x_58 < x_60)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_63 : vec4<f32> = v;
|
||||
let x_64 : vec4<f32> = v;
|
||||
let x_65 : vec4<f32> = v;
|
||||
let x_66 : vec4<f32> = v;
|
||||
let x_88 : i32 = i;
|
||||
let x_92 : f32 = x_9.x_GLF_uniform_float_values[0];
|
||||
if ((mat4x4<f32>(vec4<f32>(x_63.x, x_63.y, x_63.z, x_63.w), vec4<f32>(x_64.x, x_64.y, x_64.z, x_64.w), vec4<f32>(x_65.x, x_65.y, x_65.z, x_65.w), vec4<f32>(x_66.x, x_66.y, x_66.z, x_66.w))[0u][x_88] > x_92)) {
|
||||
let x_96 : i32 = i;
|
||||
let x_97 : vec4<f32> = v;
|
||||
let x_99 : f32 = x_9.x_GLF_uniform_float_values[1];
|
||||
let x_102 : f32 = x_9.x_GLF_uniform_float_values[0];
|
||||
let x_106 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
v[x_96] = clamp(x_97, vec4<f32>(x_99, x_99, x_99, x_99), vec4<f32>(x_102, x_102, x_102, x_102))[x_106];
|
||||
}
|
||||
|
||||
continuing {
|
||||
let x_109 : i32 = i;
|
||||
i = (x_109 + 1);
|
||||
}
|
||||
}
|
||||
let x_111 : vec4<f32> = v;
|
||||
let x_113 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_114 : f32 = f32(x_113);
|
||||
if (all((x_111 == vec4<f32>(x_114, x_114, x_114, x_114)))) {
|
||||
let x_122 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_125 : i32 = x_6.x_GLF_uniform_int_values[4];
|
||||
let x_128 : i32 = x_6.x_GLF_uniform_int_values[4];
|
||||
let x_131 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
x_GLF_color = vec4<f32>(f32(x_122), f32(x_125), f32(x_128), f32(x_131));
|
||||
} else {
|
||||
let x_135 : i32 = x_6.x_GLF_uniform_int_values[4];
|
||||
let x_136 : f32 = f32(x_135);
|
||||
x_GLF_color = vec4<f32>(x_136, x_136, x_136, x_136);
|
||||
}
|
||||
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,81 @@
|
||||
void set_float4(inout float4 vec, int idx, float val) {
|
||||
vec = (idx.xxxx == int4(0, 1, 2, 3)) ? val.xxxx : vec;
|
||||
}
|
||||
|
||||
cbuffer cbuffer_x_6 : register(b1, space0) {
|
||||
uint4 x_6[5];
|
||||
};
|
||||
cbuffer cbuffer_x_9 : register(b0, space0) {
|
||||
uint4 x_9[2];
|
||||
};
|
||||
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
void main_1() {
|
||||
float4 v = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
int i = 0;
|
||||
const int x_40 = asint(x_6[1].x);
|
||||
const int x_43 = asint(x_6[2].x);
|
||||
const int x_46 = asint(x_6[3].x);
|
||||
const uint scalar_offset = ((16u * uint(0))) / 4;
|
||||
const int x_49 = asint(x_6[scalar_offset / 4][scalar_offset % 4]);
|
||||
v = float4(float(x_40), float(x_43), float(x_46), float(x_49));
|
||||
const int x_53 = asint(x_6[4].x);
|
||||
i = x_53;
|
||||
while (true) {
|
||||
const int x_58 = i;
|
||||
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
|
||||
const int x_60 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]);
|
||||
if ((x_58 < x_60)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
const float4 x_63 = v;
|
||||
const float4 x_64 = v;
|
||||
const float4 x_65 = v;
|
||||
const float4 x_66 = v;
|
||||
const int x_88 = i;
|
||||
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
|
||||
const float x_92 = asfloat(x_9[scalar_offset_2 / 4][scalar_offset_2 % 4]);
|
||||
if ((float4x4(float4(x_63.x, x_63.y, x_63.z, x_63.w), float4(x_64.x, x_64.y, x_64.z, x_64.w), float4(x_65.x, x_65.y, x_65.z, x_65.w), float4(x_66.x, x_66.y, x_66.z, x_66.w))[0u][x_88] > x_92)) {
|
||||
const int x_96 = i;
|
||||
const float4 x_97 = v;
|
||||
const float x_99 = asfloat(x_9[1].x);
|
||||
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
|
||||
const float x_102 = asfloat(x_9[scalar_offset_3 / 4][scalar_offset_3 % 4]);
|
||||
const int x_106 = asint(x_6[1].x);
|
||||
set_float4(v, x_96, clamp(x_97, float4(x_99, x_99, x_99, x_99), float4(x_102, x_102, x_102, x_102))[x_106]);
|
||||
}
|
||||
{
|
||||
i = (i + 1);
|
||||
}
|
||||
}
|
||||
const float4 x_111 = v;
|
||||
const int x_113 = asint(x_6[1].x);
|
||||
const float x_114 = float(x_113);
|
||||
if (all((x_111 == float4(x_114, x_114, x_114, x_114)))) {
|
||||
const int x_122 = asint(x_6[1].x);
|
||||
const int x_125 = asint(x_6[4].x);
|
||||
const int x_128 = asint(x_6[4].x);
|
||||
const int x_131 = asint(x_6[1].x);
|
||||
x_GLF_color = float4(float(x_122), float(x_125), float(x_128), float(x_131));
|
||||
} else {
|
||||
const int x_135 = asint(x_6[4].x);
|
||||
const float x_136 = float(x_135);
|
||||
x_GLF_color = float4(x_136, x_136, x_136, x_136);
|
||||
}
|
||||
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_4 = {tint_symbol_1.x_GLF_color_1};
|
||||
return tint_symbol_4;
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
#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[5];
|
||||
};
|
||||
struct buf1 {
|
||||
/* 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 buf0 {
|
||||
/* 0x0000 */ tint_array_wrapper_1 x_GLF_uniform_float_values;
|
||||
};
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol_1 {
|
||||
float4 x_GLF_color_1 [[color(0)]];
|
||||
};
|
||||
|
||||
void main_1(constant buf1& x_6, constant buf0& x_9, thread float4* const tint_symbol_4) {
|
||||
float4 v = 0.0f;
|
||||
int i = 0;
|
||||
int const x_40 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_43 = x_6.x_GLF_uniform_int_values.arr[2].el;
|
||||
int const x_46 = x_6.x_GLF_uniform_int_values.arr[3].el;
|
||||
int const x_49 = x_6.x_GLF_uniform_int_values.arr[0].el;
|
||||
v = float4(float(x_40), float(x_43), float(x_46), float(x_49));
|
||||
int const x_53 = x_6.x_GLF_uniform_int_values.arr[4].el;
|
||||
i = x_53;
|
||||
while (true) {
|
||||
int const x_58 = i;
|
||||
int const x_60 = x_6.x_GLF_uniform_int_values.arr[0].el;
|
||||
if ((x_58 < x_60)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
float4 const x_63 = v;
|
||||
float4 const x_64 = v;
|
||||
float4 const x_65 = v;
|
||||
float4 const x_66 = v;
|
||||
int const x_88 = i;
|
||||
float const x_92 = x_9.x_GLF_uniform_float_values.arr[0].el;
|
||||
if ((float4x4(float4(x_63.x, x_63.y, x_63.z, x_63.w), float4(x_64.x, x_64.y, x_64.z, x_64.w), float4(x_65.x, x_65.y, x_65.z, x_65.w), float4(x_66.x, x_66.y, x_66.z, x_66.w))[0u][x_88] > x_92)) {
|
||||
int const x_96 = i;
|
||||
float4 const x_97 = v;
|
||||
float const x_99 = x_9.x_GLF_uniform_float_values.arr[1].el;
|
||||
float const x_102 = x_9.x_GLF_uniform_float_values.arr[0].el;
|
||||
int const x_106 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
v[x_96] = clamp(x_97, float4(x_99, x_99, x_99, x_99), float4(x_102, x_102, x_102, x_102))[x_106];
|
||||
}
|
||||
{
|
||||
int const x_109 = i;
|
||||
i = (x_109 + 1);
|
||||
}
|
||||
}
|
||||
float4 const x_111 = v;
|
||||
int const x_113 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
float const x_114 = float(x_113);
|
||||
if (all((x_111 == float4(x_114, x_114, x_114, x_114)))) {
|
||||
int const x_122 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_125 = x_6.x_GLF_uniform_int_values.arr[4].el;
|
||||
int const x_128 = x_6.x_GLF_uniform_int_values.arr[4].el;
|
||||
int const x_131 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
*(tint_symbol_4) = float4(float(x_122), float(x_125), float(x_128), float(x_131));
|
||||
} else {
|
||||
int const x_135 = x_6.x_GLF_uniform_int_values.arr[4].el;
|
||||
float const x_136 = float(x_135);
|
||||
*(tint_symbol_4) = float4(x_136, x_136, x_136, x_136);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]], constant buf0& x_9 [[buffer(0)]]) {
|
||||
thread float4 tint_symbol_5 = 0.0f;
|
||||
main_1(x_6, x_9, &(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,222 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 155
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%109 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %tint_symbol_1
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %buf1 "buf1"
|
||||
OpMemberName %buf1 0 "x_GLF_uniform_int_values"
|
||||
OpName %x_6 "x_6"
|
||||
OpName %buf0 "buf0"
|
||||
OpMemberName %buf0 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 %v "v"
|
||||
OpName %i "i"
|
||||
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 %buf1 Block
|
||||
OpMemberDecorate %buf1 0 Offset 0
|
||||
OpDecorate %_arr_int_uint_5 ArrayStride 16
|
||||
OpDecorate %x_6 NonWritable
|
||||
OpDecorate %x_6 DescriptorSet 0
|
||||
OpDecorate %x_6 Binding 1
|
||||
OpDecorate %buf0 Block
|
||||
OpMemberDecorate %buf0 0 Offset 0
|
||||
OpDecorate %_arr_float_uint_2 ArrayStride 16
|
||||
OpDecorate %x_9 NonWritable
|
||||
OpDecorate %x_9 DescriptorSet 0
|
||||
OpDecorate %x_9 Binding 0
|
||||
OpDecorate %tint_symbol_1 Location 0
|
||||
OpMemberDecorate %main_out 0 Offset 0
|
||||
%int = OpTypeInt 32 1
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_5 = OpConstant %uint 5
|
||||
%_arr_int_uint_5 = OpTypeArray %int %uint_5
|
||||
%buf1 = OpTypeStruct %_arr_int_uint_5
|
||||
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
|
||||
%x_6 = OpVariable %_ptr_Uniform_buf1 Uniform
|
||||
%float = OpTypeFloat 32
|
||||
%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_9 = OpVariable %_ptr_Uniform_buf0 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
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%28 = OpConstantNull %int
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_4 = OpConstant %int 4
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
||||
%mat4v4float = OpTypeMatrix %v4float 4
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%v4bool = OpTypeVector %bool 4
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%143 = OpTypeFunction %void %main_out
|
||||
%main_1 = OpFunction %void None %20
|
||||
%23 = OpLabel
|
||||
%v = OpVariable %_ptr_Function_v4float Function %17
|
||||
%i = OpVariable %_ptr_Function_int Function %28
|
||||
%32 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%33 = OpLoad %int %32
|
||||
%35 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_2
|
||||
%36 = OpLoad %int %35
|
||||
%38 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_3
|
||||
%39 = OpLoad %int %38
|
||||
%41 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
|
||||
%42 = OpLoad %int %41
|
||||
%43 = OpConvertSToF %float %33
|
||||
%44 = OpConvertSToF %float %36
|
||||
%45 = OpConvertSToF %float %39
|
||||
%46 = OpConvertSToF %float %42
|
||||
%47 = OpCompositeConstruct %v4float %43 %44 %45 %46
|
||||
OpStore %v %47
|
||||
%49 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4
|
||||
%50 = OpLoad %int %49
|
||||
OpStore %i %50
|
||||
OpBranch %51
|
||||
%51 = OpLabel
|
||||
OpLoopMerge %52 %53 None
|
||||
OpBranch %54
|
||||
%54 = OpLabel
|
||||
%55 = OpLoad %int %i
|
||||
%56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
|
||||
%57 = OpLoad %int %56
|
||||
%58 = OpSLessThan %bool %55 %57
|
||||
OpSelectionMerge %60 None
|
||||
OpBranchConditional %58 %61 %62
|
||||
%61 = OpLabel
|
||||
OpBranch %60
|
||||
%62 = OpLabel
|
||||
OpBranch %52
|
||||
%60 = OpLabel
|
||||
%63 = OpLoad %v4float %v
|
||||
%64 = OpLoad %v4float %v
|
||||
%65 = OpLoad %v4float %v
|
||||
%66 = OpLoad %v4float %v
|
||||
%67 = OpLoad %int %i
|
||||
%69 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0
|
||||
%70 = OpLoad %float %69
|
||||
%72 = OpCompositeExtract %float %63 0
|
||||
%73 = OpCompositeExtract %float %63 1
|
||||
%74 = OpCompositeExtract %float %63 2
|
||||
%75 = OpCompositeExtract %float %63 3
|
||||
%76 = OpCompositeConstruct %v4float %72 %73 %74 %75
|
||||
%77 = OpCompositeExtract %float %64 0
|
||||
%78 = OpCompositeExtract %float %64 1
|
||||
%79 = OpCompositeExtract %float %64 2
|
||||
%80 = OpCompositeExtract %float %64 3
|
||||
%81 = OpCompositeConstruct %v4float %77 %78 %79 %80
|
||||
%82 = OpCompositeExtract %float %65 0
|
||||
%83 = OpCompositeExtract %float %65 1
|
||||
%84 = OpCompositeExtract %float %65 2
|
||||
%85 = OpCompositeExtract %float %65 3
|
||||
%86 = OpCompositeConstruct %v4float %82 %83 %84 %85
|
||||
%87 = OpCompositeExtract %float %66 0
|
||||
%88 = OpCompositeExtract %float %66 1
|
||||
%89 = OpCompositeExtract %float %66 2
|
||||
%90 = OpCompositeExtract %float %66 3
|
||||
%91 = OpCompositeConstruct %v4float %87 %88 %89 %90
|
||||
%92 = OpCompositeConstruct %mat4v4float %76 %81 %86 %91
|
||||
%93 = OpCompositeExtract %v4float %92 0
|
||||
%94 = OpVectorExtractDynamic %float %93 %67
|
||||
%95 = OpFOrdGreaterThan %bool %94 %70
|
||||
OpSelectionMerge %96 None
|
||||
OpBranchConditional %95 %97 %96
|
||||
%97 = OpLabel
|
||||
%98 = OpLoad %int %i
|
||||
%99 = OpLoad %v4float %v
|
||||
%100 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_1
|
||||
%101 = OpLoad %float %100
|
||||
%102 = OpAccessChain %_ptr_Uniform_float %x_9 %uint_0 %int_0
|
||||
%103 = OpLoad %float %102
|
||||
%104 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%105 = OpLoad %int %104
|
||||
%107 = OpAccessChain %_ptr_Function_float %v %98
|
||||
%110 = OpCompositeConstruct %v4float %101 %101 %101 %101
|
||||
%111 = OpCompositeConstruct %v4float %103 %103 %103 %103
|
||||
%108 = OpExtInst %v4float %109 NClamp %99 %110 %111
|
||||
%112 = OpVectorExtractDynamic %float %108 %105
|
||||
OpStore %107 %112
|
||||
OpBranch %96
|
||||
%96 = OpLabel
|
||||
OpBranch %53
|
||||
%53 = OpLabel
|
||||
%113 = OpLoad %int %i
|
||||
%114 = OpIAdd %int %113 %int_1
|
||||
OpStore %i %114
|
||||
OpBranch %51
|
||||
%52 = OpLabel
|
||||
%115 = OpLoad %v4float %v
|
||||
%116 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%117 = OpLoad %int %116
|
||||
%118 = OpConvertSToF %float %117
|
||||
%120 = OpCompositeConstruct %v4float %118 %118 %118 %118
|
||||
%121 = OpFOrdEqual %v4bool %115 %120
|
||||
%119 = OpAll %bool %121
|
||||
OpSelectionMerge %123 None
|
||||
OpBranchConditional %119 %124 %125
|
||||
%124 = OpLabel
|
||||
%126 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%127 = OpLoad %int %126
|
||||
%128 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4
|
||||
%129 = OpLoad %int %128
|
||||
%130 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4
|
||||
%131 = OpLoad %int %130
|
||||
%132 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%133 = OpLoad %int %132
|
||||
%134 = OpConvertSToF %float %127
|
||||
%135 = OpConvertSToF %float %129
|
||||
%136 = OpConvertSToF %float %131
|
||||
%137 = OpConvertSToF %float %133
|
||||
%138 = OpCompositeConstruct %v4float %134 %135 %136 %137
|
||||
OpStore %x_GLF_color %138
|
||||
OpBranch %123
|
||||
%125 = OpLabel
|
||||
%139 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_4
|
||||
%140 = OpLoad %int %139
|
||||
%141 = OpConvertSToF %float %140
|
||||
%142 = OpCompositeConstruct %v4float %141 %141 %141 %141
|
||||
OpStore %x_GLF_color %142
|
||||
OpBranch %123
|
||||
%123 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %143
|
||||
%tint_symbol = OpFunctionParameter %main_out
|
||||
%147 = OpLabel
|
||||
%148 = OpCompositeExtract %v4float %tint_symbol 0
|
||||
OpStore %tint_symbol_1 %148
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %20
|
||||
%150 = OpLabel
|
||||
%151 = OpFunctionCall %void %main_1
|
||||
%153 = OpLoad %v4float %x_GLF_color
|
||||
%154 = OpCompositeConstruct %main_out %153
|
||||
%152 = OpFunctionCall %void %tint_symbol_2 %154
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,84 @@
|
||||
type Arr = [[stride(16)]] array<i32, 5>;
|
||||
|
||||
[[block]]
|
||||
struct buf1 {
|
||||
x_GLF_uniform_int_values : Arr;
|
||||
};
|
||||
|
||||
type Arr_1 = [[stride(16)]] array<f32, 2>;
|
||||
|
||||
[[block]]
|
||||
struct buf0 {
|
||||
x_GLF_uniform_float_values : Arr_1;
|
||||
};
|
||||
|
||||
[[group(0), binding(1)]] var<uniform> x_6 : buf1;
|
||||
|
||||
[[group(0), binding(0)]] var<uniform> x_9 : buf0;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var v : vec4<f32>;
|
||||
var i : i32;
|
||||
let x_40 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_43 : i32 = x_6.x_GLF_uniform_int_values[2];
|
||||
let x_46 : i32 = x_6.x_GLF_uniform_int_values[3];
|
||||
let x_49 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
v = vec4<f32>(f32(x_40), f32(x_43), f32(x_46), f32(x_49));
|
||||
let x_53 : i32 = x_6.x_GLF_uniform_int_values[4];
|
||||
i = x_53;
|
||||
loop {
|
||||
let x_58 : i32 = i;
|
||||
let x_60 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
if ((x_58 < x_60)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_63 : vec4<f32> = v;
|
||||
let x_64 : vec4<f32> = v;
|
||||
let x_65 : vec4<f32> = v;
|
||||
let x_66 : vec4<f32> = v;
|
||||
let x_88 : i32 = i;
|
||||
let x_92 : f32 = x_9.x_GLF_uniform_float_values[0];
|
||||
if ((mat4x4<f32>(vec4<f32>(x_63.x, x_63.y, x_63.z, x_63.w), vec4<f32>(x_64.x, x_64.y, x_64.z, x_64.w), vec4<f32>(x_65.x, x_65.y, x_65.z, x_65.w), vec4<f32>(x_66.x, x_66.y, x_66.z, x_66.w))[0u][x_88] > x_92)) {
|
||||
let x_96 : i32 = i;
|
||||
let x_97 : vec4<f32> = v;
|
||||
let x_99 : f32 = x_9.x_GLF_uniform_float_values[1];
|
||||
let x_102 : f32 = x_9.x_GLF_uniform_float_values[0];
|
||||
let x_106 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
v[x_96] = clamp(x_97, vec4<f32>(x_99, x_99, x_99, x_99), vec4<f32>(x_102, x_102, x_102, x_102))[x_106];
|
||||
}
|
||||
|
||||
continuing {
|
||||
let x_109 : i32 = i;
|
||||
i = (x_109 + 1);
|
||||
}
|
||||
}
|
||||
let x_111 : vec4<f32> = v;
|
||||
let x_113 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_114 : f32 = f32(x_113);
|
||||
if (all((x_111 == vec4<f32>(x_114, x_114, x_114, x_114)))) {
|
||||
let x_122 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_125 : i32 = x_6.x_GLF_uniform_int_values[4];
|
||||
let x_128 : i32 = x_6.x_GLF_uniform_int_values[4];
|
||||
let x_131 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
x_GLF_color = vec4<f32>(f32(x_122), f32(x_125), f32(x_128), f32(x_131));
|
||||
} else {
|
||||
let x_135 : i32 = x_6.x_GLF_uniform_int_values[4];
|
||||
let x_136 : f32 = f32(x_135);
|
||||
x_GLF_color = vec4<f32>(x_136, x_136, x_136, x_136);
|
||||
}
|
||||
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