spirv-reader: switch to HLSL-style pipeline IO

- When storing to sample_mask output, write to the 0th element
- Only make a return struct if it has members
- Adjust type signedness coercion when loading special builtins.
- Adapt tests

- Update expectations for end-to-end tests

- Handle sample_mask with stride
  Input variables normally don't have layout. But they can have it
  up through SPIR-V 1.4.
  Handle this case in the SPIR-V reader, by seeing through the
  intermediate alias type created for the strided array type.

Bug: tint:508
Change-Id: I0f19dc1305d3f250dbbc0698a602288c34245274
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54743
Auto-Submit: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
David Neto
2021-06-17 09:10:04 +00:00
committed by Tint LUCI CQ
parent c932b5535f
commit 1e19b55d19
102 changed files with 6487 additions and 3194 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -5,7 +5,7 @@ struct S {
int i;
};
kernel void tint_symbol() {
void main_1() {
int i = 0;
S V = {};
int const x_14 = V.i;
@@ -13,3 +13,8 @@ kernel void tint_symbol() {
return;
}
kernel void tint_symbol() {
main_1();
return;
}

View File

@@ -1,17 +1,18 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 17
; Bound: 20
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %main "main"
OpName %main_1 "main_1"
OpName %i "i"
OpName %S "S"
OpMemberName %S 0 "i"
OpName %V "V"
OpName %main "main"
OpMemberDecorate %S 0 Offset 0
%void = OpTypeVoid
%1 = OpTypeFunction %void
@@ -23,7 +24,7 @@
%12 = OpConstantNull %S
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%main = OpFunction %void None %1
%main_1 = OpFunction %void None %1
%4 = OpLabel
%i = OpVariable %_ptr_Function_int Function %8
%V = OpVariable %_ptr_Function_S Function %12
@@ -32,3 +33,8 @@
OpStore %i %16
OpReturn
OpFunctionEnd
%main = OpFunction %void None %1
%18 = OpLabel
%19 = OpFunctionCall %void %main_1
OpReturn
OpFunctionEnd

View File

@@ -2,11 +2,15 @@ struct S {
i : i32;
};
[[stage(compute)]]
fn main() {
fn main_1() {
var i : i32;
var V : S;
let x_14 : i32 = V.i;
i = x_14;
return;
}
[[stage(compute)]]
fn main() {
main_1();
}