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

Public Member Functions

 GraphicsDeviceVK (RenderingAllocatorInfo *allocator)
 
bool initialize () override
 Initializes the graphics device with the settings previous set through calling setSettings.
 
bool initializeInstance ()
 
bool initializeDevice ()
 
bool initializeSwapChain ()
 
bool initializeCommandPool ()
 
bool initializeDepth ()
 
void flushSetup ()
 
bool initializeFramebuffers ()
 
bool getMemoryType (uint32_t typeBits, VkFlags requirements_mask, uint32_t *typeIndex)
 
GraphicsDeviceType getType () const override
 Get the type of the graphics device.
 
std::string getIdentifier () const override
 Get the graphics device identifier.
 
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 &width, int &height) const override
 Retrieve the size previously set by setSize.
 
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 waitForCommandSync () override
 Wait for any GPU commands on the current device to finish before returning.
 
void releaseResources () override
 Release all resources allocated.
 
void * getNativeDevice () override
 
IContextgetImmediateContext () override
 Get a pointer to the immediate context used to issue commands to the graphics device.
 
IBuffersgetBuffers () override
 Get a pointer to the buffer management interface.
 
ITexturesgetTextures () override
 Get a pointer to the texture management interface.
 
IRenderTargetsgetRenderTargets ()
 Get a pointer to the render target management interface.
 
IEffectsgetEffects () override
 Get a pointer to the effect management interface.
 
IPipelineStatesgetPipelineStates ()
 Get a pointer to the pipeline state management interface.
 
ICapabilitiesgetCapabilities ()
 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.
 
VkCommandBuffer getCommandBuffer ()
 
const GraphicsDeviceSettingsgetSettings () const
 
void resize ()
 
- 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

BuffersVK buffers
 
EffectsVK effects
 
ContextVK context
 
TexturesVK textures
 
RenderTargetsVK renderTargets
 
CapabilitiesVK capabilities
 
SyncObjectsCommon syncObjects
 
VkInstance instance = VK_NULL_HANDLE
 
VkPhysicalDevice physicalDevice = VK_NULL_HANDLE
 
VkDevice device = VK_NULL_HANDLE
 
VkQueue queue = VK_NULL_HANDLE
 
VkPhysicalDeviceFeatures physicalDeviceFeatures
 
VkSurfaceKHR surface = VK_NULL_HANDLE
 
VkSwapchainKHR swapChain = VK_NULL_HANDLE
 
VkCommandPool commandPool = VK_NULL_HANDLE
 
VkCommandBuffer setupCommands = VK_NULL_HANDLE
 
std::vector< VkImage > swapChainImages
 
std::vector< RenderTargetHandleframebuffers
 
std::vector< TextureHandlebackBuffers
 
std::vector< TextureHandlebackBuffersMS
 
TextureHandle depthTextureHandle
 
VkPhysicalDeviceMemoryProperties memoryProperties
 
uint32_t currentFrameBuffer = 0
 
VkSemaphore presentCompleteSemaphore = VK_NULL_HANDLE
 
int width = 1920
 
int height = 1080
 
bool needsResize = true
 

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 GraphicsDeviceVK.h.

Constructor & Destructor Documentation

◆ GraphicsDeviceVK()

Cogs::GraphicsDeviceVK::GraphicsDeviceVK ( RenderingAllocatorInfo allocator)

Definition at line 427 of file GraphicsDeviceVK.cpp.

Member Function Documentation

◆ beginFrame()

void Cogs::GraphicsDeviceVK::beginFrame ( )
overridevirtual

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

Implements Cogs::IGraphicsDevice.

Definition at line 577 of file GraphicsDeviceVK.cpp.

◆ endFrame()

void Cogs::GraphicsDeviceVK::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 610 of file GraphicsDeviceVK.cpp.

◆ flushSetup()

void Cogs::GraphicsDeviceVK::flushSetup ( )

Definition at line 495 of file GraphicsDeviceVK.cpp.

◆ getBuffers()

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

Get a pointer to the buffer management interface.

Returns
A pointer to the buffer management interface.

Implements Cogs::IGraphicsDevice.

Definition at line 53 of file GraphicsDeviceVK.h.

◆ getCapabilities()

ICapabilities * Cogs::GraphicsDeviceVK::getCapabilities ( )
inlinevirtual

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 58 of file GraphicsDeviceVK.h.

◆ getCommandBuffer()

VkCommandBuffer Cogs::GraphicsDeviceVK::getCommandBuffer ( )

Definition at line 669 of file GraphicsDeviceVK.cpp.

◆ getDefaultSwapChain()

Cogs::ISwapChain * Cogs::GraphicsDeviceVK::getDefaultSwapChain ( )
overridevirtual

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 663 of file GraphicsDeviceVK.cpp.

◆ getEffects()

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

Get a pointer to the effect management interface.

Returns
A pointer to the effect management interface.

Implements Cogs::IGraphicsDevice.

Definition at line 56 of file GraphicsDeviceVK.h.

◆ getIdentifier()

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

◆ getImmediateContext()

IContext * Cogs::GraphicsDeviceVK::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 52 of file GraphicsDeviceVK.h.

◆ getMemoryType()

bool Cogs::GraphicsDeviceVK::getMemoryType ( uint32_t  typeBits,
VkFlags  requirements_mask,
uint32_t *  typeIndex 
)

Definition at line 543 of file GraphicsDeviceVK.cpp.

◆ getNativeDevice()

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

Reimplemented from Cogs::IGraphicsDevice.

Definition at line 50 of file GraphicsDeviceVK.h.

◆ getPipelineStates()

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

◆ getRenderTargets()

IRenderTargets * Cogs::GraphicsDeviceVK::getRenderTargets ( )
inlinevirtual

Get a pointer to the render target management interface.

Returns
A pointer to the render target management interface.

Implements Cogs::IGraphicsDevice.

Definition at line 55 of file GraphicsDeviceVK.h.

◆ getSettings()

const GraphicsDeviceSettings & Cogs::GraphicsDeviceVK::getSettings ( ) const
inline

Definition at line 64 of file GraphicsDeviceVK.h.

◆ getSize()

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

Retrieve the size previously set by setSize.

Implements Cogs::IGraphicsDevice.

Definition at line 570 of file GraphicsDeviceVK.cpp.

◆ getSyncObjects()

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

◆ getTextures()

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

Get a pointer to the texture management interface.

Returns
A pointer to the texture management interface.

Implements Cogs::IGraphicsDevice.

Definition at line 54 of file GraphicsDeviceVK.h.

◆ getType()

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

Get the type of the graphics device.

Returns
The identifier of the graphics device.

Reimplemented from Cogs::IGraphicsDevice.

Definition at line 40 of file GraphicsDeviceVK.h.

References Cogs::Vulkan.

◆ initialize()

bool Cogs::GraphicsDeviceVK::initialize ( )
overridevirtual

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

Implements Cogs::IGraphicsDevice.

Definition at line 431 of file GraphicsDeviceVK.cpp.

◆ initializeCommandPool()

bool Cogs::GraphicsDeviceVK::initializeCommandPool ( )

Definition at line 408 of file GraphicsDeviceVK.cpp.

◆ initializeDepth()

bool Cogs::GraphicsDeviceVK::initializeDepth ( )

Definition at line 488 of file GraphicsDeviceVK.cpp.

◆ initializeDevice()

bool Cogs::GraphicsDeviceVK::initializeDevice ( )

Definition at line 188 of file GraphicsDeviceVK.cpp.

◆ initializeFramebuffers()

bool Cogs::GraphicsDeviceVK::initializeFramebuffers ( )

Definition at line 522 of file GraphicsDeviceVK.cpp.

◆ initializeInstance()

bool Cogs::GraphicsDeviceVK::initializeInstance ( )

Definition at line 45 of file GraphicsDeviceVK.cpp.

◆ initializeSwapChain()

bool Cogs::GraphicsDeviceVK::initializeSwapChain ( )

Definition at line 340 of file GraphicsDeviceVK.cpp.

◆ releaseResources()

void Cogs::GraphicsDeviceVK::releaseResources ( )
overridevirtual

Release all resources allocated.

Implements Cogs::IGraphicsDevice.

Definition at line 659 of file GraphicsDeviceVK.cpp.

◆ resize()

void Cogs::GraphicsDeviceVK::resize ( )

Definition at line 702 of file GraphicsDeviceVK.cpp.

◆ setSize()

void Cogs::GraphicsDeviceVK::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 560 of file GraphicsDeviceVK.cpp.

◆ waitForCommandSync()

void Cogs::GraphicsDeviceVK::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 654 of file GraphicsDeviceVK.cpp.

Member Data Documentation

◆ backBuffers

std::vector<TextureHandle> Cogs::GraphicsDeviceVK::backBuffers

Definition at line 92 of file GraphicsDeviceVK.h.

◆ backBuffersMS

std::vector<TextureHandle> Cogs::GraphicsDeviceVK::backBuffersMS

Definition at line 93 of file GraphicsDeviceVK.h.

◆ buffers

BuffersVK Cogs::GraphicsDeviceVK::buffers

Definition at line 68 of file GraphicsDeviceVK.h.

◆ capabilities

CapabilitiesVK Cogs::GraphicsDeviceVK::capabilities

Definition at line 73 of file GraphicsDeviceVK.h.

◆ commandPool

VkCommandPool Cogs::GraphicsDeviceVK::commandPool = VK_NULL_HANDLE

Definition at line 86 of file GraphicsDeviceVK.h.

◆ context

ContextVK Cogs::GraphicsDeviceVK::context

Definition at line 70 of file GraphicsDeviceVK.h.

◆ currentFrameBuffer

uint32_t Cogs::GraphicsDeviceVK::currentFrameBuffer = 0

Definition at line 99 of file GraphicsDeviceVK.h.

◆ depthTextureHandle

TextureHandle Cogs::GraphicsDeviceVK::depthTextureHandle

Definition at line 95 of file GraphicsDeviceVK.h.

◆ device

VkDevice Cogs::GraphicsDeviceVK::device = VK_NULL_HANDLE

Definition at line 78 of file GraphicsDeviceVK.h.

◆ effects

EffectsVK Cogs::GraphicsDeviceVK::effects

Definition at line 69 of file GraphicsDeviceVK.h.

◆ framebuffers

std::vector<RenderTargetHandle> Cogs::GraphicsDeviceVK::framebuffers

Definition at line 91 of file GraphicsDeviceVK.h.

◆ height

int Cogs::GraphicsDeviceVK::height = 1080

Definition at line 104 of file GraphicsDeviceVK.h.

◆ instance

VkInstance Cogs::GraphicsDeviceVK::instance = VK_NULL_HANDLE

Definition at line 76 of file GraphicsDeviceVK.h.

◆ memoryProperties

VkPhysicalDeviceMemoryProperties Cogs::GraphicsDeviceVK::memoryProperties

Definition at line 97 of file GraphicsDeviceVK.h.

◆ needsResize

bool Cogs::GraphicsDeviceVK::needsResize = true

Definition at line 105 of file GraphicsDeviceVK.h.

◆ physicalDevice

VkPhysicalDevice Cogs::GraphicsDeviceVK::physicalDevice = VK_NULL_HANDLE

Definition at line 77 of file GraphicsDeviceVK.h.

◆ physicalDeviceFeatures

VkPhysicalDeviceFeatures Cogs::GraphicsDeviceVK::physicalDeviceFeatures

Definition at line 81 of file GraphicsDeviceVK.h.

◆ presentCompleteSemaphore

VkSemaphore Cogs::GraphicsDeviceVK::presentCompleteSemaphore = VK_NULL_HANDLE

Definition at line 101 of file GraphicsDeviceVK.h.

◆ queue

VkQueue Cogs::GraphicsDeviceVK::queue = VK_NULL_HANDLE

Definition at line 79 of file GraphicsDeviceVK.h.

◆ renderTargets

RenderTargetsVK Cogs::GraphicsDeviceVK::renderTargets

Definition at line 72 of file GraphicsDeviceVK.h.

◆ setupCommands

VkCommandBuffer Cogs::GraphicsDeviceVK::setupCommands = VK_NULL_HANDLE

Definition at line 87 of file GraphicsDeviceVK.h.

◆ surface

VkSurfaceKHR Cogs::GraphicsDeviceVK::surface = VK_NULL_HANDLE

Definition at line 83 of file GraphicsDeviceVK.h.

◆ swapChain

VkSwapchainKHR Cogs::GraphicsDeviceVK::swapChain = VK_NULL_HANDLE

Definition at line 84 of file GraphicsDeviceVK.h.

◆ swapChainImages

std::vector<VkImage> Cogs::GraphicsDeviceVK::swapChainImages

Definition at line 89 of file GraphicsDeviceVK.h.

◆ syncObjects

SyncObjectsCommon Cogs::GraphicsDeviceVK::syncObjects

Definition at line 74 of file GraphicsDeviceVK.h.

◆ textures

TexturesVK Cogs::GraphicsDeviceVK::textures

Definition at line 71 of file GraphicsDeviceVK.h.

◆ width

int Cogs::GraphicsDeviceVK::width = 1920

Definition at line 103 of file GraphicsDeviceVK.h.


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