OGRE-Next: Ogre::UavBufferPacked Class Reference

| OGRE-Next 3.0.0 Object-Oriented Graphics Rendering Engine

Loading...
Searching...
No Matches
Public Member Functions | List of all members
Ogre::UavBufferPacked Class Referenceabstract

Represents UAV buffers (also known as SSBOs in OpenGL) Uav buffers are supported in DX10/DX10.1 hardware (with up to date drivers). More...

`#include <OgreUavBufferPacked.h>`

Inheritance diagram for Ogre::UavBufferPacked:
[legend]

## Public Member Functions
| UavBufferPacked (size_t internalBufferStartBytes, size_t numElements, uint32 bytesPerElement, uint32 bindFlags, void *initialData, bool keepAsShadow, VaoManager *vaoManager, BufferInterface *bufferInterface)
| ~UavBufferPacked () override
virtual void | bindBufferCS (uint16 slot, size_t offset=0, size_t sizeBytes=0)=0
| Binds the texture buffer to the given slot in the Vertex/Pixel/Geometry/Hull/Domain/Compute Shader.
void | destroyAllBufferViews ()
| See destroyTexBufferView and getAsReadOnlyBufferView, this one does it on all the creates views.
void | destroyReadOnlyBufferView ()
| Frees memory from the view created by getAsReadOnlyBufferView Does nothing if the view wasn't created.
void | destroyTexBufferView (PixelFormatGpu pixelFormat)
| Frees memory from a view created by getAsTexBufferView Does nothing if a view of the given pixel format did not exist.
ReadOnlyBufferPacked * | getAsReadOnlyBufferView ()
| Returns a ReadOnlyBufferPacked for binding to the GPU as a texture w/ read-only access.
TexBufferPacked * | getAsTexBufferView (PixelFormatGpu pixelFormat)
| Returns a TexBufferPacked for binding to the GPU as a texture w/ read-only access.
BufferPackedTypes | getBufferPackedType () const override
| Useful to query which one is the derived class.
Public Member Functions inherited from Ogre::BufferPacked
| BufferPacked (size_t internalBufferStartBytes, size_t numElements, uint32 bytesPerElement, uint32 numElementsPadding, BufferType bufferType, void *initialData, bool keepAsShadow, VaoManager *vaoManager, BufferInterface *bufferInterface)
| Generic constructor.
virtual | ~BufferPacked ()
size_t | _getFinalBufferStart () const
size_t | _getInternalBufferStart () const
size_t | _getInternalNumElements () const
size_t | _getInternalTotalSizeBytes () const
void | _setBufferInterface (BufferInterface *bufferInterface)
| For internal use.
void | _setShadowCopy (void *copy)
| This will not delete the existing shadow copy so it can be used for other purposes if it is not needed call OGRE_FREE_SIMD( m->getShadowCopy(), MEMCATEGORY_GEOMETRY ) before calling this function.
void | advanceFrame ()
void | copyTo (BufferPacked *dstBuffer, size_t dstElemStart=0, size_t srcElemStart=0, size_t srcNumElems=std::numeric_limits< size_t >::max())
| Copies the contents of this buffer to another, using GPU -> GPU transfers.
BufferInterface * | getBufferInterface () const
BufferType | getBufferType () const
uint32 | getBytesPerElement () const
MappingState | getMappingState () const
| Returns the mapping state.
size_t | getNumElements () const
virtual BufferPacked * | getOriginalBufferType ()
| If this buffer has been reinterpreted from an UavBufferPacked, returns the original version, otherwise returns 'this'.
const void * | getShadowCopy () const
size_t | getTotalSizeBytes () const
bool | isCurrentlyMapped () const
| Returns whether the buffer is currently mapped.
void *RESTRICT_ALIAS_RETURN | map (size_t elementStart, size_t elementCount, bool bAdvanceFrame=true)
| Maps the specified region to a pointer the CPU can access.
AsyncTicketPtr | readRequest (size_t elementStart, size_t elementCount)
| Async data read request.
void | regressFrame ()
| Performs the opposite of.
void | unmap (UnmapOptions unmapOption, size_t flushStartElem=0, size_t flushSizeElem=0)
| Unmaps or flushes the region mapped with.
virtual void | upload (const void *data, size_t elementStart, size_t elementCount)
| Sends the provided data to the GPU.
Public Member Functions inherited from Ogre::GpuTrackedResource
virtual | ~GpuTrackedResource ()
virtual bool | isTextureGpu () const

## Detailed Description

Represents UAV buffers (also known as SSBOs in OpenGL) Uav buffers are supported in DX10/DX10.1 hardware (with up to date drivers).

## Constructor & Destructor Documentation

## ◆ UavBufferPacked()

Ogre::UavBufferPacked::UavBufferPacked | ( | size_t | internalBufferStartBytes,
|  | size_t | numElements,
|  | uint32 | bytesPerElement,
|  | uint32 | bindFlags,
|  | void * | initialData,
|  | bool | keepAsShadow,
|  | VaoManager * | vaoManager,
|  | BufferInterface * | bufferInterface )

References Ogre::BufferPacked::BufferInterface.

## ◆ ~UavBufferPacked()

Ogre::UavBufferPacked::~UavBufferPacked | ( |  | ) |
| override

## Member Function Documentation

## ◆ bindBufferCS()

virtual void Ogre::UavBufferPacked::bindBufferCS | ( | uint16 | slot,
|  | size_t | offset = 0,
|  | size_t | sizeBytes = 0 )
| pure virtual

Binds the texture buffer to the given slot in the Vertex/Pixel/Geometry/Hull/Domain/Compute Shader.

Remarks
  Not all RS API separate by shader stage. For best compatibility, don't assign two different buffers at the same slot for different stages (just leave the slot empty on the stages you don't use).

Parameters

  slot | The slot to asign this constant buffer. In D3D11 it's called 'slot'. In GLSL it's called it's called 'binding'
  offset | 0-based offset. It is possible to bind a region of the buffer. Offset needs to be aligned. You can query the RS capabilities for the alignment, however 256 bytes is the maximum allowed alignment per the OpenGL specification, making it a safe bet to hardcode.
  sizeBytes | Size in bytes to bind the tex buffer. When zero, binds from offset until the end of the buffer.

Implemented in Ogre::D3D11UavBufferPacked, Ogre::GL3PlusUavBufferPacked, Ogre::MetalUavBufferPacked, Ogre::NULLUavBufferPacked, and Ogre::VulkanUavBufferPacked.

## ◆ destroyAllBufferViews()

void Ogre::UavBufferPacked::destroyAllBufferViews | ( |  | ) |

See destroyTexBufferView and getAsReadOnlyBufferView, this one does it on all the creates views.

## ◆ destroyReadOnlyBufferView()

void Ogre::UavBufferPacked::destroyReadOnlyBufferView | ( |  | ) |

Frees memory from the view created by getAsReadOnlyBufferView Does nothing if the view wasn't created.

## ◆ destroyTexBufferView()

void Ogre::UavBufferPacked::destroyTexBufferView | ( | PixelFormatGpu | pixelFormat | ) |

Frees memory from a view created by getAsTexBufferView Does nothing if a view of the given pixel format did not exist.

## ◆ getAsReadOnlyBufferView()

ReadOnlyBufferPacked * Ogre::UavBufferPacked::getAsReadOnlyBufferView | ( |  | ) |

Returns a ReadOnlyBufferPacked for binding to the GPU as a texture w/ read-only access.

Buffer must've been created with BB_FLAG_READONLY.

Remarks
  Don't try to use readRequest or map the returned pointer. All major operations except binding to the shader should be done through the UavBufferPacked.

  If this function was already called, it will return the same pointer as the last time, otherwise returns a new pointer

  Unlike getAsTexBufferView there is no pixelFormat because the returned pointer will always be format-less (e.g. will use UBO in GL & Vullkan, Structure Buffer in D3D11, etc)

Returns
  A ReadOnlyBufferPacked to be used to bind to the different stages. Do not destroy this buffer via VaoManager::destroyReadOnlyBuffer. See UavBufferPacked::destroyReadOnlyBufferView

## ◆ getAsTexBufferView()

TexBufferPacked * Ogre::UavBufferPacked::getAsTexBufferView | ( | PixelFormatGpu | pixelFormat | ) |

Returns a TexBufferPacked for binding to the GPU as a texture w/ read-only access.

Buffer must've been created with BB_FLAG_TEX.

Remarks
  Don't try to use readRequest or map the returned pointer. All major operations except binding to the shader should be done through the UavBufferPacked.

  If this function was already called, it will return the same pointer as the last time (though performs an O(N) search), otherwise returns a new pointer

Parameters

  pixelFormat | Format to reinterpret as. Note some RenderSystems (D3D11, Metal) may severely restrict or ignore this parameter.

Returns
  A TexBufferPacked to be used to bind to the different stages. Do not destroy this buffer via VaoManager::destroyTexBuffer. See UavBufferPacked::destroyTexBufferView

## ◆ getBufferPackedType()

BufferPackedTypes Ogre::UavBufferPacked::getBufferPackedType | ( |  | ) | const
| inlineoverridevirtual

Useful to query which one is the derived class.

Implements Ogre::BufferPacked.

References Ogre::BP_TYPE_UAV.

The documentation for this class was generated from the following file:

- OgreUavBufferPacked.h