mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-10 14:08:04 +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,90 @@
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %_GLF_color
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %main "main"
|
||||
OpName %idx "idx"
|
||||
OpName %buf1 "buf1"
|
||||
OpMemberName %buf1 0 "_GLF_uniform_int_values"
|
||||
OpName %_ ""
|
||||
OpName %a "a"
|
||||
OpName %indexable "indexable"
|
||||
OpName %_GLF_color "_GLF_color"
|
||||
OpDecorate %_arr_int_uint_2 ArrayStride 16
|
||||
OpMemberDecorate %buf1 0 Offset 0
|
||||
OpDecorate %buf1 Block
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 1
|
||||
OpDecorate %_GLF_color Location 0
|
||||
%void = OpTypeVoid
|
||||
%11 = OpTypeFunction %void
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_int_uint_2 = OpTypeArray %int %uint_2
|
||||
%buf1 = OpTypeStruct %_arr_int_uint_2
|
||||
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
|
||||
%_ = OpVariable %_ptr_Uniform_buf1 Uniform
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2
|
||||
%bool = OpTypeBool
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_GLF_color = OpVariable %_ptr_Output_v4float Output
|
||||
%main = OpFunction %void None %11
|
||||
%25 = OpLabel
|
||||
%idx = OpVariable %_ptr_Function_int Function
|
||||
%a = OpVariable %_ptr_Function_int Function
|
||||
%indexable = OpVariable %_ptr_Function__arr_int_uint_2 Function
|
||||
%26 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
|
||||
%27 = OpLoad %int %26
|
||||
%28 = OpShiftLeftLogical %int %int_1 %27
|
||||
OpStore %idx %28
|
||||
%29 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
|
||||
%30 = OpLoad %int %29
|
||||
%31 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
|
||||
%32 = OpLoad %int %31
|
||||
%33 = OpCompositeConstruct %_arr_int_uint_2 %30 %32
|
||||
%34 = OpLoad %int %idx
|
||||
OpStore %indexable %33
|
||||
%35 = OpAccessChain %_ptr_Function_int %indexable %34
|
||||
%36 = OpLoad %int %35
|
||||
OpStore %a %36
|
||||
%37 = OpLoad %int %a
|
||||
%38 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
|
||||
%39 = OpLoad %int %38
|
||||
%40 = OpIEqual %bool %37 %39
|
||||
OpSelectionMerge %41 None
|
||||
OpBranchConditional %40 %42 %43
|
||||
%42 = OpLabel
|
||||
%44 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
|
||||
%45 = OpLoad %int %44
|
||||
%46 = OpConvertSToF %float %45
|
||||
%47 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
|
||||
%48 = OpLoad %int %47
|
||||
%49 = OpConvertSToF %float %48
|
||||
%50 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
|
||||
%51 = OpLoad %int %50
|
||||
%52 = OpConvertSToF %float %51
|
||||
%53 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_0
|
||||
%54 = OpLoad %int %53
|
||||
%55 = OpConvertSToF %float %54
|
||||
%56 = OpCompositeConstruct %v4float %46 %49 %52 %55
|
||||
OpStore %_GLF_color %56
|
||||
OpBranch %41
|
||||
%43 = OpLabel
|
||||
%57 = OpAccessChain %_ptr_Uniform_int %_ %int_0 %int_1
|
||||
%58 = OpLoad %int %57
|
||||
%59 = OpConvertSToF %float %58
|
||||
%60 = OpCompositeConstruct %v4float %59 %59 %59 %59
|
||||
OpStore %_GLF_color %60
|
||||
OpBranch %41
|
||||
%41 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,55 @@
|
||||
struct tint_padded_array_element {
|
||||
int el;
|
||||
};
|
||||
|
||||
cbuffer cbuffer_x_6 : register(b1, space0) {
|
||||
uint4 x_6[2];
|
||||
};
|
||||
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
void main_1() {
|
||||
int idx = 0;
|
||||
int a = 0;
|
||||
tint_padded_array_element indexable[2] = (tint_padded_array_element[2])0;
|
||||
const int x_27 = asint(x_6[1].x);
|
||||
idx = (1 << asuint(x_27));
|
||||
const int x_30 = asint(x_6[1].x);
|
||||
const uint scalar_offset = ((16u * uint(0))) / 4;
|
||||
const int x_32 = asint(x_6[scalar_offset / 4][scalar_offset % 4]);
|
||||
const int x_34 = idx;
|
||||
const tint_padded_array_element tint_symbol_3[2] = {{x_30}, {x_32}};
|
||||
indexable = tint_symbol_3;
|
||||
const int x_36 = indexable[x_34].el;
|
||||
a = x_36;
|
||||
const int x_37 = a;
|
||||
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
|
||||
const int x_39 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]);
|
||||
if ((x_37 == x_39)) {
|
||||
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
|
||||
const int x_45 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]);
|
||||
const int x_48 = asint(x_6[1].x);
|
||||
const int x_51 = asint(x_6[1].x);
|
||||
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
|
||||
const int x_54 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]);
|
||||
x_GLF_color = float4(float(x_45), float(x_48), float(x_51), float(x_54));
|
||||
} else {
|
||||
const int x_58 = asint(x_6[1].x);
|
||||
const float x_59 = float(x_58);
|
||||
x_GLF_color = float4(x_59, x_59, x_59, x_59);
|
||||
}
|
||||
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,57 @@
|
||||
#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[2];
|
||||
};
|
||||
struct buf1 {
|
||||
/* 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 buf1& x_6, thread float4* const tint_symbol_5) {
|
||||
int idx = 0;
|
||||
int a = 0;
|
||||
tint_array_wrapper indexable = {};
|
||||
int const x_27 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
idx = (1 << as_type<uint>(x_27));
|
||||
int const x_30 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_32 = x_6.x_GLF_uniform_int_values.arr[0].el;
|
||||
int const x_34 = idx;
|
||||
tint_array_wrapper const tint_symbol_3 = {.arr={{.el=x_30}, {.el=x_32}}};
|
||||
indexable = tint_symbol_3;
|
||||
int const x_36 = indexable.arr[x_34].el;
|
||||
a = x_36;
|
||||
int const x_37 = a;
|
||||
int const x_39 = x_6.x_GLF_uniform_int_values.arr[0].el;
|
||||
if ((x_37 == x_39)) {
|
||||
int const x_45 = x_6.x_GLF_uniform_int_values.arr[0].el;
|
||||
int const x_48 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_51 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_54 = x_6.x_GLF_uniform_int_values.arr[0].el;
|
||||
*(tint_symbol_5) = float4(float(x_45), float(x_48), float(x_51), float(x_54));
|
||||
} else {
|
||||
int const x_58 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
float const x_59 = float(x_58);
|
||||
*(tint_symbol_5) = float4(x_59, x_59, x_59, x_59);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]]) {
|
||||
thread float4 tint_symbol_6 = 0.0f;
|
||||
main_1(x_6, &(tint_symbol_6));
|
||||
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6};
|
||||
tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
|
||||
return tint_symbol_4;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 79
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
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 %x_GLF_color "x_GLF_color"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %main_1 "main_1"
|
||||
OpName %idx "idx"
|
||||
OpName %a "a"
|
||||
OpName %indexable "indexable"
|
||||
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_2 ArrayStride 16
|
||||
OpDecorate %x_6 NonWritable
|
||||
OpDecorate %x_6 DescriptorSet 0
|
||||
OpDecorate %x_6 Binding 1
|
||||
OpDecorate %tint_symbol_1 Location 0
|
||||
OpMemberDecorate %main_out 0 Offset 0
|
||||
%int = OpTypeInt 32 1
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_int_uint_2 = OpTypeArray %int %uint_2
|
||||
%buf1 = OpTypeStruct %_arr_int_uint_2
|
||||
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
|
||||
%x_6 = OpVariable %_ptr_Uniform_buf1 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
|
||||
%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2
|
||||
%25 = OpConstantNull %_arr_int_uint_2
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%bool = OpTypeBool
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%67 = OpTypeFunction %void %main_out
|
||||
%main_1 = OpFunction %void None %15
|
||||
%18 = OpLabel
|
||||
%idx = OpVariable %_ptr_Function_int Function %21
|
||||
%a = OpVariable %_ptr_Function_int Function %21
|
||||
%indexable = OpVariable %_ptr_Function__arr_int_uint_2 Function %25
|
||||
%29 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%30 = OpLoad %int %29
|
||||
%31 = OpBitcast %uint %30
|
||||
%32 = OpShiftLeftLogical %int %int_1 %31
|
||||
OpStore %idx %32
|
||||
%33 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%34 = OpLoad %int %33
|
||||
%36 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
|
||||
%37 = OpLoad %int %36
|
||||
%38 = OpLoad %int %idx
|
||||
%39 = OpCompositeConstruct %_arr_int_uint_2 %34 %37
|
||||
OpStore %indexable %39
|
||||
%40 = OpAccessChain %_ptr_Function_int %indexable %38
|
||||
%41 = OpLoad %int %40
|
||||
OpStore %a %41
|
||||
%42 = OpLoad %int %a
|
||||
%43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
|
||||
%44 = OpLoad %int %43
|
||||
%45 = OpIEqual %bool %42 %44
|
||||
OpSelectionMerge %47 None
|
||||
OpBranchConditional %45 %48 %49
|
||||
%48 = OpLabel
|
||||
%50 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
|
||||
%51 = OpLoad %int %50
|
||||
%52 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%53 = OpLoad %int %52
|
||||
%54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%55 = OpLoad %int %54
|
||||
%56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
|
||||
%57 = OpLoad %int %56
|
||||
%58 = OpConvertSToF %float %51
|
||||
%59 = OpConvertSToF %float %53
|
||||
%60 = OpConvertSToF %float %55
|
||||
%61 = OpConvertSToF %float %57
|
||||
%62 = OpCompositeConstruct %v4float %58 %59 %60 %61
|
||||
OpStore %x_GLF_color %62
|
||||
OpBranch %47
|
||||
%49 = OpLabel
|
||||
%63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%64 = OpLoad %int %63
|
||||
%65 = OpConvertSToF %float %64
|
||||
%66 = OpCompositeConstruct %v4float %65 %65 %65 %65
|
||||
OpStore %x_GLF_color %66
|
||||
OpBranch %47
|
||||
%47 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %67
|
||||
%tint_symbol = OpFunctionParameter %main_out
|
||||
%71 = OpLabel
|
||||
%72 = OpCompositeExtract %v4float %tint_symbol 0
|
||||
OpStore %tint_symbol_1 %72
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %15
|
||||
%74 = OpLabel
|
||||
%75 = OpFunctionCall %void %main_1
|
||||
%77 = OpLoad %v4float %x_GLF_color
|
||||
%78 = OpCompositeConstruct %main_out %77
|
||||
%76 = OpFunctionCall %void %tint_symbol_2 %78
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,49 @@
|
||||
type Arr = [[stride(16)]] array<i32, 2>;
|
||||
|
||||
[[block]]
|
||||
struct buf1 {
|
||||
x_GLF_uniform_int_values : Arr;
|
||||
};
|
||||
|
||||
[[group(0), binding(1)]] var<uniform> x_6 : buf1;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var idx : i32;
|
||||
var a : i32;
|
||||
var indexable : Arr;
|
||||
let x_27 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
idx = (1 << bitcast<u32>(x_27));
|
||||
let x_30 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_32 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
let x_34 : i32 = idx;
|
||||
indexable = Arr(x_30, x_32);
|
||||
let x_36 : i32 = indexable[x_34];
|
||||
a = x_36;
|
||||
let x_37 : i32 = a;
|
||||
let x_39 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
if ((x_37 == x_39)) {
|
||||
let x_45 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
let x_48 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_51 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_54 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
x_GLF_color = vec4<f32>(f32(x_45), f32(x_48), f32(x_51), f32(x_54));
|
||||
} else {
|
||||
let x_58 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_59 : f32 = f32(x_58);
|
||||
x_GLF_color = vec4<f32>(x_59, x_59, x_59, x_59);
|
||||
}
|
||||
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,49 @@
|
||||
type Arr = [[stride(16)]] array<i32, 2>;
|
||||
|
||||
[[block]]
|
||||
struct buf1 {
|
||||
x_GLF_uniform_int_values : Arr;
|
||||
};
|
||||
|
||||
[[group(0), binding(1)]] var<uniform> x_6 : buf1;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var idx : i32;
|
||||
var a : i32;
|
||||
var indexable : Arr;
|
||||
let x_27 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
idx = (1 << bitcast<u32>(x_27));
|
||||
let x_30 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_32 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
let x_34 : i32 = idx;
|
||||
indexable = Arr(x_30, x_32);
|
||||
let x_36 : i32 = indexable[x_34];
|
||||
a = x_36;
|
||||
let x_37 : i32 = a;
|
||||
let x_39 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
if ((x_37 == x_39)) {
|
||||
let x_45 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
let x_48 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_51 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_54 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
x_GLF_color = vec4<f32>(f32(x_45), f32(x_48), f32(x_51), f32(x_54));
|
||||
} else {
|
||||
let x_58 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_59 : f32 = f32(x_58);
|
||||
x_GLF_color = vec4<f32>(x_59, x_59, x_59, x_59);
|
||||
}
|
||||
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,55 @@
|
||||
struct tint_padded_array_element {
|
||||
int el;
|
||||
};
|
||||
|
||||
cbuffer cbuffer_x_6 : register(b1, space0) {
|
||||
uint4 x_6[2];
|
||||
};
|
||||
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
void main_1() {
|
||||
int idx = 0;
|
||||
int a = 0;
|
||||
tint_padded_array_element indexable[2] = (tint_padded_array_element[2])0;
|
||||
const int x_27 = asint(x_6[1].x);
|
||||
idx = (1 << asuint(x_27));
|
||||
const int x_30 = asint(x_6[1].x);
|
||||
const uint scalar_offset = ((16u * uint(0))) / 4;
|
||||
const int x_32 = asint(x_6[scalar_offset / 4][scalar_offset % 4]);
|
||||
const int x_34 = idx;
|
||||
const tint_padded_array_element tint_symbol_3[2] = {{x_30}, {x_32}};
|
||||
indexable = tint_symbol_3;
|
||||
const int x_36 = indexable[x_34].el;
|
||||
a = x_36;
|
||||
const int x_37 = a;
|
||||
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
|
||||
const int x_39 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]);
|
||||
if ((x_37 == x_39)) {
|
||||
const uint scalar_offset_2 = ((16u * uint(0))) / 4;
|
||||
const int x_45 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]);
|
||||
const int x_48 = asint(x_6[1].x);
|
||||
const int x_51 = asint(x_6[1].x);
|
||||
const uint scalar_offset_3 = ((16u * uint(0))) / 4;
|
||||
const int x_54 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]);
|
||||
x_GLF_color = float4(float(x_45), float(x_48), float(x_51), float(x_54));
|
||||
} else {
|
||||
const int x_58 = asint(x_6[1].x);
|
||||
const float x_59 = float(x_58);
|
||||
x_GLF_color = float4(x_59, x_59, x_59, x_59);
|
||||
}
|
||||
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,57 @@
|
||||
#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[2];
|
||||
};
|
||||
struct buf1 {
|
||||
/* 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 buf1& x_6, thread float4* const tint_symbol_5) {
|
||||
int idx = 0;
|
||||
int a = 0;
|
||||
tint_array_wrapper indexable = {};
|
||||
int const x_27 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
idx = (1 << as_type<uint>(x_27));
|
||||
int const x_30 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_32 = x_6.x_GLF_uniform_int_values.arr[0].el;
|
||||
int const x_34 = idx;
|
||||
tint_array_wrapper const tint_symbol_3 = {.arr={{.el=x_30}, {.el=x_32}}};
|
||||
indexable = tint_symbol_3;
|
||||
int const x_36 = indexable.arr[x_34].el;
|
||||
a = x_36;
|
||||
int const x_37 = a;
|
||||
int const x_39 = x_6.x_GLF_uniform_int_values.arr[0].el;
|
||||
if ((x_37 == x_39)) {
|
||||
int const x_45 = x_6.x_GLF_uniform_int_values.arr[0].el;
|
||||
int const x_48 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_51 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
int const x_54 = x_6.x_GLF_uniform_int_values.arr[0].el;
|
||||
*(tint_symbol_5) = float4(float(x_45), float(x_48), float(x_51), float(x_54));
|
||||
} else {
|
||||
int const x_58 = x_6.x_GLF_uniform_int_values.arr[1].el;
|
||||
float const x_59 = float(x_58);
|
||||
*(tint_symbol_5) = float4(x_59, x_59, x_59, x_59);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
fragment tint_symbol_1 tint_symbol(constant buf1& x_6 [[buffer(1)]]) {
|
||||
thread float4 tint_symbol_6 = 0.0f;
|
||||
main_1(x_6, &(tint_symbol_6));
|
||||
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_6};
|
||||
tint_symbol_1 const tint_symbol_4 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
|
||||
return tint_symbol_4;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 79
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
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 %x_GLF_color "x_GLF_color"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %main_1 "main_1"
|
||||
OpName %idx "idx"
|
||||
OpName %a "a"
|
||||
OpName %indexable "indexable"
|
||||
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_2 ArrayStride 16
|
||||
OpDecorate %x_6 NonWritable
|
||||
OpDecorate %x_6 DescriptorSet 0
|
||||
OpDecorate %x_6 Binding 1
|
||||
OpDecorate %tint_symbol_1 Location 0
|
||||
OpMemberDecorate %main_out 0 Offset 0
|
||||
%int = OpTypeInt 32 1
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%_arr_int_uint_2 = OpTypeArray %int %uint_2
|
||||
%buf1 = OpTypeStruct %_arr_int_uint_2
|
||||
%_ptr_Uniform_buf1 = OpTypePointer Uniform %buf1
|
||||
%x_6 = OpVariable %_ptr_Uniform_buf1 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
|
||||
%_ptr_Function__arr_int_uint_2 = OpTypePointer Function %_arr_int_uint_2
|
||||
%25 = OpConstantNull %_arr_int_uint_2
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Uniform_int = OpTypePointer Uniform %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%bool = OpTypeBool
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%67 = OpTypeFunction %void %main_out
|
||||
%main_1 = OpFunction %void None %15
|
||||
%18 = OpLabel
|
||||
%idx = OpVariable %_ptr_Function_int Function %21
|
||||
%a = OpVariable %_ptr_Function_int Function %21
|
||||
%indexable = OpVariable %_ptr_Function__arr_int_uint_2 Function %25
|
||||
%29 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%30 = OpLoad %int %29
|
||||
%31 = OpBitcast %uint %30
|
||||
%32 = OpShiftLeftLogical %int %int_1 %31
|
||||
OpStore %idx %32
|
||||
%33 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%34 = OpLoad %int %33
|
||||
%36 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
|
||||
%37 = OpLoad %int %36
|
||||
%38 = OpLoad %int %idx
|
||||
%39 = OpCompositeConstruct %_arr_int_uint_2 %34 %37
|
||||
OpStore %indexable %39
|
||||
%40 = OpAccessChain %_ptr_Function_int %indexable %38
|
||||
%41 = OpLoad %int %40
|
||||
OpStore %a %41
|
||||
%42 = OpLoad %int %a
|
||||
%43 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
|
||||
%44 = OpLoad %int %43
|
||||
%45 = OpIEqual %bool %42 %44
|
||||
OpSelectionMerge %47 None
|
||||
OpBranchConditional %45 %48 %49
|
||||
%48 = OpLabel
|
||||
%50 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
|
||||
%51 = OpLoad %int %50
|
||||
%52 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%53 = OpLoad %int %52
|
||||
%54 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%55 = OpLoad %int %54
|
||||
%56 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_0
|
||||
%57 = OpLoad %int %56
|
||||
%58 = OpConvertSToF %float %51
|
||||
%59 = OpConvertSToF %float %53
|
||||
%60 = OpConvertSToF %float %55
|
||||
%61 = OpConvertSToF %float %57
|
||||
%62 = OpCompositeConstruct %v4float %58 %59 %60 %61
|
||||
OpStore %x_GLF_color %62
|
||||
OpBranch %47
|
||||
%49 = OpLabel
|
||||
%63 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0 %int_1
|
||||
%64 = OpLoad %int %63
|
||||
%65 = OpConvertSToF %float %64
|
||||
%66 = OpCompositeConstruct %v4float %65 %65 %65 %65
|
||||
OpStore %x_GLF_color %66
|
||||
OpBranch %47
|
||||
%47 = OpLabel
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_2 = OpFunction %void None %67
|
||||
%tint_symbol = OpFunctionParameter %main_out
|
||||
%71 = OpLabel
|
||||
%72 = OpCompositeExtract %v4float %tint_symbol 0
|
||||
OpStore %tint_symbol_1 %72
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %15
|
||||
%74 = OpLabel
|
||||
%75 = OpFunctionCall %void %main_1
|
||||
%77 = OpLoad %v4float %x_GLF_color
|
||||
%78 = OpCompositeConstruct %main_out %77
|
||||
%76 = OpFunctionCall %void %tint_symbol_2 %78
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,49 @@
|
||||
type Arr = [[stride(16)]] array<i32, 2>;
|
||||
|
||||
[[block]]
|
||||
struct buf1 {
|
||||
x_GLF_uniform_int_values : Arr;
|
||||
};
|
||||
|
||||
[[group(0), binding(1)]] var<uniform> x_6 : buf1;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var idx : i32;
|
||||
var a : i32;
|
||||
var indexable : Arr;
|
||||
let x_27 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
idx = (1 << bitcast<u32>(x_27));
|
||||
let x_30 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_32 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
let x_34 : i32 = idx;
|
||||
indexable = Arr(x_30, x_32);
|
||||
let x_36 : i32 = indexable[x_34];
|
||||
a = x_36;
|
||||
let x_37 : i32 = a;
|
||||
let x_39 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
if ((x_37 == x_39)) {
|
||||
let x_45 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
let x_48 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_51 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_54 : i32 = x_6.x_GLF_uniform_int_values[0];
|
||||
x_GLF_color = vec4<f32>(f32(x_45), f32(x_48), f32(x_51), f32(x_54));
|
||||
} else {
|
||||
let x_58 : i32 = x_6.x_GLF_uniform_int_values[1];
|
||||
let x_59 : f32 = f32(x_58);
|
||||
x_GLF_color = vec4<f32>(x_59, x_59, x_59, x_59);
|
||||
}
|
||||
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