|
TachyonUI 0.1.0
High-performance UI for building tools.
|
#include <gui_core/graphics/vulkan/vk_window_context.h>
Public Member Functions | |
| FrameData & | GetCurrentFrame () |
| FrameData & | GetLastFrame () |
| bool | IsTransparent () const override |
| Whether the window has WindowFlags::Transparent. | |
| void | CreateSwapchain () |
| void | DestroySwapchain () |
| void | ResizeSwapchain (tachyon::int2 size) |
| void | FlushWindowContext () |
| void | CreateDrawDepthImages (VulkanImage &drawImage, VulkanImage &depthImage, VkFormat colorFormat) |
| Creates a draw and depth image pair sized to windowExtent; each FRAME_OVERLAP slot has its own. | |
| void | DestroyDrawDepthImages (VulkanImage &drawImage, VulkanImage &depthImage) |
| VkCommandBuffer | BeginWindowFrame (FrameData ¤tFrame) |
| void | EndWindowFrame (FrameData ¤tFrame) |
| void | PerformReadback (const VulkanImage &drawImage) |
| double | LastGpuFrameSeconds () const |
| GPU time of the drawing of this window's most recent finished frame, in seconds; 0 until one finished, or when the device can't time. | |
| bool | ReadPixels (std::span< uint8_t > bgra) override |
| The last rendered frame, BGRA8 with tightly packed rows; bgra holds width x height x 4 bytes of the window's pixel size. | |
| void | SetImageTarget (VkImage image, VkExtent2D extent) |
| The host image each frame is copied into (render-to-image windows); VK_NULL_HANDLE stops. | |
| void | TransitionTarget (VkCommandBuffer cmd, VkImageLayout from, VkImageLayout to, VkPipelineStageFlags2 srcStage, VkAccessFlags2 srcAccess, VkPipelineStageFlags2 dstStage, VkAccessFlags2 dstAccess) |
| void | UpdateLayeredWindowFromCache (int screenX, int screenY) |
| void | Destroy () |
| tachyon::ID | GetID () const override |
| The GUI window's ID; the backend passes it with the window's input. | |
| void | RenderWindowFrame (tachyon::GraphicsContext *graphicsContext, tachyon::IntRect rect, bool resizing) override |
| A frame is recorded (drawn and submitted), then presented. | |
| void | RecordWindowFrame (tachyon::GraphicsContext *graphicsContext, tachyon::IntRect rect) override |
| Records and submits a frame without presenting it; PresentWindowFrame presents. | |
| void | PresentWindowFrame () override |
| May wait for vsync; nothing to do for a render-to-image window. | |
| void | RecordFrame (tachyon::GraphicsContext *graphicsContext, tachyon::IntRect rect, bool resizing) |
| void | UpdateTransparentWindow (tachyon::int2 screenPos) override |
| A transparent window the OS composites from a CPU copy (a layered window on Windows): shows its last frame again at screenPos (screen pixels). | |
| tachyon::OSWindowHandle | GetWindowHandle () const override |
| The window it was created for. | |
| Public Member Functions inherited from tachyon::IWindowContext | |
| virtual | ~IWindowContext ()=default |
Static Public Member Functions | |
| static VulkanWindowContext * | Create (tachyon::ID id, void *nativeHandle, tachyon::OSWindowHandle osHandle, tachyon::int2 size, tachyon::WindowFlags windowFlags, VulkanDeviceContext *deviceContext, tachyon::OnGuiFunc onGUI) |
Public Attributes | |
| tachyon::ID | id { tachyon::ID::Invalid()} |
| VulkanDeviceContext * | deviceContext { nullptr } |
| tachyon::OSWindowHandle | osHandle { nullptr } |
| void * | nativeHandle { nullptr } |
| tachyon::OnGuiFunc | onGui {} |
| tachyon::WindowFlags | windowFlags = tachyon::WindowFlags::None |
| SwapchainState | swapchain = {} |
| WindowVulkanState | state = {} |
| VkSurfaceKHR | surface = {} |
| VkExtent2D | windowExtent = {} |
| VkExtent2D | drawExtent = {} |
| bool | resize_requested { false } |
| bool | freeze_rendering { false } |
| tachyon::int2 | mouse_pos = { 0,0 } |
| int | frameNumber { 0 } |
| std::chrono::steady_clock::time_point | lastPresentEnd {} |
| When the last vkQueuePresentKHR returned. | |
| bool | havePresentEnd { false } |
| double | lastBuildSeconds { 0.0 } |
| bool | lastBuildValid { false } |
| bool | presentPending { false } |
| Recorded and submitted, waiting for PresentWindowFrame. | |
| FrameData * | readbackPending { nullptr } |
| tachyon::int2 | recordedPosition {} |
| bool | needsReadback { false } |
| Transparent window: each frame is read back for the Windows layered window. | |
| bool | renderToImage { false } |
| WindowFlags::RenderToImage: no surface. | |
| VkImage | targetImage { VK_NULL_HANDLE } |
| host image each frame is copied into | |
| VkExtent2D | targetExtent {} |
| bool | targetWritten { false } |
| targetImage holds a previous frame | |
| tachyon::vulkan::AllocatedBuffer | readbackBuffer = {} |
| std::vector< uint8_t > | cachedBitmap |
| double | lastGpuFrameSeconds = 0.0 |
| float | timestampPeriodNs = 0.0f |
| nanoseconds per timestamp tick; 0: no timestamps | |
| FrameData & tachyon::vulkan::VulkanWindowContext::GetCurrentFrame | ( | ) |
| FrameData & tachyon::vulkan::VulkanWindowContext::GetLastFrame | ( | ) |
|
inlineoverridevirtual |
Whether the window has WindowFlags::Transparent.
Implements tachyon::IWindowContext.
| void tachyon::vulkan::VulkanWindowContext::CreateSwapchain | ( | ) |
| void tachyon::vulkan::VulkanWindowContext::DestroySwapchain | ( | ) |
| void tachyon::vulkan::VulkanWindowContext::ResizeSwapchain | ( | tachyon::int2 | size | ) |
| void tachyon::vulkan::VulkanWindowContext::FlushWindowContext | ( | ) |
| void tachyon::vulkan::VulkanWindowContext::CreateDrawDepthImages | ( | VulkanImage & | drawImage, |
| VulkanImage & | depthImage, | ||
| VkFormat | colorFormat ) |
Creates a draw and depth image pair sized to windowExtent; each FRAME_OVERLAP slot has its own.
| void tachyon::vulkan::VulkanWindowContext::DestroyDrawDepthImages | ( | VulkanImage & | drawImage, |
| VulkanImage & | depthImage ) |
| VkCommandBuffer tachyon::vulkan::VulkanWindowContext::BeginWindowFrame | ( | FrameData & | currentFrame | ) |
| void tachyon::vulkan::VulkanWindowContext::EndWindowFrame | ( | FrameData & | currentFrame | ) |
| void tachyon::vulkan::VulkanWindowContext::PerformReadback | ( | const VulkanImage & | drawImage | ) |
|
inline |
GPU time of the drawing of this window's most recent finished frame, in seconds; 0 until one finished, or when the device can't time.
|
overridevirtual |
The last rendered frame, BGRA8 with tightly packed rows; bgra holds width x height x 4 bytes of the window's pixel size.
False when it can't be read.
Reimplemented from tachyon::IWindowContext.
| void tachyon::vulkan::VulkanWindowContext::SetImageTarget | ( | VkImage | image, |
| VkExtent2D | extent ) |
The host image each frame is copied into (render-to-image windows); VK_NULL_HANDLE stops.
| void tachyon::vulkan::VulkanWindowContext::TransitionTarget | ( | VkCommandBuffer | cmd, |
| VkImageLayout | from, | ||
| VkImageLayout | to, | ||
| VkPipelineStageFlags2 | srcStage, | ||
| VkAccessFlags2 | srcAccess, | ||
| VkPipelineStageFlags2 | dstStage, | ||
| VkAccessFlags2 | dstAccess ) |
| void tachyon::vulkan::VulkanWindowContext::UpdateLayeredWindowFromCache | ( | int | screenX, |
| int | screenY ) |
|
static |
| void tachyon::vulkan::VulkanWindowContext::Destroy | ( | ) |
|
inlineoverridevirtual |
The GUI window's ID; the backend passes it with the window's input.
Implements tachyon::IWindowContext.
|
overridevirtual |
A frame is recorded (drawn and submitted), then presented.
RenderWindowFrame does both; a host loop records every window before presenting any.
Implements tachyon::IWindowContext.
|
overridevirtual |
Records and submits a frame without presenting it; PresentWindowFrame presents.
The default does both, through RenderWindowFrame.
Reimplemented from tachyon::IWindowContext.
|
overridevirtual |
May wait for vsync; nothing to do for a render-to-image window.
Reimplemented from tachyon::IWindowContext.
| void tachyon::vulkan::VulkanWindowContext::RecordFrame | ( | tachyon::GraphicsContext * | graphicsContext, |
| tachyon::IntRect | rect, | ||
| bool | resizing ) |
|
overridevirtual |
A transparent window the OS composites from a CPU copy (a layered window on Windows): shows its last frame again at screenPos (screen pixels).
The default does nothing.
Reimplemented from tachyon::IWindowContext.
|
inlineoverridevirtual |
The window it was created for.
Implements tachyon::IWindowContext.
| tachyon::ID tachyon::vulkan::VulkanWindowContext::id { tachyon::ID::Invalid()} |
| VulkanDeviceContext* tachyon::vulkan::VulkanWindowContext::deviceContext { nullptr } |
| tachyon::OSWindowHandle tachyon::vulkan::VulkanWindowContext::osHandle { nullptr } |
| void* tachyon::vulkan::VulkanWindowContext::nativeHandle { nullptr } |
| tachyon::OnGuiFunc tachyon::vulkan::VulkanWindowContext::onGui {} |
| tachyon::WindowFlags tachyon::vulkan::VulkanWindowContext::windowFlags = tachyon::WindowFlags::None |
| SwapchainState tachyon::vulkan::VulkanWindowContext::swapchain = {} |
| WindowVulkanState tachyon::vulkan::VulkanWindowContext::state = {} |
| VkSurfaceKHR tachyon::vulkan::VulkanWindowContext::surface = {} |
| VkExtent2D tachyon::vulkan::VulkanWindowContext::windowExtent = {} |
| VkExtent2D tachyon::vulkan::VulkanWindowContext::drawExtent = {} |
| bool tachyon::vulkan::VulkanWindowContext::resize_requested { false } |
| bool tachyon::vulkan::VulkanWindowContext::freeze_rendering { false } |
| tachyon::int2 tachyon::vulkan::VulkanWindowContext::mouse_pos = { 0,0 } |
| int tachyon::vulkan::VulkanWindowContext::frameNumber { 0 } |
| std::chrono::steady_clock::time_point tachyon::vulkan::VulkanWindowContext::lastPresentEnd {} |
When the last vkQueuePresentKHR returned.
The frame-build time runs from here to just before the next present: the CPU work, without the vsync wait.
| bool tachyon::vulkan::VulkanWindowContext::havePresentEnd { false } |
| double tachyon::vulkan::VulkanWindowContext::lastBuildSeconds { 0.0 } |
| bool tachyon::vulkan::VulkanWindowContext::lastBuildValid { false } |
| bool tachyon::vulkan::VulkanWindowContext::presentPending { false } |
Recorded and submitted, waiting for PresentWindowFrame.
| FrameData* tachyon::vulkan::VulkanWindowContext::readbackPending { nullptr } |
| tachyon::int2 tachyon::vulkan::VulkanWindowContext::recordedPosition {} |
| bool tachyon::vulkan::VulkanWindowContext::needsReadback { false } |
Transparent window: each frame is read back for the Windows layered window.
| bool tachyon::vulkan::VulkanWindowContext::renderToImage { false } |
WindowFlags::RenderToImage: no surface.
| VkImage tachyon::vulkan::VulkanWindowContext::targetImage { VK_NULL_HANDLE } |
host image each frame is copied into
| VkExtent2D tachyon::vulkan::VulkanWindowContext::targetExtent {} |
| bool tachyon::vulkan::VulkanWindowContext::targetWritten { false } |
targetImage holds a previous frame
| tachyon::vulkan::AllocatedBuffer tachyon::vulkan::VulkanWindowContext::readbackBuffer = {} |
| std::vector<uint8_t> tachyon::vulkan::VulkanWindowContext::cachedBitmap |
| double tachyon::vulkan::VulkanWindowContext::lastGpuFrameSeconds = 0.0 |
| float tachyon::vulkan::VulkanWindowContext::timestampPeriodNs = 0.0f |
nanoseconds per timestamp tick; 0: no timestamps