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

@@ -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

View File

@@ -0,0 +1,13 @@
#include <metal_stdlib>
using namespace metal;
int func(int value, int* pointer) {
return (value + *(pointer));
}
kernel void tint_symbol() {
int i = 123;
int const r = func(i, &(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,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,29 @@
; 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 %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_123 = OpConstant %int 123
%int_100 = OpConstant %int 100
%int_20 = OpConstant %int 20
%int_3 = OpConstant %int 3
%main = OpFunction %void None %5
%8 = OpLabel
OpStore %I %int_123
%12 = OpIAdd %int %int_100 %int_20
%14 = OpIAdd %int %12 %int_3
OpStore %I %14
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,9 @@
int I = 0;
[numthreads(1, 1, 1)]
void main() {
I = 123;
I = ((100 + 20) + 3);
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,29 @@
; 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 %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_123 = OpConstant %int 123
%int_100 = OpConstant %int 100
%int_20 = OpConstant %int 20
%int_3 = OpConstant %int 3
%main = OpFunction %void None %5
%8 = OpLabel
OpStore %I %int_123
%12 = OpIAdd %int %int_100 %int_20
%14 = OpIAdd %int %12 %int_3
OpStore %I %14
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,8 @@
var<private> I : i32 = 0;
[[stage(compute)]]
fn main() {
I = 123;
I = ((100 + 20) + 3);
return;
}

View File

@@ -0,0 +1,7 @@
var<private> I : i32;
[[stage(compute)]]
fn main() {
I = 123; // constant
I = 100 + 20 + 3; // dynamic
}

View File

@@ -0,0 +1,9 @@
int I;
[numthreads(1, 1, 1)]
void main() {
I = 123;
I = ((100 + 20) + 3);
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,29 @@
; 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 %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_123 = OpConstant %int 123
%int_100 = OpConstant %int 100
%int_20 = OpConstant %int 20
%int_3 = OpConstant %int 3
%main = OpFunction %void None %5
%8 = OpLabel
OpStore %I %int_123
%12 = OpIAdd %int %int_100 %int_20
%14 = OpIAdd %int %12 %int_3
OpStore %I %14
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,7 @@
var<private> I : i32;
[[stage(compute)]]
fn main() {
I = 123;
I = ((100 + 20) + 3);
}

View File

@@ -0,0 +1,30 @@
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 %S "S"
OpMemberName %S 0 "i"
OpName %V "V"
OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize
%void = OpTypeVoid
%3 = OpTypeFunction %void
%int = OpTypeInt 32 1
%S = OpTypeStruct %int
%_ptr_Private_S = OpTypePointer Private %S
%V = OpVariable %_ptr_Private_S Private
%int_0 = OpConstant %int 0
%int_5 = OpConstant %int 5
%_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
%13 = OpAccessChain %_ptr_Private_int %V %int_0
OpStore %13 %int_5
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,31 @@
; 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
%int_5 = OpConstant %int 5
%main = OpFunction %void None %6
%9 = OpLabel
%13 = OpAccessChain %_ptr_Private_int %V %uint_0
OpStore %13 %int_5
OpReturn
OpFunctionEnd

View File

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

View File

@@ -0,0 +1,30 @@
; 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 %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_100 = OpConstant %int 100
%int_20 = OpConstant %int 20
%int_3 = OpConstant %int 3
%main = OpFunction %void None %1
%4 = OpLabel
%i = OpVariable %_ptr_Function_int Function %9
OpStore %i %int_123
OpStore %i %int_123
%15 = OpIAdd %int %int_100 %int_20
%17 = OpIAdd %int %15 %int_3
OpStore %i %17
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,9 @@
[numthreads(1, 1, 1)]
void main() {
int i = 0;
i = 123;
i = 123;
i = ((100 + 20) + 3);
return;
}

View File

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

View File

@@ -0,0 +1,32 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 16
; 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_100 = OpConstant %int 100
%int_20 = OpConstant %int 20
%int_3 = OpConstant %int 3
%main = OpFunction %void None %1
%4 = OpLabel
%i = OpVariable %_ptr_Function_int Function %9
OpStore %i %int_0
OpStore %i %int_123
OpStore %i %int_123
%13 = OpIAdd %int %int_100 %int_20
%15 = OpIAdd %int %13 %int_3
OpStore %i %15
OpReturn
OpFunctionEnd

View File

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

View File

@@ -0,0 +1,7 @@
[[stage(compute)]]
fn main() {
var i : i32 = 123;
let p : ptr<function, i32> = &i;
*p = 123; // constant
*p = 100 + 20 + 3; // dynamic
}

View File

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

View File

@@ -0,0 +1,11 @@
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol() {
int i = 123;
int* const p = &(i);
*(p) = 123;
*(p) = ((100 + 20) + 3);
return;
}

View File

@@ -0,0 +1,30 @@
; 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 %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_100 = OpConstant %int 100
%int_20 = OpConstant %int 20
%int_3 = OpConstant %int 3
%main = OpFunction %void None %1
%4 = OpLabel
%i = OpVariable %_ptr_Function_int Function %9
OpStore %i %int_123
OpStore %i %int_123
%15 = OpIAdd %int %int_100 %int_20
%17 = OpIAdd %int %15 %int_3
OpStore %i %17
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,7 @@
[[stage(compute)]]
fn main() {
var i : i32 = 123;
let p : ptr<function, i32> = &(i);
*(p) = 123;
*(p) = ((100 + 20) + 3);
}

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