XII Release 0.1.0
Loading...
Searching...
No Matches
xiiWindowOutputTargetGAL Class Reference

Copyright (c) Theophilus Eriata. All Rights Reserved. More...

#include <WindowOutputTarget.h>

Inheritance diagram for xiiWindowOutputTargetGAL:
[legend]

Public Types

using OnSwapChainChanged = xiiDelegate<void(xiiSharedPtr<xiiGALSwapChain> pSwapChain, xiiSizeU32 vSize)>

Public Member Functions

XII_ALWAYS_INLINE const xiiGALSwapChain * GetSwapChain () const
 Returns the current swapchain. This can be used by the application to access the back buffer texture for rendering, e.g. by using it as a render target.
 xiiWindowOutputTargetGAL (const xiiGALSwapChainCreationDescription &description, OnSwapChainChanged onSwapChainChanged={})
 Copyright (c) Theophilus Eriata. All Rights Reserved.
virtual bool GetVSyncEnabled () const override
 Returns whether VSync is enabled for this output target.
virtual void SetVSyncEnabled (bool bEnableVSync) override
 Enables or disables VSync for this output target.
virtual void PresentImage () override
 Presents the current back buffer to the screen. This should be called every frame after rendering is done.
virtual void Resize (const xiiSizeU32 &newSize) override
 Resizes the output target to the new size. This should be called when the window is resized.
virtual xiiResult CaptureImage (xiiImage &out_image) override
 Captures the current back buffer and stores it in the given image. This can be used for screenshots or similar purposes.
void RequestScreenshot (xiiStringView sOutputFile)
 Saves the next rendered image before presentation acquires another backbuffer.

Public Attributes

OnSwapChainChanged m_OnSwapChainChanged
 This is called whenever the swapchain is created or resized. The application can use this to react to changes in the swapchain, e.g. by updating any references to it in xiiView.
xiiSharedPtr< xiiGALSwapChain > m_pSwapChain
 The current swapchain. This is created and managed by xiiWindowOutputTargetGAL. The application can use this to access the back buffer texture for rendering, e.g. by using it as a render target.
xiiUniquePtr< xiiGALImageCapture > m_pImageCapture
 This is used to capture the back buffer for screenshots or similar purposes. It is created by xiiWindowOutputTargetGAL and can be used by the application to capture images from the swapchain.
xiiUInt32 m_uiCurrentFrame = 0U
 This is incremented every time PresentImage is called. It can be used by the application to track the current frame index for synchronization purposes, e.g. when using multiple frames in flight.

Detailed Description

Copyright (c) Theophilus Eriata. All Rights Reserved.

Creates a swapchain and keeps it up to date with the window.

If the window is resized or xiiGameApplication::cvar_AppVSync changes and onSwapChainChanged is valid, the swapchain is destroyed and recreated. It is up the the application to respond to the OnSwapChainChanged callback and update any references to the swap-chain, e.g. uses in xiiView or uses as render targets in xiiGALRenderTargetSetup.

If onSwapChainChanged is not set, the swapchain will not be re-created and it is up to the application to manage the swapchain and react to window changes.

Member Function Documentation

◆ CaptureImage()

xiiResult xiiWindowOutputTargetGAL::CaptureImage ( xiiImage & out_image)
overridevirtual

Captures the current back buffer and stores it in the given image. This can be used for screenshots or similar purposes.

Implements xiiWindowOutputTargetBase.

◆ GetVSyncEnabled()

bool xiiWindowOutputTargetGAL::GetVSyncEnabled ( ) const
overridevirtual

Returns whether VSync is enabled for this output target.

Implements xiiWindowOutputTargetBase.

◆ PresentImage()

void xiiWindowOutputTargetGAL::PresentImage ( )
overridevirtual

Presents the current back buffer to the screen. This should be called every frame after rendering is done.

Implements xiiWindowOutputTargetBase.

◆ Resize()

void xiiWindowOutputTargetGAL::Resize ( const xiiSizeU32 & newSize)
overridevirtual

Resizes the output target to the new size. This should be called when the window is resized.

Implements xiiWindowOutputTargetBase.

◆ SetVSyncEnabled()

void xiiWindowOutputTargetGAL::SetVSyncEnabled ( bool bEnableVSync)
overridevirtual

Enables or disables VSync for this output target.

Implements xiiWindowOutputTargetBase.


The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Engine/GameEngine/GameApplication/WindowOutputTarget.h
  • /home/runner/work/XII/XII/Source/Engine/GameEngine/GameApplication/Implementation/WindowOutputTargetGAL.cpp