#include <IndirectBufferWriter.h>
Inherits AZ::RHI::Object.
Public Member Functions | |
| AZ_CLASS_ALLOCATOR (IndirectBufferWriter, AZ::SystemAllocator, 0) | |
| AZ_RTTI (IndirectBufferWriter, "{096CBDFF-AB05-4E8D-9EC1-04F12CFCD85D}") | |
| Ptr< DeviceIndirectBufferWriter > | GetDeviceIndirectBufferWriter (int deviceIndex) const |
| Returns the device-specific DeviceIndirectBufferWriter for the given index. | |
| ResultCode | Init (Buffer &buffer, size_t byteOffset, uint32_t byteStride, uint32_t maxCommandSequences, const IndirectBufferSignature &signature) |
| ResultCode | Init (const AZStd::unordered_map< int, void * > &memoryPtrs, 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, const RHI::DrawInstanceArguments &drawInstanceArgs) |
| IndirectBufferWriter * | DrawIndexed (const DrawIndexed &arguments, const RHI::DrawInstanceArguments &drawInstanceArgs) |
| 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 |
Public Member Functions inherited from AZ::RHI::Object | |
| 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. | |
Additional Inherited Members | |
Protected Member Functions inherited from AZ::RHI::Object | |
| void | add_ref () const |
| void | release () const |
Protected Attributes inherited from AZ::RHI::Object | |
| 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.
| IndirectBufferWriter * AZ::RHI::IndirectBufferWriter::Dispatch | ( | const DispatchDirect & | arguments | ) |
Writes a dispatch command into the current sequence.
| arguments | The dispatch arguments that will be written. |
| IndirectBufferWriter * AZ::RHI::IndirectBufferWriter::Draw | ( | const DrawLinear & | arguments, |
| const RHI::DrawInstanceArguments & | drawInstanceArgs | ||
| ) |
Writes a draw command into the current sequence.
| arguments | The draw arguments that will be written. |
| IndirectBufferWriter * AZ::RHI::IndirectBufferWriter::DrawIndexed | ( | const DrawIndexed & | arguments, |
| const RHI::DrawInstanceArguments & | drawInstanceArgs | ||
| ) |
Writes a draw indexed command into the current sequence.
| arguments | The draw indexed arguments that will be written. |
| 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.
| 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. |
| ResultCode AZ::RHI::IndirectBufferWriter::Init | ( | const AZStd::unordered_map< int, void * > & | memoryPtrs, |
| uint32_t | byteStride, | ||
| uint32_t | maxCommandSequences, | ||
| const IndirectBufferSignature & | signature | ||
| ) |
Initialize the IndirectBufferWriter to write commands into a memory location.
| 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. |
| bool AZ::RHI::IndirectBufferWriter::NextSequence | ( | ) |
Advance the current sequence index by 1.
| bool AZ::RHI::IndirectBufferWriter::Seek | ( | const uint32_t | sequenceIndex | ) |
Move the current sequence index to a specified position.
| sequenceIndex | The index where the sequence index will be moved. Must be less than maxCommandSequences. |
| IndirectBufferWriter * AZ::RHI::IndirectBufferWriter::SetIndexView | ( | const IndexBufferView & | view | ) |
Writes an index buffer view command into the current sequence.
| view | The IndexBufferView that will be set. |
| 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.
| data | A pointer to the data that contains the values that will be written. |
| byteSize | The size of the data that will be written. |
| IndirectBufferWriter * AZ::RHI::IndirectBufferWriter::SetVertexView | ( | uint32_t | slot, |
| const StreamBufferView & | view | ||
| ) |
Writes a vertex buffer view command into the current sequence.
| slot | The stream buffer slot that the view will set. |
| view | The StreamBufferView that will be set. |
|
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.