Cogs.Core
Static Public Member Functions | List of all members
Cogs::Factory Struct Reference

Graphics device construction factory. More...

#include <Factory.h>

Static Public Member Functions

static class IGraphicsDevicecreateDevice (RenderingAllocatorInfo *allocatorInfo=nullptr)
 Creates a graphics device.
 
static class IGraphicsDevicecreateDevice (const StringView &name)
 Creates a graphics device with the given type.
 
static class IGraphicsDevicecreateDevice (const GraphicsDeviceType &type, RenderingAllocatorInfo *allocatorInfo=nullptr)
 Creates a graphics device with the given type.
 
static void releaseDevice (class IGraphicsDevice *device)
 Release the given graphics device, freeing all associated resources.
 

Detailed Description

Graphics device construction factory.

Definition at line 10 of file Factory.h.

Member Function Documentation

◆ createDevice() [1/3]

Cogs::IGraphicsDevice * Cogs::Factory::createDevice ( const GraphicsDeviceType type,
RenderingAllocatorInfo allocatorInfo = nullptr 
)
static

Creates a graphics device with the given type.

Parameters
typeType of graphics device to create.
allocatorInfoOptional pointer to allocation information.
Returns
A pointer to the graphics device interface, nullptr if the operation failed or if the given type is not supported by the current build.

Definition at line 103 of file Factory.cpp.

References Cogs::Memory::Allocator::defaultAllocator(), Cogs::Direct3D11, Cogs::Direct3D12, Cogs::Null, Cogs::OpenGL20, Cogs::OpenGLES30, Cogs::Unknown, Cogs::Vulkan, and Cogs::WebGPU.

◆ createDevice() [2/3]

Cogs::IGraphicsDevice * Cogs::Factory::createDevice ( const StringView name)
static

Creates a graphics device with the given type.

Parameters
nameName of the graphics device type. Valid names are (depending on the current build) OpenGL20, Direct3D11, OpenGLES30.
Returns
A pointer to the graphics device interface, nullptr if the operation failed.

Definition at line 67 of file Factory.cpp.

References Cogs::Direct3D11, Cogs::Direct3D12, Cogs::Null, Cogs::OpenGL20, Cogs::OpenGLES30, Cogs::Vulkan, and Cogs::WebGPU.

◆ createDevice() [3/3]

Cogs::IGraphicsDevice * Cogs::Factory::createDevice ( RenderingAllocatorInfo allocatorInfo = nullptr)
static

Creates a graphics device.

The device type is determined from the built in supported types.

Parameters
allocatorInfoOptional pointer to allocation information.
Returns
A pointer to the graphics device interface, nullptr if the operation failed.

Definition at line 46 of file Factory.cpp.

References createDevice(), Cogs::Direct3D11, Cogs::Direct3D12, Cogs::Null, Cogs::OpenGL20, Cogs::OpenGLES30, Cogs::Vulkan, and Cogs::WebGPU.

Referenced by createDevice().

◆ releaseDevice()

void Cogs::Factory::releaseDevice ( class IGraphicsDevice device)
static

Release the given graphics device, freeing all associated resources.

Parameters
devicePointer to a graphics device.

Definition at line 147 of file Factory.cpp.

References Cogs::Direct3D11, Cogs::Direct3D12, Cogs::IGraphicsDevice::getType(), Cogs::Null, Cogs::OpenGL20, Cogs::OpenGLES30, Cogs::Vulkan, Cogs::WebGPU, and Cogs::IGraphicsDevice::~IGraphicsDevice().

Referenced by Cogs::Core::Context::~Context().


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