KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KIGFX::GL_RESET_BUDGET Class Reference

Limit how often the OpenGL canvases are rebuilt after GPU resets. More...

#include <gl_reset_budget.h>

Public Types

using CLOCK = std::chrono::steady_clock
 

Public Member Functions

 GL_RESET_BUDGET (size_t aMaxResets, CLOCK::duration aWindow)
 
bool RecordReset (CLOCK::time_point aNow)
 Record a reset.
 

Private Attributes

size_t m_maxResets
 
CLOCK::duration m_window
 
std::deque< CLOCK::time_point > m_resets
 

Detailed Description

Limit how often the OpenGL canvases are rebuilt after GPU resets.

A driver that resets on every frame would otherwise rebuild the canvases forever, so once more than the allowed number of resets land inside the window the caller should stop using OpenGL.

Definition at line 37 of file gl_reset_budget.h.

Member Typedef Documentation

◆ CLOCK

using KIGFX::GL_RESET_BUDGET::CLOCK = std::chrono::steady_clock

Definition at line 40 of file gl_reset_budget.h.

Constructor & Destructor Documentation

◆ GL_RESET_BUDGET()

KIGFX::GL_RESET_BUDGET::GL_RESET_BUDGET ( size_t aMaxResets,
CLOCK::duration aWindow )
inline

Definition at line 42 of file gl_reset_budget.h.

References m_maxResets, and m_window.

Member Function Documentation

◆ RecordReset()

bool KIGFX::GL_RESET_BUDGET::RecordReset ( CLOCK::time_point aNow)
inline

Record a reset.

Returns
true if rebuilding the OpenGL canvases is still worthwhile.

Definition at line 53 of file gl_reset_budget.h.

References m_maxResets, m_resets, and m_window.

Member Data Documentation

◆ m_maxResets

size_t KIGFX::GL_RESET_BUDGET::m_maxResets
private

Definition at line 64 of file gl_reset_budget.h.

Referenced by GL_RESET_BUDGET(), and RecordReset().

◆ m_resets

std::deque<CLOCK::time_point> KIGFX::GL_RESET_BUDGET::m_resets
private

Definition at line 66 of file gl_reset_budget.h.

Referenced by RecordReset().

◆ m_window

CLOCK::duration KIGFX::GL_RESET_BUDGET::m_window
private

Definition at line 65 of file gl_reset_budget.h.

Referenced by GL_RESET_BUDGET(), and RecordReset().


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