[spirv-writer] Add array type generation.

This CL adds generation of OpTypeArray and OpTypeRuntimeArray to the
SPIR-V writer.

Bug: tint:5
Change-Id: If3764ddb2499b8a196039521b8d9f80842626bcf
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17821
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
dan sinclair
2020-03-27 00:46:43 +00:00
committed by dan sinclair
parent 113fb07071
commit 083def41c0
5 changed files with 100 additions and 6 deletions

View File

@@ -20,7 +20,7 @@ namespace type {
ArrayType::ArrayType(Type* subtype) : subtype_(subtype) {}
ArrayType::ArrayType(Type* subtype, size_t size)
ArrayType::ArrayType(Type* subtype, uint32_t size)
: subtype_(subtype), size_(size) {}
ArrayType::~ArrayType() = default;

View File

@@ -34,7 +34,7 @@ class ArrayType : public Type {
/// Constructor
/// @param subtype the type of the array elements
/// @param size the number of elements in the array
ArrayType(Type* subtype, size_t size);
ArrayType(Type* subtype, uint32_t size);
/// Move constructor
ArrayType(ArrayType&&) = default;
~ArrayType() override;
@@ -48,9 +48,9 @@ class ArrayType : public Type {
/// @returns the array type
Type* type() const { return subtype_; }
/// @returns the array size. Size is 0 for a runtime array
size_t size() const { return size_; }
uint32_t size() const { return size_; }
/// @returns the name for th type
/// @returns the name for the type
std::string type_name() const override {
assert(subtype_);
@@ -63,7 +63,7 @@ class ArrayType : public Type {
private:
Type* subtype_ = nullptr;
size_t size_ = 0;
uint32_t size_ = 0;
};
} // namespace type