#include <IndirectBufferWriter.h>
Inherits AZ::RHI::Object.
Inherited by AZ::DX12::IndirectBufferWriter, and AZ::Vulkan::IndirectBufferWriter.
|
| AZ_RTTI (IndirectBufferWriter, "{7F569E74-382B-44EC-B0C5-89C07A184B47}") |
|
ResultCode | Init (Buffer &buffer, size_t byteOffset, uint32_t byteStride, uint32_t maxCommandSequences, const IndirectBufferSignature &signature) |
|
ResultCode | Init (void *memoryPtr, uint32_t byteStride, uint32_t maxCommandSequences, const IndirectBufferSignature &signature) |
|
IndirectBufferWriter * | SetVertexView (uint32_t slot, const StreamBufferView &view) |
|
IndirectBufferWriter * | SetIndexView (const IndexBufferView &view) |
|
IndirectBufferWriter * | Draw (const DrawLinear &arguments) |
|
IndirectBufferWriter * | DrawIndexed (const DrawIndexed &arguments) |
|
IndirectBufferWriter * | Dispatch (const DispatchDirect &arguments) |
|
IndirectBufferWriter * | SetRootConstants (const uint8_t *data, uint32_t byteSize) |
|
bool | NextSequence () |
|
bool | Seek (const uint32_t sequenceIndex) |
|
void | Flush () |
| Flush changes into the destination buffer. Only valid when using a buffer.
|
|
bool | IsInitialized () const |
|
uint32_t | GetCurrentSequenceIndex () const |
|
void | Shutdown () override |
|
| AZ_RTTI (Object, "{E43378F1-2331-4173-94B8-990ED20E6003}") |
|
void | SetName (const Name &name) |
| Sets the name of the object.
|
|
const Name & | GetName () const |
| Returns the name set on the object by SetName.
|
|
uint32_t | use_count () |
| Returns the current use count of the object.
|
|
|
uint8_t * | GetTargetMemory () const |
|
void | add_ref () const |
|
void | release () const |
|
|
Buffer * | m_buffer = 0 |
|
const IndirectBufferSignature * | m_signature = nullptr |
|
uint32_t | m_maxSequences = 0 |
|
uint32_t | m_sequenceStride = 0 |
|
size_t | m_bufferOffset = 0 |
|
AZStd::atomic_int | m_useCount = 0 |
|
IndirectBufferWriter is a helper class to write indirect commands to a buffer or a memory location in a platform independent way. Different APIs may have different layouts for the arguments of an indirect command. This class provides a secure and simple way to write the commands without worrying about API differences.
It also provides basic checks, like trying to write more commands than allowed, or writing commands that are not specified in the layout.
◆ Dispatch()
Writes a dispatch command into the current sequence.
- Parameters
-
arguments | The dispatch arguments that will be written. |
- Returns
- A pointer to the IndirectBufferWriter object (this).
◆ Draw()
Writes a draw command into the current sequence.
- Parameters
-
arguments | The draw arguments that will be written. |
- Returns
- A pointer to the IndirectBufferWriter object (this).
◆ DrawIndexed()
Writes a draw indexed command into the current sequence.
- Parameters
-
arguments | The draw indexed arguments that will be written. |
- Returns
- A pointer to the IndirectBufferWriter object (this).
◆ Init() [1/2]
ResultCode AZ::RHI::IndirectBufferWriter::Init |
( |
Buffer & |
buffer, |
|
|
size_t |
byteOffset, |
|
|
uint32_t |
byteStride, |
|
|
uint32_t |
maxCommandSequences, |
|
|
const IndirectBufferSignature & |
signature |
|
) |
| |
Initialize the IndirectBufferWriter to write commands into a buffer.
- Parameters
-
buffer | The buffer where to write the commands. Any previous values for the specified range will be overwritten. The buffer must be big enough to contain the max number of sequences. |
byteOffset | The offset into the buffer. |
byteStride | The stride between command sequences. Must be larger than the stride calculated from the signature. |
maxCommandSequences | The max number of sequences that the IndirectBufferWriter can write. |
signature | Signature of the indirect buffer. |
- Returns
- A result code denoting the status of the call. If successful, the IndirectBufferWriter is considered initialized and is able to service write requests. If failure, the IndirectBufferWriter remains uninitialized.
◆ Init() [2/2]
ResultCode AZ::RHI::IndirectBufferWriter::Init |
( |
void * |
memoryPtr, |
|
|
uint32_t |
byteStride, |
|
|
uint32_t |
maxCommandSequences, |
|
|
const IndirectBufferSignature & |
signature |
|
) |
| |
Initialize the IndirectBufferWriter to write commands into a memory location.
- Parameters
-
memoryPtr | The memory location where the commands will be written. Must not be null. |
byteStride | The stride between command sequences. Must be larger than the stride calculated from the signature. |
maxCommandSequences | The max number of sequences that the IndirectBufferWriter can write. |
signature | Signature of the indirect buffer. |
- Returns
- A result code denoting the status of the call. If successful, the IndirectBufferWriter is considered initialized and is able to service write requests. If failure, the IndirectBufferWriter remains uninitialized.
◆ NextSequence()
bool AZ::RHI::IndirectBufferWriter::NextSequence |
( |
| ) |
|
Advance the current sequence index by 1.
- Returns
- True if the sequence index was increased correctly. False otherwise.
◆ Seek()
bool AZ::RHI::IndirectBufferWriter::Seek |
( |
const uint32_t |
sequenceIndex | ) |
|
Move the current sequence index to a specified position.
- Parameters
-
sequenceIndex | The index where the sequence index will be moved. Must be less than maxCommandSequences. |
- Returns
- True if the sequence index was updated correctly. False otherwise and the current sequence index is not modified.
◆ SetIndexView()
Writes an index buffer view command into the current sequence.
- Parameters
-
- Returns
- A pointer to the IndirectBufferWriter object (this).
◆ SetRootConstants()
IndirectBufferWriter * AZ::RHI::IndirectBufferWriter::SetRootConstants |
( |
const uint8_t * |
data, |
|
|
uint32_t |
byteSize |
|
) |
| |
Writes an inline constants command into the current sequence. This command will set the values of all inline constants of the Pipeline.
- Parameters
-
data | A pointer to the data that contains the values that will be written. |
byteSize | The size of the data that will be written. |
- Returns
- A pointer to the IndirectBufferWriter object (this).
◆ SetVertexView()
Writes a vertex buffer view command into the current sequence.
- Parameters
-
slot | The stream buffer slot that the view will set. |
view | The StreamBufferView that will be set. |
- Returns
- A pointer to the IndirectBufferWriter object (this).
◆ Shutdown()
void AZ::RHI::IndirectBufferWriter::Shutdown |
( |
| ) |
|
|
overridevirtual |
Shuts down the object. Derived classes can make this public if it fits with their lifecycle model (i.e. if they use an explicit Init / Shutdown). By default, it is private in order to maintain consistency with a simpler RAII lifecycle.
Reimplemented from AZ::RHI::Object.
The documentation for this class was generated from the following file:
- Gems/Atom/RHI/Code/Include/Atom/RHI/IndirectBufferWriter.h