OGRE  13.6
Object-Oriented Graphics Rendering Engine
Ogre::VulkanWindow Class Reference

#include <OgreVulkanWindow.h>

+ Inheritance diagram for Ogre::VulkanWindow:

Public Types

enum  SwapchainStatus { SwapchainAcquired , SwapchainUsedInRendering , SwapchainPendingSwap , SwapchainReleased }
 
- Public Types inherited from Ogre::RenderTarget
enum  FrameBuffer { FB_FRONT , FB_BACK , FB_AUTO }
 

Public Member Functions

 VulkanWindow (const String &title, uint32 width, uint32 height, bool fullscreenMode)
 
virtual ~VulkanWindow ()
 
void _setDevice (VulkanDevice *device)
 
void _swapBuffers ()
 Actually performs present. More...
 
void acquireNextImage (void)
 
PixelFormat chooseSurfaceFormat (bool hwGamma)
 
void copyContentsToMemory (const Box &src, const PixelBox &dst, FrameBuffer buffer=FB_AUTO) override
 Copies the current contents of the render target to a pixelbox. More...
 
void create (const String &name, unsigned int widthPt, unsigned int heightPt, bool fullScreen, const NameValuePairList *miscParams) override
 Creates & displays the new window. More...
 
void createSurface (size_t windowHandle)
 
void createSwapchain (void)
 
void destroy (void) override
 Destroys the window. More...
 
void destroySwapchain (void)
 
VulkanTextureGpugetDepthTexture ()
 
VkSemaphore getImageAcquiredSemaphore (void)
 Returns null if getImageAcquiredSemaphore has already been called during this frame. More...
 
VkSemaphore getRenderFinishedSemaphore () const
 
VulkanRenderPassDescriptorgetRenderPassDescriptor () const
 
VkSurfaceTransformFlagBitsKHR getSurfaceTransform () const
 
const std::vector< VkImageView > & getSwapchainImageViews () const
 
VulkanTextureGpugetTexture ()
 
bool isHidden (void) const override
 Indicates whether the window was set to hidden (not displayed) More...
 
bool isVisible (void) const override
 Indicates whether the window is visible (not minimized or obscured) More...
 
void reposition (int32 leftPt, int32 topPt) override
 
bool requiresTextureFlipping () const override
 Vulkan clip space has inverted Y axis compared to OpenGL. More...
 
void resize (unsigned int widthPt, unsigned int heightPt) override
 Alter the size of the window. More...
 
void setHidden (bool hidden) override
 Hide (or show) the window. More...
 
void setImageFence (VkFence fence)
 
void setVisible (bool visible) override
 Set the visibility state. More...
 
virtual void setVSync (bool vSync, uint32 vSyncInterval)
 
PixelFormat suggestPixelFormat () const override
 Override since windows don't usually have alpha. More...
 
void swapBuffers (void) 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...
 
void windowMovedOrResized () override
 Query the current size and position from an external window handle. More...
 
- Public Member Functions inherited from Ogre::RenderWindow
 RenderWindow ()
 Default constructor. More...
 
void getMetrics (unsigned int &width, unsigned int &height, int &left, int &top) const
 Overloaded version of getMetrics from RenderTarget, including extra details specific to windowing systems. More...
 
virtual float getViewPointToPixelScale ()
 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...
 
unsigned int getVSyncInterval () const
 Returns the vertical sync interval. More...
 
bool isActive (void) const override
 Overridden from RenderTarget, flags invisible windows as inactive. More...
 
virtual bool isClosed (void) const
 Indicates whether the window has been closed by the user. More...
 
bool isDeactivatedOnFocusChange () const
 Returns true if the window will automatically de-activate itself when it loses focus. More...
 
virtual bool isFullScreen (void) const
 Returns true if window is running in fullscreen mode. More...
 
bool isPrimary (void) const override
 Indicates whether the window is the primary window. More...
 
virtual bool isVSyncEnabled () const
 Indicates whether vertical sync is activated for the window. More...
 
virtual void reposition (int leftPt, int topPt)
 Reposition the window. More...
 
void setDeactivateOnFocusChange (bool deactivate)
 Indicates whether the window will automatically deactivate itself when it loses focus. More...
 
virtual void setFullscreen (bool fullScreen, unsigned int widthPt, unsigned int heightPt)
 Alter fullscreen mode options. More...
 
virtual void setVSyncEnabled (bool vsync)
 Enable or disable vertical sync for the RenderWindow. More...
 
virtual void setVSyncInterval (unsigned int interval)
 Set the vertical sync interval. More...
 
- Public Member Functions inherited from Ogre::RenderTarget
 RenderTarget ()
 
virtual ~RenderTarget ()
 
virtual void _beginUpdate ()
 Method for manual management of rendering : fires 'preRenderTargetUpdate' and initialises statistics etc. More...
 
virtual void _detachDepthBuffer ()
 Detaches DepthBuffer without notifying it from the detach. More...
 
virtual void _endUpdate ()
 Method for manual management of rendering - finishes statistics calculation and fires 'postRenderTargetUpdate'. More...
 
virtual void _notifyCameraRemoved (const Camera *cam)
 Utility method to notify a render target that a camera has been removed, in case it was referring to it as a viewer. More...
 
virtual void _updateAutoUpdatedViewports (bool updateStatistics=true)
 Method for manual management of rendering - renders only viewports that are auto updated. More...
 
virtual void _updateViewport (int zorder, bool updateStatistics=true)
 Method for manual management of rendering - renders the given viewport (even if it is not autoupdated) More...
 
virtual void _updateViewport (Viewport *viewport, bool updateStatistics=true)
 Method for manual management of rendering - renders the given viewport (even if it is not autoupdated) More...
 
virtual void addListener (RenderTargetListener *listener)
 Add a listener to this RenderTarget which will be called back before & after rendering. More...
 
virtual ViewportaddViewport (Camera *cam, int ZOrder=0, float left=0.0f, float top=0.0f, float width=1.0f, float height=1.0f)
 Adds a viewport to the rendering target. More...
 
virtual bool attachDepthBuffer (DepthBuffer *depthBuffer)
 
void copyContentsToMemory (const PixelBox &dst, FrameBuffer buffer=FB_AUTO)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
virtual void detachDepthBuffer ()
 
uint getCustomAttribute (const String &name)
 simplified API for bindings More...
 
virtual void getCustomAttribute (const String &name, void *pData)
 Retrieve a platform or API-specific piece of information. More...
 
DepthBuffergetDepthBuffer () const
 
uint16 getDepthBufferPool () const
 
virtual uint getFSAA () const
 Indicates whether multisampling is performed on rendering and at what level. More...
 
virtual const StringgetFSAAHint () const
 RenderSystem specific FSAA option. See RenderSystem::_createRenderWindow for details. More...
 
virtual uint32 getHeight (void) const
 
void getMetrics (unsigned int &width, unsigned int &height)
 Retrieve information about the render target. More...
 
virtual const StringgetName (void) const
 Retrieve target's name. More...
 
virtual unsigned short getNumViewports (void) const
 Returns the number of viewports attached to this target. More...
 
virtual uchar getPriority () const
 Gets the priority of a render target. More...
 
const FrameStatsgetStatistics (void) const
 Retrieves details of current rendering performance. More...
 
virtual ViewportgetViewport (unsigned short index)
 Retrieves a pointer to the viewport with the given index. More...
 
virtual ViewportgetViewportByZOrder (int ZOrder)
 Retrieves a pointer to the viewport with the given Z-order. More...
 
virtual uint32 getWidth (void) const
 
virtual bool hasViewportWithZOrder (int ZOrder)
 Returns true if and only if a viewport exists at the given Z-order. More...
 
virtual void insertListener (RenderTargetListener *listener, const unsigned int pos=0)
 same as addListener, but force the position in the vector, so we can control the call order More...
 
virtual bool isAutoUpdated (void) const
 Gets whether this target is automatically updated if Ogre's rendering loop or Root::_updateAllRenderTargets is being used. More...
 
virtual bool isHardwareGammaEnabled () const
 Indicates whether on rendering, linear colour space is converted to sRGB gamma colour space. More...
 
virtual bool isStereoEnabled (void) const
 Indicates whether stereo is currently enabled for this target. More...
 
virtual void removeAllListeners (void)
 Removes all listeners from this instance. More...
 
virtual void removeAllViewports (void)
 Removes all viewports on this target. More...
 
virtual void removeListener (RenderTargetListener *listener)
 Removes a RenderTargetListener previously registered using addListener. More...
 
virtual void removeViewport (int ZOrder)
 Removes a viewport at a given Z-order. More...
 
void resetStatistics (void)
 Resets saved frame-rate statistices. More...
 
virtual void setActive (bool state)
 Used to set the active state of the render target. More...
 
virtual void setAutoUpdated (bool autoupdate)
 Sets whether this target should be automatically updated if Ogre's rendering loop or Root::_updateAllRenderTargets is being used. More...
 
void setDepthBufferPool (uint16 poolId)
 Sets the pool ID this RenderTarget should query from. More...
 
virtual void setFSAA (uint fsaa, const String &fsaaHint)
 Set the level of multisample AA to be used if hardware support it. More...
 
virtual void setPriority (uchar priority)
 Sets the priority of this render target in relation to the others. More...
 
virtual void update (bool swapBuffers=true)
 Tells the target to update it's contents. More...
 
void writeContentsToFile (const String &filename)
 Writes the current contents of the render target to the named file. More...
 
virtual String writeContentsToTimestampedFile (const String &filenamePrefix, const String &filenameSuffix)
 Writes the current contents of the render target to the (PREFIX)(time-stamp)(SUFFIX) file. More...
 

Static Public Member Functions

static const char * getRequiredExtensionName ()
 

Public Attributes

int mCurrentSemaphoreIndex
 
VulkanTextureGpumDepthTexture
 
VulkanDevicemDevice
 
bool mHidden
 
bool mHwGamma
 
std::vector< VkFence > mImageFences
 
std::vector< VkSemaphore > mImageReadySemaphores
 Makes Queue execution wait until the acquired image is done presenting. More...
 
bool mLowestLatencyVSync
 
std::vector< VkSemaphore > mRenderFinishedSemaphores
 
std::unique_ptr< VulkanRenderPassDescriptormRenderPassDescriptor
 
VkSurfaceKHR mSurfaceKHR
 
VkSurfaceTransformFlagBitsKHR mSurfaceTransform
 
VkSwapchainKHR mSwapchain
 
std::vector< VkImage > mSwapchainImages
 
std::vector< VkImageView > mSwapchainImageViews
 
SwapchainStatus mSwapchainStatus
 
VulkanTextureGpuWindowmTexture
 
bool mVisible
 
bool mVSync
 
int mVSyncInterval
 
size_t mWindowHandle = 0
 

Member Enumeration Documentation

◆ SwapchainStatus

Enumerator
SwapchainAcquired 

We already called VulkanWindow::acquireNextImage.

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

We already called VulkanWindow::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

◆ VulkanWindow()

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

◆ ~VulkanWindow()

virtual Ogre::VulkanWindow::~VulkanWindow ( )
virtual

Member Function Documentation

◆ chooseSurfaceFormat()

PixelFormat Ogre::VulkanWindow::chooseSurfaceFormat ( bool  hwGamma)

◆ createSwapchain()

void Ogre::VulkanWindow::createSwapchain ( void  )

◆ destroySwapchain()

void Ogre::VulkanWindow::destroySwapchain ( void  )

◆ createSurface()

void Ogre::VulkanWindow::createSurface ( size_t  windowHandle)

◆ acquireNextImage()

void Ogre::VulkanWindow::acquireNextImage ( void  )

◆ getRequiredExtensionName()

static const char* Ogre::VulkanWindow::getRequiredExtensionName ( )
static

◆ getRenderPassDescriptor()

VulkanRenderPassDescriptor* Ogre::VulkanWindow::getRenderPassDescriptor ( ) const
inline

References mRenderPassDescriptor.

◆ getTexture()

VulkanTextureGpu* Ogre::VulkanWindow::getTexture ( )
inline

References mTexture.

◆ getDepthTexture()

VulkanTextureGpu* Ogre::VulkanWindow::getDepthTexture ( )
inline

References mDepthTexture.

◆ getSurfaceTransform()

VkSurfaceTransformFlagBitsKHR Ogre::VulkanWindow::getSurfaceTransform ( ) const
inline

References mSurfaceTransform.

◆ destroy()

void Ogre::VulkanWindow::destroy ( void  )
overridevirtual

Destroys the window.

Implements Ogre::RenderWindow.

◆ reposition()

void Ogre::VulkanWindow::reposition ( int32  leftPt,
int32  topPt 
)
inlineoverride

◆ setVisible()

void Ogre::VulkanWindow::setVisible ( bool  visible)
inlineoverridevirtual

Set the visibility state.

Reimplemented from Ogre::RenderWindow.

References mVisible.

◆ isVisible()

bool Ogre::VulkanWindow::isVisible ( void  ) const
inlineoverridevirtual

Indicates whether the window is visible (not minimized or obscured)

Reimplemented from Ogre::RenderWindow.

References mVisible.

◆ setHidden()

void Ogre::VulkanWindow::setHidden ( bool  hidden)
inlineoverridevirtual

Hide (or show) the window.

If called with hidden=true, this will make the window completely invisible to the user.

Remarks
Setting a window to hidden is useful to create a dummy primary RenderWindow hidden from the user so that you can create and recreate your actual RenderWindows without having to recreate all your resources.

Reimplemented from Ogre::RenderWindow.

References mHidden.

◆ isHidden()

bool Ogre::VulkanWindow::isHidden ( void  ) const
inlineoverridevirtual

Indicates whether the window was set to hidden (not displayed)

Reimplemented from Ogre::RenderWindow.

References mHidden.

◆ suggestPixelFormat()

PixelFormat Ogre::VulkanWindow::suggestPixelFormat ( ) const
inlineoverridevirtual

Override since windows don't usually have alpha.

Reimplemented from Ogre::RenderWindow.

References Ogre::Texture::getFormat(), and mTexture.

◆ copyContentsToMemory()

void Ogre::VulkanWindow::copyContentsToMemory ( const Box src,
const PixelBox dst,
FrameBuffer  buffer = FB_AUTO 
)
overridevirtual

Copies the current contents of the render target to a pixelbox.

Remarks
See suggestPixelFormat for a tip as to the best pixel format to extract into, although you can use whatever format you like and the results will be converted.

Implements Ogre::RenderTarget.

◆ requiresTextureFlipping()

bool Ogre::VulkanWindow::requiresTextureFlipping ( ) const
inlineoverridevirtual

Vulkan clip space has inverted Y axis compared to OpenGL.

Implements Ogre::RenderTarget.

◆ resize()

void Ogre::VulkanWindow::resize ( unsigned int  widthPt,
unsigned int  heightPt 
)
overridevirtual

Alter the size of the window.

Implements Ogre::RenderWindow.

◆ windowMovedOrResized()

void Ogre::VulkanWindow::windowMovedOrResized ( void  )
overridevirtual

Query the current size and position from an external window handle.

Note
most of the time you already know the size and should call resize instead.

Reimplemented from Ogre::RenderWindow.

◆ _setDevice()

void Ogre::VulkanWindow::_setDevice ( VulkanDevice device)

◆ create()

void Ogre::VulkanWindow::create ( const String name,
unsigned int  widthPt,
unsigned int  heightPt,
bool  fullScreen,
const NameValuePairList miscParams 
)
overridevirtual

Creates & displays the new window.

Parameters
namethe internal window name. Not necessarily the title.
widthPtThe width of the window in view points.
heightPtThe height of the window in view points.
fullScreenIf true, the window fills the screen, with no title bar or border.
miscParamsA variable number of pointers to platform-specific arguments. The actual requirements must be defined by the implementing subclasses.

Implements Ogre::RenderWindow.

◆ getImageAcquiredSemaphore()

VkSemaphore Ogre::VulkanWindow::getImageAcquiredSemaphore ( void  )

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

◆ getRenderFinishedSemaphore()

VkSemaphore Ogre::VulkanWindow::getRenderFinishedSemaphore ( ) const

◆ setImageFence()

void Ogre::VulkanWindow::setImageFence ( VkFence  fence)
inline

◆ getSwapchainImageViews()

const std::vector<VkImageView>& Ogre::VulkanWindow::getSwapchainImageViews ( ) const
inline

References mSwapchainImageViews.

◆ setVSync()

virtual void Ogre::VulkanWindow::setVSync ( bool  vSync,
uint32  vSyncInterval 
)
virtual

◆ swapBuffers()

void Ogre::VulkanWindow::swapBuffers ( void  )
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.

Reimplemented from Ogre::RenderTarget.

◆ _swapBuffers()

void Ogre::VulkanWindow::_swapBuffers ( )

Actually performs present.

Called by VulkanDevice::commitAndNextCommandBuffer

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

Member Data Documentation

◆ mLowestLatencyVSync

bool Ogre::VulkanWindow::mLowestLatencyVSync

◆ mHwGamma

bool Ogre::VulkanWindow::mHwGamma

◆ mVisible

bool Ogre::VulkanWindow::mVisible

Referenced by isVisible(), and setVisible().

◆ mHidden

bool Ogre::VulkanWindow::mHidden

Referenced by isHidden(), and setHidden().

◆ mVSync

bool Ogre::VulkanWindow::mVSync

◆ mVSyncInterval

int Ogre::VulkanWindow::mVSyncInterval

◆ mWindowHandle

size_t Ogre::VulkanWindow::mWindowHandle = 0

◆ mDevice

VulkanDevice* Ogre::VulkanWindow::mDevice

◆ mTexture

VulkanTextureGpuWindow* Ogre::VulkanWindow::mTexture

Referenced by getTexture(), and suggestPixelFormat().

◆ mDepthTexture

VulkanTextureGpu* Ogre::VulkanWindow::mDepthTexture

Referenced by getDepthTexture().

◆ mSurfaceKHR

VkSurfaceKHR Ogre::VulkanWindow::mSurfaceKHR

◆ mSwapchain

VkSwapchainKHR Ogre::VulkanWindow::mSwapchain

◆ mSwapchainImages

std::vector<VkImage> Ogre::VulkanWindow::mSwapchainImages

◆ mSwapchainImageViews

std::vector<VkImageView> Ogre::VulkanWindow::mSwapchainImageViews

Referenced by getSwapchainImageViews().

◆ mImageReadySemaphores

std::vector<VkSemaphore> Ogre::VulkanWindow::mImageReadySemaphores

Makes Queue execution wait until the acquired image is done presenting.

◆ mRenderFinishedSemaphores

std::vector<VkSemaphore> Ogre::VulkanWindow::mRenderFinishedSemaphores

◆ mImageFences

std::vector<VkFence> Ogre::VulkanWindow::mImageFences

Referenced by setImageFence().

◆ mCurrentSemaphoreIndex

int Ogre::VulkanWindow::mCurrentSemaphoreIndex

Referenced by setImageFence().

◆ mSwapchainStatus

SwapchainStatus Ogre::VulkanWindow::mSwapchainStatus

◆ mSurfaceTransform

VkSurfaceTransformFlagBitsKHR Ogre::VulkanWindow::mSurfaceTransform

Referenced by getSurfaceTransform().

◆ mRenderPassDescriptor

std::unique_ptr<VulkanRenderPassDescriptor> Ogre::VulkanWindow::mRenderPassDescriptor

Referenced by getRenderPassDescriptor().


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