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:
Alastair Donaldson 2021-07-23 13:10:12 +00:00 committed by Tint LUCI CQ
parent bd3edb564f
commit f7e73d4ee3
5160 changed files with 621458 additions and 0 deletions

View File

@ -0,0 +1,75 @@
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpSource GLSL 430
OpName %main "main"
OpName %result "result"
OpMemberName %result 0 "res0"
OpMemberName %result 1 "res1"
OpMemberName %result 2 "res2"
OpName %_ ""
OpName %block0 "block0"
OpMemberName %block0 0 "data0"
OpName %__0 ""
OpName %block1 "block1"
OpMemberName %block1 0 "data1"
OpName %__1 ""
OpName %block2 "block2"
OpMemberName %block2 0 "data2"
OpName %__2 ""
OpMemberDecorate %result 0 Offset 0
OpMemberDecorate %result 1 Offset 4
OpMemberDecorate %result 2 Offset 8
OpDecorate %result Block
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 3
OpMemberDecorate %block0 0 Offset 0
OpDecorate %block0 Block
OpDecorate %__0 DescriptorSet 0
OpDecorate %__0 Binding 0
OpMemberDecorate %block1 0 Offset 0
OpDecorate %block1 Block
OpDecorate %__1 DescriptorSet 0
OpDecorate %__1 Binding 1
OpMemberDecorate %block2 0 Offset 0
OpDecorate %block2 Block
OpDecorate %__2 DescriptorSet 0
OpDecorate %__2 Binding 2
%void = OpTypeVoid
%12 = OpTypeFunction %void
%int = OpTypeInt 32 1
%result = OpTypeStruct %int %int %int
%_ptr_StorageBuffer_result = OpTypePointer StorageBuffer %result
%_ = OpVariable %_ptr_StorageBuffer_result StorageBuffer
%int_0 = OpConstant %int 0
%block0 = OpTypeStruct %int
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
%__0 = OpVariable %_ptr_Uniform_block0 Uniform
%_ptr_Uniform_int = OpTypePointer Uniform %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%int_1 = OpConstant %int 1
%block1 = OpTypeStruct %int
%_ptr_Uniform_block1 = OpTypePointer Uniform %block1
%__1 = OpVariable %_ptr_Uniform_block1 Uniform
%int_2 = OpConstant %int 2
%block2 = OpTypeStruct %int
%_ptr_Uniform_block2 = OpTypePointer Uniform %block2
%__2 = OpVariable %_ptr_Uniform_block2 Uniform
%main = OpFunction %void None %12
%23 = OpLabel
%24 = OpAccessChain %_ptr_Uniform_int %__0 %int_0
%25 = OpLoad %int %24
%26 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0
OpStore %26 %25
%27 = OpAccessChain %_ptr_Uniform_int %__1 %int_0
%28 = OpLoad %int %27
%29 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_1
OpStore %29 %28
%30 = OpAccessChain %_ptr_Uniform_int %__2 %int_0
%31 = OpLoad %int %30
%32 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_2
OpStore %32 %31
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,26 @@
RWByteAddressBuffer x_4 : register(u3, space0);
cbuffer cbuffer_x_6 : register(b0, space0) {
uint4 x_6[1];
};
cbuffer cbuffer_x_8 : register(b1, space0) {
uint4 x_8[1];
};
cbuffer cbuffer_x_10 : register(b2, space0) {
uint4 x_10[1];
};
void main_1() {
const int x_25 = asint(x_6[0].x);
x_4.Store(0u, asuint(x_25));
const int x_28 = asint(x_8[0].x);
x_4.Store(4u, asuint(x_28));
const int x_31 = asint(x_10[0].x);
x_4.Store(8u, asuint(x_31));
return;
}
[numthreads(1, 1, 1)]
void main() {
main_1();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
struct result {
/* 0x0000 */ int res0;
/* 0x0004 */ int res1;
/* 0x0008 */ int res2;
};
struct block0 {
/* 0x0000 */ int data0;
};
struct block1 {
/* 0x0000 */ int data1;
};
struct block2 {
/* 0x0000 */ int data2;
};
void main_1(constant block0& x_6, constant block1& x_8, constant block2& x_10, device result& x_4) {
int const x_25 = x_6.data0;
x_4.res0 = x_25;
int const x_28 = x_8.data1;
x_4.res1 = x_28;
int const x_31 = x_10.data2;
x_4.res2 = x_31;
return;
}
kernel void tint_symbol(constant block0& x_6 [[buffer(0)]], constant block1& x_8 [[buffer(1)]], constant block2& x_10 [[buffer(2)]], device result& x_4 [[buffer(3)]]) {
main_1(x_6, x_8, x_10, x_4);
return;
}

View File

@ -0,0 +1,88 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 36
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %result "result"
OpMemberName %result 0 "res0"
OpMemberName %result 1 "res1"
OpMemberName %result 2 "res2"
OpName %x_4 "x_4"
OpName %block0 "block0"
OpMemberName %block0 0 "data0"
OpName %x_6 "x_6"
OpName %block1 "block1"
OpMemberName %block1 0 "data1"
OpName %x_8 "x_8"
OpName %block2 "block2"
OpMemberName %block2 0 "data2"
OpName %x_10 "x_10"
OpName %main_1 "main_1"
OpName %main "main"
OpDecorate %result Block
OpMemberDecorate %result 0 Offset 0
OpMemberDecorate %result 1 Offset 4
OpMemberDecorate %result 2 Offset 8
OpDecorate %x_4 DescriptorSet 0
OpDecorate %x_4 Binding 3
OpDecorate %block0 Block
OpMemberDecorate %block0 0 Offset 0
OpDecorate %x_6 NonWritable
OpDecorate %x_6 DescriptorSet 0
OpDecorate %x_6 Binding 0
OpDecorate %block1 Block
OpMemberDecorate %block1 0 Offset 0
OpDecorate %x_8 NonWritable
OpDecorate %x_8 DescriptorSet 0
OpDecorate %x_8 Binding 1
OpDecorate %block2 Block
OpMemberDecorate %block2 0 Offset 0
OpDecorate %x_10 NonWritable
OpDecorate %x_10 DescriptorSet 0
OpDecorate %x_10 Binding 2
%int = OpTypeInt 32 1
%result = OpTypeStruct %int %int %int
%_ptr_StorageBuffer_result = OpTypePointer StorageBuffer %result
%x_4 = OpVariable %_ptr_StorageBuffer_result StorageBuffer
%block0 = OpTypeStruct %int
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
%x_6 = OpVariable %_ptr_Uniform_block0 Uniform
%block1 = OpTypeStruct %int
%_ptr_Uniform_block1 = OpTypePointer Uniform %block1
%x_8 = OpVariable %_ptr_Uniform_block1 Uniform
%block2 = OpTypeStruct %int
%_ptr_Uniform_block2 = OpTypePointer Uniform %block2
%x_10 = OpVariable %_ptr_Uniform_block2 Uniform
%void = OpTypeVoid
%14 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_int = OpTypePointer Uniform %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%uint_1 = OpConstant %uint 1
%uint_2 = OpConstant %uint 2
%main_1 = OpFunction %void None %14
%17 = OpLabel
%21 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0
%22 = OpLoad %int %21
%24 = OpAccessChain %_ptr_StorageBuffer_int %x_4 %uint_0
OpStore %24 %22
%25 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0
%26 = OpLoad %int %25
%28 = OpAccessChain %_ptr_StorageBuffer_int %x_4 %uint_1
OpStore %28 %26
%29 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0
%30 = OpLoad %int %29
%32 = OpAccessChain %_ptr_StorageBuffer_int %x_4 %uint_2
OpStore %32 %30
OpReturn
OpFunctionEnd
%main = OpFunction %void None %14
%34 = OpLabel
%35 = OpFunctionCall %void %main_1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,44 @@
[[block]]
struct result {
res0 : i32;
res1 : i32;
res2 : i32;
};
[[block]]
struct block0 {
data0 : i32;
};
[[block]]
struct block1 {
data1 : i32;
};
[[block]]
struct block2 {
data2 : i32;
};
[[group(0), binding(3)]] var<storage, read_write> x_4 : result;
[[group(0), binding(0)]] var<uniform> x_6 : block0;
[[group(0), binding(1)]] var<uniform> x_8 : block1;
[[group(0), binding(2)]] var<uniform> x_10 : block2;
fn main_1() {
let x_25 : i32 = x_6.data0;
x_4.res0 = x_25;
let x_28 : i32 = x_8.data1;
x_4.res1 = x_28;
let x_31 : i32 = x_10.data2;
x_4.res2 = x_31;
return;
}
[[stage(compute), workgroup_size(1, 1, 1)]]
fn main() {
main_1();
}

View File

@ -0,0 +1,44 @@
[[block]]
struct result {
res0 : i32;
res1 : i32;
res2 : i32;
};
[[block]]
struct block0 {
data0 : i32;
};
[[block]]
struct block1 {
data1 : i32;
};
[[block]]
struct block2 {
data2 : i32;
};
[[group(0), binding(3)]] var<storage, read_write> x_4 : result;
[[group(0), binding(0)]] var<uniform> x_6 : block0;
[[group(0), binding(1)]] var<uniform> x_8 : block1;
[[group(0), binding(2)]] var<uniform> x_10 : block2;
fn main_1() {
let x_25 : i32 = x_6.data0;
x_4.res0 = x_25;
let x_28 : i32 = x_8.data1;
x_4.res1 = x_28;
let x_31 : i32 = x_10.data2;
x_4.res2 = x_31;
return;
}
[[stage(compute), workgroup_size(1, 1, 1)]]
fn main() {
main_1();
}

View File

@ -0,0 +1,26 @@
RWByteAddressBuffer x_4 : register(u3, space0);
cbuffer cbuffer_x_6 : register(b0, space0) {
uint4 x_6[1];
};
cbuffer cbuffer_x_8 : register(b1, space0) {
uint4 x_8[1];
};
cbuffer cbuffer_x_10 : register(b2, space0) {
uint4 x_10[1];
};
void main_1() {
const int x_25 = asint(x_6[0].x);
x_4.Store(0u, asuint(x_25));
const int x_28 = asint(x_8[0].x);
x_4.Store(4u, asuint(x_28));
const int x_31 = asint(x_10[0].x);
x_4.Store(8u, asuint(x_31));
return;
}
[numthreads(1, 1, 1)]
void main() {
main_1();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
struct result {
/* 0x0000 */ int res0;
/* 0x0004 */ int res1;
/* 0x0008 */ int res2;
};
struct block0 {
/* 0x0000 */ int data0;
};
struct block1 {
/* 0x0000 */ int data1;
};
struct block2 {
/* 0x0000 */ int data2;
};
void main_1(constant block0& x_6, constant block1& x_8, constant block2& x_10, device result& x_4) {
int const x_25 = x_6.data0;
x_4.res0 = x_25;
int const x_28 = x_8.data1;
x_4.res1 = x_28;
int const x_31 = x_10.data2;
x_4.res2 = x_31;
return;
}
kernel void tint_symbol(constant block0& x_6 [[buffer(0)]], constant block1& x_8 [[buffer(1)]], constant block2& x_10 [[buffer(2)]], device result& x_4 [[buffer(3)]]) {
main_1(x_6, x_8, x_10, x_4);
return;
}

View File

@ -0,0 +1,88 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 36
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %result "result"
OpMemberName %result 0 "res0"
OpMemberName %result 1 "res1"
OpMemberName %result 2 "res2"
OpName %x_4 "x_4"
OpName %block0 "block0"
OpMemberName %block0 0 "data0"
OpName %x_6 "x_6"
OpName %block1 "block1"
OpMemberName %block1 0 "data1"
OpName %x_8 "x_8"
OpName %block2 "block2"
OpMemberName %block2 0 "data2"
OpName %x_10 "x_10"
OpName %main_1 "main_1"
OpName %main "main"
OpDecorate %result Block
OpMemberDecorate %result 0 Offset 0
OpMemberDecorate %result 1 Offset 4
OpMemberDecorate %result 2 Offset 8
OpDecorate %x_4 DescriptorSet 0
OpDecorate %x_4 Binding 3
OpDecorate %block0 Block
OpMemberDecorate %block0 0 Offset 0
OpDecorate %x_6 NonWritable
OpDecorate %x_6 DescriptorSet 0
OpDecorate %x_6 Binding 0
OpDecorate %block1 Block
OpMemberDecorate %block1 0 Offset 0
OpDecorate %x_8 NonWritable
OpDecorate %x_8 DescriptorSet 0
OpDecorate %x_8 Binding 1
OpDecorate %block2 Block
OpMemberDecorate %block2 0 Offset 0
OpDecorate %x_10 NonWritable
OpDecorate %x_10 DescriptorSet 0
OpDecorate %x_10 Binding 2
%int = OpTypeInt 32 1
%result = OpTypeStruct %int %int %int
%_ptr_StorageBuffer_result = OpTypePointer StorageBuffer %result
%x_4 = OpVariable %_ptr_StorageBuffer_result StorageBuffer
%block0 = OpTypeStruct %int
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
%x_6 = OpVariable %_ptr_Uniform_block0 Uniform
%block1 = OpTypeStruct %int
%_ptr_Uniform_block1 = OpTypePointer Uniform %block1
%x_8 = OpVariable %_ptr_Uniform_block1 Uniform
%block2 = OpTypeStruct %int
%_ptr_Uniform_block2 = OpTypePointer Uniform %block2
%x_10 = OpVariable %_ptr_Uniform_block2 Uniform
%void = OpTypeVoid
%14 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_int = OpTypePointer Uniform %int
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%uint_1 = OpConstant %uint 1
%uint_2 = OpConstant %uint 2
%main_1 = OpFunction %void None %14
%17 = OpLabel
%21 = OpAccessChain %_ptr_Uniform_int %x_6 %uint_0
%22 = OpLoad %int %21
%24 = OpAccessChain %_ptr_StorageBuffer_int %x_4 %uint_0
OpStore %24 %22
%25 = OpAccessChain %_ptr_Uniform_int %x_8 %uint_0
%26 = OpLoad %int %25
%28 = OpAccessChain %_ptr_StorageBuffer_int %x_4 %uint_1
OpStore %28 %26
%29 = OpAccessChain %_ptr_Uniform_int %x_10 %uint_0
%30 = OpLoad %int %29
%32 = OpAccessChain %_ptr_StorageBuffer_int %x_4 %uint_2
OpStore %32 %30
OpReturn
OpFunctionEnd
%main = OpFunction %void None %14
%34 = OpLabel
%35 = OpFunctionCall %void %main_1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,44 @@
[[block]]
struct result {
res0 : i32;
res1 : i32;
res2 : i32;
};
[[block]]
struct block0 {
data0 : i32;
};
[[block]]
struct block1 {
data1 : i32;
};
[[block]]
struct block2 {
data2 : i32;
};
[[group(0), binding(3)]] var<storage, read_write> x_4 : result;
[[group(0), binding(0)]] var<uniform> x_6 : block0;
[[group(0), binding(1)]] var<uniform> x_8 : block1;
[[group(0), binding(2)]] var<uniform> x_10 : block2;
fn main_1() {
let x_25 : i32 = x_6.data0;
x_4.res0 = x_25;
let x_28 : i32 = x_8.data1;
x_4.res1 = x_28;
let x_31 : i32 = x_10.data2;
x_4.res2 = x_31;
return;
}
[[stage(compute), workgroup_size(1, 1, 1)]]
fn main() {
main_1();
}

View File

@ -0,0 +1,35 @@
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpSource GLSL 430
OpName %main "main"
OpName %block0 "block0"
OpMemberName %block0 0 "data"
OpName %_ ""
OpMemberDecorate %block0 0 Offset 0
OpDecorate %block0 Block
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 1
%void = OpTypeVoid
%6 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%block0 = OpTypeStruct %v4float
%_ptr_StorageBuffer_block0 = OpTypePointer StorageBuffer %block0
%_ = OpVariable %_ptr_StorageBuffer_block0 StorageBuffer
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%float_4 = OpConstant %float 4
%16 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%main = OpFunction %void None %6
%18 = OpLabel
%19 = OpAccessChain %_ptr_StorageBuffer_v4float %_ %int_0
OpStore %19 %16
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,12 @@
RWByteAddressBuffer x_4 : register(u1, space0);
void main_1() {
x_4.Store4(0u, asuint(float4(1.0f, 2.0f, 3.0f, 4.0f)));
return;
}
[numthreads(1, 1, 1)]
void main() {
main_1();
return;
}

View File

@ -0,0 +1,17 @@
#include <metal_stdlib>
using namespace metal;
struct block0 {
/* 0x0000 */ packed_float4 data;
};
void main_1(device block0& x_4) {
x_4.data = float4(1.0f, 2.0f, 3.0f, 4.0f);
return;
}
kernel void tint_symbol(device block0& x_4 [[buffer(1)]]) {
main_1(x_4);
return;
}

View File

@ -0,0 +1,44 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 22
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %block0 "block0"
OpMemberName %block0 0 "data"
OpName %x_4 "x_4"
OpName %main_1 "main_1"
OpName %main "main"
OpDecorate %block0 Block
OpMemberDecorate %block0 0 Offset 0
OpDecorate %x_4 DescriptorSet 0
OpDecorate %x_4 Binding 1
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%block0 = OpTypeStruct %v4float
%_ptr_StorageBuffer_block0 = OpTypePointer StorageBuffer %block0
%x_4 = OpVariable %_ptr_StorageBuffer_block0 StorageBuffer
%void = OpTypeVoid
%6 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%float_4 = OpConstant %float 4
%18 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
%main_1 = OpFunction %void None %6
%9 = OpLabel
%13 = OpAccessChain %_ptr_StorageBuffer_v4float %x_4 %uint_0
OpStore %13 %18
OpReturn
OpFunctionEnd
%main = OpFunction %void None %6
%20 = OpLabel
%21 = OpFunctionCall %void %main_1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,16 @@
[[block]]
struct block0 {
data : vec4<f32>;
};
[[group(0), binding(1)]] var<storage, read_write> x_4 : block0;
fn main_1() {
x_4.data = vec4<f32>(1.0, 2.0, 3.0, 4.0);
return;
}
[[stage(compute), workgroup_size(1, 1, 1)]]
fn main() {
main_1();
}

View File

@ -0,0 +1,16 @@
[[block]]
struct block0 {
data : vec4<f32>;
};
[[group(0), binding(1)]] var<storage, read_write> x_4 : block0;
fn main_1() {
x_4.data = vec4<f32>(1.0, 2.0, 3.0, 4.0);
return;
}
[[stage(compute), workgroup_size(1, 1, 1)]]
fn main() {
main_1();
}

View File

@ -0,0 +1,12 @@
RWByteAddressBuffer x_4 : register(u1, space0);
void main_1() {
x_4.Store4(0u, asuint(float4(1.0f, 2.0f, 3.0f, 4.0f)));
return;
}
[numthreads(1, 1, 1)]
void main() {
main_1();
return;
}

View File

@ -0,0 +1,17 @@
#include <metal_stdlib>
using namespace metal;
struct block0 {
/* 0x0000 */ packed_float4 data;
};
void main_1(device block0& x_4) {
x_4.data = float4(1.0f, 2.0f, 3.0f, 4.0f);
return;
}
kernel void tint_symbol(device block0& x_4 [[buffer(1)]]) {
main_1(x_4);
return;
}

View File

@ -0,0 +1,44 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 22
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %block0 "block0"
OpMemberName %block0 0 "data"
OpName %x_4 "x_4"
OpName %main_1 "main_1"
OpName %main "main"
OpDecorate %block0 Block
OpMemberDecorate %block0 0 Offset 0
OpDecorate %x_4 DescriptorSet 0
OpDecorate %x_4 Binding 1
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%block0 = OpTypeStruct %v4float
%_ptr_StorageBuffer_block0 = OpTypePointer StorageBuffer %block0
%x_4 = OpVariable %_ptr_StorageBuffer_block0 StorageBuffer
%void = OpTypeVoid
%6 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%float_4 = OpConstant %float 4
%18 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
%main_1 = OpFunction %void None %6
%9 = OpLabel
%13 = OpAccessChain %_ptr_StorageBuffer_v4float %x_4 %uint_0
OpStore %13 %18
OpReturn
OpFunctionEnd
%main = OpFunction %void None %6
%20 = OpLabel
%21 = OpFunctionCall %void %main_1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,16 @@
[[block]]
struct block0 {
data : vec4<f32>;
};
[[group(0), binding(1)]] var<storage, read_write> x_4 : block0;
fn main_1() {
x_4.data = vec4<f32>(1.0, 2.0, 3.0, 4.0);
return;
}
[[stage(compute), workgroup_size(1, 1, 1)]]
fn main() {
main_1();
}

View File

@ -0,0 +1,56 @@
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %main "main" %_ %position %frag_color
OpSource GLSL 430
OpName %main "main"
OpName %gl_PerVertex "gl_PerVertex"
OpMemberName %gl_PerVertex 0 "gl_Position"
OpMemberName %gl_PerVertex 1 "gl_PointSize"
OpMemberName %gl_PerVertex 2 "gl_ClipDistance"
OpName %_ ""
OpName %position "position"
OpName %frag_color "frag_color"
OpName %block0 "block0"
OpMemberName %block0 0 "in_color"
OpName %__0 ""
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
OpDecorate %gl_PerVertex Block
OpDecorate %position Location 0
OpDecorate %frag_color Location 0
OpMemberDecorate %block0 0 Offset 0
OpDecorate %block0 Block
OpDecorate %__0 DescriptorSet 0
OpDecorate %__0 Binding 1
%void = OpTypeVoid
%10 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_arr_float_uint_1 = OpTypeArray %float %uint_1
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%_ptr_Input_v4float = OpTypePointer Input %v4float
%position = OpVariable %_ptr_Input_v4float Input
%_ptr_Output_v4float = OpTypePointer Output %v4float
%frag_color = OpVariable %_ptr_Output_v4float Output
%block0 = OpTypeStruct %v4float
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
%__0 = OpVariable %_ptr_Uniform_block0 Uniform
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%main = OpFunction %void None %10
%23 = OpLabel
%24 = OpLoad %v4float %position
%25 = OpAccessChain %_ptr_Output_v4float %_ %int_0
OpStore %25 %24
%26 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0
%27 = OpLoad %v4float %26
OpStore %frag_color %27
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,34 @@
static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_8 : register(b1, space0) {
uint4 x_8[1];
};
static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
gl_Position = position;
const float4 x_27 = asfloat(x_8[0]);
frag_color = x_27;
return;
}
struct main_out {
float4 gl_Position;
float4 frag_color_1;
};
struct tint_symbol_1 {
float4 position_param : TEXCOORD0;
};
struct tint_symbol_2 {
float4 frag_color_1 : TEXCOORD0;
float4 gl_Position : SV_Position;
};
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const float4 position_param = tint_symbol.position_param;
position = position_param;
main_1();
const main_out tint_symbol_3 = {gl_Position, frag_color};
const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.frag_color_1, tint_symbol_3.gl_Position};
return tint_symbol_5;
}

View File

@ -0,0 +1,38 @@
#include <metal_stdlib>
using namespace metal;
struct block0 {
/* 0x0000 */ packed_float4 in_color;
};
struct main_out {
float4 gl_Position;
float4 frag_color_1;
};
struct tint_symbol_2 {
float4 position_param [[attribute(0)]];
};
struct tint_symbol_3 {
float4 frag_color_1 [[user(locn0)]];
float4 gl_Position [[position]];
};
void main_1(constant block0& x_8, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8) {
float4 const x_24 = *(tint_symbol_6);
*(tint_symbol_7) = x_24;
float4 const x_27 = x_8.in_color;
*(tint_symbol_8) = x_27;
return;
}
vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]], constant block0& x_8 [[buffer(1)]]) {
thread float4 tint_symbol_9 = 0.0f;
thread float4 tint_symbol_10 = 0.0f;
thread float4 tint_symbol_11 = 0.0f;
float4 const position_param = tint_symbol_1.position_param;
tint_symbol_9 = position_param;
main_1(x_8, &(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11));
main_out const tint_symbol_4 = {.gl_Position=tint_symbol_10, .frag_color_1=tint_symbol_11};
tint_symbol_3 const tint_symbol_5 = {.frag_color_1=tint_symbol_4.frag_color_1, .gl_Position=tint_symbol_4.gl_Position};
return tint_symbol_5;
}

View File

@ -0,0 +1,92 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 45
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3
OpName %tint_pointsize "tint_pointsize"
OpName %position "position"
OpName %frag_color "frag_color"
OpName %block0 "block0"
OpMemberName %block0 0 "in_color"
OpName %x_8 "x_8"
OpName %gl_Position "gl_Position"
OpName %tint_symbol "tint_symbol"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol_3 "tint_symbol_3"
OpName %main_1 "main_1"
OpName %main_out "main_out"
OpMemberName %main_out 0 "gl_Position"
OpMemberName %main_out 1 "frag_color_1"
OpName %tint_symbol_4 "tint_symbol_4"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main "main"
OpDecorate %tint_pointsize BuiltIn PointSize
OpDecorate %block0 Block
OpMemberDecorate %block0 0 Offset 0
OpDecorate %x_8 NonWritable
OpDecorate %x_8 DescriptorSet 0
OpDecorate %x_8 Binding 1
OpDecorate %tint_symbol Location 0
OpDecorate %tint_symbol_2 BuiltIn Position
OpDecorate %tint_symbol_3 Location 0
OpMemberDecorate %main_out 0 Offset 0
OpMemberDecorate %main_out 1 Offset 16
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%8 = OpConstantNull %v4float
%position = OpVariable %_ptr_Private_v4float Private %8
%frag_color = OpVariable %_ptr_Private_v4float Private %8
%block0 = OpTypeStruct %v4float
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
%x_8 = OpVariable %_ptr_Uniform_block0 Uniform
%gl_Position = OpVariable %_ptr_Private_v4float Private %8
%_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 %8
%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
%19 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%main_out = OpTypeStruct %v4float %v4float
%29 = OpTypeFunction %void %main_out
%float_1 = OpConstant %float 1
%main_1 = OpFunction %void None %19
%22 = OpLabel
%23 = OpLoad %v4float %position
OpStore %gl_Position %23
%27 = OpAccessChain %_ptr_Uniform_v4float %x_8 %uint_0
%28 = OpLoad %v4float %27
OpStore %frag_color %28
OpReturn
OpFunctionEnd
%tint_symbol_4 = OpFunction %void None %29
%tint_symbol_1 = OpFunctionParameter %main_out
%33 = OpLabel
%34 = OpCompositeExtract %v4float %tint_symbol_1 0
OpStore %tint_symbol_2 %34
%35 = OpCompositeExtract %v4float %tint_symbol_1 1
OpStore %tint_symbol_3 %35
OpReturn
OpFunctionEnd
%main = OpFunction %void None %19
%37 = OpLabel
OpStore %tint_pointsize %float_1
%39 = OpLoad %v4float %tint_symbol
OpStore %position %39
%40 = OpFunctionCall %void %main_1
%42 = OpLoad %v4float %gl_Position
%43 = OpLoad %v4float %frag_color
%44 = OpCompositeConstruct %main_out %42 %43
%41 = OpFunctionCall %void %tint_symbol_4 %44
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,34 @@
[[block]]
struct block0 {
in_color : vec4<f32>;
};
var<private> position : vec4<f32>;
var<private> frag_color : vec4<f32>;
[[group(0), binding(1)]] var<uniform> x_8 : block0;
var<private> gl_Position : vec4<f32>;
fn main_1() {
let x_24 : vec4<f32> = position;
gl_Position = x_24;
let x_27 : vec4<f32> = x_8.in_color;
frag_color = x_27;
return;
}
struct main_out {
[[builtin(position)]]
gl_Position : vec4<f32>;
[[location(0)]]
frag_color_1 : vec4<f32>;
};
[[stage(vertex)]]
fn main([[location(0)]] position_param : vec4<f32>) -> main_out {
position = position_param;
main_1();
return main_out(gl_Position, frag_color);
}

View File

@ -0,0 +1,34 @@
[[block]]
struct block0 {
in_color : vec4<f32>;
};
var<private> position : vec4<f32>;
var<private> frag_color : vec4<f32>;
[[group(0), binding(1)]] var<uniform> x_8 : block0;
var<private> gl_Position : vec4<f32>;
fn main_1() {
let x_24 : vec4<f32> = position;
gl_Position = x_24;
let x_27 : vec4<f32> = x_8.in_color;
frag_color = x_27;
return;
}
struct main_out {
[[builtin(position)]]
gl_Position : vec4<f32>;
[[location(0)]]
frag_color_1 : vec4<f32>;
};
[[stage(vertex)]]
fn main([[location(0)]] position_param : vec4<f32>) -> main_out {
position = position_param;
main_1();
return main_out(gl_Position, frag_color);
}

View File

@ -0,0 +1,34 @@
static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_8 : register(b1, space0) {
uint4 x_8[1];
};
static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
gl_Position = position;
const float4 x_27 = asfloat(x_8[0]);
frag_color = x_27;
return;
}
struct main_out {
float4 gl_Position;
float4 frag_color_1;
};
struct tint_symbol_1 {
float4 position_param : TEXCOORD0;
};
struct tint_symbol_2 {
float4 frag_color_1 : TEXCOORD0;
float4 gl_Position : SV_Position;
};
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const float4 position_param = tint_symbol.position_param;
position = position_param;
main_1();
const main_out tint_symbol_3 = {gl_Position, frag_color};
const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.frag_color_1, tint_symbol_3.gl_Position};
return tint_symbol_5;
}

View File

@ -0,0 +1,38 @@
#include <metal_stdlib>
using namespace metal;
struct block0 {
/* 0x0000 */ packed_float4 in_color;
};
struct main_out {
float4 gl_Position;
float4 frag_color_1;
};
struct tint_symbol_2 {
float4 position_param [[attribute(0)]];
};
struct tint_symbol_3 {
float4 frag_color_1 [[user(locn0)]];
float4 gl_Position [[position]];
};
void main_1(constant block0& x_8, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8) {
float4 const x_24 = *(tint_symbol_6);
*(tint_symbol_7) = x_24;
float4 const x_27 = x_8.in_color;
*(tint_symbol_8) = x_27;
return;
}
vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]], constant block0& x_8 [[buffer(1)]]) {
thread float4 tint_symbol_9 = 0.0f;
thread float4 tint_symbol_10 = 0.0f;
thread float4 tint_symbol_11 = 0.0f;
float4 const position_param = tint_symbol_1.position_param;
tint_symbol_9 = position_param;
main_1(x_8, &(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11));
main_out const tint_symbol_4 = {.gl_Position=tint_symbol_10, .frag_color_1=tint_symbol_11};
tint_symbol_3 const tint_symbol_5 = {.frag_color_1=tint_symbol_4.frag_color_1, .gl_Position=tint_symbol_4.gl_Position};
return tint_symbol_5;
}

View File

@ -0,0 +1,92 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 45
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3
OpName %tint_pointsize "tint_pointsize"
OpName %position "position"
OpName %frag_color "frag_color"
OpName %block0 "block0"
OpMemberName %block0 0 "in_color"
OpName %x_8 "x_8"
OpName %gl_Position "gl_Position"
OpName %tint_symbol "tint_symbol"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol_3 "tint_symbol_3"
OpName %main_1 "main_1"
OpName %main_out "main_out"
OpMemberName %main_out 0 "gl_Position"
OpMemberName %main_out 1 "frag_color_1"
OpName %tint_symbol_4 "tint_symbol_4"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main "main"
OpDecorate %tint_pointsize BuiltIn PointSize
OpDecorate %block0 Block
OpMemberDecorate %block0 0 Offset 0
OpDecorate %x_8 NonWritable
OpDecorate %x_8 DescriptorSet 0
OpDecorate %x_8 Binding 1
OpDecorate %tint_symbol Location 0
OpDecorate %tint_symbol_2 BuiltIn Position
OpDecorate %tint_symbol_3 Location 0
OpMemberDecorate %main_out 0 Offset 0
OpMemberDecorate %main_out 1 Offset 16
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%8 = OpConstantNull %v4float
%position = OpVariable %_ptr_Private_v4float Private %8
%frag_color = OpVariable %_ptr_Private_v4float Private %8
%block0 = OpTypeStruct %v4float
%_ptr_Uniform_block0 = OpTypePointer Uniform %block0
%x_8 = OpVariable %_ptr_Uniform_block0 Uniform
%gl_Position = OpVariable %_ptr_Private_v4float Private %8
%_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 %8
%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
%19 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%main_out = OpTypeStruct %v4float %v4float
%29 = OpTypeFunction %void %main_out
%float_1 = OpConstant %float 1
%main_1 = OpFunction %void None %19
%22 = OpLabel
%23 = OpLoad %v4float %position
OpStore %gl_Position %23
%27 = OpAccessChain %_ptr_Uniform_v4float %x_8 %uint_0
%28 = OpLoad %v4float %27
OpStore %frag_color %28
OpReturn
OpFunctionEnd
%tint_symbol_4 = OpFunction %void None %29
%tint_symbol_1 = OpFunctionParameter %main_out
%33 = OpLabel
%34 = OpCompositeExtract %v4float %tint_symbol_1 0
OpStore %tint_symbol_2 %34
%35 = OpCompositeExtract %v4float %tint_symbol_1 1
OpStore %tint_symbol_3 %35
OpReturn
OpFunctionEnd
%main = OpFunction %void None %19
%37 = OpLabel
OpStore %tint_pointsize %float_1
%39 = OpLoad %v4float %tint_symbol
OpStore %position %39
%40 = OpFunctionCall %void %main_1
%42 = OpLoad %v4float %gl_Position
%43 = OpLoad %v4float %frag_color
%44 = OpCompositeConstruct %main_out %42 %43
%41 = OpFunctionCall %void %tint_symbol_4 %44
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,34 @@
[[block]]
struct block0 {
in_color : vec4<f32>;
};
var<private> position : vec4<f32>;
var<private> frag_color : vec4<f32>;
[[group(0), binding(1)]] var<uniform> x_8 : block0;
var<private> gl_Position : vec4<f32>;
fn main_1() {
let x_24 : vec4<f32> = position;
gl_Position = x_24;
let x_27 : vec4<f32> = x_8.in_color;
frag_color = x_27;
return;
}
struct main_out {
[[builtin(position)]]
gl_Position : vec4<f32>;
[[location(0)]]
frag_color_1 : vec4<f32>;
};
[[stage(vertex)]]
fn main([[location(0)]] position_param : vec4<f32>) -> main_out {
position = position_param;
main_1();
return main_out(gl_Position, frag_color);
}

View File

@ -0,0 +1,25 @@
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %final_color %frag_color
OpExecutionMode %main OriginUpperLeft
OpSource GLSL 430
OpName %main "main"
OpName %final_color "final_color"
OpName %frag_color "frag_color"
OpDecorate %final_color Location 0
OpDecorate %frag_color Location 0
%void = OpTypeVoid
%6 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%final_color = OpVariable %_ptr_Output_v4float Output
%_ptr_Input_v4float = OpTypePointer Input %v4float
%frag_color = OpVariable %_ptr_Input_v4float Input
%main = OpFunction %void None %6
%11 = OpLabel
%12 = OpLoad %v4float %frag_color
OpStore %final_color %12
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,26 @@
static float4 final_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
final_color = frag_color;
return;
}
struct main_out {
float4 final_color_1;
};
struct tint_symbol_1 {
float4 frag_color_param : TEXCOORD0;
};
struct tint_symbol_2 {
float4 final_color_1 : SV_Target0;
};
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const float4 frag_color_param = tint_symbol.frag_color_param;
frag_color = frag_color_param;
main_1();
const main_out tint_symbol_3 = {final_color};
const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.final_color_1};
return tint_symbol_4;
}

View File

@ -0,0 +1,30 @@
#include <metal_stdlib>
using namespace metal;
struct main_out {
float4 final_color_1;
};
struct tint_symbol_2 {
float4 frag_color_param [[user(locn0)]];
};
struct tint_symbol_3 {
float4 final_color_1 [[color(0)]];
};
void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) {
float4 const x_12 = *(tint_symbol_6);
*(tint_symbol_7) = x_12;
return;
}
fragment tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
thread float4 tint_symbol_8 = 0.0f;
thread float4 tint_symbol_9 = 0.0f;
float4 const frag_color_param = tint_symbol_1.frag_color_param;
tint_symbol_8 = frag_color_param;
main_1(&(tint_symbol_8), &(tint_symbol_9));
main_out const tint_symbol_4 = {.final_color_1=tint_symbol_9};
tint_symbol_3 const tint_symbol_5 = {.final_color_1=tint_symbol_4.final_color_1};
return tint_symbol_5;
}

View File

@ -0,0 +1,59 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 29
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2
OpExecutionMode %main OriginUpperLeft
OpName %final_color "final_color"
OpName %frag_color "frag_color"
OpName %tint_symbol "tint_symbol"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %main_1 "main_1"
OpName %main_out "main_out"
OpMemberName %main_out 0 "final_color_1"
OpName %tint_symbol_3 "tint_symbol_3"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main "main"
OpDecorate %tint_symbol Location 0
OpDecorate %tint_symbol_2 Location 0
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%5 = OpConstantNull %v4float
%final_color = OpVariable %_ptr_Private_v4float Private %5
%frag_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
%main_out = OpTypeStruct %v4float
%16 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %11
%14 = OpLabel
%15 = OpLoad %v4float %frag_color
OpStore %final_color %15
OpReturn
OpFunctionEnd
%tint_symbol_3 = OpFunction %void None %16
%tint_symbol_1 = OpFunctionParameter %main_out
%20 = OpLabel
%21 = OpCompositeExtract %v4float %tint_symbol_1 0
OpStore %tint_symbol_2 %21
OpReturn
OpFunctionEnd
%main = OpFunction %void None %11
%23 = OpLabel
%24 = OpLoad %v4float %tint_symbol
OpStore %frag_color %24
%25 = OpFunctionCall %void %main_1
%27 = OpLoad %v4float %final_color
%28 = OpCompositeConstruct %main_out %27
%26 = OpFunctionCall %void %tint_symbol_3 %28
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,21 @@
var<private> final_color : vec4<f32>;
var<private> frag_color : vec4<f32>;
fn main_1() {
let x_12 : vec4<f32> = frag_color;
final_color = x_12;
return;
}
struct main_out {
[[location(0)]]
final_color_1 : vec4<f32>;
};
[[stage(fragment)]]
fn main([[location(0)]] frag_color_param : vec4<f32>) -> main_out {
frag_color = frag_color_param;
main_1();
return main_out(final_color);
}

View File

@ -0,0 +1,21 @@
var<private> final_color : vec4<f32>;
var<private> frag_color : vec4<f32>;
fn main_1() {
let x_12 : vec4<f32> = frag_color;
final_color = x_12;
return;
}
struct main_out {
[[location(0)]]
final_color_1 : vec4<f32>;
};
[[stage(fragment)]]
fn main([[location(0)]] frag_color_param : vec4<f32>) -> main_out {
frag_color = frag_color_param;
main_1();
return main_out(final_color);
}

View File

@ -0,0 +1,26 @@
static float4 final_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
final_color = frag_color;
return;
}
struct main_out {
float4 final_color_1;
};
struct tint_symbol_1 {
float4 frag_color_param : TEXCOORD0;
};
struct tint_symbol_2 {
float4 final_color_1 : SV_Target0;
};
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const float4 frag_color_param = tint_symbol.frag_color_param;
frag_color = frag_color_param;
main_1();
const main_out tint_symbol_3 = {final_color};
const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.final_color_1};
return tint_symbol_4;
}

View File

@ -0,0 +1,30 @@
#include <metal_stdlib>
using namespace metal;
struct main_out {
float4 final_color_1;
};
struct tint_symbol_2 {
float4 frag_color_param [[user(locn0)]];
};
struct tint_symbol_3 {
float4 final_color_1 [[color(0)]];
};
void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) {
float4 const x_12 = *(tint_symbol_6);
*(tint_symbol_7) = x_12;
return;
}
fragment tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
thread float4 tint_symbol_8 = 0.0f;
thread float4 tint_symbol_9 = 0.0f;
float4 const frag_color_param = tint_symbol_1.frag_color_param;
tint_symbol_8 = frag_color_param;
main_1(&(tint_symbol_8), &(tint_symbol_9));
main_out const tint_symbol_4 = {.final_color_1=tint_symbol_9};
tint_symbol_3 const tint_symbol_5 = {.final_color_1=tint_symbol_4.final_color_1};
return tint_symbol_5;
}

View File

@ -0,0 +1,59 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 29
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2
OpExecutionMode %main OriginUpperLeft
OpName %final_color "final_color"
OpName %frag_color "frag_color"
OpName %tint_symbol "tint_symbol"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %main_1 "main_1"
OpName %main_out "main_out"
OpMemberName %main_out 0 "final_color_1"
OpName %tint_symbol_3 "tint_symbol_3"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main "main"
OpDecorate %tint_symbol Location 0
OpDecorate %tint_symbol_2 Location 0
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%5 = OpConstantNull %v4float
%final_color = OpVariable %_ptr_Private_v4float Private %5
%frag_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
%main_out = OpTypeStruct %v4float
%16 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %11
%14 = OpLabel
%15 = OpLoad %v4float %frag_color
OpStore %final_color %15
OpReturn
OpFunctionEnd
%tint_symbol_3 = OpFunction %void None %16
%tint_symbol_1 = OpFunctionParameter %main_out
%20 = OpLabel
%21 = OpCompositeExtract %v4float %tint_symbol_1 0
OpStore %tint_symbol_2 %21
OpReturn
OpFunctionEnd
%main = OpFunction %void None %11
%23 = OpLabel
%24 = OpLoad %v4float %tint_symbol
OpStore %frag_color %24
%25 = OpFunctionCall %void %main_1
%27 = OpLoad %v4float %final_color
%28 = OpCompositeConstruct %main_out %27
%26 = OpFunctionCall %void %tint_symbol_3 %28
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,21 @@
var<private> final_color : vec4<f32>;
var<private> frag_color : vec4<f32>;
fn main_1() {
let x_12 : vec4<f32> = frag_color;
final_color = x_12;
return;
}
struct main_out {
[[location(0)]]
final_color_1 : vec4<f32>;
};
[[stage(fragment)]]
fn main([[location(0)]] frag_color_param : vec4<f32>) -> main_out {
frag_color = frag_color_param;
main_1();
return main_out(final_color);
}

View File

@ -0,0 +1,46 @@
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %main "main" %_ %position %frag_color
OpSource GLSL 430
OpName %main "main"
OpName %gl_PerVertex "gl_PerVertex"
OpMemberName %gl_PerVertex 0 "gl_Position"
OpMemberName %gl_PerVertex 1 "gl_PointSize"
OpMemberName %gl_PerVertex 2 "gl_ClipDistance"
OpName %_ ""
OpName %position "position"
OpName %frag_color "frag_color"
OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
OpDecorate %gl_PerVertex Block
OpDecorate %position Location 0
OpDecorate %frag_color Location 1
%void = OpTypeVoid
%8 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_arr_float_uint_1 = OpTypeArray %float %uint_1
%gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1
%_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
%_ = OpVariable %_ptr_Output_gl_PerVertex Output
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%_ptr_Input_v4float = OpTypePointer Input %v4float
%position = OpVariable %_ptr_Input_v4float Input
%_ptr_Output_v4float = OpTypePointer Output %v4float
%frag_color = OpVariable %_ptr_Output_v4float Output
%float_0_5 = OpConstant %float 0.5
%main = OpFunction %void None %8
%20 = OpLabel
%21 = OpLoad %v4float %position
%22 = OpAccessChain %_ptr_Output_v4float %_ %int_0
OpStore %22 %21
%23 = OpLoad %v4float %position
%24 = OpVectorTimesScalar %v4float %23 %float_0_5
OpStore %frag_color %24
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,30 @@
static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
gl_Position = position;
frag_color = (position * 0.5f);
return;
}
struct main_out {
float4 gl_Position;
float4 frag_color_1;
};
struct tint_symbol_1 {
float4 position_param : TEXCOORD0;
};
struct tint_symbol_2 {
float4 frag_color_1 : TEXCOORD1;
float4 gl_Position : SV_Position;
};
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const float4 position_param = tint_symbol.position_param;
position = position_param;
main_1();
const main_out tint_symbol_3 = {gl_Position, frag_color};
const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.frag_color_1, tint_symbol_3.gl_Position};
return tint_symbol_4;
}

View File

@ -0,0 +1,35 @@
#include <metal_stdlib>
using namespace metal;
struct main_out {
float4 gl_Position;
float4 frag_color_1;
};
struct tint_symbol_2 {
float4 position_param [[attribute(0)]];
};
struct tint_symbol_3 {
float4 frag_color_1 [[user(locn1)]];
float4 gl_Position [[position]];
};
void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8) {
float4 const x_21 = *(tint_symbol_6);
*(tint_symbol_7) = x_21;
float4 const x_23 = *(tint_symbol_6);
*(tint_symbol_8) = (x_23 * 0.5f);
return;
}
vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
thread float4 tint_symbol_9 = 0.0f;
thread float4 tint_symbol_10 = 0.0f;
thread float4 tint_symbol_11 = 0.0f;
float4 const position_param = tint_symbol_1.position_param;
tint_symbol_9 = position_param;
main_1(&(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11));
main_out const tint_symbol_4 = {.gl_Position=tint_symbol_10, .frag_color_1=tint_symbol_11};
tint_symbol_3 const tint_symbol_5 = {.frag_color_1=tint_symbol_4.frag_color_1, .gl_Position=tint_symbol_4.gl_Position};
return tint_symbol_5;
}

View File

@ -0,0 +1,79 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 40
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3
OpName %tint_pointsize "tint_pointsize"
OpName %position "position"
OpName %frag_color "frag_color"
OpName %gl_Position "gl_Position"
OpName %tint_symbol "tint_symbol"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol_3 "tint_symbol_3"
OpName %main_1 "main_1"
OpName %main_out "main_out"
OpMemberName %main_out 0 "gl_Position"
OpMemberName %main_out 1 "frag_color_1"
OpName %tint_symbol_4 "tint_symbol_4"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main "main"
OpDecorate %tint_pointsize BuiltIn PointSize
OpDecorate %tint_symbol Location 0
OpDecorate %tint_symbol_2 BuiltIn Position
OpDecorate %tint_symbol_3 Location 1
OpMemberDecorate %main_out 0 Offset 0
OpMemberDecorate %main_out 1 Offset 16
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%8 = OpConstantNull %v4float
%position = OpVariable %_ptr_Private_v4float Private %8
%frag_color = OpVariable %_ptr_Private_v4float Private %8
%gl_Position = OpVariable %_ptr_Private_v4float Private %8
%_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 %8
%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
%16 = OpTypeFunction %void
%float_0_5 = OpConstant %float 0.5
%main_out = OpTypeStruct %v4float %v4float
%24 = OpTypeFunction %void %main_out
%float_1 = OpConstant %float 1
%main_1 = OpFunction %void None %16
%19 = OpLabel
%20 = OpLoad %v4float %position
OpStore %gl_Position %20
%21 = OpLoad %v4float %position
%23 = OpVectorTimesScalar %v4float %21 %float_0_5
OpStore %frag_color %23
OpReturn
OpFunctionEnd
%tint_symbol_4 = OpFunction %void None %24
%tint_symbol_1 = OpFunctionParameter %main_out
%28 = OpLabel
%29 = OpCompositeExtract %v4float %tint_symbol_1 0
OpStore %tint_symbol_2 %29
%30 = OpCompositeExtract %v4float %tint_symbol_1 1
OpStore %tint_symbol_3 %30
OpReturn
OpFunctionEnd
%main = OpFunction %void None %16
%32 = OpLabel
OpStore %tint_pointsize %float_1
%34 = OpLoad %v4float %tint_symbol
OpStore %position %34
%35 = OpFunctionCall %void %main_1
%37 = OpLoad %v4float %gl_Position
%38 = OpLoad %v4float %frag_color
%39 = OpCompositeConstruct %main_out %37 %38
%36 = OpFunctionCall %void %tint_symbol_4 %39
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,27 @@
var<private> position : vec4<f32>;
var<private> frag_color : vec4<f32>;
var<private> gl_Position : vec4<f32>;
fn main_1() {
let x_21 : vec4<f32> = position;
gl_Position = x_21;
let x_23 : vec4<f32> = position;
frag_color = (x_23 * 0.5);
return;
}
struct main_out {
[[builtin(position)]]
gl_Position : vec4<f32>;
[[location(1)]]
frag_color_1 : vec4<f32>;
};
[[stage(vertex)]]
fn main([[location(0)]] position_param : vec4<f32>) -> main_out {
position = position_param;
main_1();
return main_out(gl_Position, frag_color);
}

View File

@ -0,0 +1,27 @@
var<private> position : vec4<f32>;
var<private> frag_color : vec4<f32>;
var<private> gl_Position : vec4<f32>;
fn main_1() {
let x_21 : vec4<f32> = position;
gl_Position = x_21;
let x_23 : vec4<f32> = position;
frag_color = (x_23 * 0.5);
return;
}
struct main_out {
[[builtin(position)]]
gl_Position : vec4<f32>;
[[location(1)]]
frag_color_1 : vec4<f32>;
};
[[stage(vertex)]]
fn main([[location(0)]] position_param : vec4<f32>) -> main_out {
position = position_param;
main_1();
return main_out(gl_Position, frag_color);
}

View File

@ -0,0 +1,30 @@
static float4 position = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 gl_Position = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
gl_Position = position;
frag_color = (position * 0.5f);
return;
}
struct main_out {
float4 gl_Position;
float4 frag_color_1;
};
struct tint_symbol_1 {
float4 position_param : TEXCOORD0;
};
struct tint_symbol_2 {
float4 frag_color_1 : TEXCOORD1;
float4 gl_Position : SV_Position;
};
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const float4 position_param = tint_symbol.position_param;
position = position_param;
main_1();
const main_out tint_symbol_3 = {gl_Position, frag_color};
const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.frag_color_1, tint_symbol_3.gl_Position};
return tint_symbol_4;
}

View File

@ -0,0 +1,35 @@
#include <metal_stdlib>
using namespace metal;
struct main_out {
float4 gl_Position;
float4 frag_color_1;
};
struct tint_symbol_2 {
float4 position_param [[attribute(0)]];
};
struct tint_symbol_3 {
float4 frag_color_1 [[user(locn1)]];
float4 gl_Position [[position]];
};
void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7, thread float4* const tint_symbol_8) {
float4 const x_21 = *(tint_symbol_6);
*(tint_symbol_7) = x_21;
float4 const x_23 = *(tint_symbol_6);
*(tint_symbol_8) = (x_23 * 0.5f);
return;
}
vertex tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
thread float4 tint_symbol_9 = 0.0f;
thread float4 tint_symbol_10 = 0.0f;
thread float4 tint_symbol_11 = 0.0f;
float4 const position_param = tint_symbol_1.position_param;
tint_symbol_9 = position_param;
main_1(&(tint_symbol_9), &(tint_symbol_10), &(tint_symbol_11));
main_out const tint_symbol_4 = {.gl_Position=tint_symbol_10, .frag_color_1=tint_symbol_11};
tint_symbol_3 const tint_symbol_5 = {.frag_color_1=tint_symbol_4.frag_color_1, .gl_Position=tint_symbol_4.gl_Position};
return tint_symbol_5;
}

View File

@ -0,0 +1,79 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 40
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %main "main" %tint_pointsize %tint_symbol %tint_symbol_2 %tint_symbol_3
OpName %tint_pointsize "tint_pointsize"
OpName %position "position"
OpName %frag_color "frag_color"
OpName %gl_Position "gl_Position"
OpName %tint_symbol "tint_symbol"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %tint_symbol_3 "tint_symbol_3"
OpName %main_1 "main_1"
OpName %main_out "main_out"
OpMemberName %main_out 0 "gl_Position"
OpMemberName %main_out 1 "frag_color_1"
OpName %tint_symbol_4 "tint_symbol_4"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main "main"
OpDecorate %tint_pointsize BuiltIn PointSize
OpDecorate %tint_symbol Location 0
OpDecorate %tint_symbol_2 BuiltIn Position
OpDecorate %tint_symbol_3 Location 1
OpMemberDecorate %main_out 0 Offset 0
OpMemberDecorate %main_out 1 Offset 16
%float = OpTypeFloat 32
%_ptr_Output_float = OpTypePointer Output %float
%4 = OpConstantNull %float
%tint_pointsize = OpVariable %_ptr_Output_float Output %4
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%8 = OpConstantNull %v4float
%position = OpVariable %_ptr_Private_v4float Private %8
%frag_color = OpVariable %_ptr_Private_v4float Private %8
%gl_Position = OpVariable %_ptr_Private_v4float Private %8
%_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 %8
%tint_symbol_3 = OpVariable %_ptr_Output_v4float Output %8
%void = OpTypeVoid
%16 = OpTypeFunction %void
%float_0_5 = OpConstant %float 0.5
%main_out = OpTypeStruct %v4float %v4float
%24 = OpTypeFunction %void %main_out
%float_1 = OpConstant %float 1
%main_1 = OpFunction %void None %16
%19 = OpLabel
%20 = OpLoad %v4float %position
OpStore %gl_Position %20
%21 = OpLoad %v4float %position
%23 = OpVectorTimesScalar %v4float %21 %float_0_5
OpStore %frag_color %23
OpReturn
OpFunctionEnd
%tint_symbol_4 = OpFunction %void None %24
%tint_symbol_1 = OpFunctionParameter %main_out
%28 = OpLabel
%29 = OpCompositeExtract %v4float %tint_symbol_1 0
OpStore %tint_symbol_2 %29
%30 = OpCompositeExtract %v4float %tint_symbol_1 1
OpStore %tint_symbol_3 %30
OpReturn
OpFunctionEnd
%main = OpFunction %void None %16
%32 = OpLabel
OpStore %tint_pointsize %float_1
%34 = OpLoad %v4float %tint_symbol
OpStore %position %34
%35 = OpFunctionCall %void %main_1
%37 = OpLoad %v4float %gl_Position
%38 = OpLoad %v4float %frag_color
%39 = OpCompositeConstruct %main_out %37 %38
%36 = OpFunctionCall %void %tint_symbol_4 %39
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,27 @@
var<private> position : vec4<f32>;
var<private> frag_color : vec4<f32>;
var<private> gl_Position : vec4<f32>;
fn main_1() {
let x_21 : vec4<f32> = position;
gl_Position = x_21;
let x_23 : vec4<f32> = position;
frag_color = (x_23 * 0.5);
return;
}
struct main_out {
[[builtin(position)]]
gl_Position : vec4<f32>;
[[location(1)]]
frag_color_1 : vec4<f32>;
};
[[stage(vertex)]]
fn main([[location(0)]] position_param : vec4<f32>) -> main_out {
position = position_param;
main_1();
return main_out(gl_Position, frag_color);
}

View File

@ -0,0 +1,59 @@
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %frag_color %color_out
OpExecutionMode %main OriginUpperLeft
OpSource GLSL 430
OpName %main "main"
OpName %iv "iv"
OpName %frag_color "frag_color"
OpName %color_out "color_out"
OpDecorate %frag_color Location 1
OpDecorate %color_out Location 0
%void = OpTypeVoid
%7 = OpTypeFunction %void
%int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2
%_ptr_Function_v2int = OpTypePointer Function %v2int
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Input_v4float = OpTypePointer Input %v4float
%frag_color = OpVariable %_ptr_Input_v4float Input
%v2float = OpTypeVector %float 2
%float_256 = OpConstant %float 256
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_ptr_Function_int = OpTypePointer Function %int
%int_2 = OpConstant %int 2
%int_64 = OpConstant %int 64
%bool = OpTypeBool
%_ptr_Output_v4float = OpTypePointer Output %v4float
%color_out = OpVariable %_ptr_Output_v4float Output
%float_1 = OpConstant %float 1
%float_0 = OpConstant %float 0
%25 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%26 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1
%main = OpFunction %void None %7
%27 = OpLabel
%iv = OpVariable %_ptr_Function_v2int Function
%28 = OpLoad %v4float %frag_color
%29 = OpVectorShuffle %v2float %28 %28 0 1
%30 = OpVectorTimesScalar %v2float %29 %float_256
%31 = OpConvertFToS %v2int %30
OpStore %iv %31
%32 = OpAccessChain %_ptr_Function_int %iv %uint_1
%33 = OpLoad %int %32
%34 = OpSDiv %int %33 %int_2
%35 = OpBitwiseAnd %int %34 %int_64
%36 = OpIEqual %bool %35 %int_64
OpSelectionMerge %37 None
OpBranchConditional %36 %38 %39
%38 = OpLabel
OpStore %color_out %25
OpBranch %37
%39 = OpLabel
OpStore %color_out %26
OpBranch %37
%37 = OpLabel
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,34 @@
static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 color_out = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
int2 iv = int2(0, 0);
const float4 x_28 = frag_color;
iv = int2((float2(x_28.x, x_28.y) * 256.0f));
const int x_33 = iv.y;
if ((((x_33 / 2) & 64) == 64)) {
color_out = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
color_out = float4(0.0f, 1.0f, 1.0f, 1.0f);
}
return;
}
struct main_out {
float4 color_out_1;
};
struct tint_symbol_1 {
float4 frag_color_param : TEXCOORD1;
};
struct tint_symbol_2 {
float4 color_out_1 : SV_Target0;
};
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const float4 frag_color_param = tint_symbol.frag_color_param;
frag_color = frag_color_param;
main_1();
const main_out tint_symbol_3 = {color_out};
const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.color_out_1};
return tint_symbol_4;
}

View File

@ -0,0 +1,37 @@
#include <metal_stdlib>
using namespace metal;
struct main_out {
float4 color_out_1;
};
struct tint_symbol_2 {
float4 frag_color_param [[user(locn1)]];
};
struct tint_symbol_3 {
float4 color_out_1 [[color(0)]];
};
void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) {
int2 iv = 0;
float4 const x_28 = *(tint_symbol_6);
iv = int2((float2(x_28.x, x_28.y) * 256.0f));
int const x_33 = iv.y;
if ((((x_33 / 2) & 64) == 64)) {
*(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
*(tint_symbol_7) = float4(0.0f, 1.0f, 1.0f, 1.0f);
}
return;
}
fragment tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
thread float4 tint_symbol_8 = 0.0f;
thread float4 tint_symbol_9 = 0.0f;
float4 const frag_color_param = tint_symbol_1.frag_color_param;
tint_symbol_8 = frag_color_param;
main_1(&(tint_symbol_8), &(tint_symbol_9));
main_out const tint_symbol_4 = {.color_out_1=tint_symbol_9};
tint_symbol_3 const tint_symbol_5 = {.color_out_1=tint_symbol_4.color_out_1};
return tint_symbol_5;
}

View File

@ -0,0 +1,96 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 59
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2
OpExecutionMode %main OriginUpperLeft
OpName %frag_color "frag_color"
OpName %color_out "color_out"
OpName %tint_symbol "tint_symbol"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %main_1 "main_1"
OpName %iv "iv"
OpName %main_out "main_out"
OpMemberName %main_out 0 "color_out_1"
OpName %tint_symbol_3 "tint_symbol_3"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main "main"
OpDecorate %tint_symbol Location 1
OpDecorate %tint_symbol_2 Location 0
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%5 = OpConstantNull %v4float
%frag_color = OpVariable %_ptr_Private_v4float Private %5
%color_out = 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
%int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2
%_ptr_Function_v2int = OpTypePointer Function %v2int
%19 = OpConstantNull %v2int
%v2float = OpTypeVector %float 2
%float_256 = OpConstant %float 256
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_ptr_Function_int = OpTypePointer Function %int
%int_2 = OpConstant %int 2
%int_64 = OpConstant %int 64
%bool = OpTypeBool
%float_1 = OpConstant %float 1
%float_0 = OpConstant %float 0
%44 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%45 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1
%main_out = OpTypeStruct %v4float
%46 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %11
%14 = OpLabel
%iv = OpVariable %_ptr_Function_v2int Function %19
%20 = OpLoad %v4float %frag_color
%23 = OpCompositeExtract %float %20 0
%24 = OpCompositeExtract %float %20 1
%25 = OpCompositeConstruct %v2float %23 %24
%27 = OpVectorTimesScalar %v2float %25 %float_256
%21 = OpConvertFToS %v2int %27
OpStore %iv %21
%31 = OpAccessChain %_ptr_Function_int %iv %uint_1
%32 = OpLoad %int %31
%34 = OpSDiv %int %32 %int_2
%36 = OpBitwiseAnd %int %34 %int_64
%37 = OpIEqual %bool %36 %int_64
OpSelectionMerge %39 None
OpBranchConditional %37 %40 %41
%40 = OpLabel
OpStore %color_out %44
OpBranch %39
%41 = OpLabel
OpStore %color_out %45
OpBranch %39
%39 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_3 = OpFunction %void None %46
%tint_symbol_1 = OpFunctionParameter %main_out
%50 = OpLabel
%51 = OpCompositeExtract %v4float %tint_symbol_1 0
OpStore %tint_symbol_2 %51
OpReturn
OpFunctionEnd
%main = OpFunction %void None %11
%53 = OpLabel
%54 = OpLoad %v4float %tint_symbol
OpStore %frag_color %54
%55 = OpFunctionCall %void %main_1
%57 = OpLoad %v4float %color_out
%58 = OpCompositeConstruct %main_out %57
%56 = OpFunctionCall %void %tint_symbol_3 %58
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,28 @@
var<private> frag_color : vec4<f32>;
var<private> color_out : vec4<f32>;
fn main_1() {
var iv : vec2<i32>;
let x_28 : vec4<f32> = frag_color;
iv = vec2<i32>((vec2<f32>(x_28.x, x_28.y) * 256.0));
let x_33 : i32 = iv.y;
if ((((x_33 / 2) & 64) == 64)) {
color_out = vec4<f32>(1.0, 0.0, 0.0, 1.0);
} else {
color_out = vec4<f32>(0.0, 1.0, 1.0, 1.0);
}
return;
}
struct main_out {
[[location(0)]]
color_out_1 : vec4<f32>;
};
[[stage(fragment)]]
fn main([[location(1)]] frag_color_param : vec4<f32>) -> main_out {
frag_color = frag_color_param;
main_1();
return main_out(color_out);
}

View File

@ -0,0 +1,28 @@
var<private> frag_color : vec4<f32>;
var<private> color_out : vec4<f32>;
fn main_1() {
var iv : vec2<i32>;
let x_28 : vec4<f32> = frag_color;
iv = vec2<i32>((vec2<f32>(x_28.x, x_28.y) * 256.0));
let x_33 : i32 = iv.y;
if ((((x_33 / 2) & 64) == 64)) {
color_out = vec4<f32>(1.0, 0.0, 0.0, 1.0);
} else {
color_out = vec4<f32>(0.0, 1.0, 1.0, 1.0);
}
return;
}
struct main_out {
[[location(0)]]
color_out_1 : vec4<f32>;
};
[[stage(fragment)]]
fn main([[location(1)]] frag_color_param : vec4<f32>) -> main_out {
frag_color = frag_color_param;
main_1();
return main_out(color_out);
}

View File

@ -0,0 +1,34 @@
static float4 frag_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float4 color_out = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
int2 iv = int2(0, 0);
const float4 x_28 = frag_color;
iv = int2((float2(x_28.x, x_28.y) * 256.0f));
const int x_33 = iv.y;
if ((((x_33 / 2) & 64) == 64)) {
color_out = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
color_out = float4(0.0f, 1.0f, 1.0f, 1.0f);
}
return;
}
struct main_out {
float4 color_out_1;
};
struct tint_symbol_1 {
float4 frag_color_param : TEXCOORD1;
};
struct tint_symbol_2 {
float4 color_out_1 : SV_Target0;
};
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const float4 frag_color_param = tint_symbol.frag_color_param;
frag_color = frag_color_param;
main_1();
const main_out tint_symbol_3 = {color_out};
const tint_symbol_2 tint_symbol_4 = {tint_symbol_3.color_out_1};
return tint_symbol_4;
}

View File

@ -0,0 +1,37 @@
#include <metal_stdlib>
using namespace metal;
struct main_out {
float4 color_out_1;
};
struct tint_symbol_2 {
float4 frag_color_param [[user(locn1)]];
};
struct tint_symbol_3 {
float4 color_out_1 [[color(0)]];
};
void main_1(thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) {
int2 iv = 0;
float4 const x_28 = *(tint_symbol_6);
iv = int2((float2(x_28.x, x_28.y) * 256.0f));
int const x_33 = iv.y;
if ((((x_33 / 2) & 64) == 64)) {
*(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
*(tint_symbol_7) = float4(0.0f, 1.0f, 1.0f, 1.0f);
}
return;
}
fragment tint_symbol_3 tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
thread float4 tint_symbol_8 = 0.0f;
thread float4 tint_symbol_9 = 0.0f;
float4 const frag_color_param = tint_symbol_1.frag_color_param;
tint_symbol_8 = frag_color_param;
main_1(&(tint_symbol_8), &(tint_symbol_9));
main_out const tint_symbol_4 = {.color_out_1=tint_symbol_9};
tint_symbol_3 const tint_symbol_5 = {.color_out_1=tint_symbol_4.color_out_1};
return tint_symbol_5;
}

View File

@ -0,0 +1,96 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 59
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2
OpExecutionMode %main OriginUpperLeft
OpName %frag_color "frag_color"
OpName %color_out "color_out"
OpName %tint_symbol "tint_symbol"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %main_1 "main_1"
OpName %iv "iv"
OpName %main_out "main_out"
OpMemberName %main_out 0 "color_out_1"
OpName %tint_symbol_3 "tint_symbol_3"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main "main"
OpDecorate %tint_symbol Location 1
OpDecorate %tint_symbol_2 Location 0
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%5 = OpConstantNull %v4float
%frag_color = OpVariable %_ptr_Private_v4float Private %5
%color_out = 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
%int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2
%_ptr_Function_v2int = OpTypePointer Function %v2int
%19 = OpConstantNull %v2int
%v2float = OpTypeVector %float 2
%float_256 = OpConstant %float 256
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_ptr_Function_int = OpTypePointer Function %int
%int_2 = OpConstant %int 2
%int_64 = OpConstant %int 64
%bool = OpTypeBool
%float_1 = OpConstant %float 1
%float_0 = OpConstant %float 0
%44 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%45 = OpConstantComposite %v4float %float_0 %float_1 %float_1 %float_1
%main_out = OpTypeStruct %v4float
%46 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %11
%14 = OpLabel
%iv = OpVariable %_ptr_Function_v2int Function %19
%20 = OpLoad %v4float %frag_color
%23 = OpCompositeExtract %float %20 0
%24 = OpCompositeExtract %float %20 1
%25 = OpCompositeConstruct %v2float %23 %24
%27 = OpVectorTimesScalar %v2float %25 %float_256
%21 = OpConvertFToS %v2int %27
OpStore %iv %21
%31 = OpAccessChain %_ptr_Function_int %iv %uint_1
%32 = OpLoad %int %31
%34 = OpSDiv %int %32 %int_2
%36 = OpBitwiseAnd %int %34 %int_64
%37 = OpIEqual %bool %36 %int_64
OpSelectionMerge %39 None
OpBranchConditional %37 %40 %41
%40 = OpLabel
OpStore %color_out %44
OpBranch %39
%41 = OpLabel
OpStore %color_out %45
OpBranch %39
%39 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_3 = OpFunction %void None %46
%tint_symbol_1 = OpFunctionParameter %main_out
%50 = OpLabel
%51 = OpCompositeExtract %v4float %tint_symbol_1 0
OpStore %tint_symbol_2 %51
OpReturn
OpFunctionEnd
%main = OpFunction %void None %11
%53 = OpLabel
%54 = OpLoad %v4float %tint_symbol
OpStore %frag_color %54
%55 = OpFunctionCall %void %main_1
%57 = OpLoad %v4float %color_out
%58 = OpCompositeConstruct %main_out %57
%56 = OpFunctionCall %void %tint_symbol_3 %58
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,28 @@
var<private> frag_color : vec4<f32>;
var<private> color_out : vec4<f32>;
fn main_1() {
var iv : vec2<i32>;
let x_28 : vec4<f32> = frag_color;
iv = vec2<i32>((vec2<f32>(x_28.x, x_28.y) * 256.0));
let x_33 : i32 = iv.y;
if ((((x_33 / 2) & 64) == 64)) {
color_out = vec4<f32>(1.0, 0.0, 0.0, 1.0);
} else {
color_out = vec4<f32>(0.0, 1.0, 1.0, 1.0);
}
return;
}
struct main_out {
[[location(0)]]
color_out_1 : vec4<f32>;
};
[[stage(fragment)]]
fn main([[location(1)]] frag_color_param : vec4<f32>) -> main_out {
frag_color = frag_color_param;
main_1();
return main_out(color_out);
}

View File

@ -0,0 +1,44 @@
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 %x "x"
OpName %_GLF_color "_GLF_color"
OpDecorate %x RelaxedPrecision
OpDecorate %5 RelaxedPrecision
OpDecorate %6 RelaxedPrecision
OpDecorate %_GLF_color Location 0
%void = OpTypeVoid
%8 = OpTypeFunction %void
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%int_0 = OpConstant %int 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%float_1 = OpConstant %float 1
%15 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%int_3 = OpConstant %int 3
%bool = OpTypeBool
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_GLF_color = OpVariable %_ptr_Output_v4float Output
%float_0 = OpConstant %float 0
%20 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%main = OpFunction %void None %8
%21 = OpLabel
%x = OpVariable %_ptr_Function_int Function
OpStore %x %int_0
%5 = OpLoad %int %x
%6 = OpExtInst %int %1 SClamp %5 %int_0 %int_3
%22 = OpVectorExtractDynamic %float %15 %6
%23 = OpFOrdGreaterThanEqual %bool %22 %float_1
OpSelectionMerge %24 None
OpBranchConditional %23 %25 %24
%25 = OpLabel
OpBranch %24
%24 = OpLabel
OpStore %_GLF_color %20
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,24 @@
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
int x = 0;
x = 0;
if ((float4(1.0f, 1.0f, 1.0f, 1.0f)[clamp(x, 0, 3)] >= 1.0f)) {
}
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
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_2 = {tint_symbol_1.x_GLF_color_1};
return tint_symbol_2;
}

View File

@ -0,0 +1,28 @@
#include <metal_stdlib>
using namespace metal;
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
void main_1(thread float4* const tint_symbol_4) {
int x = 0;
x = 0;
int const x_5 = x;
if ((float4(1.0f, 1.0f, 1.0f, 1.0f)[clamp(x_5, 0, 3)] >= 1.0f)) {
}
*(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f);
return;
}
fragment tint_symbol_1 tint_symbol() {
thread float4 tint_symbol_5 = 0.0f;
main_1(&(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;
}

View File

@ -0,0 +1,73 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 42
; Schema: 0
OpCapability Shader
%21 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
OpName %x "x"
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 %tint_symbol_1 Location 0
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%5 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5
%void = OpTypeVoid
%8 = OpTypeFunction %void
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%15 = OpConstantNull %int
%int_0 = OpConstant %int 0
%float_1 = OpConstant %float 1
%19 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%int_3 = OpConstant %int 3
%bool = OpTypeBool
%float_0 = OpConstant %float 0
%29 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%main_out = OpTypeStruct %v4float
%30 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %8
%11 = OpLabel
%x = OpVariable %_ptr_Function_int Function %15
OpStore %x %int_0
%17 = OpLoad %int %x
%20 = OpExtInst %int %21 SClamp %17 %int_0 %int_3
%23 = OpVectorExtractDynamic %float %19 %20
%24 = OpFOrdGreaterThanEqual %bool %23 %float_1
OpSelectionMerge %26 None
OpBranchConditional %24 %27 %26
%27 = OpLabel
OpBranch %26
%26 = OpLabel
OpStore %x_GLF_color %29
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %30
%tint_symbol = OpFunctionParameter %main_out
%34 = OpLabel
%35 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %35
OpReturn
OpFunctionEnd
%main = OpFunction %void None %8
%37 = OpLabel
%38 = OpFunctionCall %void %main_1
%40 = OpLoad %v4float %x_GLF_color
%41 = OpCompositeConstruct %main_out %40
%39 = OpFunctionCall %void %tint_symbol_2 %41
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,22 @@
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var x : i32;
x = 0;
let x_5 : i32 = x;
if ((vec4<f32>(1.0, 1.0, 1.0, 1.0)[clamp(x_5, 0, 3)] >= 1.0)) {
}
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
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);
}

View File

@ -0,0 +1,22 @@
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var x : i32;
x = 0;
let x_5 : i32 = x;
if ((vec4<f32>(1.0, 1.0, 1.0, 1.0)[clamp(x_5, 0, 3)] >= 1.0)) {
}
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
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);
}

View File

@ -0,0 +1,24 @@
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
int x = 0;
x = 0;
if ((float4(1.0f, 1.0f, 1.0f, 1.0f)[clamp(x, 0, 3)] >= 1.0f)) {
}
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
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_2 = {tint_symbol_1.x_GLF_color_1};
return tint_symbol_2;
}

View File

@ -0,0 +1,28 @@
#include <metal_stdlib>
using namespace metal;
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
void main_1(thread float4* const tint_symbol_4) {
int x = 0;
x = 0;
int const x_5 = x;
if ((float4(1.0f, 1.0f, 1.0f, 1.0f)[clamp(x_5, 0, 3)] >= 1.0f)) {
}
*(tint_symbol_4) = float4(1.0f, 0.0f, 0.0f, 1.0f);
return;
}
fragment tint_symbol_1 tint_symbol() {
thread float4 tint_symbol_5 = 0.0f;
main_1(&(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;
}

View File

@ -0,0 +1,73 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 42
; Schema: 0
OpCapability Shader
%21 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
OpName %x "x"
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 %tint_symbol_1 Location 0
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%5 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %5
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5
%void = OpTypeVoid
%8 = OpTypeFunction %void
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%15 = OpConstantNull %int
%int_0 = OpConstant %int 0
%float_1 = OpConstant %float 1
%19 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%int_3 = OpConstant %int 3
%bool = OpTypeBool
%float_0 = OpConstant %float 0
%29 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%main_out = OpTypeStruct %v4float
%30 = OpTypeFunction %void %main_out
%main_1 = OpFunction %void None %8
%11 = OpLabel
%x = OpVariable %_ptr_Function_int Function %15
OpStore %x %int_0
%17 = OpLoad %int %x
%20 = OpExtInst %int %21 SClamp %17 %int_0 %int_3
%23 = OpVectorExtractDynamic %float %19 %20
%24 = OpFOrdGreaterThanEqual %bool %23 %float_1
OpSelectionMerge %26 None
OpBranchConditional %24 %27 %26
%27 = OpLabel
OpBranch %26
%26 = OpLabel
OpStore %x_GLF_color %29
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %30
%tint_symbol = OpFunctionParameter %main_out
%34 = OpLabel
%35 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %35
OpReturn
OpFunctionEnd
%main = OpFunction %void None %8
%37 = OpLabel
%38 = OpFunctionCall %void %main_1
%40 = OpLoad %v4float %x_GLF_color
%41 = OpCompositeConstruct %main_out %40
%39 = OpFunctionCall %void %tint_symbol_2 %41
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,22 @@
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var x : i32;
x = 0;
let x_5 : i32 = x;
if ((vec4<f32>(1.0, 1.0, 1.0, 1.0)[clamp(x_5, 0, 3)] >= 1.0)) {
}
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
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);
}

View File

@ -0,0 +1,244 @@
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 %tmp_struct "tmp_struct"
OpMemberName %tmp_struct 0 "nmb"
OpName %binarySearch_struct_tmp_struct_i1_1_1_ "binarySearch(struct-tmp_struct-i1[1]1;"
OpName %obj "obj"
OpName %one "one"
OpName %zero "zero"
OpName %tmp_float "tmp_float"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "injectionSwitch"
OpName %_ ""
OpName %color "color"
OpName %_GLF_color "_GLF_color"
OpMemberDecorate %tmp_struct 0 RelaxedPrecision
OpDecorate %binarySearch_struct_tmp_struct_i1_1_1_ RelaxedPrecision
OpDecorate %one RelaxedPrecision
OpDecorate %zero RelaxedPrecision
OpDecorate %13 RelaxedPrecision
OpDecorate %14 RelaxedPrecision
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %buf0 Block
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
OpDecorate %_GLF_color Location 0
OpDecorate %15 RelaxedPrecision
OpDecorate %16 RelaxedPrecision
OpDecorate %17 RelaxedPrecision
OpDecorate %18 RelaxedPrecision
OpDecorate %19 RelaxedPrecision
OpDecorate %20 RelaxedPrecision
OpDecorate %21 RelaxedPrecision
OpDecorate %22 RelaxedPrecision
OpDecorate %23 RelaxedPrecision
OpDecorate %24 RelaxedPrecision
OpDecorate %25 RelaxedPrecision
OpDecorate %26 RelaxedPrecision
OpDecorate %27 RelaxedPrecision
OpDecorate %28 RelaxedPrecision
%void = OpTypeVoid
%30 = OpTypeFunction %void
%int = OpTypeInt 32 1
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_arr_int_uint_1 = OpTypeArray %int %uint_1
%tmp_struct = OpTypeStruct %_arr_int_uint_1
%_ptr_Function_tmp_struct = OpTypePointer Function %tmp_struct
%36 = OpTypeFunction %int %_ptr_Function_tmp_struct
%_ptr_Function_int = OpTypePointer Function %int
%int_1 = OpConstant %int 1
%int_10 = OpConstant %int 10
%bool = OpTypeBool
%int_0 = OpConstant %int 0
%int_n1 = OpConstant %int -1
%float = OpTypeFloat 32
%_ptr_Function_float = OpTypePointer Function %float
%v2float = OpTypeVector %float 2
%buf0 = OpTypeStruct %v2float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%_ = OpVariable %_ptr_Uniform_buf0 Uniform
%_ptr_Uniform_float = OpTypePointer Uniform %float
%v3float = OpTypeVector %float 3
%_ptr_Function_v3float = OpTypePointer Function %v3float
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_GLF_color = OpVariable %_ptr_Output_v4float Output
%float_0 = OpConstant %float 0
%53 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
%float_1 = OpConstant %float 1
%55 = OpConstantComposite %v2float %float_1 %float_1
%uint_0 = OpConstant %uint 0
%57 = OpUndef %tmp_struct
%false = OpConstantFalse %bool
%_ptr_Function_bool = OpTypePointer Function %bool
%true = OpConstantTrue %bool
%61 = OpConstantNull %_arr_int_uint_1
%_ptr_Function__arr_int_uint_1 = OpTypePointer Function %_arr_int_uint_1
%63 = OpUndef %int
%64 = OpUndef %bool
%65 = OpUndef %int
%66 = OpUndef %bool
%main = OpFunction %void None %30
%67 = OpLabel
%24 = OpVariable %_ptr_Function__arr_int_uint_1 Function
%68 = OpVariable %_ptr_Function_bool Function %false
%17 = OpVariable %_ptr_Function_int Function
%18 = OpVariable %_ptr_Function_int Function
%19 = OpVariable %_ptr_Function_int Function
%20 = OpVariable %_ptr_Function_int Function
%69 = OpVariable %_ptr_Function_bool Function %false
%tmp_float = OpVariable %_ptr_Function_float Function
%color = OpVariable %_ptr_Function_v3float Function
OpBranch %70
%70 = OpLabel
OpLoopMerge %71 %72 None
OpBranch %73
%73 = OpLabel
%74 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1
%75 = OpLoad %float %74
OpStore %tmp_float %75
%76 = OpCompositeConstruct %v3float %75 %75 %75
OpStore %color %76
%77 = OpCompositeExtract %_arr_int_uint_1 %57 0
OpStore %24 %77
OpStore %68 %false
OpBranch %78
%78 = OpLabel
%79 = OpPhi %bool %false %73 %64 %80
OpLoopMerge %81 %80 None
OpBranch %82
%82 = OpLabel
OpStore %18 %int_1
OpBranch %83
%83 = OpLabel
%21 = OpPhi %int %int_1 %82 %22 %84
OpLoopMerge %85 %84 None
OpBranch %86
%86 = OpLabel
%87 = OpSGreaterThan %bool %21 %int_10
OpBranchConditional %87 %88 %85
%88 = OpLabel
%22 = OpISub %int %21 %int_1
OpStore %19 %22
%89 = OpAccessChain %_ptr_Function_int %24 %22
%23 = OpLoad %int %89
%90 = OpIEqual %bool %23 %int_1
OpSelectionMerge %91 None
OpBranchConditional %90 %92 %91
%92 = OpLabel
OpStore %68 %true
OpStore %17 %int_1
OpBranch %85
%91 = OpLabel
OpStore %18 %22
OpBranch %84
%84 = OpLabel
OpBranch %83
%85 = OpLabel
%25 = OpPhi %int %63 %86 %int_1 %92
%93 = OpPhi %bool %79 %86 %true %92
OpSelectionMerge %94 None
OpBranchConditional %93 %81 %94
%94 = OpLabel
OpStore %68 %true
OpStore %17 %int_n1
OpBranch %81
%80 = OpLabel
OpBranch %78
%81 = OpLabel
%26 = OpPhi %int %25 %85 %int_n1 %94
OpStore %20 %26
%95 = OpIEqual %bool %26 %int_n1
OpSelectionMerge %96 None
OpBranchConditional %95 %97 %98
%97 = OpLabel
OpKill
%98 = OpLabel
OpStore %_GLF_color %53
%99 = OpVectorShuffle %v2float %76 %76 1 2
%100 = OpFAdd %v2float %99 %55
%101 = OpVectorShuffle %v3float %76 %100 0 3 4
OpStore %color %101
%102 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0
%103 = OpLoad %float %102
%104 = OpFOrdGreaterThan %bool %103 %float_1
OpSelectionMerge %105 None
OpBranchConditional %104 %106 %105
%106 = OpLabel
OpStore %69 %true
OpBranch %71
%105 = OpLabel
OpBranch %96
%96 = OpLabel
%107 = OpCompositeExtract %float %101 0
%108 = OpCompositeExtract %float %101 1
%109 = OpCompositeExtract %float %101 2
%110 = OpCompositeConstruct %v4float %107 %108 %109 %float_1
OpStore %_GLF_color %110
OpStore %69 %true
OpBranch %71
%72 = OpLabel
OpBranch %70
%71 = OpLabel
OpReturn
OpFunctionEnd
%binarySearch_struct_tmp_struct_i1_1_1_ = OpFunction %int None %36
%obj = OpFunctionParameter %_ptr_Function_tmp_struct
%111 = OpLabel
%112 = OpVariable %_ptr_Function_bool Function %false
%16 = OpVariable %_ptr_Function_int Function
%one = OpVariable %_ptr_Function_int Function
%zero = OpVariable %_ptr_Function_int Function
OpBranch %113
%113 = OpLabel
%114 = OpPhi %bool %false %111 %66 %115
OpLoopMerge %116 %115 None
OpBranch %117
%117 = OpLabel
OpStore %one %int_1
OpBranch %118
%118 = OpLabel
%15 = OpPhi %int %int_1 %117 %13 %119
OpLoopMerge %120 %119 None
OpBranch %121
%121 = OpLabel
%122 = OpSGreaterThan %bool %15 %int_10
OpBranchConditional %122 %123 %120
%123 = OpLabel
%13 = OpISub %int %15 %int_1
OpStore %zero %13
%124 = OpAccessChain %_ptr_Function_int %obj %int_0 %13
%14 = OpLoad %int %124
%125 = OpIEqual %bool %14 %int_1
OpSelectionMerge %126 None
OpBranchConditional %125 %127 %126
%127 = OpLabel
OpStore %112 %true
OpStore %16 %int_1
OpBranch %120
%126 = OpLabel
OpStore %one %13
OpBranch %119
%119 = OpLabel
OpBranch %118
%120 = OpLabel
%27 = OpPhi %int %65 %121 %int_1 %127
%128 = OpPhi %bool %114 %121 %true %127
OpSelectionMerge %129 None
OpBranchConditional %128 %116 %129
%129 = OpLabel
OpStore %112 %true
OpStore %16 %int_n1
OpBranch %116
%115 = OpLabel
OpBranch %113
%116 = OpLabel
%28 = OpPhi %int %27 %120 %int_n1 %129
OpReturnValue %28
OpFunctionEnd

View File

@ -0,0 +1,168 @@
struct tmp_struct {
int nmb[1];
};
cbuffer cbuffer_x_11 : register(b0, space0) {
uint4 x_11[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
int x_24[1] = (int[1])0;
bool x_68 = false;
int x_17 = 0;
int x_18 = 0;
int x_19 = 0;
int x_20 = 0;
bool x_69 = false;
float tmp_float = 0.0f;
float3 color = float3(0.0f, 0.0f, 0.0f);
while (true) {
int x_25 = 0;
float3 x_101 = float3(0.0f, 0.0f, 0.0f);
bool x_79_phi = false;
int x_26_phi = 0;
const float x_75 = asfloat(x_11[0].y);
tmp_float = x_75;
const float3 x_76 = float3(x_75, x_75, x_75);
color = x_76;
const int tint_symbol_3[1] = {0};
const tmp_struct tint_symbol_4 = {tint_symbol_3};
x_24 = tint_symbol_4.nmb;
x_68 = false;
x_79_phi = false;
while (true) {
int x_21_phi = 0;
int x_25_phi = 0;
bool x_93_phi = false;
const bool x_79 = x_79_phi;
x_18 = 1;
x_21_phi = 1;
while (true) {
const int x_21 = x_21_phi;
x_25_phi = 0;
x_93_phi = x_79;
if ((x_21 > 10)) {
} else {
break;
}
const int x_22 = (x_21 - 1);
x_19 = x_22;
const int x_23 = x_24[x_22];
if ((x_23 == 1)) {
x_68 = true;
x_17 = 1;
x_25_phi = 1;
x_93_phi = true;
break;
}
x_18 = x_22;
{
x_21_phi = x_22;
}
}
x_25 = x_25_phi;
const bool x_93 = x_93_phi;
x_26_phi = x_25;
if (x_93) {
break;
}
x_68 = true;
x_17 = -1;
x_26_phi = -1;
break;
{
x_79_phi = false;
}
}
const int x_26 = x_26_phi;
x_20 = x_26;
if ((x_26 == -1)) {
discard;
} else {
x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
const float2 x_100 = (float2(x_76.y, x_76.z) + float2(1.0f, 1.0f));
x_101 = float3(x_76.x, x_100.x, x_100.y);
color = x_101;
const float x_103 = asfloat(x_11[0].x);
if ((x_103 > 1.0f)) {
x_69 = true;
break;
}
}
x_GLF_color = float4(x_101.x, x_101.y, x_101.z, 1.0f);
x_69 = true;
break;
}
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_5 = {tint_symbol_1.x_GLF_color_1};
return tint_symbol_5;
}
int binarySearch_struct_tmp_struct_i1_1_1_(inout tmp_struct obj) {
bool x_112 = false;
int x_16 = 0;
int one = 0;
int zero = 0;
int x_27 = 0;
bool x_114_phi = false;
int x_28_phi = 0;
x_114_phi = false;
while (true) {
int x_15_phi = 0;
int x_27_phi = 0;
bool x_128_phi = false;
const bool x_114 = x_114_phi;
one = 1;
x_15_phi = 1;
while (true) {
const int x_15 = x_15_phi;
x_27_phi = 0;
x_128_phi = x_114;
if ((x_15 > 10)) {
} else {
break;
}
const int x_13 = (x_15 - 1);
zero = x_13;
const int x_14 = obj.nmb[x_13];
if ((x_14 == 1)) {
x_112 = true;
x_16 = 1;
x_27_phi = 1;
x_128_phi = true;
break;
}
one = x_13;
{
x_15_phi = x_13;
}
}
x_27 = x_27_phi;
const bool x_128 = x_128_phi;
x_28_phi = x_27;
if (x_128) {
break;
}
x_112 = true;
x_16 = -1;
x_28_phi = -1;
break;
{
x_114_phi = false;
}
}
return x_28_phi;
}

View File

@ -0,0 +1,174 @@
#include <metal_stdlib>
using namespace metal;
struct tint_array_wrapper {
int arr[1];
};
struct tmp_struct {
tint_array_wrapper nmb;
};
struct buf0 {
/* 0x0000 */ packed_float2 injectionSwitch;
};
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_11, thread float4* const tint_symbol_6) {
tint_array_wrapper x_24 = {};
bool x_68 = false;
int x_17 = 0;
int x_18 = 0;
int x_19 = 0;
int x_20 = 0;
bool x_69 = false;
float tmp_float = 0.0f;
float3 color = 0.0f;
while (true) {
int x_25 = 0;
float3 x_101 = 0.0f;
bool x_79_phi = false;
int x_26_phi = 0;
float const x_75 = x_11.injectionSwitch.y;
tmp_float = x_75;
float3 const x_76 = float3(x_75, x_75, x_75);
color = x_76;
tint_array_wrapper const tint_symbol_3 = {.arr={0}};
tmp_struct const tint_symbol_4 = {.nmb=tint_symbol_3};
x_24 = tint_symbol_4.nmb;
x_68 = false;
x_79_phi = false;
while (true) {
int x_21_phi = 0;
int x_25_phi = 0;
bool x_93_phi = false;
bool const x_79 = x_79_phi;
x_18 = 1;
x_21_phi = 1;
while (true) {
int const x_21 = x_21_phi;
x_25_phi = 0;
x_93_phi = x_79;
if ((x_21 > 10)) {
} else {
break;
}
int const x_22 = (x_21 - 1);
x_19 = x_22;
int const x_23 = x_24.arr[x_22];
if ((x_23 == 1)) {
x_68 = true;
x_17 = 1;
x_25_phi = 1;
x_93_phi = true;
break;
}
x_18 = x_22;
{
x_21_phi = x_22;
}
}
x_25 = x_25_phi;
bool const x_93 = x_93_phi;
x_26_phi = x_25;
if (x_93) {
break;
}
x_68 = true;
x_17 = -1;
x_26_phi = -1;
break;
{
x_79_phi = false;
}
}
int const x_26 = x_26_phi;
x_20 = x_26;
if ((x_26 == -1)) {
discard_fragment();
} else {
*(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f);
float2 const x_100 = (float2(x_76.y, x_76.z) + float2(1.0f, 1.0f));
x_101 = float3(x_76.x, x_100.x, x_100.y);
color = x_101;
float const x_103 = x_11.injectionSwitch.x;
if ((x_103 > 1.0f)) {
x_69 = true;
break;
}
}
*(tint_symbol_6) = float4(x_101.x, x_101.y, x_101.z, 1.0f);
x_69 = true;
break;
}
return;
}
fragment tint_symbol_1 tint_symbol(constant buf0& x_11 [[buffer(0)]]) {
thread float4 tint_symbol_7 = 0.0f;
main_1(x_11, &(tint_symbol_7));
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7};
tint_symbol_1 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
return tint_symbol_5;
}
int binarySearch_struct_tmp_struct_i1_1_1_(thread tmp_struct* const obj) {
bool x_112 = false;
int x_16 = 0;
int one = 0;
int zero = 0;
int x_27 = 0;
bool x_114_phi = false;
int x_28_phi = 0;
x_114_phi = false;
while (true) {
int x_15_phi = 0;
int x_27_phi = 0;
bool x_128_phi = false;
bool const x_114 = x_114_phi;
one = 1;
x_15_phi = 1;
while (true) {
int const x_15 = x_15_phi;
x_27_phi = 0;
x_128_phi = x_114;
if ((x_15 > 10)) {
} else {
break;
}
int const x_13 = (x_15 - 1);
zero = x_13;
int const x_14 = (*(obj)).nmb.arr[x_13];
if ((x_14 == 1)) {
x_112 = true;
x_16 = 1;
x_27_phi = 1;
x_128_phi = true;
break;
}
one = x_13;
{
x_15_phi = x_13;
}
}
x_27 = x_27_phi;
bool const x_128 = x_128_phi;
x_28_phi = x_27;
if (x_128) {
break;
}
x_112 = true;
x_16 = -1;
x_28_phi = -1;
break;
{
x_114_phi = false;
}
}
int const x_28 = x_28_phi;
return x_28;
}

View File

@ -0,0 +1,345 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 177
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %buf0 "buf0"
OpMemberName %buf0 0 "injectionSwitch"
OpName %x_11 "x_11"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
OpName %x_24 "x_24"
OpName %x_68 "x_68"
OpName %x_17 "x_17"
OpName %x_18 "x_18"
OpName %x_19 "x_19"
OpName %x_20 "x_20"
OpName %x_69 "x_69"
OpName %tmp_float "tmp_float"
OpName %color "color"
OpName %x_25 "x_25"
OpName %x_101 "x_101"
OpName %x_79_phi "x_79_phi"
OpName %x_26_phi "x_26_phi"
OpName %tmp_struct "tmp_struct"
OpMemberName %tmp_struct 0 "nmb"
OpName %x_21_phi "x_21_phi"
OpName %x_25_phi "x_25_phi"
OpName %x_93_phi "x_93_phi"
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"
OpName %binarySearch_struct_tmp_struct_i1_1_1_ "binarySearch_struct_tmp_struct_i1_1_1_"
OpName %obj "obj"
OpName %x_112 "x_112"
OpName %x_16 "x_16"
OpName %one "one"
OpName %zero "zero"
OpName %x_27 "x_27"
OpName %x_114_phi "x_114_phi"
OpName %x_28_phi "x_28_phi"
OpName %x_15_phi "x_15_phi"
OpName %x_27_phi "x_27_phi"
OpName %x_128_phi "x_128_phi"
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %x_11 NonWritable
OpDecorate %x_11 DescriptorSet 0
OpDecorate %x_11 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpDecorate %_arr_int_uint_1 ArrayStride 4
OpMemberDecorate %tmp_struct 0 Offset 0
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%buf0 = OpTypeStruct %v2float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_11 = OpVariable %_ptr_Uniform_buf0 Uniform
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%9 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9
%void = OpTypeVoid
%12 = OpTypeFunction %void
%int = OpTypeInt 32 1
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_arr_int_uint_1 = OpTypeArray %int %uint_1
%_ptr_Function__arr_int_uint_1 = OpTypePointer Function %_arr_int_uint_1
%22 = OpConstantNull %_arr_int_uint_1
%bool = OpTypeBool
%false = OpConstantFalse %bool
%_ptr_Function_bool = OpTypePointer Function %bool
%27 = OpConstantNull %bool
%_ptr_Function_int = OpTypePointer Function %int
%30 = OpConstantNull %int
%_ptr_Function_float = OpTypePointer Function %float
%37 = OpConstantNull %float
%v3float = OpTypeVector %float 3
%_ptr_Function_v3float = OpTypePointer Function %v3float
%41 = OpConstantNull %v3float
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_float = OpTypePointer Uniform %float
%tmp_struct = OpTypeStruct %_arr_int_uint_1
%int_0 = OpConstant %int 0
%57 = OpConstantComposite %_arr_int_uint_1 %int_0
%58 = OpConstantComposite %tmp_struct %57
%int_1 = OpConstant %int 1
%int_10 = OpConstant %int 10
%true = OpConstantTrue %bool
%int_n1 = OpConstant %int -1
%float_0 = OpConstant %float 0
%98 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
%float_1 = OpConstant %float 1
%103 = OpConstantComposite %v2float %float_1 %float_1
%uint_2 = OpConstant %uint 2
%main_out = OpTypeStruct %v4float
%123 = OpTypeFunction %void %main_out
%_ptr_Function_tmp_struct = OpTypePointer Function %tmp_struct
%135 = OpTypeFunction %int %_ptr_Function_tmp_struct
%main_1 = OpFunction %void None %12
%15 = OpLabel
%x_24 = OpVariable %_ptr_Function__arr_int_uint_1 Function %22
%x_68 = OpVariable %_ptr_Function_bool Function %27
%x_17 = OpVariable %_ptr_Function_int Function %30
%x_18 = OpVariable %_ptr_Function_int Function %30
%x_19 = OpVariable %_ptr_Function_int Function %30
%x_20 = OpVariable %_ptr_Function_int Function %30
%x_69 = OpVariable %_ptr_Function_bool Function %27
%tmp_float = OpVariable %_ptr_Function_float Function %37
%color = OpVariable %_ptr_Function_v3float Function %41
%x_25 = OpVariable %_ptr_Function_int Function %30
%x_101 = OpVariable %_ptr_Function_v3float Function %41
%x_79_phi = OpVariable %_ptr_Function_bool Function %27
%x_26_phi = OpVariable %_ptr_Function_int Function %30
%x_21_phi = OpVariable %_ptr_Function_int Function %30
%x_25_phi = OpVariable %_ptr_Function_int Function %30
%x_93_phi = OpVariable %_ptr_Function_bool Function %27
OpStore %x_68 %false
OpStore %x_69 %false
OpBranch %42
%42 = OpLabel
OpLoopMerge %43 %44 None
OpBranch %45
%45 = OpLabel
%52 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %uint_1
%53 = OpLoad %float %52
OpStore %tmp_float %53
%54 = OpCompositeConstruct %v3float %53 %53 %53
OpStore %color %54
%59 = OpCompositeExtract %_arr_int_uint_1 %58 0
OpStore %x_24 %59
OpStore %x_68 %false
OpStore %x_79_phi %false
OpBranch %60
%60 = OpLabel
OpLoopMerge %61 %62 None
OpBranch %63
%63 = OpLabel
%67 = OpLoad %bool %x_79_phi
OpStore %x_18 %int_1
OpStore %x_21_phi %int_1
OpBranch %69
%69 = OpLabel
OpLoopMerge %70 %71 None
OpBranch %72
%72 = OpLabel
%73 = OpLoad %int %x_21_phi
OpStore %x_25_phi %int_0
OpStore %x_93_phi %67
%75 = OpSGreaterThan %bool %73 %int_10
OpSelectionMerge %76 None
OpBranchConditional %75 %77 %78
%77 = OpLabel
OpBranch %76
%78 = OpLabel
OpBranch %70
%76 = OpLabel
%79 = OpISub %int %73 %int_1
OpStore %x_19 %79
%80 = OpAccessChain %_ptr_Function_int %x_24 %79
%81 = OpLoad %int %80
%82 = OpIEqual %bool %81 %int_1
OpSelectionMerge %83 None
OpBranchConditional %82 %84 %83
%84 = OpLabel
OpStore %x_68 %true
OpStore %x_17 %int_1
OpStore %x_25_phi %int_1
OpStore %x_93_phi %true
OpBranch %70
%83 = OpLabel
OpStore %x_18 %79
OpBranch %71
%71 = OpLabel
OpStore %x_21_phi %79
OpBranch %69
%70 = OpLabel
%86 = OpLoad %int %x_25_phi
OpStore %x_25 %86
%87 = OpLoad %bool %x_93_phi
%88 = OpLoad %int %x_25
OpStore %x_26_phi %88
OpSelectionMerge %89 None
OpBranchConditional %87 %90 %89
%90 = OpLabel
OpBranch %61
%89 = OpLabel
OpStore %x_68 %true
OpStore %x_17 %int_n1
OpStore %x_26_phi %int_n1
OpBranch %61
%62 = OpLabel
OpStore %x_79_phi %false
OpBranch %60
%61 = OpLabel
%92 = OpLoad %int %x_26_phi
OpStore %x_20 %92
%93 = OpIEqual %bool %92 %int_n1
OpSelectionMerge %94 None
OpBranchConditional %93 %95 %96
%95 = OpLabel
OpKill
%96 = OpLabel
OpStore %x_GLF_color %98
%99 = OpCompositeExtract %float %54 1
%100 = OpCompositeExtract %float %54 2
%101 = OpCompositeConstruct %v2float %99 %100
%104 = OpFAdd %v2float %101 %103
%105 = OpCompositeExtract %float %54 0
%106 = OpCompositeExtract %float %104 0
%107 = OpCompositeExtract %float %104 1
%108 = OpCompositeConstruct %v3float %105 %106 %107
OpStore %x_101 %108
%109 = OpLoad %v3float %x_101
OpStore %color %109
%110 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %uint_0
%111 = OpLoad %float %110
%112 = OpFOrdGreaterThan %bool %111 %float_1
OpSelectionMerge %113 None
OpBranchConditional %112 %114 %113
%114 = OpLabel
OpStore %x_69 %true
OpBranch %43
%113 = OpLabel
OpBranch %94
%94 = OpLabel
%115 = OpAccessChain %_ptr_Function_float %x_101 %uint_0
%116 = OpLoad %float %115
%117 = OpAccessChain %_ptr_Function_float %x_101 %uint_1
%118 = OpLoad %float %117
%120 = OpAccessChain %_ptr_Function_float %x_101 %uint_2
%121 = OpLoad %float %120
%122 = OpCompositeConstruct %v4float %116 %118 %121 %float_1
OpStore %x_GLF_color %122
OpStore %x_69 %true
OpBranch %43
%44 = OpLabel
OpBranch %42
%43 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %123
%tint_symbol = OpFunctionParameter %main_out
%127 = OpLabel
%128 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %128
OpReturn
OpFunctionEnd
%main = OpFunction %void None %12
%130 = OpLabel
%131 = OpFunctionCall %void %main_1
%133 = OpLoad %v4float %x_GLF_color
%134 = OpCompositeConstruct %main_out %133
%132 = OpFunctionCall %void %tint_symbol_2 %134
OpReturn
OpFunctionEnd
%binarySearch_struct_tmp_struct_i1_1_1_ = OpFunction %int None %135
%obj = OpFunctionParameter %_ptr_Function_tmp_struct
%139 = OpLabel
%x_112 = OpVariable %_ptr_Function_bool Function %27
%x_16 = OpVariable %_ptr_Function_int Function %30
%one = OpVariable %_ptr_Function_int Function %30
%zero = OpVariable %_ptr_Function_int Function %30
%x_27 = OpVariable %_ptr_Function_int Function %30
%x_114_phi = OpVariable %_ptr_Function_bool Function %27
%x_28_phi = OpVariable %_ptr_Function_int Function %30
%x_15_phi = OpVariable %_ptr_Function_int Function %30
%x_27_phi = OpVariable %_ptr_Function_int Function %30
%x_128_phi = OpVariable %_ptr_Function_bool Function %27
OpStore %x_112 %false
OpStore %x_114_phi %false
OpBranch %147
%147 = OpLabel
OpLoopMerge %148 %149 None
OpBranch %150
%150 = OpLabel
%154 = OpLoad %bool %x_114_phi
OpStore %one %int_1
OpStore %x_15_phi %int_1
OpBranch %155
%155 = OpLabel
OpLoopMerge %156 %157 None
OpBranch %158
%158 = OpLabel
%159 = OpLoad %int %x_15_phi
OpStore %x_27_phi %int_0
OpStore %x_128_phi %154
%160 = OpSGreaterThan %bool %159 %int_10
OpSelectionMerge %161 None
OpBranchConditional %160 %162 %163
%162 = OpLabel
OpBranch %161
%163 = OpLabel
OpBranch %156
%161 = OpLabel
%164 = OpISub %int %159 %int_1
OpStore %zero %164
%166 = OpAccessChain %_ptr_Function_int %obj %uint_0 %164
%167 = OpLoad %int %166
%168 = OpIEqual %bool %167 %int_1
OpSelectionMerge %169 None
OpBranchConditional %168 %170 %169
%170 = OpLabel
OpStore %x_112 %true
OpStore %x_16 %int_1
OpStore %x_27_phi %int_1
OpStore %x_128_phi %true
OpBranch %156
%169 = OpLabel
OpStore %one %164
OpBranch %157
%157 = OpLabel
OpStore %x_15_phi %164
OpBranch %155
%156 = OpLabel
%171 = OpLoad %int %x_27_phi
OpStore %x_27 %171
%172 = OpLoad %bool %x_128_phi
%173 = OpLoad %int %x_27
OpStore %x_28_phi %173
OpSelectionMerge %174 None
OpBranchConditional %172 %175 %174
%175 = OpLabel
OpBranch %148
%174 = OpLabel
OpStore %x_112 %true
OpStore %x_16 %int_n1
OpStore %x_28_phi %int_n1
OpBranch %148
%149 = OpLabel
OpStore %x_114_phi %false
OpBranch %147
%148 = OpLabel
%176 = OpLoad %int %x_28_phi
OpReturnValue %176
OpFunctionEnd

View File

@ -0,0 +1,172 @@
struct tmp_struct {
nmb : array<i32, 1>;
};
[[block]]
struct buf0 {
injectionSwitch : vec2<f32>;
};
[[group(0), binding(0)]] var<uniform> x_11 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var x_24 : array<i32, 1>;
var x_68 : bool = false;
var x_17 : i32;
var x_18 : i32;
var x_19 : i32;
var x_20 : i32;
var x_69 : bool = false;
var tmp_float : f32;
var color : vec3<f32>;
loop {
var x_25 : i32;
var x_101 : vec3<f32>;
var x_79_phi : bool;
var x_26_phi : i32;
let x_75 : f32 = x_11.injectionSwitch.y;
tmp_float = x_75;
let x_76 : vec3<f32> = vec3<f32>(x_75, x_75, x_75);
color = x_76;
x_24 = tmp_struct(array<i32, 1>(0)).nmb;
x_68 = false;
x_79_phi = false;
loop {
var x_21_phi : i32;
var x_25_phi : i32;
var x_93_phi : bool;
let x_79 : bool = x_79_phi;
x_18 = 1;
x_21_phi = 1;
loop {
let x_21 : i32 = x_21_phi;
x_25_phi = 0;
x_93_phi = x_79;
if ((x_21 > 10)) {
} else {
break;
}
let x_22 : i32 = (x_21 - 1);
x_19 = x_22;
let x_23 : i32 = x_24[x_22];
if ((x_23 == 1)) {
x_68 = true;
x_17 = 1;
x_25_phi = 1;
x_93_phi = true;
break;
}
x_18 = x_22;
continuing {
x_21_phi = x_22;
}
}
x_25 = x_25_phi;
let x_93 : bool = x_93_phi;
x_26_phi = x_25;
if (x_93) {
break;
}
x_68 = true;
x_17 = -1;
x_26_phi = -1;
break;
continuing {
x_79_phi = false;
}
}
let x_26 : i32 = x_26_phi;
x_20 = x_26;
if ((x_26 == -1)) {
discard;
} else {
x_GLF_color = vec4<f32>(0.0, 0.0, 0.0, 0.0);
let x_100 : vec2<f32> = (vec2<f32>(x_76.y, x_76.z) + vec2<f32>(1.0, 1.0));
x_101 = vec3<f32>(x_76.x, x_100.x, x_100.y);
color = x_101;
let x_103 : f32 = x_11.injectionSwitch.x;
if ((x_103 > 1.0)) {
x_69 = true;
break;
}
}
x_GLF_color = vec4<f32>(x_101.x, x_101.y, x_101.z, 1.0);
x_69 = true;
break;
}
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);
}
fn binarySearch_struct_tmp_struct_i1_1_1_(obj : ptr<function, tmp_struct>) -> i32 {
var x_112 : bool = false;
var x_16 : i32;
var one : i32;
var zero : i32;
var x_27 : i32;
var x_114_phi : bool;
var x_28_phi : i32;
x_114_phi = false;
loop {
var x_15_phi : i32;
var x_27_phi : i32;
var x_128_phi : bool;
let x_114 : bool = x_114_phi;
one = 1;
x_15_phi = 1;
loop {
let x_15 : i32 = x_15_phi;
x_27_phi = 0;
x_128_phi = x_114;
if ((x_15 > 10)) {
} else {
break;
}
let x_13 : i32 = (x_15 - 1);
zero = x_13;
let x_14 : i32 = (*(obj)).nmb[x_13];
if ((x_14 == 1)) {
x_112 = true;
x_16 = 1;
x_27_phi = 1;
x_128_phi = true;
break;
}
one = x_13;
continuing {
x_15_phi = x_13;
}
}
x_27 = x_27_phi;
let x_128 : bool = x_128_phi;
x_28_phi = x_27;
if (x_128) {
break;
}
x_112 = true;
x_16 = -1;
x_28_phi = -1;
break;
continuing {
x_114_phi = false;
}
}
let x_28 : i32 = x_28_phi;
return x_28;
}

View File

@ -0,0 +1,172 @@
struct tmp_struct {
nmb : array<i32, 1>;
};
[[block]]
struct buf0 {
injectionSwitch : vec2<f32>;
};
[[group(0), binding(0)]] var<uniform> x_11 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var x_24 : array<i32, 1>;
var x_68 : bool = false;
var x_17 : i32;
var x_18 : i32;
var x_19 : i32;
var x_20 : i32;
var x_69 : bool = false;
var tmp_float : f32;
var color : vec3<f32>;
loop {
var x_25 : i32;
var x_101 : vec3<f32>;
var x_79_phi : bool;
var x_26_phi : i32;
let x_75 : f32 = x_11.injectionSwitch.y;
tmp_float = x_75;
let x_76 : vec3<f32> = vec3<f32>(x_75, x_75, x_75);
color = x_76;
x_24 = tmp_struct(array<i32, 1>(0)).nmb;
x_68 = false;
x_79_phi = false;
loop {
var x_21_phi : i32;
var x_25_phi : i32;
var x_93_phi : bool;
let x_79 : bool = x_79_phi;
x_18 = 1;
x_21_phi = 1;
loop {
let x_21 : i32 = x_21_phi;
x_25_phi = 0;
x_93_phi = x_79;
if ((x_21 > 10)) {
} else {
break;
}
let x_22 : i32 = (x_21 - 1);
x_19 = x_22;
let x_23 : i32 = x_24[x_22];
if ((x_23 == 1)) {
x_68 = true;
x_17 = 1;
x_25_phi = 1;
x_93_phi = true;
break;
}
x_18 = x_22;
continuing {
x_21_phi = x_22;
}
}
x_25 = x_25_phi;
let x_93 : bool = x_93_phi;
x_26_phi = x_25;
if (x_93) {
break;
}
x_68 = true;
x_17 = -1;
x_26_phi = -1;
break;
continuing {
x_79_phi = false;
}
}
let x_26 : i32 = x_26_phi;
x_20 = x_26;
if ((x_26 == -1)) {
discard;
} else {
x_GLF_color = vec4<f32>(0.0, 0.0, 0.0, 0.0);
let x_100 : vec2<f32> = (vec2<f32>(x_76.y, x_76.z) + vec2<f32>(1.0, 1.0));
x_101 = vec3<f32>(x_76.x, x_100.x, x_100.y);
color = x_101;
let x_103 : f32 = x_11.injectionSwitch.x;
if ((x_103 > 1.0)) {
x_69 = true;
break;
}
}
x_GLF_color = vec4<f32>(x_101.x, x_101.y, x_101.z, 1.0);
x_69 = true;
break;
}
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);
}
fn binarySearch_struct_tmp_struct_i1_1_1_(obj : ptr<function, tmp_struct>) -> i32 {
var x_112 : bool = false;
var x_16 : i32;
var one : i32;
var zero : i32;
var x_27 : i32;
var x_114_phi : bool;
var x_28_phi : i32;
x_114_phi = false;
loop {
var x_15_phi : i32;
var x_27_phi : i32;
var x_128_phi : bool;
let x_114 : bool = x_114_phi;
one = 1;
x_15_phi = 1;
loop {
let x_15 : i32 = x_15_phi;
x_27_phi = 0;
x_128_phi = x_114;
if ((x_15 > 10)) {
} else {
break;
}
let x_13 : i32 = (x_15 - 1);
zero = x_13;
let x_14 : i32 = (*(obj)).nmb[x_13];
if ((x_14 == 1)) {
x_112 = true;
x_16 = 1;
x_27_phi = 1;
x_128_phi = true;
break;
}
one = x_13;
continuing {
x_15_phi = x_13;
}
}
x_27 = x_27_phi;
let x_128 : bool = x_128_phi;
x_28_phi = x_27;
if (x_128) {
break;
}
x_112 = true;
x_16 = -1;
x_28_phi = -1;
break;
continuing {
x_114_phi = false;
}
}
let x_28 : i32 = x_28_phi;
return x_28;
}

View File

@ -0,0 +1,168 @@
struct tmp_struct {
int nmb[1];
};
cbuffer cbuffer_x_11 : register(b0, space0) {
uint4 x_11[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
int x_24[1] = (int[1])0;
bool x_68 = false;
int x_17 = 0;
int x_18 = 0;
int x_19 = 0;
int x_20 = 0;
bool x_69 = false;
float tmp_float = 0.0f;
float3 color = float3(0.0f, 0.0f, 0.0f);
while (true) {
int x_25 = 0;
float3 x_101 = float3(0.0f, 0.0f, 0.0f);
bool x_79_phi = false;
int x_26_phi = 0;
const float x_75 = asfloat(x_11[0].y);
tmp_float = x_75;
const float3 x_76 = float3(x_75, x_75, x_75);
color = x_76;
const int tint_symbol_3[1] = {0};
const tmp_struct tint_symbol_4 = {tint_symbol_3};
x_24 = tint_symbol_4.nmb;
x_68 = false;
x_79_phi = false;
while (true) {
int x_21_phi = 0;
int x_25_phi = 0;
bool x_93_phi = false;
const bool x_79 = x_79_phi;
x_18 = 1;
x_21_phi = 1;
while (true) {
const int x_21 = x_21_phi;
x_25_phi = 0;
x_93_phi = x_79;
if ((x_21 > 10)) {
} else {
break;
}
const int x_22 = (x_21 - 1);
x_19 = x_22;
const int x_23 = x_24[x_22];
if ((x_23 == 1)) {
x_68 = true;
x_17 = 1;
x_25_phi = 1;
x_93_phi = true;
break;
}
x_18 = x_22;
{
x_21_phi = x_22;
}
}
x_25 = x_25_phi;
const bool x_93 = x_93_phi;
x_26_phi = x_25;
if (x_93) {
break;
}
x_68 = true;
x_17 = -1;
x_26_phi = -1;
break;
{
x_79_phi = false;
}
}
const int x_26 = x_26_phi;
x_20 = x_26;
if ((x_26 == -1)) {
discard;
} else {
x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
const float2 x_100 = (float2(x_76.y, x_76.z) + float2(1.0f, 1.0f));
x_101 = float3(x_76.x, x_100.x, x_100.y);
color = x_101;
const float x_103 = asfloat(x_11[0].x);
if ((x_103 > 1.0f)) {
x_69 = true;
break;
}
}
x_GLF_color = float4(x_101.x, x_101.y, x_101.z, 1.0f);
x_69 = true;
break;
}
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_5 = {tint_symbol_1.x_GLF_color_1};
return tint_symbol_5;
}
int binarySearch_struct_tmp_struct_i1_1_1_(inout tmp_struct obj) {
bool x_112 = false;
int x_16 = 0;
int one = 0;
int zero = 0;
int x_27 = 0;
bool x_114_phi = false;
int x_28_phi = 0;
x_114_phi = false;
while (true) {
int x_15_phi = 0;
int x_27_phi = 0;
bool x_128_phi = false;
const bool x_114 = x_114_phi;
one = 1;
x_15_phi = 1;
while (true) {
const int x_15 = x_15_phi;
x_27_phi = 0;
x_128_phi = x_114;
if ((x_15 > 10)) {
} else {
break;
}
const int x_13 = (x_15 - 1);
zero = x_13;
const int x_14 = obj.nmb[x_13];
if ((x_14 == 1)) {
x_112 = true;
x_16 = 1;
x_27_phi = 1;
x_128_phi = true;
break;
}
one = x_13;
{
x_15_phi = x_13;
}
}
x_27 = x_27_phi;
const bool x_128 = x_128_phi;
x_28_phi = x_27;
if (x_128) {
break;
}
x_112 = true;
x_16 = -1;
x_28_phi = -1;
break;
{
x_114_phi = false;
}
}
return x_28_phi;
}

View File

@ -0,0 +1,174 @@
#include <metal_stdlib>
using namespace metal;
struct tint_array_wrapper {
int arr[1];
};
struct tmp_struct {
tint_array_wrapper nmb;
};
struct buf0 {
/* 0x0000 */ packed_float2 injectionSwitch;
};
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_11, thread float4* const tint_symbol_6) {
tint_array_wrapper x_24 = {};
bool x_68 = false;
int x_17 = 0;
int x_18 = 0;
int x_19 = 0;
int x_20 = 0;
bool x_69 = false;
float tmp_float = 0.0f;
float3 color = 0.0f;
while (true) {
int x_25 = 0;
float3 x_101 = 0.0f;
bool x_79_phi = false;
int x_26_phi = 0;
float const x_75 = x_11.injectionSwitch.y;
tmp_float = x_75;
float3 const x_76 = float3(x_75, x_75, x_75);
color = x_76;
tint_array_wrapper const tint_symbol_3 = {.arr={0}};
tmp_struct const tint_symbol_4 = {.nmb=tint_symbol_3};
x_24 = tint_symbol_4.nmb;
x_68 = false;
x_79_phi = false;
while (true) {
int x_21_phi = 0;
int x_25_phi = 0;
bool x_93_phi = false;
bool const x_79 = x_79_phi;
x_18 = 1;
x_21_phi = 1;
while (true) {
int const x_21 = x_21_phi;
x_25_phi = 0;
x_93_phi = x_79;
if ((x_21 > 10)) {
} else {
break;
}
int const x_22 = (x_21 - 1);
x_19 = x_22;
int const x_23 = x_24.arr[x_22];
if ((x_23 == 1)) {
x_68 = true;
x_17 = 1;
x_25_phi = 1;
x_93_phi = true;
break;
}
x_18 = x_22;
{
x_21_phi = x_22;
}
}
x_25 = x_25_phi;
bool const x_93 = x_93_phi;
x_26_phi = x_25;
if (x_93) {
break;
}
x_68 = true;
x_17 = -1;
x_26_phi = -1;
break;
{
x_79_phi = false;
}
}
int const x_26 = x_26_phi;
x_20 = x_26;
if ((x_26 == -1)) {
discard_fragment();
} else {
*(tint_symbol_6) = float4(0.0f, 0.0f, 0.0f, 0.0f);
float2 const x_100 = (float2(x_76.y, x_76.z) + float2(1.0f, 1.0f));
x_101 = float3(x_76.x, x_100.x, x_100.y);
color = x_101;
float const x_103 = x_11.injectionSwitch.x;
if ((x_103 > 1.0f)) {
x_69 = true;
break;
}
}
*(tint_symbol_6) = float4(x_101.x, x_101.y, x_101.z, 1.0f);
x_69 = true;
break;
}
return;
}
fragment tint_symbol_1 tint_symbol(constant buf0& x_11 [[buffer(0)]]) {
thread float4 tint_symbol_7 = 0.0f;
main_1(x_11, &(tint_symbol_7));
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_7};
tint_symbol_1 const tint_symbol_5 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
return tint_symbol_5;
}
int binarySearch_struct_tmp_struct_i1_1_1_(thread tmp_struct* const obj) {
bool x_112 = false;
int x_16 = 0;
int one = 0;
int zero = 0;
int x_27 = 0;
bool x_114_phi = false;
int x_28_phi = 0;
x_114_phi = false;
while (true) {
int x_15_phi = 0;
int x_27_phi = 0;
bool x_128_phi = false;
bool const x_114 = x_114_phi;
one = 1;
x_15_phi = 1;
while (true) {
int const x_15 = x_15_phi;
x_27_phi = 0;
x_128_phi = x_114;
if ((x_15 > 10)) {
} else {
break;
}
int const x_13 = (x_15 - 1);
zero = x_13;
int const x_14 = (*(obj)).nmb.arr[x_13];
if ((x_14 == 1)) {
x_112 = true;
x_16 = 1;
x_27_phi = 1;
x_128_phi = true;
break;
}
one = x_13;
{
x_15_phi = x_13;
}
}
x_27 = x_27_phi;
bool const x_128 = x_128_phi;
x_28_phi = x_27;
if (x_128) {
break;
}
x_112 = true;
x_16 = -1;
x_28_phi = -1;
break;
{
x_114_phi = false;
}
}
int const x_28 = x_28_phi;
return x_28;
}

View File

@ -0,0 +1,345 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 177
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %buf0 "buf0"
OpMemberName %buf0 0 "injectionSwitch"
OpName %x_11 "x_11"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %main_1 "main_1"
OpName %x_24 "x_24"
OpName %x_68 "x_68"
OpName %x_17 "x_17"
OpName %x_18 "x_18"
OpName %x_19 "x_19"
OpName %x_20 "x_20"
OpName %x_69 "x_69"
OpName %tmp_float "tmp_float"
OpName %color "color"
OpName %x_25 "x_25"
OpName %x_101 "x_101"
OpName %x_79_phi "x_79_phi"
OpName %x_26_phi "x_26_phi"
OpName %tmp_struct "tmp_struct"
OpMemberName %tmp_struct 0 "nmb"
OpName %x_21_phi "x_21_phi"
OpName %x_25_phi "x_25_phi"
OpName %x_93_phi "x_93_phi"
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"
OpName %binarySearch_struct_tmp_struct_i1_1_1_ "binarySearch_struct_tmp_struct_i1_1_1_"
OpName %obj "obj"
OpName %x_112 "x_112"
OpName %x_16 "x_16"
OpName %one "one"
OpName %zero "zero"
OpName %x_27 "x_27"
OpName %x_114_phi "x_114_phi"
OpName %x_28_phi "x_28_phi"
OpName %x_15_phi "x_15_phi"
OpName %x_27_phi "x_27_phi"
OpName %x_128_phi "x_128_phi"
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %x_11 NonWritable
OpDecorate %x_11 DescriptorSet 0
OpDecorate %x_11 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpDecorate %_arr_int_uint_1 ArrayStride 4
OpMemberDecorate %tmp_struct 0 Offset 0
OpMemberDecorate %main_out 0 Offset 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%buf0 = OpTypeStruct %v2float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_11 = OpVariable %_ptr_Uniform_buf0 Uniform
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%9 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %9
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %9
%void = OpTypeVoid
%12 = OpTypeFunction %void
%int = OpTypeInt 32 1
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_arr_int_uint_1 = OpTypeArray %int %uint_1
%_ptr_Function__arr_int_uint_1 = OpTypePointer Function %_arr_int_uint_1
%22 = OpConstantNull %_arr_int_uint_1
%bool = OpTypeBool
%false = OpConstantFalse %bool
%_ptr_Function_bool = OpTypePointer Function %bool
%27 = OpConstantNull %bool
%_ptr_Function_int = OpTypePointer Function %int
%30 = OpConstantNull %int
%_ptr_Function_float = OpTypePointer Function %float
%37 = OpConstantNull %float
%v3float = OpTypeVector %float 3
%_ptr_Function_v3float = OpTypePointer Function %v3float
%41 = OpConstantNull %v3float
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_float = OpTypePointer Uniform %float
%tmp_struct = OpTypeStruct %_arr_int_uint_1
%int_0 = OpConstant %int 0
%57 = OpConstantComposite %_arr_int_uint_1 %int_0
%58 = OpConstantComposite %tmp_struct %57
%int_1 = OpConstant %int 1
%int_10 = OpConstant %int 10
%true = OpConstantTrue %bool
%int_n1 = OpConstant %int -1
%float_0 = OpConstant %float 0
%98 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
%float_1 = OpConstant %float 1
%103 = OpConstantComposite %v2float %float_1 %float_1
%uint_2 = OpConstant %uint 2
%main_out = OpTypeStruct %v4float
%123 = OpTypeFunction %void %main_out
%_ptr_Function_tmp_struct = OpTypePointer Function %tmp_struct
%135 = OpTypeFunction %int %_ptr_Function_tmp_struct
%main_1 = OpFunction %void None %12
%15 = OpLabel
%x_24 = OpVariable %_ptr_Function__arr_int_uint_1 Function %22
%x_68 = OpVariable %_ptr_Function_bool Function %27
%x_17 = OpVariable %_ptr_Function_int Function %30
%x_18 = OpVariable %_ptr_Function_int Function %30
%x_19 = OpVariable %_ptr_Function_int Function %30
%x_20 = OpVariable %_ptr_Function_int Function %30
%x_69 = OpVariable %_ptr_Function_bool Function %27
%tmp_float = OpVariable %_ptr_Function_float Function %37
%color = OpVariable %_ptr_Function_v3float Function %41
%x_25 = OpVariable %_ptr_Function_int Function %30
%x_101 = OpVariable %_ptr_Function_v3float Function %41
%x_79_phi = OpVariable %_ptr_Function_bool Function %27
%x_26_phi = OpVariable %_ptr_Function_int Function %30
%x_21_phi = OpVariable %_ptr_Function_int Function %30
%x_25_phi = OpVariable %_ptr_Function_int Function %30
%x_93_phi = OpVariable %_ptr_Function_bool Function %27
OpStore %x_68 %false
OpStore %x_69 %false
OpBranch %42
%42 = OpLabel
OpLoopMerge %43 %44 None
OpBranch %45
%45 = OpLabel
%52 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %uint_1
%53 = OpLoad %float %52
OpStore %tmp_float %53
%54 = OpCompositeConstruct %v3float %53 %53 %53
OpStore %color %54
%59 = OpCompositeExtract %_arr_int_uint_1 %58 0
OpStore %x_24 %59
OpStore %x_68 %false
OpStore %x_79_phi %false
OpBranch %60
%60 = OpLabel
OpLoopMerge %61 %62 None
OpBranch %63
%63 = OpLabel
%67 = OpLoad %bool %x_79_phi
OpStore %x_18 %int_1
OpStore %x_21_phi %int_1
OpBranch %69
%69 = OpLabel
OpLoopMerge %70 %71 None
OpBranch %72
%72 = OpLabel
%73 = OpLoad %int %x_21_phi
OpStore %x_25_phi %int_0
OpStore %x_93_phi %67
%75 = OpSGreaterThan %bool %73 %int_10
OpSelectionMerge %76 None
OpBranchConditional %75 %77 %78
%77 = OpLabel
OpBranch %76
%78 = OpLabel
OpBranch %70
%76 = OpLabel
%79 = OpISub %int %73 %int_1
OpStore %x_19 %79
%80 = OpAccessChain %_ptr_Function_int %x_24 %79
%81 = OpLoad %int %80
%82 = OpIEqual %bool %81 %int_1
OpSelectionMerge %83 None
OpBranchConditional %82 %84 %83
%84 = OpLabel
OpStore %x_68 %true
OpStore %x_17 %int_1
OpStore %x_25_phi %int_1
OpStore %x_93_phi %true
OpBranch %70
%83 = OpLabel
OpStore %x_18 %79
OpBranch %71
%71 = OpLabel
OpStore %x_21_phi %79
OpBranch %69
%70 = OpLabel
%86 = OpLoad %int %x_25_phi
OpStore %x_25 %86
%87 = OpLoad %bool %x_93_phi
%88 = OpLoad %int %x_25
OpStore %x_26_phi %88
OpSelectionMerge %89 None
OpBranchConditional %87 %90 %89
%90 = OpLabel
OpBranch %61
%89 = OpLabel
OpStore %x_68 %true
OpStore %x_17 %int_n1
OpStore %x_26_phi %int_n1
OpBranch %61
%62 = OpLabel
OpStore %x_79_phi %false
OpBranch %60
%61 = OpLabel
%92 = OpLoad %int %x_26_phi
OpStore %x_20 %92
%93 = OpIEqual %bool %92 %int_n1
OpSelectionMerge %94 None
OpBranchConditional %93 %95 %96
%95 = OpLabel
OpKill
%96 = OpLabel
OpStore %x_GLF_color %98
%99 = OpCompositeExtract %float %54 1
%100 = OpCompositeExtract %float %54 2
%101 = OpCompositeConstruct %v2float %99 %100
%104 = OpFAdd %v2float %101 %103
%105 = OpCompositeExtract %float %54 0
%106 = OpCompositeExtract %float %104 0
%107 = OpCompositeExtract %float %104 1
%108 = OpCompositeConstruct %v3float %105 %106 %107
OpStore %x_101 %108
%109 = OpLoad %v3float %x_101
OpStore %color %109
%110 = OpAccessChain %_ptr_Uniform_float %x_11 %uint_0 %uint_0
%111 = OpLoad %float %110
%112 = OpFOrdGreaterThan %bool %111 %float_1
OpSelectionMerge %113 None
OpBranchConditional %112 %114 %113
%114 = OpLabel
OpStore %x_69 %true
OpBranch %43
%113 = OpLabel
OpBranch %94
%94 = OpLabel
%115 = OpAccessChain %_ptr_Function_float %x_101 %uint_0
%116 = OpLoad %float %115
%117 = OpAccessChain %_ptr_Function_float %x_101 %uint_1
%118 = OpLoad %float %117
%120 = OpAccessChain %_ptr_Function_float %x_101 %uint_2
%121 = OpLoad %float %120
%122 = OpCompositeConstruct %v4float %116 %118 %121 %float_1
OpStore %x_GLF_color %122
OpStore %x_69 %true
OpBranch %43
%44 = OpLabel
OpBranch %42
%43 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %123
%tint_symbol = OpFunctionParameter %main_out
%127 = OpLabel
%128 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %128
OpReturn
OpFunctionEnd
%main = OpFunction %void None %12
%130 = OpLabel
%131 = OpFunctionCall %void %main_1
%133 = OpLoad %v4float %x_GLF_color
%134 = OpCompositeConstruct %main_out %133
%132 = OpFunctionCall %void %tint_symbol_2 %134
OpReturn
OpFunctionEnd
%binarySearch_struct_tmp_struct_i1_1_1_ = OpFunction %int None %135
%obj = OpFunctionParameter %_ptr_Function_tmp_struct
%139 = OpLabel
%x_112 = OpVariable %_ptr_Function_bool Function %27
%x_16 = OpVariable %_ptr_Function_int Function %30
%one = OpVariable %_ptr_Function_int Function %30
%zero = OpVariable %_ptr_Function_int Function %30
%x_27 = OpVariable %_ptr_Function_int Function %30
%x_114_phi = OpVariable %_ptr_Function_bool Function %27
%x_28_phi = OpVariable %_ptr_Function_int Function %30
%x_15_phi = OpVariable %_ptr_Function_int Function %30
%x_27_phi = OpVariable %_ptr_Function_int Function %30
%x_128_phi = OpVariable %_ptr_Function_bool Function %27
OpStore %x_112 %false
OpStore %x_114_phi %false
OpBranch %147
%147 = OpLabel
OpLoopMerge %148 %149 None
OpBranch %150
%150 = OpLabel
%154 = OpLoad %bool %x_114_phi
OpStore %one %int_1
OpStore %x_15_phi %int_1
OpBranch %155
%155 = OpLabel
OpLoopMerge %156 %157 None
OpBranch %158
%158 = OpLabel
%159 = OpLoad %int %x_15_phi
OpStore %x_27_phi %int_0
OpStore %x_128_phi %154
%160 = OpSGreaterThan %bool %159 %int_10
OpSelectionMerge %161 None
OpBranchConditional %160 %162 %163
%162 = OpLabel
OpBranch %161
%163 = OpLabel
OpBranch %156
%161 = OpLabel
%164 = OpISub %int %159 %int_1
OpStore %zero %164
%166 = OpAccessChain %_ptr_Function_int %obj %uint_0 %164
%167 = OpLoad %int %166
%168 = OpIEqual %bool %167 %int_1
OpSelectionMerge %169 None
OpBranchConditional %168 %170 %169
%170 = OpLabel
OpStore %x_112 %true
OpStore %x_16 %int_1
OpStore %x_27_phi %int_1
OpStore %x_128_phi %true
OpBranch %156
%169 = OpLabel
OpStore %one %164
OpBranch %157
%157 = OpLabel
OpStore %x_15_phi %164
OpBranch %155
%156 = OpLabel
%171 = OpLoad %int %x_27_phi
OpStore %x_27 %171
%172 = OpLoad %bool %x_128_phi
%173 = OpLoad %int %x_27
OpStore %x_28_phi %173
OpSelectionMerge %174 None
OpBranchConditional %172 %175 %174
%175 = OpLabel
OpBranch %148
%174 = OpLabel
OpStore %x_112 %true
OpStore %x_16 %int_n1
OpStore %x_28_phi %int_n1
OpBranch %148
%149 = OpLabel
OpStore %x_114_phi %false
OpBranch %147
%148 = OpLabel
%176 = OpLoad %int %x_28_phi
OpReturnValue %176
OpFunctionEnd

View File

@ -0,0 +1,172 @@
struct tmp_struct {
nmb : array<i32, 1>;
};
[[block]]
struct buf0 {
injectionSwitch : vec2<f32>;
};
[[group(0), binding(0)]] var<uniform> x_11 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn main_1() {
var x_24 : array<i32, 1>;
var x_68 : bool = false;
var x_17 : i32;
var x_18 : i32;
var x_19 : i32;
var x_20 : i32;
var x_69 : bool = false;
var tmp_float : f32;
var color : vec3<f32>;
loop {
var x_25 : i32;
var x_101 : vec3<f32>;
var x_79_phi : bool;
var x_26_phi : i32;
let x_75 : f32 = x_11.injectionSwitch.y;
tmp_float = x_75;
let x_76 : vec3<f32> = vec3<f32>(x_75, x_75, x_75);
color = x_76;
x_24 = tmp_struct(array<i32, 1>(0)).nmb;
x_68 = false;
x_79_phi = false;
loop {
var x_21_phi : i32;
var x_25_phi : i32;
var x_93_phi : bool;
let x_79 : bool = x_79_phi;
x_18 = 1;
x_21_phi = 1;
loop {
let x_21 : i32 = x_21_phi;
x_25_phi = 0;
x_93_phi = x_79;
if ((x_21 > 10)) {
} else {
break;
}
let x_22 : i32 = (x_21 - 1);
x_19 = x_22;
let x_23 : i32 = x_24[x_22];
if ((x_23 == 1)) {
x_68 = true;
x_17 = 1;
x_25_phi = 1;
x_93_phi = true;
break;
}
x_18 = x_22;
continuing {
x_21_phi = x_22;
}
}
x_25 = x_25_phi;
let x_93 : bool = x_93_phi;
x_26_phi = x_25;
if (x_93) {
break;
}
x_68 = true;
x_17 = -1;
x_26_phi = -1;
break;
continuing {
x_79_phi = false;
}
}
let x_26 : i32 = x_26_phi;
x_20 = x_26;
if ((x_26 == -1)) {
discard;
} else {
x_GLF_color = vec4<f32>(0.0, 0.0, 0.0, 0.0);
let x_100 : vec2<f32> = (vec2<f32>(x_76.y, x_76.z) + vec2<f32>(1.0, 1.0));
x_101 = vec3<f32>(x_76.x, x_100.x, x_100.y);
color = x_101;
let x_103 : f32 = x_11.injectionSwitch.x;
if ((x_103 > 1.0)) {
x_69 = true;
break;
}
}
x_GLF_color = vec4<f32>(x_101.x, x_101.y, x_101.z, 1.0);
x_69 = true;
break;
}
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);
}
fn binarySearch_struct_tmp_struct_i1_1_1_(obj : ptr<function, tmp_struct>) -> i32 {
var x_112 : bool = false;
var x_16 : i32;
var one : i32;
var zero : i32;
var x_27 : i32;
var x_114_phi : bool;
var x_28_phi : i32;
x_114_phi = false;
loop {
var x_15_phi : i32;
var x_27_phi : i32;
var x_128_phi : bool;
let x_114 : bool = x_114_phi;
one = 1;
x_15_phi = 1;
loop {
let x_15 : i32 = x_15_phi;
x_27_phi = 0;
x_128_phi = x_114;
if ((x_15 > 10)) {
} else {
break;
}
let x_13 : i32 = (x_15 - 1);
zero = x_13;
let x_14 : i32 = (*(obj)).nmb[x_13];
if ((x_14 == 1)) {
x_112 = true;
x_16 = 1;
x_27_phi = 1;
x_128_phi = true;
break;
}
one = x_13;
continuing {
x_15_phi = x_13;
}
}
x_27 = x_27_phi;
let x_128 : bool = x_128_phi;
x_28_phi = x_27;
if (x_128) {
break;
}
x_112 = true;
x_16 = -1;
x_28_phi = -1;
break;
continuing {
x_114_phi = false;
}
}
let x_28 : i32 = x_28_phi;
return x_28;
}

View File

@ -0,0 +1,315 @@
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 %swap_i1_i1_ "swap(i1;i1;"
OpName %i "i"
OpName %j "j"
OpName %performPartition_i1_i1_ "performPartition(i1;i1;"
OpName %l "l"
OpName %h "h"
OpName %quicksort_ "quicksort("
OpName %temp "temp"
OpName %QuicksortObject "QuicksortObject"
OpMemberName %QuicksortObject 0 "numbers"
OpName %obj "obj"
OpName %pivot "pivot"
OpName %i_0 "i"
OpName %j_0 "j"
OpName %param "param"
OpName %param_0 "param"
OpName %param_1 "param"
OpName %param_2 "param"
OpName %l_0 "l"
OpName %h_0 "h"
OpName %top "top"
OpName %stack "stack"
OpName %p "p"
OpName %param_3 "param"
OpName %param_4 "param"
OpName %i_1 "i"
OpName %_GLF_color "_GLF_color"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "resolution"
OpName %_ ""
OpDecorate %_GLF_color Location 0
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %buf0 Block
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
%void = OpTypeVoid
%32 = OpTypeFunction %void
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%35 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int
%36 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int
%uint = OpTypeInt 32 0
%uint_10 = OpConstant %uint 10
%_arr_int_uint_10 = OpTypeArray %int %uint_10
%QuicksortObject = OpTypeStruct %_arr_int_uint_10
%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject
%obj = OpVariable %_ptr_Private_QuicksortObject Private
%int_0 = OpConstant %int 0
%_ptr_Private_int = OpTypePointer Private %int
%int_1 = OpConstant %int 1
%bool = OpTypeBool
%int_9 = OpConstant %int 9
%int_n1 = OpConstant %int -1
%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10
%int_10 = OpConstant %int 10
%int_4 = OpConstant %int 4
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_GLF_color = OpVariable %_ptr_Output_v4float Output
%float_1 = OpConstant %float 1
%float_0 = OpConstant %float 0
%55 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%56 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1
%v2float = OpTypeVector %float 2
%buf0 = OpTypeStruct %v2float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%_ = OpVariable %_ptr_Uniform_buf0 Uniform
%main = OpFunction %void None %32
%59 = OpLabel
%i_1 = OpVariable %_ptr_Function_int Function
OpStore %i_1 %int_0
OpBranch %60
%60 = OpLabel
OpLoopMerge %61 %62 None
OpBranch %63
%63 = OpLabel
%64 = OpLoad %int %i_1
%65 = OpSLessThan %bool %64 %int_10
OpBranchConditional %65 %66 %61
%66 = OpLabel
%67 = OpLoad %int %i_1
%68 = OpLoad %int %i_1
%69 = OpISub %int %int_10 %68
%70 = OpAccessChain %_ptr_Private_int %obj %int_0 %67
OpStore %70 %69
%71 = OpLoad %int %i_1
%72 = OpLoad %int %i_1
%73 = OpAccessChain %_ptr_Private_int %obj %int_0 %72
%74 = OpLoad %int %73
%75 = OpLoad %int %i_1
%76 = OpAccessChain %_ptr_Private_int %obj %int_0 %75
%77 = OpLoad %int %76
%78 = OpIMul %int %74 %77
%79 = OpAccessChain %_ptr_Private_int %obj %int_0 %71
OpStore %79 %78
OpBranch %62
%62 = OpLabel
%80 = OpLoad %int %i_1
%81 = OpIAdd %int %80 %int_1
OpStore %i_1 %81
OpBranch %60
%61 = OpLabel
%82 = OpFunctionCall %void %quicksort_
%83 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_0
%84 = OpLoad %int %83
%85 = OpAccessChain %_ptr_Private_int %obj %int_0 %int_4
%86 = OpLoad %int %85
%87 = OpSLessThan %bool %84 %86
OpSelectionMerge %88 None
OpBranchConditional %87 %89 %90
%89 = OpLabel
OpStore %_GLF_color %55
OpBranch %88
%90 = OpLabel
OpStore %_GLF_color %56
OpBranch %88
%88 = OpLabel
OpReturn
OpFunctionEnd
%swap_i1_i1_ = OpFunction %void None %35
%i = OpFunctionParameter %_ptr_Function_int
%j = OpFunctionParameter %_ptr_Function_int
%91 = OpLabel
%temp = OpVariable %_ptr_Function_int Function
%92 = OpLoad %int %i
%93 = OpAccessChain %_ptr_Private_int %obj %int_0 %92
%94 = OpLoad %int %93
OpStore %temp %94
%95 = OpLoad %int %i
%96 = OpLoad %int %j
%97 = OpAccessChain %_ptr_Private_int %obj %int_0 %96
%98 = OpLoad %int %97
%99 = OpAccessChain %_ptr_Private_int %obj %int_0 %95
OpStore %99 %98
%100 = OpLoad %int %j
%101 = OpLoad %int %temp
%102 = OpAccessChain %_ptr_Private_int %obj %int_0 %100
OpStore %102 %101
OpReturn
OpFunctionEnd
%performPartition_i1_i1_ = OpFunction %int None %36
%l = OpFunctionParameter %_ptr_Function_int
%h = OpFunctionParameter %_ptr_Function_int
%103 = OpLabel
%pivot = OpVariable %_ptr_Function_int Function
%i_0 = OpVariable %_ptr_Function_int Function
%j_0 = OpVariable %_ptr_Function_int Function
%param = OpVariable %_ptr_Function_int Function
%param_0 = OpVariable %_ptr_Function_int Function
%param_1 = OpVariable %_ptr_Function_int Function
%param_2 = OpVariable %_ptr_Function_int Function
%104 = OpLoad %int %h
%105 = OpAccessChain %_ptr_Private_int %obj %int_0 %104
%106 = OpLoad %int %105
OpStore %pivot %106
%107 = OpLoad %int %l
%108 = OpISub %int %107 %int_1
OpStore %i_0 %108
%109 = OpLoad %int %l
OpStore %j_0 %109
OpBranch %110
%110 = OpLabel
OpLoopMerge %111 %112 None
OpBranch %113
%113 = OpLabel
%114 = OpLoad %int %j_0
%115 = OpLoad %int %h
%116 = OpISub %int %115 %int_1
%117 = OpSLessThanEqual %bool %114 %116
OpBranchConditional %117 %118 %111
%118 = OpLabel
%119 = OpLoad %int %j_0
%120 = OpAccessChain %_ptr_Private_int %obj %int_0 %119
%121 = OpLoad %int %120
%122 = OpLoad %int %pivot
%123 = OpSLessThanEqual %bool %121 %122
OpSelectionMerge %124 None
OpBranchConditional %123 %125 %124
%125 = OpLabel
%126 = OpLoad %int %i_0
%127 = OpIAdd %int %126 %int_1
OpStore %i_0 %127
%128 = OpLoad %int %i_0
OpStore %param %128
%129 = OpLoad %int %j_0
OpStore %param_0 %129
%130 = OpFunctionCall %void %swap_i1_i1_ %param %param_0
OpBranch %124
%124 = OpLabel
OpBranch %112
%112 = OpLabel
%131 = OpLoad %int %j_0
%132 = OpIAdd %int %131 %int_1
OpStore %j_0 %132
OpBranch %110
%111 = OpLabel
%133 = OpLoad %int %i_0
%134 = OpIAdd %int %133 %int_1
OpStore %param_1 %134
%135 = OpLoad %int %h
OpStore %param_2 %135
%136 = OpFunctionCall %void %swap_i1_i1_ %param_1 %param_2
%137 = OpLoad %int %i_0
%138 = OpIAdd %int %137 %int_1
OpReturnValue %138
OpFunctionEnd
%quicksort_ = OpFunction %void None %32
%139 = OpLabel
%l_0 = OpVariable %_ptr_Function_int Function
%h_0 = OpVariable %_ptr_Function_int Function
%top = OpVariable %_ptr_Function_int Function
%stack = OpVariable %_ptr_Function__arr_int_uint_10 Function
%p = OpVariable %_ptr_Function_int Function
%param_3 = OpVariable %_ptr_Function_int Function
%param_4 = OpVariable %_ptr_Function_int Function
OpStore %l_0 %int_0
OpStore %h_0 %int_9
OpStore %top %int_n1
%140 = OpLoad %int %top
%141 = OpIAdd %int %140 %int_1
OpStore %top %141
%142 = OpLoad %int %l_0
%143 = OpAccessChain %_ptr_Function_int %stack %141
OpStore %143 %142
%144 = OpLoad %int %top
%145 = OpIAdd %int %144 %int_1
OpStore %top %145
%146 = OpLoad %int %h_0
%147 = OpAccessChain %_ptr_Function_int %stack %145
OpStore %147 %146
OpBranch %148
%148 = OpLabel
OpLoopMerge %149 %150 None
OpBranch %151
%151 = OpLabel
%152 = OpLoad %int %top
%153 = OpSGreaterThanEqual %bool %152 %int_0
OpBranchConditional %153 %154 %149
%154 = OpLabel
%155 = OpLoad %int %top
%156 = OpISub %int %155 %int_1
OpStore %top %156
%157 = OpAccessChain %_ptr_Function_int %stack %155
%158 = OpLoad %int %157
OpStore %h_0 %158
%159 = OpLoad %int %top
%160 = OpISub %int %159 %int_1
OpStore %top %160
%161 = OpAccessChain %_ptr_Function_int %stack %159
%162 = OpLoad %int %161
OpStore %l_0 %162
%163 = OpLoad %int %l_0
OpStore %param_3 %163
%164 = OpLoad %int %h_0
OpStore %param_4 %164
%165 = OpFunctionCall %int %performPartition_i1_i1_ %param_3 %param_4
OpStore %p %165
%166 = OpLoad %int %p
%167 = OpISub %int %166 %int_1
%168 = OpLoad %int %l_0
%169 = OpSGreaterThan %bool %167 %168
OpSelectionMerge %170 None
OpBranchConditional %169 %171 %170
%171 = OpLabel
%172 = OpLoad %int %top
%173 = OpIAdd %int %172 %int_1
OpStore %top %173
%174 = OpLoad %int %l_0
%175 = OpAccessChain %_ptr_Function_int %stack %173
OpStore %175 %174
%176 = OpLoad %int %top
%177 = OpIAdd %int %176 %int_1
OpStore %top %177
%178 = OpLoad %int %p
%179 = OpISub %int %178 %int_1
%180 = OpAccessChain %_ptr_Function_int %stack %177
OpStore %180 %179
OpBranch %170
%170 = OpLabel
%181 = OpLoad %int %p
%182 = OpIAdd %int %181 %int_1
%183 = OpLoad %int %h_0
%184 = OpSLessThan %bool %182 %183
OpSelectionMerge %185 None
OpBranchConditional %184 %186 %185
%186 = OpLabel
%187 = OpLoad %int %top
%188 = OpIAdd %int %187 %int_1
OpStore %top %188
%189 = OpLoad %int %p
%190 = OpIAdd %int %189 %int_1
%191 = OpAccessChain %_ptr_Function_int %stack %188
OpStore %191 %190
%192 = OpLoad %int %top
%193 = OpIAdd %int %192 %int_1
OpStore %top %193
%194 = OpLoad %int %h_0
%195 = OpAccessChain %_ptr_Function_int %stack %193
OpStore %195 %194
OpBranch %185
%185 = OpLabel
OpBranch %150
%150 = OpLabel
OpBranch %148
%149 = OpLabel
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,154 @@
struct QuicksortObject {
int numbers[10];
};
static QuicksortObject obj = (QuicksortObject)0;
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_30 : register(b0, space0) {
uint4 x_30[1];
};
void swap_i1_i1_(inout int i, inout int j) {
int temp = 0;
const int x_92 = i;
const int x_94 = obj.numbers[x_92];
temp = x_94;
const int x_95 = i;
const int x_96 = j;
const int x_98 = obj.numbers[x_96];
obj.numbers[x_95] = x_98;
const int x_100 = j;
obj.numbers[x_100] = temp;
return;
}
int performPartition_i1_i1_(inout int l, inout int h) {
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
const int x_104 = h;
const int x_106 = obj.numbers[x_104];
pivot = x_106;
const int x_107 = l;
i_1 = (x_107 - 1);
const int x_109 = l;
j_1 = x_109;
while (true) {
const int x_114 = j_1;
const int x_115 = h;
if ((x_114 <= (x_115 - 1))) {
} else {
break;
}
const int x_121 = obj.numbers[j_1];
if ((x_121 <= pivot)) {
i_1 = (i_1 + 1);
param = i_1;
param_1 = j_1;
swap_i1_i1_(param, param_1);
}
{
j_1 = (j_1 + 1);
}
}
param_2 = (i_1 + 1);
const int x_135 = h;
param_3 = x_135;
swap_i1_i1_(param_2, param_3);
return (i_1 + 1);
}
void quicksort_() {
int l_1 = 0;
int h_1 = 0;
int top = 0;
int stack[10] = (int[10])0;
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
const int x_141 = (top + 1);
top = x_141;
stack[x_141] = l_1;
const int x_145 = (top + 1);
top = x_145;
stack[x_145] = h_1;
while (true) {
if ((top >= 0)) {
} else {
break;
}
const int x_155 = top;
top = (x_155 - 1);
const int x_158 = stack[x_155];
h_1 = x_158;
const int x_159 = top;
top = (x_159 - 1);
const int x_162 = stack[x_159];
l_1 = x_162;
param_4 = l_1;
param_5 = h_1;
const int x_165 = performPartition_i1_i1_(param_4, param_5);
p = x_165;
if (((p - 1) > l_1)) {
const int x_173 = (top + 1);
top = x_173;
stack[x_173] = l_1;
const int x_177 = (top + 1);
top = x_177;
stack[x_177] = (p - 1);
}
if (((p + 1) < h_1)) {
const int x_188 = (top + 1);
top = x_188;
stack[x_188] = (p + 1);
const int x_193 = (top + 1);
top = x_193;
stack[x_193] = h_1;
}
}
return;
}
void main_1() {
int i_2 = 0;
i_2 = 0;
{
for(; (i_2 < 10); i_2 = (i_2 + 1)) {
obj.numbers[i_2] = (10 - i_2);
const int x_71 = i_2;
const int x_74 = obj.numbers[i_2];
const int x_77 = obj.numbers[i_2];
obj.numbers[x_71] = (x_74 * x_77);
}
}
quicksort_();
const int x_84 = obj.numbers[0];
const int x_86 = obj.numbers[4];
if ((x_84 < x_86)) {
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
x_GLF_color = float4(0.0f, 1.0f, 0.0f, 1.0f);
}
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_2 = {tint_symbol_1.x_GLF_color_1};
return tint_symbol_2;
}

View File

@ -0,0 +1,198 @@
#include <metal_stdlib>
using namespace metal;
struct tint_array_wrapper {
int arr[10];
};
struct QuicksortObject {
tint_array_wrapper numbers;
};
struct buf0 {
/* 0x0000 */ packed_float2 resolution;
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_4) {
int temp = 0;
int const x_92 = *(i);
int const x_94 = (*(tint_symbol_4)).numbers.arr[x_92];
temp = x_94;
int const x_95 = *(i);
int const x_96 = *(j);
int const x_98 = (*(tint_symbol_4)).numbers.arr[x_96];
(*(tint_symbol_4)).numbers.arr[x_95] = x_98;
int const x_100 = *(j);
int const x_101 = temp;
(*(tint_symbol_4)).numbers.arr[x_100] = x_101;
return;
}
int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_5) {
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
int const x_104 = *(h);
int const x_106 = (*(tint_symbol_5)).numbers.arr[x_104];
pivot = x_106;
int const x_107 = *(l);
i_1 = (x_107 - 1);
int const x_109 = *(l);
j_1 = x_109;
while (true) {
int const x_114 = j_1;
int const x_115 = *(h);
if ((x_114 <= (x_115 - 1))) {
} else {
break;
}
int const x_119 = j_1;
int const x_121 = (*(tint_symbol_5)).numbers.arr[x_119];
int const x_122 = pivot;
if ((x_121 <= x_122)) {
int const x_126 = i_1;
i_1 = (x_126 + 1);
int const x_128 = i_1;
param = x_128;
int const x_129 = j_1;
param_1 = x_129;
swap_i1_i1_(&(param), &(param_1), tint_symbol_5);
}
{
int const x_131 = j_1;
j_1 = (x_131 + 1);
}
}
int const x_133 = i_1;
param_2 = (x_133 + 1);
int const x_135 = *(h);
param_3 = x_135;
swap_i1_i1_(&(param_2), &(param_3), tint_symbol_5);
int const x_137 = i_1;
return (x_137 + 1);
}
void quicksort_(thread QuicksortObject* const tint_symbol_6) {
int l_1 = 0;
int h_1 = 0;
int top = 0;
tint_array_wrapper stack = {};
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
int const x_140 = top;
int const x_141 = (x_140 + 1);
top = x_141;
int const x_142 = l_1;
stack.arr[x_141] = x_142;
int const x_144 = top;
int const x_145 = (x_144 + 1);
top = x_145;
int const x_146 = h_1;
stack.arr[x_145] = x_146;
while (true) {
int const x_152 = top;
if ((x_152 >= 0)) {
} else {
break;
}
int const x_155 = top;
top = (x_155 - 1);
int const x_158 = stack.arr[x_155];
h_1 = x_158;
int const x_159 = top;
top = (x_159 - 1);
int const x_162 = stack.arr[x_159];
l_1 = x_162;
int const x_163 = l_1;
param_4 = x_163;
int const x_164 = h_1;
param_5 = x_164;
int const x_165 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_6);
p = x_165;
int const x_166 = p;
int const x_168 = l_1;
if (((x_166 - 1) > x_168)) {
int const x_172 = top;
int const x_173 = (x_172 + 1);
top = x_173;
int const x_174 = l_1;
stack.arr[x_173] = x_174;
int const x_176 = top;
int const x_177 = (x_176 + 1);
top = x_177;
int const x_178 = p;
stack.arr[x_177] = (x_178 - 1);
}
int const x_181 = p;
int const x_183 = h_1;
if (((x_181 + 1) < x_183)) {
int const x_187 = top;
int const x_188 = (x_187 + 1);
top = x_188;
int const x_189 = p;
stack.arr[x_188] = (x_189 + 1);
int const x_192 = top;
int const x_193 = (x_192 + 1);
top = x_193;
int const x_194 = h_1;
stack.arr[x_193] = x_194;
}
}
return;
}
void main_1(thread QuicksortObject* const tint_symbol_7, thread float4* const tint_symbol_8) {
int i_2 = 0;
i_2 = 0;
while (true) {
int const x_64 = i_2;
if ((x_64 < 10)) {
} else {
break;
}
int const x_67 = i_2;
int const x_68 = i_2;
(*(tint_symbol_7)).numbers.arr[x_67] = (10 - x_68);
int const x_71 = i_2;
int const x_72 = i_2;
int const x_74 = (*(tint_symbol_7)).numbers.arr[x_72];
int const x_75 = i_2;
int const x_77 = (*(tint_symbol_7)).numbers.arr[x_75];
(*(tint_symbol_7)).numbers.arr[x_71] = (x_74 * x_77);
{
int const x_80 = i_2;
i_2 = (x_80 + 1);
}
}
quicksort_(tint_symbol_7);
int const x_84 = (*(tint_symbol_7)).numbers.arr[0];
int const x_86 = (*(tint_symbol_7)).numbers.arr[4];
if ((x_84 < x_86)) {
*(tint_symbol_8) = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
*(tint_symbol_8) = float4(0.0f, 1.0f, 0.0f, 1.0f);
}
return;
}
fragment tint_symbol_1 tint_symbol() {
thread QuicksortObject tint_symbol_9 = {};
thread float4 tint_symbol_10 = 0.0f;
main_1(&(tint_symbol_9), &(tint_symbol_10));
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_10};
tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
return tint_symbol_3;
}

View File

@ -0,0 +1,367 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 235
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %QuicksortObject "QuicksortObject"
OpMemberName %QuicksortObject 0 "numbers"
OpName %obj "obj"
OpName %x_GLF_color "x_GLF_color"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "resolution"
OpName %x_30 "x_30"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %swap_i1_i1_ "swap_i1_i1_"
OpName %i "i"
OpName %j "j"
OpName %temp "temp"
OpName %performPartition_i1_i1_ "performPartition_i1_i1_"
OpName %l "l"
OpName %h "h"
OpName %pivot "pivot"
OpName %i_1 "i_1"
OpName %j_1 "j_1"
OpName %param "param"
OpName %param_1 "param_1"
OpName %param_2 "param_2"
OpName %param_3 "param_3"
OpName %quicksort_ "quicksort_"
OpName %l_1 "l_1"
OpName %h_1 "h_1"
OpName %top "top"
OpName %stack "stack"
OpName %p "p"
OpName %param_4 "param_4"
OpName %param_5 "param_5"
OpName %main_1 "main_1"
OpName %i_2 "i_2"
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"
OpMemberDecorate %QuicksortObject 0 Offset 0
OpDecorate %_arr_int_uint_10 ArrayStride 4
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %x_30 NonWritable
OpDecorate %x_30 DescriptorSet 0
OpDecorate %x_30 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpMemberDecorate %main_out 0 Offset 0
%int = OpTypeInt 32 1
%uint = OpTypeInt 32 0
%uint_10 = OpConstant %uint 10
%_arr_int_uint_10 = OpTypeArray %int %uint_10
%QuicksortObject = OpTypeStruct %_arr_int_uint_10
%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject
%8 = OpConstantNull %QuicksortObject
%obj = OpVariable %_ptr_Private_QuicksortObject Private %8
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%13 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %13
%v2float = OpTypeVector %float 2
%buf0 = OpTypeStruct %v2float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_30 = OpVariable %_ptr_Uniform_buf0 Uniform
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %13
%void = OpTypeVoid
%_ptr_Function_int = OpTypePointer Function %int
%20 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int
%28 = OpConstantNull %int
%uint_0 = OpConstant %uint 0
%_ptr_Private_int = OpTypePointer Private %int
%46 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int
%int_1 = OpConstant %int 1
%bool = OpTypeBool
%106 = OpTypeFunction %void
%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10
%114 = OpConstantNull %_arr_int_uint_10
%int_0 = OpConstant %int 0
%int_9 = OpConstant %int 9
%int_n1 = OpConstant %int -1
%int_10 = OpConstant %int 10
%int_4 = OpConstant %int 4
%float_1 = OpConstant %float 1
%float_0 = OpConstant %float 0
%221 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%222 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1
%main_out = OpTypeStruct %v4float
%223 = OpTypeFunction %void %main_out
%swap_i1_i1_ = OpFunction %void None %20
%i = OpFunctionParameter %_ptr_Function_int
%j = OpFunctionParameter %_ptr_Function_int
%26 = OpLabel
%temp = OpVariable %_ptr_Function_int Function %28
%30 = OpLoad %int %i
%33 = OpAccessChain %_ptr_Private_int %obj %uint_0 %30
%34 = OpLoad %int %33
OpStore %temp %34
%36 = OpLoad %int %i
%38 = OpLoad %int %j
%39 = OpAccessChain %_ptr_Private_int %obj %uint_0 %38
%40 = OpLoad %int %39
%41 = OpAccessChain %_ptr_Private_int %obj %uint_0 %36
OpStore %41 %40
%43 = OpLoad %int %j
%44 = OpLoad %int %temp
%45 = OpAccessChain %_ptr_Private_int %obj %uint_0 %43
OpStore %45 %44
OpReturn
OpFunctionEnd
%performPartition_i1_i1_ = OpFunction %int None %46
%l = OpFunctionParameter %_ptr_Function_int
%h = OpFunctionParameter %_ptr_Function_int
%50 = OpLabel
%pivot = OpVariable %_ptr_Function_int Function %28
%i_1 = OpVariable %_ptr_Function_int Function %28
%j_1 = OpVariable %_ptr_Function_int Function %28
%param = OpVariable %_ptr_Function_int Function %28
%param_1 = OpVariable %_ptr_Function_int Function %28
%param_2 = OpVariable %_ptr_Function_int Function %28
%param_3 = OpVariable %_ptr_Function_int Function %28
%59 = OpLoad %int %h
%60 = OpAccessChain %_ptr_Private_int %obj %uint_0 %59
%61 = OpLoad %int %60
OpStore %pivot %61
%63 = OpLoad %int %l
%65 = OpISub %int %63 %int_1
OpStore %i_1 %65
%67 = OpLoad %int %l
OpStore %j_1 %67
OpBranch %68
%68 = OpLabel
OpLoopMerge %69 %70 None
OpBranch %71
%71 = OpLabel
%72 = OpLoad %int %j_1
%74 = OpLoad %int %h
%75 = OpISub %int %74 %int_1
%76 = OpSLessThanEqual %bool %72 %75
OpSelectionMerge %78 None
OpBranchConditional %76 %79 %80
%79 = OpLabel
OpBranch %78
%80 = OpLabel
OpBranch %69
%78 = OpLabel
%81 = OpLoad %int %j_1
%82 = OpAccessChain %_ptr_Private_int %obj %uint_0 %81
%83 = OpLoad %int %82
%84 = OpLoad %int %pivot
%85 = OpSLessThanEqual %bool %83 %84
OpSelectionMerge %86 None
OpBranchConditional %85 %87 %86
%87 = OpLabel
%88 = OpLoad %int %i_1
%89 = OpIAdd %int %88 %int_1
OpStore %i_1 %89
%90 = OpLoad %int %i_1
OpStore %param %90
%91 = OpLoad %int %j_1
OpStore %param_1 %91
%92 = OpFunctionCall %void %swap_i1_i1_ %param %param_1
OpBranch %86
%86 = OpLabel
OpBranch %70
%70 = OpLabel
%95 = OpLoad %int %j_1
%96 = OpIAdd %int %95 %int_1
OpStore %j_1 %96
OpBranch %68
%69 = OpLabel
%97 = OpLoad %int %i_1
%98 = OpIAdd %int %97 %int_1
OpStore %param_2 %98
%100 = OpLoad %int %h
OpStore %param_3 %100
%101 = OpFunctionCall %void %swap_i1_i1_ %param_2 %param_3
%104 = OpLoad %int %i_1
%105 = OpIAdd %int %104 %int_1
OpReturnValue %105
OpFunctionEnd
%quicksort_ = OpFunction %void None %106
%108 = OpLabel
%l_1 = OpVariable %_ptr_Function_int Function %28
%h_1 = OpVariable %_ptr_Function_int Function %28
%top = OpVariable %_ptr_Function_int Function %28
%stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %114
%p = OpVariable %_ptr_Function_int Function %28
%param_4 = OpVariable %_ptr_Function_int Function %28
%param_5 = OpVariable %_ptr_Function_int Function %28
OpStore %l_1 %int_0
OpStore %h_1 %int_9
OpStore %top %int_n1
%121 = OpLoad %int %top
%122 = OpIAdd %int %121 %int_1
OpStore %top %122
%123 = OpLoad %int %l_1
%124 = OpAccessChain %_ptr_Function_int %stack %122
OpStore %124 %123
%125 = OpLoad %int %top
%126 = OpIAdd %int %125 %int_1
OpStore %top %126
%127 = OpLoad %int %h_1
%128 = OpAccessChain %_ptr_Function_int %stack %126
OpStore %128 %127
OpBranch %129
%129 = OpLabel
OpLoopMerge %130 %131 None
OpBranch %132
%132 = OpLabel
%133 = OpLoad %int %top
%134 = OpSGreaterThanEqual %bool %133 %int_0
OpSelectionMerge %135 None
OpBranchConditional %134 %136 %137
%136 = OpLabel
OpBranch %135
%137 = OpLabel
OpBranch %130
%135 = OpLabel
%138 = OpLoad %int %top
%139 = OpISub %int %138 %int_1
OpStore %top %139
%140 = OpAccessChain %_ptr_Function_int %stack %138
%141 = OpLoad %int %140
OpStore %h_1 %141
%142 = OpLoad %int %top
%143 = OpISub %int %142 %int_1
OpStore %top %143
%144 = OpAccessChain %_ptr_Function_int %stack %142
%145 = OpLoad %int %144
OpStore %l_1 %145
%146 = OpLoad %int %l_1
OpStore %param_4 %146
%147 = OpLoad %int %h_1
OpStore %param_5 %147
%148 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5
OpStore %p %148
%151 = OpLoad %int %p
%152 = OpLoad %int %l_1
%153 = OpISub %int %151 %int_1
%154 = OpSGreaterThan %bool %153 %152
OpSelectionMerge %155 None
OpBranchConditional %154 %156 %155
%156 = OpLabel
%157 = OpLoad %int %top
%158 = OpIAdd %int %157 %int_1
OpStore %top %158
%159 = OpLoad %int %l_1
%160 = OpAccessChain %_ptr_Function_int %stack %158
OpStore %160 %159
%161 = OpLoad %int %top
%162 = OpIAdd %int %161 %int_1
OpStore %top %162
%163 = OpLoad %int %p
%164 = OpAccessChain %_ptr_Function_int %stack %162
%165 = OpISub %int %163 %int_1
OpStore %164 %165
OpBranch %155
%155 = OpLabel
%166 = OpLoad %int %p
%167 = OpLoad %int %h_1
%168 = OpIAdd %int %166 %int_1
%169 = OpSLessThan %bool %168 %167
OpSelectionMerge %170 None
OpBranchConditional %169 %171 %170
%171 = OpLabel
%172 = OpLoad %int %top
%173 = OpIAdd %int %172 %int_1
OpStore %top %173
%174 = OpLoad %int %p
%175 = OpAccessChain %_ptr_Function_int %stack %173
%176 = OpIAdd %int %174 %int_1
OpStore %175 %176
%177 = OpLoad %int %top
%178 = OpIAdd %int %177 %int_1
OpStore %top %178
%179 = OpLoad %int %h_1
%180 = OpAccessChain %_ptr_Function_int %stack %178
OpStore %180 %179
OpBranch %170
%170 = OpLabel
OpBranch %131
%131 = OpLabel
OpBranch %129
%130 = OpLabel
OpReturn
OpFunctionEnd
%main_1 = OpFunction %void None %106
%182 = OpLabel
%i_2 = OpVariable %_ptr_Function_int Function %28
OpStore %i_2 %int_0
OpBranch %184
%184 = OpLabel
OpLoopMerge %185 %186 None
OpBranch %187
%187 = OpLabel
%188 = OpLoad %int %i_2
%190 = OpSLessThan %bool %188 %int_10
OpSelectionMerge %191 None
OpBranchConditional %190 %192 %193
%192 = OpLabel
OpBranch %191
%193 = OpLabel
OpBranch %185
%191 = OpLabel
%194 = OpLoad %int %i_2
%195 = OpLoad %int %i_2
%196 = OpAccessChain %_ptr_Private_int %obj %uint_0 %194
%197 = OpISub %int %int_10 %195
OpStore %196 %197
%198 = OpLoad %int %i_2
%199 = OpLoad %int %i_2
%200 = OpAccessChain %_ptr_Private_int %obj %uint_0 %199
%201 = OpLoad %int %200
%202 = OpLoad %int %i_2
%203 = OpAccessChain %_ptr_Private_int %obj %uint_0 %202
%204 = OpLoad %int %203
%205 = OpAccessChain %_ptr_Private_int %obj %uint_0 %198
%206 = OpIMul %int %201 %204
OpStore %205 %206
OpBranch %186
%186 = OpLabel
%207 = OpLoad %int %i_2
%208 = OpIAdd %int %207 %int_1
OpStore %i_2 %208
OpBranch %184
%185 = OpLabel
%209 = OpFunctionCall %void %quicksort_
%210 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_0
%211 = OpLoad %int %210
%213 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4
%214 = OpLoad %int %213
%215 = OpSLessThan %bool %211 %214
OpSelectionMerge %216 None
OpBranchConditional %215 %217 %218
%217 = OpLabel
OpStore %x_GLF_color %221
OpBranch %216
%218 = OpLabel
OpStore %x_GLF_color %222
OpBranch %216
%216 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %223
%tint_symbol = OpFunctionParameter %main_out
%227 = OpLabel
%228 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %228
OpReturn
OpFunctionEnd
%main = OpFunction %void None %106
%230 = OpLabel
%231 = OpFunctionCall %void %main_1
%233 = OpLoad %v4float %x_GLF_color
%234 = OpCompositeConstruct %main_out %233
%232 = OpFunctionCall %void %tint_symbol_2 %234
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,197 @@
struct QuicksortObject {
numbers : array<i32, 10>;
};
[[block]]
struct buf0 {
resolution : vec2<f32>;
};
var<private> obj : QuicksortObject;
var<private> x_GLF_color : vec4<f32>;
[[group(0), binding(0)]] var<uniform> x_30 : buf0;
fn swap_i1_i1_(i : ptr<function, i32>, j : ptr<function, i32>) {
var temp : i32;
let x_92 : i32 = *(i);
let x_94 : i32 = obj.numbers[x_92];
temp = x_94;
let x_95 : i32 = *(i);
let x_96 : i32 = *(j);
let x_98 : i32 = obj.numbers[x_96];
obj.numbers[x_95] = x_98;
let x_100 : i32 = *(j);
let x_101 : i32 = temp;
obj.numbers[x_100] = x_101;
return;
}
fn performPartition_i1_i1_(l : ptr<function, i32>, h : ptr<function, i32>) -> i32 {
var pivot : i32;
var i_1 : i32;
var j_1 : i32;
var param : i32;
var param_1 : i32;
var param_2 : i32;
var param_3 : i32;
let x_104 : i32 = *(h);
let x_106 : i32 = obj.numbers[x_104];
pivot = x_106;
let x_107 : i32 = *(l);
i_1 = (x_107 - 1);
let x_109 : i32 = *(l);
j_1 = x_109;
loop {
let x_114 : i32 = j_1;
let x_115 : i32 = *(h);
if ((x_114 <= (x_115 - 1))) {
} else {
break;
}
let x_119 : i32 = j_1;
let x_121 : i32 = obj.numbers[x_119];
let x_122 : i32 = pivot;
if ((x_121 <= x_122)) {
let x_126 : i32 = i_1;
i_1 = (x_126 + 1);
let x_128 : i32 = i_1;
param = x_128;
let x_129 : i32 = j_1;
param_1 = x_129;
swap_i1_i1_(&(param), &(param_1));
}
continuing {
let x_131 : i32 = j_1;
j_1 = (x_131 + 1);
}
}
let x_133 : i32 = i_1;
param_2 = (x_133 + 1);
let x_135 : i32 = *(h);
param_3 = x_135;
swap_i1_i1_(&(param_2), &(param_3));
let x_137 : i32 = i_1;
return (x_137 + 1);
}
fn quicksort_() {
var l_1 : i32;
var h_1 : i32;
var top : i32;
var stack : array<i32, 10>;
var p : i32;
var param_4 : i32;
var param_5 : i32;
l_1 = 0;
h_1 = 9;
top = -1;
let x_140 : i32 = top;
let x_141 : i32 = (x_140 + 1);
top = x_141;
let x_142 : i32 = l_1;
stack[x_141] = x_142;
let x_144 : i32 = top;
let x_145 : i32 = (x_144 + 1);
top = x_145;
let x_146 : i32 = h_1;
stack[x_145] = x_146;
loop {
let x_152 : i32 = top;
if ((x_152 >= 0)) {
} else {
break;
}
let x_155 : i32 = top;
top = (x_155 - 1);
let x_158 : i32 = stack[x_155];
h_1 = x_158;
let x_159 : i32 = top;
top = (x_159 - 1);
let x_162 : i32 = stack[x_159];
l_1 = x_162;
let x_163 : i32 = l_1;
param_4 = x_163;
let x_164 : i32 = h_1;
param_5 = x_164;
let x_165 : i32 = performPartition_i1_i1_(&(param_4), &(param_5));
p = x_165;
let x_166 : i32 = p;
let x_168 : i32 = l_1;
if (((x_166 - 1) > x_168)) {
let x_172 : i32 = top;
let x_173 : i32 = (x_172 + 1);
top = x_173;
let x_174 : i32 = l_1;
stack[x_173] = x_174;
let x_176 : i32 = top;
let x_177 : i32 = (x_176 + 1);
top = x_177;
let x_178 : i32 = p;
stack[x_177] = (x_178 - 1);
}
let x_181 : i32 = p;
let x_183 : i32 = h_1;
if (((x_181 + 1) < x_183)) {
let x_187 : i32 = top;
let x_188 : i32 = (x_187 + 1);
top = x_188;
let x_189 : i32 = p;
stack[x_188] = (x_189 + 1);
let x_192 : i32 = top;
let x_193 : i32 = (x_192 + 1);
top = x_193;
let x_194 : i32 = h_1;
stack[x_193] = x_194;
}
}
return;
}
fn main_1() {
var i_2 : i32;
i_2 = 0;
loop {
let x_64 : i32 = i_2;
if ((x_64 < 10)) {
} else {
break;
}
let x_67 : i32 = i_2;
let x_68 : i32 = i_2;
obj.numbers[x_67] = (10 - x_68);
let x_71 : i32 = i_2;
let x_72 : i32 = i_2;
let x_74 : i32 = obj.numbers[x_72];
let x_75 : i32 = i_2;
let x_77 : i32 = obj.numbers[x_75];
obj.numbers[x_71] = (x_74 * x_77);
continuing {
let x_80 : i32 = i_2;
i_2 = (x_80 + 1);
}
}
quicksort_();
let x_84 : i32 = obj.numbers[0];
let x_86 : i32 = obj.numbers[4];
if ((x_84 < x_86)) {
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
} else {
x_GLF_color = vec4<f32>(0.0, 1.0, 0.0, 1.0);
}
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);
}

View File

@ -0,0 +1,197 @@
struct QuicksortObject {
numbers : array<i32, 10>;
};
[[block]]
struct buf0 {
resolution : vec2<f32>;
};
var<private> obj : QuicksortObject;
var<private> x_GLF_color : vec4<f32>;
[[group(0), binding(0)]] var<uniform> x_30 : buf0;
fn swap_i1_i1_(i : ptr<function, i32>, j : ptr<function, i32>) {
var temp : i32;
let x_92 : i32 = *(i);
let x_94 : i32 = obj.numbers[x_92];
temp = x_94;
let x_95 : i32 = *(i);
let x_96 : i32 = *(j);
let x_98 : i32 = obj.numbers[x_96];
obj.numbers[x_95] = x_98;
let x_100 : i32 = *(j);
let x_101 : i32 = temp;
obj.numbers[x_100] = x_101;
return;
}
fn performPartition_i1_i1_(l : ptr<function, i32>, h : ptr<function, i32>) -> i32 {
var pivot : i32;
var i_1 : i32;
var j_1 : i32;
var param : i32;
var param_1 : i32;
var param_2 : i32;
var param_3 : i32;
let x_104 : i32 = *(h);
let x_106 : i32 = obj.numbers[x_104];
pivot = x_106;
let x_107 : i32 = *(l);
i_1 = (x_107 - 1);
let x_109 : i32 = *(l);
j_1 = x_109;
loop {
let x_114 : i32 = j_1;
let x_115 : i32 = *(h);
if ((x_114 <= (x_115 - 1))) {
} else {
break;
}
let x_119 : i32 = j_1;
let x_121 : i32 = obj.numbers[x_119];
let x_122 : i32 = pivot;
if ((x_121 <= x_122)) {
let x_126 : i32 = i_1;
i_1 = (x_126 + 1);
let x_128 : i32 = i_1;
param = x_128;
let x_129 : i32 = j_1;
param_1 = x_129;
swap_i1_i1_(&(param), &(param_1));
}
continuing {
let x_131 : i32 = j_1;
j_1 = (x_131 + 1);
}
}
let x_133 : i32 = i_1;
param_2 = (x_133 + 1);
let x_135 : i32 = *(h);
param_3 = x_135;
swap_i1_i1_(&(param_2), &(param_3));
let x_137 : i32 = i_1;
return (x_137 + 1);
}
fn quicksort_() {
var l_1 : i32;
var h_1 : i32;
var top : i32;
var stack : array<i32, 10>;
var p : i32;
var param_4 : i32;
var param_5 : i32;
l_1 = 0;
h_1 = 9;
top = -1;
let x_140 : i32 = top;
let x_141 : i32 = (x_140 + 1);
top = x_141;
let x_142 : i32 = l_1;
stack[x_141] = x_142;
let x_144 : i32 = top;
let x_145 : i32 = (x_144 + 1);
top = x_145;
let x_146 : i32 = h_1;
stack[x_145] = x_146;
loop {
let x_152 : i32 = top;
if ((x_152 >= 0)) {
} else {
break;
}
let x_155 : i32 = top;
top = (x_155 - 1);
let x_158 : i32 = stack[x_155];
h_1 = x_158;
let x_159 : i32 = top;
top = (x_159 - 1);
let x_162 : i32 = stack[x_159];
l_1 = x_162;
let x_163 : i32 = l_1;
param_4 = x_163;
let x_164 : i32 = h_1;
param_5 = x_164;
let x_165 : i32 = performPartition_i1_i1_(&(param_4), &(param_5));
p = x_165;
let x_166 : i32 = p;
let x_168 : i32 = l_1;
if (((x_166 - 1) > x_168)) {
let x_172 : i32 = top;
let x_173 : i32 = (x_172 + 1);
top = x_173;
let x_174 : i32 = l_1;
stack[x_173] = x_174;
let x_176 : i32 = top;
let x_177 : i32 = (x_176 + 1);
top = x_177;
let x_178 : i32 = p;
stack[x_177] = (x_178 - 1);
}
let x_181 : i32 = p;
let x_183 : i32 = h_1;
if (((x_181 + 1) < x_183)) {
let x_187 : i32 = top;
let x_188 : i32 = (x_187 + 1);
top = x_188;
let x_189 : i32 = p;
stack[x_188] = (x_189 + 1);
let x_192 : i32 = top;
let x_193 : i32 = (x_192 + 1);
top = x_193;
let x_194 : i32 = h_1;
stack[x_193] = x_194;
}
}
return;
}
fn main_1() {
var i_2 : i32;
i_2 = 0;
loop {
let x_64 : i32 = i_2;
if ((x_64 < 10)) {
} else {
break;
}
let x_67 : i32 = i_2;
let x_68 : i32 = i_2;
obj.numbers[x_67] = (10 - x_68);
let x_71 : i32 = i_2;
let x_72 : i32 = i_2;
let x_74 : i32 = obj.numbers[x_72];
let x_75 : i32 = i_2;
let x_77 : i32 = obj.numbers[x_75];
obj.numbers[x_71] = (x_74 * x_77);
continuing {
let x_80 : i32 = i_2;
i_2 = (x_80 + 1);
}
}
quicksort_();
let x_84 : i32 = obj.numbers[0];
let x_86 : i32 = obj.numbers[4];
if ((x_84 < x_86)) {
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
} else {
x_GLF_color = vec4<f32>(0.0, 1.0, 0.0, 1.0);
}
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);
}

View File

@ -0,0 +1,154 @@
struct QuicksortObject {
int numbers[10];
};
static QuicksortObject obj = (QuicksortObject)0;
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_30 : register(b0, space0) {
uint4 x_30[1];
};
void swap_i1_i1_(inout int i, inout int j) {
int temp = 0;
const int x_92 = i;
const int x_94 = obj.numbers[x_92];
temp = x_94;
const int x_95 = i;
const int x_96 = j;
const int x_98 = obj.numbers[x_96];
obj.numbers[x_95] = x_98;
const int x_100 = j;
obj.numbers[x_100] = temp;
return;
}
int performPartition_i1_i1_(inout int l, inout int h) {
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
const int x_104 = h;
const int x_106 = obj.numbers[x_104];
pivot = x_106;
const int x_107 = l;
i_1 = (x_107 - 1);
const int x_109 = l;
j_1 = x_109;
while (true) {
const int x_114 = j_1;
const int x_115 = h;
if ((x_114 <= (x_115 - 1))) {
} else {
break;
}
const int x_121 = obj.numbers[j_1];
if ((x_121 <= pivot)) {
i_1 = (i_1 + 1);
param = i_1;
param_1 = j_1;
swap_i1_i1_(param, param_1);
}
{
j_1 = (j_1 + 1);
}
}
param_2 = (i_1 + 1);
const int x_135 = h;
param_3 = x_135;
swap_i1_i1_(param_2, param_3);
return (i_1 + 1);
}
void quicksort_() {
int l_1 = 0;
int h_1 = 0;
int top = 0;
int stack[10] = (int[10])0;
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
const int x_141 = (top + 1);
top = x_141;
stack[x_141] = l_1;
const int x_145 = (top + 1);
top = x_145;
stack[x_145] = h_1;
while (true) {
if ((top >= 0)) {
} else {
break;
}
const int x_155 = top;
top = (x_155 - 1);
const int x_158 = stack[x_155];
h_1 = x_158;
const int x_159 = top;
top = (x_159 - 1);
const int x_162 = stack[x_159];
l_1 = x_162;
param_4 = l_1;
param_5 = h_1;
const int x_165 = performPartition_i1_i1_(param_4, param_5);
p = x_165;
if (((p - 1) > l_1)) {
const int x_173 = (top + 1);
top = x_173;
stack[x_173] = l_1;
const int x_177 = (top + 1);
top = x_177;
stack[x_177] = (p - 1);
}
if (((p + 1) < h_1)) {
const int x_188 = (top + 1);
top = x_188;
stack[x_188] = (p + 1);
const int x_193 = (top + 1);
top = x_193;
stack[x_193] = h_1;
}
}
return;
}
void main_1() {
int i_2 = 0;
i_2 = 0;
{
for(; (i_2 < 10); i_2 = (i_2 + 1)) {
obj.numbers[i_2] = (10 - i_2);
const int x_71 = i_2;
const int x_74 = obj.numbers[i_2];
const int x_77 = obj.numbers[i_2];
obj.numbers[x_71] = (x_74 * x_77);
}
}
quicksort_();
const int x_84 = obj.numbers[0];
const int x_86 = obj.numbers[4];
if ((x_84 < x_86)) {
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
x_GLF_color = float4(0.0f, 1.0f, 0.0f, 1.0f);
}
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_2 = {tint_symbol_1.x_GLF_color_1};
return tint_symbol_2;
}

View File

@ -0,0 +1,198 @@
#include <metal_stdlib>
using namespace metal;
struct tint_array_wrapper {
int arr[10];
};
struct QuicksortObject {
tint_array_wrapper numbers;
};
struct buf0 {
/* 0x0000 */ packed_float2 resolution;
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_1 {
float4 x_GLF_color_1 [[color(0)]];
};
void swap_i1_i1_(thread int* const i, thread int* const j, thread QuicksortObject* const tint_symbol_4) {
int temp = 0;
int const x_92 = *(i);
int const x_94 = (*(tint_symbol_4)).numbers.arr[x_92];
temp = x_94;
int const x_95 = *(i);
int const x_96 = *(j);
int const x_98 = (*(tint_symbol_4)).numbers.arr[x_96];
(*(tint_symbol_4)).numbers.arr[x_95] = x_98;
int const x_100 = *(j);
int const x_101 = temp;
(*(tint_symbol_4)).numbers.arr[x_100] = x_101;
return;
}
int performPartition_i1_i1_(thread int* const l, thread int* const h, thread QuicksortObject* const tint_symbol_5) {
int pivot = 0;
int i_1 = 0;
int j_1 = 0;
int param = 0;
int param_1 = 0;
int param_2 = 0;
int param_3 = 0;
int const x_104 = *(h);
int const x_106 = (*(tint_symbol_5)).numbers.arr[x_104];
pivot = x_106;
int const x_107 = *(l);
i_1 = (x_107 - 1);
int const x_109 = *(l);
j_1 = x_109;
while (true) {
int const x_114 = j_1;
int const x_115 = *(h);
if ((x_114 <= (x_115 - 1))) {
} else {
break;
}
int const x_119 = j_1;
int const x_121 = (*(tint_symbol_5)).numbers.arr[x_119];
int const x_122 = pivot;
if ((x_121 <= x_122)) {
int const x_126 = i_1;
i_1 = (x_126 + 1);
int const x_128 = i_1;
param = x_128;
int const x_129 = j_1;
param_1 = x_129;
swap_i1_i1_(&(param), &(param_1), tint_symbol_5);
}
{
int const x_131 = j_1;
j_1 = (x_131 + 1);
}
}
int const x_133 = i_1;
param_2 = (x_133 + 1);
int const x_135 = *(h);
param_3 = x_135;
swap_i1_i1_(&(param_2), &(param_3), tint_symbol_5);
int const x_137 = i_1;
return (x_137 + 1);
}
void quicksort_(thread QuicksortObject* const tint_symbol_6) {
int l_1 = 0;
int h_1 = 0;
int top = 0;
tint_array_wrapper stack = {};
int p = 0;
int param_4 = 0;
int param_5 = 0;
l_1 = 0;
h_1 = 9;
top = -1;
int const x_140 = top;
int const x_141 = (x_140 + 1);
top = x_141;
int const x_142 = l_1;
stack.arr[x_141] = x_142;
int const x_144 = top;
int const x_145 = (x_144 + 1);
top = x_145;
int const x_146 = h_1;
stack.arr[x_145] = x_146;
while (true) {
int const x_152 = top;
if ((x_152 >= 0)) {
} else {
break;
}
int const x_155 = top;
top = (x_155 - 1);
int const x_158 = stack.arr[x_155];
h_1 = x_158;
int const x_159 = top;
top = (x_159 - 1);
int const x_162 = stack.arr[x_159];
l_1 = x_162;
int const x_163 = l_1;
param_4 = x_163;
int const x_164 = h_1;
param_5 = x_164;
int const x_165 = performPartition_i1_i1_(&(param_4), &(param_5), tint_symbol_6);
p = x_165;
int const x_166 = p;
int const x_168 = l_1;
if (((x_166 - 1) > x_168)) {
int const x_172 = top;
int const x_173 = (x_172 + 1);
top = x_173;
int const x_174 = l_1;
stack.arr[x_173] = x_174;
int const x_176 = top;
int const x_177 = (x_176 + 1);
top = x_177;
int const x_178 = p;
stack.arr[x_177] = (x_178 - 1);
}
int const x_181 = p;
int const x_183 = h_1;
if (((x_181 + 1) < x_183)) {
int const x_187 = top;
int const x_188 = (x_187 + 1);
top = x_188;
int const x_189 = p;
stack.arr[x_188] = (x_189 + 1);
int const x_192 = top;
int const x_193 = (x_192 + 1);
top = x_193;
int const x_194 = h_1;
stack.arr[x_193] = x_194;
}
}
return;
}
void main_1(thread QuicksortObject* const tint_symbol_7, thread float4* const tint_symbol_8) {
int i_2 = 0;
i_2 = 0;
while (true) {
int const x_64 = i_2;
if ((x_64 < 10)) {
} else {
break;
}
int const x_67 = i_2;
int const x_68 = i_2;
(*(tint_symbol_7)).numbers.arr[x_67] = (10 - x_68);
int const x_71 = i_2;
int const x_72 = i_2;
int const x_74 = (*(tint_symbol_7)).numbers.arr[x_72];
int const x_75 = i_2;
int const x_77 = (*(tint_symbol_7)).numbers.arr[x_75];
(*(tint_symbol_7)).numbers.arr[x_71] = (x_74 * x_77);
{
int const x_80 = i_2;
i_2 = (x_80 + 1);
}
}
quicksort_(tint_symbol_7);
int const x_84 = (*(tint_symbol_7)).numbers.arr[0];
int const x_86 = (*(tint_symbol_7)).numbers.arr[4];
if ((x_84 < x_86)) {
*(tint_symbol_8) = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
*(tint_symbol_8) = float4(0.0f, 1.0f, 0.0f, 1.0f);
}
return;
}
fragment tint_symbol_1 tint_symbol() {
thread QuicksortObject tint_symbol_9 = {};
thread float4 tint_symbol_10 = 0.0f;
main_1(&(tint_symbol_9), &(tint_symbol_10));
main_out const tint_symbol_2 = {.x_GLF_color_1=tint_symbol_10};
tint_symbol_1 const tint_symbol_3 = {.x_GLF_color_1=tint_symbol_2.x_GLF_color_1};
return tint_symbol_3;
}

View File

@ -0,0 +1,367 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 235
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol_1
OpExecutionMode %main OriginUpperLeft
OpName %QuicksortObject "QuicksortObject"
OpMemberName %QuicksortObject 0 "numbers"
OpName %obj "obj"
OpName %x_GLF_color "x_GLF_color"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "resolution"
OpName %x_30 "x_30"
OpName %tint_symbol_1 "tint_symbol_1"
OpName %swap_i1_i1_ "swap_i1_i1_"
OpName %i "i"
OpName %j "j"
OpName %temp "temp"
OpName %performPartition_i1_i1_ "performPartition_i1_i1_"
OpName %l "l"
OpName %h "h"
OpName %pivot "pivot"
OpName %i_1 "i_1"
OpName %j_1 "j_1"
OpName %param "param"
OpName %param_1 "param_1"
OpName %param_2 "param_2"
OpName %param_3 "param_3"
OpName %quicksort_ "quicksort_"
OpName %l_1 "l_1"
OpName %h_1 "h_1"
OpName %top "top"
OpName %stack "stack"
OpName %p "p"
OpName %param_4 "param_4"
OpName %param_5 "param_5"
OpName %main_1 "main_1"
OpName %i_2 "i_2"
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"
OpMemberDecorate %QuicksortObject 0 Offset 0
OpDecorate %_arr_int_uint_10 ArrayStride 4
OpDecorate %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %x_30 NonWritable
OpDecorate %x_30 DescriptorSet 0
OpDecorate %x_30 Binding 0
OpDecorate %tint_symbol_1 Location 0
OpMemberDecorate %main_out 0 Offset 0
%int = OpTypeInt 32 1
%uint = OpTypeInt 32 0
%uint_10 = OpConstant %uint 10
%_arr_int_uint_10 = OpTypeArray %int %uint_10
%QuicksortObject = OpTypeStruct %_arr_int_uint_10
%_ptr_Private_QuicksortObject = OpTypePointer Private %QuicksortObject
%8 = OpConstantNull %QuicksortObject
%obj = OpVariable %_ptr_Private_QuicksortObject Private %8
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Private_v4float = OpTypePointer Private %v4float
%13 = OpConstantNull %v4float
%x_GLF_color = OpVariable %_ptr_Private_v4float Private %13
%v2float = OpTypeVector %float 2
%buf0 = OpTypeStruct %v2float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_30 = OpVariable %_ptr_Uniform_buf0 Uniform
%_ptr_Output_v4float = OpTypePointer Output %v4float
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %13
%void = OpTypeVoid
%_ptr_Function_int = OpTypePointer Function %int
%20 = OpTypeFunction %void %_ptr_Function_int %_ptr_Function_int
%28 = OpConstantNull %int
%uint_0 = OpConstant %uint 0
%_ptr_Private_int = OpTypePointer Private %int
%46 = OpTypeFunction %int %_ptr_Function_int %_ptr_Function_int
%int_1 = OpConstant %int 1
%bool = OpTypeBool
%106 = OpTypeFunction %void
%_ptr_Function__arr_int_uint_10 = OpTypePointer Function %_arr_int_uint_10
%114 = OpConstantNull %_arr_int_uint_10
%int_0 = OpConstant %int 0
%int_9 = OpConstant %int 9
%int_n1 = OpConstant %int -1
%int_10 = OpConstant %int 10
%int_4 = OpConstant %int 4
%float_1 = OpConstant %float 1
%float_0 = OpConstant %float 0
%221 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%222 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1
%main_out = OpTypeStruct %v4float
%223 = OpTypeFunction %void %main_out
%swap_i1_i1_ = OpFunction %void None %20
%i = OpFunctionParameter %_ptr_Function_int
%j = OpFunctionParameter %_ptr_Function_int
%26 = OpLabel
%temp = OpVariable %_ptr_Function_int Function %28
%30 = OpLoad %int %i
%33 = OpAccessChain %_ptr_Private_int %obj %uint_0 %30
%34 = OpLoad %int %33
OpStore %temp %34
%36 = OpLoad %int %i
%38 = OpLoad %int %j
%39 = OpAccessChain %_ptr_Private_int %obj %uint_0 %38
%40 = OpLoad %int %39
%41 = OpAccessChain %_ptr_Private_int %obj %uint_0 %36
OpStore %41 %40
%43 = OpLoad %int %j
%44 = OpLoad %int %temp
%45 = OpAccessChain %_ptr_Private_int %obj %uint_0 %43
OpStore %45 %44
OpReturn
OpFunctionEnd
%performPartition_i1_i1_ = OpFunction %int None %46
%l = OpFunctionParameter %_ptr_Function_int
%h = OpFunctionParameter %_ptr_Function_int
%50 = OpLabel
%pivot = OpVariable %_ptr_Function_int Function %28
%i_1 = OpVariable %_ptr_Function_int Function %28
%j_1 = OpVariable %_ptr_Function_int Function %28
%param = OpVariable %_ptr_Function_int Function %28
%param_1 = OpVariable %_ptr_Function_int Function %28
%param_2 = OpVariable %_ptr_Function_int Function %28
%param_3 = OpVariable %_ptr_Function_int Function %28
%59 = OpLoad %int %h
%60 = OpAccessChain %_ptr_Private_int %obj %uint_0 %59
%61 = OpLoad %int %60
OpStore %pivot %61
%63 = OpLoad %int %l
%65 = OpISub %int %63 %int_1
OpStore %i_1 %65
%67 = OpLoad %int %l
OpStore %j_1 %67
OpBranch %68
%68 = OpLabel
OpLoopMerge %69 %70 None
OpBranch %71
%71 = OpLabel
%72 = OpLoad %int %j_1
%74 = OpLoad %int %h
%75 = OpISub %int %74 %int_1
%76 = OpSLessThanEqual %bool %72 %75
OpSelectionMerge %78 None
OpBranchConditional %76 %79 %80
%79 = OpLabel
OpBranch %78
%80 = OpLabel
OpBranch %69
%78 = OpLabel
%81 = OpLoad %int %j_1
%82 = OpAccessChain %_ptr_Private_int %obj %uint_0 %81
%83 = OpLoad %int %82
%84 = OpLoad %int %pivot
%85 = OpSLessThanEqual %bool %83 %84
OpSelectionMerge %86 None
OpBranchConditional %85 %87 %86
%87 = OpLabel
%88 = OpLoad %int %i_1
%89 = OpIAdd %int %88 %int_1
OpStore %i_1 %89
%90 = OpLoad %int %i_1
OpStore %param %90
%91 = OpLoad %int %j_1
OpStore %param_1 %91
%92 = OpFunctionCall %void %swap_i1_i1_ %param %param_1
OpBranch %86
%86 = OpLabel
OpBranch %70
%70 = OpLabel
%95 = OpLoad %int %j_1
%96 = OpIAdd %int %95 %int_1
OpStore %j_1 %96
OpBranch %68
%69 = OpLabel
%97 = OpLoad %int %i_1
%98 = OpIAdd %int %97 %int_1
OpStore %param_2 %98
%100 = OpLoad %int %h
OpStore %param_3 %100
%101 = OpFunctionCall %void %swap_i1_i1_ %param_2 %param_3
%104 = OpLoad %int %i_1
%105 = OpIAdd %int %104 %int_1
OpReturnValue %105
OpFunctionEnd
%quicksort_ = OpFunction %void None %106
%108 = OpLabel
%l_1 = OpVariable %_ptr_Function_int Function %28
%h_1 = OpVariable %_ptr_Function_int Function %28
%top = OpVariable %_ptr_Function_int Function %28
%stack = OpVariable %_ptr_Function__arr_int_uint_10 Function %114
%p = OpVariable %_ptr_Function_int Function %28
%param_4 = OpVariable %_ptr_Function_int Function %28
%param_5 = OpVariable %_ptr_Function_int Function %28
OpStore %l_1 %int_0
OpStore %h_1 %int_9
OpStore %top %int_n1
%121 = OpLoad %int %top
%122 = OpIAdd %int %121 %int_1
OpStore %top %122
%123 = OpLoad %int %l_1
%124 = OpAccessChain %_ptr_Function_int %stack %122
OpStore %124 %123
%125 = OpLoad %int %top
%126 = OpIAdd %int %125 %int_1
OpStore %top %126
%127 = OpLoad %int %h_1
%128 = OpAccessChain %_ptr_Function_int %stack %126
OpStore %128 %127
OpBranch %129
%129 = OpLabel
OpLoopMerge %130 %131 None
OpBranch %132
%132 = OpLabel
%133 = OpLoad %int %top
%134 = OpSGreaterThanEqual %bool %133 %int_0
OpSelectionMerge %135 None
OpBranchConditional %134 %136 %137
%136 = OpLabel
OpBranch %135
%137 = OpLabel
OpBranch %130
%135 = OpLabel
%138 = OpLoad %int %top
%139 = OpISub %int %138 %int_1
OpStore %top %139
%140 = OpAccessChain %_ptr_Function_int %stack %138
%141 = OpLoad %int %140
OpStore %h_1 %141
%142 = OpLoad %int %top
%143 = OpISub %int %142 %int_1
OpStore %top %143
%144 = OpAccessChain %_ptr_Function_int %stack %142
%145 = OpLoad %int %144
OpStore %l_1 %145
%146 = OpLoad %int %l_1
OpStore %param_4 %146
%147 = OpLoad %int %h_1
OpStore %param_5 %147
%148 = OpFunctionCall %int %performPartition_i1_i1_ %param_4 %param_5
OpStore %p %148
%151 = OpLoad %int %p
%152 = OpLoad %int %l_1
%153 = OpISub %int %151 %int_1
%154 = OpSGreaterThan %bool %153 %152
OpSelectionMerge %155 None
OpBranchConditional %154 %156 %155
%156 = OpLabel
%157 = OpLoad %int %top
%158 = OpIAdd %int %157 %int_1
OpStore %top %158
%159 = OpLoad %int %l_1
%160 = OpAccessChain %_ptr_Function_int %stack %158
OpStore %160 %159
%161 = OpLoad %int %top
%162 = OpIAdd %int %161 %int_1
OpStore %top %162
%163 = OpLoad %int %p
%164 = OpAccessChain %_ptr_Function_int %stack %162
%165 = OpISub %int %163 %int_1
OpStore %164 %165
OpBranch %155
%155 = OpLabel
%166 = OpLoad %int %p
%167 = OpLoad %int %h_1
%168 = OpIAdd %int %166 %int_1
%169 = OpSLessThan %bool %168 %167
OpSelectionMerge %170 None
OpBranchConditional %169 %171 %170
%171 = OpLabel
%172 = OpLoad %int %top
%173 = OpIAdd %int %172 %int_1
OpStore %top %173
%174 = OpLoad %int %p
%175 = OpAccessChain %_ptr_Function_int %stack %173
%176 = OpIAdd %int %174 %int_1
OpStore %175 %176
%177 = OpLoad %int %top
%178 = OpIAdd %int %177 %int_1
OpStore %top %178
%179 = OpLoad %int %h_1
%180 = OpAccessChain %_ptr_Function_int %stack %178
OpStore %180 %179
OpBranch %170
%170 = OpLabel
OpBranch %131
%131 = OpLabel
OpBranch %129
%130 = OpLabel
OpReturn
OpFunctionEnd
%main_1 = OpFunction %void None %106
%182 = OpLabel
%i_2 = OpVariable %_ptr_Function_int Function %28
OpStore %i_2 %int_0
OpBranch %184
%184 = OpLabel
OpLoopMerge %185 %186 None
OpBranch %187
%187 = OpLabel
%188 = OpLoad %int %i_2
%190 = OpSLessThan %bool %188 %int_10
OpSelectionMerge %191 None
OpBranchConditional %190 %192 %193
%192 = OpLabel
OpBranch %191
%193 = OpLabel
OpBranch %185
%191 = OpLabel
%194 = OpLoad %int %i_2
%195 = OpLoad %int %i_2
%196 = OpAccessChain %_ptr_Private_int %obj %uint_0 %194
%197 = OpISub %int %int_10 %195
OpStore %196 %197
%198 = OpLoad %int %i_2
%199 = OpLoad %int %i_2
%200 = OpAccessChain %_ptr_Private_int %obj %uint_0 %199
%201 = OpLoad %int %200
%202 = OpLoad %int %i_2
%203 = OpAccessChain %_ptr_Private_int %obj %uint_0 %202
%204 = OpLoad %int %203
%205 = OpAccessChain %_ptr_Private_int %obj %uint_0 %198
%206 = OpIMul %int %201 %204
OpStore %205 %206
OpBranch %186
%186 = OpLabel
%207 = OpLoad %int %i_2
%208 = OpIAdd %int %207 %int_1
OpStore %i_2 %208
OpBranch %184
%185 = OpLabel
%209 = OpFunctionCall %void %quicksort_
%210 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_0
%211 = OpLoad %int %210
%213 = OpAccessChain %_ptr_Private_int %obj %uint_0 %int_4
%214 = OpLoad %int %213
%215 = OpSLessThan %bool %211 %214
OpSelectionMerge %216 None
OpBranchConditional %215 %217 %218
%217 = OpLabel
OpStore %x_GLF_color %221
OpBranch %216
%218 = OpLabel
OpStore %x_GLF_color %222
OpBranch %216
%216 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %223
%tint_symbol = OpFunctionParameter %main_out
%227 = OpLabel
%228 = OpCompositeExtract %v4float %tint_symbol 0
OpStore %tint_symbol_1 %228
OpReturn
OpFunctionEnd
%main = OpFunction %void None %106
%230 = OpLabel
%231 = OpFunctionCall %void %main_1
%233 = OpLoad %v4float %x_GLF_color
%234 = OpCompositeConstruct %main_out %233
%232 = OpFunctionCall %void %tint_symbol_2 %234
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,197 @@
struct QuicksortObject {
numbers : array<i32, 10>;
};
[[block]]
struct buf0 {
resolution : vec2<f32>;
};
var<private> obj : QuicksortObject;
var<private> x_GLF_color : vec4<f32>;
[[group(0), binding(0)]] var<uniform> x_30 : buf0;
fn swap_i1_i1_(i : ptr<function, i32>, j : ptr<function, i32>) {
var temp : i32;
let x_92 : i32 = *(i);
let x_94 : i32 = obj.numbers[x_92];
temp = x_94;
let x_95 : i32 = *(i);
let x_96 : i32 = *(j);
let x_98 : i32 = obj.numbers[x_96];
obj.numbers[x_95] = x_98;
let x_100 : i32 = *(j);
let x_101 : i32 = temp;
obj.numbers[x_100] = x_101;
return;
}
fn performPartition_i1_i1_(l : ptr<function, i32>, h : ptr<function, i32>) -> i32 {
var pivot : i32;
var i_1 : i32;
var j_1 : i32;
var param : i32;
var param_1 : i32;
var param_2 : i32;
var param_3 : i32;
let x_104 : i32 = *(h);
let x_106 : i32 = obj.numbers[x_104];
pivot = x_106;
let x_107 : i32 = *(l);
i_1 = (x_107 - 1);
let x_109 : i32 = *(l);
j_1 = x_109;
loop {
let x_114 : i32 = j_1;
let x_115 : i32 = *(h);
if ((x_114 <= (x_115 - 1))) {
} else {
break;
}
let x_119 : i32 = j_1;
let x_121 : i32 = obj.numbers[x_119];
let x_122 : i32 = pivot;
if ((x_121 <= x_122)) {
let x_126 : i32 = i_1;
i_1 = (x_126 + 1);
let x_128 : i32 = i_1;
param = x_128;
let x_129 : i32 = j_1;
param_1 = x_129;
swap_i1_i1_(&(param), &(param_1));
}
continuing {
let x_131 : i32 = j_1;
j_1 = (x_131 + 1);
}
}
let x_133 : i32 = i_1;
param_2 = (x_133 + 1);
let x_135 : i32 = *(h);
param_3 = x_135;
swap_i1_i1_(&(param_2), &(param_3));
let x_137 : i32 = i_1;
return (x_137 + 1);
}
fn quicksort_() {
var l_1 : i32;
var h_1 : i32;
var top : i32;
var stack : array<i32, 10>;
var p : i32;
var param_4 : i32;
var param_5 : i32;
l_1 = 0;
h_1 = 9;
top = -1;
let x_140 : i32 = top;
let x_141 : i32 = (x_140 + 1);
top = x_141;
let x_142 : i32 = l_1;
stack[x_141] = x_142;
let x_144 : i32 = top;
let x_145 : i32 = (x_144 + 1);
top = x_145;
let x_146 : i32 = h_1;
stack[x_145] = x_146;
loop {
let x_152 : i32 = top;
if ((x_152 >= 0)) {
} else {
break;
}
let x_155 : i32 = top;
top = (x_155 - 1);
let x_158 : i32 = stack[x_155];
h_1 = x_158;
let x_159 : i32 = top;
top = (x_159 - 1);
let x_162 : i32 = stack[x_159];
l_1 = x_162;
let x_163 : i32 = l_1;
param_4 = x_163;
let x_164 : i32 = h_1;
param_5 = x_164;
let x_165 : i32 = performPartition_i1_i1_(&(param_4), &(param_5));
p = x_165;
let x_166 : i32 = p;
let x_168 : i32 = l_1;
if (((x_166 - 1) > x_168)) {
let x_172 : i32 = top;
let x_173 : i32 = (x_172 + 1);
top = x_173;
let x_174 : i32 = l_1;
stack[x_173] = x_174;
let x_176 : i32 = top;
let x_177 : i32 = (x_176 + 1);
top = x_177;
let x_178 : i32 = p;
stack[x_177] = (x_178 - 1);
}
let x_181 : i32 = p;
let x_183 : i32 = h_1;
if (((x_181 + 1) < x_183)) {
let x_187 : i32 = top;
let x_188 : i32 = (x_187 + 1);
top = x_188;
let x_189 : i32 = p;
stack[x_188] = (x_189 + 1);
let x_192 : i32 = top;
let x_193 : i32 = (x_192 + 1);
top = x_193;
let x_194 : i32 = h_1;
stack[x_193] = x_194;
}
}
return;
}
fn main_1() {
var i_2 : i32;
i_2 = 0;
loop {
let x_64 : i32 = i_2;
if ((x_64 < 10)) {
} else {
break;
}
let x_67 : i32 = i_2;
let x_68 : i32 = i_2;
obj.numbers[x_67] = (10 - x_68);
let x_71 : i32 = i_2;
let x_72 : i32 = i_2;
let x_74 : i32 = obj.numbers[x_72];
let x_75 : i32 = i_2;
let x_77 : i32 = obj.numbers[x_75];
obj.numbers[x_71] = (x_74 * x_77);
continuing {
let x_80 : i32 = i_2;
i_2 = (x_80 + 1);
}
}
quicksort_();
let x_84 : i32 = obj.numbers[0];
let x_86 : i32 = obj.numbers[4];
if ((x_84 < x_86)) {
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
} else {
x_GLF_color = vec4<f32>(0.0, 1.0, 0.0, 1.0);
}
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);
}

View File

@ -0,0 +1,188 @@
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 %func_ "func("
OpName %gl_FragCoord "gl_FragCoord"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "injectionSwitch"
OpName %_ ""
OpName %x "x"
OpName %i "i"
OpName %j "j"
OpName %data "data"
OpName %_GLF_color "_GLF_color"
OpDecorate %gl_FragCoord BuiltIn FragCoord
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %buf0 Block
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
OpDecorate %_GLF_color Location 0
%void = OpTypeVoid
%13 = OpTypeFunction %void
%float = OpTypeFloat 32
%15 = OpTypeFunction %float
%v4float = OpTypeVector %float 4
%_ptr_Input_v4float = OpTypePointer Input %v4float
%gl_FragCoord = OpVariable %_ptr_Input_v4float Input
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_Input_float = OpTypePointer Input %float
%float_1 = OpConstant %float 1
%bool = OpTypeBool
%float_5 = OpConstant %float 5
%v2float = OpTypeVector %float 2
%buf0 = OpTypeStruct %v2float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%_ = OpVariable %_ptr_Uniform_buf0 Uniform
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%_ptr_Uniform_float = OpTypePointer Uniform %float
%uint_1 = OpConstant %uint 1
%_ptr_Function_int = OpTypePointer Function %int
%float_0 = OpConstant %float 0
%int_3 = OpConstant %int 3
%int_4 = OpConstant %int 4
%uint_17 = OpConstant %uint 17
%_arr_v2float_uint_17 = OpTypeArray %v2float %uint_17
%_ptr_Function__arr_v2float_uint_17 = OpTypePointer Function %_arr_v2float_uint_17
%_ptr_Function_float = OpTypePointer Function %float
%int_15 = OpConstant %int 15
%_ptr_Output_v4float = OpTypePointer Output %v4float
%_GLF_color = OpVariable %_ptr_Output_v4float Output
%40 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%41 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
%int_1 = OpConstant %int 1
%main = OpFunction %void None %13
%43 = OpLabel
%i = OpVariable %_ptr_Function_int Function
%j = OpVariable %_ptr_Function_int Function
%data = OpVariable %_ptr_Function__arr_v2float_uint_17 Function
OpStore %i %int_0
OpBranch %44
%44 = OpLabel
OpLoopMerge %45 %46 None
OpBranch %47
%47 = OpLabel
%48 = OpLoad %int %i
%49 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0
%50 = OpLoad %float %49
%51 = OpConvertFToS %int %50
%52 = OpIAdd %int %int_4 %51
%53 = OpSLessThan %bool %48 %52
OpBranchConditional %53 %54 %45
%54 = OpLabel
%55 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0
%56 = OpLoad %float %55
%57 = OpFOrdGreaterThanEqual %bool %56 %float_0
OpSelectionMerge %58 None
OpBranchConditional %57 %59 %58
%59 = OpLabel
OpStore %j %int_0
OpBranch %60
%60 = OpLabel
OpLoopMerge %61 %62 None
OpBranch %63
%63 = OpLabel
%64 = OpLoad %int %j
%65 = OpSLessThan %bool %64 %int_4
OpBranchConditional %65 %66 %61
%66 = OpLabel
%67 = OpLoad %int %j
%68 = OpIMul %int %int_4 %67
%69 = OpLoad %int %i
%70 = OpIAdd %int %68 %69
%71 = OpFunctionCall %float %func_
%72 = OpAccessChain %_ptr_Function_float %data %70 %uint_0
OpStore %72 %71
%73 = OpAccessChain %_ptr_Function_float %data %int_0 %uint_0
%74 = OpLoad %float %73
%75 = OpFOrdEqual %bool %74 %float_5
%76 = OpLogicalNot %bool %75
OpSelectionMerge %77 None
OpBranchConditional %76 %78 %77
%78 = OpLabel
%79 = OpAccessChain %_ptr_Function_float %data %int_15 %uint_0
%80 = OpLoad %float %79
%81 = OpFOrdEqual %bool %80 %float_5
OpBranch %77
%77 = OpLabel
%82 = OpPhi %bool %75 %66 %81 %78
OpSelectionMerge %83 None
OpBranchConditional %82 %84 %85
%84 = OpLabel
OpStore %_GLF_color %40
OpBranch %83
%85 = OpLabel
OpStore %_GLF_color %41
OpBranch %83
%83 = OpLabel
%86 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0
%87 = OpLoad %float %86
%88 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1
%89 = OpLoad %float %88
%90 = OpFOrdGreaterThan %bool %87 %89
OpSelectionMerge %91 None
OpBranchConditional %90 %92 %91
%92 = OpLabel
OpReturn
%91 = OpLabel
OpBranch %62
%62 = OpLabel
%93 = OpLoad %int %j
%94 = OpIAdd %int %93 %int_1
OpStore %j %94
OpBranch %60
%61 = OpLabel
OpBranch %58
%58 = OpLabel
OpBranch %46
%46 = OpLabel
%95 = OpLoad %int %i
%96 = OpIAdd %int %95 %int_1
OpStore %i %96
OpBranch %44
%45 = OpLabel
OpReturn
OpFunctionEnd
%func_ = OpFunction %float None %15
%97 = OpLabel
%x = OpVariable %_ptr_Function_int Function
%98 = OpAccessChain %_ptr_Input_float %gl_FragCoord %uint_0
%99 = OpLoad %float %98
%100 = OpFOrdLessThan %bool %99 %float_1
OpSelectionMerge %101 None
OpBranchConditional %100 %102 %101
%102 = OpLabel
OpReturnValue %float_5
%101 = OpLabel
%103 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0
%104 = OpLoad %float %103
%105 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_1
%106 = OpLoad %float %105
%107 = OpFOrdGreaterThan %bool %104 %106
OpSelectionMerge %108 None
OpBranchConditional %107 %109 %108
%109 = OpLabel
OpReturnValue %float_1
%108 = OpLabel
%110 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0
%111 = OpLoad %float %110
%112 = OpConvertFToS %int %111
OpStore %x %112
%113 = OpAccessChain %_ptr_Uniform_float %_ %int_0 %uint_0
%114 = OpLoad %float %113
%115 = OpExtInst %float %1 FClamp %114 %float_0 %float_1
%116 = OpConvertFToS %int %115
%117 = OpIMul %int %116 %int_3
%118 = OpLoad %int %x
%119 = OpIAdd %int %118 %117
OpStore %x %119
%120 = OpLoad %int %x
%121 = OpConvertSToF %float %120
%122 = OpFAdd %float %float_5 %121
OpReturnValue %122
OpFunctionEnd

View File

@ -0,0 +1,98 @@
static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_7 : register(b0, space0) {
uint4 x_7[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
float func_() {
int x = 0;
const float x_99 = gl_FragCoord.x;
if ((x_99 < 1.0f)) {
return 5.0f;
}
const float x_104 = asfloat(x_7[0].x);
const float x_106 = asfloat(x_7[0].y);
if ((x_104 > x_106)) {
return 1.0f;
}
const float x_111 = asfloat(x_7[0].x);
x = int(x_111);
const float x_114 = asfloat(x_7[0].x);
x = (x + (int(clamp(x_114, 0.0f, 1.0f)) * 3));
return (5.0f + float(x));
}
void main_1() {
int i = 0;
int j = 0;
float2 data[17] = (float2[17])0;
i = 0;
while (true) {
const int x_48 = i;
const float x_50 = asfloat(x_7[0].x);
if ((x_48 < (4 + int(x_50)))) {
} else {
break;
}
const float x_56 = gl_FragCoord.x;
if ((x_56 >= 0.0f)) {
j = 0;
while (true) {
bool x_81 = false;
bool x_82_phi = false;
if ((j < 4)) {
} else {
break;
}
const int x_67 = j;
const int x_69 = i;
const float x_71 = func_();
data[((4 * x_67) + x_69)].x = x_71;
const float x_74 = data[0].x;
const bool x_75 = (x_74 == 5.0f);
x_82_phi = x_75;
if (!(x_75)) {
const float x_80 = data[15].x;
x_81 = (x_80 == 5.0f);
x_82_phi = x_81;
}
if (x_82_phi) {
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
}
const float x_87 = asfloat(x_7[0].x);
const float x_89 = asfloat(x_7[0].y);
if ((x_87 > x_89)) {
return;
}
{
j = (j + 1);
}
}
}
{
i = (i + 1);
}
}
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;
}

View File

@ -0,0 +1,106 @@
#include <metal_stdlib>
using namespace metal;
struct buf0 {
/* 0x0000 */ packed_float2 injectionSwitch;
};
struct tint_array_wrapper {
float2 arr[17];
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_2 {
float4 x_GLF_color_1 [[color(0)]];
};
float func_(constant buf0& x_7, thread float4* const tint_symbol_5) {
int x = 0;
float const x_99 = (*(tint_symbol_5)).x;
if ((x_99 < 1.0f)) {
return 5.0f;
}
float const x_104 = x_7.injectionSwitch.x;
float const x_106 = x_7.injectionSwitch.y;
if ((x_104 > x_106)) {
return 1.0f;
}
float const x_111 = x_7.injectionSwitch.x;
x = int(x_111);
float const x_114 = x_7.injectionSwitch.x;
int const x_118 = x;
x = (x_118 + (int(clamp(x_114, 0.0f, 1.0f)) * 3));
int const x_120 = x;
return (5.0f + float(x_120));
}
void main_1(constant buf0& x_7, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) {
int i = 0;
int j = 0;
tint_array_wrapper data = {};
i = 0;
while (true) {
int const x_48 = i;
float const x_50 = x_7.injectionSwitch.x;
if ((x_48 < (4 + int(x_50)))) {
} else {
break;
}
float const x_56 = (*(tint_symbol_6)).x;
if ((x_56 >= 0.0f)) {
j = 0;
while (true) {
bool x_81 = false;
bool x_82_phi = false;
int const x_64 = j;
if ((x_64 < 4)) {
} else {
break;
}
int const x_67 = j;
int const x_69 = i;
float const x_71 = func_(x_7, tint_symbol_6);
data.arr[((4 * x_67) + x_69)].x = x_71;
float const x_74 = data.arr[0].x;
bool const x_75 = (x_74 == 5.0f);
x_82_phi = x_75;
if (!(x_75)) {
float const x_80 = data.arr[15].x;
x_81 = (x_80 == 5.0f);
x_82_phi = x_81;
}
bool const x_82 = x_82_phi;
if (x_82) {
*(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
*(tint_symbol_7) = float4(0.0f, 0.0f, 0.0f, 0.0f);
}
float const x_87 = x_7.injectionSwitch.x;
float const x_89 = x_7.injectionSwitch.y;
if ((x_87 > x_89)) {
return;
}
{
int const x_93 = j;
j = (x_93 + 1);
}
}
}
{
int const x_95 = i;
i = (x_95 + 1);
}
}
return;
}
fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) {
thread float4 tint_symbol_8 = 0.0f;
thread float4 tint_symbol_9 = 0.0f;
tint_symbol_8 = gl_FragCoord_param;
main_1(x_7, &(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_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
return tint_symbol_4;
}

View File

@ -0,0 +1,247 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 151
; Schema: 0
OpCapability Shader
%50 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2
OpExecutionMode %main OriginUpperLeft
OpName %gl_FragCoord "gl_FragCoord"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "injectionSwitch"
OpName %x_7 "x_7"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol "tint_symbol"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %func_ "func_"
OpName %x "x"
OpName %main_1 "main_1"
OpName %i "i"
OpName %j "j"
OpName %data "data"
OpName %x_81 "x_81"
OpName %x_82_phi "x_82_phi"
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 %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %x_7 NonWritable
OpDecorate %x_7 DescriptorSet 0
OpDecorate %x_7 Binding 0
OpDecorate %tint_symbol BuiltIn FragCoord
OpDecorate %tint_symbol_2 Location 0
OpDecorate %_arr_v2float_uint_17 ArrayStride 8
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
%v2float = OpTypeVector %float 2
%buf0 = OpTypeStruct %v2float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_7 = OpVariable %_ptr_Uniform_buf0 Uniform
%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
%15 = OpTypeFunction %float
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%21 = OpConstantNull %int
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_Private_float = OpTypePointer Private %float
%float_1 = OpConstant %float 1
%bool = OpTypeBool
%float_5 = OpConstant %float 5
%_ptr_Uniform_float = OpTypePointer Uniform %float
%uint_1 = OpConstant %uint 1
%float_0 = OpConstant %float 0
%int_3 = OpConstant %int 3
%void = OpTypeVoid
%58 = OpTypeFunction %void
%uint_17 = OpConstant %uint 17
%_arr_v2float_uint_17 = OpTypeArray %v2float %uint_17
%_ptr_Function__arr_v2float_uint_17 = OpTypePointer Function %_arr_v2float_uint_17
%68 = OpConstantNull %_arr_v2float_uint_17
%int_0 = OpConstant %int 0
%int_4 = OpConstant %int 4
%_ptr_Function_bool = OpTypePointer Function %bool
%95 = OpConstantNull %bool
%_ptr_Function_float = OpTypePointer Function %float
%int_15 = OpConstant %int 15
%124 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%125 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
%int_1 = OpConstant %int 1
%main_out = OpTypeStruct %v4float
%138 = OpTypeFunction %void %main_out
%func_ = OpFunction %float None %15
%17 = OpLabel
%x = OpVariable %_ptr_Function_int Function %21
%25 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0
%26 = OpLoad %float %25
%28 = OpFOrdLessThan %bool %26 %float_1
OpSelectionMerge %30 None
OpBranchConditional %28 %31 %30
%31 = OpLabel
OpReturnValue %float_5
%30 = OpLabel
%34 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0
%35 = OpLoad %float %34
%37 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1
%38 = OpLoad %float %37
%39 = OpFOrdGreaterThan %bool %35 %38
OpSelectionMerge %40 None
OpBranchConditional %39 %41 %40
%41 = OpLabel
OpReturnValue %float_1
%40 = OpLabel
%42 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0
%43 = OpLoad %float %42
%44 = OpConvertFToS %int %43
OpStore %x %44
%45 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0
%46 = OpLoad %float %45
%47 = OpLoad %int %x
%49 = OpExtInst %float %50 NClamp %46 %float_0 %float_1
%48 = OpConvertFToS %int %49
%53 = OpIMul %int %48 %int_3
%54 = OpIAdd %int %47 %53
OpStore %x %54
%55 = OpLoad %int %x
%56 = OpConvertSToF %float %55
%57 = OpFAdd %float %float_5 %56
OpReturnValue %57
OpFunctionEnd
%main_1 = OpFunction %void None %58
%61 = OpLabel
%i = OpVariable %_ptr_Function_int Function %21
%j = OpVariable %_ptr_Function_int Function %21
%data = OpVariable %_ptr_Function__arr_v2float_uint_17 Function %68
%x_81 = OpVariable %_ptr_Function_bool Function %95
%x_82_phi = OpVariable %_ptr_Function_bool Function %95
OpStore %i %int_0
OpBranch %70
%70 = OpLabel
OpLoopMerge %71 %72 None
OpBranch %73
%73 = OpLabel
%74 = OpLoad %int %i
%75 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0
%76 = OpLoad %float %75
%78 = OpConvertFToS %int %76
%79 = OpIAdd %int %int_4 %78
%80 = OpSLessThan %bool %74 %79
OpSelectionMerge %81 None
OpBranchConditional %80 %82 %83
%82 = OpLabel
OpBranch %81
%83 = OpLabel
OpBranch %71
%81 = OpLabel
%84 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0
%85 = OpLoad %float %84
%86 = OpFOrdGreaterThanEqual %bool %85 %float_0
OpSelectionMerge %87 None
OpBranchConditional %86 %88 %87
%88 = OpLabel
OpStore %j %int_0
OpBranch %89
%89 = OpLabel
OpLoopMerge %90 %91 None
OpBranch %92
%92 = OpLabel
%97 = OpLoad %int %j
%98 = OpSLessThan %bool %97 %int_4
OpSelectionMerge %99 None
OpBranchConditional %98 %100 %101
%100 = OpLabel
OpBranch %99
%101 = OpLabel
OpBranch %90
%99 = OpLabel
%102 = OpLoad %int %j
%103 = OpLoad %int %i
%104 = OpFunctionCall %float %func_
%105 = OpIMul %int %int_4 %102
%106 = OpIAdd %int %105 %103
%108 = OpAccessChain %_ptr_Function_float %data %106 %uint_0
OpStore %108 %104
%109 = OpAccessChain %_ptr_Function_float %data %int_0 %uint_0
%110 = OpLoad %float %109
%111 = OpFOrdEqual %bool %110 %float_5
OpStore %x_82_phi %111
%112 = OpLogicalNot %bool %111
OpSelectionMerge %113 None
OpBranchConditional %112 %114 %113
%114 = OpLabel
%116 = OpAccessChain %_ptr_Function_float %data %int_15 %uint_0
%117 = OpLoad %float %116
%118 = OpFOrdEqual %bool %117 %float_5
OpStore %x_81 %118
%119 = OpLoad %bool %x_81
OpStore %x_82_phi %119
OpBranch %113
%113 = OpLabel
%120 = OpLoad %bool %x_82_phi
OpSelectionMerge %121 None
OpBranchConditional %120 %122 %123
%122 = OpLabel
OpStore %x_GLF_color %124
OpBranch %121
%123 = OpLabel
OpStore %x_GLF_color %125
OpBranch %121
%121 = OpLabel
%126 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0
%127 = OpLoad %float %126
%128 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1
%129 = OpLoad %float %128
%130 = OpFOrdGreaterThan %bool %127 %129
OpSelectionMerge %131 None
OpBranchConditional %130 %132 %131
%132 = OpLabel
OpReturn
%131 = OpLabel
OpBranch %91
%91 = OpLabel
%133 = OpLoad %int %j
%135 = OpIAdd %int %133 %int_1
OpStore %j %135
OpBranch %89
%90 = OpLabel
OpBranch %87
%87 = OpLabel
OpBranch %72
%72 = OpLabel
%136 = OpLoad %int %i
%137 = OpIAdd %int %136 %int_1
OpStore %i %137
OpBranch %70
%71 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_3 = OpFunction %void None %138
%tint_symbol_1 = OpFunctionParameter %main_out
%142 = OpLabel
%143 = OpCompositeExtract %v4float %tint_symbol_1 0
OpStore %tint_symbol_2 %143
OpReturn
OpFunctionEnd
%main = OpFunction %void None %58
%145 = OpLabel
%146 = OpLoad %v4float %tint_symbol
OpStore %gl_FragCoord %146
%147 = OpFunctionCall %void %main_1
%149 = OpLoad %v4float %x_GLF_color
%150 = OpCompositeConstruct %main_out %149
%148 = OpFunctionCall %void %tint_symbol_3 %150
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,104 @@
[[block]]
struct buf0 {
injectionSwitch : vec2<f32>;
};
var<private> gl_FragCoord : vec4<f32>;
[[group(0), binding(0)]] var<uniform> x_7 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn func_() -> f32 {
var x : i32;
let x_99 : f32 = gl_FragCoord.x;
if ((x_99 < 1.0)) {
return 5.0;
}
let x_104 : f32 = x_7.injectionSwitch.x;
let x_106 : f32 = x_7.injectionSwitch.y;
if ((x_104 > x_106)) {
return 1.0;
}
let x_111 : f32 = x_7.injectionSwitch.x;
x = i32(x_111);
let x_114 : f32 = x_7.injectionSwitch.x;
let x_118 : i32 = x;
x = (x_118 + (i32(clamp(x_114, 0.0, 1.0)) * 3));
let x_120 : i32 = x;
return (5.0 + f32(x_120));
}
fn main_1() {
var i : i32;
var j : i32;
var data : array<vec2<f32>, 17>;
i = 0;
loop {
let x_48 : i32 = i;
let x_50 : f32 = x_7.injectionSwitch.x;
if ((x_48 < (4 + i32(x_50)))) {
} else {
break;
}
let x_56 : f32 = gl_FragCoord.x;
if ((x_56 >= 0.0)) {
j = 0;
loop {
var x_81 : bool;
var x_82_phi : bool;
let x_64 : i32 = j;
if ((x_64 < 4)) {
} else {
break;
}
let x_67 : i32 = j;
let x_69 : i32 = i;
let x_71 : f32 = func_();
data[((4 * x_67) + x_69)].x = x_71;
let x_74 : f32 = data[0].x;
let x_75 : bool = (x_74 == 5.0);
x_82_phi = x_75;
if (!(x_75)) {
let x_80 : f32 = data[15].x;
x_81 = (x_80 == 5.0);
x_82_phi = x_81;
}
let x_82 : bool = x_82_phi;
if (x_82) {
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
} else {
x_GLF_color = vec4<f32>(0.0, 0.0, 0.0, 0.0);
}
let x_87 : f32 = x_7.injectionSwitch.x;
let x_89 : f32 = x_7.injectionSwitch.y;
if ((x_87 > x_89)) {
return;
}
continuing {
let x_93 : i32 = j;
j = (x_93 + 1);
}
}
}
continuing {
let x_95 : i32 = i;
i = (x_95 + 1);
}
}
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);
}

View File

@ -0,0 +1,104 @@
[[block]]
struct buf0 {
injectionSwitch : vec2<f32>;
};
var<private> gl_FragCoord : vec4<f32>;
[[group(0), binding(0)]] var<uniform> x_7 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn func_() -> f32 {
var x : i32;
let x_99 : f32 = gl_FragCoord.x;
if ((x_99 < 1.0)) {
return 5.0;
}
let x_104 : f32 = x_7.injectionSwitch.x;
let x_106 : f32 = x_7.injectionSwitch.y;
if ((x_104 > x_106)) {
return 1.0;
}
let x_111 : f32 = x_7.injectionSwitch.x;
x = i32(x_111);
let x_114 : f32 = x_7.injectionSwitch.x;
let x_118 : i32 = x;
x = (x_118 + (i32(clamp(x_114, 0.0, 1.0)) * 3));
let x_120 : i32 = x;
return (5.0 + f32(x_120));
}
fn main_1() {
var i : i32;
var j : i32;
var data : array<vec2<f32>, 17>;
i = 0;
loop {
let x_48 : i32 = i;
let x_50 : f32 = x_7.injectionSwitch.x;
if ((x_48 < (4 + i32(x_50)))) {
} else {
break;
}
let x_56 : f32 = gl_FragCoord.x;
if ((x_56 >= 0.0)) {
j = 0;
loop {
var x_81 : bool;
var x_82_phi : bool;
let x_64 : i32 = j;
if ((x_64 < 4)) {
} else {
break;
}
let x_67 : i32 = j;
let x_69 : i32 = i;
let x_71 : f32 = func_();
data[((4 * x_67) + x_69)].x = x_71;
let x_74 : f32 = data[0].x;
let x_75 : bool = (x_74 == 5.0);
x_82_phi = x_75;
if (!(x_75)) {
let x_80 : f32 = data[15].x;
x_81 = (x_80 == 5.0);
x_82_phi = x_81;
}
let x_82 : bool = x_82_phi;
if (x_82) {
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
} else {
x_GLF_color = vec4<f32>(0.0, 0.0, 0.0, 0.0);
}
let x_87 : f32 = x_7.injectionSwitch.x;
let x_89 : f32 = x_7.injectionSwitch.y;
if ((x_87 > x_89)) {
return;
}
continuing {
let x_93 : i32 = j;
j = (x_93 + 1);
}
}
}
continuing {
let x_95 : i32 = i;
i = (x_95 + 1);
}
}
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);
}

View File

@ -0,0 +1,98 @@
static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f);
cbuffer cbuffer_x_7 : register(b0, space0) {
uint4 x_7[1];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
float func_() {
int x = 0;
const float x_99 = gl_FragCoord.x;
if ((x_99 < 1.0f)) {
return 5.0f;
}
const float x_104 = asfloat(x_7[0].x);
const float x_106 = asfloat(x_7[0].y);
if ((x_104 > x_106)) {
return 1.0f;
}
const float x_111 = asfloat(x_7[0].x);
x = int(x_111);
const float x_114 = asfloat(x_7[0].x);
x = (x + (int(clamp(x_114, 0.0f, 1.0f)) * 3));
return (5.0f + float(x));
}
void main_1() {
int i = 0;
int j = 0;
float2 data[17] = (float2[17])0;
i = 0;
while (true) {
const int x_48 = i;
const float x_50 = asfloat(x_7[0].x);
if ((x_48 < (4 + int(x_50)))) {
} else {
break;
}
const float x_56 = gl_FragCoord.x;
if ((x_56 >= 0.0f)) {
j = 0;
while (true) {
bool x_81 = false;
bool x_82_phi = false;
if ((j < 4)) {
} else {
break;
}
const int x_67 = j;
const int x_69 = i;
const float x_71 = func_();
data[((4 * x_67) + x_69)].x = x_71;
const float x_74 = data[0].x;
const bool x_75 = (x_74 == 5.0f);
x_82_phi = x_75;
if (!(x_75)) {
const float x_80 = data[15].x;
x_81 = (x_80 == 5.0f);
x_82_phi = x_81;
}
if (x_82_phi) {
x_GLF_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
}
const float x_87 = asfloat(x_7[0].x);
const float x_89 = asfloat(x_7[0].y);
if ((x_87 > x_89)) {
return;
}
{
j = (j + 1);
}
}
}
{
i = (i + 1);
}
}
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;
}

View File

@ -0,0 +1,106 @@
#include <metal_stdlib>
using namespace metal;
struct buf0 {
/* 0x0000 */ packed_float2 injectionSwitch;
};
struct tint_array_wrapper {
float2 arr[17];
};
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol_2 {
float4 x_GLF_color_1 [[color(0)]];
};
float func_(constant buf0& x_7, thread float4* const tint_symbol_5) {
int x = 0;
float const x_99 = (*(tint_symbol_5)).x;
if ((x_99 < 1.0f)) {
return 5.0f;
}
float const x_104 = x_7.injectionSwitch.x;
float const x_106 = x_7.injectionSwitch.y;
if ((x_104 > x_106)) {
return 1.0f;
}
float const x_111 = x_7.injectionSwitch.x;
x = int(x_111);
float const x_114 = x_7.injectionSwitch.x;
int const x_118 = x;
x = (x_118 + (int(clamp(x_114, 0.0f, 1.0f)) * 3));
int const x_120 = x;
return (5.0f + float(x_120));
}
void main_1(constant buf0& x_7, thread float4* const tint_symbol_6, thread float4* const tint_symbol_7) {
int i = 0;
int j = 0;
tint_array_wrapper data = {};
i = 0;
while (true) {
int const x_48 = i;
float const x_50 = x_7.injectionSwitch.x;
if ((x_48 < (4 + int(x_50)))) {
} else {
break;
}
float const x_56 = (*(tint_symbol_6)).x;
if ((x_56 >= 0.0f)) {
j = 0;
while (true) {
bool x_81 = false;
bool x_82_phi = false;
int const x_64 = j;
if ((x_64 < 4)) {
} else {
break;
}
int const x_67 = j;
int const x_69 = i;
float const x_71 = func_(x_7, tint_symbol_6);
data.arr[((4 * x_67) + x_69)].x = x_71;
float const x_74 = data.arr[0].x;
bool const x_75 = (x_74 == 5.0f);
x_82_phi = x_75;
if (!(x_75)) {
float const x_80 = data.arr[15].x;
x_81 = (x_80 == 5.0f);
x_82_phi = x_81;
}
bool const x_82 = x_82_phi;
if (x_82) {
*(tint_symbol_7) = float4(1.0f, 0.0f, 0.0f, 1.0f);
} else {
*(tint_symbol_7) = float4(0.0f, 0.0f, 0.0f, 0.0f);
}
float const x_87 = x_7.injectionSwitch.x;
float const x_89 = x_7.injectionSwitch.y;
if ((x_87 > x_89)) {
return;
}
{
int const x_93 = j;
j = (x_93 + 1);
}
}
}
{
int const x_95 = i;
i = (x_95 + 1);
}
}
return;
}
fragment tint_symbol_2 tint_symbol(float4 gl_FragCoord_param [[position]], constant buf0& x_7 [[buffer(0)]]) {
thread float4 tint_symbol_8 = 0.0f;
thread float4 tint_symbol_9 = 0.0f;
tint_symbol_8 = gl_FragCoord_param;
main_1(x_7, &(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_4 = {.x_GLF_color_1=tint_symbol_3.x_GLF_color_1};
return tint_symbol_4;
}

View File

@ -0,0 +1,247 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 151
; Schema: 0
OpCapability Shader
%50 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %tint_symbol %tint_symbol_2
OpExecutionMode %main OriginUpperLeft
OpName %gl_FragCoord "gl_FragCoord"
OpName %buf0 "buf0"
OpMemberName %buf0 0 "injectionSwitch"
OpName %x_7 "x_7"
OpName %x_GLF_color "x_GLF_color"
OpName %tint_symbol "tint_symbol"
OpName %tint_symbol_2 "tint_symbol_2"
OpName %func_ "func_"
OpName %x "x"
OpName %main_1 "main_1"
OpName %i "i"
OpName %j "j"
OpName %data "data"
OpName %x_81 "x_81"
OpName %x_82_phi "x_82_phi"
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 %buf0 Block
OpMemberDecorate %buf0 0 Offset 0
OpDecorate %x_7 NonWritable
OpDecorate %x_7 DescriptorSet 0
OpDecorate %x_7 Binding 0
OpDecorate %tint_symbol BuiltIn FragCoord
OpDecorate %tint_symbol_2 Location 0
OpDecorate %_arr_v2float_uint_17 ArrayStride 8
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
%v2float = OpTypeVector %float 2
%buf0 = OpTypeStruct %v2float
%_ptr_Uniform_buf0 = OpTypePointer Uniform %buf0
%x_7 = OpVariable %_ptr_Uniform_buf0 Uniform
%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
%15 = OpTypeFunction %float
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%21 = OpConstantNull %int
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_Private_float = OpTypePointer Private %float
%float_1 = OpConstant %float 1
%bool = OpTypeBool
%float_5 = OpConstant %float 5
%_ptr_Uniform_float = OpTypePointer Uniform %float
%uint_1 = OpConstant %uint 1
%float_0 = OpConstant %float 0
%int_3 = OpConstant %int 3
%void = OpTypeVoid
%58 = OpTypeFunction %void
%uint_17 = OpConstant %uint 17
%_arr_v2float_uint_17 = OpTypeArray %v2float %uint_17
%_ptr_Function__arr_v2float_uint_17 = OpTypePointer Function %_arr_v2float_uint_17
%68 = OpConstantNull %_arr_v2float_uint_17
%int_0 = OpConstant %int 0
%int_4 = OpConstant %int 4
%_ptr_Function_bool = OpTypePointer Function %bool
%95 = OpConstantNull %bool
%_ptr_Function_float = OpTypePointer Function %float
%int_15 = OpConstant %int 15
%124 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%125 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
%int_1 = OpConstant %int 1
%main_out = OpTypeStruct %v4float
%138 = OpTypeFunction %void %main_out
%func_ = OpFunction %float None %15
%17 = OpLabel
%x = OpVariable %_ptr_Function_int Function %21
%25 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0
%26 = OpLoad %float %25
%28 = OpFOrdLessThan %bool %26 %float_1
OpSelectionMerge %30 None
OpBranchConditional %28 %31 %30
%31 = OpLabel
OpReturnValue %float_5
%30 = OpLabel
%34 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0
%35 = OpLoad %float %34
%37 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1
%38 = OpLoad %float %37
%39 = OpFOrdGreaterThan %bool %35 %38
OpSelectionMerge %40 None
OpBranchConditional %39 %41 %40
%41 = OpLabel
OpReturnValue %float_1
%40 = OpLabel
%42 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0
%43 = OpLoad %float %42
%44 = OpConvertFToS %int %43
OpStore %x %44
%45 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0
%46 = OpLoad %float %45
%47 = OpLoad %int %x
%49 = OpExtInst %float %50 NClamp %46 %float_0 %float_1
%48 = OpConvertFToS %int %49
%53 = OpIMul %int %48 %int_3
%54 = OpIAdd %int %47 %53
OpStore %x %54
%55 = OpLoad %int %x
%56 = OpConvertSToF %float %55
%57 = OpFAdd %float %float_5 %56
OpReturnValue %57
OpFunctionEnd
%main_1 = OpFunction %void None %58
%61 = OpLabel
%i = OpVariable %_ptr_Function_int Function %21
%j = OpVariable %_ptr_Function_int Function %21
%data = OpVariable %_ptr_Function__arr_v2float_uint_17 Function %68
%x_81 = OpVariable %_ptr_Function_bool Function %95
%x_82_phi = OpVariable %_ptr_Function_bool Function %95
OpStore %i %int_0
OpBranch %70
%70 = OpLabel
OpLoopMerge %71 %72 None
OpBranch %73
%73 = OpLabel
%74 = OpLoad %int %i
%75 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0
%76 = OpLoad %float %75
%78 = OpConvertFToS %int %76
%79 = OpIAdd %int %int_4 %78
%80 = OpSLessThan %bool %74 %79
OpSelectionMerge %81 None
OpBranchConditional %80 %82 %83
%82 = OpLabel
OpBranch %81
%83 = OpLabel
OpBranch %71
%81 = OpLabel
%84 = OpAccessChain %_ptr_Private_float %gl_FragCoord %uint_0
%85 = OpLoad %float %84
%86 = OpFOrdGreaterThanEqual %bool %85 %float_0
OpSelectionMerge %87 None
OpBranchConditional %86 %88 %87
%88 = OpLabel
OpStore %j %int_0
OpBranch %89
%89 = OpLabel
OpLoopMerge %90 %91 None
OpBranch %92
%92 = OpLabel
%97 = OpLoad %int %j
%98 = OpSLessThan %bool %97 %int_4
OpSelectionMerge %99 None
OpBranchConditional %98 %100 %101
%100 = OpLabel
OpBranch %99
%101 = OpLabel
OpBranch %90
%99 = OpLabel
%102 = OpLoad %int %j
%103 = OpLoad %int %i
%104 = OpFunctionCall %float %func_
%105 = OpIMul %int %int_4 %102
%106 = OpIAdd %int %105 %103
%108 = OpAccessChain %_ptr_Function_float %data %106 %uint_0
OpStore %108 %104
%109 = OpAccessChain %_ptr_Function_float %data %int_0 %uint_0
%110 = OpLoad %float %109
%111 = OpFOrdEqual %bool %110 %float_5
OpStore %x_82_phi %111
%112 = OpLogicalNot %bool %111
OpSelectionMerge %113 None
OpBranchConditional %112 %114 %113
%114 = OpLabel
%116 = OpAccessChain %_ptr_Function_float %data %int_15 %uint_0
%117 = OpLoad %float %116
%118 = OpFOrdEqual %bool %117 %float_5
OpStore %x_81 %118
%119 = OpLoad %bool %x_81
OpStore %x_82_phi %119
OpBranch %113
%113 = OpLabel
%120 = OpLoad %bool %x_82_phi
OpSelectionMerge %121 None
OpBranchConditional %120 %122 %123
%122 = OpLabel
OpStore %x_GLF_color %124
OpBranch %121
%123 = OpLabel
OpStore %x_GLF_color %125
OpBranch %121
%121 = OpLabel
%126 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_0
%127 = OpLoad %float %126
%128 = OpAccessChain %_ptr_Uniform_float %x_7 %uint_0 %uint_1
%129 = OpLoad %float %128
%130 = OpFOrdGreaterThan %bool %127 %129
OpSelectionMerge %131 None
OpBranchConditional %130 %132 %131
%132 = OpLabel
OpReturn
%131 = OpLabel
OpBranch %91
%91 = OpLabel
%133 = OpLoad %int %j
%135 = OpIAdd %int %133 %int_1
OpStore %j %135
OpBranch %89
%90 = OpLabel
OpBranch %87
%87 = OpLabel
OpBranch %72
%72 = OpLabel
%136 = OpLoad %int %i
%137 = OpIAdd %int %136 %int_1
OpStore %i %137
OpBranch %70
%71 = OpLabel
OpReturn
OpFunctionEnd
%tint_symbol_3 = OpFunction %void None %138
%tint_symbol_1 = OpFunctionParameter %main_out
%142 = OpLabel
%143 = OpCompositeExtract %v4float %tint_symbol_1 0
OpStore %tint_symbol_2 %143
OpReturn
OpFunctionEnd
%main = OpFunction %void None %58
%145 = OpLabel
%146 = OpLoad %v4float %tint_symbol
OpStore %gl_FragCoord %146
%147 = OpFunctionCall %void %main_1
%149 = OpLoad %v4float %x_GLF_color
%150 = OpCompositeConstruct %main_out %149
%148 = OpFunctionCall %void %tint_symbol_3 %150
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,104 @@
[[block]]
struct buf0 {
injectionSwitch : vec2<f32>;
};
var<private> gl_FragCoord : vec4<f32>;
[[group(0), binding(0)]] var<uniform> x_7 : buf0;
var<private> x_GLF_color : vec4<f32>;
fn func_() -> f32 {
var x : i32;
let x_99 : f32 = gl_FragCoord.x;
if ((x_99 < 1.0)) {
return 5.0;
}
let x_104 : f32 = x_7.injectionSwitch.x;
let x_106 : f32 = x_7.injectionSwitch.y;
if ((x_104 > x_106)) {
return 1.0;
}
let x_111 : f32 = x_7.injectionSwitch.x;
x = i32(x_111);
let x_114 : f32 = x_7.injectionSwitch.x;
let x_118 : i32 = x;
x = (x_118 + (i32(clamp(x_114, 0.0, 1.0)) * 3));
let x_120 : i32 = x;
return (5.0 + f32(x_120));
}
fn main_1() {
var i : i32;
var j : i32;
var data : array<vec2<f32>, 17>;
i = 0;
loop {
let x_48 : i32 = i;
let x_50 : f32 = x_7.injectionSwitch.x;
if ((x_48 < (4 + i32(x_50)))) {
} else {
break;
}
let x_56 : f32 = gl_FragCoord.x;
if ((x_56 >= 0.0)) {
j = 0;
loop {
var x_81 : bool;
var x_82_phi : bool;
let x_64 : i32 = j;
if ((x_64 < 4)) {
} else {
break;
}
let x_67 : i32 = j;
let x_69 : i32 = i;
let x_71 : f32 = func_();
data[((4 * x_67) + x_69)].x = x_71;
let x_74 : f32 = data[0].x;
let x_75 : bool = (x_74 == 5.0);
x_82_phi = x_75;
if (!(x_75)) {
let x_80 : f32 = data[15].x;
x_81 = (x_80 == 5.0);
x_82_phi = x_81;
}
let x_82 : bool = x_82_phi;
if (x_82) {
x_GLF_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
} else {
x_GLF_color = vec4<f32>(0.0, 0.0, 0.0, 0.0);
}
let x_87 : f32 = x_7.injectionSwitch.x;
let x_89 : f32 = x_7.injectionSwitch.y;
if ((x_87 > x_89)) {
return;
}
continuing {
let x_93 : i32 = j;
j = (x_93 + 1);
}
}
}
continuing {
let x_95 : i32 = i;
i = (x_95 + 1);
}
}
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);
}

Some files were not shown because too many files have changed in this diff Show More