Diligent Engine API Reference: Diligent::IBuffer Class Reference

Diligent Engine API Reference

Public Member Functions | List of all members
Diligent::IBuffer Class Referenceabstract

Buffer interface. More...

Inheritance diagram for Diligent::IBuffer:

## Public Member Functions
virtual void | QueryInterface (const Diligent::INTERFACE_ID &IID, IObject **ppInterface)=0
| Queries the specific interface, see IObject::QueryInterface() for details.
virtual const BufferDesc & | GetDesc () const =0
| Returns the buffer description used to create the object.
virtual void | UpdateData (class IDeviceContext *pContext, Uint32 Offset, Uint32 Size, const PVoid pData)=0
| Updates the data in the buffer. More...
virtual void | CopyData (IDeviceContext *pContext, IBuffer *pSrcBuffer, Uint32 SrcOffset, Uint32 DstOffset, Uint32 Size)=0
| Copies the data from other buffer. More...
virtual void | Map (IDeviceContext *pContext, MAP_TYPE MapType, Uint32 MapFlags, PVoid &pMappedData)=0
| Maps the buffer. More...
virtual void | Unmap (IDeviceContext *pContext, MAP_TYPE MapType, Uint32 MapFlags)=0
| Unmaps the previously mapped buffer. More...
virtual void | CreateView (const struct BufferViewDesc &ViewDesc, class IBufferView **ppView)=0
| Creates a new buffer view. More...
virtual IBufferView * | GetDefaultView (BUFFER_VIEW_TYPE ViewType)=0
| Returns the pointer to the default view. More...
virtual void * | GetNativeHandle ()=0
| Returns native buffer handle specific to the underlying graphics API. More...
Public Member Functions inherited from Diligent::IDeviceObject
virtual void | QueryInterface (const INTERFACE_ID &IID, IObject **ppInterface)=0
| Queries the specific interface, see IObject::QueryInterface() for details.

## Detailed Description

Buffer interface.

Defines the methods to manipulate a buffer object

## Member Function Documentation

## ◆ CopyData()

virtual void Diligent::IBuffer::CopyData | ( | IDeviceContext * | pContext,
|  | IBuffer * | pSrcBuffer,
|  | Uint32 | SrcOffset,
|  | Uint32 | DstOffset,
|  | Uint32 | Size
| ) |  |
| pure virtual

Copies the data from other buffer.

Parameters

  [in] | pContext | - Pointer to the device context interface to be used to perform the operation.
  [in] | pSrcBuffer | - Source buffer to copy data from.
  [in] | SrcOffset | - Offset in bytes from the beginning of the source buffer to the beginning of data to copy.
  [in] | DstOffset | - Offset in bytes from the beginning of the destination buffer to the beginning of the destination region.
  [in] | Size | - Size in bytes of data to copy.

Implemented in Diligent::BufferBase< IBufferD3D11, BufferViewD3D11Impl, FixedBlockMemoryAllocator >, Diligent::BufferBase< IBufferGL, BufferViewGLImpl, FixedBlockMemoryAllocator >, Diligent::BufferBase< IBufferD3D12, BufferViewD3D12Impl, FixedBlockMemoryAllocator >, Diligent::BufferD3D11Impl, Diligent::BufferGLImpl, and Diligent::BufferD3D12Impl.

## ◆ CreateView()

virtual void Diligent::IBuffer::CreateView | ( | const struct BufferViewDesc & | ViewDesc,
|  | class IBufferView ** | ppView
| ) |  |
| pure virtual

Creates a new buffer view.

Parameters

  [in] | ViewDesc | - View description. See Diligent::BufferViewDesc for details.
  [out] | ppView | - Address of the memory location where the pointer to the view interface will be written to.

Remarks
  To create a view addressing the entire buffer, set only BufferViewDesc::ViewType member of the ViewDesc structure and leave all other members in their default values.
  Buffer view will contain strong reference to the buffer, so the buffer will not be destroyed until all views are released.
  The function calls AddRef() for the created interface, so it must be released by a call to Release() when it is no longer needed.

Implemented in Diligent::BufferBase< IBufferD3D11, BufferViewD3D11Impl, FixedBlockMemoryAllocator >, Diligent::BufferBase< IBufferGL, BufferViewGLImpl, FixedBlockMemoryAllocator >, and Diligent::BufferBase< IBufferD3D12, BufferViewD3D12Impl, FixedBlockMemoryAllocator >.

## ◆ GetDefaultView()

virtual IBufferView* Diligent::IBuffer::GetDefaultView | ( | BUFFER_VIEW_TYPE | ViewType | ) |
| pure virtual

Returns the pointer to the default view.

Parameters

  [in] | ViewType | - Type of the requested view. See Diligent::BUFFER_VIEW_TYPE.

Returns
  Pointer to the interface

Note
  The function does not increase the reference counter for the returned interface, so Release() must NOT be called.

Implemented in Diligent::BufferBase< IBufferD3D11, BufferViewD3D11Impl, FixedBlockMemoryAllocator >, Diligent::BufferBase< IBufferGL, BufferViewGLImpl, FixedBlockMemoryAllocator >, and Diligent::BufferBase< IBufferD3D12, BufferViewD3D12Impl, FixedBlockMemoryAllocator >.

## ◆ GetNativeHandle()

virtual void* Diligent::IBuffer::GetNativeHandle | ( |  | ) |
| pure virtual

Returns native buffer handle specific to the underlying graphics API.

Returns
  pointer to ID3D11Resource interface, for D3D11 implementation
  pointer to ID3D12Resource interface, for D3D12 implementation
  GL buffer handle, for GL implementation

Implemented in Diligent::BufferD3D12Impl, Diligent::BufferD3D11Impl, and Diligent::BufferGLImpl.

## ◆ Map()

virtual void Diligent::IBuffer::Map | ( | IDeviceContext * | pContext,
|  | MAP_TYPE | MapType,
|  | Uint32 | MapFlags,
|  | PVoid & | pMappedData
| ) |  |
| pure virtual

Maps the buffer.

Parameters

  [in] | pContext | - Pointer to the device context interface to be used to perform the operation.
  [in] | MapType | - Type of the map operation. See Diligent::MAP_TYPE.
  [in] | MapFlags | - Special map flags. See Diligent::MAP_FLAGS.
  [out] | pMappedData | - Reference to the void pointer to store the address of the mapped region.

Implemented in Diligent::BufferBase< IBufferD3D11, BufferViewD3D11Impl, FixedBlockMemoryAllocator >, Diligent::BufferBase< IBufferGL, BufferViewGLImpl, FixedBlockMemoryAllocator >, Diligent::BufferBase< IBufferD3D12, BufferViewD3D12Impl, FixedBlockMemoryAllocator >, Diligent::BufferD3D11Impl, Diligent::BufferGLImpl, and Diligent::BufferD3D12Impl.

## ◆ Unmap()

virtual void Diligent::IBuffer::Unmap | ( | IDeviceContext * | pContext,
|  | MAP_TYPE | MapType,
|  | Uint32 | MapFlags
| ) |  |
| pure virtual

Unmaps the previously mapped buffer.

Parameters

  [in] | pContext | - Pointer to the device context interface to be used to perform the operation.
  [in] | MapType | - Type of the map operation. This parameter must match the type that was provided to the Map() method.
  [in] | MapFlags | - Map flags. This parameter must match the flags that were provided to the Map() method.

Implemented in Diligent::BufferBase< IBufferD3D11, BufferViewD3D11Impl, FixedBlockMemoryAllocator >, Diligent::BufferBase< IBufferGL, BufferViewGLImpl, FixedBlockMemoryAllocator >, Diligent::BufferBase< IBufferD3D12, BufferViewD3D12Impl, FixedBlockMemoryAllocator >, Diligent::BufferD3D11Impl, Diligent::BufferGLImpl, and Diligent::BufferD3D12Impl.

## ◆ UpdateData()

virtual void Diligent::IBuffer::UpdateData | ( | class IDeviceContext * | pContext,
|  | Uint32 | Offset,
|  | Uint32 | Size,
|  | const PVoid | pData
| ) |  |
| pure virtual

Updates the data in the buffer.

Parameters

  [in] | pContext | - Pointer to the device context interface to be used to perform the operation.
  [in] | Offset | - Offset in bytes from the beginning of the buffer to the update region.
  [in] | Size | - Size in bytes of the data region to update.
  [in] | pData | - Pointer to the data to store in the buffer.

Implemented in Diligent::BufferBase< IBufferD3D11, BufferViewD3D11Impl, FixedBlockMemoryAllocator >, Diligent::BufferBase< IBufferGL, BufferViewGLImpl, FixedBlockMemoryAllocator >, Diligent::BufferBase< IBufferD3D12, BufferViewD3D12Impl, FixedBlockMemoryAllocator >, Diligent::BufferD3D11Impl, Diligent::BufferGLImpl, and Diligent::BufferD3D12Impl.