#include <DeviceIndirectBufferWriter.h>
Inherits AZ::RHI::Object.
Inherited by AZ::DX12::IndirectBufferWriter, and AZ::Vulkan::IndirectBufferWriter.
|
|
| AZ_RTTI (DeviceIndirectBufferWriter, "{7F569E74-382B-44EC-B0C5-89C07A184B47}") |
| |
| ResultCode | Init (DeviceBuffer &buffer, size_t byteOffset, uint32_t byteStride, uint32_t maxCommandSequences, const DeviceIndirectBufferSignature &signature) |
| |
| ResultCode | Init (void *memoryPtr, uint32_t byteStride, uint32_t maxCommandSequences, const DeviceIndirectBufferSignature &signature) |
| |
| DeviceIndirectBufferWriter * | SetVertexView (uint32_t slot, const DeviceStreamBufferView &view) |
| |
| DeviceIndirectBufferWriter * | SetIndexView (const DeviceIndexBufferView &view) |
| |
| DeviceIndirectBufferWriter * | Draw (const DrawLinear &arguments, const RHI::DrawInstanceArguments &drawInstanceArgs) |
| |
| DeviceIndirectBufferWriter * | DrawIndexed (const DrawIndexed &arguments, const RHI::DrawInstanceArguments &drawInstanceArgs) |
| |
| DeviceIndirectBufferWriter * | Dispatch (const DispatchDirect &arguments) |
| |
| DeviceIndirectBufferWriter * | 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 |
| |
DeviceIndirectBufferWriter 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 DeviceIndirectBufferWriter 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 DeviceIndirectBufferWriter 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 DeviceIndirectBufferWriter object (this).
◆ Init() [1/2]
Initialize the DeviceIndirectBufferWriter 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 DeviceIndirectBufferWriter can write. |
| signature | Signature of the indirect buffer. |
- Returns
- A result code denoting the status of the call. If successful, the DeviceIndirectBufferWriter is considered initialized and is able to service write requests. If failure, the DeviceIndirectBufferWriter remains uninitialized.
◆ Init() [2/2]
| ResultCode AZ::RHI::DeviceIndirectBufferWriter::Init |
( |
void * |
memoryPtr, |
|
|
uint32_t |
byteStride, |
|
|
uint32_t |
maxCommandSequences, |
|
|
const DeviceIndirectBufferSignature & |
signature |
|
) |
| |
Initialize the DeviceIndirectBufferWriter 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 DeviceIndirectBufferWriter can write. |
| signature | Signature of the indirect buffer. |
- Returns
- A result code denoting the status of the call. If successful, the DeviceIndirectBufferWriter is considered initialized and is able to service write requests. If failure, the DeviceIndirectBufferWriter remains uninitialized.
◆ NextSequence()
| bool AZ::RHI::DeviceIndirectBufferWriter::NextSequence |
( |
| ) |
|
Advance the current sequence index by 1.
- Returns
- True if the sequence index was increased correctly. False otherwise.
◆ Seek()
| bool AZ::RHI::DeviceIndirectBufferWriter::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
-
| view | The DeviceIndexBufferView that will be set. |
- Returns
- A pointer to the DeviceIndirectBufferWriter object (this).
◆ SetRootConstants()
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 DeviceIndirectBufferWriter object (this).
◆ SetVertexView()
| DeviceIndirectBufferWriter * AZ::RHI::DeviceIndirectBufferWriter::SetVertexView |
( |
uint32_t |
slot, |
|
|
const DeviceStreamBufferView & |
view |
|
) |
| |
Writes a vertex buffer view command into the current sequence.
- Parameters
-
| slot | The stream buffer slot that the view will set. |
| view | The DeviceStreamBufferView that will be set. |
- Returns
- A pointer to the DeviceIndirectBufferWriter object (this).
◆ Shutdown()
| void AZ::RHI::DeviceIndirectBufferWriter::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/DeviceIndirectBufferWriter.h