KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KIGFX::WINDOW_STATE Struct Reference

Per-window state owned by the render thread. More...

#include <render_thread_window_state.h>

Classes

struct  FRAME_UNIFORMS
 One window's uniforms for one frame. More...
 
struct  PASS_UNIFORMS
 Uniform buffers owned by one geometry target. More...
 
struct  RENDERED_CONTENT
 What a geometry target holds, so a frame asking for the same content at the same camera can reuse it. More...
 

Public Types

using Clock = std::chrono::steady_clock
 

Public Member Functions

uint32_t RenderWidth () const
 
uint32_t RenderHeight () const
 
RHI_FramebufferHandle ShownStaticFBO () const
 
int32_t ShownStaticX () const
 Where the view starts in the shown static target, in texels.
 
int32_t ShownStaticY () const
 
uint32_t StaticWidth () const
 
uint32_t StaticHeight () const
 
FRAME_UNIFORMS & Uniforms ()
 

Public Attributes

RHI_WINDOW_ID windowId = 0
 
RHI_NATIVE_WINDOW_HANDLE nativeHandle
 
RHI_SurfaceHandle surface
 
RHI_SwapchainHandle swapchain
 
uint32_t width = 0
 
uint32_t height = 0
 
float dpiScale = 1.0f
 
uint32_t backingWidth = 0
 
uint32_t backingHeight = 0
 
uint32_t supersampleFactor = 1
 Supersampling factor.
 
RHI_FramebufferHandle staticFBO
 
RHI_FramebufferHandle dynamicFBO
 
uint32_t staticMargin = 0
 Frame pixels the static target holds beyond each view edge so a pan within them is only a shift.
 
RHI_FramebufferHandle staticTempFBO
 The static target's temp target, made when a static layer first needs one.
 
RHI_FramebufferHandle staticViewFBO
 Static content drawn without the margin, as during a zoom, goes into this view sized target so the zoom does not clear and store an empty margin.
 
bool staticInMargin = true
 the content shown is in staticFBO
 
RHI_VIEW_SHIFT staticShift
 How far the view has moved since the static target was drawn.
 
RHI_VIEW_SHIFT overlayShift
 How far the view has moved since overlayMarginFBO was drawn.
 
RHI_FramebufferHandle tempFBO
 
RHI_FramebufferHandle diffBelowFBO
 Copies of what lies under a difference layer, for the view sized targets and the static one.
 
RHI_FramebufferHandle staticDiffBelowFBO
 
RHI_FramebufferHandle overlayGeometryFBO
 Overlay content, drawn from a transparent start and composited over the dynamic target (see RHI_GAL_PIPELINES::GetOverlayVariant).
 
bool overlayGeometryDrawn = false
 
RHI_FramebufferHandle overlayMarginFBO
 Overlay content that stayed the same through a pan, drawn with the static target's margin.
 
bool overlayInMargin = false
 
bool dynamicGeometryDrawn = true
 An empty dynamicFBO is neither drawn nor composited.
 
RHI_FramebufferHandle accumulationFBO
 Color only, without depth or stencil.
 
FRAME_UNIFORMS uniformSets [UNIFORM_GENERATIONS]
 
size_t uniformGeneration = 0
 
FRAME_DRAW_DESC drawDesc
 
FRAME_DRAW_DESC staticDrawDesc
 Static and dynamic pool descriptions, each drawn into its own target.
 
FRAME_DRAW_DESC dynamicDrawDesc
 
bool staticChanged = true
 
bool dynamicChanged = true
 
uint64_t staticEpoch = 0
 
uint64_t dynamicEpoch = 0
 
RENDERED_CONTENT renderedStatic
 
RENDERED_CONTENT renderedDynamic
 
RENDERED_CONTENT renderedOverlay
 the overlay target keeps the static target's margin
 
uint64_t staticPasses = 0
 times staticFBO was re-rendered
 
uint64_t geometryRenderPasses = 0
 render passes begun while drawing geometry
 
uint64_t dynamicPasses = 0
 times dynamicFBO was re-rendered
 
uint64_t requestedGeneration = 0
 
uint64_t lastRenderedGeneration = 0
 
bool needsStaticInvalidate = false
 
bool active = false
 
bool frameResultPending = false
 
uint64_t framesProcessed = 0
 
Clock::time_point lastActivityTime
 
Clock::time_point lastFrameRequestTime
 
Clock::time_point lastRenderStartTime
 
Clock::time_point lastRenderCompleteTime
 
Clock::time_point lastPresentAttemptTime
 
Clock::time_point lastPresentSuccessTime
 
Clock::time_point lastPresentFailureTime
 
Clock::time_point nextPresentRetryAt
 
Clock::time_point lastSwapchainCreateAttemptTime
 
Clock::time_point lastLagLogTime
 
float refreshHz = 0.0f
 A swapchain that presents immediately is drawn at most once per refresh unless the frame answers input the last drawn frame had not seen.
 
Clock::time_point nextFrameAt
 earliest time such a window may be drawn again
 
uint64_t drawnInputSerial = 0
 FRAME_PACKET::inputSerial of the last packet loaded.
 
uint64_t presentSuccessCount = 0
 
uint64_t presentFailureCount = 0
 
uint32_t consecutivePresentFailures = 0
 
uint64_t swapchainCreateAttempts = 0
 
uint64_t lastPresentedGeneration = 0
 
FRAME_MAILBOX * mailbox = nullptr
 Owned by the panel.
 

Static Public Attributes

static constexpr size_t UNIFORM_GENERATIONS = 3
 A frame's passes are still queued when the next frame is built, so frames rotate through several uniform sets rather than waiting on the previous one.
 

Detailed Description

Per-window state owned by the render thread.

It is created and destroyed by the SWAPCHAIN_CREATE/RESIZE/DESTROY control commands and touched by no other thread.

Definition at line 43 of file render_thread_window_state.h.

Member Typedef Documentation

◆ Clock

using KIGFX::WINDOW_STATE::Clock = std::chrono::steady_clock

Definition at line 221 of file render_thread_window_state.h.

Member Function Documentation

◆ RenderHeight()

◆ RenderWidth()

◆ ShownStaticFBO()

◆ ShownStaticX()

int32_t KIGFX::WINDOW_STATE::ShownStaticX ( ) const
inline

Where the view starts in the shown static target, in texels.

Definition at line 92 of file render_thread_window_state.h.

References staticInMargin, staticMargin, staticShift, and supersampleFactor.

Referenced by KIGFX::RENDER_THREAD::RenderGeometryInto(), and KIGFX::RENDER_THREAD::RenderWindow().

◆ ShownStaticY()

int32_t KIGFX::WINDOW_STATE::ShownStaticY ( ) const
inline

◆ StaticHeight()

uint32_t KIGFX::WINDOW_STATE::StaticHeight ( ) const
inline

◆ StaticWidth()

uint32_t KIGFX::WINDOW_STATE::StaticWidth ( ) const
inline

◆ Uniforms()

Member Data Documentation

◆ accumulationFBO

RHI_FramebufferHandle KIGFX::WINDOW_STATE::accumulationFBO

◆ active

bool KIGFX::WINDOW_STATE::active = false

◆ backingHeight

◆ backingWidth

◆ consecutivePresentFailures

uint32_t KIGFX::WINDOW_STATE::consecutivePresentFailures = 0

Definition at line 243 of file render_thread_window_state.h.

◆ diffBelowFBO

RHI_FramebufferHandle KIGFX::WINDOW_STATE::diffBelowFBO

Copies of what lies under a difference layer, for the view sized targets and the static one.

Dropped once no difference layer is left.

Definition at line 120 of file render_thread_window_state.h.

Referenced by destroyDiffCopies(), KIGFX::RENDER_THREAD::RenderGeometryInto(), and KIGFX::RENDER_THREAD::RenderWindow().

◆ dpiScale

◆ drawDesc

◆ drawnInputSerial

uint64_t KIGFX::WINDOW_STATE::drawnInputSerial = 0

FRAME_PACKET::inputSerial of the last packet loaded.

Definition at line 239 of file render_thread_window_state.h.

◆ dynamicChanged

bool KIGFX::WINDOW_STATE::dynamicChanged = true

Definition at line 185 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::RenderWindow().

◆ dynamicDrawDesc

FRAME_DRAW_DESC KIGFX::WINDOW_STATE::dynamicDrawDesc

Definition at line 183 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::RenderWindow().

◆ dynamicEpoch

uint64_t KIGFX::WINDOW_STATE::dynamicEpoch = 0

Definition at line 188 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::RenderWindow().

◆ dynamicFBO

◆ dynamicGeometryDrawn

bool KIGFX::WINDOW_STATE::dynamicGeometryDrawn = true

An empty dynamicFBO is neither drawn nor composited.

Definition at line 138 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::ReadbackWindowPixels(), and KIGFX::RENDER_THREAD::RenderWindow().

◆ dynamicPasses

uint64_t KIGFX::WINDOW_STATE::dynamicPasses = 0

times dynamicFBO was re-rendered

Definition at line 210 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::RenderWindow().

◆ frameResultPending

bool KIGFX::WINDOW_STATE::frameResultPending = false

◆ framesProcessed

uint64_t KIGFX::WINDOW_STATE::framesProcessed = 0

◆ geometryRenderPasses

uint64_t KIGFX::WINDOW_STATE::geometryRenderPasses = 0

render passes begun while drawing geometry

Definition at line 209 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::RenderGeometryInto(), and KIGFX::RENDER_THREAD::RenderWindow().

◆ height

uint32_t KIGFX::WINDOW_STATE::height = 0

◆ lastActivityTime

Clock::time_point KIGFX::WINDOW_STATE::lastActivityTime

◆ lastFrameRequestTime

Clock::time_point KIGFX::WINDOW_STATE::lastFrameRequestTime

◆ lastLagLogTime

Clock::time_point KIGFX::WINDOW_STATE::lastLagLogTime

Definition at line 231 of file render_thread_window_state.h.

◆ lastPresentAttemptTime

Clock::time_point KIGFX::WINDOW_STATE::lastPresentAttemptTime

Definition at line 226 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::RenderWindow().

◆ lastPresentedGeneration

uint64_t KIGFX::WINDOW_STATE::lastPresentedGeneration = 0

Definition at line 245 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::RenderWindow().

◆ lastPresentFailureTime

Clock::time_point KIGFX::WINDOW_STATE::lastPresentFailureTime

Definition at line 228 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::RenderWindow().

◆ lastPresentSuccessTime

Clock::time_point KIGFX::WINDOW_STATE::lastPresentSuccessTime

Definition at line 227 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::RenderWindow().

◆ lastRenderCompleteTime

Clock::time_point KIGFX::WINDOW_STATE::lastRenderCompleteTime

Definition at line 225 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::RenderWindow().

◆ lastRenderedGeneration

uint64_t KIGFX::WINDOW_STATE::lastRenderedGeneration = 0

Definition at line 213 of file render_thread_window_state.h.

◆ lastRenderStartTime

Clock::time_point KIGFX::WINDOW_STATE::lastRenderStartTime

Definition at line 224 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::RenderWindow().

◆ lastSwapchainCreateAttemptTime

Clock::time_point KIGFX::WINDOW_STATE::lastSwapchainCreateAttemptTime

◆ mailbox

FRAME_MAILBOX* KIGFX::WINDOW_STATE::mailbox = nullptr

Owned by the panel.

Definition at line 248 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::HandleSwapchainCreate().

◆ nativeHandle

◆ needsStaticInvalidate

bool KIGFX::WINDOW_STATE::needsStaticInvalidate = false

◆ nextFrameAt

Clock::time_point KIGFX::WINDOW_STATE::nextFrameAt

earliest time such a window may be drawn again

Definition at line 238 of file render_thread_window_state.h.

◆ nextPresentRetryAt

Clock::time_point KIGFX::WINDOW_STATE::nextPresentRetryAt

◆ overlayGeometryDrawn

bool KIGFX::WINDOW_STATE::overlayGeometryDrawn = false

◆ overlayGeometryFBO

RHI_FramebufferHandle KIGFX::WINDOW_STATE::overlayGeometryFBO

Overlay content, drawn from a transparent start and composited over the dynamic target (see RHI_GAL_PIPELINES::GetOverlayVariant).

Definition at line 127 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::DestroyWindowFBOs(), and KIGFX::RENDER_THREAD::RenderWindow().

◆ overlayInMargin

bool KIGFX::WINDOW_STATE::overlayInMargin = false

◆ overlayMarginFBO

RHI_FramebufferHandle KIGFX::WINDOW_STATE::overlayMarginFBO

Overlay content that stayed the same through a pan, drawn with the static target's margin.

Changing content goes to the view sized overlayGeometryFBO so a drag never pays for the margin.

Definition at line 134 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::DestroyWindowFBOs(), KIGFX::RENDER_THREAD::RenderGeometryInto(), and KIGFX::RENDER_THREAD::RenderWindow().

◆ overlayShift

RHI_VIEW_SHIFT KIGFX::WINDOW_STATE::overlayShift

How far the view has moved since overlayMarginFBO was drawn.

Definition at line 110 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::CreateWindowFBOs(), and KIGFX::RENDER_THREAD::RenderWindow().

◆ presentFailureCount

uint64_t KIGFX::WINDOW_STATE::presentFailureCount = 0

Definition at line 242 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::RenderWindow().

◆ presentSuccessCount

uint64_t KIGFX::WINDOW_STATE::presentSuccessCount = 0

Definition at line 241 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::RenderWindow().

◆ refreshHz

float KIGFX::WINDOW_STATE::refreshHz = 0.0f

A swapchain that presents immediately is drawn at most once per refresh unless the frame answers input the last drawn frame had not seen.

0 when unknown, which lifts the limit

Definition at line 237 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::HandleFrameRequest().

◆ renderedDynamic

RENDERED_CONTENT KIGFX::WINDOW_STATE::renderedDynamic

Definition at line 205 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::RenderWindow().

◆ renderedOverlay

RENDERED_CONTENT KIGFX::WINDOW_STATE::renderedOverlay

the overlay target keeps the static target's margin

Definition at line 206 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::CreateWindowFBOs(), and KIGFX::RENDER_THREAD::RenderWindow().

◆ renderedStatic

RENDERED_CONTENT KIGFX::WINDOW_STATE::renderedStatic

◆ requestedGeneration

uint64_t KIGFX::WINDOW_STATE::requestedGeneration = 0

◆ staticChanged

bool KIGFX::WINDOW_STATE::staticChanged = true

Definition at line 184 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::RenderWindow().

◆ staticDiffBelowFBO

◆ staticDrawDesc

FRAME_DRAW_DESC KIGFX::WINDOW_STATE::staticDrawDesc

Static and dynamic pool descriptions, each drawn into its own target.

The changed flags say whether that target must be redrawn this frame.

Definition at line 182 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::RenderWindow().

◆ staticEpoch

uint64_t KIGFX::WINDOW_STATE::staticEpoch = 0

Definition at line 187 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::RenderWindow().

◆ staticFBO

◆ staticInMargin

◆ staticMargin

uint32_t KIGFX::WINDOW_STATE::staticMargin = 0

Frame pixels the static target holds beyond each view edge so a pan within them is only a shift.

0 when the static target is the view's size.

Definition at line 74 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::CreateWindowFBOs(), marginLayer(), KIGFX::RENDER_THREAD::RenderGeometryInto(), KIGFX::RENDER_THREAD::RenderWindow(), ShownStaticX(), ShownStaticY(), StaticHeight(), and StaticWidth().

◆ staticPasses

uint64_t KIGFX::WINDOW_STATE::staticPasses = 0

times staticFBO was re-rendered

Definition at line 208 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::RenderWindow().

◆ staticShift

RHI_VIEW_SHIFT KIGFX::WINDOW_STATE::staticShift

How far the view has moved since the static target was drawn.

Definition at line 107 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::CreateWindowFBOs(), KIGFX::RENDER_THREAD::ReadbackWindowPixels(), KIGFX::RENDER_THREAD::RenderWindow(), ShownStaticX(), and ShownStaticY().

◆ staticTempFBO

RHI_FramebufferHandle KIGFX::WINDOW_STATE::staticTempFBO

The static target's temp target, made when a static layer first needs one.

Definition at line 77 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::DestroyWindowFBOs(), and KIGFX::RENDER_THREAD::RenderGeometryInto().

◆ staticViewFBO

RHI_FramebufferHandle KIGFX::WINDOW_STATE::staticViewFBO

Static content drawn without the margin, as during a zoom, goes into this view sized target so the zoom does not clear and store an empty margin.

Definition at line 83 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::DestroyWindowFBOs(), KIGFX::RENDER_THREAD::RenderGeometryInto(), KIGFX::RENDER_THREAD::RenderWindow(), and ShownStaticFBO().

◆ supersampleFactor

uint32_t KIGFX::WINDOW_STATE::supersampleFactor = 1

Supersampling factor.

Layer and compositor targets are the backing size times this and the present blit downsamples to the swapchain, which stays at the backing size.

Definition at line 62 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::CreateWindowFBOs(), marginLayer(), KIGFX::RENDER_THREAD::RenderGeometryInto(), RenderHeight(), RenderWidth(), ShownStaticX(), ShownStaticY(), StaticHeight(), staticMarginFor(), and StaticWidth().

◆ surface

◆ swapchain

◆ swapchainCreateAttempts

uint64_t KIGFX::WINDOW_STATE::swapchainCreateAttempts = 0

Definition at line 244 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::EnsureSwapchain().

◆ tempFBO

◆ UNIFORM_GENERATIONS

size_t KIGFX::WINDOW_STATE::UNIFORM_GENERATIONS = 3
staticconstexpr

A frame's passes are still queued when the next frame is built, so frames rotate through several uniform sets rather than waiting on the previous one.

Definition at line 169 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::RenderWindow().

◆ uniformGeneration

size_t KIGFX::WINDOW_STATE::uniformGeneration = 0

Definition at line 172 of file render_thread_window_state.h.

Referenced by KIGFX::RENDER_THREAD::RenderWindow(), and Uniforms().

◆ uniformSets

FRAME_UNIFORMS KIGFX::WINDOW_STATE::uniformSets[UNIFORM_GENERATIONS]

◆ width

uint32_t KIGFX::WINDOW_STATE::width = 0

◆ windowId


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