mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 09:25:25 +00:00
writer/wgsl: Fix size / align decoration emission
This was broken by a rebase of the Default Struct Layout change. This went unnoticed because there was no test coverage for these. Added. Also replace `[[offset(n)]]` decorations with padding fields. Bug: tint:626 Change-Id: Iad6f1a239bc8d8fcb15d18a204d3f5a78a372350 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/44683 Commit-Queue: Ben Clayton <bclayton@chromium.org> Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: James Price <jrprice@google.com> Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
fd3cf82056
commit
822fa54d87
@@ -30,8 +30,9 @@ Struct::~Struct() = default;
|
||||
|
||||
StructMember::StructMember(ast::StructMember* declaration,
|
||||
uint32_t offset,
|
||||
uint32_t align,
|
||||
uint32_t size)
|
||||
: declaration_(declaration), offset_(offset), size_(size) {}
|
||||
: declaration_(declaration), offset_(offset), align_(align), size_(size) {}
|
||||
|
||||
StructMember::~StructMember() = default;
|
||||
|
||||
|
||||
@@ -85,8 +85,12 @@ class StructMember : public Castable<StructMember, Node> {
|
||||
/// Constructor
|
||||
/// @param declaration the AST declaration node
|
||||
/// @param offset the byte offset from the base of the structure
|
||||
/// @param size the byte size
|
||||
StructMember(ast::StructMember* declaration, uint32_t offset, uint32_t size);
|
||||
/// @param align the byte alignment of the member
|
||||
/// @param size the byte size of the member
|
||||
StructMember(ast::StructMember* declaration,
|
||||
uint32_t offset,
|
||||
uint32_t align,
|
||||
uint32_t size);
|
||||
|
||||
/// Destructor
|
||||
~StructMember() override;
|
||||
@@ -97,13 +101,17 @@ class StructMember : public Castable<StructMember, Node> {
|
||||
/// @returns byte offset from base of structure
|
||||
uint32_t Offset() const { return offset_; }
|
||||
|
||||
/// @returns the alignment of the member in bytes
|
||||
uint32_t Align() const { return align_; }
|
||||
|
||||
/// @returns byte size
|
||||
uint32_t Size() const { return size_; }
|
||||
|
||||
private:
|
||||
ast::StructMember* const declaration_;
|
||||
uint32_t const offset_; // Byte offset from base of structure
|
||||
uint32_t const size_; // Byte size
|
||||
uint32_t const align_; // Byte alignment of the member
|
||||
uint32_t const size_; // Byte size of the member
|
||||
};
|
||||
|
||||
} // namespace semantic
|
||||
|
||||
Reference in New Issue
Block a user