TachyonUI 1.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
tachyon::IWindowContext Class Referenceabstract

A window's rendering state: made by GraphicsContext::CreateWindowContext for each OS window, attached to it with IWindowBackend::AttachContextToWindow, and destroyed by GraphicsContext::DestroyWindowContext. More...

#include <gui_core/windows/gui_window_backend.h>

Inheritance diagram for tachyon::IWindowContext:

Public Member Functions

virtual ~IWindowContext ()=default
virtual ID GetID () const =0
 The GUI window's ID; the backend passes it with the window's input.
virtual OSWindowHandle GetWindowHandle () const =0
 The window it was created for.
virtual bool IsTransparent () const =0
 Whether the window has WindowFlags::Transparent.
virtual void RenderWindowFrame (tachyon::GraphicsContext *graphicsContext, tachyon::IntRect rect, bool resizing)=0
 A frame is recorded (drawn and submitted), then presented.
virtual void RecordWindowFrame (tachyon::GraphicsContext *graphicsContext, tachyon::IntRect rect)
 Records and submits a frame without presenting it; PresentWindowFrame presents.
virtual std::optional< double > PresentWindowFrame ()
 May wait for vsync; nothing to do for a render-to-image window.
virtual bool NeedsRecord () const
 True when the window must be recorded this frame even though its draws didn't change (its swapchain is out of date).
virtual void UpdateTransparentWindow ()
 A transparent window the OS composites from a CPU copy (a layered window on Windows): shows its last frame again, where the window is.
virtual bool ReadPixels (std::span< uint8_t >)
 The last rendered frame, BGRA8 with tightly packed rows; bgra holds width x height x 4 bytes of the window's pixel size.

Detailed Description

A window's rendering state: made by GraphicsContext::CreateWindowContext for each OS window, attached to it with IWindowBackend::AttachContextToWindow, and destroyed by GraphicsContext::DestroyWindowContext.

The backend doesn't own it.

Constructor & Destructor Documentation

◆ ~IWindowContext()

virtual tachyon::IWindowContext::~IWindowContext ( )
virtualdefault

Member Function Documentation

◆ GetID()

virtual ID tachyon::IWindowContext::GetID ( ) const
pure virtual

◆ GetWindowHandle()

virtual OSWindowHandle tachyon::IWindowContext::GetWindowHandle ( ) const
pure virtual

◆ IsTransparent()

virtual bool tachyon::IWindowContext::IsTransparent ( ) const
pure virtual

◆ RenderWindowFrame()

virtual void tachyon::IWindowContext::RenderWindowFrame ( tachyon::GraphicsContext * graphicsContext,
tachyon::IntRect rect,
bool resizing )
pure virtual

A frame is recorded (drawn and submitted), then presented.

RenderWindowFrame does both; a host loop records every window before presenting any.

Implemented in tachyon::d3d12::D3D12WindowContext, tachyon::metal::MetalWindowContext, tachyon::sdlgpu::SDLGPUWindowContext, and tachyon::vulkan::VulkanWindowContext.

◆ RecordWindowFrame()

virtual void tachyon::IWindowContext::RecordWindowFrame ( tachyon::GraphicsContext * graphicsContext,
tachyon::IntRect rect )
inlinevirtual

Records and submits a frame without presenting it; PresentWindowFrame presents.

The default does both, through RenderWindowFrame.

Reimplemented in tachyon::d3d12::D3D12WindowContext, tachyon::metal::MetalWindowContext, tachyon::sdlgpu::SDLGPUWindowContext, and tachyon::vulkan::VulkanWindowContext.

◆ PresentWindowFrame()

virtual std::optional< double > tachyon::IWindowContext::PresentWindowFrame ( )
inlinevirtual

May wait for vsync; nothing to do for a render-to-image window.

Returns the seconds the frame waited on the OS to show it: getting its image and presenting it, since a driver may hold the vsync wait in either. Nothing when no frame was presented to it (a render-to-image window, a window not recorded this frame).

Reimplemented in tachyon::d3d12::D3D12WindowContext, tachyon::metal::MetalWindowContext, tachyon::sdlgpu::SDLGPUWindowContext, and tachyon::vulkan::VulkanWindowContext.

◆ NeedsRecord()

virtual bool tachyon::IWindowContext::NeedsRecord ( ) const
inlinevirtual

True when the window must be recorded this frame even though its draws didn't change (its swapchain is out of date).

False by default.

Reimplemented in tachyon::vulkan::VulkanWindowContext.

◆ UpdateTransparentWindow()

virtual void tachyon::IWindowContext::UpdateTransparentWindow ( )
inlinevirtual

A transparent window the OS composites from a CPU copy (a layered window on Windows): shows its last frame again, where the window is.

Only its picture: the window manager places it. The default does nothing.

Reimplemented in tachyon::vulkan::VulkanWindowContext.

◆ ReadPixels()

virtual bool tachyon::IWindowContext::ReadPixels ( std::span< uint8_t > )
inlinevirtual

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 in tachyon::d3d12::D3D12WindowContext, tachyon::metal::MetalWindowContext, tachyon::sdlgpu::SDLGPUWindowContext, and tachyon::vulkan::VulkanWindowContext.


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