KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_gal_resize_strategy.cpp File Reference
#include <boost/test/unit_test.hpp>
#include <gal/opengl/utils.h>

Go to the source code of this file.

Enumerations

enum class  VRAM_RESIZE_STRATEGY
 Strategy for growing a GPU vertex buffer, trading copy speed against peak video memory. More...
 

Functions

 BOOST_AUTO_TEST_CASE (UnknownVramKeepsGpuCopy)
 
 BOOST_AUTO_TEST_CASE (AmpleVramUsesGpuCopy)
 
 BOOST_AUTO_TEST_CASE (TightVramStagesThroughRam)
 
 BOOST_AUTO_TEST_CASE (InsufficientVramRefuses)
 
 BOOST_AUTO_TEST_CASE (MarginBoundaries)
 
 BOOST_AUTO_TEST_CASE (NegativeMarginClampedToZero)
 
VRAM_RESIZE_STRATEGY chooseResizeStrategy (size_t aFreeVRAM, size_t aOldBytes, size_t aNewBytes, double aMarginFrac)
 Decide how to grow a GPU vertex buffer given the free video memory budget.
 

Variables

static const size_t MB = static_cast<size_t>( 1024 ) * 1024
 Tests for the predictive GPU buffer resize strategy guard that keeps a large-board defragmentResize() from tripping a fatal driver out-of-memory abort.
 

Enumeration Type Documentation

◆ VRAM_RESIZE_STRATEGY

enum class KIGFX::VRAM_RESIZE_STRATEGY
strong

Strategy for growing a GPU vertex buffer, trading copy speed against peak video memory.

Definition at line 57 of file utils.h.

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/6]

BOOST_AUTO_TEST_CASE ( AmpleVramUsesGpuCopy )

Definition at line 47 of file test_gal_resize_strategy.cpp.

References chooseResizeStrategy(), and MB.

◆ BOOST_AUTO_TEST_CASE() [2/6]

BOOST_AUTO_TEST_CASE ( InsufficientVramRefuses )

Definition at line 63 of file test_gal_resize_strategy.cpp.

References chooseResizeStrategy(), and MB.

◆ BOOST_AUTO_TEST_CASE() [3/6]

BOOST_AUTO_TEST_CASE ( MarginBoundaries )

Definition at line 70 of file test_gal_resize_strategy.cpp.

References chooseResizeStrategy(), and MB.

◆ BOOST_AUTO_TEST_CASE() [4/6]

BOOST_AUTO_TEST_CASE ( NegativeMarginClampedToZero )

Definition at line 93 of file test_gal_resize_strategy.cpp.

References chooseResizeStrategy(), and MB.

◆ BOOST_AUTO_TEST_CASE() [5/6]

BOOST_AUTO_TEST_CASE ( TightVramStagesThroughRam )

Definition at line 55 of file test_gal_resize_strategy.cpp.

References chooseResizeStrategy(), and MB.

◆ BOOST_AUTO_TEST_CASE() [6/6]

BOOST_AUTO_TEST_CASE ( UnknownVramKeepsGpuCopy )

Definition at line 36 of file test_gal_resize_strategy.cpp.

References BOOST_AUTO_TEST_CASE(), chooseResizeStrategy(), and MB.

◆ chooseResizeStrategy()

GAL_API VRAM_RESIZE_STRATEGY KIGFX::chooseResizeStrategy ( size_t aFreeVRAM,
size_t aOldBytes,
size_t aNewBytes,
double aMarginFrac )

Decide how to grow a GPU vertex buffer given the free video memory budget.

A doubling resize would otherwise hold the old and new buffers in VRAM at the same time, which can exceed the budget on a large board and trip a fatal driver out-of-memory abort.

Parameters
aFreeVRAMis the free video memory in bytes, or 0 when unknown.
aOldBytesis the size of the existing buffer in bytes.
aNewBytesis the size of the requested buffer in bytes.
aMarginFracis the headroom kept free, as a fraction of the allocation size.
Returns
the resize strategy to use.

Definition at line 234 of file utils.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().

Variable Documentation

◆ MB

const size_t MB = static_cast<size_t>( 1024 ) * 1024
static

Tests for the predictive GPU buffer resize strategy guard that keeps a large-board defragmentResize() from tripping a fatal driver out-of-memory abort.

Definition at line 33 of file test_gal_resize_strategy.cpp.

Referenced by PROJECT_ARCHIVER::Archive(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().