mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-08 21:17:45 +00:00
writer/spirv: Simplify member accesses
Using semantic info. Change-Id: Iec9a592d9d66930535ead78fab69a6085a57a941 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50302 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com> Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
4cd5eea87e
commit
2e1a284cbb
@@ -56,11 +56,13 @@ std::string Struct::FriendlyName(const SymbolTable& symbols) const {
|
||||
|
||||
StructMember::StructMember(ast::StructMember* declaration,
|
||||
sem::Type* type,
|
||||
uint32_t index,
|
||||
uint32_t offset,
|
||||
uint32_t align,
|
||||
uint32_t size)
|
||||
: declaration_(declaration),
|
||||
type_(type),
|
||||
index_(index),
|
||||
offset_(offset),
|
||||
align_(align),
|
||||
size_(size) {}
|
||||
|
||||
@@ -166,11 +166,13 @@ class StructMember : public Castable<StructMember, Node> {
|
||||
/// Constructor
|
||||
/// @param declaration the AST declaration node
|
||||
/// @param type the type of the member
|
||||
/// @param index the index of the member in the structure
|
||||
/// @param offset the byte offset from the base of the structure
|
||||
/// @param align the byte alignment of the member
|
||||
/// @param size the byte size of the member
|
||||
StructMember(ast::StructMember* declaration,
|
||||
sem::Type* type,
|
||||
uint32_t index,
|
||||
uint32_t offset,
|
||||
uint32_t align,
|
||||
uint32_t size);
|
||||
@@ -184,6 +186,9 @@ class StructMember : public Castable<StructMember, Node> {
|
||||
/// @returns the type of the member
|
||||
sem::Type* Type() const { return type_; }
|
||||
|
||||
/// @returns the member index
|
||||
uint32_t Index() const { return index_; }
|
||||
|
||||
/// @returns byte offset from base of structure
|
||||
uint32_t Offset() const { return offset_; }
|
||||
|
||||
@@ -196,9 +201,10 @@ class StructMember : public Castable<StructMember, Node> {
|
||||
private:
|
||||
ast::StructMember* const declaration_;
|
||||
sem::Type* const type_;
|
||||
uint32_t const offset_; // Byte offset from base of structure
|
||||
uint32_t const align_; // Byte alignment of the member
|
||||
uint32_t const size_; // Byte size of the member
|
||||
uint32_t const index_;
|
||||
uint32_t const offset_;
|
||||
uint32_t const align_;
|
||||
uint32_t const size_;
|
||||
};
|
||||
|
||||
} // namespace sem
|
||||
|
||||
Reference in New Issue
Block a user