mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 21:47:47 +00:00
tint: fix identity initializer of vec from vec of abstract not remaining abstract
For "vec3(vec3<T>) -> vec3<T>", this CL makes T also include abstract int and float (all scalars). Bug: tint:1731 Change-Id: I776c7ba6872c3d680982dbec6b0970389e720611 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107540 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
c303bdf705
commit
2048d4f6ef
@@ -739,9 +739,9 @@ fn textureLoad<C: iu32>(texture: texture_external, coords: vec2<C>) -> vec4<f32>
|
||||
@const("Identity") init f32(f32) -> f32
|
||||
@const("Identity") init f16(f16) -> f16
|
||||
@const("Identity") init bool(bool) -> bool
|
||||
@const("Identity") init vec2<T: concrete_scalar>(vec2<T>) -> vec2<T>
|
||||
@const("Identity") init vec3<T: concrete_scalar>(vec3<T>) -> vec3<T>
|
||||
@const("Identity") init vec4<T: concrete_scalar>(vec4<T>) -> vec4<T>
|
||||
@const("Identity") init vec2<T: scalar>(vec2<T>) -> vec2<T>
|
||||
@const("Identity") init vec3<T: scalar>(vec3<T>) -> vec3<T>
|
||||
@const("Identity") init vec4<T: scalar>(vec4<T>) -> vec4<T>
|
||||
@const("Identity") init mat2x2<T: f32_f16>(mat2x2<T>) -> mat2x2<T>
|
||||
@const("Identity") init mat2x3<T: f32_f16>(mat2x3<T>) -> mat2x3<T>
|
||||
@const("Identity") init mat2x4<T: f32_f16>(mat2x4<T>) -> mat2x4<T>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -839,7 +839,7 @@ TEST_F(IntrinsicTableTest, MismatchTypeInitializerImplicit) {
|
||||
vec3(xy: vec2<T>, z: T) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||
vec3(x: T, yz: vec2<T>) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||
vec3(T) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||
vec3(vec3<T>) -> vec3<T> where: T is f32, f16, i32, u32 or bool
|
||||
vec3(vec3<T>) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||
vec3<T>() -> vec3<T> where: T is f32, f16, i32, u32 or bool
|
||||
|
||||
5 candidate conversions:
|
||||
@@ -865,7 +865,7 @@ TEST_F(IntrinsicTableTest, MismatchTypeInitializerExplicit) {
|
||||
vec3(x: T, yz: vec2<T>) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||
vec3(T) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||
vec3(xy: vec2<T>, z: T) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||
vec3(vec3<T>) -> vec3<T> where: T is f32, f16, i32, u32 or bool
|
||||
vec3(vec3<T>) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||
vec3<T>() -> vec3<T> where: T is f32, f16, i32, u32 or bool
|
||||
|
||||
5 candidate conversions:
|
||||
@@ -877,6 +877,19 @@ TEST_F(IntrinsicTableTest, MismatchTypeInitializerExplicit) {
|
||||
)");
|
||||
}
|
||||
|
||||
TEST_F(IntrinsicTableTest, MatchTypeInitializerImplicitVecFromVecAbstract) {
|
||||
auto* ai = create<sem::AbstractInt>();
|
||||
auto* vec3_ai = create<sem::Vector>(ai, 3u);
|
||||
auto result = table->Lookup(InitConvIntrinsic::kVec3, nullptr, utils::Vector{vec3_ai},
|
||||
sem::EvaluationStage::kConstant, Source{{12, 34}});
|
||||
ASSERT_NE(result.target, nullptr);
|
||||
EXPECT_EQ(result.target->ReturnType(), vec3_ai);
|
||||
EXPECT_TRUE(result.target->Is<sem::TypeInitializer>());
|
||||
ASSERT_EQ(result.target->Parameters().Length(), 1u);
|
||||
EXPECT_EQ(result.target->Parameters()[0]->Type(), vec3_ai);
|
||||
EXPECT_NE(result.const_eval_fn, nullptr);
|
||||
}
|
||||
|
||||
TEST_F(IntrinsicTableTest, MatchTypeInitializerImplicitMatFromVec) {
|
||||
auto* af = create<sem::AbstractFloat>();
|
||||
auto* vec2_ai = create<sem::Vector>(create<sem::AbstractInt>(), 2u);
|
||||
@@ -951,7 +964,7 @@ TEST_F(IntrinsicTableTest, MismatchTypeConversion) {
|
||||
R"(12:34 error: no matching initializer for vec3<f32>(array<u32>)
|
||||
|
||||
6 candidate initializers:
|
||||
vec3(vec3<T>) -> vec3<T> where: T is f32, f16, i32, u32 or bool
|
||||
vec3(vec3<T>) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||
vec3(T) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||
vec3<T>() -> vec3<T> where: T is f32, f16, i32, u32 or bool
|
||||
vec3(xy: vec2<T>, z: T) -> vec3<T> where: T is abstract-int, abstract-float, f32, f16, i32, u32 or bool
|
||||
|
||||
Reference in New Issue
Block a user