HDK
|
A vulkan buffer object. More...
#include <RV_VKBuffer.h>
Public Member Functions | |
VkBuffer | getVkBuf () |
Get the raw vulkan buffer handle. More... | |
const RV_VKBufferCreateInfo & | getInfo () |
Get the create info the buffer was created with. More... | |
RV_VKMemory & | getMemory () |
Get the memory the buffer is backed by. More... | |
VkBufferView | getVkView () |
Fetch the buffer view assigned to this buffer, if any. More... | |
VkFormat | getVkFormat () const |
Return the vulkan format of the buffer. More... | |
exint | getSize () const |
Return the size of the buffer, in bytes. More... | |
VkBufferUsageFlags | getUsage () const |
return the vulkan usage of the buffer when it was created More... | |
VkBufferUsageFlags | getLastUsage () const |
return the current usage of this buffer More... | |
exint | entries () const |
Number of elements in this buffer (eg. RGB 32b is 1 element) More... | |
RV_GPUType | getGPUType () const |
Return the RV type of the buffer. More... | |
int | getVectorSize () const |
Return the vector size of the buffer (1-4) More... | |
bool | uploadData (RV_Render *r, VkBufferUsageFlags new_usage, const void *data, exint data_size, exint data_offset=0) |
Upload data to the buffer Upload data to the buffer and add a barrier based on its usage. Returns true if the size+offset doesn't exceed the allocated size. More... | |
bool | uploadData (RV_Render *r, const void *data, exint data_size, exint data_offset=0) |
Upload data to the buffer Upload data to the buffer. Returns true if the size+offset doesn't exceed the allocated size. More... | |
template<typename T , typename std::enable_if<!std::is_pointer< T >::value, int >::type = 0> | |
bool | uploadData (RV_Render *r, const T &data, exint offset=0) |
Span version of buffer upload. More... | |
bool | downloadData (RV_Render *r, void *data, exint data_size, exint offset=0, exint sublen=-1) |
void | addBarrier (RV_Render *r, VkBufferUsageFlags new_usage) |
Add a barrier for using the buffer in the future. More... | |
void | addBarrier (RV_Render *r, VkBufferUsageFlags old_usage, VkBufferUsageFlags new_usage) |
Add a barrier for using the buffer in the future, changing its usage. More... | |
virtual | ~RV_VKBuffer () |
void | print () const |
Debug output of the buffer (but not its data). More... | |
Static Public Member Functions | |
static RV_VKBuffer * | allocate (RV_Instance *inst, exint size, VkBufferUsageFlags usage, bool is_staging, VkFormat vk_format=VK_FORMAT_UNDEFINED, const char *name=nullptr) |
Allocate a new Buffer object Allocate a vulkan buffer is_staging - if true, buffer will be CPU visible. More... | |
Public Attributes | |
RV_StageGroup | myWaitingBarrierStage = RV_STAGE_NONE |
Protected Member Functions | |
RV_VKBuffer (RV_Instance *inst, const RV_VKBufferCreateInfo *info, VkBuffer vk_buf, RV_VKMemory *mem, RV_VKBufferView *view) | |
Protected Attributes | |
RV_Instance * | myInst = nullptr |
VkBuffer | myVkBuf = VK_NULL_HANDLE |
UT_UniquePtr< const RV_VKBufferCreateInfo > | myCreateInfo |
UT_UniquePtr< RV_VKBufferView > | myView |
UT_UniquePtr< RV_VKMemory > | myMemory |
VkBufferUsageFlags | myLastUsage |
A vulkan buffer object.
Definition at line 80 of file RV_VKBuffer.h.
|
virtual |
|
protected |
|
inline |
Add a barrier for using the buffer in the future.
Definition at line 164 of file RV_VKBuffer.h.
void RV_VKBuffer::addBarrier | ( | RV_Render * | r, |
VkBufferUsageFlags | old_usage, | ||
VkBufferUsageFlags | new_usage | ||
) |
Add a barrier for using the buffer in the future, changing its usage.
|
static |
Allocate a new Buffer object Allocate a vulkan buffer is_staging
- if true, buffer will be CPU visible.
vk_format
- if provided, a BufferView is only created – only needed for texel buffer usage
bool RV_VKBuffer::downloadData | ( | RV_Render * | r, |
void * | data, | ||
exint | data_size, | ||
exint | offset = 0 , |
||
exint | sublen = -1 |
||
) |
Donwload data from the buffer to data
. Returns false if the operation would read data out-of-range or there was an error.
exint RV_VKBuffer::entries | ( | ) | const |
Number of elements in this buffer (eg. RGB 32b is 1 element)
RV_GPUType RV_VKBuffer::getGPUType | ( | ) | const |
Return the RV type of the buffer.
|
inline |
Get the create info the buffer was created with.
Definition at line 100 of file RV_VKBuffer.h.
|
inline |
return the current usage of this buffer
Definition at line 121 of file RV_VKBuffer.h.
|
inline |
Get the memory the buffer is backed by.
Definition at line 102 of file RV_VKBuffer.h.
|
inline |
Return the size of the buffer, in bytes.
Definition at line 117 of file RV_VKBuffer.h.
|
inline |
return the vulkan usage of the buffer when it was created
Definition at line 119 of file RV_VKBuffer.h.
int RV_VKBuffer::getVectorSize | ( | ) | const |
Return the vector size of the buffer (1-4)
|
inline |
Get the raw vulkan buffer handle.
Definition at line 98 of file RV_VKBuffer.h.
|
inline |
Return the vulkan format of the buffer.
Definition at line 111 of file RV_VKBuffer.h.
|
inline |
Fetch the buffer view assigned to this buffer, if any.
Definition at line 105 of file RV_VKBuffer.h.
void RV_VKBuffer::print | ( | ) | const |
Debug output of the buffer (but not its data).
bool RV_VKBuffer::uploadData | ( | RV_Render * | r, |
VkBufferUsageFlags | new_usage, | ||
const void * | data, | ||
exint | data_size, | ||
exint | data_offset = 0 |
||
) |
Upload data to the buffer Upload data to the buffer and add a barrier based on its usage. Returns true if the size+offset doesn't exceed the allocated size.
bool RV_VKBuffer::uploadData | ( | RV_Render * | r, |
const void * | data, | ||
exint | data_size, | ||
exint | data_offset = 0 |
||
) |
Upload data to the buffer Upload data to the buffer. Returns true if the size+offset doesn't exceed the allocated size.
|
inline |
Span version of buffer upload.
Definition at line 148 of file RV_VKBuffer.h.
|
protected |
Definition at line 185 of file RV_VKBuffer.h.
|
protected |
Definition at line 182 of file RV_VKBuffer.h.
|
protected |
Definition at line 189 of file RV_VKBuffer.h.
|
protected |
Definition at line 188 of file RV_VKBuffer.h.
|
protected |
Definition at line 187 of file RV_VKBuffer.h.
|
protected |
Definition at line 184 of file RV_VKBuffer.h.
RV_StageGroup RV_VKBuffer::myWaitingBarrierStage = RV_STAGE_NONE |
Definition at line 192 of file RV_VKBuffer.h.