tint: Add builtin type aliases (vec3f, etc)

Fixed: tint:1772
Change-Id: I4bed36ded91ca5288875ed6ea819ff4bbb432186
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112340
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton
2022-12-01 13:41:56 +00:00
committed by Dawn LUCI CQ
parent 5798f2d021
commit d5d207ba9f
74 changed files with 943 additions and 18 deletions

View File

@@ -0,0 +1,10 @@
type a = vec3f;
fn f() {
{
const vec3f = 1;
const b = vec3f;
}
const c = a();
const d = vec3f();
}

View File

@@ -0,0 +1,10 @@
type a = vec3f;
fn f() {
{
const vec3f = 1;
const b = vec3f;
}
const c = a();
const d = vec3f();
}

View File

@@ -0,0 +1,10 @@
type a = vec3f;
fn f() {
{
let vec3f = 1;
let b = vec3f;
}
let c = a();
let d = vec3f();
}

View File

@@ -0,0 +1,13 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
void f() {
{
const int vec3f = 1;
const int b = vec3f;
}
const float3 c = (0.0f).xxx;
const float3 d = (0.0f).xxx;
}

View File

@@ -0,0 +1,13 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
void f() {
{
const int vec3f = 1;
const int b = vec3f;
}
const float3 c = (0.0f).xxx;
const float3 d = (0.0f).xxx;
}

View File

@@ -0,0 +1,15 @@
#version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
void f() {
{
int vec3f = 1;
int b = vec3f;
}
vec3 c = vec3(0.0f);
vec3 d = vec3(0.0f);
}

View File

@@ -0,0 +1,12 @@
#include <metal_stdlib>
using namespace metal;
void f() {
{
int const vec3f = 1;
int const b = vec3f;
}
float3 const c = float3(0.0f);
float3 const d = float3(0.0f);
}

View File

@@ -0,0 +1,26 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 12
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %unused_entry_point "unused_entry_point"
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%11 = OpConstantNull %v3float
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %1
%6 = OpLabel
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,10 @@
type a = vec3f;
fn f() {
{
let vec3f = 1;
let b = vec3f;
}
let c = a();
let d = vec3f();
}

View File

@@ -0,0 +1,3 @@
fn f(vec3f : vec3f) {
let b = vec3f;
}

View File

@@ -0,0 +1,8 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
void f(float3 vec3f) {
const float3 b = vec3f;
}

View File

@@ -0,0 +1,8 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
void f(float3 vec3f) {
const float3 b = vec3f;
}

View File

@@ -0,0 +1,10 @@
#version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
void f(vec3 vec3f) {
vec3 b = vec3f;
}

View File

@@ -0,0 +1,7 @@
#include <metal_stdlib>
using namespace metal;
void f(float3 vec3f) {
float3 const b = vec3f;
}

View File

@@ -0,0 +1,26 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 11
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %unused_entry_point "unused_entry_point"
OpName %f "f"
OpName %vec3f "vec3f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%5 = OpTypeFunction %void %v3float
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %5
%vec3f = OpFunctionParameter %v3float
%10 = OpLabel
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,3 @@
fn f(vec3f : vec3f) {
let b = vec3f;
}

View File

@@ -0,0 +1,10 @@
type a = vec3f;
fn f() {
{
var vec3f = 1;
var b = vec3f;
}
var c = a();
var d = vec3f();
}

View File

@@ -0,0 +1,13 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
void f() {
{
int vec3f = 1;
int b = vec3f;
}
float3 c = (0.0f).xxx;
float3 d = (0.0f).xxx;
}

View File

@@ -0,0 +1,13 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
void f() {
{
int vec3f = 1;
int b = vec3f;
}
float3 c = (0.0f).xxx;
float3 d = (0.0f).xxx;
}

View File

@@ -0,0 +1,15 @@
#version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
void f() {
{
int vec3f = 1;
int b = vec3f;
}
vec3 c = vec3(0.0f);
vec3 d = vec3(0.0f);
}

View File

@@ -0,0 +1,12 @@
#include <metal_stdlib>
using namespace metal;
void f() {
{
int vec3f = 1;
int b = vec3f;
}
float3 c = float3(0.0f);
float3 d = float3(0.0f);
}

View File

@@ -0,0 +1,42 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 20
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %unused_entry_point "unused_entry_point"
OpName %f "f"
OpName %vec3f "vec3f"
OpName %b "b"
OpName %c "c"
OpName %d "d"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%_ptr_Function_int = OpTypePointer Function %int
%11 = OpConstantNull %int
%float = OpTypeFloat 32
%v3float = OpTypeVector %float 3
%16 = OpConstantNull %v3float
%_ptr_Function_v3float = OpTypePointer Function %v3float
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %1
%6 = OpLabel
%vec3f = OpVariable %_ptr_Function_int Function %11
%b = OpVariable %_ptr_Function_int Function %11
%c = OpVariable %_ptr_Function_v3float Function %16
%d = OpVariable %_ptr_Function_v3float Function %16
OpStore %vec3f %int_1
%12 = OpLoad %int %vec3f
OpStore %b %12
OpStore %c %16
OpStore %d %16
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,10 @@
type a = vec3f;
fn f() {
{
var vec3f = 1;
var b = vec3f;
}
var c = a();
var d = vec3f();
}

View File

@@ -0,0 +1,9 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
void f() {
{
}
}

View File

@@ -0,0 +1,9 @@
[numthreads(1, 1, 1)]
void unused_entry_point() {
return;
}
void f() {
{
}
}

View File

@@ -0,0 +1,11 @@
#version 310 es
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void unused_entry_point() {
return;
}
void f() {
{
}
}

View File

@@ -0,0 +1,8 @@
#include <metal_stdlib>
using namespace metal;
void f() {
{
}
}

View File

@@ -0,0 +1,21 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 7
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
OpName %unused_entry_point "unused_entry_point"
OpName %f "f"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%unused_entry_point = OpFunction %void None %1
%4 = OpLabel
OpReturn
OpFunctionEnd
%f = OpFunction %void None %1
%6 = OpLabel
OpReturn
OpFunctionEnd