mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-11 22:44:04 +00:00
tint: Remove single scalar matrix constructors.
These were never part of the spec, and they were not correctly implemented for all backends. Fixed: tint:1597 Change-Id: If1a23f1619c61c53baae277f1cf37aee4460ab7b Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95952 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:
committed by
Dawn LUCI CQ
parent
65c5c9d92b
commit
f19cb029b8
@@ -690,16 +690,6 @@ 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: af_f32>(T) -> mat2x2<T>
|
||||
ctor mat2x3<T: af_f32>(T) -> mat2x3<T>
|
||||
ctor mat2x4<T: af_f32>(T) -> mat2x4<T>
|
||||
ctor mat3x2<T: af_f32>(T) -> mat3x2<T>
|
||||
ctor mat3x3<T: af_f32>(T) -> mat3x3<T>
|
||||
ctor mat3x4<T: af_f32>(T) -> mat3x4<T>
|
||||
ctor mat4x2<T: af_f32>(T) -> mat4x2<T>
|
||||
ctor mat4x3<T: af_f32>(T) -> mat4x3<T>
|
||||
ctor mat4x4<T: af_f32>(T) -> mat4x4<T>
|
||||
|
||||
ctor mat2x2<T: af_f32f16>(T, T,
|
||||
T, T) -> mat2x2<T>
|
||||
ctor mat2x2<T: af_f32f16>(vec2<T>, vec2<T>) -> mat2x2<T>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -276,10 +276,6 @@ static constexpr Params valid_cases[] = {
|
||||
ParamsFor<vec3<f32>, f32>(Kind::Construct), //
|
||||
ParamsFor<vec3<f16>, f16>(Kind::Construct), //
|
||||
|
||||
ParamsFor<mat3x3<f32>, f32>(Kind::Construct), //
|
||||
ParamsFor<mat2x3<f32>, f32>(Kind::Construct), //
|
||||
ParamsFor<mat3x2<f32>, f32>(Kind::Construct), //
|
||||
|
||||
// Conversion
|
||||
ParamsFor<bool, u32>(Kind::Conversion), //
|
||||
ParamsFor<bool, i32>(Kind::Conversion), //
|
||||
|
||||
@@ -31,108 +31,6 @@ TEST_F(VectorizeScalarMatrixConstructorsTest, ShouldRunEmptyModule) {
|
||||
EXPECT_FALSE(ShouldRun<VectorizeScalarMatrixConstructors>(src));
|
||||
}
|
||||
|
||||
TEST_P(VectorizeScalarMatrixConstructorsTest, SingleScalars) {
|
||||
uint32_t cols = GetParam().first;
|
||||
uint32_t rows = GetParam().second;
|
||||
std::string matrix_no_type = "mat" + std::to_string(cols) + "x" + std::to_string(rows);
|
||||
std::string matrix = matrix_no_type + "<f32>";
|
||||
std::string vector = "vec" + std::to_string(rows) + "<f32>";
|
||||
std::string values;
|
||||
for (uint32_t c = 0; c < cols; c++) {
|
||||
if (c > 0) {
|
||||
values += ", ";
|
||||
}
|
||||
values += vector + "(";
|
||||
for (uint32_t r = 0; r < rows; r++) {
|
||||
if (r > 0) {
|
||||
values += ", ";
|
||||
}
|
||||
values += "value";
|
||||
}
|
||||
values += ")";
|
||||
}
|
||||
|
||||
std::string src = R"(
|
||||
@fragment
|
||||
fn main() {
|
||||
let m = ${matrix}(42.0);
|
||||
}
|
||||
)";
|
||||
|
||||
std::string expect = R"(
|
||||
fn build_${matrix_no_type}(value : f32) -> ${matrix} {
|
||||
return ${matrix}(${values});
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn main() {
|
||||
let m = build_${matrix_no_type}(42.0);
|
||||
}
|
||||
)";
|
||||
src = utils::ReplaceAll(src, "${matrix}", matrix);
|
||||
expect = utils::ReplaceAll(expect, "${matrix}", matrix);
|
||||
expect = utils::ReplaceAll(expect, "${matrix_no_type}", matrix_no_type);
|
||||
expect = utils::ReplaceAll(expect, "${values}", values);
|
||||
|
||||
EXPECT_TRUE(ShouldRun<VectorizeScalarMatrixConstructors>(src));
|
||||
|
||||
auto got = Run<VectorizeScalarMatrixConstructors>(src);
|
||||
|
||||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
TEST_P(VectorizeScalarMatrixConstructorsTest, SingleScalarsReference) {
|
||||
uint32_t cols = GetParam().first;
|
||||
uint32_t rows = GetParam().second;
|
||||
std::string matrix_no_type = "mat" + std::to_string(cols) + "x" + std::to_string(rows);
|
||||
std::string matrix = matrix_no_type + "<f32>";
|
||||
std::string vector = "vec" + std::to_string(rows) + "<f32>";
|
||||
std::string values;
|
||||
for (uint32_t c = 0; c < cols; c++) {
|
||||
if (c > 0) {
|
||||
values += ", ";
|
||||
}
|
||||
values += vector + "(";
|
||||
for (uint32_t r = 0; r < rows; r++) {
|
||||
if (r > 0) {
|
||||
values += ", ";
|
||||
}
|
||||
values += "value";
|
||||
}
|
||||
values += ")";
|
||||
}
|
||||
|
||||
std::string src = R"(
|
||||
@fragment
|
||||
fn main() {
|
||||
let v = vec4<f32>(42.0);
|
||||
let m = ${matrix}(v[2]);
|
||||
}
|
||||
)";
|
||||
|
||||
std::string expect = R"(
|
||||
fn build_${matrix_no_type}(value : f32) -> ${matrix} {
|
||||
return ${matrix}(${values});
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn main() {
|
||||
let v = vec4<f32>(42.0);
|
||||
let m = build_${matrix_no_type}(v[2]);
|
||||
}
|
||||
)";
|
||||
src = utils::ReplaceAll(src, "${matrix}", matrix);
|
||||
expect = utils::ReplaceAll(expect, "${matrix}", matrix);
|
||||
expect = utils::ReplaceAll(expect, "${matrix_no_type}", matrix_no_type);
|
||||
expect = utils::ReplaceAll(expect, "${values}", values);
|
||||
|
||||
EXPECT_TRUE(ShouldRun<VectorizeScalarMatrixConstructors>(src));
|
||||
|
||||
auto got = Run<VectorizeScalarMatrixConstructors>(src);
|
||||
|
||||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
TEST_P(VectorizeScalarMatrixConstructorsTest, MultipleScalars) {
|
||||
uint32_t cols = GetParam().first;
|
||||
uint32_t rows = GetParam().second;
|
||||
|
||||
Reference in New Issue
Block a user