Cogs.Core
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Cogs::GraphicsDeviceD3D11 Struct Reference
Inheritance diagram for Cogs::GraphicsDeviceD3D11:
Cogs::IGraphicsDevice

Public Member Functions

 GraphicsDeviceD3D11 (RenderingAllocatorInfo *allocator)
 
bool initialize ()
 Initializes the graphics device with the settings previous set through calling setSettings.
 
std::string getIdentifier () const override
 Get the graphics device identifier.
 
GraphicsDeviceType getType () const override
 Get the type of the graphics device.
 
void beginFrame ()
 Signal the beginning of a new frame to the graphics device.
 
void endFrame (uint32_t syncInterval=0, uint32_t presentFlags=PresentFlags::None)
 Signal the end of a frame to the graphics device.
 
void releaseResources ()
 Release all resources allocated.
 
virtual ISwapChaincreateSwapChain (struct WindowData *windowData) override
 Create a new swap chain for the specified window.
 
virtual void deleteSwapChain (ISwapChain *swapChain) override
 Deletes the specified swap chain.
 
void setSize (int newWidth, int newHeight)
 Set the size of the main drawing buffer used by the graphics device in pixels.
 
bool getSize (int &w, int &h) const override
 Retrieve the size previously set by setSize.
 
bool resizeSharedSurfaces ()
 
IBuffersgetBuffers ()
 Get a pointer to the buffer management interface.
 
ITexturesgetTextures ()
 Get a pointer to the texture management interface.
 
IContextgetImmediateContext ()
 Get a pointer to the immediate context used to issue commands to the graphics device.
 
IEffectsgetEffects ()
 Get a pointer to the effect management interface.
 
IPipelineStatesgetPipelineStates ()
 Get a pointer to the pipeline state management interface.
 
IRenderTargetsgetRenderTargets ()
 Get a pointer to the render target management interface.
 
ICapabilitiesgetCapabilities ()
 Get a pointer to the capability management interface used to query the graphics device capability flags.
 
ISyncObjectsgetSyncObjects () override
 Get a pointer to the sync object management interface.
 
SwapChainD3D11getDefaultSwapChain () override
 Get a pointer to the default swap chain for this graphics device.
 
virtual void * getNativeDevice () override
 
ResourcePointer< ID3D11Device > & getDevice ()
 
Memory::AllocatorgetResourceAllocator ()
 
ResourceStatistics getResourceStatistics () override
 
- Public Member Functions inherited from Cogs::IGraphicsDevice
virtual ~IGraphicsDevice ()=default
 Destructor.
 
virtual bool initializeThread ()
 Initialize the graphics device for operation on the current thread.
 
virtual SharedGraphicsContextcreateSharedContext ()
 Create a shared graphics context that can be used to activate another thread for rendering.
 
virtual void activateSharedContext (SharedGraphicsContext *)
 Activates the given shared context on the calling thread.
 
virtual void releaseSharedContext (SharedGraphicsContext *)
 Releases the given shared context.
 
virtual bool initialize ()=0
 Initializes the graphics device with the settings previous set through calling setSettings.
 
virtual bool isInitializationFinished ()
 Check if async initialization is finished.
 
virtual ResourceStatistics getResourceStatistics ()
 
virtual std::string getIdentifier () const
 Get the graphics device identifier.
 
virtual GraphicsDeviceType getType () const
 Get the type of the graphics device.
 
virtual void setSize (int width, int height)=0
 Set the size of the main drawing buffer used by the graphics device in pixels.
 
virtual bool getSize (int &width, int &height) const =0
 Retrieve the size previously set by setSize.
 
virtual void beginFrame ()=0
 Signal the beginning of a new frame to the graphics device.
 
virtual void endFrame (uint32_t syncInterval=0, uint32_t presentFlags=PresentFlags::None)=0
 Signal the end of a frame to the graphics device.
 
virtual void waitForCommandSync ()
 Wait for any GPU commands on the current device to finish before returning.
 
virtual void releaseResources ()=0
 Release all resources allocated.
 
virtual ISwapChaincreateSwapChain (struct WindowData *)
 Create a new swap chain for the specified window.
 
virtual void deleteSwapChain (ISwapChain *)
 Deletes the specified swap chain.
 
virtual IContextgetImmediateContext ()=0
 Get a pointer to the immediate context used to issue commands to the graphics device.
 
virtual IBuffersgetBuffers ()=0
 Get a pointer to the buffer management interface.
 
virtual ITexturesgetTextures ()=0
 Get a pointer to the texture management interface.
 
virtual IRenderTargetsgetRenderTargets ()=0
 Get a pointer to the render target management interface.
 
virtual IEffectsgetEffects ()=0
 Get a pointer to the effect management interface.
 
virtual IPipelineStatesgetPipelineStates ()=0
 Get a pointer to the pipeline state management interface.
 
virtual ICapabilitiesgetCapabilities ()=0
 Get a pointer to the capability management interface used to query the graphics device capability flags.
 
virtual ISwapChaingetDefaultSwapChain ()=0
 Get a pointer to the default swap chain for this graphics device.
 
virtual ISyncObjectsgetSyncObjects ()=0
 Get a pointer to the sync object management interface.
 
virtual void * getNativeDevice ()
 
virtual bool setSettings (const GraphicsDeviceSettings &newSettings)
 Updates the settings associated with this device.
 
const GraphicsDeviceSettingsgetSettings () const
 

Private Member Functions

bool initializeDeviceAndSwapChain ()
 
bool initializeDeviceShared ()
 
void setupDebugging ()
 
HRESULT createDevice (IDXGIAdapter *adapter, D3D_DRIVER_TYPE driverType, UINT flags, const std::vector< D3D_FEATURE_LEVEL > &featureLevelsRequested, D3D_FEATURE_LEVEL &apiFeatureLevel)
 

Private Attributes

std::unique_ptr< Memory::AllocatorresourceAllocator
 
ResourcePointer< ID3D11Device > device
 
ResourcePointer< ID3D11Device1 > device1
 
ResourcePointer< ID3D11Device5 > device5
 
ResourcePointer< ID3D11InfoQueue > infoQueue
 
SwapChainD3D11 defaultSwapChain
 
ContextD3D11 context
 
CapabilitiesD3D11 capabilities
 
BuffersD3D11 buffers
 
TexturesD3D11 textures
 
EffectsD3D11 effects
 
RenderTargetsD3D11 renderTargets
 
SyncObjectsD3D11 syncObjects
 
bool inFrame = false
 

Additional Inherited Members

- Static Public Member Functions inherited from Cogs::IGraphicsDevice
static void fillGraphicsSettings (struct WindowData *windowData, int requestedSampleCount)
 Set platform specific graphics settings used for window creation e.g.: XVisualInfo on Linux.
 
- Protected Attributes inherited from Cogs::IGraphicsDevice
GraphicsDeviceSettings settings
 
std::vector< ISwapChain * > swapChains
 

Detailed Description

Definition at line 18 of file GraphicsDeviceD3D11.h.

Constructor & Destructor Documentation

◆ GraphicsDeviceD3D11()

Cogs::GraphicsDeviceD3D11::GraphicsDeviceD3D11 ( RenderingAllocatorInfo allocator)

Definition at line 74 of file GraphicsDeviceD3D11.cpp.

Member Function Documentation

◆ beginFrame()

void Cogs::GraphicsDeviceD3D11::beginFrame ( )
virtual

Signal the beginning of a new frame to the graphics device.

Implements Cogs::IGraphicsDevice.

Definition at line 124 of file GraphicsDeviceD3D11.cpp.

◆ createDevice()

HRESULT Cogs::GraphicsDeviceD3D11::createDevice ( IDXGIAdapter *  adapter,
D3D_DRIVER_TYPE  driverType,
UINT  flags,
const std::vector< D3D_FEATURE_LEVEL > &  featureLevelsRequested,
D3D_FEATURE_LEVEL &  apiFeatureLevel 
)
private

Definition at line 480 of file GraphicsDeviceD3D11.cpp.

◆ createSwapChain()

Cogs::ISwapChain * Cogs::GraphicsDeviceD3D11::createSwapChain ( struct WindowData )
overridevirtual

Create a new swap chain for the specified window.

Returns
A pointer to the newly created swap chain.

Reimplemented from Cogs::IGraphicsDevice.

Definition at line 178 of file GraphicsDeviceD3D11.cpp.

◆ deleteSwapChain()

void Cogs::GraphicsDeviceD3D11::deleteSwapChain ( ISwapChain )
overridevirtual

Deletes the specified swap chain.

The swap chain must have been previously created through a call to createSwapChain.

Reimplemented from Cogs::IGraphicsDevice.

Definition at line 189 of file GraphicsDeviceD3D11.cpp.

◆ endFrame()

void Cogs::GraphicsDeviceD3D11::endFrame ( uint32_t  syncInterval = 0,
uint32_t  presentFlags = PresentFlags::None 
)
virtual

Signal the end of a frame to the graphics device.

When the graphics device itself is responsible for managing the device context (e.g in D3D11), and the PresentFlags::NoSwap flag is not set, this will swap the back buffer to make the result of previous drawing visible.

Parameters
syncIntervalSynchronization interval.
  • 0 - No synchronization, presentation occurs immediately.
  • 1 - Synchronize presentation after 1 vertical blank.
presentFlagsA combination of PresentFlags controlling the presentation of the rendered frame.
See also
PresentFlags

Implements Cogs::IGraphicsDevice.

Definition at line 137 of file GraphicsDeviceD3D11.cpp.

References Cogs::Logging::Log::logFileLine(), and Cogs::Logging::Unspecified.

◆ getBuffers()

IBuffers * Cogs::GraphicsDeviceD3D11::getBuffers ( )
inlinevirtual

Get a pointer to the buffer management interface.

Returns
A pointer to the buffer management interface.

Implements Cogs::IGraphicsDevice.

Definition at line 41 of file GraphicsDeviceD3D11.h.

◆ getCapabilities()

ICapabilities * Cogs::GraphicsDeviceD3D11::getCapabilities ( )
inlinevirtual

Get a pointer to the capability management interface used to query the graphics device capability flags.

Returns
A pointer to the capability management interface.

Implements Cogs::IGraphicsDevice.

Definition at line 47 of file GraphicsDeviceD3D11.h.

◆ getDefaultSwapChain()

SwapChainD3D11 * Cogs::GraphicsDeviceD3D11::getDefaultSwapChain ( )
inlineoverridevirtual

Get a pointer to the default swap chain for this graphics device.

Returns
A pointer to the default swap chain.

Implements Cogs::IGraphicsDevice.

Definition at line 49 of file GraphicsDeviceD3D11.h.

◆ getDevice()

ResourcePointer< ID3D11Device > & Cogs::GraphicsDeviceD3D11::getDevice ( )
inline

Definition at line 52 of file GraphicsDeviceD3D11.h.

◆ getEffects()

IEffects * Cogs::GraphicsDeviceD3D11::getEffects ( )
inlinevirtual

Get a pointer to the effect management interface.

Returns
A pointer to the effect management interface.

Implements Cogs::IGraphicsDevice.

Definition at line 44 of file GraphicsDeviceD3D11.h.

◆ getIdentifier()

std::string Cogs::GraphicsDeviceD3D11::getIdentifier ( ) const
inlineoverridevirtual

Get the graphics device identifier.

Returns
A string containing the name of the currently initialized graphics device.

Reimplemented from Cogs::IGraphicsDevice.

Definition at line 26 of file GraphicsDeviceD3D11.h.

◆ getImmediateContext()

IContext * Cogs::GraphicsDeviceD3D11::getImmediateContext ( )
inlinevirtual

Get a pointer to the immediate context used to issue commands to the graphics device.

Returns
A pointer to the context interface.

Implements Cogs::IGraphicsDevice.

Definition at line 43 of file GraphicsDeviceD3D11.h.

◆ getNativeDevice()

virtual void * Cogs::GraphicsDeviceD3D11::getNativeDevice ( )
inlineoverridevirtual

Reimplemented from Cogs::IGraphicsDevice.

Definition at line 51 of file GraphicsDeviceD3D11.h.

◆ getPipelineStates()

IPipelineStates * Cogs::GraphicsDeviceD3D11::getPipelineStates ( )
inlinevirtual

Get a pointer to the pipeline state management interface.

Returns
A pointer to the pipeline state management interface.

Implements Cogs::IGraphicsDevice.

Definition at line 45 of file GraphicsDeviceD3D11.h.

◆ getRenderTargets()

IRenderTargets * Cogs::GraphicsDeviceD3D11::getRenderTargets ( )
inlinevirtual

Get a pointer to the render target management interface.

Returns
A pointer to the render target management interface.

Implements Cogs::IGraphicsDevice.

Definition at line 46 of file GraphicsDeviceD3D11.h.

◆ getResourceAllocator()

Memory::Allocator * Cogs::GraphicsDeviceD3D11::getResourceAllocator ( )
inline

Definition at line 53 of file GraphicsDeviceD3D11.h.

◆ getResourceStatistics()

Cogs::ResourceStatistics Cogs::GraphicsDeviceD3D11::getResourceStatistics ( )
overridevirtual

Reimplemented from Cogs::IGraphicsDevice.

Definition at line 461 of file GraphicsDeviceD3D11.cpp.

◆ getSize()

bool Cogs::GraphicsDeviceD3D11::getSize ( int &  width,
int &  height 
) const
overridevirtual

Retrieve the size previously set by setSize.

Implements Cogs::IGraphicsDevice.

Definition at line 203 of file GraphicsDeviceD3D11.cpp.

◆ getSyncObjects()

ISyncObjects * Cogs::GraphicsDeviceD3D11::getSyncObjects ( )
inlineoverridevirtual

Get a pointer to the sync object management interface.

Returns
A pointer to the sync object management interface.

Implements Cogs::IGraphicsDevice.

Definition at line 48 of file GraphicsDeviceD3D11.h.

◆ getTextures()

ITextures * Cogs::GraphicsDeviceD3D11::getTextures ( )
inlinevirtual

Get a pointer to the texture management interface.

Returns
A pointer to the texture management interface.

Implements Cogs::IGraphicsDevice.

Definition at line 42 of file GraphicsDeviceD3D11.h.

◆ getType()

GraphicsDeviceType Cogs::GraphicsDeviceD3D11::getType ( ) const
inlineoverridevirtual

Get the type of the graphics device.

Returns
The identifier of the graphics device.

Reimplemented from Cogs::IGraphicsDevice.

Definition at line 27 of file GraphicsDeviceD3D11.h.

References Cogs::Direct3D11.

◆ initialize()

bool Cogs::GraphicsDeviceD3D11::initialize ( )
virtual

Initializes the graphics device with the settings previous set through calling setSettings.

Implements Cogs::IGraphicsDevice.

Definition at line 84 of file GraphicsDeviceD3D11.cpp.

References Cogs::UseSharedSurface.

◆ initializeDeviceAndSwapChain()

bool Cogs::GraphicsDeviceD3D11::initializeDeviceAndSwapChain ( )
private

Definition at line 258 of file GraphicsDeviceD3D11.cpp.

◆ initializeDeviceShared()

bool Cogs::GraphicsDeviceD3D11::initializeDeviceShared ( )
private

Definition at line 378 of file GraphicsDeviceD3D11.cpp.

◆ releaseResources()

void Cogs::GraphicsDeviceD3D11::releaseResources ( )
virtual

Release all resources allocated.

Implements Cogs::IGraphicsDevice.

Definition at line 171 of file GraphicsDeviceD3D11.cpp.

◆ resizeSharedSurfaces()

bool Cogs::GraphicsDeviceD3D11::resizeSharedSurfaces ( )

Definition at line 209 of file GraphicsDeviceD3D11.cpp.

◆ setSize()

void Cogs::GraphicsDeviceD3D11::setSize ( int  width,
int  height 
)
virtual

Set the size of the main drawing buffer used by the graphics device in pixels.

Parameters
widthWidth of the drawing buffer in pixels.
heightHeight of the drawing buffer in pixels.

Implements Cogs::IGraphicsDevice.

Definition at line 199 of file GraphicsDeviceD3D11.cpp.

◆ setupDebugging()

void Cogs::GraphicsDeviceD3D11::setupDebugging ( )
private

Definition at line 425 of file GraphicsDeviceD3D11.cpp.

Member Data Documentation

◆ buffers

BuffersD3D11 Cogs::GraphicsDeviceD3D11::buffers
private

Definition at line 79 of file GraphicsDeviceD3D11.h.

◆ capabilities

CapabilitiesD3D11 Cogs::GraphicsDeviceD3D11::capabilities
private

Definition at line 78 of file GraphicsDeviceD3D11.h.

◆ context

ContextD3D11 Cogs::GraphicsDeviceD3D11::context
private

Definition at line 77 of file GraphicsDeviceD3D11.h.

◆ defaultSwapChain

SwapChainD3D11 Cogs::GraphicsDeviceD3D11::defaultSwapChain
private

Definition at line 76 of file GraphicsDeviceD3D11.h.

◆ device

ResourcePointer<ID3D11Device> Cogs::GraphicsDeviceD3D11::device
private

Definition at line 71 of file GraphicsDeviceD3D11.h.

◆ device1

ResourcePointer<ID3D11Device1> Cogs::GraphicsDeviceD3D11::device1
private

Definition at line 72 of file GraphicsDeviceD3D11.h.

◆ device5

ResourcePointer<ID3D11Device5> Cogs::GraphicsDeviceD3D11::device5
private

Definition at line 73 of file GraphicsDeviceD3D11.h.

◆ effects

EffectsD3D11 Cogs::GraphicsDeviceD3D11::effects
private

Definition at line 81 of file GraphicsDeviceD3D11.h.

◆ infoQueue

ResourcePointer<ID3D11InfoQueue> Cogs::GraphicsDeviceD3D11::infoQueue
private

Definition at line 74 of file GraphicsDeviceD3D11.h.

◆ inFrame

bool Cogs::GraphicsDeviceD3D11::inFrame = false
private

Definition at line 85 of file GraphicsDeviceD3D11.h.

◆ renderTargets

RenderTargetsD3D11 Cogs::GraphicsDeviceD3D11::renderTargets
private

Definition at line 82 of file GraphicsDeviceD3D11.h.

◆ resourceAllocator

std::unique_ptr<Memory::Allocator> Cogs::GraphicsDeviceD3D11::resourceAllocator
private

Definition at line 65 of file GraphicsDeviceD3D11.h.

◆ syncObjects

SyncObjectsD3D11 Cogs::GraphicsDeviceD3D11::syncObjects
private

Definition at line 83 of file GraphicsDeviceD3D11.h.

◆ textures

TexturesD3D11 Cogs::GraphicsDeviceD3D11::textures
private

Definition at line 80 of file GraphicsDeviceD3D11.h.


The documentation for this struct was generated from the following files: