Cogs.Core
|
Represents a graphics device used to manage graphics resources and issue drawing commands. More...
#include <IGraphicsDevice.h>
Public Member Functions | |
virtual | ~IGraphicsDevice ()=default |
Destructor. | |
virtual bool | initializeThread () |
Initialize the graphics device for operation on the current thread. | |
virtual SharedGraphicsContext * | createSharedContext () |
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 ISwapChain * | createSwapChain (struct WindowData *) |
Create a new swap chain for the specified window. | |
virtual void | deleteSwapChain (ISwapChain *) |
Deletes the specified swap chain. | |
virtual IContext * | getImmediateContext ()=0 |
Get a pointer to the immediate context used to issue commands to the graphics device. | |
virtual IBuffers * | getBuffers ()=0 |
Get a pointer to the buffer management interface. | |
virtual ITextures * | getTextures ()=0 |
Get a pointer to the texture management interface. | |
virtual IRenderTargets * | getRenderTargets ()=0 |
Get a pointer to the render target management interface. | |
virtual IEffects * | getEffects ()=0 |
Get a pointer to the effect management interface. | |
virtual IPipelineStates * | getPipelineStates ()=0 |
Get a pointer to the pipeline state management interface. | |
virtual ICapabilities * | getCapabilities ()=0 |
Get a pointer to the capability management interface used to query the graphics device capability flags. | |
virtual ISwapChain * | getDefaultSwapChain ()=0 |
Get a pointer to the default swap chain for this graphics device. | |
virtual ISyncObjects * | getSyncObjects ()=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 GraphicsDeviceSettings & | getSettings () const |
Static Public Member Functions | |
static void | fillGraphicsSettings (struct WindowData *windowData, int requestedSampleCount) |
Set platform specific graphics settings used for window creation e.g.: XVisualInfo on Linux. | |
Protected Attributes | |
GraphicsDeviceSettings | settings |
std::vector< ISwapChain * > | swapChains |
Represents a graphics device used to manage graphics resources and issue drawing commands.
Definition at line 168 of file IGraphicsDevice.h.
|
inlinevirtual |
Activates the given shared context on the calling thread.
context | Pointer to a shared graphics context. |
Reimplemented in Cogs::GraphicsDeviceGL20.
Definition at line 201 of file IGraphicsDevice.h.
|
pure virtual |
Signal the beginning of a new frame to the graphics device.
Implemented in Cogs::GraphicsDeviceD3D11, Cogs::GraphicsDeviceD3D12, Cogs::GraphicsDeviceNull, Cogs::GraphicsDeviceGL20, Cogs::GraphicsDeviceGLES30, Cogs::GraphicsDeviceVK, and Cogs::GraphicsDeviceWebGPU.
Referenced by Cogs::Core::Renderer::beginFrame().
|
inlinevirtual |
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.
Reimplemented in Cogs::GraphicsDeviceGL20.
Definition at line 192 of file IGraphicsDevice.h.
|
inlinevirtual |
Create a new swap chain for the specified window.
Reimplemented in Cogs::GraphicsDeviceD3D11, and Cogs::GraphicsDeviceGL20.
Definition at line 283 of file IGraphicsDevice.h.
|
inlinevirtual |
Deletes the specified swap chain.
The swap chain must have been previously created through a call to createSwapChain.
Reimplemented in Cogs::GraphicsDeviceD3D11, and Cogs::GraphicsDeviceGL20.
Definition at line 288 of file IGraphicsDevice.h.
|
pure 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.
syncInterval | Synchronization interval.
|
presentFlags | A combination of PresentFlags controlling the presentation of the rendered frame. |
Implemented in Cogs::GraphicsDeviceD3D11, Cogs::GraphicsDeviceD3D12, Cogs::GraphicsDeviceGL20, Cogs::GraphicsDeviceGLES30, Cogs::GraphicsDeviceVK, Cogs::GraphicsDeviceNull, and Cogs::GraphicsDeviceWebGPU.
Referenced by Cogs::Core::Renderer::endFrame().
|
static |
Set platform specific graphics settings used for window creation e.g.: XVisualInfo on Linux.
Definition at line 17 of file IGraphicsDevice.cpp.
|
pure virtual |
Get a pointer to the buffer management interface.
Implemented in Cogs::GraphicsDeviceD3D11, Cogs::GraphicsDeviceD3D12, Cogs::GraphicsDeviceNull, Cogs::GraphicsDeviceGL20, Cogs::GraphicsDeviceGLES30, Cogs::GraphicsDeviceVK, and Cogs::GraphicsDeviceWebGPU.
Referenced by Cogs::Core::Image360::RendererExtension::handleEvent(), Cogs::Core::PotreeRenderer::handleEvent(), Cogs::Core::Image360::RendererExtension::initialize(), Cogs::Core::PotreeRenderer::initialize(), Cogs::Core::SeaCurrentsRenderer::initialize(), Cogs::Core::Volumetric::OctRenderer::initialize(), and Cogs::Core::Renderer::renderScreenshot().
|
pure virtual |
Get a pointer to the capability management interface used to query the graphics device capability flags.
Implemented in Cogs::GraphicsDeviceD3D11, Cogs::GraphicsDeviceVK, Cogs::GraphicsDeviceD3D12, Cogs::GraphicsDeviceNull, Cogs::GraphicsDeviceGL20, Cogs::GraphicsDeviceGLES30, and Cogs::GraphicsDeviceWebGPU.
Referenced by Cogs::Core::Renderer::getClearDepth(), Cogs::Core::Renderer::getNearDepth(), Cogs::Core::Renderer::getProjectionMatrix(), Cogs::Core::Renderer::getViewFromViewportMatrix(), Cogs::Core::ShapeSystem::initialize(), Cogs::Core::Image360System::update(), and Cogs::Core::Renderer::updatePermutation().
|
pure virtual |
Get a pointer to the default swap chain for this graphics device.
Implemented in Cogs::GraphicsDeviceD3D11, Cogs::GraphicsDeviceD3D12, Cogs::GraphicsDeviceNull, Cogs::GraphicsDeviceGL20, Cogs::GraphicsDeviceGLES30, Cogs::GraphicsDeviceVK, and Cogs::GraphicsDeviceWebGPU.
|
pure virtual |
Get a pointer to the effect management interface.
Implemented in Cogs::GraphicsDeviceD3D11, Cogs::GraphicsDeviceD3D12, Cogs::GraphicsDeviceNull, Cogs::GraphicsDeviceGL20, Cogs::GraphicsDeviceGLES30, Cogs::GraphicsDeviceVK, and Cogs::GraphicsDeviceWebGPU.
|
inlinevirtual |
Get the graphics device identifier.
Reimplemented in Cogs::GraphicsDeviceD3D11, Cogs::GraphicsDeviceD3D12, Cogs::GraphicsDeviceNull, Cogs::GraphicsDeviceGL20, Cogs::GraphicsDeviceGLES30, Cogs::GraphicsDeviceVK, and Cogs::GraphicsDeviceWebGPU.
Definition at line 227 of file IGraphicsDevice.h.
|
pure virtual |
Get a pointer to the immediate context used to issue commands to the graphics device.
Implemented in Cogs::GraphicsDeviceD3D11, Cogs::GraphicsDeviceD3D12, Cogs::GraphicsDeviceNull, Cogs::GraphicsDeviceGL20, Cogs::GraphicsDeviceGLES30, Cogs::GraphicsDeviceVK, and Cogs::GraphicsDeviceWebGPU.
Referenced by Cogs::Core::Renderer::render(), and Cogs::Core::Renderer::renderScreenshot().
|
inlinevirtual |
Definition at line 353 of file IGraphicsDevice.h.
|
pure virtual |
Get a pointer to the pipeline state management interface.
Implemented in Cogs::GraphicsDeviceD3D11, Cogs::GraphicsDeviceD3D12, Cogs::GraphicsDeviceVK, Cogs::GraphicsDeviceNull, Cogs::GraphicsDeviceGL20, Cogs::GraphicsDeviceGLES30, and Cogs::GraphicsDeviceWebGPU.
|
pure virtual |
Get a pointer to the render target management interface.
Implemented in Cogs::GraphicsDeviceD3D11, Cogs::GraphicsDeviceVK, Cogs::GraphicsDeviceD3D12, Cogs::GraphicsDeviceNull, Cogs::GraphicsDeviceGL20, Cogs::GraphicsDeviceGLES30, and Cogs::GraphicsDeviceWebGPU.
Referenced by Cogs::Core::Volumetric::OctRenderer::initialize(), Cogs::Core::Renderer::render(), and Cogs::Core::Renderer::renderScreenshot().
|
virtual |
Reimplemented in Cogs::GraphicsDeviceGL20.
Definition at line 11 of file IGraphicsDevice.cpp.
|
inline |
Definition at line 364 of file IGraphicsDevice.h.
|
pure virtual |
Retrieve the size previously set by setSize.
Implemented in Cogs::GraphicsDeviceNull, Cogs::GraphicsDeviceD3D11, Cogs::GraphicsDeviceD3D12, Cogs::GraphicsDeviceGL20, Cogs::GraphicsDeviceGLES30, Cogs::GraphicsDeviceWebGPU, and Cogs::GraphicsDeviceVK.
|
pure virtual |
Get a pointer to the sync object management interface.
Implemented in Cogs::GraphicsDeviceD3D11, Cogs::GraphicsDeviceD3D12, Cogs::GraphicsDeviceNull, Cogs::GraphicsDeviceGL20, Cogs::GraphicsDeviceGLES30, Cogs::GraphicsDeviceVK, and Cogs::GraphicsDeviceWebGPU.
|
pure virtual |
Get a pointer to the texture management interface.
Implemented in Cogs::GraphicsDeviceD3D11, Cogs::GraphicsDeviceD3D12, Cogs::GraphicsDeviceNull, Cogs::GraphicsDeviceGL20, Cogs::GraphicsDeviceGLES30, Cogs::GraphicsDeviceVK, and Cogs::GraphicsDeviceWebGPU.
Referenced by Cogs::Core::Image360::RendererExtension::handleEvent(), Cogs::Core::PotreeRenderer::handleEvent(), Cogs::Core::Volumetric::OctRenderer::initialize(), Cogs::Core::Renderer::render(), and Cogs::Core::Renderer::renderScreenshot().
|
inlinevirtual |
Get the type of the graphics device.
Reimplemented in Cogs::GraphicsDeviceD3D11, Cogs::GraphicsDeviceD3D12, Cogs::GraphicsDeviceNull, Cogs::GraphicsDeviceGL20, Cogs::GraphicsDeviceGLES30, Cogs::GraphicsDeviceVK, and Cogs::GraphicsDeviceWebGPU.
Definition at line 234 of file IGraphicsDevice.h.
References Cogs::Unknown.
Referenced by Cogs::Core::Renderer::getProjectionMatrix(), Cogs::Core::Renderer::getViewFromViewportMatrix(), and Cogs::Factory::releaseDevice().
|
pure virtual |
Initializes the graphics device with the settings previous set through calling setSettings.
Implemented in Cogs::GraphicsDeviceD3D11, Cogs::GraphicsDeviceD3D12, Cogs::GraphicsDeviceGLES30, Cogs::GraphicsDeviceNull, Cogs::GraphicsDeviceGL20, Cogs::GraphicsDeviceVK, and Cogs::GraphicsDeviceWebGPU.
|
inlinevirtual |
Initialize the graphics device for operation on the current thread.
Definition at line 177 of file IGraphicsDevice.h.
|
inlinevirtual |
Check if async initialization is finished.
Reimplemented in Cogs::GraphicsDeviceWebGPU.
Definition at line 218 of file IGraphicsDevice.h.
|
pure virtual |
Release all resources allocated.
Implemented in Cogs::GraphicsDeviceD3D11, Cogs::GraphicsDeviceD3D12, Cogs::GraphicsDeviceNull, Cogs::GraphicsDeviceGL20, Cogs::GraphicsDeviceGLES30, Cogs::GraphicsDeviceVK, and Cogs::GraphicsDeviceWebGPU.
|
inlinevirtual |
Releases the given shared context.
context | Pointer to a shared graphics context. |
Reimplemented in Cogs::GraphicsDeviceGL20.
Definition at line 208 of file IGraphicsDevice.h.
|
inlinevirtual |
Updates the settings associated with this device.
The device must be recreated for the new settings to take effect.
Graphics | device settings to use when initializing the device. |
Reimplemented in Cogs::GraphicsDeviceGL20.
Definition at line 362 of file IGraphicsDevice.h.
Referenced by Cogs::GraphicsDeviceGL20::setSettings().
|
pure virtual |
Set the size of the main drawing buffer used by the graphics device in pixels.
width | Width of the drawing buffer in pixels. |
height | Height of the drawing buffer in pixels. |
Implemented in Cogs::GraphicsDeviceD3D11, Cogs::GraphicsDeviceD3D12, Cogs::GraphicsDeviceGL20, Cogs::GraphicsDeviceGLES30, Cogs::GraphicsDeviceVK, Cogs::GraphicsDeviceWebGPU, and Cogs::GraphicsDeviceNull.
|
inlinevirtual |
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 in Cogs::GraphicsDeviceD3D12, Cogs::GraphicsDeviceNull, Cogs::GraphicsDeviceGL20, Cogs::GraphicsDeviceGLES30, Cogs::GraphicsDeviceVK, and Cogs::GraphicsDeviceWebGPU.
Definition at line 271 of file IGraphicsDevice.h.
|
protected |
Definition at line 373 of file IGraphicsDevice.h.
|
protected |
Definition at line 374 of file IGraphicsDevice.h.