OGRE-Next  4.0.0unstable
Object-Oriented Graphics Rendering Engine
Ogre::VulkanWindowSwapChainBased Class Referenceabstract

#include <OgreVulkanWindow.h>

+ Inheritance diagram for Ogre::VulkanWindowSwapChainBased:

Public Types

enum  Backend { BackendX11 = 1u << 0u }
 
enum  SwapchainStatus { SwapchainAcquired , SwapchainUsedInRendering , SwapchainPendingSwap , SwapchainReleased }
 

Public Member Functions

 VulkanWindowSwapChainBased (const String &title, uint32 width, uint32 height, bool fullscreenMode)
 
 ~VulkanWindowSwapChainBased () override
 
void _swapBuffers (VkSemaphore queueFinishSemaphore)
 Actually performs present. More...
 
void acquireNextSwapchain ()
 
bool canDownloadData () const override
 Returns true if you can download to CPU (i.e. More...
 
PixelFormatGpu chooseSurfaceFormat (bool hwGamma)
 
virtual void createSurface ()=0
 
virtual void createSwapchain ()
 
void destroy () override
 
virtual void destroySurface ()
 
virtual void destroySwapchain (bool finalDestruction=false)
 
void getCustomAttribute (IdString name, void *pData) override
 
VkSemaphore getImageAcquiredSemaphore ()
 Returns null if getImageAcquiredSemaphore has already been called during this frame. More...
 
size_t getNumSwapchains () const
 
VkImage getSwapchainImage (size_t idx) const
 
bool isClosed () const override
 Indicates whether the window has been closed by the user. More...
 
void notifyDeviceLost () override
 
void notifyDeviceRestored (unsigned pass) override
 
void parseSharedParams (const NameValuePairList *miscParams)
 
void setVSync (bool vSync, uint32 vSyncInterval) override
 Turns VSync on/off. More...
 
void setWantsToDownload (bool bWantsToDownload) override
 On Metal you must call this function and set it to true in order to take pictures. More...
 
void swapBuffers () override
 Tells our VulkanDevice that the next commitAndNextCommandBuffer call should present us Calling swapBuffers during the command buffer that is rendering to us is key for good performance; otherwise Ogre may split the commands that render to this window and the command that presents this window into two queue submissions. More...
 
- Public Member Functions inherited from Ogre::VulkanWindow
 VulkanWindow (const String &title, uint32 width, uint32 height, bool fullscreenMode)
 
void _setDevice (VulkanDevice *device)
 
- Public Member Functions inherited from Ogre::Window
 Window (const String &title, uint32 widthPt, uint32 heightPt, bool fullscreenMode)
 
virtual ~Window ()
 
virtual void _initialize (TextureGpuManager *textureGpuManager, const NameValuePairList *ogre_nullable miscParams)=0
 
void _setPrimary ()
 Indicates that this is the primary window. More...
 
virtual void _setVisible (bool visible)=0
 Internal method to notify the window it has been obscured or minimized. More...
 
bool getBorderless () const
 
TextureGpu *ogre_nullable getDepthBuffer () const
 
uint32 getFrequencyDenominator () const
 
uint32 getFrequencyNumerator () const
 
uint32 getHeight () const
 
virtual void getMetrics (uint32 &width, uint32 &height, int32 &left, int32 &top) const
 Overloaded version of getMetrics from RenderTarget, including extra details specific to windowing systems. More...
 
PixelFormatGpu getPixelFormat () const
 
uint32 getRequestedHeightPt () const
 
uint32 getRequestedWidthPt () const
 
SampleDescription getSampleDescription () const
 
TextureGpu *ogre_nullable getStencilBuffer () const
 
TextureGpu *ogre_nullable getTexture () const
 WARNING: Attempting to change the TextureGpu (e.g. More...
 
const StringgetTitle () const
 
virtual float getViewPointToPixelScale () const
 Many windowing systems that support HiDPI displays use special points to specify size of the windows and controls, so that windows and controls with hardcoded sizes does not become too small on HiDPI displays. More...
 
bool getVSync () const
 
uint32 getVSyncInterval () const
 
uint32 getWidth () const
 
bool isFocused () const
 
bool isFullscreen () const
 Returns true if we are currently in fullscreen mode. More...
 
virtual bool isHidden () const =0
 Indicates whether the window was set to hidden (not displayed) More...
 
virtual bool isManualSwapRelease () const
 Returns the value set by setManualSwapRelease when supported. More...
 
bool isMultisample () const
 
bool isPrimary () const
 
virtual bool isVisible () const =0
 
virtual void performManualRelease ()
 See Window::setManualSwapRelease. More...
 
virtual void reposition (int32 leftPt, int32 topPt)=0
 
virtual void requestFullscreenSwitch (bool goFullscreen, bool borderless, uint32 monitorIdx, uint32 widthPt, uint32 heightPt, uint32 frequencyNumerator, uint32 frequencyDenominator)
 Requests to toggle between fullscreen and windowed mode. More...
 
virtual void requestResolution (uint32 widthPt, uint32 heightPt)
 Requests a change in resolution. More...
 
virtual void setBorderless (bool borderless)
 
virtual void setFocused (bool focused)
 
virtual void setFsaa (const String &fsaa)
 Set the FSAA mode to be used if hardware support it. More...
 
virtual void setHidden (bool hidden)=0
 Hide (or show) the window. More...
 
virtual void setManualSwapRelease (bool bManualRelease)
 Metal doesn't want us to hold on to a drawable after presenting. More...
 
virtual void setTitle (const String &title)
 
bool wantsToGoFullscreen () const
 Returns true if we are in windowed mode right now, but want to go fullscreen. More...
 
bool wantsToGoWindowed () const
 Returns true if we are in fullscreen mode right now, but want to go windowed mode. More...
 
virtual void windowMovedOrResized ()
 Notify that the window has been resized. More...
 

Public Attributes

bool mCanDownloadData
 
bool mClosed
 
bool mEnablePreTransform
 
bool mLowestLatencyVSync
 
bool mRebuildingSwapchain
 
bool mSuboptimal
 
VkSurfaceKHR mSurfaceKHR
 
VkSwapchainKHR mSwapchain
 
FastArray< VkImage > mSwapchainImages
 
VkSemaphore mSwapchainSemaphore
 Note: We need a semaphore per frame, not per swapchain. More...
 
SwapchainStatus mSwapchainStatus
 

Member Enumeration Documentation

◆ Backend

Enumerator
BackendX11 

◆ SwapchainStatus

Enumerator
SwapchainAcquired 

We already called VulkanWindowSwapChainBased::acquireNextSwapchain.

        Can only go into this state if we're coming from SwapchainReleased 
SwapchainUsedInRendering 

We already called VulkanWindowSwapChainBased::getImageAcquiredSemaphore.

Further calls to getImageAcquiredSemaphore will return null. Ogre is rendering or intends to into this swapchain.

Can only go into this state if we're coming from SwapchainAcquired

SwapchainPendingSwap 

We've come from SwapchainUsedInRendering and are waiting for VulkanDevice::commitAndNextCommandBuffer to present us.

SwapchainReleased 

We don't own a swapchain.

Ogre cannot render to this window.

        This status should not last long unless we're not initialized yet. 

Constructor & Destructor Documentation

◆ VulkanWindowSwapChainBased()

Ogre::VulkanWindowSwapChainBased::VulkanWindowSwapChainBased ( const String title,
uint32  width,
uint32  height,
bool  fullscreenMode 
)

◆ ~VulkanWindowSwapChainBased()

Ogre::VulkanWindowSwapChainBased::~VulkanWindowSwapChainBased ( )
override

Member Function Documentation

◆ _swapBuffers()

void Ogre::VulkanWindowSwapChainBased::_swapBuffers ( VkSemaphore  queueFinishSemaphore)

Actually performs present.

Called by VulkanDevice::commitAndNextCommandBuffer

Parameters
queueFinishSemaphoreMakes our present request wait until the Queue is done executing before we can present

◆ acquireNextSwapchain()

void Ogre::VulkanWindowSwapChainBased::acquireNextSwapchain ( )

◆ canDownloadData()

bool Ogre::VulkanWindowSwapChainBased::canDownloadData ( ) const
overridevirtual

Returns true if you can download to CPU (i.e.

transfer it via AsyncTextureTicket) If it returns false, attempting to do so could result in a crash

See Window::setWantsToDownload See Window::setManualSwapRelease

Reimplemented from Ogre::Window.

◆ chooseSurfaceFormat()

PixelFormatGpu Ogre::VulkanWindowSwapChainBased::chooseSurfaceFormat ( bool  hwGamma)

◆ createSurface()

virtual void Ogre::VulkanWindowSwapChainBased::createSurface ( )
pure virtual

◆ createSwapchain()

virtual void Ogre::VulkanWindowSwapChainBased::createSwapchain ( )
virtual

◆ destroy()

void Ogre::VulkanWindowSwapChainBased::destroy ( )
overridevirtual

◆ destroySurface()

virtual void Ogre::VulkanWindowSwapChainBased::destroySurface ( )
virtual

◆ destroySwapchain()

virtual void Ogre::VulkanWindowSwapChainBased::destroySwapchain ( bool  finalDestruction = false)
virtual

◆ getCustomAttribute()

void Ogre::VulkanWindowSwapChainBased::getCustomAttribute ( IdString  name,
void *  pData 
)
overridevirtual

◆ getImageAcquiredSemaphore()

VkSemaphore Ogre::VulkanWindowSwapChainBased::getImageAcquiredSemaphore ( )

Returns null if getImageAcquiredSemaphore has already been called during this frame.

◆ getNumSwapchains()

size_t Ogre::VulkanWindowSwapChainBased::getNumSwapchains ( ) const
inline

◆ getSwapchainImage()

VkImage Ogre::VulkanWindowSwapChainBased::getSwapchainImage ( size_t  idx) const
inline

References mSwapchainImages.

◆ isClosed()

bool Ogre::VulkanWindowSwapChainBased::isClosed ( ) const
overridevirtual

Indicates whether the window has been closed by the user.

Implements Ogre::Window.

◆ notifyDeviceLost()

void Ogre::VulkanWindowSwapChainBased::notifyDeviceLost ( )
overridevirtual

◆ notifyDeviceRestored()

void Ogre::VulkanWindowSwapChainBased::notifyDeviceRestored ( unsigned  pass)
overridevirtual

◆ parseSharedParams()

void Ogre::VulkanWindowSwapChainBased::parseSharedParams ( const NameValuePairList miscParams)

◆ setVSync()

void Ogre::VulkanWindowSwapChainBased::setVSync ( bool  vSync,
uint32  vSyncInterval 
)
overridevirtual

Turns VSync on/off.

Parameters
vSync
vSyncIntervalWhen true, specifies how often the screen should be updated. e.g. at 60hz: vSyncInterval = 1 then update at 60hz vSyncInterval = 2 then update at 30hz vSyncInterval = 3 then update at 15hz vSyncInterval = 4 then update at 7.5hz

If the 31st bit is set, i.e. 0x80000000, then lowest latency mode, aka mailbox, will be used (which doesn't limit the framerate)

Reimplemented from Ogre::Window.

Reimplemented in Ogre::VulkanAndroidWindow.

◆ setWantsToDownload()

void Ogre::VulkanWindowSwapChainBased::setWantsToDownload ( bool  bWantsToDownload)
overridevirtual

On Metal you must call this function and set it to true in order to take pictures.

If you no longer need that functionality, set it to false to improve performance

Reimplemented from Ogre::Window.

◆ swapBuffers()

void Ogre::VulkanWindowSwapChainBased::swapBuffers ( )
overridevirtual

Tells our VulkanDevice that the next commitAndNextCommandBuffer call should present us Calling swapBuffers during the command buffer that is rendering to us is key for good performance; otherwise Ogre may split the commands that render to this window and the command that presents this window into two queue submissions.

Implements Ogre::Window.

Member Data Documentation

◆ mCanDownloadData

bool Ogre::VulkanWindowSwapChainBased::mCanDownloadData

◆ mClosed

bool Ogre::VulkanWindowSwapChainBased::mClosed

◆ mEnablePreTransform

bool Ogre::VulkanWindowSwapChainBased::mEnablePreTransform

◆ mLowestLatencyVSync

bool Ogre::VulkanWindowSwapChainBased::mLowestLatencyVSync

◆ mRebuildingSwapchain

bool Ogre::VulkanWindowSwapChainBased::mRebuildingSwapchain

◆ mSuboptimal

bool Ogre::VulkanWindowSwapChainBased::mSuboptimal

◆ mSurfaceKHR

VkSurfaceKHR Ogre::VulkanWindowSwapChainBased::mSurfaceKHR

◆ mSwapchain

VkSwapchainKHR Ogre::VulkanWindowSwapChainBased::mSwapchain

◆ mSwapchainImages

FastArray<VkImage> Ogre::VulkanWindowSwapChainBased::mSwapchainImages

◆ mSwapchainSemaphore

VkSemaphore Ogre::VulkanWindowSwapChainBased::mSwapchainSemaphore

Note: We need a semaphore per frame, not per swapchain.

Makes Queue execution wait until the acquired image is done presenting

◆ mSwapchainStatus

SwapchainStatus Ogre::VulkanWindowSwapChainBased::mSwapchainStatus

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