Caches a GeomPrimitive in the DirectX device as an index buffer. More...
#include "dxIndexBufferContext9.h"
Public Member Functions | |
DXIndexBufferContext9 (PreparedGraphicsObjects *pgo, GeomPrimitive *data) | |
void | allocate_ibuffer (DXScreenData &scrn, const GeomPrimitivePipelineReader *reader) |
Allocates index buffer memory. More... | |
void | create_ibuffer (DXScreenData &scrn, const GeomPrimitivePipelineReader *reader) |
Creates a new index buffer (but does not upload data to it). More... | |
virtual void | evict_lru () |
Evicts the page from the LRU. More... | |
virtual TypeHandle | force_init_type () |
void | free_ibuffer () |
Free index buffer. More... | |
virtual TypeHandle | get_type () const |
bool | upload_data (const GeomPrimitivePipelineReader *reader, bool force) |
Copies the latest data from the client store to DirectX. More... | |
Public Member Functions inherited from IndexBufferContext | |
IndexBufferContext (PreparedGraphicsObjects *pgo, GeomPrimitive *data) | |
bool | changed_size (const GeomPrimitivePipelineReader *reader) const |
Returns true if the data has changed size since the last time mark_loaded() was called. More... | |
bool | changed_usage_hint (const GeomPrimitivePipelineReader *reader) const |
Returns true if the data has changed its usage hint since the last time mark_loaded() was called. More... | |
GeomPrimitive * | get_data () const |
Returns the pointer to the client-side array data object. More... | |
void | mark_loaded (const GeomPrimitivePipelineReader *reader) |
Should be called after the IndexBufferContext has been loaded into graphics memory, this updates the internal flags for changed_size() and modified(). More... | |
void | mark_unloaded () |
Should be called after the buffer has been forced out of graphics memory. More... | |
virtual void | output (std::ostream &out) const |
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. More... | |
bool | was_modified (const GeomPrimitivePipelineReader *reader) const |
Returns true if the data has been modified since the last time mark_loaded() was called. More... | |
virtual void | write (std::ostream &out, int indent_level) const |
Public Member Functions inherited from BufferContext | |
BufferContext (BufferResidencyTracker *residency, TypedWritableReferenceCount *object) | |
bool | get_active () const |
size_t | get_data_size_bytes () const |
UpdateSeq | get_modified () const |
BufferContext * | get_next () const |
This can be used along with BufferContextChain::get_first() to walk through the list of objects stored on a tracker. More... | |
TypedWritableReferenceCount * | get_object () const |
bool | get_resident () const |
void | set_active (bool flag) |
Changes the active flag associated with this object. More... | |
void | set_resident (bool flag) |
Changes the resident flag associated with this object. More... | |
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. More... | |
void | update_modified (UpdateSeq new_modified) |
Should be called (usually by a derived class) when the modified counter for this object has changed. More... | |
Public Member Functions inherited from TypedObject | |
TypedObject (const TypedObject ©)=default | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
const TypedObject * | as_typed_object () const |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
int | get_best_parent_from_Set (const std::set< int > &) const |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More... | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. More... | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. More... | |
TypedObject & | operator= (const TypedObject ©)=default |
Public Member Functions inherited from AdaptiveLruPage | |
AdaptiveLruPage (size_t lru_size) | |
AdaptiveLruPage (const AdaptiveLruPage ©) | |
void | dequeue_lru () |
Removes the page from its AdaptiveLru. More... | |
void | enqueue_lru (AdaptiveLru *lru) |
Adds the page to the LRU for the first time, or marks it recently-accessed if it has already been added. More... | |
AdaptiveLru * | get_lru () const |
Returns the LRU that manages this page, or NULL if it is not currently managed by any LRU. More... | |
size_t | get_lru_size () const |
Returns the size of this page as reported to the LRU, presumably in bytes. More... | |
unsigned int | get_num_frames () const |
Returns the number of frames since the page was first added to its LRU. More... | |
unsigned int | get_num_inactive_frames () const |
Returns the number of frames since the page was last accessed on its LRU. More... | |
void | mark_used_lru () const |
To be called when the page is used; this will move it to the tail of the AdaptiveLru queue it is already on. More... | |
void | mark_used_lru (AdaptiveLru *lru) |
To be called when the page is used; this will move it to the tail of the specified AdaptiveLru queue. More... | |
void | operator= (const AdaptiveLruPage ©) |
void | set_lru_size (size_t lru_size) |
Specifies the size of this page, presumably in bytes, although any unit is possible. More... | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
Static Public Member Functions inherited from IndexBufferContext | |
static TypeHandle | get_class_type () |
static void | init_type () |
Static Public Member Functions inherited from BufferContext | |
static TypeHandle | get_class_type () |
static void | init_type () |
Static Public Member Functions inherited from SavedContext | |
static TypeHandle | get_class_type () |
static void | init_type () |
Static Public Member Functions inherited from TypedObject | |
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. More... | |
Public Attributes | |
IDirect3DIndexBuffer9 * | _ibuffer |
int | _managed |
Public Attributes inherited from BufferContext | |
get_active | |
Returns the active flag associated with this object. More... | |
get_data_size_bytes | |
Returns the number of bytes previously reported for the data object. More... | |
get_modified | |
Returns the UpdateSeq that was recorded the last time mark_loaded() was called. More... | |
get_object | |
Returns the associated object. More... | |
get_resident | |
Returns the resident flag associated with this object. More... | |
Public Attributes inherited from TypedObject | |
get_type | |
Caches a GeomPrimitive in the DirectX device as an index buffer.
Definition at line 24 of file dxIndexBufferContext9.h.
void DXIndexBufferContext9::allocate_ibuffer | ( | DXScreenData & | scrn, |
const GeomPrimitivePipelineReader * | reader | ||
) |
Allocates index buffer memory.
Definition at line 85 of file dxIndexBufferContext9.cxx.
References DXGraphicsStateGuardian9::get_index_type().
void DXIndexBufferContext9::create_ibuffer | ( | DXScreenData & | scrn, |
const GeomPrimitivePipelineReader * | reader | ||
) |
Creates a new index buffer (but does not upload data to it).
Definition at line 144 of file dxIndexBufferContext9.cxx.
|
virtual |
Evicts the page from the LRU.
Called internally when the LRU determines that it is full. May also be called externally when necessary to explicitly evict the page.
It is legal for this method to either evict the page as requested, do nothing (in which case the eviction will be requested again at the next epoch), or requeue itself on the tail of the queue (in which case the eviction will be requested again much later).
Reimplemented from AdaptiveLruPage.
Definition at line 53 of file dxIndexBufferContext9.cxx.
References AdaptiveLruPage::dequeue_lru(), free_ibuffer(), IndexBufferContext::mark_unloaded(), and IndexBufferContext::update_data_size_bytes().
void DXIndexBufferContext9::free_ibuffer | ( | void | ) |
Free index buffer.
Definition at line 64 of file dxIndexBufferContext9.cxx.
Referenced by evict_lru().
bool DXIndexBufferContext9::upload_data | ( | const GeomPrimitivePipelineReader * | reader, |
bool | force | ||
) |
Copies the latest data from the client store to DirectX.
Definition at line 161 of file dxIndexBufferContext9.cxx.