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,92 @@
|
||||
OpCapability Shader
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %gl_FragCoord %_GLF_color
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpSource ESSL 310
|
||||
OpName %main "main"
|
||||
OpName %data "data"
|
||||
OpName %i "i"
|
||||
OpName %gl_FragCoord "gl_FragCoord"
|
||||
OpName %_GLF_color "_GLF_color"
|
||||
OpDecorate %i RelaxedPrecision
|
||||
OpDecorate %7 RelaxedPrecision
|
||||
OpDecorate %gl_FragCoord BuiltIn FragCoord
|
||||
OpDecorate %8 RelaxedPrecision
|
||||
OpDecorate %9 RelaxedPrecision
|
||||
OpDecorate %10 RelaxedPrecision
|
||||
OpDecorate %_GLF_color Location 0
|
||||
%void = OpTypeVoid
|
||||
%12 = OpTypeFunction %void
|
||||
%float = OpTypeFloat 32
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_10 = OpConstant %uint 10
|
||||
%_arr_float_uint_10 = OpTypeArray %float %uint_10
|
||||
%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10
|
||||
%float_0_100000001 = OpConstant %float 0.100000001
|
||||
%float_0_200000003 = OpConstant %float 0.200000003
|
||||
%float_0_300000012 = OpConstant %float 0.300000012
|
||||
%float_0_400000006 = OpConstant %float 0.400000006
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%float_0_600000024 = OpConstant %float 0.600000024
|
||||
%float_0_699999988 = OpConstant %float 0.699999988
|
||||
%float_0_800000012 = OpConstant %float 0.800000012
|
||||
%float_0_899999976 = OpConstant %float 0.899999976
|
||||
%float_1 = OpConstant %float 1
|
||||
%28 = OpConstantComposite %_arr_float_uint_10 %float_0_100000001 %float_0_200000003 %float_0_300000012 %float_0_400000006 %float_0_5 %float_0_600000024 %float_0_699999988 %float_0_800000012 %float_0_899999976 %float_1
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_10 = OpConstant %int 10
|
||||
%bool = OpTypeBool
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%gl_FragCoord = OpVariable %_ptr_Input_v4float Input
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Input_float = OpTypePointer Input %float
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%_GLF_color = OpVariable %_ptr_Output_v4float Output
|
||||
%main = OpFunction %void None %12
|
||||
%42 = OpLabel
|
||||
%data = OpVariable %_ptr_Function__arr_float_uint_10 Function
|
||||
%i = OpVariable %_ptr_Function_int Function
|
||||
OpStore %data %28
|
||||
OpStore %i %int_0
|
||||
OpBranch %43
|
||||
%43 = OpLabel
|
||||
OpLoopMerge %44 %45 None
|
||||
OpBranch %46
|
||||
%46 = OpLabel
|
||||
%7 = OpLoad %int %i
|
||||
%47 = OpSLessThan %bool %7 %int_10
|
||||
OpBranchConditional %47 %48 %44
|
||||
%48 = OpLabel
|
||||
%49 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0
|
||||
%50 = OpLoad %float %49
|
||||
%51 = OpFOrdLessThan %bool %50 %float_0
|
||||
OpSelectionMerge %52 None
|
||||
OpBranchConditional %51 %53 %52
|
||||
%53 = OpLabel
|
||||
OpKill
|
||||
%52 = OpLabel
|
||||
%8 = OpLoad %int %i
|
||||
%54 = OpAccessChain %_ptr_Function_float %data %8
|
||||
%55 = OpLoad %float %54
|
||||
%56 = OpAccessChain %_ptr_Function_float %data %int_0
|
||||
OpStore %56 %55
|
||||
OpBranch %45
|
||||
%45 = OpLabel
|
||||
%9 = OpLoad %int %i
|
||||
%10 = OpIAdd %int %9 %int_1
|
||||
OpStore %i %10
|
||||
OpBranch %43
|
||||
%44 = OpLabel
|
||||
%57 = OpAccessChain %_ptr_Function_float %data %int_0
|
||||
%58 = OpLoad %float %57
|
||||
%59 = OpCompositeConstruct %v4float %58 %float_0 %float_0 %float_1
|
||||
OpStore %_GLF_color %59
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,42 @@
|
||||
static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
void main_1() {
|
||||
float data[10] = (float[10])0;
|
||||
int i = 0;
|
||||
const float tint_symbol_4[10] = {0.100000001f, 0.200000003f, 0.300000012f, 0.400000006f, 0.5f, 0.600000024f, 0.699999988f, 0.800000012f, 0.899999976f, 1.0f};
|
||||
data = tint_symbol_4;
|
||||
i = 0;
|
||||
{
|
||||
for(; (i < 10); i = (i + 1)) {
|
||||
const float x_50 = gl_FragCoord.x;
|
||||
if ((x_50 < 0.0f)) {
|
||||
discard;
|
||||
}
|
||||
const float x_55 = data[i];
|
||||
data[0] = x_55;
|
||||
}
|
||||
}
|
||||
const float x_58 = data[0];
|
||||
x_GLF_color = float4(x_58, 0.0f, 0.0f, 1.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol_1 {
|
||||
float4 gl_FragCoord_param : SV_Position;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float4 x_GLF_color_1 : SV_Target0;
|
||||
};
|
||||
|
||||
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
||||
const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param;
|
||||
gl_FragCoord = gl_FragCoord_param;
|
||||
main_1();
|
||||
const main_out tint_symbol_3 = {x_GLF_color};
|
||||
const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_array_wrapper {
|
||||
float arr[10];
|
||||
};
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float4 x_GLF_color_1 [[color(0)]];
|
||||
};
|
||||
|
||||
void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) {
|
||||
tint_array_wrapper data = {};
|
||||
int i = 0;
|
||||
tint_array_wrapper const tint_symbol_4 = {.arr={0.100000001f, 0.200000003f, 0.300000012f, 0.400000006f, 0.5f, 0.600000024f, 0.699999988f, 0.800000012f, 0.899999976f, 1.0f}};
|
||||
data = tint_symbol_4;
|
||||
i = 0;
|
||||
while (true) {
|
||||
int const x_7 = i;
|
||||
if ((x_7 < 10)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
float const x_50 = (*(tint_symbol_6)).x;
|
||||
if ((x_50 < 0.0f)) {
|
||||
discard_fragment();
|
||||
}
|
||||
int const x_8 = i;
|
||||
float const x_55 = data.arr[x_8];
|
||||
data.arr[0] = x_55;
|
||||
{
|
||||
int const x_9 = i;
|
||||
i = (x_9 + 1);
|
||||
}
|
||||
}
|
||||
float const x_58 = data.arr[0];
|
||||
*(tint_symbol_7) = float4(x_58, 0.0f, 0.0f, 1.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) {
|
||||
thread float4 tint_symbol_8 = 0.0f;
|
||||
thread float4 tint_symbol_9 = 0.0f;
|
||||
tint_symbol_8 = gl_FragCoord_param;
|
||||
main_1(&(tint_symbol_8), &(tint_symbol_9));
|
||||
main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9};
|
||||
tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 80
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %gl_FragCoord "gl_FragCoord"
|
||||
OpName %x_GLF_color "x_GLF_color"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %main_1 "main_1"
|
||||
OpName %data "data"
|
||||
OpName %i "i"
|
||||
OpName %main_out "main_out"
|
||||
OpMemberName %main_out 0 "x_GLF_color_1"
|
||||
OpName %tint_symbol_3 "tint_symbol_3"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %main "main"
|
||||
OpDecorate %tint_symbol BuiltIn FragCoord
|
||||
OpDecorate %tint_symbol_2 Location 0
|
||||
OpDecorate %_arr_float_uint_10 ArrayStride 4
|
||||
OpMemberDecorate %main_out 0 Offset 0
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Private_v4float = OpTypePointer Private %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5
|
||||
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%tint_symbol = OpVariable %_ptr_Input_v4float Input
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5
|
||||
%void = OpTypeVoid
|
||||
%11 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_10 = OpConstant %uint 10
|
||||
%_arr_float_uint_10 = OpTypeArray %float %uint_10
|
||||
%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10
|
||||
%20 = OpConstantNull %_arr_float_uint_10
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%24 = OpConstantNull %int
|
||||
%float_0_100000001 = OpConstant %float 0.100000001
|
||||
%float_0_200000003 = OpConstant %float 0.200000003
|
||||
%float_0_300000012 = OpConstant %float 0.300000012
|
||||
%float_0_400000006 = OpConstant %float 0.400000006
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%float_0_600000024 = OpConstant %float 0.600000024
|
||||
%float_0_699999988 = OpConstant %float 0.699999988
|
||||
%float_0_800000012 = OpConstant %float 0.800000012
|
||||
%float_0_899999976 = OpConstant %float 0.899999976
|
||||
%float_1 = OpConstant %float 1
|
||||
%35 = OpConstantComposite %_arr_float_uint_10 %float_0_100000001 %float_0_200000003 %float_0_300000012 %float_0_400000006 %float_0_5 %float_0_600000024 %float_0_699999988 %float_0_800000012 %float_0_899999976 %float_1
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_10 = OpConstant %int 10
|
||||
%bool = OpTypeBool
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Private_float = OpTypePointer Private %float
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%int_1 = OpConstant %int 1
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%67 = OpTypeFunction %void %main_out
|
||||
%main_1 = OpFunction %void None %11
|
||||
%14 = OpLabel
|
||||
%data = OpVariable %_ptr_Function__arr_float_uint_10 Function %20
|
||||
%i = OpVariable %_ptr_Function_int Function %24
|
||||
OpStore %data %35
|
||||
OpStore %i %int_0
|
||||
OpBranch %37
|
||||
%37 = OpLabel
|
||||
OpLoopMerge %38 %39 None
|
||||
OpBranch %40
|
||||
%40 = OpLabel
|
||||
%41 = OpLoad %int %i
|
||||
%43 = OpSLessThan %bool %41 %int_10
|
||||
OpSelectionMerge %45 None
|
||||
OpBranchConditional %43 %46 %47
|
||||
%46 = OpLabel
|
||||
OpBranch %45
|
||||
%47 = OpLabel
|
||||
OpBranch %38
|
||||
%45 = OpLabel
|
||||
%50 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0
|
||||
%51 = OpLoad %float %50
|
||||
%53 = OpFOrdLessThan %bool %51 %float_0
|
||||
OpSelectionMerge %54 None
|
||||
OpBranchConditional %53 %55 %54
|
||||
%55 = OpLabel
|
||||
OpKill
|
||||
%54 = OpLabel
|
||||
%56 = OpLoad %int %i
|
||||
%58 = OpAccessChain %_ptr_Function_float %data %56
|
||||
%59 = OpLoad %float %58
|
||||
%60 = OpAccessChain %_ptr_Function_float %data %int_0
|
||||
OpStore %60 %59
|
||||
OpBranch %39
|
||||
%39 = OpLabel
|
||||
%61 = OpLoad %int %i
|
||||
%63 = OpIAdd %int %61 %int_1
|
||||
OpStore %i %63
|
||||
OpBranch %37
|
||||
%38 = OpLabel
|
||||
%64 = OpAccessChain %_ptr_Function_float %data %int_0
|
||||
%65 = OpLoad %float %64
|
||||
%66 = OpCompositeConstruct %v4float %65 %float_0 %float_0 %float_1
|
||||
OpStore %x_GLF_color %66
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_3 = OpFunction %void None %67
|
||||
%tint_symbol_1 = OpFunctionParameter %main_out
|
||||
%71 = OpLabel
|
||||
%72 = OpCompositeExtract %v4float %tint_symbol_1 0
|
||||
OpStore %tint_symbol_2 %72
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %11
|
||||
%74 = OpLabel
|
||||
%75 = OpLoad %v4float %tint_symbol
|
||||
OpStore %gl_FragCoord %75
|
||||
%76 = OpFunctionCall %void %main_1
|
||||
%78 = OpLoad %v4float %x_GLF_color
|
||||
%79 = OpCompositeConstruct %main_out %78
|
||||
%77 = OpFunctionCall %void %tint_symbol_3 %79
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,44 @@
|
||||
var<private> gl_FragCoord : vec4<f32>;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var data : array<f32, 10>;
|
||||
var i : i32;
|
||||
data = array<f32, 10>(0.100000001, 0.200000003, 0.300000012, 0.400000006, 0.5, 0.600000024, 0.699999988, 0.800000012, 0.899999976, 1.0);
|
||||
i = 0;
|
||||
loop {
|
||||
let x_7 : i32 = i;
|
||||
if ((x_7 < 10)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_50 : f32 = gl_FragCoord.x;
|
||||
if ((x_50 < 0.0)) {
|
||||
discard;
|
||||
}
|
||||
let x_8 : i32 = i;
|
||||
let x_55 : f32 = data[x_8];
|
||||
data[0] = x_55;
|
||||
|
||||
continuing {
|
||||
let x_9 : i32 = i;
|
||||
i = (x_9 + 1);
|
||||
}
|
||||
}
|
||||
let x_58 : f32 = data[0];
|
||||
x_GLF_color = vec4<f32>(x_58, 0.0, 0.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
[[location(0)]]
|
||||
x_GLF_color_1 : vec4<f32>;
|
||||
};
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn main([[builtin(position)]] gl_FragCoord_param : vec4<f32>) -> main_out {
|
||||
gl_FragCoord = gl_FragCoord_param;
|
||||
main_1();
|
||||
return main_out(x_GLF_color);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
var<private> gl_FragCoord : vec4<f32>;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var data : array<f32, 10>;
|
||||
var i : i32;
|
||||
data = array<f32, 10>(0.100000001, 0.200000003, 0.300000012, 0.400000006, 0.5, 0.600000024, 0.699999988, 0.800000012, 0.899999976, 1.0);
|
||||
i = 0;
|
||||
loop {
|
||||
let x_7 : i32 = i;
|
||||
if ((x_7 < 10)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_50 : f32 = gl_FragCoord.x;
|
||||
if ((x_50 < 0.0)) {
|
||||
discard;
|
||||
}
|
||||
let x_8 : i32 = i;
|
||||
let x_55 : f32 = data[x_8];
|
||||
data[0] = x_55;
|
||||
|
||||
continuing {
|
||||
let x_9 : i32 = i;
|
||||
i = (x_9 + 1);
|
||||
}
|
||||
}
|
||||
let x_58 : f32 = data[0];
|
||||
x_GLF_color = vec4<f32>(x_58, 0.0, 0.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
[[location(0)]]
|
||||
x_GLF_color_1 : vec4<f32>;
|
||||
};
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn main([[builtin(position)]] gl_FragCoord_param : vec4<f32>) -> main_out {
|
||||
gl_FragCoord = gl_FragCoord_param;
|
||||
main_1();
|
||||
return main_out(x_GLF_color);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
void main_1() {
|
||||
float data[10] = (float[10])0;
|
||||
int i = 0;
|
||||
const float tint_symbol_4[10] = {0.100000001f, 0.200000003f, 0.300000012f, 0.400000006f, 0.5f, 0.600000024f, 0.699999988f, 0.800000012f, 0.899999976f, 1.0f};
|
||||
data = tint_symbol_4;
|
||||
i = 0;
|
||||
{
|
||||
for(; (i < 10); i = (i + 1)) {
|
||||
const float x_50 = gl_FragCoord.x;
|
||||
if ((x_50 < 0.0f)) {
|
||||
discard;
|
||||
}
|
||||
const float x_55 = data[i];
|
||||
data[0] = x_55;
|
||||
}
|
||||
}
|
||||
const float x_58 = data[0];
|
||||
x_GLF_color = float4(x_58, 0.0f, 0.0f, 1.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol_1 {
|
||||
float4 gl_FragCoord_param : SV_Position;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float4 x_GLF_color_1 : SV_Target0;
|
||||
};
|
||||
|
||||
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
|
||||
const float4 gl_FragCoord_param = tint_symbol.gl_FragCoord_param;
|
||||
gl_FragCoord = gl_FragCoord_param;
|
||||
main_1();
|
||||
const main_out tint_symbol_3 = {x_GLF_color};
|
||||
const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_array_wrapper {
|
||||
float arr[10];
|
||||
};
|
||||
struct main_out {
|
||||
float4 x_GLF_color_1;
|
||||
};
|
||||
struct tint_symbol_2 {
|
||||
float4 x_GLF_color_1 [[color(0)]];
|
||||
};
|
||||
|
||||
void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) {
|
||||
tint_array_wrapper data = {};
|
||||
int i = 0;
|
||||
tint_array_wrapper const tint_symbol_4 = {.arr={0.100000001f, 0.200000003f, 0.300000012f, 0.400000006f, 0.5f, 0.600000024f, 0.699999988f, 0.800000012f, 0.899999976f, 1.0f}};
|
||||
data = tint_symbol_4;
|
||||
i = 0;
|
||||
while (true) {
|
||||
int const x_7 = i;
|
||||
if ((x_7 < 10)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
float const x_50 = (*(tint_symbol_6)).x;
|
||||
if ((x_50 < 0.0f)) {
|
||||
discard_fragment();
|
||||
}
|
||||
int const x_8 = i;
|
||||
float const x_55 = data.arr[x_8];
|
||||
data.arr[0] = x_55;
|
||||
{
|
||||
int const x_9 = i;
|
||||
i = (x_9 + 1);
|
||||
}
|
||||
}
|
||||
float const x_58 = data.arr[0];
|
||||
*(tint_symbol_7) = float4(x_58, 0.0f, 0.0f, 1.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]]) {
|
||||
thread float4 tint_symbol_8 = 0.0f;
|
||||
thread float4 tint_symbol_9 = 0.0f;
|
||||
tint_symbol_8 = gl_FragCoord_param;
|
||||
main_1(&(tint_symbol_8), &(tint_symbol_9));
|
||||
main_out const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_9};
|
||||
tint_symbol_2 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
|
||||
return tint_symbol_5;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 80
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %gl_FragCoord "gl_FragCoord"
|
||||
OpName %x_GLF_color "x_GLF_color"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %main_1 "main_1"
|
||||
OpName %data "data"
|
||||
OpName %i "i"
|
||||
OpName %main_out "main_out"
|
||||
OpMemberName %main_out 0 "x_GLF_color_1"
|
||||
OpName %tint_symbol_3 "tint_symbol_3"
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %main "main"
|
||||
OpDecorate %tint_symbol BuiltIn FragCoord
|
||||
OpDecorate %tint_symbol_2 Location 0
|
||||
OpDecorate %_arr_float_uint_10 ArrayStride 4
|
||||
OpMemberDecorate %main_out 0 Offset 0
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Private_v4float = OpTypePointer Private %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%gl_FragCoord = OpVariable %_ptr_Private_v4float Private %5
|
||||
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5
|
||||
%_ptr_Input_v4float = OpTypePointer Input %v4float
|
||||
%tint_symbol = OpVariable %_ptr_Input_v4float Input
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %5
|
||||
%void = OpTypeVoid
|
||||
%11 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_10 = OpConstant %uint 10
|
||||
%_arr_float_uint_10 = OpTypeArray %float %uint_10
|
||||
%_ptr_Function__arr_float_uint_10 = OpTypePointer Function %_arr_float_uint_10
|
||||
%20 = OpConstantNull %_arr_float_uint_10
|
||||
%int = OpTypeInt 32 1
|
||||
%_ptr_Function_int = OpTypePointer Function %int
|
||||
%24 = OpConstantNull %int
|
||||
%float_0_100000001 = OpConstant %float 0.100000001
|
||||
%float_0_200000003 = OpConstant %float 0.200000003
|
||||
%float_0_300000012 = OpConstant %float 0.300000012
|
||||
%float_0_400000006 = OpConstant %float 0.400000006
|
||||
%float_0_5 = OpConstant %float 0.5
|
||||
%float_0_600000024 = OpConstant %float 0.600000024
|
||||
%float_0_699999988 = OpConstant %float 0.699999988
|
||||
%float_0_800000012 = OpConstant %float 0.800000012
|
||||
%float_0_899999976 = OpConstant %float 0.899999976
|
||||
%float_1 = OpConstant %float 1
|
||||
%35 = OpConstantComposite %_arr_float_uint_10 %float_0_100000001 %float_0_200000003 %float_0_300000012 %float_0_400000006 %float_0_5 %float_0_600000024 %float_0_699999988 %float_0_800000012 %float_0_899999976 %float_1
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_10 = OpConstant %int 10
|
||||
%bool = OpTypeBool
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Private_float = OpTypePointer Private %float
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%int_1 = OpConstant %int 1
|
||||
%main_out = OpTypeStruct %v4float
|
||||
%67 = OpTypeFunction %void %main_out
|
||||
%main_1 = OpFunction %void None %11
|
||||
%14 = OpLabel
|
||||
%data = OpVariable %_ptr_Function__arr_float_uint_10 Function %20
|
||||
%i = OpVariable %_ptr_Function_int Function %24
|
||||
OpStore %data %35
|
||||
OpStore %i %int_0
|
||||
OpBranch %37
|
||||
%37 = OpLabel
|
||||
OpLoopMerge %38 %39 None
|
||||
OpBranch %40
|
||||
%40 = OpLabel
|
||||
%41 = OpLoad %int %i
|
||||
%43 = OpSLessThan %bool %41 %int_10
|
||||
OpSelectionMerge %45 None
|
||||
OpBranchConditional %43 %46 %47
|
||||
%46 = OpLabel
|
||||
OpBranch %45
|
||||
%47 = OpLabel
|
||||
OpBranch %38
|
||||
%45 = OpLabel
|
||||
%50 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0
|
||||
%51 = OpLoad %float %50
|
||||
%53 = OpFOrdLessThan %bool %51 %float_0
|
||||
OpSelectionMerge %54 None
|
||||
OpBranchConditional %53 %55 %54
|
||||
%55 = OpLabel
|
||||
OpKill
|
||||
%54 = OpLabel
|
||||
%56 = OpLoad %int %i
|
||||
%58 = OpAccessChain %_ptr_Function_float %data %56
|
||||
%59 = OpLoad %float %58
|
||||
%60 = OpAccessChain %_ptr_Function_float %data %int_0
|
||||
OpStore %60 %59
|
||||
OpBranch %39
|
||||
%39 = OpLabel
|
||||
%61 = OpLoad %int %i
|
||||
%63 = OpIAdd %int %61 %int_1
|
||||
OpStore %i %63
|
||||
OpBranch %37
|
||||
%38 = OpLabel
|
||||
%64 = OpAccessChain %_ptr_Function_float %data %int_0
|
||||
%65 = OpLoad %float %64
|
||||
%66 = OpCompositeConstruct %v4float %65 %float_0 %float_0 %float_1
|
||||
OpStore %x_GLF_color %66
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%tint_symbol_3 = OpFunction %void None %67
|
||||
%tint_symbol_1 = OpFunctionParameter %main_out
|
||||
%71 = OpLabel
|
||||
%72 = OpCompositeExtract %v4float %tint_symbol_1 0
|
||||
OpStore %tint_symbol_2 %72
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %11
|
||||
%74 = OpLabel
|
||||
%75 = OpLoad %v4float %tint_symbol
|
||||
OpStore %gl_FragCoord %75
|
||||
%76 = OpFunctionCall %void %main_1
|
||||
%78 = OpLoad %v4float %x_GLF_color
|
||||
%79 = OpCompositeConstruct %main_out %78
|
||||
%77 = OpFunctionCall %void %tint_symbol_3 %79
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,44 @@
|
||||
var<private> gl_FragCoord : vec4<f32>;
|
||||
|
||||
var<private> x_GLF_color : vec4<f32>;
|
||||
|
||||
fn main_1() {
|
||||
var data : array<f32, 10>;
|
||||
var i : i32;
|
||||
data = array<f32, 10>(0.100000001, 0.200000003, 0.300000012, 0.400000006, 0.5, 0.600000024, 0.699999988, 0.800000012, 0.899999976, 1.0);
|
||||
i = 0;
|
||||
loop {
|
||||
let x_7 : i32 = i;
|
||||
if ((x_7 < 10)) {
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
let x_50 : f32 = gl_FragCoord.x;
|
||||
if ((x_50 < 0.0)) {
|
||||
discard;
|
||||
}
|
||||
let x_8 : i32 = i;
|
||||
let x_55 : f32 = data[x_8];
|
||||
data[0] = x_55;
|
||||
|
||||
continuing {
|
||||
let x_9 : i32 = i;
|
||||
i = (x_9 + 1);
|
||||
}
|
||||
}
|
||||
let x_58 : f32 = data[0];
|
||||
x_GLF_color = vec4<f32>(x_58, 0.0, 0.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
struct main_out {
|
||||
[[location(0)]]
|
||||
x_GLF_color_1 : vec4<f32>;
|
||||
};
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn main([[builtin(position)]] gl_FragCoord_param : vec4<f32>) -> main_out {
|
||||
gl_FragCoord = gl_FragCoord_param;
|
||||
main_1();
|
||||
return main_out(x_GLF_color);
|
||||
}
|
||||
Reference in New Issue
Block a user