mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-15 08:06:19 +00:00
[resolver]: Begin constant value evaluation
Move the bulk of the constant evaulation logic out of transform::FoldConstants and into Resolver and sem::Expression. transform::FoldConstants now replace TypeConstructor nodes that have a constant value on the expression. This is ground work to: * Cleaning up the HLSL uniform buffer indexing, which is `/` and `%` arithmatic heavy * Prepares us to handle `constexpr` when it lands in the spec * Provide a centralized place to do constant evaluation, instead of the having similar logic scattered around the codebase. Change-Id: I3e2f542be692046a8d243b62a82556db519953e7 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57426 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com> Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
@@ -30,6 +30,7 @@ Matrix::Matrix(ProgramID program_id,
|
||||
subtype_(subtype),
|
||||
rows_(rows),
|
||||
columns_(columns) {
|
||||
TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, subtype, program_id);
|
||||
TINT_ASSERT(AST, rows > 1);
|
||||
TINT_ASSERT(AST, rows < 5);
|
||||
TINT_ASSERT(AST, columns > 1);
|
||||
|
||||
@@ -26,6 +26,7 @@ Vector::Vector(ProgramID program_id,
|
||||
Type const* subtype,
|
||||
uint32_t size)
|
||||
: Base(program_id, source), subtype_(subtype), size_(size) {
|
||||
TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, subtype, program_id);
|
||||
TINT_ASSERT(AST, size_ > 1);
|
||||
TINT_ASSERT(AST, size_ < 5);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user