tint: Add abstract numerics to vector and matrix constructors
These are the first intrinsics to support abstract-integers and abstract-floats. Nothing can use these yet, as the resolver hasn't had abstract numerics enabled in production builds. Bug: tint:1504 Change-Id: I2760f72f5d3c68c30c2e7de5ae5fb290dce64d3f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91027 Reviewed-by: David Neto <dneto@google.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
d3de38d7e3
commit
55c0c9d950
|
@ -129,6 +129,7 @@ match fi32: f32 | i32
|
|||
match iu32: i32 | u32
|
||||
match scalar: f32 | i32 | u32 | bool
|
||||
match abstract_or_scalar: ai | af | f32 | i32 | u32 | bool
|
||||
match af_f32: af | f32
|
||||
match scalar_no_f32: i32 | u32 | bool
|
||||
match scalar_no_i32: f32 | u32 | bool
|
||||
match scalar_no_u32: f32 | i32 | bool
|
||||
|
@ -645,75 +646,75 @@ ctor mat4x3<f32>(mat4x3<f32>) -> mat4x3<f32>
|
|||
ctor mat4x4<f32>(mat4x4<f32>) -> mat4x4<f32>
|
||||
|
||||
// Vector constructors
|
||||
ctor vec2<T: scalar>(T) -> vec2<T>
|
||||
ctor vec2<T: scalar>(x: T, y: T) -> vec2<T>
|
||||
ctor vec3<T: scalar>(T) -> vec3<T>
|
||||
ctor vec3<T: scalar>(x: T, y: T, z: T) -> vec3<T>
|
||||
ctor vec3<T: scalar>(xy: vec2<T>, z: T) -> vec3<T>
|
||||
ctor vec3<T: scalar>(x: T, yz: vec2<T>) -> vec3<T>
|
||||
ctor vec4<T: scalar>(T) -> vec4<T>
|
||||
ctor vec4<T: scalar>(x: T, y: T, z: T, w: T) -> vec4<T>
|
||||
ctor vec4<T: scalar>(xy: vec2<T>, z: T, w: T) -> vec4<T>
|
||||
ctor vec4<T: scalar>(x: T, yz: vec2<T>, w: T) -> vec4<T>
|
||||
ctor vec4<T: scalar>(x: T, y: T, zw: vec2<T>) -> vec4<T>
|
||||
ctor vec4<T: scalar>(xy: vec2<T>, zw: vec2<T>) -> vec4<T>
|
||||
ctor vec4<T: scalar>(xyz: vec3<T>, w: T) -> vec4<T>
|
||||
ctor vec4<T: scalar>(x: T, zyw: vec3<T>) -> vec4<T>
|
||||
ctor vec2<T: abstract_or_scalar>(T) -> vec2<T>
|
||||
ctor vec2<T: abstract_or_scalar>(x: T, y: T) -> vec2<T>
|
||||
ctor vec3<T: abstract_or_scalar>(T) -> vec3<T>
|
||||
ctor vec3<T: abstract_or_scalar>(x: T, y: T, z: T) -> vec3<T>
|
||||
ctor vec3<T: abstract_or_scalar>(xy: vec2<T>, z: T) -> vec3<T>
|
||||
ctor vec3<T: abstract_or_scalar>(x: T, yz: vec2<T>) -> vec3<T>
|
||||
ctor vec4<T: abstract_or_scalar>(T) -> vec4<T>
|
||||
ctor vec4<T: abstract_or_scalar>(x: T, y: T, z: T, w: T) -> vec4<T>
|
||||
ctor vec4<T: abstract_or_scalar>(xy: vec2<T>, z: T, w: T) -> vec4<T>
|
||||
ctor vec4<T: abstract_or_scalar>(x: T, yz: vec2<T>, w: T) -> vec4<T>
|
||||
ctor vec4<T: abstract_or_scalar>(x: T, y: T, zw: vec2<T>) -> vec4<T>
|
||||
ctor vec4<T: abstract_or_scalar>(xy: vec2<T>, zw: vec2<T>) -> vec4<T>
|
||||
ctor vec4<T: abstract_or_scalar>(xyz: vec3<T>, w: T) -> vec4<T>
|
||||
ctor vec4<T: abstract_or_scalar>(x: T, zyw: vec3<T>) -> vec4<T>
|
||||
|
||||
// Matrix constructors
|
||||
ctor mat2x2<T: f32>(T) -> mat2x2<T>
|
||||
ctor mat2x2<T: f32>(T, T,
|
||||
T, T) -> mat2x2<T>
|
||||
ctor mat2x2<T: f32>(vec2<T>, vec2<T>) -> mat2x2<T>
|
||||
ctor mat2x2<T: af_f32>(T) -> mat2x2<T>
|
||||
ctor mat2x2<T: af_f32>(T, T,
|
||||
T, T) -> mat2x2<T>
|
||||
ctor mat2x2<T: af_f32>(vec2<T>, vec2<T>) -> mat2x2<T>
|
||||
|
||||
ctor mat2x3<T: f32>(T) -> mat2x3<T>
|
||||
ctor mat2x3<T: f32>(T, T, T,
|
||||
T, T, T) -> mat2x3<T>
|
||||
ctor mat2x3<T: f32>(vec3<T>, vec3<T>) -> mat2x3<T>
|
||||
ctor mat2x3<T: af_f32>(T) -> mat2x3<T>
|
||||
ctor mat2x3<T: af_f32>(T, T, T,
|
||||
T, T, T) -> mat2x3<T>
|
||||
ctor mat2x3<T: af_f32>(vec3<T>, vec3<T>) -> mat2x3<T>
|
||||
|
||||
ctor mat2x4<T: f32>(T) -> mat2x4<T>
|
||||
ctor mat2x4<T: f32>(T, T, T, T,
|
||||
T, T, T, T) -> mat2x4<T>
|
||||
ctor mat2x4<T: f32>(vec4<T>, vec4<T>) -> mat2x4<T>
|
||||
ctor mat2x4<T: af_f32>(T) -> mat2x4<T>
|
||||
ctor mat2x4<T: af_f32>(T, T, T, T,
|
||||
T, T, T, T) -> mat2x4<T>
|
||||
ctor mat2x4<T: af_f32>(vec4<T>, vec4<T>) -> mat2x4<T>
|
||||
|
||||
ctor mat3x2<T: f32>(T) -> mat3x2<T>
|
||||
ctor mat3x2<T: f32>(T, T,
|
||||
T, T,
|
||||
T, T) -> mat3x2<T>
|
||||
ctor mat3x2<T: f32>(vec2<T>, vec2<T>, vec2<T>) -> mat3x2<T>
|
||||
ctor mat3x2<T: af_f32>(T) -> mat3x2<T>
|
||||
ctor mat3x2<T: af_f32>(T, T,
|
||||
T, T,
|
||||
T, T) -> mat3x2<T>
|
||||
ctor mat3x2<T: af_f32>(vec2<T>, vec2<T>, vec2<T>) -> mat3x2<T>
|
||||
|
||||
ctor mat3x3<T: f32>(T) -> mat3x3<T>
|
||||
ctor mat3x3<T: f32>(T, T, T,
|
||||
T, T, T,
|
||||
T, T, T) -> mat3x3<T>
|
||||
ctor mat3x3<T: f32>(vec3<T>, vec3<T>, vec3<T>) -> mat3x3<T>
|
||||
ctor mat3x3<T: af_f32>(T) -> mat3x3<T>
|
||||
ctor mat3x3<T: af_f32>(T, T, T,
|
||||
T, T, T,
|
||||
T, T, T) -> mat3x3<T>
|
||||
ctor mat3x3<T: af_f32>(vec3<T>, vec3<T>, vec3<T>) -> mat3x3<T>
|
||||
|
||||
ctor mat3x4<T: f32>(T) -> mat3x4<T>
|
||||
ctor mat3x4<T: f32>(T, T, T, T,
|
||||
T, T, T, T,
|
||||
T, T, T, T) -> mat3x4<T>
|
||||
ctor mat3x4<T: f32>(vec4<T>, vec4<T>, vec4<T>) -> mat3x4<T>
|
||||
ctor mat3x4<T: af_f32>(T) -> mat3x4<T>
|
||||
ctor mat3x4<T: af_f32>(T, T, T, T,
|
||||
T, T, T, T,
|
||||
T, T, T, T) -> mat3x4<T>
|
||||
ctor mat3x4<T: af_f32>(vec4<T>, vec4<T>, vec4<T>) -> mat3x4<T>
|
||||
|
||||
ctor mat4x2<T: f32>(T) -> mat4x2<T>
|
||||
ctor mat4x2<T: f32>(T, T,
|
||||
T, T,
|
||||
T, T,
|
||||
T, T) -> mat4x2<T>
|
||||
ctor mat4x2<T: f32>(vec2<T>, vec2<T>, vec2<T>, vec2<T>) -> mat4x2<T>
|
||||
ctor mat4x2<T: af_f32>(T) -> mat4x2<T>
|
||||
ctor mat4x2<T: af_f32>(T, T,
|
||||
T, T,
|
||||
T, T,
|
||||
T, T) -> mat4x2<T>
|
||||
ctor mat4x2<T: af_f32>(vec2<T>, vec2<T>, vec2<T>, vec2<T>) -> mat4x2<T>
|
||||
|
||||
ctor mat4x3<T: f32>(T) -> mat4x3<T>
|
||||
ctor mat4x3<T: f32>(T, T, T,
|
||||
T, T, T,
|
||||
T, T, T,
|
||||
T, T, T) -> mat4x3<T>
|
||||
ctor mat4x3<T: f32>(vec3<T>, vec3<T>, vec3<T>, vec3<T>) -> mat4x3<T>
|
||||
ctor mat4x3<T: af_f32>(T) -> mat4x3<T>
|
||||
ctor mat4x3<T: af_f32>(T, T, T,
|
||||
T, T, T,
|
||||
T, T, T,
|
||||
T, T, T) -> mat4x3<T>
|
||||
ctor mat4x3<T: af_f32>(vec3<T>, vec3<T>, vec3<T>, vec3<T>) -> mat4x3<T>
|
||||
|
||||
ctor mat4x4<T: f32>(T) -> mat4x4<T>
|
||||
ctor mat4x4<T: f32>(T, T, T, T,
|
||||
T, T, T, T,
|
||||
T, T, T, T,
|
||||
T, T, T, T) -> mat4x4<T>
|
||||
ctor mat4x4<T: f32>(vec4<T>, vec4<T>, vec4<T>, vec4<T>) -> mat4x4<T>
|
||||
ctor mat4x4<T: af_f32>(T) -> mat4x4<T>
|
||||
ctor mat4x4<T: af_f32>(T, T, T, T,
|
||||
T, T, T, T,
|
||||
T, T, T, T,
|
||||
T, T, T, T) -> mat4x4<T>
|
||||
ctor mat4x4<T: af_f32>(vec4<T>, vec4<T>, vec4<T>, vec4<T>) -> mat4x4<T>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Type conversions //
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -709,10 +709,10 @@ TEST_F(IntrinsicTableTest, MismatchTypeConstructorImplicit) {
|
|||
EXPECT_EQ(Diagnostics().str(), R"(12:34 error: no matching constructor for vec3(i32, f32, i32)
|
||||
|
||||
6 candidate constructors:
|
||||
vec3(x: T, y: T, z: T) -> vec3<T> where: T is f32, i32, u32 or bool
|
||||
vec3(xy: vec2<T>, z: T) -> vec3<T> where: T is f32, i32, u32 or bool
|
||||
vec3(x: T, yz: vec2<T>) -> vec3<T> where: T is f32, i32, u32 or bool
|
||||
vec3(T) -> vec3<T> where: T is f32, i32, u32 or bool
|
||||
vec3(x: T, y: T, z: T) -> vec3<T> where: T is abstract-int, abstract-float, f32, i32, u32 or bool
|
||||
vec3(xy: vec2<T>, z: T) -> vec3<T> where: T is abstract-int, abstract-float, f32, i32, u32 or bool
|
||||
vec3(x: T, yz: vec2<T>) -> vec3<T> where: T is abstract-int, abstract-float, f32, i32, u32 or bool
|
||||
vec3(T) -> vec3<T> where: T is abstract-int, abstract-float, f32, i32, u32 or bool
|
||||
vec3(vec3<T>) -> vec3<T> where: T is f32, i32, u32 or bool
|
||||
vec3() -> vec3<T> where: T is f32, i32, u32 or bool
|
||||
|
||||
|
@ -733,10 +733,10 @@ TEST_F(IntrinsicTableTest, MismatchTypeConstructorExplicit) {
|
|||
R"(12:34 error: no matching constructor for vec3<i32>(i32, f32, i32)
|
||||
|
||||
6 candidate constructors:
|
||||
vec3(x: T, y: T, z: T) -> vec3<T> where: T is f32, i32, u32 or bool
|
||||
vec3(x: T, yz: vec2<T>) -> vec3<T> where: T is f32, i32, u32 or bool
|
||||
vec3(T) -> vec3<T> where: T is f32, i32, u32 or bool
|
||||
vec3(xy: vec2<T>, z: T) -> vec3<T> where: T is f32, i32, u32 or bool
|
||||
vec3(x: T, y: T, z: T) -> vec3<T> where: T is abstract-int, abstract-float, f32, i32, u32 or bool
|
||||
vec3(x: T, yz: vec2<T>) -> vec3<T> where: T is abstract-int, abstract-float, f32, i32, u32 or bool
|
||||
vec3(T) -> vec3<T> where: T is abstract-int, abstract-float, f32, i32, u32 or bool
|
||||
vec3(xy: vec2<T>, z: T) -> vec3<T> where: T is abstract-int, abstract-float, f32, i32, u32 or bool
|
||||
vec3(vec3<T>) -> vec3<T> where: T is f32, i32, u32 or bool
|
||||
vec3() -> vec3<T> where: T is f32, i32, u32 or bool
|
||||
|
||||
|
@ -771,11 +771,11 @@ TEST_F(IntrinsicTableTest, MismatchTypeConversion) {
|
|||
|
||||
6 candidate constructors:
|
||||
vec3(vec3<T>) -> vec3<T> where: T is f32, i32, u32 or bool
|
||||
vec3(T) -> vec3<T> where: T is f32, i32, u32 or bool
|
||||
vec3(T) -> vec3<T> where: T is abstract-int, abstract-float, f32, i32, u32 or bool
|
||||
vec3() -> vec3<T> where: T is f32, i32, u32 or bool
|
||||
vec3(xy: vec2<T>, z: T) -> vec3<T> where: T is f32, i32, u32 or bool
|
||||
vec3(x: T, yz: vec2<T>) -> vec3<T> where: T is f32, i32, u32 or bool
|
||||
vec3(x: T, y: T, z: T) -> vec3<T> where: T is f32, i32, u32 or bool
|
||||
vec3(xy: vec2<T>, z: T) -> vec3<T> where: T is abstract-int, abstract-float, f32, i32, u32 or bool
|
||||
vec3(x: T, yz: vec2<T>) -> vec3<T> where: T is abstract-int, abstract-float, f32, i32, u32 or bool
|
||||
vec3(x: T, y: T, z: T) -> vec3<T> where: T is abstract-int, abstract-float, f32, i32, u32 or bool
|
||||
|
||||
4 candidate conversions:
|
||||
vec3(vec3<U>) -> vec3<f32> where: T is f32, U is i32, u32 or bool
|
||||
|
@ -822,8 +822,7 @@ struct Case {
|
|||
builder::sem_type_func_ptr arg_rhs;
|
||||
};
|
||||
|
||||
struct IntrinsicTableAbstractBinaryTest : public testing::TestWithParam<Case>,
|
||||
public ProgramBuilder {
|
||||
struct IntrinsicTableAbstractBinaryTest : public ResolverTestWithParam<Case> {
|
||||
std::unique_ptr<IntrinsicTable> table = IntrinsicTable::Create(*this);
|
||||
};
|
||||
|
||||
|
@ -1004,8 +1003,7 @@ struct Case {
|
|||
builder::sem_type_func_ptr arg_c;
|
||||
};
|
||||
|
||||
struct IntrinsicTableAbstractTernaryTest : public testing::TestWithParam<Case>,
|
||||
public ProgramBuilder {
|
||||
struct IntrinsicTableAbstractTernaryTest : public ResolverTestWithParam<Case> {
|
||||
std::unique_ptr<IntrinsicTable> table = IntrinsicTable::Create(*this);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue