mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 18:59:21 +00:00
tint/sem: Treat abstract-numerics as scalars.
This tracks the WGSL spec and reduces tint complexity. Change-Id: I240a87fc7bb7f51d9e0ff180af4911cd00a33758 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/97581 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
6fe1f515d4
commit
ea84b9b072
@@ -18,6 +18,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "src/tint/program_builder.h"
|
||||
#include "src/tint/sem/abstract_numeric.h"
|
||||
#include "src/tint/sem/call.h"
|
||||
#include "src/tint/sem/expression.h"
|
||||
#include "src/tint/sem/type_constructor.h"
|
||||
@@ -54,7 +55,6 @@ void VectorizeScalarMatrixConstructors::Run(CloneContext& ctx, const DataMap&, D
|
||||
if (!ty_ctor) {
|
||||
return nullptr;
|
||||
}
|
||||
// Check if this is a matrix constructor with scalar arguments.
|
||||
auto* mat_type = call->Type()->As<sem::Matrix>();
|
||||
if (!mat_type) {
|
||||
return nullptr;
|
||||
@@ -64,7 +64,15 @@ void VectorizeScalarMatrixConstructors::Run(CloneContext& ctx, const DataMap&, D
|
||||
if (args.IsEmpty()) {
|
||||
return nullptr;
|
||||
}
|
||||
if (!args[0]->Type()->UnwrapRef()->is_scalar()) {
|
||||
|
||||
// If the argument type is a matrix, then this is an identity / conversion constructor.
|
||||
// If the argument type is a vector, then we're already column vectors.
|
||||
// If the argument type is abstract, then we're const-expression and there's no need to
|
||||
// adjust this, as it'll be constant folded by the backend.
|
||||
if (args[0]
|
||||
->Type()
|
||||
->UnwrapRef()
|
||||
->IsAnyOf<sem::Matrix, sem::Vector, sem::AbstractNumeric>()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user