Diligent Engine
 
Loading...
Searching...
No Matches
Diligent::RenderDeviceBase< EngineImplTraits > Class Template Referenceabstract

Base implementation of a render device. More...

#include <RenderDeviceBase.hpp>

Inheritance diagram for Diligent::RenderDeviceBase< EngineImplTraits >:
Diligent::ObjectBase< EngineImplTraits::RenderDeviceInterface > Diligent::RefCountedObject< EngineImplTraits::RenderDeviceInterface > Diligent::RenderDeviceD3DBase< EngineD3D11ImplTraits > Diligent::RenderDeviceNextGenBase< RenderDeviceBase< EngineVkImplTraits >, ICommandQueueVk > Diligent::RenderDeviceD3DBase< EngineImplTraits > Diligent::RenderDeviceD3D11Impl Diligent::RenderDeviceVkImpl Diligent::RenderDeviceNextGenBase< RenderDeviceD3DBase< EngineD3D12ImplTraits >, ICommandQueueD3D12 > Diligent::RenderDeviceD3D12Impl

Public Member Functions

 RenderDeviceBase (IReferenceCounters *pRefCounters, IMemoryAllocator &RawMemAllocator, IEngineFactory *pEngineFactory, const EngineCreateInfo &EngineCI, const GraphicsAdapterInfo &AdapterInfo)
 
virtual void DILIGENT_CALL_TYPE CreateResourceMapping (const ResourceMappingCreateInfo &ResMappingCI, IResourceMapping **ppMapping) override final
 Implementation of IRenderDevice::CreateResourceMapping().
 
virtual const RenderDeviceInfo &DILIGENT_CALL_TYPE GetDeviceInfo () const override final
 Implementation of IRenderDevice::GetDeviceInfo().
 
virtual const GraphicsAdapterInfo &DILIGENT_CALL_TYPE GetAdapterInfo () const override final
 Implementation of IRenderDevice::GetAdapterInfo().
 
virtual const TextureFormatInfo &DILIGENT_CALL_TYPE GetTextureFormatInfo (TEXTURE_FORMAT TexFormat) const override final
 Implementation of IRenderDevice::GetTextureFormatInfo().
 
virtual const TextureFormatInfoExt &DILIGENT_CALL_TYPE GetTextureFormatInfoExt (TEXTURE_FORMAT TexFormat) override final
 Implementation of IRenderDevice::GetTextureFormatInfoExt().
 
virtual void DILIGENT_CALL_TYPE CreateTilePipelineState (const TilePipelineStateCreateInfo &PSOCreateInfo, IPipelineState **ppPipelineState) override
 Base implementation of IRenderDevice::CreateTilePipelineState().
 
void SetImmediateContext (size_t Ctx, DeviceContextImplType *pImmediateContext)
 Set weak reference to the immediate context.
 
size_t GetNumImmediateContexts () const
 Returns the number of immediate contexts.
 
size_t GetNumDeferredContexts () const
 Returns number of deferred contexts.
 

Protected Member Functions

template<typename ObjectType, typename ObjectDescType, typename ObjectConstructorType>
void CreateDeviceObject (const Char *ObjectTypeName, const ObjectDescType &Desc, ObjectType **ppObject, ObjectConstructorType ConstructObject)
 Helper template function to facilitate device object creation.
 

Protected Attributes

ObjectsRegistry< SamplerDesc, RefCntAutoPtr< ISampler > > m_SamplersRegistry
 Sampler state registry.
 
std::vector< RefCntWeakPtr< DeviceContextImplType >, STDAllocatorRawMem< RefCntWeakPtr< DeviceContextImplType > > > m_wpImmediateContexts
 
std::mutex m_DeferredCtxMtx
 Weak references to deferred contexts.
 
IMemoryAllocatorm_RawMemAllocator
 Raw memory allocator.
 
FixedBlockMemoryAllocator m_TexObjAllocator
 Allocator for texture objects.
 
FixedBlockMemoryAllocator m_TexViewObjAllocator
 Allocator for texture view objects.
 
FixedBlockMemoryAllocator m_BufObjAllocator
 Allocator for buffer objects.
 
FixedBlockMemoryAllocator m_BuffViewObjAllocator
 Allocator for buffer view objects.
 
FixedBlockMemoryAllocator m_ShaderObjAllocator
 Allocator for shader objects.
 
FixedBlockMemoryAllocator m_SamplerObjAllocator
 Allocator for sampler objects.
 
FixedBlockMemoryAllocator m_PSOAllocator
 Allocator for pipeline state objects.
 
FixedBlockMemoryAllocator m_SRBAllocator
 Allocator for shader resource binding objects.
 
FixedBlockMemoryAllocator m_ResMappingAllocator
 Allocator for resource mapping objects.
 
FixedBlockMemoryAllocator m_FenceAllocator
 Allocator for fence objects.
 
FixedBlockMemoryAllocator m_QueryAllocator
 Allocator for query objects.
 
FixedBlockMemoryAllocator m_RenderPassAllocator
 Allocator for render pass objects.
 
FixedBlockMemoryAllocator m_FramebufferAllocator
 Allocator for framebuffer objects.
 
FixedBlockMemoryAllocator m_BLASAllocator
 Allocator for bottom-level acceleration structure objects.
 
FixedBlockMemoryAllocator m_TLASAllocator
 Allocator for top-level acceleration structure objects.
 
FixedBlockMemoryAllocator m_SBTAllocator
 Allocator for shader binding table objects.
 
FixedBlockMemoryAllocator m_PipeResSignAllocator
 Allocator for pipeline resource signature objects.
 
FixedBlockMemoryAllocator m_MemObjAllocator
 Allocator for device memory objects.
 
FixedBlockMemoryAllocator m_PSOCacheAllocator
 Allocator for pipeline state cache objects.
 

Detailed Description

template<typename EngineImplTraits>
class Diligent::RenderDeviceBase< EngineImplTraits >

Base implementation of a render device.

Template Parameters
EngineImplTraits- Engine implementation type traits.
Warning
Render device must NOT hold strong references to any object it creates to avoid cyclic dependencies. Device context, swap chain and all object the device creates keep strong reference to the device. Device only holds weak reference to the immediate context.

Constructor & Destructor Documentation

◆ RenderDeviceBase()

template<typename EngineImplTraits>
Diligent::RenderDeviceBase< EngineImplTraits >::RenderDeviceBase ( IReferenceCounters * pRefCounters,
IMemoryAllocator & RawMemAllocator,
IEngineFactory * pEngineFactory,
const EngineCreateInfo & EngineCI,
const GraphicsAdapterInfo & AdapterInfo )
inline
Parameters
pRefCounters- Reference counters object that controls the lifetime of this render device
RawMemAllocator- Allocator that will be used to allocate memory for all device objects (including render device itself)
pEngineFactory- Engine factory that was used to create this device
EngineCI- Engine create info struct, see Diligent::EngineCreateInfo.
AdapterInfo- Graphics adapter info, see Diligent::AdapterInfo.
Remarks
Render device uses fixed block allocators (see FixedBlockMemoryAllocator) to allocate memory for device objects. The object sizes from EngineImplTraits are used to initialize the allocators.

Member Function Documentation

◆ CreateDeviceObject()

template<typename EngineImplTraits>
template<typename ObjectType, typename ObjectDescType, typename ObjectConstructorType>
void Diligent::RenderDeviceBase< EngineImplTraits >::CreateDeviceObject ( const Char * ObjectTypeName,
const ObjectDescType & Desc,
ObjectType ** ppObject,
ObjectConstructorType ConstructObject )
inlineprotected

Helper template function to facilitate device object creation.

Template Parameters
ObjectType- The type of the object being created (IBuffer, ITexture, etc.).
ObjectDescType- The type of the object description structure (BufferDesc, TextureDesc, etc.).
ObjectConstructorType- The type of the function that constructs the object.
Parameters
ObjectTypeName- String name of the object type ("buffer", "texture", etc.).
Desc- Object description.
ppObject- Memory address where the pointer to the created object will be stored.
ConstructObject- Function that constructs the object.

Member Data Documentation

◆ m_wpImmediateContexts

template<typename EngineImplTraits>
std::vector<RefCntWeakPtr<DeviceContextImplType>, STDAllocatorRawMem<RefCntWeakPtr<DeviceContextImplType> > > Diligent::RenderDeviceBase< EngineImplTraits >::m_wpImmediateContexts
protected

Weak references to immediate contexts. Immediate contexts hold strong reference to the device, so we must use weak references to avoid circular dependencies.