Diligent Engine API Reference: Diligent::BufferBase< BaseInterface, BufferViewImplType, TBuffViewObjAllocator > Class Template Reference

Diligent Engine API Reference

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Diligent::BufferBase< BaseInterface, BufferViewImplType, TBuffViewObjAllocator > Class Template Referenceabstract

Template class implementing base functionality for a buffer object. More...

Inheritance diagram for Diligent::BufferBase< BaseInterface, BufferViewImplType, TBuffViewObjAllocator >:

## Public Member Functions
| BufferBase (IReferenceCounters *pRefCounters, TBuffViewObjAllocator &BuffViewObjAllocator, IRenderDevice *pDevice, const BufferDesc &BuffDesc, bool bIsDeviceInternal)
virtual void | UpdateData (IDeviceContext *pContext, Uint32 Offset, Uint32 Size, const PVoid pData) override=0
| Base implementation of IBuffer::UpdateData(); validates input parameters.
virtual void | CopyData (IDeviceContext *pContext, IBuffer *pSrcBuffer, Uint32 SrcOffset, Uint32 DstOffset, Uint32 Size) override=0
| Base implementation of IBuffer::CopyData(); validates input parameters.
virtual void | Map (IDeviceContext *pContext, MAP_TYPE MapType, Uint32 MapFlags, PVoid &pMappedData) override
| Base implementation of IBuffer::Map(); validates input parameters.
virtual void | Unmap (IDeviceContext *pContext, MAP_TYPE MapType, Uint32 MapFlags) override=0
| Base implementation of IBuffer::Unmap()
virtual void | CreateView (const struct BufferViewDesc &ViewDesc, IBufferView **ppView) override
| Implementation of IBuffer::CreateView(); calls CreateViewInternal() virtual function that creates buffer view for the specific engine implementation.
virtual IBufferView * | GetDefaultView (BUFFER_VIEW_TYPE ViewType) override
| Implementation of IBuffer::GetDefaultView().
void | CreateDefaultViews ()
| Creates default buffer views. More...
Public Member Functions inherited from Diligent::DeviceObjectBase< BaseInterface, BufferDesc >
| DeviceObjectBase (IReferenceCounters *pRefCounters, IRenderDevice *pDevice, const BufferDesc &ObjDesc, bool bIsDeviceInternal=false)
UniqueIdentifier | GetUniqueID () const
| Returns unique identifier. More...

## Protected Member Functions
virtual void | CreateViewInternal (const struct BufferViewDesc &ViewDesc, IBufferView **ppView, bool bIsDefaultView)=0
| Pure virtual function that creates buffer view for the specific engine implementation.
void | CorrectBufferViewDesc (struct BufferViewDesc &ViewDesc)
| Corrects buffer view description and validates view parameters.

## Protected Attributes
std::unique_ptr< BufferViewImplType, STDDeleter< BufferViewImplType, TBuffViewObjAllocator > > | m_pDefaultUAV
| Default UAV addressing the entire buffer.
std::unique_ptr< BufferViewImplType, STDDeleter< BufferViewImplType, TBuffViewObjAllocator > > | m_pDefaultSRV
| Default SRV addressing the entire buffer.
Protected Attributes inherited from Diligent::DeviceObjectBase< BaseInterface, BufferDesc >
const String | m_ObjectNameCopy
| Copy of a device object name. More...
BufferDesc | m_Desc
| Object description.

## Detailed Description

### template<class BaseInterface, class BufferViewImplType, class TBuffViewObjAllocator>
class Diligent::BufferBase< BaseInterface, BufferViewImplType, TBuffViewObjAllocator >

Template class implementing base functionality for a buffer object.

Template Parameters

  BaseInterface | - base interface that this class will inheret (Diligent::IBufferD3D11, Diligent::IBufferD3D12 or Diligent::IBufferGL).
  BufferViewImplType | - type of the buffer view implementation (Diligent::BufferViewD3D11Impl, Diligent::BufferViewD3D12Impl or Diligent::BufferViewGLImpl)
  TBuffViewObjAllocator | - type of the allocator that is used to allocate memory for the buffer view object instances

## Constructor & Destructor Documentation

## ◆ BufferBase()

template<class BaseInterface, class BufferViewImplType, class TBuffViewObjAllocator>

Diligent::BufferBase< BaseInterface, BufferViewImplType, TBuffViewObjAllocator >::BufferBase | ( | IReferenceCounters * | pRefCounters,
|  | TBuffViewObjAllocator & | BuffViewObjAllocator,
|  | IRenderDevice * | pDevice,
|  | const BufferDesc & | BuffDesc,
|  | bool | bIsDeviceInternal
| ) |  |
| inline

Parameters

  pRefCounters | - reference counters object that controls the lifetime of this buffer.
  BuffViewObjAllocator | - allocator that is used to allocate memory for the buffer view instances. This parameter is only used for debug purposes.
  pDevice | - pointer to the device.
  BuffDesc | - buffer description.
  bIsDeviceInternal | - flag indicating if the buffer is an internal device object and must not keep a strong reference to the device.

## Member Function Documentation

## ◆ CreateDefaultViews()

template<class BaseInterface , class BufferViewImplType , class TBuffViewObjAllocator >

void Diligent::BufferBase< BaseInterface, BufferViewImplType, TBuffViewObjAllocator >::CreateDefaultViews | ( |  | ) |

Creates default buffer views.

- Creates default shader resource view addressing the entire buffer if Diligent::BIND_SHADER_RESOURCE flag is set
- Creates default unordered access view addressing the entire buffer if Diligent::BIND_UNORDERED_ACCESS flag is set

The function calls CreateViewInternal().