KiCad PCB EDA Suite
Loading...
Searching...
No Matches
utils.h File Reference
#include <gal/gal.h>
#include <cstddef>
#include <string>

Go to the source code of this file.

Namespaces

namespace  KIGFX
 The Cairo implementation of the graphics abstraction layer.
 

Enumerations

enum class  KIGFX::VRAM_RESIZE_STRATEGY { KIGFX::GPU_COPY , KIGFX::RAM_STAGE , KIGFX::REFUSE }
 Strategy for growing a GPU vertex buffer, trading copy speed against peak video memory. More...
 

Functions

int checkGlError (const std::string &aInfo, const char *aFile, int aLine, bool aThrow=true)
 Check if a recent OpenGL operation has failed.
 
void enableGlDebug (bool aEnable)
 Enable or disable OpenGL driver messages output.
 
size_t KIGFX::queryFreeVideoMemoryBytes ()
 Query the amount of free video memory the driver reports.
 
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.
 

Function Documentation

◆ checkGlError()

int checkGlError ( const std::string & aInfo,
const char * aFile,
int aLine,
bool aThrow = true )

Check if a recent OpenGL operation has failed.

If so, display the appropriate message starting with aInfo string to give more details.

Parameters
aInfois the beginning of the error message.
aFileis the file where the error occurred defined by the C FILE variable.
aLineis the line in aFile where the error occurred defined by the C LINE variable.
aThrowan exception is thrown when true, otherwise only an error message is displayed.
Returns
GL_NO_ERROR in case of no errors or one of GL_ constants returned by glGetError().

Definition at line 44 of file utils.cpp.

References DisplayErrorMessage(), result, and traceGalOpenGlError.

Referenced by KIGFX::OPENGL_GAL::BeginDrawing(), KIGFX::OPENGL_COMPOSITOR::bindFb(), KIGFX::CACHED_CONTAINER_GPU::CACHED_CONTAINER_GPU(), KIGFX::CACHED_CONTAINER_RAM::CACHED_CONTAINER_RAM(), KIGFX::OPENGL_COMPOSITOR::CreateBuffer(), KIGFX::CACHED_CONTAINER_GPU::defragmentResize(), KIGFX::CACHED_CONTAINER_GPU::defragmentResizeMemcpy(), KIGFX::CACHED_CONTAINER_GPU::defragmentResizeStaged(), KIGFX::OPENGL_COMPOSITOR::DrawBufferDifference(), KIGFX::OPENGL_COMPOSITOR::Initialize(), KIGFX::ANTIALIASING_SMAA::loadShaders(), KIGFX::CACHED_CONTAINER_GPU::Map(), KIGFX::ANTIALIASING_SMAA::Present(), KIGFX::OPENGL_COMPOSITOR::SetBuffer(), KIGFX::CACHED_CONTAINER_GPU::Unmap(), KIGFX::CACHED_CONTAINER_RAM::Unmap(), and KIGFX::ANTIALIASING_SMAA::updateUniforms().

◆ enableGlDebug()

void enableGlDebug ( bool aEnable)

Enable or disable OpenGL driver messages output.

Parameters
aEnabledecides whether the message should be shown.

Definition at line 187 of file utils.cpp.

References debugMsgCallback().

Referenced by KIGFX::OPENGL_GAL::init().