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,7 +1,12 @@
[numthreads(1, 1, 1)]
void main() {
void main_1() {
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;
}
[numthreads(1, 1, 1)]
void main() {
main_1();
return;
}

View File

@@ -1,10 +1,15 @@
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol() {
void main_1() {
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;
}
kernel void tint_symbol() {
main_1();
return;
}

View File

@@ -1,14 +1,15 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Bound: 35
; 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 %m "m"
OpName %main "main"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
@@ -36,7 +37,7 @@
%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
%main_1 = OpFunction %void None %1
%4 = OpLabel
%m = OpVariable %_ptr_Function_mat3v3float Function %13
OpStore %m %10
@@ -45,3 +46,8 @@
OpStore %30 %31
OpReturn
OpFunctionEnd
%main = OpFunction %void None %1
%33 = OpLabel
%34 = OpFunctionCall %void %main_1
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,11 @@
[[stage(compute)]]
fn main() {
fn main_1() {
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;
}
[[stage(compute)]]
fn main() {
main_1();
}

View File

@@ -1,7 +1,12 @@
[numthreads(1, 1, 1)]
void main() {
void main_1() {
float3 v = float3(0.0f, 0.0f, 0.0f);
v = float3(1.0f, 2.0f, 3.0f);
v.y = 5.0f;
return;
}
[numthreads(1, 1, 1)]
void main() {
main_1();
return;
}

View File

@@ -1,10 +1,15 @@
#include <metal_stdlib>
using namespace metal;
kernel void tint_symbol() {
void main_1() {
float3 v = float3(0.0f, 0.0f, 0.0f);
v = float3(1.0f, 2.0f, 3.0f);
v.y = 5.0f;
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: 21
; Bound: 24
; 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 %v "v"
OpName %main "main"
%void = OpTypeVoid
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
@@ -25,7 +26,7 @@
%uint_1 = OpConstant %uint 1
%_ptr_Function_float = OpTypePointer Function %float
%float_5 = OpConstant %float 5
%main = OpFunction %void None %1
%main_1 = OpFunction %void None %1
%4 = OpLabel
%v = OpVariable %_ptr_Function_v3float Function %11
OpStore %v %8
@@ -34,3 +35,8 @@
OpStore %19 %float_5
OpReturn
OpFunctionEnd
%main = OpFunction %void None %1
%22 = OpLabel
%23 = OpFunctionCall %void %main_1
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,11 @@
[[stage(compute)]]
fn main() {
fn main_1() {
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;
}
[[stage(compute)]]
fn main() {
main_1();
}