Cogs.Core
Public Types | Public Attributes | List of all members
Cogs::GraphicsDeviceSettings Struct Reference

Settings for graphics device initialization. More...

#include <IGraphicsDevice.h>

Public Types

using RedrawRequestCallback = void(*)(void *userData)
 Optional callback invoked when the device wants the owning application to re-run the frame loop and render again, even though nothing else may have changed.
 

Public Attributes

int featureLevelMajor
 Major feature level.
 
int featureLevelMinor
 Minor feature level.
 
TextureFormat colorFormat = TextureFormat::R8G8B8A8_UNORM_SRGB
 Back buffer format.
 
TextureFormat depthFormat = TextureFormat::D32_FLOAT
 Depth buffer format.
 
int numSamples = 1
 Number of samples to use for back buffer MSAA.
 
int flags = GraphicsDeviceFlags::None
 Flags controlling the behavior of the graphics device.
 
struct WindowDatawindowData
 Native window handle used to initialize the graphics device.
 
void ** sharedSurface = nullptr
 Pointer to storage for a pointer to a shared surface.
 
IIOHandlerioHandler
 Optional pointer to an IO handler.
 
RedrawRequestCallback redrawRequestCallback = nullptr
 
void * redrawRequestCallbackUserData = nullptr
 
uint32_t fakeAsyncEffectLoadFrames = 0
 Testing aid: simulate asynchronous effect loading by delaying the number of frames given here before an effect (and any pipeline using it) reports ResourceStatus::Ready.
 

Detailed Description

Settings for graphics device initialization.

Definition at line 90 of file IGraphicsDevice.h.

Member Typedef Documentation

◆ RedrawRequestCallback

using Cogs::GraphicsDeviceSettings::RedrawRequestCallback = void(*)(void * userData)

Optional callback invoked when the device wants the owning application to re-run the frame loop and render again, even though nothing else may have changed.

This is needed for asynchronously loaded resources (e.g. WebGPU shader compilation) that become ready some time after loadEffect/loadPipeline returned - without this notification, an application using an on-demand ("dirty") render loop would not know to re-render once the load completes.

May be called from any thread, callback-driven backends may complete off the render thread, so the callback must be safe to call from any thread. Typically it will just post/signal a wake-up to the actual render/frame-loop thread.

Definition at line 174 of file IGraphicsDevice.h.

Member Data Documentation

◆ colorFormat

TextureFormat Cogs::GraphicsDeviceSettings::colorFormat = TextureFormat::R8G8B8A8_UNORM_SRGB

◆ depthFormat

TextureFormat Cogs::GraphicsDeviceSettings::depthFormat = TextureFormat::D32_FLOAT

Depth buffer format.

Definition at line 123 of file IGraphicsDevice.h.

Referenced by Cogs::RenderTargetsVK::getLayout().

◆ fakeAsyncEffectLoadFrames

uint32_t Cogs::GraphicsDeviceSettings::fakeAsyncEffectLoadFrames = 0

Testing aid: simulate asynchronous effect loading by delaying the number of frames given here before an effect (and any pipeline using it) reports ResourceStatus::Ready.

Zero (default) disables the simulation, effects are ready as soon as loadEffect returns, as today.

Note
Only implemented by the OpenGLES30 backend.

Definition at line 186 of file IGraphicsDevice.h.

◆ featureLevelMajor

int Cogs::GraphicsDeviceSettings::featureLevelMajor

Major feature level.

Corresponds to the underlying graphics APIs major version number desired. If the underlying API fails to meet the requirements, device initialization will fail.

Setting this to zero defaults the major version.

E.g if the user knows that some of the features desired require OpenGL version 3.2, this would be set to 3.

Definition at line 102 of file IGraphicsDevice.h.

◆ featureLevelMinor

int Cogs::GraphicsDeviceSettings::featureLevelMinor

Minor feature level.

Corresponds to the underlying graphics APIs minor version number. If the underlying API fails to meet the requirements, device initialization will fail.

Setting this to zero defaults the minor version.

E.g if the user knows that some of the features desired require OpenGL version 3.2 this would be set to 2.

Definition at line 113 of file IGraphicsDevice.h.

◆ flags

int Cogs::GraphicsDeviceSettings::flags = GraphicsDeviceFlags::None

Flags controlling the behavior of the graphics device.

See also
GraphicsDeviceFlags

Definition at line 135 of file IGraphicsDevice.h.

◆ ioHandler

IIOHandler* Cogs::GraphicsDeviceSettings::ioHandler

Optional pointer to an IO handler.

Definition at line 161 of file IGraphicsDevice.h.

Referenced by Cogs::GraphicsDeviceNull::initialize(), and Cogs::GraphicsDeviceWebGPU::initialize().

◆ numSamples

int Cogs::GraphicsDeviceSettings::numSamples = 1

◆ redrawRequestCallback

RedrawRequestCallback Cogs::GraphicsDeviceSettings::redrawRequestCallback = nullptr

Definition at line 175 of file IGraphicsDevice.h.

◆ redrawRequestCallbackUserData

void* Cogs::GraphicsDeviceSettings::redrawRequestCallbackUserData = nullptr

Definition at line 176 of file IGraphicsDevice.h.

◆ sharedSurface

void** Cogs::GraphicsDeviceSettings::sharedSurface = nullptr

Pointer to storage for a pointer to a shared surface.

When shared surface support is enabled, a pointer to the shared back buffer surface will be stored at the given location whenever the shared surface is updated. The shares surface may be changed during the following operations;

  • initialize
  • setSize If, after calling one of these methods, the shared surface has changed, the calling code must update its references to the shared surface.

Definition at line 158 of file IGraphicsDevice.h.

◆ windowData

struct WindowData* Cogs::GraphicsDeviceSettings::windowData

Native window handle used to initialize the graphics device.

On Windows systems this must be valid if the device should create and initialize an OpenGL context from scratch. If there is already an OpenGL context active the window handle can be left as default.

WindowData is a typedef for HWND on Windows, and a structure on Linux.

Definition at line 146 of file IGraphicsDevice.h.

Referenced by Cogs::GraphicsDeviceWebGPU::initialize().


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