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

Public Member Functions

 GraphicsDeviceD3D12 (RenderingAllocatorInfo *)
 
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 () override
 Signal the beginning of a new frame to the graphics device.
 
void endFrame (uint32_t syncInterval=0, uint32_t presentFlags=PresentFlags::None) override
 Signal the end of a frame to the graphics device.
 
void waitForPreviousFrame ()
 
void releaseResources () override
 Release all resources allocated.
 
void setSize (int width, int height) override
 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.
 
void setVerticalSync (bool enabled)
 
IBuffersgetBuffers () override
 Get a pointer to the buffer management interface.
 
ITexturesgetTextures () override
 Get a pointer to the texture management interface.
 
IContextgetImmediateContext () override
 Get a pointer to the immediate context used to issue commands to the graphics device.
 
IEffectsgetEffects () override
 Get a pointer to the effect management interface.
 
IPipelineStatesgetPipelineStates ()
 Get a pointer to the pipeline state management interface.
 
IRenderTargetsgetRenderTargets () override
 Get a pointer to the render target management interface.
 
ICapabilitiesgetCapabilities () override
 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.
 
ISwapChaingetDefaultSwapChain () override
 Get a pointer to the default swap chain for this graphics device.
 
void waitForCommandSync () override
 Wait for any GPU commands on the current device to finish before returning.
 
void * getNativeDevice () override
 
HRESULT initializeDevice ()
 
HRESULT initializeDeviceShared ()
 
HRESULT initializeDeviceAndSwapChain ()
 
HRESULT resizeSharedSurfaces ()
 
HRESULT createRenderTargetView ()
 
HRESULT createDepthStencilView ()
 
- 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
 

Public Attributes

int indexLastSwapBuf = 0
 
ResourcePointer< ID3D12Fence > deviceFence
 
UINT64 currentFence = 0
 
HANDLE eventHandle = nullptr
 
ResourcePointer< ID3D12Device > device
 
ResourcePointer< IDXGISwapChain > swapChain
 
ResourcePointer< ID3D12CommandQueue > commandQueue
 
RenderTargetHandle renderTarget [numSwapBufs]
 
DepthStencilHandle depthTarget
 
TextureHandle depthTexture
 
ResourcePointer< ID3D12Resource > multisampleBackBuffer
 
ContextD3D12 context
 
CapabilitiesD3D12 capabilities
 
BuffersD3D12 buffers
 
TexturesD3D12 textures
 
EffectsD3D12 effects
 
RenderTargetsD3D12 renderTargets
 
SyncObjectsD3D12 syncObjects
 
int width
 
int height
 
bool fullscreenMode = false
 
bool verticalSync = true
 

Static Public Attributes

static const int numSwapBufs = 2
 

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 21 of file GraphicsDeviceD3D12.h.

Constructor & Destructor Documentation

◆ GraphicsDeviceD3D12()

Cogs::GraphicsDeviceD3D12::GraphicsDeviceD3D12 ( RenderingAllocatorInfo )

Definition at line 15 of file GraphicsDeviceD3D12.cpp.

◆ ~GraphicsDeviceD3D12()

Cogs::GraphicsDeviceD3D12::~GraphicsDeviceD3D12 ( )

Definition at line 23 of file GraphicsDeviceD3D12.cpp.

Member Function Documentation

◆ beginFrame()

void Cogs::GraphicsDeviceD3D12::beginFrame ( )
overridevirtual

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

Implements Cogs::IGraphicsDevice.

Definition at line 274 of file GraphicsDeviceD3D12.cpp.

◆ createDepthStencilView()

HRESULT Cogs::GraphicsDeviceD3D12::createDepthStencilView ( )

Definition at line 257 of file GraphicsDeviceD3D12.cpp.

◆ createRenderTargetView()

HRESULT Cogs::GraphicsDeviceD3D12::createRenderTargetView ( )

Definition at line 199 of file GraphicsDeviceD3D12.cpp.

◆ endFrame()

void Cogs::GraphicsDeviceD3D12::endFrame ( uint32_t  syncInterval = 0,
uint32_t  presentFlags = PresentFlags::None 
)
overridevirtual

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 287 of file GraphicsDeviceD3D12.cpp.

◆ getBuffers()

IBuffers * Cogs::GraphicsDeviceD3D12::getBuffers ( )
inlineoverridevirtual

Get a pointer to the buffer management interface.

Returns
A pointer to the buffer management interface.

Implements Cogs::IGraphicsDevice.

Definition at line 43 of file GraphicsDeviceD3D12.h.

◆ getCapabilities()

ICapabilities * Cogs::GraphicsDeviceD3D12::getCapabilities ( )
inlineoverridevirtual

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 49 of file GraphicsDeviceD3D12.h.

◆ getDefaultSwapChain()

ISwapChain * Cogs::GraphicsDeviceD3D12::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 51 of file GraphicsDeviceD3D12.h.

◆ getEffects()

IEffects * Cogs::GraphicsDeviceD3D12::getEffects ( )
inlineoverridevirtual

Get a pointer to the effect management interface.

Returns
A pointer to the effect management interface.

Implements Cogs::IGraphicsDevice.

Definition at line 46 of file GraphicsDeviceD3D12.h.

◆ getIdentifier()

std::string Cogs::GraphicsDeviceD3D12::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 29 of file GraphicsDeviceD3D12.h.

◆ getImmediateContext()

IContext * Cogs::GraphicsDeviceD3D12::getImmediateContext ( )
inlineoverridevirtual

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 45 of file GraphicsDeviceD3D12.h.

◆ getNativeDevice()

void * Cogs::GraphicsDeviceD3D12::getNativeDevice ( )
inlineoverridevirtual

Reimplemented from Cogs::IGraphicsDevice.

Definition at line 55 of file GraphicsDeviceD3D12.h.

◆ getPipelineStates()

IPipelineStates * Cogs::GraphicsDeviceD3D12::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 47 of file GraphicsDeviceD3D12.h.

◆ getRenderTargets()

IRenderTargets * Cogs::GraphicsDeviceD3D12::getRenderTargets ( )
inlineoverridevirtual

Get a pointer to the render target management interface.

Returns
A pointer to the render target management interface.

Implements Cogs::IGraphicsDevice.

Definition at line 48 of file GraphicsDeviceD3D12.h.

◆ getSize()

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

Retrieve the size previously set by setSize.

Implements Cogs::IGraphicsDevice.

Definition at line 349 of file GraphicsDeviceD3D12.cpp.

◆ getSyncObjects()

ISyncObjects * Cogs::GraphicsDeviceD3D12::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 50 of file GraphicsDeviceD3D12.h.

◆ getTextures()

ITextures * Cogs::GraphicsDeviceD3D12::getTextures ( )
inlineoverridevirtual

Get a pointer to the texture management interface.

Returns
A pointer to the texture management interface.

Implements Cogs::IGraphicsDevice.

Definition at line 44 of file GraphicsDeviceD3D12.h.

◆ getType()

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

Get the type of the graphics device.

Returns
The identifier of the graphics device.

Reimplemented from Cogs::IGraphicsDevice.

Definition at line 30 of file GraphicsDeviceD3D12.h.

References Cogs::Direct3D12.

◆ initialize()

bool Cogs::GraphicsDeviceD3D12::initialize ( )
virtual

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

Implements Cogs::IGraphicsDevice.

Definition at line 30 of file GraphicsDeviceD3D12.cpp.

◆ initializeDevice()

HRESULT Cogs::GraphicsDeviceD3D12::initializeDevice ( )

Definition at line 37 of file GraphicsDeviceD3D12.cpp.

◆ initializeDeviceAndSwapChain()

HRESULT Cogs::GraphicsDeviceD3D12::initializeDeviceAndSwapChain ( )

Definition at line 67 of file GraphicsDeviceD3D12.cpp.

◆ initializeDeviceShared()

HRESULT Cogs::GraphicsDeviceD3D12::initializeDeviceShared ( )

Definition at line 187 of file GraphicsDeviceD3D12.cpp.

◆ releaseResources()

void Cogs::GraphicsDeviceD3D12::releaseResources ( )
overridevirtual

Release all resources allocated.

Implements Cogs::IGraphicsDevice.

Definition at line 362 of file GraphicsDeviceD3D12.cpp.

◆ resizeSharedSurfaces()

HRESULT Cogs::GraphicsDeviceD3D12::resizeSharedSurfaces ( )

Definition at line 194 of file GraphicsDeviceD3D12.cpp.

◆ setSize()

void Cogs::GraphicsDeviceD3D12::setSize ( int  width,
int  height 
)
overridevirtual

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 325 of file GraphicsDeviceD3D12.cpp.

References Cogs::Handle_t< DepthStencilTag >::InvalidHandle, and Cogs::Handle_t< RenderTargetTag >::InvalidHandle.

◆ setVerticalSync()

void Cogs::GraphicsDeviceD3D12::setVerticalSync ( bool  enabled)
inline

Definition at line 41 of file GraphicsDeviceD3D12.h.

◆ waitForCommandSync()

void Cogs::GraphicsDeviceD3D12::waitForCommandSync ( )
overridevirtual

Wait for any GPU commands on the current device to finish before returning.

After this command returns, any commands issued to the graphics device should be finished, and results from these ready to use.

Reimplemented from Cogs::IGraphicsDevice.

Definition at line 357 of file GraphicsDeviceD3D12.cpp.

◆ waitForPreviousFrame()

void Cogs::GraphicsDeviceD3D12::waitForPreviousFrame ( )

Definition at line 312 of file GraphicsDeviceD3D12.cpp.

Member Data Documentation

◆ buffers

BuffersD3D12 Cogs::GraphicsDeviceD3D12::buffers

Definition at line 85 of file GraphicsDeviceD3D12.h.

◆ capabilities

CapabilitiesD3D12 Cogs::GraphicsDeviceD3D12::capabilities

Definition at line 84 of file GraphicsDeviceD3D12.h.

◆ commandQueue

ResourcePointer<ID3D12CommandQueue> Cogs::GraphicsDeviceD3D12::commandQueue

Definition at line 75 of file GraphicsDeviceD3D12.h.

◆ context

ContextD3D12 Cogs::GraphicsDeviceD3D12::context

Definition at line 83 of file GraphicsDeviceD3D12.h.

◆ currentFence

UINT64 Cogs::GraphicsDeviceD3D12::currentFence = 0

Definition at line 70 of file GraphicsDeviceD3D12.h.

◆ depthTarget

DepthStencilHandle Cogs::GraphicsDeviceD3D12::depthTarget

Definition at line 78 of file GraphicsDeviceD3D12.h.

◆ depthTexture

TextureHandle Cogs::GraphicsDeviceD3D12::depthTexture

Definition at line 79 of file GraphicsDeviceD3D12.h.

◆ device

ResourcePointer<ID3D12Device> Cogs::GraphicsDeviceD3D12::device

Definition at line 73 of file GraphicsDeviceD3D12.h.

◆ deviceFence

ResourcePointer<ID3D12Fence> Cogs::GraphicsDeviceD3D12::deviceFence

Definition at line 69 of file GraphicsDeviceD3D12.h.

◆ effects

EffectsD3D12 Cogs::GraphicsDeviceD3D12::effects

Definition at line 87 of file GraphicsDeviceD3D12.h.

◆ eventHandle

HANDLE Cogs::GraphicsDeviceD3D12::eventHandle = nullptr

Definition at line 71 of file GraphicsDeviceD3D12.h.

◆ fullscreenMode

bool Cogs::GraphicsDeviceD3D12::fullscreenMode = false

Definition at line 93 of file GraphicsDeviceD3D12.h.

◆ height

int Cogs::GraphicsDeviceD3D12::height

Definition at line 91 of file GraphicsDeviceD3D12.h.

◆ indexLastSwapBuf

int Cogs::GraphicsDeviceD3D12::indexLastSwapBuf = 0

Definition at line 67 of file GraphicsDeviceD3D12.h.

◆ multisampleBackBuffer

ResourcePointer<ID3D12Resource> Cogs::GraphicsDeviceD3D12::multisampleBackBuffer

Definition at line 81 of file GraphicsDeviceD3D12.h.

◆ numSwapBufs

const int Cogs::GraphicsDeviceD3D12::numSwapBufs = 2
static

Definition at line 68 of file GraphicsDeviceD3D12.h.

◆ renderTarget

RenderTargetHandle Cogs::GraphicsDeviceD3D12::renderTarget[numSwapBufs]

Definition at line 77 of file GraphicsDeviceD3D12.h.

◆ renderTargets

RenderTargetsD3D12 Cogs::GraphicsDeviceD3D12::renderTargets

Definition at line 88 of file GraphicsDeviceD3D12.h.

◆ swapChain

ResourcePointer<IDXGISwapChain> Cogs::GraphicsDeviceD3D12::swapChain

Definition at line 74 of file GraphicsDeviceD3D12.h.

◆ syncObjects

SyncObjectsD3D12 Cogs::GraphicsDeviceD3D12::syncObjects

Definition at line 89 of file GraphicsDeviceD3D12.h.

◆ textures

TexturesD3D12 Cogs::GraphicsDeviceD3D12::textures

Definition at line 86 of file GraphicsDeviceD3D12.h.

◆ verticalSync

bool Cogs::GraphicsDeviceD3D12::verticalSync = true

Definition at line 94 of file GraphicsDeviceD3D12.h.

◆ width

int Cogs::GraphicsDeviceD3D12::width

Definition at line 91 of file GraphicsDeviceD3D12.h.


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