Convert `@align` to hold an expression. With the updated WGSL grammar the `@align` attribute takes an expression instead of a value. This CL updates the internal data structures to store an expression instead of an integer value. The parser still only parses integers, they're just turned into `IntLiteralExpressions` at the moment. Bug: tint:1633 Change-Id: If34901798ed6ceaced354bc06ae9b6df875b700e Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99980 Reviewed-by: Ben Clayton <bclayton@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
diff --git a/src/tint/program_builder.h b/src/tint/program_builder.h index 42e428a..5da80d6 100644 --- a/src/tint/program_builder.h +++ b/src/tint/program_builder.h
@@ -2274,17 +2274,19 @@ /// Creates a ast::StructMemberAlignAttribute /// @param source the source information - /// @param val the align value + /// @param val the align value expression /// @returns the align attribute pointer - const ast::StructMemberAlignAttribute* MemberAlign(const Source& source, uint32_t val) { - return create<ast::StructMemberAlignAttribute>(source, val); + template <typename EXPR> + const ast::StructMemberAlignAttribute* MemberAlign(const Source& source, EXPR&& val) { + return create<ast::StructMemberAlignAttribute>(source, Expr(std::forward<EXPR>(val))); } /// Creates a ast::StructMemberAlignAttribute - /// @param val the align value + /// @param val the align value expression /// @returns the align attribute pointer - const ast::StructMemberAlignAttribute* MemberAlign(uint32_t val) { - return create<ast::StructMemberAlignAttribute>(source_, val); + template <typename EXPR> + const ast::StructMemberAlignAttribute* MemberAlign(EXPR&& val) { + return create<ast::StructMemberAlignAttribute>(source_, Expr(std::forward<EXPR>(val))); } /// Creates the ast::GroupAttribute