Implement Pointers and References

This change implements pointers and references as described by the WGSL
specification change in https://github.com/gpuweb/gpuweb/pull/1569.

reader/spirv:
* Now emits address-of `&expr` and indirection `*expr` operators as
  needed.
* As an identifier may now resolve to a pointer or reference type
  depending on whether the declaration is a `var`, `let` or
  parameter, `Function::identifier_values_` has been changed from
  an ID set to an ID -> Type* map.

resolver:
* Now correctly resolves all expressions to either a value type,
  reference type or pointer type.
* Validates pointer / reference rules on assignment, `var` and `let`
  construction, and usage.
* Handles the address-of and indirection operators.
* No longer does any implicit loads of pointer types.
* Storage class validation is still TODO (crbug.com/tint/809)

writer/spirv:
* Correctly handles variables and expressions of pointer and
  reference types, emitting OpLoads where necessary.

test:
* Lots of new test cases

Fixed: tint:727
Change-Id: I77d3281590e35e5a3122f5b74cdeb71a6fe51f74
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50740
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
Ben Clayton
2021-05-18 10:28:48 +00:00
committed by Commit Bot service account
parent d1232670ae
commit 9b54a2e53c
192 changed files with 6289 additions and 1680 deletions

View File

@@ -257,6 +257,8 @@ tint_unittests_source_set("tint_unittests_core_src") {
"../src/resolver/intrinsic_test.cc",
"../src/resolver/is_host_shareable_test.cc",
"../src/resolver/is_storeable_test.cc",
"../src/resolver/ptr_ref_test.cc",
"../src/resolver/ptr_ref_validation_test.cc",
"../src/resolver/pipeline_overridable_constant_test.cc",
"../src/resolver/resolver_test.cc",
"../src/resolver/resolver_test_helper.cc",
@@ -268,6 +270,8 @@ tint_unittests_source_set("tint_unittests_core_src") {
"../src/resolver/type_constructor_validation_test.cc",
"../src/resolver/type_validation_test.cc",
"../src/resolver/validation_test.cc",
"../src/resolver/var_let_test.cc",
"../src/resolver/var_let_validation_test.cc",
"../src/scope_stack_test.cc",
"../src/sem/bool_type_test.cc",
"../src/sem/depth_texture_type_test.cc",

View File

@@ -2,7 +2,7 @@
using namespace metal;
kernel void tint_symbol() {
const float x_24 = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f))[1u].y;
float const x_24 = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f))[1u].y;
return;
}

View File

@@ -2,9 +2,9 @@
using namespace metal;
kernel void tint_symbol() {
const float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
const float3 v = m[1];
const float f = v[1];
float3x3 const m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
float3 const v = m[1];
float const f = v[1];
return;
}

View File

@@ -3,24 +3,24 @@
; Generator: Google Tint Compiler; 0
; Bound: 15
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%10 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%v2float = OpTypeVector %float 2
%main = OpFunction %void None %1
%4 = OpLabel
%11 = OpCompositeExtract %float %10 1
%13 = OpVectorShuffle %v2float %10 %10 0 2
%14 = OpVectorShuffle %v3float %10 %10 0 2 1
OpReturn
OpFunctionEnd
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%10 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%v2float = OpTypeVector %float 2
%main = OpFunction %void None %1
%4 = OpLabel
%11 = OpCompositeExtract %float %10 1
%13 = OpVectorShuffle %v2float %10 %10 0 2
%14 = OpVectorShuffle %v3float %10 %10 0 2 1
OpReturn
OpFunctionEnd

View File

@@ -2,9 +2,9 @@
using namespace metal;
kernel void tint_symbol() {
const float x_11 = float3(1.0f, 2.0f, 3.0f).y;
const float2 x_13 = float2(float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).z);
const float3 x_14 = float3(float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).z, float3(1.0f, 2.0f, 3.0f).y);
float const x_11 = float3(1.0f, 2.0f, 3.0f).y;
float2 const x_13 = float2(float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).z);
float3 const x_14 = float3(float3(1.0f, 2.0f, 3.0f).x, float3(1.0f, 2.0f, 3.0f).z, float3(1.0f, 2.0f, 3.0f).y);
return;
}

View File

@@ -2,10 +2,10 @@
using namespace metal;
kernel void tint_symbol() {
const float3 v = float3(1.0f, 2.0f, 3.0f);
const float scalar = v.y;
const float2 swizzle2 = v.xz;
const float3 swizzle3 = v.xzy;
float3 const v = float3(1.0f, 2.0f, 3.0f);
float const scalar = v.y;
float2 const swizzle2 = v.xz;
float3 const swizzle3 = v.xzy;
return;
}

View File

@@ -3,8 +3,8 @@
using namespace metal;
kernel void tint_symbol() {
float3x3 m = float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
const float3 x_15 = m[1];
const float x_16 = x_15.y;
float3 const x_15 = m[1];
float const x_16 = x_15.y;
return;
}

View File

@@ -3,8 +3,8 @@
using namespace metal;
kernel void tint_symbol() {
float3x3 m = 0.0f;
const float3 v = m[1];
const float f = v[1];
float3 const v = m[1];
float const f = v[1];
return;
}

View File

@@ -3,30 +3,30 @@
; Generator: Google Tint Compiler; 0
; Bound: 20
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %v "v"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %v "v"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%_ptr_Function_v3float = OpTypePointer Function %v3float
%9 = OpConstantNull %v3float
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_ptr_Function_float = OpTypePointer Function %float
%v2float = OpTypeVector %float 2
%main = OpFunction %void None %1
%4 = OpLabel
%v = OpVariable %_ptr_Function_v3float Function %9
%13 = OpAccessChain %_ptr_Function_float %v %uint_1
%14 = OpLoad %float %13
%16 = OpLoad %v3float %v
%17 = OpVectorShuffle %v2float %16 %16 0 2
%18 = OpLoad %v3float %v
%19 = OpVectorShuffle %v3float %18 %18 0 2 1
OpReturn
OpFunctionEnd
%9 = OpConstantNull %v3float
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_ptr_Function_float = OpTypePointer Function %float
%v2float = OpTypeVector %float 2
%main = OpFunction %void None %1
%4 = OpLabel
%v = OpVariable %_ptr_Function_v3float Function %9
%13 = OpAccessChain %_ptr_Function_float %v %uint_1
%14 = OpLoad %float %13
%16 = OpLoad %v3float %v
%17 = OpVectorShuffle %v2float %16 %16 0 2
%18 = OpLoad %v3float %v
%19 = OpVectorShuffle %v3float %18 %18 0 2 1
OpReturn
OpFunctionEnd

View File

@@ -3,11 +3,11 @@
using namespace metal;
kernel void tint_symbol() {
float3 v = float3(0.0f, 0.0f, 0.0f);
const float x_14 = v.y;
const float3 x_16 = v;
const float2 x_17 = float2(x_16.x, x_16.z);
const float3 x_18 = v;
const float3 x_19 = float3(x_18.x, x_18.z, x_18.y);
float const x_14 = v.y;
float3 const x_16 = v;
float2 const x_17 = float2(x_16.x, x_16.z);
float3 const x_18 = v;
float3 const x_19 = float3(x_18.x, x_18.z, x_18.y);
return;
}

View File

@@ -3,9 +3,9 @@
using namespace metal;
kernel void tint_symbol() {
float3 v = 0.0f;
const float scalar = v.y;
const float2 swizzle2 = v.xz;
const float3 swizzle3 = v.xzy;
float const scalar = v.y;
float2 const swizzle2 = v.xz;
float3 const swizzle3 = v.xzy;
return;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,12 @@
[[block]]
struct S {
a : array<i32>;
};
[[group(0), binding(0)]] var<storage> G : [[access(read)]] S;
[[stage(compute)]]
fn main() {
// TODO(crbug.com/tint/806): arrayLength signature is currently wrong
// let l : i32 = arrayLength(&G.a);
}

View File

@@ -0,0 +1,6 @@
[numthreads(1, 1, 1)]
void main() {
return;
}

View File

@@ -0,0 +1,11 @@
#include <metal_stdlib>
using namespace metal;
struct S {
/* 0x0000 */ int a[1];
};
kernel void tint_symbol() {
return;
}

View File

@@ -0,0 +1,30 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 10
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %S "S"
OpMemberName %S 0 "a"
OpName %G "G"
OpName %main "main"
OpDecorate %S Block
OpMemberDecorate %S 0 Offset 0
OpDecorate %_runtimearr_int ArrayStride 4
OpDecorate %G NonWritable
OpDecorate %G DescriptorSet 0
OpDecorate %G Binding 0
%int = OpTypeInt 32 1
%_runtimearr_int = OpTypeRuntimeArray %int
%S = OpTypeStruct %_runtimearr_int
%_ptr_StorageBuffer_S = OpTypePointer StorageBuffer %S
%G = OpVariable %_ptr_StorageBuffer_S StorageBuffer
%void = OpTypeVoid
%6 = OpTypeFunction %void
%main = OpFunction %void None %6
%9 = OpLabel
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,10 @@
[[block]]
struct S {
a : array<i32>;
};
[[group(0), binding(0)]] var<storage> G : [[access(read)]] S;
[[stage(compute)]]
fn main() {
}

View File

@@ -0,0 +1,5 @@
[[stage(compute)]]
fn main() {
var exponent : i32;
let significand : f32 = frexp(1.23, &exponent);
}

View File

@@ -0,0 +1 @@
SKIP: Failed to generate: error: Unknown builtin method: frexp

View File

@@ -0,0 +1 @@
SKIP: Failed to generate: error: Unknown import method: frexp

View File

@@ -0,0 +1,25 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 14
; Schema: 0
OpCapability Shader
%11 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %exponent "exponent"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%8 = OpConstantNull %int
%float = OpTypeFloat 32
%float_1_23000002 = OpConstant %float 1.23000002
%main = OpFunction %void None %1
%4 = OpLabel
%exponent = OpVariable %_ptr_Function_int Function %8
%9 = OpExtInst %float %11 Frexp %float_1_23000002 %exponent
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,5 @@
[[stage(compute)]]
fn main() {
var exponent : i32;
let significand : f32 = frexp(1.230000019, &(exponent));
}

View File

@@ -0,0 +1,5 @@
[[stage(compute)]]
fn main() {
var whole : f32;
let frac : f32 = modf(1.23, &whole);
}

View File

@@ -0,0 +1 @@
SKIP: Failed to generate: error: Unknown builtin method: frexp

View File

@@ -0,0 +1 @@
SKIP: Failed to generate: error: Unknown import method: frexp

View File

@@ -0,0 +1,24 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 13
; Schema: 0
OpCapability Shader
%10 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %whole "whole"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%_ptr_Function_float = OpTypePointer Function %float
%8 = OpConstantNull %float
%float_1_23000002 = OpConstant %float 1.23000002
%main = OpFunction %void None %1
%4 = OpLabel
%whole = OpVariable %_ptr_Function_float Function %8
%9 = OpExtInst %float %10 Modf %float_1_23000002 %whole
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,5 @@
[[stage(compute)]]
fn main() {
var whole : f32;
let frac : f32 = modf(1.230000019, &(whole));
}

View File

@@ -0,0 +1,43 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 31
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %m "m"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%11 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
%float_6 = OpConstant %float 6
%15 = OpConstantComposite %v3float %float_4 %float_5 %float_6
%float_7 = OpConstant %float 7
%float_8 = OpConstant %float 8
%float_9 = OpConstant %float 9
%19 = OpConstantComposite %v3float %float_7 %float_8 %float_9
%20 = OpConstantComposite %mat3v3float %11 %15 %19
%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
%23 = OpConstantNull %mat3v3float
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%_ptr_Function_v3float = OpTypePointer Function %v3float
%30 = OpConstantComposite %v3float %float_5 %float_5 %float_5
%main = OpFunction %void None %1
%4 = OpLabel
%m = OpVariable %_ptr_Function_mat3v3float Function %23
OpStore %m %20
%28 = OpAccessChain %_ptr_Function_v3float %m %int_1
OpStore %28 %30
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1 @@
SKIP: Failed to generate: error: pointers not supported in HLSL

View File

@@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol() {
float3x3 m = float3x3(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
m[1] = float3(5.0f, 5.0f, 5.0f);
return;
}

View File

@@ -0,0 +1,47 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %m "m"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
%float_0 = OpConstant %float 0
%9 = OpConstantComposite %v3float %float_0 %float_0 %float_0
%10 = OpConstantComposite %mat3v3float %9 %9 %9
%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
%13 = OpConstantNull %mat3v3float
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%17 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
%float_6 = OpConstant %float 6
%21 = OpConstantComposite %v3float %float_4 %float_5 %float_6
%float_7 = OpConstant %float 7
%float_8 = OpConstant %float 8
%float_9 = OpConstant %float 9
%25 = OpConstantComposite %v3float %float_7 %float_8 %float_9
%26 = OpConstantComposite %mat3v3float %17 %21 %25
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%_ptr_Function_v3float = OpTypePointer Function %v3float
%31 = OpConstantComposite %v3float %float_5 %float_5 %float_5
%main = OpFunction %void None %1
%4 = OpLabel
%m = OpVariable %_ptr_Function_mat3v3float Function %13
OpStore %m %10
OpStore %m %26
%30 = OpAccessChain %_ptr_Function_v3float %m %int_1
OpStore %30 %31
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,7 @@
[[stage(compute)]]
fn main() {
var m : mat3x3<f32> = mat3x3<f32>(vec3<f32>(0.0, 0.0, 0.0), vec3<f32>(0.0, 0.0, 0.0), vec3<f32>(0.0, 0.0, 0.0));
m = mat3x3<f32>(vec3<f32>(1.0, 2.0, 3.0), vec3<f32>(4.0, 5.0, 6.0), vec3<f32>(7.0, 8.0, 9.0));
m[1] = vec3<f32>(5.0, 5.0, 5.0);
return;
}

View File

@@ -0,0 +1,6 @@
[[stage(compute)]]
fn main() {
var m : mat3x3<f32> = mat3x3<f32>(vec3<f32>(1., 2., 3.), vec3<f32>(4., 5., 6.), vec3<f32>(7., 8., 9.));
let v : ptr<function, vec3<f32>> = &m[1];
*v = vec3<f32>(5., 5., 5.);
}

View File

@@ -0,0 +1 @@
SKIP: Failed to generate: error: pointers not supported in HLSL

View File

@@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol() {
float3x3 m = float3x3(float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f), float3(7.0f, 8.0f, 9.0f));
float3* const v = &(m[1]);
*(v) = float3(5.0f, 5.0f, 5.0f);
return;
}

View File

@@ -0,0 +1,43 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 31
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %m "m"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%mat3v3float = OpTypeMatrix %v3float 3
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%11 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%float_4 = OpConstant %float 4
%float_5 = OpConstant %float 5
%float_6 = OpConstant %float 6
%15 = OpConstantComposite %v3float %float_4 %float_5 %float_6
%float_7 = OpConstant %float 7
%float_8 = OpConstant %float 8
%float_9 = OpConstant %float 9
%19 = OpConstantComposite %v3float %float_7 %float_8 %float_9
%20 = OpConstantComposite %mat3v3float %11 %15 %19
%_ptr_Function_mat3v3float = OpTypePointer Function %mat3v3float
%23 = OpConstantNull %mat3v3float
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%_ptr_Function_v3float = OpTypePointer Function %v3float
%30 = OpConstantComposite %v3float %float_5 %float_5 %float_5
%main = OpFunction %void None %1
%4 = OpLabel
%m = OpVariable %_ptr_Function_mat3v3float Function %23
OpStore %m %20
%28 = OpAccessChain %_ptr_Function_v3float %m %int_1
OpStore %28 %30
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,6 @@
[[stage(compute)]]
fn main() {
var m : mat3x3<f32> = mat3x3<f32>(vec3<f32>(1.0, 2.0, 3.0), vec3<f32>(4.0, 5.0, 6.0), vec3<f32>(7.0, 8.0, 9.0));
let v : ptr<function, vec3<f32>> = &(m[1]);
*(v) = vec3<f32>(5.0, 5.0, 5.0);
}

View File

@@ -0,0 +1,33 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 21
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %v "v"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%10 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%_ptr_Function_v3float = OpTypePointer Function %v3float
%13 = OpConstantNull %v3float
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_ptr_Function_float = OpTypePointer Function %float
%float_5 = OpConstant %float 5
%main = OpFunction %void None %1
%4 = OpLabel
%v = OpVariable %_ptr_Function_v3float Function %13
OpStore %v %10
%18 = OpAccessChain %_ptr_Function_float %v %uint_1
OpStore %18 %float_5
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1 @@
SKIP: Failed to generate: error: pointers not supported in HLSL

View File

@@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol() {
float3 v = float3(0.0f, 0.0f, 0.0f);
v = float3(1.0f, 2.0f, 3.0f);
v.y = 5.0f;
return;
}

View File

@@ -0,0 +1,36 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 21
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %v "v"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%float_0 = OpConstant %float 0
%8 = OpConstantComposite %v3float %float_0 %float_0 %float_0
%_ptr_Function_v3float = OpTypePointer Function %v3float
%11 = OpConstantNull %v3float
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%15 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_ptr_Function_float = OpTypePointer Function %float
%float_5 = OpConstant %float 5
%main = OpFunction %void None %1
%4 = OpLabel
%v = OpVariable %_ptr_Function_v3float Function %11
OpStore %v %8
OpStore %v %15
%19 = OpAccessChain %_ptr_Function_float %v %uint_1
OpStore %19 %float_5
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,7 @@
[[stage(compute)]]
fn main() {
var v : vec3<f32> = vec3<f32>(0.0, 0.0, 0.0);
v = vec3<f32>(1.0, 2.0, 3.0);
v.y = 5.0;
return;
}

View File

@@ -0,0 +1,6 @@
[[stage(compute)]]
fn main() {
var v : vec3<f32> = vec3<f32>(1., 2., 3.);
let f : ptr<function, f32> = &v.y;
*f = 5.0;
}

View File

@@ -0,0 +1 @@
SKIP: Failed to generate: error: pointers not supported in HLSL

View File

@@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol() {
float3 v = float3(1.0f, 2.0f, 3.0f);
float* const f = &(v.y);
*(f) = 5.0f;
return;
}

View File

@@ -0,0 +1,33 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 21
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %v "v"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%10 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%_ptr_Function_v3float = OpTypePointer Function %v3float
%13 = OpConstantNull %v3float
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%_ptr_Function_float = OpTypePointer Function %float
%float_5 = OpConstant %float 5
%main = OpFunction %void None %1
%4 = OpLabel
%v = OpVariable %_ptr_Function_v3float Function %13
OpStore %v %10
%18 = OpAccessChain %_ptr_Function_float %v %uint_1
OpStore %18 %float_5
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,6 @@
[[stage(compute)]]
fn main() {
var v : vec3<f32> = vec3<f32>(1.0, 2.0, 3.0);
let f : ptr<function, f32> = &(v.y);
*(f) = 5.0;
}

View File

@@ -0,0 +1,15 @@
OpCapability Shader
OpMemoryModel Logical Simple
OpEntryPoint GLCompute %100 "main"
OpExecutionMode %100 LocalSize 1 1 1
%uint = OpTypeInt 32 0
%void = OpTypeVoid
%voidfn = OpTypeFunction %void
%ptr = OpTypePointer Function %uint
%100 = OpFunction %void None %voidfn
%entry = OpLabel
%10 = OpVariable %ptr Function
%1 = OpCopyObject %ptr %10
%2 = OpCopyObject %ptr %1
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1 @@
SKIP: error: pointers not supported in HLSL

View File

@@ -0,0 +1,10 @@
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol() {
uint x_10 = 0u;
uint* const x_1 = &(x_10);
uint* const x_2 = x_1;
return;
}

View File

@@ -0,0 +1,21 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 10
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %x_10 "x_10"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%_ptr_Function_uint = OpTypePointer Function %uint
%8 = OpConstantNull %uint
%main = OpFunction %void None %1
%4 = OpLabel
%x_10 = OpVariable %_ptr_Function_uint Function %8
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,7 @@
[[stage(compute)]]
fn main() {
var x_10 : u32;
let x_1 : ptr<function, u32> = &(x_10);
let x_2 : ptr<function, u32> = x_1;
return;
}

View File

@@ -0,0 +1,19 @@
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %I "I"
OpName %main "main"
%int = OpTypeInt 32 1
%_ptr_Private_int = OpTypePointer Private %int
%4 = OpConstantNull %int
%I = OpVariable %_ptr_Private_int Private %4
%void = OpTypeVoid
%5 = OpTypeFunction %void
%int_1 = OpConstant %int 1
%main = OpFunction %void None %5
%8 = OpLabel
%9 = OpLoad %int %I
%11 = OpIAdd %int %9 %int_1
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,9 @@
int I = 0;
[numthreads(1, 1, 1)]
void main() {
const int x_9 = I;
const int x_11 = (x_9 + 1);
return;
}

View File

@@ -0,0 +1 @@
SKIP: TINT_UNIMPLEMENTED crbug.com/tint/726: module-scope private and workgroup variables not yet implemented

View File

@@ -0,0 +1,24 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 12
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %I "I"
OpName %main "main"
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%_ptr_Private_int = OpTypePointer Private %int
%I = OpVariable %_ptr_Private_int Private %int_0
%void = OpTypeVoid
%5 = OpTypeFunction %void
%int_1 = OpConstant %int 1
%main = OpFunction %void None %5
%8 = OpLabel
%9 = OpLoad %int %I
%11 = OpIAdd %int %9 %int_1
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,8 @@
var<private> I : i32 = 0;
[[stage(compute)]]
fn main() {
let x_9 : i32 = I;
let x_11 : i32 = (x_9 + 1);
return;
}

View File

@@ -0,0 +1,7 @@
var<private> I : i32;
[[stage(compute)]]
fn main() {
let i : i32 = I;
let use : i32 = i + 1;
}

View File

@@ -0,0 +1,9 @@
int I;
[numthreads(1, 1, 1)]
void main() {
const int i = I;
const int use = (i + 1);
return;
}

View File

@@ -0,0 +1 @@
SKIP: TINT_UNIMPLEMENTED crbug.com/tint/726: module-scope private and workgroup variables not yet implemented

View File

@@ -0,0 +1,24 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 12
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %I "I"
OpName %main "main"
%int = OpTypeInt 32 1
%_ptr_Private_int = OpTypePointer Private %int
%4 = OpConstantNull %int
%I = OpVariable %_ptr_Private_int Private %4
%void = OpTypeVoid
%5 = OpTypeFunction %void
%int_1 = OpConstant %int 1
%main = OpFunction %void None %5
%8 = OpLabel
%9 = OpLoad %int %I
%11 = OpIAdd %int %9 %int_1
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,7 @@
var<private> I : i32;
[[stage(compute)]]
fn main() {
let i : i32 = I;
let use : i32 = (i + 1);
}

View File

@@ -0,0 +1,33 @@
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpSource GLSL 450
OpName %main "main"
OpName %i "i"
OpName %S "S"
OpMemberName %S 0 "i"
OpName %V "V"
OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize
%void = OpTypeVoid
%3 = OpTypeFunction %void
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%S = OpTypeStruct %int
%_ptr_Private_S = OpTypePointer Private %S
%V = OpVariable %_ptr_Private_S Private
%int_0 = OpConstant %int 0
%_ptr_Private_int = OpTypePointer Private %int
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%uint_1 = OpConstant %uint 1
%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
%main = OpFunction %void None %3
%5 = OpLabel
%i = OpVariable %_ptr_Function_int Function
%14 = OpAccessChain %_ptr_Private_int %V %int_0
%15 = OpLoad %int %14
OpStore %i %15
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1 @@
SKIP: error: pointers not supported in HLSL

View File

@@ -0,0 +1 @@
SKIP: TINT_UNIMPLEMENTED crbug.com/tint/726: module-scope private and workgroup variables not yet implemented

View File

@@ -0,0 +1,35 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 18
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %S "S"
OpMemberName %S 0 "i"
OpName %V "V"
OpName %main "main"
OpName %i "i"
OpMemberDecorate %S 0 Offset 0
%int = OpTypeInt 32 1
%S = OpTypeStruct %int
%_ptr_Private_S = OpTypePointer Private %S
%5 = OpConstantNull %S
%V = OpVariable %_ptr_Private_S Private %5
%void = OpTypeVoid
%6 = OpTypeFunction %void
%_ptr_Function_int = OpTypePointer Function %int
%12 = OpConstantNull %int
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_Private_int = OpTypePointer Private %int
%main = OpFunction %void None %6
%9 = OpLabel
%i = OpVariable %_ptr_Function_int Function %12
%16 = OpAccessChain %_ptr_Private_int %V %uint_0
%17 = OpLoad %int %16
OpStore %i %17
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,13 @@
struct S {
i : i32;
};
var<private> V : S;
[[stage(compute)]]
fn main() {
var i : i32;
let x_15 : i32 = V.i;
i = x_15;
return;
}

View File

@@ -0,0 +1,10 @@
struct S {
i : i32;
};
var<private> V : S;
[[stage(compute)]]
fn main() {
let i : i32 = V.i;
}

View File

@@ -0,0 +1,12 @@
struct S {
int i;
};
S V;
[numthreads(1, 1, 1)]
void main() {
const int i = V.i;
return;
}

View File

@@ -0,0 +1 @@
SKIP: TINT_UNIMPLEMENTED crbug.com/tint/726: module-scope private and workgroup variables not yet implemented

View File

@@ -0,0 +1,30 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 15
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %S "S"
OpMemberName %S 0 "i"
OpName %V "V"
OpName %main "main"
OpMemberDecorate %S 0 Offset 0
%int = OpTypeInt 32 1
%S = OpTypeStruct %int
%_ptr_Private_S = OpTypePointer Private %S
%5 = OpConstantNull %S
%V = OpVariable %_ptr_Private_S Private %5
%void = OpTypeVoid
%6 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_Private_int = OpTypePointer Private %int
%main = OpFunction %void None %6
%9 = OpLabel
%13 = OpAccessChain %_ptr_Private_int %V %uint_0
%14 = OpLoad %int %13
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,10 @@
struct S {
i : i32;
};
var<private> V : S;
[[stage(compute)]]
fn main() {
let i : i32 = V.i;
}

View File

@@ -0,0 +1,26 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 13
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %i "i"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_123 = OpConstant %int 123
%_ptr_Function_int = OpTypePointer Function %int
%9 = OpConstantNull %int
%int_1 = OpConstant %int 1
%main = OpFunction %void None %1
%4 = OpLabel
%i = OpVariable %_ptr_Function_int Function %9
OpStore %i %int_123
%10 = OpLoad %int %i
%12 = OpIAdd %int %10 %int_1
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,9 @@
[numthreads(1, 1, 1)]
void main() {
int i = 0;
i = 123;
const int x_10 = i;
const int x_12 = (x_10 + 1);
return;
}

View File

@@ -0,0 +1,11 @@
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol() {
int i = 0;
i = 123;
int const x_10 = i;
int const x_12 = (x_10 + 1);
return;
}

View File

@@ -0,0 +1,28 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 14
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %i "i"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%_ptr_Function_int = OpTypePointer Function %int
%9 = OpConstantNull %int
%int_123 = OpConstant %int 123
%int_1 = OpConstant %int 1
%main = OpFunction %void None %1
%4 = OpLabel
%i = OpVariable %_ptr_Function_int Function %9
OpStore %i %int_0
OpStore %i %int_123
%11 = OpLoad %int %i
%13 = OpIAdd %int %11 %int_1
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,8 @@
[[stage(compute)]]
fn main() {
var i : i32 = 0;
i = 123;
let x_10 : i32 = i;
let x_12 : i32 = (x_10 + 1);
return;
}

View File

@@ -0,0 +1,5 @@
[[stage(compute)]]
fn main() {
var i : i32 = 123;
let use : i32 = i + 1;
}

View File

@@ -0,0 +1,7 @@
[numthreads(1, 1, 1)]
void main() {
int i = 123;
const int use = (i + 1);
return;
}

View File

@@ -0,0 +1,9 @@
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol() {
int i = 123;
int const use = (i + 1);
return;
}

View File

@@ -0,0 +1,26 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 13
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %i "i"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_123 = OpConstant %int 123
%_ptr_Function_int = OpTypePointer Function %int
%9 = OpConstantNull %int
%int_1 = OpConstant %int 1
%main = OpFunction %void None %1
%4 = OpLabel
%i = OpVariable %_ptr_Function_int Function %9
OpStore %i %int_123
%10 = OpLoad %int %i
%12 = OpIAdd %int %10 %int_1
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,5 @@
[[stage(compute)]]
fn main() {
var i : i32 = 123;
let use : i32 = (i + 1);
}

View File

@@ -0,0 +1,32 @@
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpSource GLSL 450
OpName %main "main"
OpName %i "i"
OpName %S "S"
OpMemberName %S 0 "i"
OpName %V "V"
OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize
%void = OpTypeVoid
%3 = OpTypeFunction %void
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%S = OpTypeStruct %int
%_ptr_Function_S = OpTypePointer Function %S
%int_0 = OpConstant %int 0
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%uint_1 = OpConstant %uint 1
%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
%main = OpFunction %void None %3
%5 = OpLabel
%i = OpVariable %_ptr_Function_int Function
%V = OpVariable %_ptr_Function_S Function
%13 = OpAccessChain %_ptr_Function_int %V %int_0
%14 = OpLoad %int %13
OpStore %i %14
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,13 @@
struct S {
int i;
};
[numthreads(1, 1, 1)]
void main() {
int i = 0;
S V = {0};
const int x_14 = V.i;
i = x_14;
return;
}

View File

@@ -0,0 +1,15 @@
#include <metal_stdlib>
using namespace metal;
struct S {
int i;
};
kernel void tint_symbol() {
int i = 0;
S V = {};
int const x_14 = V.i;
i = x_14;
return;
}

View File

@@ -0,0 +1,34 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 17
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %i "i"
OpName %S "S"
OpMemberName %S 0 "i"
OpName %V "V"
OpMemberDecorate %S 0 Offset 0
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%8 = OpConstantNull %int
%S = OpTypeStruct %int
%_ptr_Function_S = OpTypePointer Function %S
%12 = OpConstantNull %S
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%main = OpFunction %void None %1
%4 = OpLabel
%i = OpVariable %_ptr_Function_int Function %8
%V = OpVariable %_ptr_Function_S Function %12
%15 = OpAccessChain %_ptr_Function_int %V %uint_0
%16 = OpLoad %int %15
OpStore %i %16
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,12 @@
struct S {
i : i32;
};
[[stage(compute)]]
fn main() {
var i : i32;
var V : S;
let x_14 : i32 = V.i;
i = x_14;
return;
}

View File

@@ -0,0 +1,10 @@
struct S {
i : i32;
};
[[stage(compute)]]
fn main() {
var V : S;
var i : i32 = V.i;
return;
}

View File

@@ -0,0 +1,11 @@
struct S {
int i;
};
[numthreads(1, 1, 1)]
void main() {
S V = {0};
int i = V.i;
return;
}

View File

@@ -0,0 +1,13 @@
#include <metal_stdlib>
using namespace metal;
struct S {
int i;
};
kernel void tint_symbol() {
S V = {};
int i = V.i;
return;
}

View File

@@ -0,0 +1,34 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 17
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %S "S"
OpMemberName %S 0 "i"
OpName %V "V"
OpName %i "i"
OpMemberDecorate %S 0 Offset 0
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%S = OpTypeStruct %int
%_ptr_Function_S = OpTypePointer Function %S
%9 = OpConstantNull %S
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_Function_int = OpTypePointer Function %int
%16 = OpConstantNull %int
%main = OpFunction %void None %1
%4 = OpLabel
%V = OpVariable %_ptr_Function_S Function %9
%i = OpVariable %_ptr_Function_int Function %16
%13 = OpAccessChain %_ptr_Function_int %V %uint_0
%14 = OpLoad %int %13
OpStore %i %14
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,10 @@
struct S {
i : i32;
};
[[stage(compute)]]
fn main() {
var V : S;
var i : i32 = V.i;
return;
}

View File

@@ -0,0 +1,37 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 21
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %func "func"
OpName %value "value"
OpName %pointer "pointer"
OpName %main "main"
OpName %i "i"
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%1 = OpTypeFunction %int %int %_ptr_Function_int
%void = OpTypeVoid
%11 = OpTypeFunction %void
%int_123 = OpConstant %int 123
%17 = OpConstantNull %int
%func = OpFunction %int None %1
%value = OpFunctionParameter %int
%pointer = OpFunctionParameter %_ptr_Function_int
%7 = OpLabel
%9 = OpLoad %int %pointer
%10 = OpIAdd %int %value %9
OpReturnValue %10
OpFunctionEnd
%main = OpFunction %void None %11
%14 = OpLabel
%i = OpVariable %_ptr_Function_int Function %17
OpStore %i %int_123
%19 = OpLoad %int %i
%18 = OpFunctionCall %int %func %19 %i
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1 @@
SKIP: error: pointers not supported in HLSL

View File

@@ -0,0 +1,16 @@
#include <metal_stdlib>
using namespace metal;
int func(int value, int* pointer) {
int const x_9 = *(pointer);
return (value + x_9);
}
kernel void tint_symbol() {
int i = 0;
i = 123;
int const x_19 = i;
int const x_18 = func(x_19, &(i));
return;
}

View File

@@ -0,0 +1,39 @@
; 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 %func "func"
OpName %value "value"
OpName %pointer "pointer"
OpName %main "main"
OpName %i "i"
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
%1 = OpTypeFunction %int %int %_ptr_Function_int
%void = OpTypeVoid
%11 = OpTypeFunction %void
%int_0 = OpConstant %int 0
%17 = OpConstantNull %int
%int_123 = OpConstant %int 123
%func = OpFunction %int None %1
%value = OpFunctionParameter %int
%pointer = OpFunctionParameter %_ptr_Function_int
%7 = OpLabel
%9 = OpLoad %int %pointer
%10 = OpIAdd %int %value %9
OpReturnValue %10
OpFunctionEnd
%main = OpFunction %void None %11
%14 = OpLabel
%i = OpVariable %_ptr_Function_int Function %17
OpStore %i %int_0
OpStore %i %int_123
%19 = OpLoad %int %i
%20 = OpFunctionCall %int %func %19 %i
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,13 @@
fn func(value : i32, pointer : ptr<function, i32>) -> i32 {
let x_9 : i32 = *(pointer);
return (value + x_9);
}
[[stage(compute)]]
fn main() {
var i : i32 = 0;
i = 123;
let x_19 : i32 = i;
let x_18 : i32 = func(x_19, &(i));
return;
}

View File

@@ -0,0 +1,9 @@
fn func(value : i32, pointer : ptr<function, i32>) -> i32 {
return value + *pointer;
}
[[stage(compute)]]
fn main() {
var i : i32 = 123;
let r : i32 = func(i, &i);
}

View File

@@ -0,0 +1 @@
SKIP: error: pointers not supported in HLSL

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