Panda3D
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Friends | List of all members
TextureContext Class Reference

This is a special class object that holds all the information returned by a particular GSG to indicate the texture's internal context identifier. More...

#include "textureContext.h"

Inheritance diagram for TextureContext:
BufferContext AdaptiveLruPage SavedContext LinkedListNode AdaptiveLruPageDynamicList AdaptiveLruPageStaticList TypedObject LinkedListNode LinkedListNode MemoryBase DXTextureContext9

Public Member Functions

 TextureContext (PreparedGraphicsObjects *pgo, Texture *tex, int view)
 
virtual TypeHandle force_init_type ()
 
UpdateSeq get_image_modified () const
 Returns a sequence number which is guaranteed to change at least every time the texture image data (including mipmap levels) are modified.
 
virtual uint64_t get_native_buffer_id () const
 Similar to get_native_id, but some implementations use a separate identifier for the buffer object associated with buffer textures.
 
virtual uint64_t get_native_id () const
 Returns an implementation-defined handle or pointer that can be used to interface directly with the underlying API.
 
UpdateSeq get_properties_modified () const
 Returns a sequence number which is guaranteed to change at least every time the texture properties (unrelated to the image) are modified.
 
UpdateSeq get_simple_image_modified () const
 Returns a sequence number which is guaranteed to change at least every time the texture's "simple" image data is modified.
 
Textureget_texture () const
 Returns the pointer to the associated Texture object.
 
virtual TypeHandle get_type () const
 
int get_view () const
 Returns the specific view of a multiview texture this context represents.
 
void mark_loaded ()
 Should be called after the texture has been loaded into graphics memory, this updates the internal flags for changed_size() and modified().
 
void mark_needs_reload ()
 Should be called to indicate the texture should be reloaded at the nearest opportunity.
 
void mark_simple_loaded ()
 Should be called after the texture's "simple" image has been loaded into graphics memory.
 
void mark_unloaded ()
 Should be called after the texture has been forced out of texture memory.
 
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.
 
bool was_image_modified () const
 Returns true if the texture image has been modified since the last time mark_loaded() was called.
 
bool was_modified () const
 Returns true if the texture properties or image have been modified since the last time mark_loaded() was called.
 
bool was_properties_modified () const
 Returns true if the texture properties (unrelated to the image) have been modified since the last time mark_loaded() was called.
 
bool was_simple_image_modified () const
 Returns true if the texture's "simple" image has been modified since the last time mark_simple_loaded() was called.
 
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
 
BufferContextget_next () const
 This can be used along with BufferContextChain::get_first() to walk through the list of objects stored on a tracker.
 
TypedWritableReferenceCountget_object () const
 
bool get_resident () 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.
 
- Public Member Functions inherited from TypedObject
 TypedObject (const TypedObject &copy)=default
 
TypedObjectas_typed_object ()
 Returns the object, upcast (if necessary) to a TypedObject pointer.
 
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer.
 
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.
 
bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly.
 
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type.
 
TypedObjectoperator= (const TypedObject &copy)=default
 
- Public Member Functions inherited from MemoryBase
void operator delete (void *, void *)
 
void operator delete (void *ptr)
 
void operator delete[] (void *, void *)
 
void operator delete[] (void *ptr)
 
void * operator new (size_t size)
 
void * operator new (size_t size, void *ptr)
 
void * operator new[] (size_t size)
 
void * operator new[] (size_t size, void *ptr)
 
- Public Member Functions inherited from AdaptiveLruPage
 AdaptiveLruPage (const AdaptiveLruPage &copy)
 
 AdaptiveLruPage (size_t lru_size)
 
void dequeue_lru ()
 Removes the page from its AdaptiveLru.
 
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.
 
virtual void evict_lru ()
 Evicts the page from the LRU.
 
AdaptiveLruget_lru () const
 Returns the LRU that manages this page, or NULL if it is not currently managed by any LRU.
 
size_t get_lru_size () const
 Returns the size of this page as reported to the LRU, presumably in bytes.
 
unsigned int get_num_frames () const
 Returns the number of frames since the page was first added to its LRU.
 
unsigned int get_num_inactive_frames () const
 Returns the number of frames since the page was last accessed on its LRU.
 
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.
 
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.
 
void operator= (const AdaptiveLruPage &copy)
 
void set_lru_size (size_t lru_size)
 Specifies the size of this page, presumably in bytes, although any unit is possible.
 

Static Public Member Functions

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.
 

Friends

class PreparedGraphicsObjects
 

Additional Inherited Members

- Public Attributes inherited from BufferContext
 get_active
 Returns the active flag associated with this object.
 
 get_data_size_bytes
 Returns the number of bytes previously reported for the data object.
 
 get_modified
 Returns the UpdateSeq that was recorded the last time mark_loaded() was called.
 
 get_object
 Returns the associated object.
 
 get_resident
 Returns the resident flag associated with this object.
 
- Public Attributes inherited from TypedObject
 get_type
 

Detailed Description

This is a special class object that holds all the information returned by a particular GSG to indicate the texture's internal context identifier.

Textures typically have an immediate-mode and a retained-mode operation. When using textures in retained-mode (in response to Texture::prepare()), the GSG will create some internal handle for the texture and store it here. The texture stores all of these handles internally.

Definition at line 33 of file textureContext.h.

Constructor & Destructor Documentation

◆ TextureContext()

TextureContext::TextureContext ( PreparedGraphicsObjects * pgo,
Texture * tex,
int view )
inline

Definition at line 17 of file textureContext.I.

Member Function Documentation

◆ force_init_type()

virtual TypeHandle TextureContext::force_init_type ( )
inlinevirtual

Reimplemented from BufferContext.

Definition at line 80 of file textureContext.h.

◆ get_class_type()

static TypeHandle TextureContext::get_class_type ( )
inlinestatic

Definition at line 69 of file textureContext.h.

◆ get_image_modified()

UpdateSeq TextureContext::get_image_modified ( ) const
inline

Returns a sequence number which is guaranteed to change at least every time the texture image data (including mipmap levels) are modified.

Definition at line 92 of file textureContext.I.

◆ get_native_buffer_id()

uint64_t TextureContext::get_native_buffer_id ( ) const
virtual

Similar to get_native_id, but some implementations use a separate identifier for the buffer object associated with buffer textures.

Returns 0 if the underlying implementation does not support this, or if this is not a buffer texture.

Definition at line 34 of file textureContext.cxx.

◆ get_native_id()

uint64_t TextureContext::get_native_id ( ) const
virtual

Returns an implementation-defined handle or pointer that can be used to interface directly with the underlying API.

Returns 0 if the underlying implementation does not support this.

Definition at line 23 of file textureContext.cxx.

◆ get_properties_modified()

UpdateSeq TextureContext::get_properties_modified ( ) const
inline

Returns a sequence number which is guaranteed to change at least every time the texture properties (unrelated to the image) are modified.

Definition at line 83 of file textureContext.I.

◆ get_simple_image_modified()

UpdateSeq TextureContext::get_simple_image_modified ( ) const
inline

Returns a sequence number which is guaranteed to change at least every time the texture's "simple" image data is modified.

Definition at line 101 of file textureContext.I.

◆ get_texture()

Texture * TextureContext::get_texture ( ) const
inline

◆ get_type()

virtual TypeHandle TextureContext::get_type ( ) const
inlinevirtual

Reimplemented from BufferContext.

Definition at line 77 of file textureContext.h.

◆ get_view()

int TextureContext::get_view ( ) const
inline

Returns the specific view of a multiview texture this context represents.

In the usual case, with a non-multiview texture, this will be 0.

Definition at line 37 of file textureContext.I.

Referenced by PreparedGraphicsObjects::release_all_textures(), and PreparedGraphicsObjects::release_texture().

◆ init_type()

static void TextureContext::init_type ( )
inlinestatic

Definition at line 72 of file textureContext.h.

◆ mark_loaded()

void TextureContext::mark_loaded ( )
inline

Should be called after the texture has been loaded into graphics memory, this updates the internal flags for changed_size() and modified().

Definition at line 120 of file textureContext.I.

References Texture::get_image_modified, Texture::get_properties_modified, get_texture(), BufferContext::set_resident(), and BufferContext::update_modified().

Referenced by DXTextureContext9::create_texture(), and DXGraphicsStateGuardian9::framebuffer_copy_to_texture().

◆ mark_needs_reload()

void TextureContext::mark_needs_reload ( )
inline

Should be called to indicate the texture should be reloaded at the nearest opportunity.

Definition at line 162 of file textureContext.I.

◆ mark_simple_loaded()

void TextureContext::mark_simple_loaded ( )
inline

Should be called after the texture's "simple" image has been loaded into graphics memory.

Definition at line 135 of file textureContext.I.

References Texture::get_properties_modified, Texture::get_simple_image_modified, get_texture(), BufferContext::set_resident(), and BufferContext::update_modified().

◆ mark_unloaded()

void TextureContext::mark_unloaded ( )
inline

Should be called after the texture has been forced out of texture memory.

Definition at line 148 of file textureContext.I.

References BufferContext::set_resident(), and BufferContext::update_modified().

Referenced by DXTextureContext9::evict_lru(), and DXGraphicsStateGuardian9::upload_texture().

◆ output()

void TextureContext::output ( std::ostream & out) const
virtual

Reimplemented from SavedContext.

Definition at line 42 of file textureContext.cxx.

◆ update_data_size_bytes()

void TextureContext::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.

Definition at line 110 of file textureContext.I.

References AdaptiveLruPage::set_lru_size(), and BufferContext::update_data_size_bytes().

Referenced by DXTextureContext9::create_texture(), DXTextureContext9::evict_lru(), and DXGraphicsStateGuardian9::upload_texture().

◆ was_image_modified()

bool TextureContext::was_image_modified ( ) const
inline

Returns true if the texture image has been modified since the last time mark_loaded() was called.

Definition at line 65 of file textureContext.I.

References Texture::get_image_modified, and get_texture().

Referenced by Texture::was_image_modified(), and was_modified().

◆ was_modified()

bool TextureContext::was_modified ( ) const
inline

Returns true if the texture properties or image have been modified since the last time mark_loaded() was called.

Definition at line 47 of file textureContext.I.

References was_image_modified(), and was_properties_modified().

Referenced by DXGraphicsStateGuardian9::update_texture().

◆ was_properties_modified()

bool TextureContext::was_properties_modified ( ) const
inline

Returns true if the texture properties (unrelated to the image) have been modified since the last time mark_loaded() was called.

Definition at line 56 of file textureContext.I.

References Texture::get_properties_modified, and get_texture().

Referenced by was_modified().

◆ was_simple_image_modified()

bool TextureContext::was_simple_image_modified ( ) const
inline

Returns true if the texture's "simple" image has been modified since the last time mark_simple_loaded() was called.

Definition at line 74 of file textureContext.I.

References Texture::get_simple_image_modified, and get_texture().

Referenced by DXGraphicsStateGuardian9::upload_texture().

◆ write()

void TextureContext::write ( std::ostream & out,
int indent_level ) const
virtual

Reimplemented from SavedContext.

Definition at line 50 of file textureContext.cxx.

Friends And Related Symbol Documentation

◆ PreparedGraphicsObjects

friend class PreparedGraphicsObjects
friend

Definition at line 85 of file textureContext.h.


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