mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-10 14:08:04 +00:00
test: Shuffle files around.
In an attempt to better follow the guidelines in docs/end-to-end-tests.md. Change-Id: Id012004e8a376598bb69cf364ca7ca0735632a2e Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/69342 Reviewed-by: Antonio Maiorano <amaiorano@google.com> Reviewed-by: James Price <jrprice@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
24
test/let/global/global.wgsl
Normal file
24
test/let/global/global.wgsl
Normal file
@@ -0,0 +1,24 @@
|
||||
struct MyStruct {
|
||||
f1 : f32;
|
||||
};
|
||||
|
||||
type MyArray = array<f32, 10>;
|
||||
|
||||
// Global lets
|
||||
let v1 = 1;
|
||||
let v2 = 1u;
|
||||
let v3 = 1.0;
|
||||
|
||||
let v4 = vec3<i32>(1, 1, 1);
|
||||
let v5 = vec3<u32>(1u, 1u, 1u);
|
||||
let v6 = vec3<f32>(1.0, 1.0, 1.0);
|
||||
|
||||
let v7 = mat3x3<f32>(vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0));
|
||||
|
||||
let v8 = MyStruct();
|
||||
let v9 = MyArray();
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn main() -> [[location(0)]] vec4<f32> {
|
||||
return vec4<f32>(0.0,0.0,0.0,0.0);
|
||||
}
|
||||
28
test/let/global/global.wgsl.expected.hlsl
Normal file
28
test/let/global/global.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,28 @@
|
||||
struct MyStruct {
|
||||
float f1;
|
||||
};
|
||||
|
||||
static const int v1 = 1;
|
||||
static const uint v2 = 1u;
|
||||
static const float v3 = 1.0f;
|
||||
static const int3 v4 = int3(1, 1, 1);
|
||||
static const uint3 v5 = uint3(1u, 1u, 1u);
|
||||
static const float3 v6 = float3(1.0f, 1.0f, 1.0f);
|
||||
static const float3x3 v7 = float3x3(float3(1.0f, 1.0f, 1.0f), float3(1.0f, 1.0f, 1.0f), float3(1.0f, 1.0f, 1.0f));
|
||||
static const MyStruct v8 = (MyStruct)0;
|
||||
static const float v9[10] = (float[10])0;
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main_inner() {
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol main() {
|
||||
const float4 inner_result = main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
33
test/let/global/global.wgsl.expected.msl
Normal file
33
test/let/global/global.wgsl.expected.msl
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct MyStruct {
|
||||
float f1;
|
||||
};
|
||||
struct tint_array_wrapper {
|
||||
float arr[10];
|
||||
};
|
||||
struct tint_symbol_1 {
|
||||
float4 value [[color(0)]];
|
||||
};
|
||||
|
||||
constant int v1 = 1;
|
||||
constant uint v2 = 1u;
|
||||
constant float v3 = 1.0f;
|
||||
constant int3 v4 = int3(1, 1, 1);
|
||||
constant uint3 v5 = uint3(1u, 1u, 1u);
|
||||
constant float3 v6 = float3(1.0f, 1.0f, 1.0f);
|
||||
constant float3x3 v7 = float3x3(float3(1.0f, 1.0f, 1.0f), float3(1.0f, 1.0f, 1.0f), float3(1.0f, 1.0f, 1.0f));
|
||||
constant MyStruct v8 = {};
|
||||
constant tint_array_wrapper v9 = {.arr={}};
|
||||
float4 tint_symbol_inner() {
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
fragment tint_symbol_1 tint_symbol() {
|
||||
float4 const inner_result = tint_symbol_inner();
|
||||
tint_symbol_1 wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
64
test/let/global/global.wgsl.expected.spvasm
Normal file
64
test/let/global/global.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,64 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 34
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %value
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %value "value"
|
||||
OpName %v1 "v1"
|
||||
OpName %v2 "v2"
|
||||
OpName %v3 "v3"
|
||||
OpName %v4 "v4"
|
||||
OpName %v5 "v5"
|
||||
OpName %v6 "v6"
|
||||
OpName %v7 "v7"
|
||||
OpName %MyStruct "MyStruct"
|
||||
OpMemberName %MyStruct 0 "f1"
|
||||
OpName %v8 "v8"
|
||||
OpName %v9 "v9"
|
||||
OpName %main_inner "main_inner"
|
||||
OpName %main "main"
|
||||
OpDecorate %value Location 0
|
||||
OpMemberDecorate %MyStruct 0 Offset 0
|
||||
OpDecorate %_arr_float_uint_10 ArrayStride 4
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%int = OpTypeInt 32 1
|
||||
%v1 = OpConstant %int 1
|
||||
%uint = OpTypeInt 32 0
|
||||
%v2 = OpConstant %uint 1
|
||||
%v3 = OpConstant %float 1
|
||||
%v3int = OpTypeVector %int 3
|
||||
%v4 = OpConstantComposite %v3int %v1 %v1 %v1
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%v5 = OpConstantComposite %v3uint %v2 %v2 %v2
|
||||
%v3float = OpTypeVector %float 3
|
||||
%v6 = OpConstantComposite %v3float %v3 %v3 %v3
|
||||
%mat3v3float = OpTypeMatrix %v3float 3
|
||||
%v7 = OpConstantComposite %mat3v3float %v6 %v6 %v6
|
||||
%MyStruct = OpTypeStruct %float
|
||||
%v8 = OpConstantNull %MyStruct
|
||||
%uint_10 = OpConstant %uint 10
|
||||
%_arr_float_uint_10 = OpTypeArray %float %uint_10
|
||||
%v9 = OpConstantNull %_arr_float_uint_10
|
||||
%24 = OpTypeFunction %v4float
|
||||
%float_0 = OpConstant %float 0
|
||||
%28 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
|
||||
%void = OpTypeVoid
|
||||
%29 = OpTypeFunction %void
|
||||
%main_inner = OpFunction %v4float None %24
|
||||
%26 = OpLabel
|
||||
OpReturnValue %28
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %29
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %v4float %main_inner
|
||||
OpStore %value %33
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
28
test/let/global/global.wgsl.expected.wgsl
Normal file
28
test/let/global/global.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,28 @@
|
||||
struct MyStruct {
|
||||
f1 : f32;
|
||||
};
|
||||
|
||||
type MyArray = array<f32, 10>;
|
||||
|
||||
let v1 = 1;
|
||||
|
||||
let v2 = 1u;
|
||||
|
||||
let v3 = 1.0;
|
||||
|
||||
let v4 = vec3<i32>(1, 1, 1);
|
||||
|
||||
let v5 = vec3<u32>(1u, 1u, 1u);
|
||||
|
||||
let v6 = vec3<f32>(1.0, 1.0, 1.0);
|
||||
|
||||
let v7 = mat3x3<f32>(vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0), vec3<f32>(1.0, 1.0, 1.0));
|
||||
|
||||
let v8 = MyStruct();
|
||||
|
||||
let v9 = MyArray();
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn main() -> [[location(0)]] vec4<f32> {
|
||||
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
39
test/let/inferred/function.wgsl
Normal file
39
test/let/inferred/function.wgsl
Normal file
@@ -0,0 +1,39 @@
|
||||
struct MyStruct {
|
||||
f1 : f32;
|
||||
};
|
||||
|
||||
type MyArray = array<f32, 10>;
|
||||
|
||||
fn ret_i32() -> i32 { return 1; }
|
||||
fn ret_u32() -> u32 { return 1u; }
|
||||
fn ret_f32() -> f32 { return 1.0; }
|
||||
fn ret_MyStruct() -> MyStruct { return MyStruct(); }
|
||||
fn ret_MyArray() -> MyArray { return MyArray(); }
|
||||
|
||||
// Local lets
|
||||
fn let_decls() {
|
||||
let v1 = 1;
|
||||
let v2 = 1u;
|
||||
let v3 = 1.0;
|
||||
|
||||
let v4 = vec3<i32>(1, 1, 1);
|
||||
let v5 = vec3<u32>(1u, 1u, 1u);
|
||||
let v6 = vec3<f32>(1.0, 1.0, 1.0);
|
||||
|
||||
let v7 = mat3x3<f32>(v6, v6, v6);
|
||||
|
||||
let v8 = MyStruct(1.0);
|
||||
let v9 = MyArray();
|
||||
|
||||
let v10 = ret_i32();
|
||||
let v11 = ret_u32();
|
||||
let v12 = ret_f32();
|
||||
let v13 = ret_MyStruct();
|
||||
let v14 = ret_MyStruct();
|
||||
let v15 = ret_MyArray();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn main() -> [[location(0)]] vec4<f32> {
|
||||
return vec4<f32>(0.0,0.0,0.0,0.0);
|
||||
}
|
||||
59
test/let/inferred/function.wgsl.expected.hlsl
Normal file
59
test/let/inferred/function.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,59 @@
|
||||
struct MyStruct {
|
||||
float f1;
|
||||
};
|
||||
|
||||
int ret_i32() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint ret_u32() {
|
||||
return 1u;
|
||||
}
|
||||
|
||||
float ret_f32() {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
MyStruct ret_MyStruct() {
|
||||
const MyStruct tint_symbol_1 = (MyStruct)0;
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
typedef float ret_MyArray_ret[10];
|
||||
ret_MyArray_ret ret_MyArray() {
|
||||
const float tint_symbol_2[10] = (float[10])0;
|
||||
return tint_symbol_2;
|
||||
}
|
||||
|
||||
void let_decls() {
|
||||
const int v1 = 1;
|
||||
const uint v2 = 1u;
|
||||
const float v3 = 1.0f;
|
||||
const int3 v4 = int3(1, 1, 1);
|
||||
const uint3 v5 = uint3(1u, 1u, 1u);
|
||||
const float3 v6 = float3(1.0f, 1.0f, 1.0f);
|
||||
const float3x3 v7 = float3x3(v6, v6, v6);
|
||||
const MyStruct v8 = {1.0f};
|
||||
const float v9[10] = (float[10])0;
|
||||
const int v10 = ret_i32();
|
||||
const uint v11 = ret_u32();
|
||||
const float v12 = ret_f32();
|
||||
const MyStruct v13 = ret_MyStruct();
|
||||
const MyStruct v14 = ret_MyStruct();
|
||||
const float v15[10] = ret_MyArray();
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Target0;
|
||||
};
|
||||
|
||||
float4 main_inner() {
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol main() {
|
||||
const float4 inner_result = main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
64
test/let/inferred/function.wgsl.expected.msl
Normal file
64
test/let/inferred/function.wgsl.expected.msl
Normal file
@@ -0,0 +1,64 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct MyStruct {
|
||||
float f1;
|
||||
};
|
||||
struct tint_array_wrapper {
|
||||
float arr[10];
|
||||
};
|
||||
struct tint_symbol_1 {
|
||||
float4 value [[color(0)]];
|
||||
};
|
||||
|
||||
int ret_i32() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint ret_u32() {
|
||||
return 1u;
|
||||
}
|
||||
|
||||
float ret_f32() {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
MyStruct ret_MyStruct() {
|
||||
MyStruct const tint_symbol_2 = {};
|
||||
return tint_symbol_2;
|
||||
}
|
||||
|
||||
tint_array_wrapper ret_MyArray() {
|
||||
tint_array_wrapper const tint_symbol_3 = {.arr={}};
|
||||
return tint_symbol_3;
|
||||
}
|
||||
|
||||
void let_decls() {
|
||||
int const v1 = 1;
|
||||
uint const v2 = 1u;
|
||||
float const v3 = 1.0f;
|
||||
int3 const v4 = int3(1, 1, 1);
|
||||
uint3 const v5 = uint3(1u, 1u, 1u);
|
||||
float3 const v6 = float3(1.0f, 1.0f, 1.0f);
|
||||
float3x3 const v7 = float3x3(v6, v6, v6);
|
||||
MyStruct const v8 = {.f1=1.0f};
|
||||
tint_array_wrapper const v9 = {.arr={}};
|
||||
int const v10 = ret_i32();
|
||||
uint const v11 = ret_u32();
|
||||
float const v12 = ret_f32();
|
||||
MyStruct const v13 = ret_MyStruct();
|
||||
MyStruct const v14 = ret_MyStruct();
|
||||
tint_array_wrapper const v15 = ret_MyArray();
|
||||
}
|
||||
|
||||
float4 tint_symbol_inner() {
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
fragment tint_symbol_1 tint_symbol() {
|
||||
float4 const inner_result = tint_symbol_inner();
|
||||
tint_symbol_1 wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
97
test/let/inferred/function.wgsl.expected.spvasm
Normal file
97
test/let/inferred/function.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,97 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 58
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main" %value
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %value "value"
|
||||
OpName %ret_i32 "ret_i32"
|
||||
OpName %ret_u32 "ret_u32"
|
||||
OpName %ret_f32 "ret_f32"
|
||||
OpName %MyStruct "MyStruct"
|
||||
OpMemberName %MyStruct 0 "f1"
|
||||
OpName %ret_MyStruct "ret_MyStruct"
|
||||
OpName %ret_MyArray "ret_MyArray"
|
||||
OpName %let_decls "let_decls"
|
||||
OpName %main_inner "main_inner"
|
||||
OpName %main "main"
|
||||
OpDecorate %value Location 0
|
||||
OpMemberDecorate %MyStruct 0 Offset 0
|
||||
OpDecorate %_arr_float_uint_10 ArrayStride 4
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%int = OpTypeInt 32 1
|
||||
%6 = OpTypeFunction %int
|
||||
%int_1 = OpConstant %int 1
|
||||
%uint = OpTypeInt 32 0
|
||||
%11 = OpTypeFunction %uint
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%16 = OpTypeFunction %float
|
||||
%float_1 = OpConstant %float 1
|
||||
%MyStruct = OpTypeStruct %float
|
||||
%20 = OpTypeFunction %MyStruct
|
||||
%24 = OpConstantNull %MyStruct
|
||||
%uint_10 = OpConstant %uint 10
|
||||
%_arr_float_uint_10 = OpTypeArray %float %uint_10
|
||||
%25 = OpTypeFunction %_arr_float_uint_10
|
||||
%30 = OpConstantNull %_arr_float_uint_10
|
||||
%void = OpTypeVoid
|
||||
%31 = OpTypeFunction %void
|
||||
%v3int = OpTypeVector %int 3
|
||||
%36 = OpConstantComposite %v3int %int_1 %int_1 %int_1
|
||||
%v3uint = OpTypeVector %uint 3
|
||||
%38 = OpConstantComposite %v3uint %uint_1 %uint_1 %uint_1
|
||||
%v3float = OpTypeVector %float 3
|
||||
%40 = OpConstantComposite %v3float %float_1 %float_1 %float_1
|
||||
%mat3v3float = OpTypeMatrix %v3float 3
|
||||
%43 = OpConstantComposite %MyStruct %float_1
|
||||
%50 = OpTypeFunction %v4float
|
||||
%float_0 = OpConstant %float 0
|
||||
%54 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0
|
||||
%ret_i32 = OpFunction %int None %6
|
||||
%9 = OpLabel
|
||||
OpReturnValue %int_1
|
||||
OpFunctionEnd
|
||||
%ret_u32 = OpFunction %uint None %11
|
||||
%14 = OpLabel
|
||||
OpReturnValue %uint_1
|
||||
OpFunctionEnd
|
||||
%ret_f32 = OpFunction %float None %16
|
||||
%18 = OpLabel
|
||||
OpReturnValue %float_1
|
||||
OpFunctionEnd
|
||||
%ret_MyStruct = OpFunction %MyStruct None %20
|
||||
%23 = OpLabel
|
||||
OpReturnValue %24
|
||||
OpFunctionEnd
|
||||
%ret_MyArray = OpFunction %_arr_float_uint_10 None %25
|
||||
%29 = OpLabel
|
||||
OpReturnValue %30
|
||||
OpFunctionEnd
|
||||
%let_decls = OpFunction %void None %31
|
||||
%34 = OpLabel
|
||||
%42 = OpCompositeConstruct %mat3v3float %40 %40 %40
|
||||
%44 = OpFunctionCall %int %ret_i32
|
||||
%45 = OpFunctionCall %uint %ret_u32
|
||||
%46 = OpFunctionCall %float %ret_f32
|
||||
%47 = OpFunctionCall %MyStruct %ret_MyStruct
|
||||
%48 = OpFunctionCall %MyStruct %ret_MyStruct
|
||||
%49 = OpFunctionCall %_arr_float_uint_10 %ret_MyArray
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%main_inner = OpFunction %v4float None %50
|
||||
%52 = OpLabel
|
||||
OpReturnValue %54
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %31
|
||||
%56 = OpLabel
|
||||
%57 = OpFunctionCall %v4float %main_inner
|
||||
OpStore %value %57
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
48
test/let/inferred/function.wgsl.expected.wgsl
Normal file
48
test/let/inferred/function.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,48 @@
|
||||
struct MyStruct {
|
||||
f1 : f32;
|
||||
};
|
||||
|
||||
type MyArray = array<f32, 10>;
|
||||
|
||||
fn ret_i32() -> i32 {
|
||||
return 1;
|
||||
}
|
||||
|
||||
fn ret_u32() -> u32 {
|
||||
return 1u;
|
||||
}
|
||||
|
||||
fn ret_f32() -> f32 {
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
fn ret_MyStruct() -> MyStruct {
|
||||
return MyStruct();
|
||||
}
|
||||
|
||||
fn ret_MyArray() -> MyArray {
|
||||
return MyArray();
|
||||
}
|
||||
|
||||
fn let_decls() {
|
||||
let v1 = 1;
|
||||
let v2 = 1u;
|
||||
let v3 = 1.0;
|
||||
let v4 = vec3<i32>(1, 1, 1);
|
||||
let v5 = vec3<u32>(1u, 1u, 1u);
|
||||
let v6 = vec3<f32>(1.0, 1.0, 1.0);
|
||||
let v7 = mat3x3<f32>(v6, v6, v6);
|
||||
let v8 = MyStruct(1.0);
|
||||
let v9 = MyArray();
|
||||
let v10 = ret_i32();
|
||||
let v11 = ret_u32();
|
||||
let v12 = ret_f32();
|
||||
let v13 = ret_MyStruct();
|
||||
let v14 = ret_MyStruct();
|
||||
let v15 = ret_MyArray();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn main() -> [[location(0)]] vec4<f32> {
|
||||
return vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
Reference in New Issue
Block a user