Add test case for tint:219

The original problem appears to be fixed.

Fixed: tint:219
Change-Id: I8d16fbb715da3ca149769699c86f86a4bed85b4f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57703
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Ben Clayton 2021-07-13 16:41:56 +00:00 committed by Tint LUCI CQ
parent 4166eccb70
commit f6a4fe073a
5 changed files with 122 additions and 0 deletions

30
test/bug/tint/219.spvasm Normal file
View File

@ -0,0 +1,30 @@
OpCapability Shader
OpMemoryModel Logical Simple
OpEntryPoint GLCompute %100 "main"
OpExecutionMode %100 LocalSize 1 1 1
%void = OpTypeVoid
%voidfn = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%ptr_v2f = OpTypePointer Function %v2float
%ptr_f = OpTypePointer Function %float
%floatfn = OpTypeFunction %float %ptr_v2f
%200 = OpFunction %float None %floatfn
%201 = OpFunctionParameter %ptr_v2f
%210 = OpLabel
%211 = OpAccessChain %ptr_f %201 %uint_0
%212 = OpLoad %float %211
OpReturnValue %212
OpFunctionEnd
%100 = OpFunction %void None %voidfn
%10 = OpLabel
%11 = OpVariable %ptr_v2f Function
%f = OpFunctionCall %float %200 %11
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,16 @@
float x_200(inout float2 x_201) {
const float x_212 = x_201.x;
return x_212;
}
void main_1() {
float2 x_11 = float2(0.0f, 0.0f);
const float x_12 = x_200(x_11);
return;
}
[numthreads(1, 1, 1)]
void main() {
main_1();
return;
}

View File

@ -0,0 +1,19 @@
#include <metal_stdlib>
using namespace metal;
float x_200(thread float2* const x_201) {
float const x_212 = (*(x_201)).x;
return x_212;
}
void main_1() {
float2 x_11 = 0.0f;
float const x_12 = x_200(&(x_11));
return;
}
kernel void tint_symbol() {
main_1();
return;
}

View File

@ -0,0 +1,42 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 25
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %x_200 "x_200"
OpName %x_201 "x_201"
OpName %main_1 "main_1"
OpName %x_11 "x_11"
OpName %main "main"
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%_ptr_Function_v2float = OpTypePointer Function %v2float
%1 = OpTypeFunction %float %_ptr_Function_v2float
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_Function_float = OpTypePointer Function %float
%void = OpTypeVoid
%14 = OpTypeFunction %void
%19 = OpConstantNull %v2float
%x_200 = OpFunction %float None %1
%x_201 = OpFunctionParameter %_ptr_Function_v2float
%7 = OpLabel
%12 = OpAccessChain %_ptr_Function_float %x_201 %uint_0
%13 = OpLoad %float %12
OpReturnValue %13
OpFunctionEnd
%main_1 = OpFunction %void None %14
%17 = OpLabel
%x_11 = OpVariable %_ptr_Function_v2float Function %19
%20 = OpFunctionCall %float %x_200 %x_11
OpReturn
OpFunctionEnd
%main = OpFunction %void None %14
%23 = OpLabel
%24 = OpFunctionCall %void %main_1
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,15 @@
fn x_200(x_201 : ptr<function, vec2<f32>>) -> f32 {
let x_212 : f32 = (*(x_201)).x;
return x_212;
}
fn main_1() {
var x_11 : vec2<f32>;
let x_12 : f32 = x_200(&(x_11));
return;
}
[[stage(compute), workgroup_size(1, 1, 1)]]
fn main() {
main_1();
}