A buffer that will reside on the GPU.
More...
A buffer that will reside on the GPU.
Used as the basic memory holder to push data to the GPU. Each renderer will have its own implementation to adapt it to the API it targets.
See BufferManager::createOrRetrieve() or Buffer::create() for instantiation.
◆ ~Buffer()
virtual nkGraphics::Buffer::~Buffer |
( |
| ) |
|
|
virtual |
◆ getElementByteSize()
unsigned int nkGraphics::Buffer::getElementByteSize |
( |
| ) |
const |
- Returns
- An element's byte size within the buffer.
◆ getElementCount()
unsigned int nkGraphics::Buffer::getElementCount |
( |
| ) |
const |
- Returns
- The element count within the buffer.
◆ getTotalByteSize()
unsigned int nkGraphics::Buffer::getTotalByteSize |
( |
| ) |
const |
- Returns
- The final byte size of the buffer. Computed as elementByteSize * elementCount.
◆ getUsage()
- Returns
- The usage declared for the buffer.
◆ getBindFlag()
- Returns
- The binding declared for the buffer.
◆ getCpuAccessFlag()
- Returns
- The cpu access flag declared for the buffer.
◆ getMiscFlag()
- Returns
- Any misc flag set on the buffer.
◆ setCpuData()
Sets the CPU data to upload to the gpu buffer during load.
- Parameters
-
◆ setCpuDataCopy()
Sets the CPU data to upload to the gpu buffer during load.
- Parameters
-
◆ setCpuDataForward()
Sets the CPU data to upload to the gpu buffer during load.
- Parameters
-
◆ freeCpuData()
virtual void nkGraphics::Buffer::freeCpuData |
( |
| ) |
|
|
virtual |
Frees the CPU data holding structures and, if owning them, local shadow CPU buffers.
◆ setElementByteSize()
virtual void nkGraphics::Buffer::setElementByteSize |
( |
unsigned int |
value | ) |
|
|
virtual |
Sets the size of an element within the buffer.
- Parameters
-
value | The byte size an element will have in the buffer. |
◆ setElementCount()
virtual void nkGraphics::Buffer::setElementCount |
( |
unsigned int |
value | ) |
|
|
virtual |
Sets the number of elements inside the buffer.
- Parameters
-
value | The number of elements to declare inside the buffer. |
◆ setUsage()
virtual void nkGraphics::Buffer::setUsage |
( |
BUFFER_USAGE |
value | ) |
|
|
pure virtual |
Sets the usage flag in the buffer.
- Parameters
-
value | The usage flag to declare. |
◆ setBindFlag()
Sets the binding flags for the buffer.
- Parameters
-
value | The binding flag to declare. |
◆ setCpuAccessFlag()
Sets the cpu access flags for the buffer.
- Parameters
-
value | The value to declare. |
◆ setMiscFlag()
Sets the misc flags for the buffer.
- Parameters
-
value | The value to declare. |
◆ copyParams()
virtual void nkGraphics::Buffer::copyParams |
( |
const Buffer & |
other | ) |
|
|
virtual |
Copies the parameters from another buffer.
- Parameters
-
other | The buffer to copy the parameters from. |
◆ map()
Maps the buffer. This allows to read or write the GPU data from the cpu context. For a read request, depending on the usage and CPU access flag, this can trigger staging buffer creation and copy to pull data from the GPU. Note that in some cases, this means a flush in the GPU pipeline (and a CPU lock) to ensure the latest data is retrieved.
- Parameters
-
requestDesc | The description of what kind of mapping is needed. |
- Returns
- The resulting mapped memory, if the request is valid. If not, reason will be logged, and mapped memory will be nullptr.
◆ unmap()
Requests to unmap the buffer. Should be called the earliest possible after a call to map().
- Parameters
-
requestDesc | The description of the unmap request. |
◆ gpuCopyFrom()
Copy memory from one buffer to another. This will trigger copies on GPU, and involve the CPU the least possible.
- Parameters
-
other | The buffer to copy from. |
descriptor | The description of what kind of copy is wanted. |
◆ prepareForShaderResourceUsage()
virtual void nkGraphics::Buffer::prepareForShaderResourceUsage |
( |
bool |
value = true | ) |
|
|
virtual |
Prepares the resource for an usage as a shader resource. This is needed to use the buffer in a Shader::addTexture() call.
- Parameters
-
value | If the buffer should be usable in such context (true) or not (false). |
◆ prepareForComputeResourceUsage()
virtual void nkGraphics::Buffer::prepareForComputeResourceUsage |
( |
bool |
value = true | ) |
|
|
virtual |
Prepares the resource for an usage as a compute resource. This is needed to use the buffer in a Shader::addUavBuffer() call.
- Parameters
-
value | If the buffer should be usable in such context (true) or not (false). |
◆ prepareForOutputStreamUsage()
virtual void nkGraphics::Buffer::prepareForOutputStreamUsage |
( |
bool |
value = true | ) |
|
|
virtual |
Prepares the resource for an usage as an output stream resource. This is needed to use the buffer in a Renderer::launchGeometryShaderStream() call.
- Parameters
-
value | If the buffer should be usable in such context (true) or not (false). |
◆ operator=()
Buffer& nkGraphics::Buffer::operator= |
( |
const Buffer & |
other | ) |
|
|
delete |
◆ exportClassToTree()
virtual void nkGraphics::Buffer::exportClassToTree |
( |
nkExport::Node * |
rootNode | ) |
|
|
overridevirtual |
Exports an item into a tree describing its structure and its data.
- Parameters
-
rootNode | The node into which the object has to write its related information. |
Implements nkExport::Exportable.
◆ importClassFromTree()
virtual void nkGraphics::Buffer::importClassFromTree |
( |
nkExport::Node * |
rootNode | ) |
|
|
overridevirtual |
Imports information from a tree which is supposed to describe its structure and data.
- Parameters
-
rootNode | The root node of the tree holding the information. |
Implements nkExport::Exportable.
◆ create()
Creates a standalone resource, linking it to a system, but no manager. This method can be used to allocate a resource and manually manage its lifetime.
- Parameters
-
system | The system to create the resource into. If left to nullptr, then the Singleton instance will be used. |
- Returns
- The created resource instance.
The documentation for this class was generated from the following file:
- Documentation/Headers/NilkinsGraphics/Buffers/Buffer.h