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,183 @@
|
||||
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 %v0 "v0"
|
||||
OpName %buf0 "buf0"
|
||||
OpMemberName %buf0 0 "_GLF_uniform_float_values"
|
||||
OpName %_ ""
|
||||
OpName %v1 "v1"
|
||||
OpName %a "a"
|
||||
OpName %buf1 "buf1"
|
||||
OpMemberName %buf1 0 "_GLF_uniform_int_values"
|
||||
OpName %__0 ""
|
||||
OpName %c "c"
|
||||
OpName %_GLF_color "_GLF_color"
|
||||
OpDecorate %_arr_float_uint_2 ArrayStride 16
|
||||
OpMemberDecorate %buf0 0 Offset 0
|
||||
OpDecorate %buf0 Block
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %_arr_int_uint_4 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
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%buf0 = OpTypeStruct %_arr_float_uint_2
|
||||
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
|
||||
%_ = OpVariable %_ptr_Uniform_buf0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_int_uint_4 = OpTypeArray %int %uint_4
|
||||
%buf1 = OpTypeStruct %_arr_int_uint_4
|
||||
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
|
||||
%__0 = OpVariable %_ptr_Uniform_buf1 Uniform
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%bool = OpTypeBool
|
||||
%int_3 = OpConstant %int 3
|
||||
%int_2 = OpConstant %int 2
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%float_3 = OpConstant %float 3
|
||||
%float_1 = OpConstant %float 1
|
||||
%36 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_GLF_color = OpVariable %_ptr_Output_v4float Output
|
||||
%main = OpFunction %void None %15
|
||||
%39 = OpLabel
|
||||
%v0 = OpVariable %_ptr_Function_v4float Function
|
||||
%v1 = OpVariable %_ptr_Function_v4float Function
|
||||
%a = OpVariable %_ptr_Function_int Function
|
||||
%c = OpVariable %_ptr_Function_int Function
|
||||
%40 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1
|
||||
%41 = OpLoad %float %40
|
||||
%42 = OpCompositeConstruct %v4float %41 %41 %41 %41
|
||||
OpStore %v0 %42
|
||||
%43 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0
|
||||
%44 = OpLoad %float %43
|
||||
%45 = OpCompositeConstruct %v4float %44 %44 %44 %44
|
||||
OpStore %v1 %45
|
||||
%46 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1
|
||||
%47 = OpLoad %int %46
|
||||
OpStore %a %47
|
||||
OpBranch %48
|
||||
%48 = OpLabel
|
||||
OpLoopMerge %49 %50 None
|
||||
OpBranch %51
|
||||
%51 = OpLabel
|
||||
%52 = OpLoad %int %a
|
||||
%53 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_0
|
||||
%54 = OpLoad %int %53
|
||||
%55 = OpSLessThan %bool %52 %54
|
||||
OpBranchConditional %55 %56 %49
|
||||
%56 = OpLabel
|
||||
%57 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3
|
||||
%58 = OpLoad %int %57
|
||||
OpStore %c %58
|
||||
OpBranch %59
|
||||
%59 = OpLabel
|
||||
OpLoopMerge %60 %61 None
|
||||
OpBranch %62
|
||||
%62 = OpLabel
|
||||
%63 = OpLoad %int %c
|
||||
%64 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_2
|
||||
%65 = OpLoad %int %64
|
||||
%66 = OpSLessThan %bool %63 %65
|
||||
OpBranchConditional %66 %67 %60
|
||||
%67 = OpLabel
|
||||
%68 = OpLoad %int %c
|
||||
%69 = OpExtInst %int %1 SClamp %68 %int_0 %int_3
|
||||
%70 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1
|
||||
%71 = OpLoad %float %70
|
||||
%72 = OpAccessChain %_ptr_Function_float %v0 %69
|
||||
%73 = OpLoad %float %72
|
||||
%74 = OpFSub %float %73 %71
|
||||
%75 = OpAccessChain %_ptr_Function_float %v0 %69
|
||||
OpStore %75 %74
|
||||
%76 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1
|
||||
%77 = OpLoad %int %76
|
||||
%78 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3
|
||||
%79 = OpLoad %int %78
|
||||
%80 = OpIEqual %bool %77 %79
|
||||
OpSelectionMerge %81 None
|
||||
OpBranchConditional %80 %82 %81
|
||||
%82 = OpLabel
|
||||
%83 = OpLoad %int %a
|
||||
%84 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1
|
||||
%85 = OpLoad %float %84
|
||||
%86 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1
|
||||
%87 = OpLoad %float %86
|
||||
%88 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_1
|
||||
%89 = OpLoad %float %88
|
||||
%90 = OpCompositeConstruct %v4float %85 %87 %89 %float_3
|
||||
%91 = OpLoad %v4float %v0
|
||||
%92 = OpExtInst %v4float %1 SmoothStep %90 %36 %91
|
||||
%93 = OpLoad %int %a
|
||||
%94 = OpVectorExtractDynamic %float %92 %93
|
||||
%95 = OpAccessChain %_ptr_Function_float %v1 %83
|
||||
OpStore %95 %94
|
||||
OpBranch %81
|
||||
%81 = OpLabel
|
||||
OpBranch %61
|
||||
%61 = OpLabel
|
||||
%96 = OpLoad %int %c
|
||||
%97 = OpIAdd %int %96 %int_1
|
||||
OpStore %c %97
|
||||
OpBranch %59
|
||||
%60 = OpLabel
|
||||
OpBranch %50
|
||||
%50 = OpLabel
|
||||
%98 = OpLoad %int %a
|
||||
%99 = OpIAdd %int %98 %int_1
|
||||
OpStore %a %99
|
||||
OpBranch %48
|
||||
%49 = OpLabel
|
||||
%100 = OpAccessChain %_ptr_Function_float %v1 %uint_0
|
||||
%101 = OpLoad %float %100
|
||||
%102 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %int_0
|
||||
%103 = OpLoad %float %102
|
||||
%104 = OpFOrdEqual %bool %101 %103
|
||||
OpSelectionMerge %105 None
|
||||
OpBranchConditional %104 %106 %107
|
||||
%106 = OpLabel
|
||||
%108 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1
|
||||
%109 = OpLoad %int %108
|
||||
%110 = OpConvertSToF %float %109
|
||||
%111 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3
|
||||
%112 = OpLoad %int %111
|
||||
%113 = OpConvertSToF %float %112
|
||||
%114 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_3
|
||||
%115 = OpLoad %int %114
|
||||
%116 = OpConvertSToF %float %115
|
||||
%117 = OpAccessChain %_ptr_Uniform_int %__0 %int_0 %int_1
|
||||
%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 %__0 %int_0 %int_3
|
||||
%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,92 @@
|
||||
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(b0, space0) {
|
||||
uint4 x_6[2];
|
||||
};
|
||||
cbuffer cbuffer_x_10 : register(b1, space0) {
|
||||
uint4 x_10[4];
|
||||
};
|
||||
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
void main_1() {
|
||||
float4 v0 = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
int a = 0;
|
||||
int c = 0;
|
||||
const float x_41 = asfloat(x_6[1].x);
|
||||
v0 = float4(x_41, x_41, x_41, x_41);
|
||||
const uint scalar_offset = ((16u * uint(0))) / 4;
|
||||
const float x_44 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]);
|
||||
v1 = float4(x_44, x_44, x_44, x_44);
|
||||
const int x_47 = asint(x_10[1].x);
|
||||
a = x_47;
|
||||
while (true) {
|
||||
const int x_52 = a;
|
||||
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
|
||||
const int x_54 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]);
|
||||
if ((x_52 < x_54)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
const int x_58 = asint(x_10[3].x);
|
||||
c = x_58;
|
||||
while (true) {
|
||||
const int x_63 = c;
|
||||
const int x_65 = asint(x_10[2].x);
|
||||
if ((x_63 < x_65)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
const int x_69 = clamp(c, 0, 3);
|
||||
const float x_71 = asfloat(x_6[1].x);
|
||||
const float x_73 = v0[x_69];
|
||||
set_float4(v0, x_69, (x_73 - x_71));
|
||||
const int x_77 = asint(x_10[1].x);
|
||||
const int x_79 = asint(x_10[3].x);
|
||||
if ((x_77 == x_79)) {
|
||||
const int x_83 = a;
|
||||
const float x_85 = asfloat(x_6[1].x);
|
||||
const float x_87 = asfloat(x_6[1].x);
|
||||
const float x_89 = asfloat(x_6[1].x);
|
||||
set_float4(v1, x_83, smoothstep(float4(x_85, x_87, x_89, 3.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), v0)[a]);
|
||||
}
|
||||
{
|
||||
c = (c + 1);
|
||||
}
|
||||
}
|
||||
{
|
||||
a = (a + 1);
|
||||
}
|
||||
}
|
||||
const float x_101 = v1.x;
|
||||
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
|
||||
const float x_103 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]);
|
||||
if ((x_101 == x_103)) {
|
||||
const int x_109 = asint(x_10[1].x);
|
||||
const int x_112 = asint(x_10[3].x);
|
||||
const int x_115 = asint(x_10[3].x);
|
||||
const int x_118 = asint(x_10[1].x);
|
||||
x_GLF_color = float4(float(x_109), float(x_112), float(x_115), float(x_118));
|
||||
} else {
|
||||
const int x_122 = asint(x_10[3].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_4 = {tint_symbol_1.x_GLF_color_1};
|
||||
return tint_symbol_4;
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_padded_array_element {
|
||||
/* 0x0000 */ float el;
|
||||
/* 0x0004 */ int8_t tint_pad[12];
|
||||
};
|
||||
struct tint_array_wrapper {
|
||||
/* 0x0000 */ tint_padded_array_element arr[2];
|
||||
};
|
||||
struct buf0 {
|
||||
/* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values;
|
||||
};
|
||||
struct tint_padded_array_element_1 {
|
||||
/* 0x0000 */ int el;
|
||||
/* 0x0004 */ int8_t tint_pad_1[12];
|
||||
};
|
||||
struct tint_array_wrapper_1 {
|
||||
/* 0x0000 */ tint_padded_array_element_1 arr[4];
|
||||
};
|
||||
struct buf1 {
|
||||
/* 0x0000 */ tint_array_wrapper_1 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_6, constant buf1& x_10, thread float4* const tint_symbol_4) {
|
||||
float4 v0 = 0.0f;
|
||||
float4 v1 = 0.0f;
|
||||
int a = 0;
|
||||
int c = 0;
|
||||
float const x_41 = x_6.x_GLF_uniform_float_values.arr[1].el;
|
||||
v0 = float4(x_41, x_41, x_41, x_41);
|
||||
float const x_44 = x_6.x_GLF_uniform_float_values.arr[0].el;
|
||||
v1 = float4(x_44, x_44, x_44, x_44);
|
||||
int const x_47 = x_10.x_GLF_uniform_int_values.arr[1].el;
|
||||
a = x_47;
|
||||
while (true) {
|
||||
int const x_52 = a;
|
||||
int const x_54 = x_10.x_GLF_uniform_int_values.arr[0].el;
|
||||
if ((x_52 < x_54)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
int const x_58 = x_10.x_GLF_uniform_int_values.arr[3].el;
|
||||
c = x_58;
|
||||
while (true) {
|
||||
int const x_63 = c;
|
||||
int const x_65 = x_10.x_GLF_uniform_int_values.arr[2].el;
|
||||
if ((x_63 < x_65)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
int const x_68 = c;
|
||||
int const x_69 = clamp(x_68, 0, 3);
|
||||
float const x_71 = x_6.x_GLF_uniform_float_values.arr[1].el;
|
||||
float const x_73 = v0[x_69];
|
||||
v0[x_69] = (x_73 - x_71);
|
||||
int const x_77 = x_10.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_79 = x_10.x_GLF_uniform_int_values.arr[3].el;
|
||||
if ((x_77 == x_79)) {
|
||||
int const x_83 = a;
|
||||
float const x_85 = x_6.x_GLF_uniform_float_values.arr[1].el;
|
||||
float const x_87 = x_6.x_GLF_uniform_float_values.arr[1].el;
|
||||
float const x_89 = x_6.x_GLF_uniform_float_values.arr[1].el;
|
||||
float4 const x_91 = v0;
|
||||
int const x_93 = a;
|
||||
v1[x_83] = smoothstep(float4(x_85, x_87, x_89, 3.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), x_91)[x_93];
|
||||
}
|
||||
{
|
||||
int const x_96 = c;
|
||||
c = (x_96 + 1);
|
||||
}
|
||||
}
|
||||
{
|
||||
int const x_98 = a;
|
||||
a = (x_98 + 1);
|
||||
}
|
||||
}
|
||||
float const x_101 = v1.x;
|
||||
float const x_103 = x_6.x_GLF_uniform_float_values.arr[0].el;
|
||||
if ((x_101 == x_103)) {
|
||||
int const x_109 = x_10.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_112 = x_10.x_GLF_uniform_int_values.arr[3].el;
|
||||
int const x_115 = x_10.x_GLF_uniform_int_values.arr[3].el;
|
||||
int const x_118 = x_10.x_GLF_uniform_int_values.arr[1].el;
|
||||
*(tint_symbol_4) = float4(float(x_109), float(x_112), float(x_115), float(x_118));
|
||||
} else {
|
||||
int const x_122 = x_10.x_GLF_uniform_int_values.arr[3].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_6 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) {
|
||||
thread float4 tint_symbol_5 = 0.0f;
|
||||
main_1(x_6, x_10, &(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,227 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 145
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%73 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %tint_symbol_1
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %buf0 "buf0"
|
||||
OpMemberName %buf0 0 "x_GLF_uniform_float_values"
|
||||
OpName %x_6 "x_6"
|
||||
OpName %buf1 "buf1"
|
||||
OpMemberName %buf1 0 "x_GLF_uniform_int_values"
|
||||
OpName %x_10 "x_10"
|
||||
OpName %x_GLF_color "x_GLF_color"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %main_1 "main_1"
|
||||
OpName %v0 "v0"
|
||||
OpName %v1 "v1"
|
||||
OpName %a "a"
|
||||
OpName %c "c"
|
||||
OpName %main_out "main_out"
|
||||
OpMemberName %main_out 0 "x_GLF_color_1"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %main "main"
|
||||
OpDecorate %buf0 Block
|
||||
OpMemberDecorate %buf0 0 Offset 0
|
||||
OpDecorate %_arr_float_uint_2 ArrayStride 16
|
||||
OpDecorate %x_6 NonWritable
|
||||
OpDecorate %x_6 DescriptorSet 0
|
||||
OpDecorate %x_6 Binding 0
|
||||
OpDecorate %buf1 Block
|
||||
OpMemberDecorate %buf1 0 Offset 0
|
||||
OpDecorate %_arr_int_uint_4 ArrayStride 16
|
||||
OpDecorate %x_10 NonWritable
|
||||
OpDecorate %x_10 DescriptorSet 0
|
||||
OpDecorate %x_10 Binding 1
|
||||
OpDecorate %tint_symbol_1 Location 0
|
||||
OpMemberDecorate %main_out 0 Offset 0
|
||||
%float = OpTypeFloat 32
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%buf0 = OpTypeStruct %_arr_float_uint_2
|
||||
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
|
||||
%x_6 = OpVariable %_ptr_Uniform_buf0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_int_uint_4 = OpTypeArray %int %uint_4
|
||||
%buf1 = OpTypeStruct %_arr_int_uint_4
|
||||
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
|
||||
%x_10 = 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
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%29 = OpConstantNull %int
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%bool = OpTypeBool
|
||||
%int_3 = OpConstant %int 3
|
||||
%int_2 = OpConstant %int 2
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%float_3 = OpConstant %float 3
|
||||
%float_1 = OpConstant %float 1
|
||||
%102 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%133 = OpTypeFunction %void %main_out
|
||||
%main_1 = OpFunction %void None %20
|
||||
%23 = OpLabel
|
||||
%v0 = OpVariable %_ptr_Function_v4float Function %17
|
||||
%v1 = OpVariable %_ptr_Function_v4float Function %17
|
||||
%a = OpVariable %_ptr_Function_int Function %29
|
||||
%c = OpVariable %_ptr_Function_int Function %29
|
||||
%34 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1
|
||||
%35 = OpLoad %float %34
|
||||
%36 = OpCompositeConstruct %v4float %35 %35 %35 %35
|
||||
OpStore %v0 %36
|
||||
%38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0
|
||||
%39 = OpLoad %float %38
|
||||
%40 = OpCompositeConstruct %v4float %39 %39 %39 %39
|
||||
OpStore %v1 %40
|
||||
%42 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
|
||||
%43 = OpLoad %int %42
|
||||
OpStore %a %43
|
||||
OpBranch %44
|
||||
%44 = OpLabel
|
||||
OpLoopMerge %45 %46 None
|
||||
OpBranch %47
|
||||
%47 = OpLabel
|
||||
%48 = OpLoad %int %a
|
||||
%49 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0
|
||||
%50 = OpLoad %int %49
|
||||
%51 = OpSLessThan %bool %48 %50
|
||||
OpSelectionMerge %53 None
|
||||
OpBranchConditional %51 %54 %55
|
||||
%54 = OpLabel
|
||||
OpBranch %53
|
||||
%55 = OpLabel
|
||||
OpBranch %45
|
||||
%53 = OpLabel
|
||||
%57 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3
|
||||
%58 = OpLoad %int %57
|
||||
OpStore %c %58
|
||||
OpBranch %59
|
||||
%59 = OpLabel
|
||||
OpLoopMerge %60 %61 None
|
||||
OpBranch %62
|
||||
%62 = OpLabel
|
||||
%63 = OpLoad %int %c
|
||||
%65 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2
|
||||
%66 = OpLoad %int %65
|
||||
%67 = OpSLessThan %bool %63 %66
|
||||
OpSelectionMerge %68 None
|
||||
OpBranchConditional %67 %69 %70
|
||||
%69 = OpLabel
|
||||
OpBranch %68
|
||||
%70 = OpLabel
|
||||
OpBranch %60
|
||||
%68 = OpLabel
|
||||
%71 = OpLoad %int %c
|
||||
%72 = OpExtInst %int %73 SClamp %71 %int_0 %int_3
|
||||
%74 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1
|
||||
%75 = OpLoad %float %74
|
||||
%77 = OpAccessChain %_ptr_Function_float %v0 %72
|
||||
%78 = OpLoad %float %77
|
||||
%79 = OpAccessChain %_ptr_Function_float %v0 %72
|
||||
%80 = OpFSub %float %78 %75
|
||||
OpStore %79 %80
|
||||
%81 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
|
||||
%82 = OpLoad %int %81
|
||||
%83 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3
|
||||
%84 = OpLoad %int %83
|
||||
%85 = OpIEqual %bool %82 %84
|
||||
OpSelectionMerge %86 None
|
||||
OpBranchConditional %85 %87 %86
|
||||
%87 = OpLabel
|
||||
%88 = OpLoad %int %a
|
||||
%89 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1
|
||||
%90 = OpLoad %float %89
|
||||
%91 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1
|
||||
%92 = OpLoad %float %91
|
||||
%93 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1
|
||||
%94 = OpLoad %float %93
|
||||
%95 = OpLoad %v4float %v0
|
||||
%96 = OpLoad %int %a
|
||||
%97 = OpAccessChain %_ptr_Function_float %v1 %88
|
||||
%100 = OpCompositeConstruct %v4float %90 %92 %94 %float_3
|
||||
%98 = OpExtInst %v4float %73 SmoothStep %100 %102 %95
|
||||
%103 = OpVectorExtractDynamic %float %98 %96
|
||||
OpStore %97 %103
|
||||
OpBranch %86
|
||||
%86 = OpLabel
|
||||
OpBranch %61
|
||||
%61 = OpLabel
|
||||
%104 = OpLoad %int %c
|
||||
%105 = OpIAdd %int %104 %int_1
|
||||
OpStore %c %105
|
||||
OpBranch %59
|
||||
%60 = OpLabel
|
||||
OpBranch %46
|
||||
%46 = OpLabel
|
||||
%106 = OpLoad %int %a
|
||||
%107 = OpIAdd %int %106 %int_1
|
||||
OpStore %a %107
|
||||
OpBranch %44
|
||||
%45 = OpLabel
|
||||
%108 = OpAccessChain %_ptr_Function_float %v1 %uint_0
|
||||
%109 = OpLoad %float %108
|
||||
%110 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0
|
||||
%111 = OpLoad %float %110
|
||||
%112 = OpFOrdEqual %bool %109 %111
|
||||
OpSelectionMerge %113 None
|
||||
OpBranchConditional %112 %114 %115
|
||||
%114 = OpLabel
|
||||
%116 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
|
||||
%117 = OpLoad %int %116
|
||||
%118 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3
|
||||
%119 = OpLoad %int %118
|
||||
%120 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3
|
||||
%121 = OpLoad %int %120
|
||||
%122 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
|
||||
%123 = OpLoad %int %122
|
||||
%124 = OpConvertSToF %float %117
|
||||
%125 = OpConvertSToF %float %119
|
||||
%126 = OpConvertSToF %float %121
|
||||
%127 = OpConvertSToF %float %123
|
||||
%128 = OpCompositeConstruct %v4float %124 %125 %126 %127
|
||||
OpStore %x_GLF_color %128
|
||||
OpBranch %113
|
||||
%115 = OpLabel
|
||||
%129 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3
|
||||
%130 = OpLoad %int %129
|
||||
%131 = OpConvertSToF %float %130
|
||||
%132 = OpCompositeConstruct %v4float %131 %131 %131 %131
|
||||
OpStore %x_GLF_color %132
|
||||
OpBranch %113
|
||||
%113 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %133
|
||||
%tint_symbol = OpFunctionParameter %main_out
|
||||
%137 = OpLabel
|
||||
%138 = OpCompositeExtract %v4float %tint_symbol 0
|
||||
OpStore %tint_symbol_1 %138
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %20
|
||||
%140 = OpLabel
|
||||
%141 = OpFunctionCall %void %main_1
|
||||
%143 = OpLoad %v4float %x_GLF_color
|
||||
%144 = OpCompositeConstruct %main_out %143
|
||||
%142 = OpFunctionCall %void %tint_symbol_2 %144
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,101 @@
|
||||
type Arr = [[stride(16)]] array<f32, 2>;
|
||||
|
||||
[[block]]
|
||||
struct buf0 {
|
||||
x_GLF_uniform_float_values : Arr;
|
||||
};
|
||||
|
||||
type Arr_1 = [[stride(16)]] array<i32, 4>;
|
||||
|
||||
[[block]]
|
||||
struct buf1 {
|
||||
x_GLF_uniform_int_values : Arr_1;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]] var<uniform> x_6 : buf0;
|
||||
|
||||
[[group(0), binding(1)]] var<uniform> x_10 : buf1;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var v0 : vec4<f32>;
|
||||
var v1 : vec4<f32>;
|
||||
var a : i32;
|
||||
var c : i32;
|
||||
let x_41 : f32 = x_6.x_GLF_uniform_float_values[1];
|
||||
v0 = vec4<f32>(x_41, x_41, x_41, x_41);
|
||||
let x_44 : f32 = x_6.x_GLF_uniform_float_values[0];
|
||||
v1 = vec4<f32>(x_44, x_44, x_44, x_44);
|
||||
let x_47 : i32 = x_10.x_GLF_uniform_int_values[1];
|
||||
a = x_47;
|
||||
loop {
|
||||
let x_52 : i32 = a;
|
||||
let x_54 : i32 = x_10.x_GLF_uniform_int_values[0];
|
||||
if ((x_52 < x_54)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_58 : i32 = x_10.x_GLF_uniform_int_values[3];
|
||||
c = x_58;
|
||||
loop {
|
||||
let x_63 : i32 = c;
|
||||
let x_65 : i32 = x_10.x_GLF_uniform_int_values[2];
|
||||
if ((x_63 < x_65)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_68 : i32 = c;
|
||||
let x_69 : i32 = clamp(x_68, 0, 3);
|
||||
let x_71 : f32 = x_6.x_GLF_uniform_float_values[1];
|
||||
let x_73 : f32 = v0[x_69];
|
||||
v0[x_69] = (x_73 - x_71);
|
||||
let x_77 : i32 = x_10.x_GLF_uniform_int_values[1];
|
||||
let x_79 : i32 = x_10.x_GLF_uniform_int_values[3];
|
||||
if ((x_77 == x_79)) {
|
||||
let x_83 : i32 = a;
|
||||
let x_85 : f32 = x_6.x_GLF_uniform_float_values[1];
|
||||
let x_87 : f32 = x_6.x_GLF_uniform_float_values[1];
|
||||
let x_89 : f32 = x_6.x_GLF_uniform_float_values[1];
|
||||
let x_91 : vec4<f32> = v0;
|
||||
let x_93 : i32 = a;
|
||||
v1[x_83] = smoothStep(vec4<f32>(x_85, x_87, x_89, 3.0), vec4<f32>(1.0, 1.0, 1.0, 1.0), x_91)[x_93];
|
||||
}
|
||||
|
||||
continuing {
|
||||
let x_96 : i32 = c;
|
||||
c = (x_96 + 1);
|
||||
}
|
||||
}
|
||||
|
||||
continuing {
|
||||
let x_98 : i32 = a;
|
||||
a = (x_98 + 1);
|
||||
}
|
||||
}
|
||||
let x_101 : f32 = v1.x;
|
||||
let x_103 : f32 = x_6.x_GLF_uniform_float_values[0];
|
||||
if ((x_101 == x_103)) {
|
||||
let x_109 : i32 = x_10.x_GLF_uniform_int_values[1];
|
||||
let x_112 : i32 = x_10.x_GLF_uniform_int_values[3];
|
||||
let x_115 : i32 = x_10.x_GLF_uniform_int_values[3];
|
||||
let x_118 : i32 = x_10.x_GLF_uniform_int_values[1];
|
||||
x_GLF_color = vec4<f32>(f32(x_109), f32(x_112), f32(x_115), f32(x_118));
|
||||
} else {
|
||||
let x_122 : i32 = x_10.x_GLF_uniform_int_values[3];
|
||||
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,101 @@
|
||||
type Arr = [[stride(16)]] array<f32, 2>;
|
||||
|
||||
[[block]]
|
||||
struct buf0 {
|
||||
x_GLF_uniform_float_values : Arr;
|
||||
};
|
||||
|
||||
type Arr_1 = [[stride(16)]] array<i32, 4>;
|
||||
|
||||
[[block]]
|
||||
struct buf1 {
|
||||
x_GLF_uniform_int_values : Arr_1;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]] var<uniform> x_6 : buf0;
|
||||
|
||||
[[group(0), binding(1)]] var<uniform> x_10 : buf1;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var v0 : vec4<f32>;
|
||||
var v1 : vec4<f32>;
|
||||
var a : i32;
|
||||
var c : i32;
|
||||
let x_41 : f32 = x_6.x_GLF_uniform_float_values[1];
|
||||
v0 = vec4<f32>(x_41, x_41, x_41, x_41);
|
||||
let x_44 : f32 = x_6.x_GLF_uniform_float_values[0];
|
||||
v1 = vec4<f32>(x_44, x_44, x_44, x_44);
|
||||
let x_47 : i32 = x_10.x_GLF_uniform_int_values[1];
|
||||
a = x_47;
|
||||
loop {
|
||||
let x_52 : i32 = a;
|
||||
let x_54 : i32 = x_10.x_GLF_uniform_int_values[0];
|
||||
if ((x_52 < x_54)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_58 : i32 = x_10.x_GLF_uniform_int_values[3];
|
||||
c = x_58;
|
||||
loop {
|
||||
let x_63 : i32 = c;
|
||||
let x_65 : i32 = x_10.x_GLF_uniform_int_values[2];
|
||||
if ((x_63 < x_65)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_68 : i32 = c;
|
||||
let x_69 : i32 = clamp(x_68, 0, 3);
|
||||
let x_71 : f32 = x_6.x_GLF_uniform_float_values[1];
|
||||
let x_73 : f32 = v0[x_69];
|
||||
v0[x_69] = (x_73 - x_71);
|
||||
let x_77 : i32 = x_10.x_GLF_uniform_int_values[1];
|
||||
let x_79 : i32 = x_10.x_GLF_uniform_int_values[3];
|
||||
if ((x_77 == x_79)) {
|
||||
let x_83 : i32 = a;
|
||||
let x_85 : f32 = x_6.x_GLF_uniform_float_values[1];
|
||||
let x_87 : f32 = x_6.x_GLF_uniform_float_values[1];
|
||||
let x_89 : f32 = x_6.x_GLF_uniform_float_values[1];
|
||||
let x_91 : vec4<f32> = v0;
|
||||
let x_93 : i32 = a;
|
||||
v1[x_83] = smoothStep(vec4<f32>(x_85, x_87, x_89, 3.0), vec4<f32>(1.0, 1.0, 1.0, 1.0), x_91)[x_93];
|
||||
}
|
||||
|
||||
continuing {
|
||||
let x_96 : i32 = c;
|
||||
c = (x_96 + 1);
|
||||
}
|
||||
}
|
||||
|
||||
continuing {
|
||||
let x_98 : i32 = a;
|
||||
a = (x_98 + 1);
|
||||
}
|
||||
}
|
||||
let x_101 : f32 = v1.x;
|
||||
let x_103 : f32 = x_6.x_GLF_uniform_float_values[0];
|
||||
if ((x_101 == x_103)) {
|
||||
let x_109 : i32 = x_10.x_GLF_uniform_int_values[1];
|
||||
let x_112 : i32 = x_10.x_GLF_uniform_int_values[3];
|
||||
let x_115 : i32 = x_10.x_GLF_uniform_int_values[3];
|
||||
let x_118 : i32 = x_10.x_GLF_uniform_int_values[1];
|
||||
x_GLF_color = vec4<f32>(f32(x_109), f32(x_112), f32(x_115), f32(x_118));
|
||||
} else {
|
||||
let x_122 : i32 = x_10.x_GLF_uniform_int_values[3];
|
||||
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,92 @@
|
||||
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(b0, space0) {
|
||||
uint4 x_6[2];
|
||||
};
|
||||
cbuffer cbuffer_x_10 : register(b1, space0) {
|
||||
uint4 x_10[4];
|
||||
};
|
||||
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
void main_1() {
|
||||
float4 v0 = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
float4 v1 = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
int a = 0;
|
||||
int c = 0;
|
||||
const float x_41 = asfloat(x_6[1].x);
|
||||
v0 = float4(x_41, x_41, x_41, x_41);
|
||||
const uint scalar_offset = ((16u * uint(0))) / 4;
|
||||
const float x_44 = asfloat(x_6[scalar_offset / 4][scalar_offset % 4]);
|
||||
v1 = float4(x_44, x_44, x_44, x_44);
|
||||
const int x_47 = asint(x_10[1].x);
|
||||
a = x_47;
|
||||
while (true) {
|
||||
const int x_52 = a;
|
||||
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
|
||||
const int x_54 = asint(x_10[scalar_offset_1 / 4][scalar_offset_1 % 4]);
|
||||
if ((x_52 < x_54)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
const int x_58 = asint(x_10[3].x);
|
||||
c = x_58;
|
||||
while (true) {
|
||||
const int x_63 = c;
|
||||
const int x_65 = asint(x_10[2].x);
|
||||
if ((x_63 < x_65)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
const int x_69 = clamp(c, 0, 3);
|
||||
const float x_71 = asfloat(x_6[1].x);
|
||||
const float x_73 = v0[x_69];
|
||||
set_float4(v0, x_69, (x_73 - x_71));
|
||||
const int x_77 = asint(x_10[1].x);
|
||||
const int x_79 = asint(x_10[3].x);
|
||||
if ((x_77 == x_79)) {
|
||||
const int x_83 = a;
|
||||
const float x_85 = asfloat(x_6[1].x);
|
||||
const float x_87 = asfloat(x_6[1].x);
|
||||
const float x_89 = asfloat(x_6[1].x);
|
||||
set_float4(v1, x_83, smoothstep(float4(x_85, x_87, x_89, 3.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), v0)[a]);
|
||||
}
|
||||
{
|
||||
c = (c + 1);
|
||||
}
|
||||
}
|
||||
{
|
||||
a = (a + 1);
|
||||
}
|
||||
}
|
||||
const float x_101 = v1.x;
|
||||
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
|
||||
const float x_103 = asfloat(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]);
|
||||
if ((x_101 == x_103)) {
|
||||
const int x_109 = asint(x_10[1].x);
|
||||
const int x_112 = asint(x_10[3].x);
|
||||
const int x_115 = asint(x_10[3].x);
|
||||
const int x_118 = asint(x_10[1].x);
|
||||
x_GLF_color = float4(float(x_109), float(x_112), float(x_115), float(x_118));
|
||||
} else {
|
||||
const int x_122 = asint(x_10[3].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_4 = {tint_symbol_1.x_GLF_color_1};
|
||||
return tint_symbol_4;
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_padded_array_element {
|
||||
/* 0x0000 */ float el;
|
||||
/* 0x0004 */ int8_t tint_pad[12];
|
||||
};
|
||||
struct tint_array_wrapper {
|
||||
/* 0x0000 */ tint_padded_array_element arr[2];
|
||||
};
|
||||
struct buf0 {
|
||||
/* 0x0000 */ tint_array_wrapper x_GLF_uniform_float_values;
|
||||
};
|
||||
struct tint_padded_array_element_1 {
|
||||
/* 0x0000 */ int el;
|
||||
/* 0x0004 */ int8_t tint_pad_1[12];
|
||||
};
|
||||
struct tint_array_wrapper_1 {
|
||||
/* 0x0000 */ tint_padded_array_element_1 arr[4];
|
||||
};
|
||||
struct buf1 {
|
||||
/* 0x0000 */ tint_array_wrapper_1 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_6, constant buf1& x_10, thread float4* const tint_symbol_4) {
|
||||
float4 v0 = 0.0f;
|
||||
float4 v1 = 0.0f;
|
||||
int a = 0;
|
||||
int c = 0;
|
||||
float const x_41 = x_6.x_GLF_uniform_float_values.arr[1].el;
|
||||
v0 = float4(x_41, x_41, x_41, x_41);
|
||||
float const x_44 = x_6.x_GLF_uniform_float_values.arr[0].el;
|
||||
v1 = float4(x_44, x_44, x_44, x_44);
|
||||
int const x_47 = x_10.x_GLF_uniform_int_values.arr[1].el;
|
||||
a = x_47;
|
||||
while (true) {
|
||||
int const x_52 = a;
|
||||
int const x_54 = x_10.x_GLF_uniform_int_values.arr[0].el;
|
||||
if ((x_52 < x_54)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
int const x_58 = x_10.x_GLF_uniform_int_values.arr[3].el;
|
||||
c = x_58;
|
||||
while (true) {
|
||||
int const x_63 = c;
|
||||
int const x_65 = x_10.x_GLF_uniform_int_values.arr[2].el;
|
||||
if ((x_63 < x_65)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
int const x_68 = c;
|
||||
int const x_69 = clamp(x_68, 0, 3);
|
||||
float const x_71 = x_6.x_GLF_uniform_float_values.arr[1].el;
|
||||
float const x_73 = v0[x_69];
|
||||
v0[x_69] = (x_73 - x_71);
|
||||
int const x_77 = x_10.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_79 = x_10.x_GLF_uniform_int_values.arr[3].el;
|
||||
if ((x_77 == x_79)) {
|
||||
int const x_83 = a;
|
||||
float const x_85 = x_6.x_GLF_uniform_float_values.arr[1].el;
|
||||
float const x_87 = x_6.x_GLF_uniform_float_values.arr[1].el;
|
||||
float const x_89 = x_6.x_GLF_uniform_float_values.arr[1].el;
|
||||
float4 const x_91 = v0;
|
||||
int const x_93 = a;
|
||||
v1[x_83] = smoothstep(float4(x_85, x_87, x_89, 3.0f), float4(1.0f, 1.0f, 1.0f, 1.0f), x_91)[x_93];
|
||||
}
|
||||
{
|
||||
int const x_96 = c;
|
||||
c = (x_96 + 1);
|
||||
}
|
||||
}
|
||||
{
|
||||
int const x_98 = a;
|
||||
a = (x_98 + 1);
|
||||
}
|
||||
}
|
||||
float const x_101 = v1.x;
|
||||
float const x_103 = x_6.x_GLF_uniform_float_values.arr[0].el;
|
||||
if ((x_101 == x_103)) {
|
||||
int const x_109 = x_10.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_112 = x_10.x_GLF_uniform_int_values.arr[3].el;
|
||||
int const x_115 = x_10.x_GLF_uniform_int_values.arr[3].el;
|
||||
int const x_118 = x_10.x_GLF_uniform_int_values.arr[1].el;
|
||||
*(tint_symbol_4) = float4(float(x_109), float(x_112), float(x_115), float(x_118));
|
||||
} else {
|
||||
int const x_122 = x_10.x_GLF_uniform_int_values.arr[3].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_6 [[buffer(0)]], constant buf1& x_10 [[buffer(1)]]) {
|
||||
thread float4 tint_symbol_5 = 0.0f;
|
||||
main_1(x_6, x_10, &(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,227 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 145
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%73 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %tint_symbol_1
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %buf0 "buf0"
|
||||
OpMemberName %buf0 0 "x_GLF_uniform_float_values"
|
||||
OpName %x_6 "x_6"
|
||||
OpName %buf1 "buf1"
|
||||
OpMemberName %buf1 0 "x_GLF_uniform_int_values"
|
||||
OpName %x_10 "x_10"
|
||||
OpName %x_GLF_color "x_GLF_color"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %main_1 "main_1"
|
||||
OpName %v0 "v0"
|
||||
OpName %v1 "v1"
|
||||
OpName %a "a"
|
||||
OpName %c "c"
|
||||
OpName %main_out "main_out"
|
||||
OpMemberName %main_out 0 "x_GLF_color_1"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %main "main"
|
||||
OpDecorate %buf0 Block
|
||||
OpMemberDecorate %buf0 0 Offset 0
|
||||
OpDecorate %_arr_float_uint_2 ArrayStride 16
|
||||
OpDecorate %x_6 NonWritable
|
||||
OpDecorate %x_6 DescriptorSet 0
|
||||
OpDecorate %x_6 Binding 0
|
||||
OpDecorate %buf1 Block
|
||||
OpMemberDecorate %buf1 0 Offset 0
|
||||
OpDecorate %_arr_int_uint_4 ArrayStride 16
|
||||
OpDecorate %x_10 NonWritable
|
||||
OpDecorate %x_10 DescriptorSet 0
|
||||
OpDecorate %x_10 Binding 1
|
||||
OpDecorate %tint_symbol_1 Location 0
|
||||
OpMemberDecorate %main_out 0 Offset 0
|
||||
%float = OpTypeFloat 32
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_float_uint_2 = OpTypeArray %float %uint_2
|
||||
%buf0 = OpTypeStruct %_arr_float_uint_2
|
||||
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
|
||||
%x_6 = OpVariable %_ptr_Uniform_buf0 Uniform
|
||||
%int = OpTypeInt 32 1
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_int_uint_4 = OpTypeArray %int %uint_4
|
||||
%buf1 = OpTypeStruct %_arr_int_uint_4
|
||||
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
|
||||
%x_10 = 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
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%29 = OpConstantNull %int
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Uniform_float = OpTypePointer Uniform %float
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%bool = OpTypeBool
|
||||
%int_3 = OpConstant %int 3
|
||||
%int_2 = OpConstant %int 2
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%float_3 = OpConstant %float 3
|
||||
%float_1 = OpConstant %float 1
|
||||
%102 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%133 = OpTypeFunction %void %main_out
|
||||
%main_1 = OpFunction %void None %20
|
||||
%23 = OpLabel
|
||||
%v0 = OpVariable %_ptr_Function_v4float Function %17
|
||||
%v1 = OpVariable %_ptr_Function_v4float Function %17
|
||||
%a = OpVariable %_ptr_Function_int Function %29
|
||||
%c = OpVariable %_ptr_Function_int Function %29
|
||||
%34 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1
|
||||
%35 = OpLoad %float %34
|
||||
%36 = OpCompositeConstruct %v4float %35 %35 %35 %35
|
||||
OpStore %v0 %36
|
||||
%38 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0
|
||||
%39 = OpLoad %float %38
|
||||
%40 = OpCompositeConstruct %v4float %39 %39 %39 %39
|
||||
OpStore %v1 %40
|
||||
%42 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
|
||||
%43 = OpLoad %int %42
|
||||
OpStore %a %43
|
||||
OpBranch %44
|
||||
%44 = OpLabel
|
||||
OpLoopMerge %45 %46 None
|
||||
OpBranch %47
|
||||
%47 = OpLabel
|
||||
%48 = OpLoad %int %a
|
||||
%49 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_0
|
||||
%50 = OpLoad %int %49
|
||||
%51 = OpSLessThan %bool %48 %50
|
||||
OpSelectionMerge %53 None
|
||||
OpBranchConditional %51 %54 %55
|
||||
%54 = OpLabel
|
||||
OpBranch %53
|
||||
%55 = OpLabel
|
||||
OpBranch %45
|
||||
%53 = OpLabel
|
||||
%57 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3
|
||||
%58 = OpLoad %int %57
|
||||
OpStore %c %58
|
||||
OpBranch %59
|
||||
%59 = OpLabel
|
||||
OpLoopMerge %60 %61 None
|
||||
OpBranch %62
|
||||
%62 = OpLabel
|
||||
%63 = OpLoad %int %c
|
||||
%65 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_2
|
||||
%66 = OpLoad %int %65
|
||||
%67 = OpSLessThan %bool %63 %66
|
||||
OpSelectionMerge %68 None
|
||||
OpBranchConditional %67 %69 %70
|
||||
%69 = OpLabel
|
||||
OpBranch %68
|
||||
%70 = OpLabel
|
||||
OpBranch %60
|
||||
%68 = OpLabel
|
||||
%71 = OpLoad %int %c
|
||||
%72 = OpExtInst %int %73 SClamp %71 %int_0 %int_3
|
||||
%74 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1
|
||||
%75 = OpLoad %float %74
|
||||
%77 = OpAccessChain %_ptr_Function_float %v0 %72
|
||||
%78 = OpLoad %float %77
|
||||
%79 = OpAccessChain %_ptr_Function_float %v0 %72
|
||||
%80 = OpFSub %float %78 %75
|
||||
OpStore %79 %80
|
||||
%81 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
|
||||
%82 = OpLoad %int %81
|
||||
%83 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3
|
||||
%84 = OpLoad %int %83
|
||||
%85 = OpIEqual %bool %82 %84
|
||||
OpSelectionMerge %86 None
|
||||
OpBranchConditional %85 %87 %86
|
||||
%87 = OpLabel
|
||||
%88 = OpLoad %int %a
|
||||
%89 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1
|
||||
%90 = OpLoad %float %89
|
||||
%91 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1
|
||||
%92 = OpLoad %float %91
|
||||
%93 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_1
|
||||
%94 = OpLoad %float %93
|
||||
%95 = OpLoad %v4float %v0
|
||||
%96 = OpLoad %int %a
|
||||
%97 = OpAccessChain %_ptr_Function_float %v1 %88
|
||||
%100 = OpCompositeConstruct %v4float %90 %92 %94 %float_3
|
||||
%98 = OpExtInst %v4float %73 SmoothStep %100 %102 %95
|
||||
%103 = OpVectorExtractDynamic %float %98 %96
|
||||
OpStore %97 %103
|
||||
OpBranch %86
|
||||
%86 = OpLabel
|
||||
OpBranch %61
|
||||
%61 = OpLabel
|
||||
%104 = OpLoad %int %c
|
||||
%105 = OpIAdd %int %104 %int_1
|
||||
OpStore %c %105
|
||||
OpBranch %59
|
||||
%60 = OpLabel
|
||||
OpBranch %46
|
||||
%46 = OpLabel
|
||||
%106 = OpLoad %int %a
|
||||
%107 = OpIAdd %int %106 %int_1
|
||||
OpStore %a %107
|
||||
OpBranch %44
|
||||
%45 = OpLabel
|
||||
%108 = OpAccessChain %_ptr_Function_float %v1 %uint_0
|
||||
%109 = OpLoad %float %108
|
||||
%110 = OpAccessChain %_ptr_Uniform_float %x_6 %uint_0 %int_0
|
||||
%111 = OpLoad %float %110
|
||||
%112 = OpFOrdEqual %bool %109 %111
|
||||
OpSelectionMerge %113 None
|
||||
OpBranchConditional %112 %114 %115
|
||||
%114 = OpLabel
|
||||
%116 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
|
||||
%117 = OpLoad %int %116
|
||||
%118 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3
|
||||
%119 = OpLoad %int %118
|
||||
%120 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3
|
||||
%121 = OpLoad %int %120
|
||||
%122 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_1
|
||||
%123 = OpLoad %int %122
|
||||
%124 = OpConvertSToF %float %117
|
||||
%125 = OpConvertSToF %float %119
|
||||
%126 = OpConvertSToF %float %121
|
||||
%127 = OpConvertSToF %float %123
|
||||
%128 = OpCompositeConstruct %v4float %124 %125 %126 %127
|
||||
OpStore %x_GLF_color %128
|
||||
OpBranch %113
|
||||
%115 = OpLabel
|
||||
%129 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0 %int_3
|
||||
%130 = OpLoad %int %129
|
||||
%131 = OpConvertSToF %float %130
|
||||
%132 = OpCompositeConstruct %v4float %131 %131 %131 %131
|
||||
OpStore %x_GLF_color %132
|
||||
OpBranch %113
|
||||
%113 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %133
|
||||
%tint_symbol = OpFunctionParameter %main_out
|
||||
%137 = OpLabel
|
||||
%138 = OpCompositeExtract %v4float %tint_symbol 0
|
||||
OpStore %tint_symbol_1 %138
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %20
|
||||
%140 = OpLabel
|
||||
%141 = OpFunctionCall %void %main_1
|
||||
%143 = OpLoad %v4float %x_GLF_color
|
||||
%144 = OpCompositeConstruct %main_out %143
|
||||
%142 = OpFunctionCall %void %tint_symbol_2 %144
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,101 @@
|
||||
type Arr = [[stride(16)]] array<f32, 2>;
|
||||
|
||||
[[block]]
|
||||
struct buf0 {
|
||||
x_GLF_uniform_float_values : Arr;
|
||||
};
|
||||
|
||||
type Arr_1 = [[stride(16)]] array<i32, 4>;
|
||||
|
||||
[[block]]
|
||||
struct buf1 {
|
||||
x_GLF_uniform_int_values : Arr_1;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]] var<uniform> x_6 : buf0;
|
||||
|
||||
[[group(0), binding(1)]] var<uniform> x_10 : buf1;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var v0 : vec4<f32>;
|
||||
var v1 : vec4<f32>;
|
||||
var a : i32;
|
||||
var c : i32;
|
||||
let x_41 : f32 = x_6.x_GLF_uniform_float_values[1];
|
||||
v0 = vec4<f32>(x_41, x_41, x_41, x_41);
|
||||
let x_44 : f32 = x_6.x_GLF_uniform_float_values[0];
|
||||
v1 = vec4<f32>(x_44, x_44, x_44, x_44);
|
||||
let x_47 : i32 = x_10.x_GLF_uniform_int_values[1];
|
||||
a = x_47;
|
||||
loop {
|
||||
let x_52 : i32 = a;
|
||||
let x_54 : i32 = x_10.x_GLF_uniform_int_values[0];
|
||||
if ((x_52 < x_54)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_58 : i32 = x_10.x_GLF_uniform_int_values[3];
|
||||
c = x_58;
|
||||
loop {
|
||||
let x_63 : i32 = c;
|
||||
let x_65 : i32 = x_10.x_GLF_uniform_int_values[2];
|
||||
if ((x_63 < x_65)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_68 : i32 = c;
|
||||
let x_69 : i32 = clamp(x_68, 0, 3);
|
||||
let x_71 : f32 = x_6.x_GLF_uniform_float_values[1];
|
||||
let x_73 : f32 = v0[x_69];
|
||||
v0[x_69] = (x_73 - x_71);
|
||||
let x_77 : i32 = x_10.x_GLF_uniform_int_values[1];
|
||||
let x_79 : i32 = x_10.x_GLF_uniform_int_values[3];
|
||||
if ((x_77 == x_79)) {
|
||||
let x_83 : i32 = a;
|
||||
let x_85 : f32 = x_6.x_GLF_uniform_float_values[1];
|
||||
let x_87 : f32 = x_6.x_GLF_uniform_float_values[1];
|
||||
let x_89 : f32 = x_6.x_GLF_uniform_float_values[1];
|
||||
let x_91 : vec4<f32> = v0;
|
||||
let x_93 : i32 = a;
|
||||
v1[x_83] = smoothStep(vec4<f32>(x_85, x_87, x_89, 3.0), vec4<f32>(1.0, 1.0, 1.0, 1.0), x_91)[x_93];
|
||||
}
|
||||
|
||||
continuing {
|
||||
let x_96 : i32 = c;
|
||||
c = (x_96 + 1);
|
||||
}
|
||||
}
|
||||
|
||||
continuing {
|
||||
let x_98 : i32 = a;
|
||||
a = (x_98 + 1);
|
||||
}
|
||||
}
|
||||
let x_101 : f32 = v1.x;
|
||||
let x_103 : f32 = x_6.x_GLF_uniform_float_values[0];
|
||||
if ((x_101 == x_103)) {
|
||||
let x_109 : i32 = x_10.x_GLF_uniform_int_values[1];
|
||||
let x_112 : i32 = x_10.x_GLF_uniform_int_values[3];
|
||||
let x_115 : i32 = x_10.x_GLF_uniform_int_values[3];
|
||||
let x_118 : i32 = x_10.x_GLF_uniform_int_values[1];
|
||||
x_GLF_color = vec4<f32>(f32(x_109), f32(x_112), f32(x_115), f32(x_118));
|
||||
} else {
|
||||
let x_122 : i32 = x_10.x_GLF_uniform_int_values[3];
|
||||
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