Panda3D
Public Member Functions | Static Public Member Functions | Friends

BufferContext Class Reference

This is a base class for those kinds of SavedContexts that occupy an easily-measured (and substantial) number of bytes in the video card's frame buffer memory or AGP memory. More...

#include "bufferContext.h"

Inheritance diagram for BufferContext:
SavedContext LinkedListNode TypedObject MemoryBase IndexBufferContext TextureContext VertexBufferContext DXIndexBufferContext8 DXIndexBufferContext9 DXTextureContext8 DXTextureContext9 TinyTextureContext DXVertexBufferContext8

List of all members.

Public Member Functions

 BufferContext (BufferResidencyTracker *residency)
virtual TypeHandle force_init_type ()
bool get_active () const
 Returns the active flag associated with this object.
size_t get_data_size_bytes () const
 Returns the number of bytes previously reported for the data object.
UpdateSeq get_modified () const
 Returns the UpdateSeq that was recorded the last time mark_loaded() was called.
BufferContextget_next () const
 This can be used along with BufferContextChain::get_first() to walk through the list of objects stored on a tracker.
bool get_resident () const
 Returns the resident flag associated with this object.
virtual TypeHandle get_type () const
void set_active (bool flag)
 Changes the active flag associated with this object.
void set_resident (bool flag)
 Changes the resident flag associated with this object.
void update_data_size_bytes (size_t new_data_size_bytes)
 Should be called (usually by a derived class) when the on-card size of this object has changed.
void update_modified (UpdateSeq new_modified)
 Should be called (usually by a derived class) when the modified counter for this object has changed.

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()
 This function is declared non-inline to work around a compiler bug in g++ 2.96.

Friends

class BufferContextChain
class BufferResidencyTracker
class PreparedGraphicsObjects

Detailed Description

This is a base class for those kinds of SavedContexts that occupy an easily-measured (and substantial) number of bytes in the video card's frame buffer memory or AGP memory.

At the present, this includes most of the SavedContext types: VertexBufferContext and IndexBufferContext, as well as TextureContext.

This class provides methods for tracking the video memory utilization, as well as residency of each object, via PStats.

Definition at line 41 of file bufferContext.h.


Member Function Documentation

bool BufferContext::get_active ( ) const [inline]

Returns the active flag associated with this object.

An object is considered "active" if it was rendered in the current frame.

Definition at line 49 of file bufferContext.I.

Referenced by Texture::get_active().

size_t BufferContext::get_data_size_bytes ( ) const [inline]

Returns the number of bytes previously reported for the data object.

This is used to track changes in the data object's allocated size; if it changes from this, we need to create a new buffer. This is also used to track memory utilization in PStats.

Definition at line 26 of file bufferContext.I.

Referenced by VertexBufferContext::changed_size(), IndexBufferContext::changed_size(), and Texture::get_data_size_bytes().

UpdateSeq BufferContext::get_modified ( ) const [inline]

Returns the UpdateSeq that was recorded the last time mark_loaded() was called.

Definition at line 37 of file bufferContext.I.

Referenced by IndexBufferContext::was_modified(), and VertexBufferContext::was_modified().

BufferContext * BufferContext::get_next ( ) const [inline]

This can be used along with BufferContextChain::get_first() to walk through the list of objects stored on a tracker.

Definition at line 110 of file bufferContext.I.

bool BufferContext::get_resident ( ) const [inline]

Returns the resident flag associated with this object.

An object is considered "resident" if it appears to be resident in texture memory.

Definition at line 61 of file bufferContext.I.

Referenced by Texture::get_resident().

static void BufferContext::init_type ( ) [inline, static]

This function is declared non-inline to work around a compiler bug in g++ 2.96.

Making it inline seems to cause problems in the optimizer.

Reimplemented from SavedContext.

Reimplemented in DXIndexBufferContext8, DXTextureContext8, DXVertexBufferContext8, DXIndexBufferContext9, DXTextureContext9, IndexBufferContext, TextureContext, VertexBufferContext, and TinyTextureContext.

Definition at line 76 of file bufferContext.h.

References SavedContext::init_type().

Referenced by VertexBufferContext::init_type(), TextureContext::init_type(), and IndexBufferContext::init_type().

void BufferContext::set_active ( bool  flag) [inline]

Changes the active flag associated with this object.

An object is considered "active" if it was rendered in the current frame.

Definition at line 73 of file bufferContext.I.

Referenced by DXGraphicsStateGuardian9::apply_index_buffer(), DXGraphicsStateGuardian8::apply_index_buffer(), DXGraphicsStateGuardian9::apply_texture(), DXGraphicsStateGuardian8::apply_texture(), and DXGraphicsStateGuardian8::apply_vertex_buffer().

void BufferContext::set_resident ( bool  flag) [inline]

Changes the resident flag associated with this object.

An object is considered "resident" if it appears to be resident in texture memory.

Definition at line 93 of file bufferContext.I.

Referenced by VertexBufferContext::mark_loaded(), TextureContext::mark_loaded(), IndexBufferContext::mark_loaded(), TextureContext::mark_simple_loaded(), VertexBufferContext::mark_unloaded(), TextureContext::mark_unloaded(), and IndexBufferContext::mark_unloaded().

void BufferContext::update_data_size_bytes ( size_t  new_data_size_bytes) [inline]

Should be called (usually by a derived class) when the on-card size of this object has changed.

Reimplemented in IndexBufferContext, TextureContext, and VertexBufferContext.

Definition at line 125 of file bufferContext.I.

void BufferContext::update_modified ( UpdateSeq  new_modified) [inline]

The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations