26 this->Data =
new uint8_t[Ty->
getSize()];
28 memcpy(this->Data, Data, Ty->
getSize());
34 assert(
sizeof(T) == Ty->
getSize());
59 std::swap(
Ty, Tmp.
Ty);
82 for (
size_t i = 0; i < Indices.size(); i++)
103 return ((T *)
Data)[Element];
125 for (
size_t i = 0; i < Indices.size(); i++)
162 for (uint32_t Col = 0; Col < NumCols; Col++)
166 uint64_t SrcPtr = Pointer.
get<uint64_t>();
170 SrcPtr += Col * ElemTy->
getSize();
173 for (uint32_t Row = 0; Row < VecTy->getElementCount(); Row++)
196 void print(std::ostream &Stream, uint8_t *Data,
const Type *Ty)
202 Stream << (*(
bool *)Data ?
"true" :
"false");
211 Stream << *(int16_t *)Data;
214 Stream << *(int32_t *)Data;
217 Stream << *(int64_t *)Data;
220 assert(
false &&
"Invalid integer type.");
229 Stream << *(
float *)Data;
232 Stream << *(
double *)Data;
235 assert(
false &&
"Invalid floating point type.");
257 Stream << Ty << std::endl;
263 Stream <<
"Format = " << Image->
getFormat() << std::endl;
269 Stream <<
"sampler object";
274 Stream <<
"0x" << std::hex << *(uint64_t *)Data << std::dec;
278 Stream <<
"<unhandled object type>";
287 Stream <<
"<undefined>";
301 ((T *)
Data)[Element] = Value;
337 for (uint32_t Col = 0; Col < NumCols; Col++)
341 uint64_t DstPtr = Pointer.
get<uint64_t>();
345 DstPtr += Col * ElemTy->
getSize();
348 for (uint32_t Row = 0; Row < VecTy->getElementCount(); Row++)
371 #define INSTANTIATE(TYPE) \
372 template Object::Object(const talvos::Type *Ty, TYPE Value); \
373 template TYPE Object::get(uint32_t) const; \
374 template void Object::set(TYPE, uint32_t)
const DescriptorElement * getDescriptorElements() const
Returns the descriptor array element information.
bool isScalar() const
Returns true if this is a scalar type.
~Object()
Destroy this object.
This class represents an image object.
void setDescriptorElements(const DescriptorElement *DAE)
Set the descriptor array elements for this object.
size_t getSize() const
Returns the size of this type in bytes.
Structure to describe the memory layout of a matrix.
bool isPointer() const
Returns true if this is a pointer type.
size_t getElementOffset(uint64_t Index) const
Returns the byte offset of the element at Index.
const Type * getElementType(uint64_t Index=0) const
Returns the type of the element at Index.
This class represents a view into a range of image subresources.
void store(Memory &Mem, uint64_t Address) const
Store the value of this object to memory at Address.
bool isArray() const
Returns true if this is an array type.
bool isMatrix() const
Returns true if this is a matrix type.
void set(T Value, uint32_t Element=0)
Set the value of this object to a scalar of type T.
uint32_t getElementCount() const
Returns the number of elements in this array, struct, or vector type.
VkFormat getFormat() const
Returns the format of the image.
uint32_t getNumArrayLayers() const
Returns the number of array layers in the image view.
static Object load(const Type *Ty, const Memory &Mem, uint64_t Address)
Create an object of type Ty from the data at Address.
uint32_t getWidth(uint32_t Level=0) const
Get the width of the image view at the specified mip level.
This file declares the Type class.
enum talvos::PtrMatrixLayout::@4 Order
Specifies the order of the elements in memory.
const DescriptorElement * DescriptorElements
Descriptor array element information.
bool isComposite() const
Returns true if this is an array, struct, or vector type.
uint32_t Stride
The stride in bytes between columns (COL_MAJOR) or rows (ROW_MAJOR).
This class represents an address space in the virtual device.
uint32_t getDepth(uint32_t Level=0) const
Get the depth of the image view at the specified mip level.
uint8_t * Data
The raw data backing this object.
Structure used to hold information about an element of a descriptor array.
This file declares data structures and functions for handling images.
PtrMatrixLayout MatrixLayout
The memory layout of a matrix that this object points to.
uint32_t getBitWidth() const
Returns the bit-width of this type.
void zero()
Set all of the value bits in this object to zero.
This file declares the Object class.
void setMatrixLayout(const PtrMatrixLayout &ML)
Set the matrix layout for this object.
Object()
Create an empty, uninitialized object.
std::ostream & operator<<(std::ostream &Stream, const Dim3 &D)
const Type * getType() const
Returns the type of this object.
uint32_t getHeight(uint32_t Level=0) const
Get the height of the image view at the specified mip level.
This file declares the Memory class.
Object & operator=(const Object &Src)
Copy-assign to this object, cloning the data from Src.
TypeId getTypeId() const
Returns the type ID of this type.
void load(uint8_t *Result, uint64_t Address, uint64_t NumBytes) const
Load NumBytes of data from Address into Result.
const PtrMatrixLayout & getMatrixLayout() const
Get the matrix layout for this object.
This class represents a SPIR-V type.
void insert(const std::vector< uint32_t > &Indices, const Object &Element)
Insert the value of Element into a composite object.
This class represents an instruction result.
void store(uint64_t Address, uint64_t NumBytes, const uint8_t *Data)
Store NumBytes of data from Data to Address.
T get(uint32_t Element=0) const
Get the value of this object as a scalar of type T.
uint32_t getNumMipLevels() const
Returns the number of mip levels in the image view.
bool isVector() const
Returns true if this is a vector type.
Object extract(const std::vector< uint32_t > &Indices) const
Extract an element from a composite object.
const Type * Ty
The type of this object.
void print(std::ostream &Stream, uint8_t *Data, const Type *Ty)
Recursively print typed data to a stream.