Have TypesBuilder vector and matrix methods return ast types
Bug: tint:724 Change-Id: I7bf0d36572ff332e1ecc606f2aa61414a6d74377 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/51664 Reviewed-by: Antonio Maiorano <amaiorano@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com> Auto-Submit: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
b966265f5a
commit
d3e80fd36c
|
@ -404,8 +404,7 @@ class ProgramBuilder {
|
|||
/// @return the tint AST type for a `n`-element vector of `type`.
|
||||
typ::Vector vec(typ::Type type, uint32_t n) const {
|
||||
type = MaybeCreateTypename(type);
|
||||
return {type.ast ? builder->create<ast::Vector>(type, n) : nullptr,
|
||||
type.sem ? builder->create<sem::Vector>(type, n) : nullptr};
|
||||
return {builder->create<ast::Vector>(type, n)};
|
||||
}
|
||||
|
||||
/// @param source the Source of the node
|
||||
|
@ -414,9 +413,7 @@ class ProgramBuilder {
|
|||
/// @return the tint AST type for a `n`-element vector of `type`.
|
||||
typ::Vector vec(const Source& source, typ::Type type, uint32_t n) const {
|
||||
type = MaybeCreateTypename(type);
|
||||
return {
|
||||
type.ast ? builder->create<ast::Vector>(source, type, n) : nullptr,
|
||||
type.sem ? builder->create<sem::Vector>(type, n) : nullptr};
|
||||
return {builder->create<ast::Vector>(source, type, n)};
|
||||
}
|
||||
|
||||
/// @param type vector subtype
|
||||
|
@ -462,10 +459,7 @@ class ProgramBuilder {
|
|||
/// @return the tint AST type for a matrix of `type`
|
||||
typ::Matrix mat(typ::Type type, uint32_t columns, uint32_t rows) const {
|
||||
type = MaybeCreateTypename(type);
|
||||
return {type.ast ? builder->create<ast::Matrix>(type, rows, columns)
|
||||
: nullptr,
|
||||
type.sem ? builder->create<sem::Matrix>(vec(type, rows), columns)
|
||||
: nullptr};
|
||||
return {builder->create<ast::Matrix>(type, rows, columns)};
|
||||
}
|
||||
|
||||
/// @param source the Source of the node
|
||||
|
@ -477,11 +471,7 @@ class ProgramBuilder {
|
|||
typ::Type type,
|
||||
uint32_t columns,
|
||||
uint32_t rows) const {
|
||||
return {type.ast
|
||||
? builder->create<ast::Matrix>(source, type, rows, columns)
|
||||
: nullptr,
|
||||
type.sem ? builder->create<sem::Matrix>(vec(type, rows), columns)
|
||||
: nullptr};
|
||||
return {builder->create<ast::Matrix>(source, type, rows, columns)};
|
||||
}
|
||||
|
||||
/// @param type matrix subtype
|
||||
|
|
|
@ -237,10 +237,8 @@ bool operator!=(std::nullptr_t, const TypePair<AST, SEM>& rhs) {
|
|||
|
||||
using Type = TypePair<ast::Type, sem::Type>;
|
||||
|
||||
using Matrix = TypePair<ast::Matrix, sem::Matrix>;
|
||||
using Pointer = TypePair<ast::Pointer, sem::Pointer>;
|
||||
using Struct = TypePair<ast::Struct, sem::Struct>;
|
||||
using Vector = TypePair<ast::Vector, sem::Vector>;
|
||||
|
||||
using Bool = Ptr<ast::Bool>;
|
||||
using U32 = Ptr<ast::U32>;
|
||||
|
@ -254,6 +252,8 @@ using SampledTexture = Ptr<ast::SampledTexture>;
|
|||
using StorageTexture = Ptr<ast::StorageTexture>;
|
||||
using Texture = Ptr<ast::Texture>;
|
||||
using Sampler = Ptr<ast::Sampler>;
|
||||
using Matrix = Ptr<ast::Matrix>;
|
||||
using Vector = Ptr<ast::Vector>;
|
||||
|
||||
// Helpers
|
||||
|
||||
|
|
Loading…
Reference in New Issue