mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-13 23:26:24 +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,91 @@
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %_GLF_color
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpSource ESSL 320
|
||||
OpName %main "main"
|
||||
OpName %buf0 "buf0"
|
||||
OpMemberName %buf0 0 "_GLF_uniform_int_values"
|
||||
OpName %_ ""
|
||||
OpName %_GLF_color "_GLF_color"
|
||||
OpDecorate %_arr_int_uint_4 ArrayStride 16
|
||||
OpMemberDecorate %buf0 0 Offset 0
|
||||
OpDecorate %buf0 Block
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %_GLF_color Location 0
|
||||
%void = OpTypeVoid
|
||||
%8 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_int_uint_4 = OpTypeArray %int %uint_4
|
||||
%buf0 = OpTypeStruct %_arr_int_uint_4
|
||||
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
|
||||
%_ = OpVariable %_ptr_Uniform_buf0 Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_3 = OpConstant %int 3
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%bool = OpTypeBool
|
||||
%int_2 = OpConstant %int 2
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_GLF_color = OpVariable %_ptr_Output_v4float Output
|
||||
%main = OpFunction %void None %8
|
||||
%22 = OpLabel
|
||||
%23 = OpBitReverse %int %int_1
|
||||
%24 = OpExtInst %int %1 SMin %int_1 %23
|
||||
%25 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_3
|
||||
%26 = OpLoad %int %25
|
||||
OpBranch %27
|
||||
%27 = OpLabel
|
||||
%28 = OpPhi %int %26 %22 %29 %30
|
||||
%31 = OpPhi %int %int_1 %22 %32 %30
|
||||
%33 = OpISub %int %24 %int_1
|
||||
%34 = OpSLessThanEqual %bool %31 %33
|
||||
OpLoopMerge %35 %30 None
|
||||
OpBranchConditional %34 %36 %35
|
||||
%36 = OpLabel
|
||||
%29 = OpIAdd %int %28 %31
|
||||
%37 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
|
||||
%38 = OpLoad %int %37
|
||||
%39 = OpIEqual %bool %38 %int_1
|
||||
OpSelectionMerge %40 None
|
||||
OpBranchConditional %39 %41 %40
|
||||
%41 = OpLabel
|
||||
OpBranch %35
|
||||
%40 = OpLabel
|
||||
OpBranch %30
|
||||
%30 = OpLabel
|
||||
%32 = OpIAdd %int %31 %int_1
|
||||
OpBranch %27
|
||||
%35 = OpLabel
|
||||
%42 = OpPhi %int %28 %27 %29 %41
|
||||
%43 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_2
|
||||
%44 = OpLoad %int %43
|
||||
%45 = OpIEqual %bool %42 %44
|
||||
OpSelectionMerge %46 None
|
||||
OpBranchConditional %45 %47 %48
|
||||
%47 = OpLabel
|
||||
%49 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
|
||||
%50 = OpLoad %int %49
|
||||
%51 = OpConvertSToF %float %50
|
||||
%52 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
|
||||
%53 = OpLoad %int %52
|
||||
%54 = OpConvertSToF %float %53
|
||||
%55 = OpCompositeConstruct %v4float %51 %54 %54 %51
|
||||
OpStore %_GLF_color %55
|
||||
OpBranch %46
|
||||
%48 = OpLabel
|
||||
%56 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
|
||||
%57 = OpLoad %int %56
|
||||
%58 = OpConvertSToF %float %57
|
||||
%59 = OpCompositeConstruct %v4float %58 %58 %58 %58
|
||||
OpStore %_GLF_color %59
|
||||
OpBranch %46
|
||||
%46 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,67 @@
|
||||
cbuffer cbuffer_x_5 : register(b0, space0) {
|
||||
uint4 x_5[4];
|
||||
};
|
||||
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
void main_1() {
|
||||
int x_28 = 0;
|
||||
int x_29 = 0;
|
||||
int x_28_phi = 0;
|
||||
int x_31_phi = 0;
|
||||
int x_42_phi = 0;
|
||||
const int x_24 = min(1, reversebits(1));
|
||||
const int x_26 = asint(x_5[3].x);
|
||||
x_28_phi = x_26;
|
||||
x_31_phi = 1;
|
||||
while (true) {
|
||||
int x_32 = 0;
|
||||
x_28 = x_28_phi;
|
||||
const int x_31 = x_31_phi;
|
||||
x_42_phi = x_28;
|
||||
if ((x_31 <= (x_24 - 1))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
x_29 = asint((x_28 + asint(x_31)));
|
||||
const uint scalar_offset = ((16u * uint(0))) / 4;
|
||||
const int x_38 = asint(x_5[scalar_offset / 4][scalar_offset % 4]);
|
||||
if ((x_38 == 1)) {
|
||||
x_42_phi = x_29;
|
||||
break;
|
||||
}
|
||||
{
|
||||
x_32 = (x_31 + 1);
|
||||
x_28_phi = x_29;
|
||||
x_31_phi = x_32;
|
||||
}
|
||||
}
|
||||
const int x_42 = x_42_phi;
|
||||
const int x_44 = asint(x_5[2].x);
|
||||
if ((x_42 == x_44)) {
|
||||
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
|
||||
const int x_50 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]);
|
||||
const float x_51 = float(x_50);
|
||||
const int x_53 = asint(x_5[1].x);
|
||||
const float x_54 = float(x_53);
|
||||
x_GLF_color = float4(x_51, x_54, x_54, x_51);
|
||||
} else {
|
||||
const int x_57 = asint(x_5[1].x);
|
||||
const float x_58 = float(x_57);
|
||||
x_GLF_color = float4(x_58, x_58, x_58, x_58);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol {
|
||||
float4 x_GLF_color_1 : SV_Target0;
|
||||
};
|
||||
|
||||
tint_symbol main() {
|
||||
main_1();
|
||||
const main_out tint_symbol_1 = {x_GLF_color};
|
||||
const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
|
||||
return tint_symbol_3;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_padded_array_element {
|
||||
/* 0x0000 */ int el;
|
||||
/* 0x0004 */ int8_t tint_pad[12];
|
||||
};
|
||||
struct tint_array_wrapper {
|
||||
/* 0x0000 */ tint_padded_array_element arr[4];
|
||||
};
|
||||
struct buf0 {
|
||||
/* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values;
|
||||
};
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol_1 {
|
||||
float4 x_GLF_color_1 [[color(0)]];
|
||||
};
|
||||
|
||||
void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) {
|
||||
int x_28 = 0;
|
||||
int x_29 = 0;
|
||||
int x_28_phi = 0;
|
||||
int x_31_phi = 0;
|
||||
int x_42_phi = 0;
|
||||
int const x_24 = min(1, reverse_bits(1));
|
||||
int const x_26 = x_5.x_GLF_uniform_int_values.arr[3].el;
|
||||
x_28_phi = x_26;
|
||||
x_31_phi = 1;
|
||||
while (true) {
|
||||
int x_32 = 0;
|
||||
x_28 = x_28_phi;
|
||||
int const x_31 = x_31_phi;
|
||||
x_42_phi = x_28;
|
||||
if ((x_31 <= (x_24 - 1))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
x_29 = as_type<int>((x_28 + as_type<int>(x_31)));
|
||||
int const x_38 = x_5.x_GLF_uniform_int_values.arr[0].el;
|
||||
if ((x_38 == 1)) {
|
||||
x_42_phi = x_29;
|
||||
break;
|
||||
}
|
||||
{
|
||||
x_32 = (x_31 + 1);
|
||||
x_28_phi = x_29;
|
||||
x_31_phi = x_32;
|
||||
}
|
||||
}
|
||||
int const x_42 = x_42_phi;
|
||||
int const x_44 = x_5.x_GLF_uniform_int_values.arr[2].el;
|
||||
if ((x_42 == x_44)) {
|
||||
int const x_50 = x_5.x_GLF_uniform_int_values.arr[0].el;
|
||||
float const x_51 = float(x_50);
|
||||
int const x_53 = x_5.x_GLF_uniform_int_values.arr[1].el;
|
||||
float const x_54 = float(x_53);
|
||||
*(tint_symbol_4) = float4(x_51, x_54, x_54, x_51);
|
||||
} else {
|
||||
int const x_57 = x_5.x_GLF_uniform_int_values.arr[1].el;
|
||||
float const x_58 = float(x_57);
|
||||
*(tint_symbol_4) = float4(x_58, x_58, x_58, x_58);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) {
|
||||
thread float4 tint_symbol_5 = 0.0f;
|
||||
main_1(x_5, &(tint_symbol_5));
|
||||
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5};
|
||||
tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
|
||||
return tint_symbol_3;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 94
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%27 = 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_int_values"
|
||||
OpName %x_5 "x_5"
|
||||
OpName %x_GLF_color "x_GLF_color"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %main_1 "main_1"
|
||||
OpName %x_28 "x_28"
|
||||
OpName %x_29 "x_29"
|
||||
OpName %x_28_phi "x_28_phi"
|
||||
OpName %x_31_phi "x_31_phi"
|
||||
OpName %x_42_phi "x_42_phi"
|
||||
OpName %x_32 "x_32"
|
||||
OpName %main_out "main_out"
|
||||
OpMemberName %main_out 0 "x_GLF_color_1"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %main "main"
|
||||
OpDecorate %buf0 Block
|
||||
OpMemberDecorate %buf0 0 Offset 0
|
||||
OpDecorate %_arr_int_uint_4 ArrayStride 16
|
||||
OpDecorate %x_5 NonWritable
|
||||
OpDecorate %x_5 DescriptorSet 0
|
||||
OpDecorate %x_5 Binding 0
|
||||
OpDecorate %tint_symbol_1 Location 0
|
||||
OpMemberDecorate %main_out 0 Offset 0
|
||||
%int = OpTypeInt 32 1
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_int_uint_4 = OpTypeArray %int %uint_4
|
||||
%buf0 = OpTypeStruct %_arr_int_uint_4
|
||||
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
|
||||
%x_5 = OpVariable %_ptr_Uniform_buf0 Uniform
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Private_v4float = OpTypePointer Private %v4float
|
||||
%12 = OpConstantNull %v4float
|
||||
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12
|
||||
%void = OpTypeVoid
|
||||
%15 = OpTypeFunction %void
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%21 = OpConstantNull %int
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%int_3 = OpConstant %int 3
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%bool = OpTypeBool
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_2 = OpConstant %int 2
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%82 = OpTypeFunction %void %main_out
|
||||
%main_1 = OpFunction %void None %15
|
||||
%18 = OpLabel
|
||||
%x_28 = OpVariable %_ptr_Function_int Function %21
|
||||
%x_29 = OpVariable %_ptr_Function_int Function %21
|
||||
%x_28_phi = OpVariable %_ptr_Function_int Function %21
|
||||
%x_31_phi = OpVariable %_ptr_Function_int Function %21
|
||||
%x_42_phi = OpVariable %_ptr_Function_int Function %21
|
||||
%x_32 = OpVariable %_ptr_Function_int Function %21
|
||||
%29 = OpBitReverse %int %int_1
|
||||
%26 = OpExtInst %int %27 SMin %int_1 %29
|
||||
%33 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_3
|
||||
%34 = OpLoad %int %33
|
||||
OpStore %x_28_phi %34
|
||||
OpStore %x_31_phi %int_1
|
||||
OpBranch %35
|
||||
%35 = OpLabel
|
||||
OpLoopMerge %36 %37 None
|
||||
OpBranch %38
|
||||
%38 = OpLabel
|
||||
%40 = OpLoad %int %x_28_phi
|
||||
OpStore %x_28 %40
|
||||
%41 = OpLoad %int %x_31_phi
|
||||
%42 = OpLoad %int %x_28
|
||||
OpStore %x_42_phi %42
|
||||
%43 = OpISub %int %26 %int_1
|
||||
%44 = OpSLessThanEqual %bool %41 %43
|
||||
OpSelectionMerge %46 None
|
||||
OpBranchConditional %44 %47 %48
|
||||
%47 = OpLabel
|
||||
OpBranch %46
|
||||
%48 = OpLabel
|
||||
OpBranch %36
|
||||
%46 = OpLabel
|
||||
%50 = OpLoad %int %x_28
|
||||
%51 = OpCopyObject %int %41
|
||||
%52 = OpIAdd %int %50 %51
|
||||
%49 = OpCopyObject %int %52
|
||||
OpStore %x_29 %49
|
||||
%54 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0
|
||||
%55 = OpLoad %int %54
|
||||
%56 = OpIEqual %bool %55 %int_1
|
||||
OpSelectionMerge %57 None
|
||||
OpBranchConditional %56 %58 %57
|
||||
%58 = OpLabel
|
||||
%59 = OpLoad %int %x_29
|
||||
OpStore %x_42_phi %59
|
||||
OpBranch %36
|
||||
%57 = OpLabel
|
||||
OpBranch %37
|
||||
%37 = OpLabel
|
||||
%60 = OpIAdd %int %41 %int_1
|
||||
OpStore %x_32 %60
|
||||
%61 = OpLoad %int %x_29
|
||||
OpStore %x_28_phi %61
|
||||
%62 = OpLoad %int %x_32
|
||||
OpStore %x_31_phi %62
|
||||
OpBranch %35
|
||||
%36 = OpLabel
|
||||
%63 = OpLoad %int %x_42_phi
|
||||
%65 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2
|
||||
%66 = OpLoad %int %65
|
||||
%67 = OpIEqual %bool %63 %66
|
||||
OpSelectionMerge %68 None
|
||||
OpBranchConditional %67 %69 %70
|
||||
%69 = OpLabel
|
||||
%71 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0
|
||||
%72 = OpLoad %int %71
|
||||
%73 = OpConvertSToF %float %72
|
||||
%74 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1
|
||||
%75 = OpLoad %int %74
|
||||
%76 = OpConvertSToF %float %75
|
||||
%77 = OpCompositeConstruct %v4float %73 %76 %76 %73
|
||||
OpStore %x_GLF_color %77
|
||||
OpBranch %68
|
||||
%70 = OpLabel
|
||||
%78 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1
|
||||
%79 = OpLoad %int %78
|
||||
%80 = OpConvertSToF %float %79
|
||||
%81 = OpCompositeConstruct %v4float %80 %80 %80 %80
|
||||
OpStore %x_GLF_color %81
|
||||
OpBranch %68
|
||||
%68 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %82
|
||||
%tint_symbol = OpFunctionParameter %main_out
|
||||
%86 = OpLabel
|
||||
%87 = OpCompositeExtract %v4float %tint_symbol 0
|
||||
OpStore %tint_symbol_1 %87
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %15
|
||||
%89 = OpLabel
|
||||
%90 = OpFunctionCall %void %main_1
|
||||
%92 = OpLoad %v4float %x_GLF_color
|
||||
%93 = OpCompositeConstruct %main_out %92
|
||||
%91 = OpFunctionCall %void %tint_symbol_2 %93
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,69 @@
|
||||
type Arr = [[stride(16)]] array<i32, 4>;
|
||||
|
||||
[[block]]
|
||||
struct buf0 {
|
||||
x_GLF_uniform_int_values : Arr;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]] var<uniform> x_5 : buf0;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var x_28 : i32;
|
||||
var x_29 : i32;
|
||||
var x_28_phi : i32;
|
||||
var x_31_phi : i32;
|
||||
var x_42_phi : i32;
|
||||
let x_24 : i32 = min(1, reverseBits(1));
|
||||
let x_26 : i32 = x_5.x_GLF_uniform_int_values[3];
|
||||
x_28_phi = x_26;
|
||||
x_31_phi = 1;
|
||||
loop {
|
||||
var x_32 : i32;
|
||||
x_28 = x_28_phi;
|
||||
let x_31 : i32 = x_31_phi;
|
||||
x_42_phi = x_28;
|
||||
if ((x_31 <= (x_24 - 1))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
x_29 = bitcast<i32>((x_28 + bitcast<i32>(x_31)));
|
||||
let x_38 : i32 = x_5.x_GLF_uniform_int_values[0];
|
||||
if ((x_38 == 1)) {
|
||||
x_42_phi = x_29;
|
||||
break;
|
||||
}
|
||||
|
||||
continuing {
|
||||
x_32 = (x_31 + 1);
|
||||
x_28_phi = x_29;
|
||||
x_31_phi = x_32;
|
||||
}
|
||||
}
|
||||
let x_42 : i32 = x_42_phi;
|
||||
let x_44 : i32 = x_5.x_GLF_uniform_int_values[2];
|
||||
if ((x_42 == x_44)) {
|
||||
let x_50 : i32 = x_5.x_GLF_uniform_int_values[0];
|
||||
let x_51 : f32 = f32(x_50);
|
||||
let x_53 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
let x_54 : f32 = f32(x_53);
|
||||
x_GLF_color = vec4<f32>(x_51, x_54, x_54, x_51);
|
||||
} else {
|
||||
let x_57 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
let x_58 : f32 = f32(x_57);
|
||||
x_GLF_color = vec4<f32>(x_58, x_58, x_58, x_58);
|
||||
}
|
||||
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,69 @@
|
||||
type Arr = [[stride(16)]] array<i32, 4>;
|
||||
|
||||
[[block]]
|
||||
struct buf0 {
|
||||
x_GLF_uniform_int_values : Arr;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]] var<uniform> x_5 : buf0;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var x_28 : i32;
|
||||
var x_29 : i32;
|
||||
var x_28_phi : i32;
|
||||
var x_31_phi : i32;
|
||||
var x_42_phi : i32;
|
||||
let x_24 : i32 = min(1, reverseBits(1));
|
||||
let x_26 : i32 = x_5.x_GLF_uniform_int_values[3];
|
||||
x_28_phi = x_26;
|
||||
x_31_phi = 1;
|
||||
loop {
|
||||
var x_32 : i32;
|
||||
x_28 = x_28_phi;
|
||||
let x_31 : i32 = x_31_phi;
|
||||
x_42_phi = x_28;
|
||||
if ((x_31 <= (x_24 - 1))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
x_29 = bitcast<i32>((x_28 + bitcast<i32>(x_31)));
|
||||
let x_38 : i32 = x_5.x_GLF_uniform_int_values[0];
|
||||
if ((x_38 == 1)) {
|
||||
x_42_phi = x_29;
|
||||
break;
|
||||
}
|
||||
|
||||
continuing {
|
||||
x_32 = (x_31 + 1);
|
||||
x_28_phi = x_29;
|
||||
x_31_phi = x_32;
|
||||
}
|
||||
}
|
||||
let x_42 : i32 = x_42_phi;
|
||||
let x_44 : i32 = x_5.x_GLF_uniform_int_values[2];
|
||||
if ((x_42 == x_44)) {
|
||||
let x_50 : i32 = x_5.x_GLF_uniform_int_values[0];
|
||||
let x_51 : f32 = f32(x_50);
|
||||
let x_53 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
let x_54 : f32 = f32(x_53);
|
||||
x_GLF_color = vec4<f32>(x_51, x_54, x_54, x_51);
|
||||
} else {
|
||||
let x_57 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
let x_58 : f32 = f32(x_57);
|
||||
x_GLF_color = vec4<f32>(x_58, x_58, x_58, x_58);
|
||||
}
|
||||
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,67 @@
|
||||
cbuffer cbuffer_x_5 : register(b0, space0) {
|
||||
uint4 x_5[4];
|
||||
};
|
||||
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
void main_1() {
|
||||
int x_28 = 0;
|
||||
int x_29 = 0;
|
||||
int x_28_phi = 0;
|
||||
int x_31_phi = 0;
|
||||
int x_42_phi = 0;
|
||||
const int x_24 = min(1, reversebits(1));
|
||||
const int x_26 = asint(x_5[3].x);
|
||||
x_28_phi = x_26;
|
||||
x_31_phi = 1;
|
||||
while (true) {
|
||||
int x_32 = 0;
|
||||
x_28 = x_28_phi;
|
||||
const int x_31 = x_31_phi;
|
||||
x_42_phi = x_28;
|
||||
if ((x_31 <= (x_24 - 1))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
x_29 = asint((x_28 + asint(x_31)));
|
||||
const uint scalar_offset = ((16u * uint(0))) / 4;
|
||||
const int x_38 = asint(x_5[scalar_offset / 4][scalar_offset % 4]);
|
||||
if ((x_38 == 1)) {
|
||||
x_42_phi = x_29;
|
||||
break;
|
||||
}
|
||||
{
|
||||
x_32 = (x_31 + 1);
|
||||
x_28_phi = x_29;
|
||||
x_31_phi = x_32;
|
||||
}
|
||||
}
|
||||
const int x_42 = x_42_phi;
|
||||
const int x_44 = asint(x_5[2].x);
|
||||
if ((x_42 == x_44)) {
|
||||
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
|
||||
const int x_50 = asint(x_5[scalar_offset_1 / 4][scalar_offset_1 % 4]);
|
||||
const float x_51 = float(x_50);
|
||||
const int x_53 = asint(x_5[1].x);
|
||||
const float x_54 = float(x_53);
|
||||
x_GLF_color = float4(x_51, x_54, x_54, x_51);
|
||||
} else {
|
||||
const int x_57 = asint(x_5[1].x);
|
||||
const float x_58 = float(x_57);
|
||||
x_GLF_color = float4(x_58, x_58, x_58, x_58);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol {
|
||||
float4 x_GLF_color_1 : SV_Target0;
|
||||
};
|
||||
|
||||
tint_symbol main() {
|
||||
main_1();
|
||||
const main_out tint_symbol_1 = {x_GLF_color};
|
||||
const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1};
|
||||
return tint_symbol_3;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_padded_array_element {
|
||||
/* 0x0000 */ int el;
|
||||
/* 0x0004 */ int8_t tint_pad[12];
|
||||
};
|
||||
struct tint_array_wrapper {
|
||||
/* 0x0000 */ tint_padded_array_element arr[4];
|
||||
};
|
||||
struct buf0 {
|
||||
/* 0x0000 */ tint_array_wrapper x_GLF_uniform_int_values;
|
||||
};
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol_1 {
|
||||
float4 x_GLF_color_1 [[color(0)]];
|
||||
};
|
||||
|
||||
void main_1(constant buf0& x_5, thread float4* const tint_symbol_4) {
|
||||
int x_28 = 0;
|
||||
int x_29 = 0;
|
||||
int x_28_phi = 0;
|
||||
int x_31_phi = 0;
|
||||
int x_42_phi = 0;
|
||||
int const x_24 = min(1, reverse_bits(1));
|
||||
int const x_26 = x_5.x_GLF_uniform_int_values.arr[3].el;
|
||||
x_28_phi = x_26;
|
||||
x_31_phi = 1;
|
||||
while (true) {
|
||||
int x_32 = 0;
|
||||
x_28 = x_28_phi;
|
||||
int const x_31 = x_31_phi;
|
||||
x_42_phi = x_28;
|
||||
if ((x_31 <= (x_24 - 1))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
x_29 = as_type<int>((x_28 + as_type<int>(x_31)));
|
||||
int const x_38 = x_5.x_GLF_uniform_int_values.arr[0].el;
|
||||
if ((x_38 == 1)) {
|
||||
x_42_phi = x_29;
|
||||
break;
|
||||
}
|
||||
{
|
||||
x_32 = (x_31 + 1);
|
||||
x_28_phi = x_29;
|
||||
x_31_phi = x_32;
|
||||
}
|
||||
}
|
||||
int const x_42 = x_42_phi;
|
||||
int const x_44 = x_5.x_GLF_uniform_int_values.arr[2].el;
|
||||
if ((x_42 == x_44)) {
|
||||
int const x_50 = x_5.x_GLF_uniform_int_values.arr[0].el;
|
||||
float const x_51 = float(x_50);
|
||||
int const x_53 = x_5.x_GLF_uniform_int_values.arr[1].el;
|
||||
float const x_54 = float(x_53);
|
||||
*(tint_symbol_4) = float4(x_51, x_54, x_54, x_51);
|
||||
} else {
|
||||
int const x_57 = x_5.x_GLF_uniform_int_values.arr[1].el;
|
||||
float const x_58 = float(x_57);
|
||||
*(tint_symbol_4) = float4(x_58, x_58, x_58, x_58);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
fragment tint_symbol_1 tint_symbol(constant buf0& x_5 [[buffer(0)]]) {
|
||||
thread float4 tint_symbol_5 = 0.0f;
|
||||
main_1(x_5, &(tint_symbol_5));
|
||||
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_5};
|
||||
tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
|
||||
return tint_symbol_3;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 94
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%27 = 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_int_values"
|
||||
OpName %x_5 "x_5"
|
||||
OpName %x_GLF_color "x_GLF_color"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %main_1 "main_1"
|
||||
OpName %x_28 "x_28"
|
||||
OpName %x_29 "x_29"
|
||||
OpName %x_28_phi "x_28_phi"
|
||||
OpName %x_31_phi "x_31_phi"
|
||||
OpName %x_42_phi "x_42_phi"
|
||||
OpName %x_32 "x_32"
|
||||
OpName %main_out "main_out"
|
||||
OpMemberName %main_out 0 "x_GLF_color_1"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %main "main"
|
||||
OpDecorate %buf0 Block
|
||||
OpMemberDecorate %buf0 0 Offset 0
|
||||
OpDecorate %_arr_int_uint_4 ArrayStride 16
|
||||
OpDecorate %x_5 NonWritable
|
||||
OpDecorate %x_5 DescriptorSet 0
|
||||
OpDecorate %x_5 Binding 0
|
||||
OpDecorate %tint_symbol_1 Location 0
|
||||
OpMemberDecorate %main_out 0 Offset 0
|
||||
%int = OpTypeInt 32 1
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_4 = OpConstant %uint 4
|
||||
%_arr_int_uint_4 = OpTypeArray %int %uint_4
|
||||
%buf0 = OpTypeStruct %_arr_int_uint_4
|
||||
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
|
||||
%x_5 = OpVariable %_ptr_Uniform_buf0 Uniform
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Private_v4float = OpTypePointer Private %v4float
|
||||
%12 = OpConstantNull %v4float
|
||||
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %12
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %12
|
||||
%void = OpTypeVoid
|
||||
%15 = OpTypeFunction %void
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%21 = OpConstantNull %int
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%int_3 = OpConstant %int 3
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%bool = OpTypeBool
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_2 = OpConstant %int 2
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%82 = OpTypeFunction %void %main_out
|
||||
%main_1 = OpFunction %void None %15
|
||||
%18 = OpLabel
|
||||
%x_28 = OpVariable %_ptr_Function_int Function %21
|
||||
%x_29 = OpVariable %_ptr_Function_int Function %21
|
||||
%x_28_phi = OpVariable %_ptr_Function_int Function %21
|
||||
%x_31_phi = OpVariable %_ptr_Function_int Function %21
|
||||
%x_42_phi = OpVariable %_ptr_Function_int Function %21
|
||||
%x_32 = OpVariable %_ptr_Function_int Function %21
|
||||
%29 = OpBitReverse %int %int_1
|
||||
%26 = OpExtInst %int %27 SMin %int_1 %29
|
||||
%33 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_3
|
||||
%34 = OpLoad %int %33
|
||||
OpStore %x_28_phi %34
|
||||
OpStore %x_31_phi %int_1
|
||||
OpBranch %35
|
||||
%35 = OpLabel
|
||||
OpLoopMerge %36 %37 None
|
||||
OpBranch %38
|
||||
%38 = OpLabel
|
||||
%40 = OpLoad %int %x_28_phi
|
||||
OpStore %x_28 %40
|
||||
%41 = OpLoad %int %x_31_phi
|
||||
%42 = OpLoad %int %x_28
|
||||
OpStore %x_42_phi %42
|
||||
%43 = OpISub %int %26 %int_1
|
||||
%44 = OpSLessThanEqual %bool %41 %43
|
||||
OpSelectionMerge %46 None
|
||||
OpBranchConditional %44 %47 %48
|
||||
%47 = OpLabel
|
||||
OpBranch %46
|
||||
%48 = OpLabel
|
||||
OpBranch %36
|
||||
%46 = OpLabel
|
||||
%50 = OpLoad %int %x_28
|
||||
%51 = OpCopyObject %int %41
|
||||
%52 = OpIAdd %int %50 %51
|
||||
%49 = OpCopyObject %int %52
|
||||
OpStore %x_29 %49
|
||||
%54 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0
|
||||
%55 = OpLoad %int %54
|
||||
%56 = OpIEqual %bool %55 %int_1
|
||||
OpSelectionMerge %57 None
|
||||
OpBranchConditional %56 %58 %57
|
||||
%58 = OpLabel
|
||||
%59 = OpLoad %int %x_29
|
||||
OpStore %x_42_phi %59
|
||||
OpBranch %36
|
||||
%57 = OpLabel
|
||||
OpBranch %37
|
||||
%37 = OpLabel
|
||||
%60 = OpIAdd %int %41 %int_1
|
||||
OpStore %x_32 %60
|
||||
%61 = OpLoad %int %x_29
|
||||
OpStore %x_28_phi %61
|
||||
%62 = OpLoad %int %x_32
|
||||
OpStore %x_31_phi %62
|
||||
OpBranch %35
|
||||
%36 = OpLabel
|
||||
%63 = OpLoad %int %x_42_phi
|
||||
%65 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_2
|
||||
%66 = OpLoad %int %65
|
||||
%67 = OpIEqual %bool %63 %66
|
||||
OpSelectionMerge %68 None
|
||||
OpBranchConditional %67 %69 %70
|
||||
%69 = OpLabel
|
||||
%71 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_0
|
||||
%72 = OpLoad %int %71
|
||||
%73 = OpConvertSToF %float %72
|
||||
%74 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1
|
||||
%75 = OpLoad %int %74
|
||||
%76 = OpConvertSToF %float %75
|
||||
%77 = OpCompositeConstruct %v4float %73 %76 %76 %73
|
||||
OpStore %x_GLF_color %77
|
||||
OpBranch %68
|
||||
%70 = OpLabel
|
||||
%78 = OpAccessChain %_ptr_Uniform_int %x_5 %uint_0 %int_1
|
||||
%79 = OpLoad %int %78
|
||||
%80 = OpConvertSToF %float %79
|
||||
%81 = OpCompositeConstruct %v4float %80 %80 %80 %80
|
||||
OpStore %x_GLF_color %81
|
||||
OpBranch %68
|
||||
%68 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %82
|
||||
%tint_symbol = OpFunctionParameter %main_out
|
||||
%86 = OpLabel
|
||||
%87 = OpCompositeExtract %v4float %tint_symbol 0
|
||||
OpStore %tint_symbol_1 %87
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %15
|
||||
%89 = OpLabel
|
||||
%90 = OpFunctionCall %void %main_1
|
||||
%92 = OpLoad %v4float %x_GLF_color
|
||||
%93 = OpCompositeConstruct %main_out %92
|
||||
%91 = OpFunctionCall %void %tint_symbol_2 %93
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,69 @@
|
||||
type Arr = [[stride(16)]] array<i32, 4>;
|
||||
|
||||
[[block]]
|
||||
struct buf0 {
|
||||
x_GLF_uniform_int_values : Arr;
|
||||
};
|
||||
|
||||
[[group(0), binding(0)]] var<uniform> x_5 : buf0;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var x_28 : i32;
|
||||
var x_29 : i32;
|
||||
var x_28_phi : i32;
|
||||
var x_31_phi : i32;
|
||||
var x_42_phi : i32;
|
||||
let x_24 : i32 = min(1, reverseBits(1));
|
||||
let x_26 : i32 = x_5.x_GLF_uniform_int_values[3];
|
||||
x_28_phi = x_26;
|
||||
x_31_phi = 1;
|
||||
loop {
|
||||
var x_32 : i32;
|
||||
x_28 = x_28_phi;
|
||||
let x_31 : i32 = x_31_phi;
|
||||
x_42_phi = x_28;
|
||||
if ((x_31 <= (x_24 - 1))) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
x_29 = bitcast<i32>((x_28 + bitcast<i32>(x_31)));
|
||||
let x_38 : i32 = x_5.x_GLF_uniform_int_values[0];
|
||||
if ((x_38 == 1)) {
|
||||
x_42_phi = x_29;
|
||||
break;
|
||||
}
|
||||
|
||||
continuing {
|
||||
x_32 = (x_31 + 1);
|
||||
x_28_phi = x_29;
|
||||
x_31_phi = x_32;
|
||||
}
|
||||
}
|
||||
let x_42 : i32 = x_42_phi;
|
||||
let x_44 : i32 = x_5.x_GLF_uniform_int_values[2];
|
||||
if ((x_42 == x_44)) {
|
||||
let x_50 : i32 = x_5.x_GLF_uniform_int_values[0];
|
||||
let x_51 : f32 = f32(x_50);
|
||||
let x_53 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
let x_54 : f32 = f32(x_53);
|
||||
x_GLF_color = vec4<f32>(x_51, x_54, x_54, x_51);
|
||||
} else {
|
||||
let x_57 : i32 = x_5.x_GLF_uniform_int_values[1];
|
||||
let x_58 : f32 = f32(x_57);
|
||||
x_GLF_color = vec4<f32>(x_58, x_58, x_58, x_58);
|
||||
}
|
||||
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