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

Public Member Functions

 GraphicsDeviceGL20 (RenderingAllocatorInfo *allocator)
 
virtual bool initialize () override
 Initialises this graphics device.
 
virtual bool setSettings (const GraphicsDeviceSettings &newSettings) override
 Updates settings for this graphics device.
 
virtual ISwapChaincreateSwapChain (struct WindowData *windowData) override
 Create a new SwapChain and attach it to the provided window.
 
virtual void deleteSwapChain (ISwapChain *swapChain) override
 Delete the specified SwapChain.
 
virtual std::string getIdentifier () const override
 Get the graphics device identifier.
 
virtual GraphicsDeviceType getType () const override
 Get the type of the graphics device.
 
virtual void setSize (int width, int height) override
 Resizes the output of this graphics device.
 
virtual bool getSize (int &w, int &h) const override
 Retrieve the current size of this graphics device's default swap chain.
 
virtual void beginFrame () override
 Prepares the current frame for rendering.
 
virtual void endFrame (uint32_t syncInterval=0, uint32_t presentFlags=PresentFlags::None) override
 Finalises frame rendering and presents the new frames to the display (if applicable).
 
virtual void waitForCommandSync () override
 Forces the calling thread to synchronise with the GPU.
 
virtual void releaseResources () override
 Release all resources used by this graphics device.
 
virtual SharedGraphicsContextcreateSharedContext () override
 Create a shared graphics context that can be used to activate another thread for rendering.
 
virtual void activateSharedContext (SharedGraphicsContext *) override
 Activates the given shared context on the calling thread.
 
virtual void releaseSharedContext (SharedGraphicsContext *) override
 Releases the given shared context.
 
virtual ResourceStatistics getResourceStatistics () override
 Retrieve statistics about resources currently in use by this graphics device instance.
 
virtual BuffersGL20getBuffers () override
 Get a pointer to the buffer management interface.
 
virtual TexturesGL20getTextures () override
 Get a pointer to the texture management interface.
 
virtual RenderTargetsGL20getRenderTargets () override
 Get a pointer to the render target management interface.
 
virtual EffectsGL20getEffects () override
 Get a pointer to the effect management interface.
 
virtual IPipelineStatesgetPipelineStates () override
 Get a pointer to the pipeline state management interface.
 
virtual ISyncObjectsgetSyncObjects () override
 Get a pointer to the sync object management interface.
 
virtual ContextGL20getImmediateContext () override
 Get a pointer to the immediate context used to issue commands to the graphics device.
 
virtual CapabilitiesGL20getCapabilities () override
 Get a pointer to the capability management interface used to query the graphics device capability flags.
 
virtual SwapChainGL20getDefaultSwapChain () override
 Get a pointer to the default swap chain for this graphics device.
 
GLContext & getShareContext ()
 
- 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 Attributes

BuffersGL20 buffers
 
TexturesGL20 textures
 
EffectsGL20 effects
 
RenderTargetsGL20 renderTargets
 
ContextGL20 context
 
CapabilitiesGL20 capabilities
 
GLSyncObjects syncObjects
 
SwapChainGL20 defaultSwapChain
 
RenderTargetHandle offscreenRenderTargetHandle
 
TextureHandle offscreenTextureHandle
 
RenderTargetHandle offscreenResolveRenderTargetHandle
 
TextureHandle offscreenResolveTextureHandle
 
bool initialized = false
 
GLContext glShareContext
 

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 20 of file GraphicsDeviceGL20.h.

Constructor & Destructor Documentation

◆ GraphicsDeviceGL20()

Cogs::GraphicsDeviceGL20::GraphicsDeviceGL20 ( RenderingAllocatorInfo allocator)

Definition at line 19 of file GraphicsDeviceGL20.cpp.

◆ ~GraphicsDeviceGL20()

Cogs::GraphicsDeviceGL20::~GraphicsDeviceGL20 ( )

Definition at line 22 of file GraphicsDeviceGL20.cpp.

Member Function Documentation

◆ activateSharedContext()

void Cogs::GraphicsDeviceGL20::activateSharedContext ( SharedGraphicsContext )
overridevirtual

Activates the given shared context on the calling thread.

See also
createSharedContext.
Parameters
contextPointer to a shared graphics context.

Reimplemented from Cogs::IGraphicsDevice.

Definition at line 249 of file GraphicsDeviceGL20.cpp.

◆ beginFrame()

void Cogs::GraphicsDeviceGL20::beginFrame ( )
overridevirtual

Prepares the current frame for rendering.

*============================================================================================

Implements Cogs::IGraphicsDevice.

Definition at line 149 of file GraphicsDeviceGL20.cpp.

◆ createSharedContext()

Cogs::SharedGraphicsContext * Cogs::GraphicsDeviceGL20::createSharedContext ( )
overridevirtual

Create a shared graphics context that can be used to activate another thread for rendering.

When using OpenGL on the windows platform, rendering contexts have to be made separate for each thread. These contexts must also be made current on their respective threads to enable calling GL functions there.

This function must be called from the same thread that the device was created on.

See also
activateSharedContext
Returns
A pointer to a graphics context that can be activated on another thread.

Reimplemented from Cogs::IGraphicsDevice.

Definition at line 237 of file GraphicsDeviceGL20.cpp.

References Cogs::EnableDiagnostics.

◆ createSwapChain()

Cogs::ISwapChain * Cogs::GraphicsDeviceGL20::createSwapChain ( struct WindowData windowData)
overridevirtual

Create a new SwapChain and attach it to the provided window.

*============================================================================================

Reimplemented from Cogs::IGraphicsDevice.

Definition at line 104 of file GraphicsDeviceGL20.cpp.

References Cogs::EnableDiagnostics, and Cogs::SwapChainGL20::initialize().

◆ deleteSwapChain()

void Cogs::GraphicsDeviceGL20::deleteSwapChain ( ISwapChain swapChain)
overridevirtual

Delete the specified SwapChain.

*============================================================================================

Reimplemented from Cogs::IGraphicsDevice.

Definition at line 119 of file GraphicsDeviceGL20.cpp.

◆ endFrame()

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

Finalises frame rendering and presents the new frames to the display (if applicable).

*============================================================================================

Implements Cogs::IGraphicsDevice.

Definition at line 166 of file GraphicsDeviceGL20.cpp.

◆ getBuffers()

virtual BuffersGL20 * Cogs::GraphicsDeviceGL20::getBuffers ( )
inlineoverridevirtual

Get a pointer to the buffer management interface.

Returns
A pointer to the buffer management interface.

Implements Cogs::IGraphicsDevice.

Definition at line 49 of file GraphicsDeviceGL20.h.

◆ getCapabilities()

virtual CapabilitiesGL20 * Cogs::GraphicsDeviceGL20::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 56 of file GraphicsDeviceGL20.h.

◆ getDefaultSwapChain()

virtual SwapChainGL20 * Cogs::GraphicsDeviceGL20::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 57 of file GraphicsDeviceGL20.h.

◆ getEffects()

virtual EffectsGL20 * Cogs::GraphicsDeviceGL20::getEffects ( )
inlineoverridevirtual

Get a pointer to the effect management interface.

Returns
A pointer to the effect management interface.

Implements Cogs::IGraphicsDevice.

Definition at line 52 of file GraphicsDeviceGL20.h.

◆ getIdentifier()

virtual std::string Cogs::GraphicsDeviceGL20::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 32 of file GraphicsDeviceGL20.h.

◆ getImmediateContext()

virtual ContextGL20 * Cogs::GraphicsDeviceGL20::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 55 of file GraphicsDeviceGL20.h.

◆ getPipelineStates()

virtual IPipelineStates * Cogs::GraphicsDeviceGL20::getPipelineStates ( )
inlineoverridevirtual

Get a pointer to the pipeline state management interface.

Returns
A pointer to the pipeline state management interface.

Implements Cogs::IGraphicsDevice.

Definition at line 53 of file GraphicsDeviceGL20.h.

◆ getRenderTargets()

virtual RenderTargetsGL20 * Cogs::GraphicsDeviceGL20::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 51 of file GraphicsDeviceGL20.h.

◆ getResourceStatistics()

Cogs::ResourceStatistics Cogs::GraphicsDeviceGL20::getResourceStatistics ( )
overridevirtual

Retrieve statistics about resources currently in use by this graphics device instance.

*============================================================================================

Reimplemented from Cogs::IGraphicsDevice.

Definition at line 211 of file GraphicsDeviceGL20.cpp.

◆ getShareContext()

GLContext & Cogs::GraphicsDeviceGL20::getShareContext ( )
inline

Definition at line 59 of file GraphicsDeviceGL20.h.

◆ getSize()

bool Cogs::GraphicsDeviceGL20::getSize ( int &  w,
int &  h 
) const
overridevirtual

Retrieve the current size of this graphics device's default swap chain.

*============================================================================================

Implements Cogs::IGraphicsDevice.

Definition at line 140 of file GraphicsDeviceGL20.cpp.

◆ getSyncObjects()

virtual ISyncObjects * Cogs::GraphicsDeviceGL20::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 54 of file GraphicsDeviceGL20.h.

◆ getTextures()

virtual TexturesGL20 * Cogs::GraphicsDeviceGL20::getTextures ( )
inlineoverridevirtual

Get a pointer to the texture management interface.

Returns
A pointer to the texture management interface.

Implements Cogs::IGraphicsDevice.

Definition at line 50 of file GraphicsDeviceGL20.h.

◆ getType()

virtual GraphicsDeviceType Cogs::GraphicsDeviceGL20::getType ( ) const
inlineoverridevirtual

Get the type of the graphics device.

Returns
The identifier of the graphics device.

Reimplemented from Cogs::IGraphicsDevice.

Definition at line 33 of file GraphicsDeviceGL20.h.

References Cogs::OpenGL20.

◆ initialize()

bool Cogs::GraphicsDeviceGL20::initialize ( )
overridevirtual

Initialises this graphics device.

This function can (and probably should be) called after setSettings has been called. *============================================================================================

Implements Cogs::IGraphicsDevice.

Definition at line 31 of file GraphicsDeviceGL20.cpp.

References Cogs::EnableDiagnostics, and Cogs::UseOpenGLClipControl.

◆ releaseResources()

void Cogs::GraphicsDeviceGL20::releaseResources ( )
overridevirtual

Release all resources used by this graphics device.

(Typically called during destruction.) *============================================================================================

Implements Cogs::IGraphicsDevice.

Definition at line 193 of file GraphicsDeviceGL20.cpp.

References Cogs::Handle_t< SamplerTag >::NoHandle.

◆ releaseSharedContext()

void Cogs::GraphicsDeviceGL20::releaseSharedContext ( SharedGraphicsContext )
overridevirtual

Releases the given shared context.

Parameters
contextPointer to a shared graphics context.

Reimplemented from Cogs::IGraphicsDevice.

Definition at line 256 of file GraphicsDeviceGL20.cpp.

◆ setSettings()

bool Cogs::GraphicsDeviceGL20::setSettings ( const GraphicsDeviceSettings newSettings)
overridevirtual

Updates settings for this graphics device.

This should typically be called before calling initialize. *============================================================================================

Reimplemented from Cogs::IGraphicsDevice.

Definition at line 91 of file GraphicsDeviceGL20.cpp.

References Cogs::IGraphicsDevice::setSettings().

◆ setSize()

void Cogs::GraphicsDeviceGL20::setSize ( int  newWidth,
int  newHeight 
)
overridevirtual

Resizes the output of this graphics device.

(Actually resizes the output of the default swap chain.) *============================================================================================

Implements Cogs::IGraphicsDevice.

Definition at line 133 of file GraphicsDeviceGL20.cpp.

◆ waitForCommandSync()

void Cogs::GraphicsDeviceGL20::waitForCommandSync ( )
overridevirtual

Forces the calling thread to synchronise with the GPU.

*============================================================================================

Reimplemented from Cogs::IGraphicsDevice.

Definition at line 177 of file GraphicsDeviceGL20.cpp.

References Cogs::Series::FireGL.

Member Data Documentation

◆ buffers

BuffersGL20 Cogs::GraphicsDeviceGL20::buffers
private

Definition at line 62 of file GraphicsDeviceGL20.h.

◆ capabilities

CapabilitiesGL20 Cogs::GraphicsDeviceGL20::capabilities
private

Definition at line 67 of file GraphicsDeviceGL20.h.

◆ context

ContextGL20 Cogs::GraphicsDeviceGL20::context
private

Definition at line 66 of file GraphicsDeviceGL20.h.

◆ defaultSwapChain

SwapChainGL20 Cogs::GraphicsDeviceGL20::defaultSwapChain
private

Definition at line 69 of file GraphicsDeviceGL20.h.

◆ effects

EffectsGL20 Cogs::GraphicsDeviceGL20::effects
private

Definition at line 64 of file GraphicsDeviceGL20.h.

◆ glShareContext

GLContext Cogs::GraphicsDeviceGL20::glShareContext
private

Definition at line 80 of file GraphicsDeviceGL20.h.

◆ initialized

bool Cogs::GraphicsDeviceGL20::initialized = false
private

Definition at line 76 of file GraphicsDeviceGL20.h.

◆ offscreenRenderTargetHandle

RenderTargetHandle Cogs::GraphicsDeviceGL20::offscreenRenderTargetHandle
private

Definition at line 71 of file GraphicsDeviceGL20.h.

◆ offscreenResolveRenderTargetHandle

RenderTargetHandle Cogs::GraphicsDeviceGL20::offscreenResolveRenderTargetHandle
private

Definition at line 73 of file GraphicsDeviceGL20.h.

◆ offscreenResolveTextureHandle

TextureHandle Cogs::GraphicsDeviceGL20::offscreenResolveTextureHandle
private

Definition at line 74 of file GraphicsDeviceGL20.h.

◆ offscreenTextureHandle

TextureHandle Cogs::GraphicsDeviceGL20::offscreenTextureHandle
private

Definition at line 72 of file GraphicsDeviceGL20.h.

◆ renderTargets

RenderTargetsGL20 Cogs::GraphicsDeviceGL20::renderTargets
private

Definition at line 65 of file GraphicsDeviceGL20.h.

◆ syncObjects

GLSyncObjects Cogs::GraphicsDeviceGL20::syncObjects
private

Definition at line 68 of file GraphicsDeviceGL20.h.

◆ textures

TexturesGL20 Cogs::GraphicsDeviceGL20::textures
private

Definition at line 63 of file GraphicsDeviceGL20.h.


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