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

#include <gpu_manager.h>

Inheritance diagram for KIGFX::GPU_CACHED_MANAGER:
KIGFX::GPU_MANAGER

Classes

struct  VRANGE
 

Public Member Functions

 GPU_CACHED_MANAGER (VERTEX_CONTAINER *aContainer)
 
 ~GPU_CACHED_MANAGER ()
 
virtual void BeginDrawing () override
 Prepare the stored data to be drawn.
 
virtual void DrawIndices (const VERTEX_ITEM *aItem) override
 Make the GPU draw given range of vertices.
 
virtual void EndDrawing () override
 Clear the container after drawing routines.
 
void Map ()
 Map vertex buffer stored in GPU memory.
 
void Unmap ()
 Unmap vertex buffer.
 
virtual void SetShader (SHADER &aShader)
 Allow using shaders with the stored data.
 
void EnableDepthTest (bool aEnabled)
 Enable/disable Z buffer depth test.
 

Static Public Member Functions

static GPU_MANAGER * MakeManager (VERTEX_CONTAINER *aContainer)
 

Protected Member Functions

void resizeIndices (unsigned int aNewSize)
 Resizes the indices buffer to aNewSize if necessary.
 

Protected Attributes

bool m_buffersInitialized
 Buffers initialization flag.
 
boost::scoped_array< GLuint > m_indices
 Pointer to the current indices buffer.
 
unsigned int m_indicesCapacity
 Current indices buffer size.
 
std::vector< VRANGE > m_vranges
 Ranges of visible vertex indices to render.
 
int m_totalHuge
 Number of huge VRANGEs (i.e. large zones) with separate draw calls.
 
int m_totalNormal
 Number of regular VRANGEs (small items) pooled into single draw call.
 
unsigned int m_indexBufSize
 Current size of index buffer.
 
unsigned int m_indexBufMaxSize
 Maximum size taken by the index buffer for all frames rendered so far.
 
unsigned int m_curVrangeSize
 Size of the current VRANGE.
 
bool m_isDrawing
 Drawing status flag.
 
VERTEX_CONTAINER * m_container
 Container that stores vertices data.
 
SHADER * m_shader
 Shader handling.
 
int m_shaderAttrib
 Location of shader attributes (for glVertexAttribPointer)
 
bool m_enableDepthTest
 true: enable Z test when drawing
 

Detailed Description

Definition at line 97 of file gpu_manager.h.

Constructor & Destructor Documentation

◆ GPU_CACHED_MANAGER()

GPU_CACHED_MANAGER::GPU_CACHED_MANAGER ( VERTEX_CONTAINER * aContainer)

◆ ~GPU_CACHED_MANAGER()

GPU_CACHED_MANAGER::~GPU_CACHED_MANAGER ( )

Definition at line 94 of file gpu_manager.cpp.

Member Function Documentation

◆ BeginDrawing()

void GPU_CACHED_MANAGER::BeginDrawing ( )
overridevirtual

Prepare the stored data to be drawn.

Implements KIGFX::GPU_MANAGER.

Definition at line 99 of file gpu_manager.cpp.

References m_curVrangeSize, m_indexBufMaxSize, m_indexBufSize, KIGFX::GPU_MANAGER::m_isDrawing, and m_vranges.

◆ DrawIndices()

void GPU_CACHED_MANAGER::DrawIndices ( const VERTEX_ITEM * aItem)
overridevirtual

Make the GPU draw given range of vertices.

Parameters
aItemis the vertex item to draw.

Implements KIGFX::GPU_MANAGER.

Definition at line 112 of file gpu_manager.cpp.

References KIGFX::VERTEX_ITEM::GetOffset(), KIGFX::VERTEX_ITEM::GetSize(), m_curVrangeSize, m_indexBufSize, KIGFX::GPU_MANAGER::m_isDrawing, m_totalHuge, m_totalNormal, and m_vranges.

◆ EnableDepthTest()

void GPU_MANAGER::EnableDepthTest ( bool aEnabled)
inherited

Enable/disable Z buffer depth test.

Definition at line 336 of file gpu_manager.cpp.

References m_enableDepthTest.

◆ EndDrawing()

◆ MakeManager()

GPU_MANAGER * GPU_MANAGER::MakeManager ( VERTEX_CONTAINER * aContainer)
staticinherited

◆ Map()

void KIGFX::GPU_CACHED_MANAGER::Map ( )

Map vertex buffer stored in GPU memory.

◆ resizeIndices()

void GPU_CACHED_MANAGER::resizeIndices ( unsigned int aNewSize)
protected

Resizes the indices buffer to aNewSize if necessary.

Definition at line 247 of file gpu_manager.cpp.

References m_indices, and m_indicesCapacity.

Referenced by EndDrawing().

◆ SetShader()

void GPU_MANAGER::SetShader ( SHADER & aShader)
virtualinherited

Allow using shaders with the stored data.

Parameters
aShaderis the object that allows using shaders.

Definition at line 68 of file gpu_manager.cpp.

References DisplayError(), m_shader, and m_shaderAttrib.

◆ Unmap()

void KIGFX::GPU_CACHED_MANAGER::Unmap ( )

Unmap vertex buffer.

Member Data Documentation

◆ m_buffersInitialized

bool KIGFX::GPU_CACHED_MANAGER::m_buffersInitialized
protected

Buffers initialization flag.

Definition at line 138 of file gpu_manager.h.

Referenced by GPU_CACHED_MANAGER().

◆ m_container

VERTEX_CONTAINER* KIGFX::GPU_MANAGER::m_container
protectedinherited

Container that stores vertices data.

Definition at line 84 of file gpu_manager.h.

Referenced by KIGFX::GPU_CACHED_MANAGER::EndDrawing(), KIGFX::GPU_NONCACHED_MANAGER::EndDrawing(), and GPU_MANAGER().

◆ m_curVrangeSize

unsigned int KIGFX::GPU_CACHED_MANAGER::m_curVrangeSize
protected

Size of the current VRANGE.

Definition at line 162 of file gpu_manager.h.

Referenced by BeginDrawing(), DrawIndices(), EndDrawing(), and GPU_CACHED_MANAGER().

◆ m_enableDepthTest

bool KIGFX::GPU_MANAGER::m_enableDepthTest
protectedinherited

true: enable Z test when drawing

Definition at line 93 of file gpu_manager.h.

Referenced by EnableDepthTest(), KIGFX::GPU_CACHED_MANAGER::EndDrawing(), KIGFX::GPU_NONCACHED_MANAGER::EndDrawing(), and GPU_MANAGER().

◆ m_indexBufMaxSize

unsigned int KIGFX::GPU_CACHED_MANAGER::m_indexBufMaxSize
protected

Maximum size taken by the index buffer for all frames rendered so far.

Definition at line 159 of file gpu_manager.h.

Referenced by BeginDrawing(), EndDrawing(), and GPU_CACHED_MANAGER().

◆ m_indexBufSize

unsigned int KIGFX::GPU_CACHED_MANAGER::m_indexBufSize
protected

Current size of index buffer.

Definition at line 156 of file gpu_manager.h.

Referenced by BeginDrawing(), DrawIndices(), EndDrawing(), and GPU_CACHED_MANAGER().

◆ m_indices

boost::scoped_array<GLuint> KIGFX::GPU_CACHED_MANAGER::m_indices
protected

Pointer to the current indices buffer.

Definition at line 141 of file gpu_manager.h.

Referenced by EndDrawing(), and resizeIndices().

◆ m_indicesCapacity

unsigned int KIGFX::GPU_CACHED_MANAGER::m_indicesCapacity
protected

Current indices buffer size.

Definition at line 144 of file gpu_manager.h.

Referenced by GPU_CACHED_MANAGER(), and resizeIndices().

◆ m_isDrawing

bool KIGFX::GPU_MANAGER::m_isDrawing
protectedinherited

◆ m_shader

SHADER* KIGFX::GPU_MANAGER::m_shader
protectedinherited

◆ m_shaderAttrib

int KIGFX::GPU_MANAGER::m_shaderAttrib
protectedinherited

Location of shader attributes (for glVertexAttribPointer)

Definition at line 90 of file gpu_manager.h.

Referenced by KIGFX::GPU_CACHED_MANAGER::EndDrawing(), KIGFX::GPU_NONCACHED_MANAGER::EndDrawing(), GPU_MANAGER(), and SetShader().

◆ m_totalHuge

int KIGFX::GPU_CACHED_MANAGER::m_totalHuge
protected

Number of huge VRANGEs (i.e. large zones) with separate draw calls.

Definition at line 150 of file gpu_manager.h.

Referenced by DrawIndices(), and GPU_CACHED_MANAGER().

◆ m_totalNormal

int KIGFX::GPU_CACHED_MANAGER::m_totalNormal
protected

Number of regular VRANGEs (small items) pooled into single draw call.

Definition at line 153 of file gpu_manager.h.

Referenced by DrawIndices(), and GPU_CACHED_MANAGER().

◆ m_vranges

std::vector<VRANGE> KIGFX::GPU_CACHED_MANAGER::m_vranges
protected

Ranges of visible vertex indices to render.

Definition at line 147 of file gpu_manager.h.

Referenced by BeginDrawing(), DrawIndices(), and EndDrawing().


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