46 if ((_flags & F_checked_cull_callback) == 0) {
51 return (_flags & F_has_cull_callback) != 0;
65 _empty_state = return_unique(state);
83 state->fill_default();
84 _full_default_state = return_unique(state);
87 return _full_default_state;
101 return remove_attrib(slot);
137 return _attributes[slot]._attrib;
149 return _attributes[slot]._attrib;
161 if (_attributes[slot]._attrib != (
RenderAttrib *)NULL) {
162 return _attributes[slot]._attrib;
164 return make_full_default()->get_attrib(slot);
178 return _attributes[slot]._override;
190 return _attributes[slot]._override;
213 INLINE
void RenderState::
218 consider_update_pstats(old_referenced_bits);
233 bool result = do_cache_unref();
234 consider_update_pstats(old_referenced_bits);
237 return do_cache_unref();
251 consider_update_pstats(old_referenced_bits);
266 bool result = do_node_unref();
267 consider_update_pstats(old_referenced_bits);
270 return do_node_unref();
319 return _composition_cache.
get_size();
339 return _composition_cache.
get_key(n);
362 return _composition_cache.
get_data(n)._result;
380 return _invert_composition_cache.
get_size();
400 return _invert_composition_cache.
get_key(n);
424 return _invert_composition_cache.
get_data(n)._result;
436 if ((_flags & F_checked_bin_index) == 0) {
455 if ((_flags & F_checked_bin_index) == 0) {
472 INLINE
void RenderState::
475 _flags |= F_is_destructing;
488 INLINE
bool RenderState::
489 is_destructing()
const {
491 return (_flags & F_is_destructing) != 0;
503 INLINE
void RenderState::
504 consider_update_pstats(
int old_referenced_bits)
const {
507 if (old_referenced_bits != new_referenced_bits) {
508 update_pstats(old_referenced_bits, new_referenced_bits);
518 INLINE RenderState::Composition::
527 INLINE RenderState::Composition::
528 Composition(
const RenderState::Composition ©) :
529 _result(copy._result)
538 INLINE RenderState::Attribute::
550 INLINE RenderState::Attribute::
551 Attribute(
int override) :
561 INLINE RenderState::Attribute::
562 Attribute(
const Attribute ©) :
563 _attrib(copy._attrib),
564 _override(copy._override)
573 INLINE
void RenderState::Attribute::
574 operator = (
const Attribute ©) {
575 _attrib = copy._attrib;
576 _override = copy._override;
587 INLINE
int RenderState::Attribute::
588 compare_to(
const Attribute &other)
const {
589 if (_attrib != other._attrib) {
590 if (_attrib == NULL) {
592 }
else if (other._attrib == NULL) {
596 int c = _attrib->compare_to(*other._attrib);
602 return _override - other._override;
610 INLINE
void RenderState::Attribute::
613 _override =
override;
623 _node_counter.flush_level();
624 _cache_counter.flush_level();
635 template<
class AttribType>
638 attrib = (
const AttribType *)
get_attrib((
int)AttribType::get_class_slot());
639 return (attrib != (
const AttribType *)NULL);
648 template<
class AttribType>
651 attrib = (
const AttribType *)
get_attrib_def((
int)AttribType::get_class_slot());
660 INLINE
void RenderState::
664 if ((_flags & F_hash_known) == 0) {
676 INLINE
bool RenderState::
677 do_cache_unref()
const {
688 INLINE
bool RenderState::
689 do_node_unref()
const {
699 INLINE
void RenderState::
710 INLINE RenderState::CompositionCycleDescEntry::
bool node_unref() const
Overrides this method to update PStats appropriately.
const RenderAttrib * get_attrib_def(int slot) const
Returns the RenderAttrib with the indicated slot index, or the default attrib for that slot if there ...
int get_draw_order() const
Returns the draw order indicated by the CullBinAttrib, if any, associated by this state (or 0 if ther...
int get_composition_cache_size() const
Returns the number of slots in the composition cache for this RenderState.
This is the base class for a number of render attributes (other than transform) that may be set on sc...
int get_slot(TypeHandle type_handle) const
Returns the slot number assigned to the indicated TypeHandle, or 0 if no slot number has been assigne...
int get_num_entries() const
Returns the number of active entries in the table.
int get_referenced_bits() const
Returns the union of the values defined in the Referenced enum that represents the various things tha...
const RenderState * get_composition_cache_result(int n) const
Returns the result RenderState of the nth element in the composition cache.
int get_composition_cache_num_entries() const
Returns the number of entries in the composition cache for this RenderState.
bool has_attrib(TypeHandle type) const
Returns true if an attrib of the indicated type is present, false otherwise.
size_t get_hash() const
Returns a suitable hash value for phash_map.
const RenderState * get_invert_composition_cache_source(int n) const
Returns the source RenderState of the nth element in the invert composition cache.
const RenderState * get_invert_composition_cache_result(int n) const
Returns the result RenderState of the nth element in the invert composition cache.
int get_override(TypeHandle type) const
Looks for a RenderAttrib of the indicated type in the state, and returns its override value if it is ...
int get_size() const
Returns the total number of slots in the table.
This class is used to associate each RenderAttrib with a different slot index at runtime, so we can store a list of RenderAttribs in the RenderState object, and very quickly look them up by type.
Similar to MutexHolder, but for a light mutex.
void cache_ref() const
Explicitly increments the cache reference count and the normal reference count simultaneously.
virtual bool unref() const
This method overrides ReferenceCount::unref() to check whether the remaining reference count is entir...
bool is_empty() const
Returns true if the state is empty, false otherwise.
bool cache_unref() const
Overrides this method to update PStats appropriately.
void node_ref() const
Explicitly increments the reference count.
const RenderAttrib * get_attrib(TypeHandle type) const
Looks for a RenderAttrib of the indicated type in the state, and returns it if it is found...
Similar to MutexHolder, but for a light reentrant mutex.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
int get_bin_index() const
Returns the bin index indicated by the CullBinAttrib, if any, associated by this state (or the defaul...
bool has_cull_callback() const
Returns true if any of the RenderAttribs in this state request a cull_callback(), false if none of th...
const RenderState * get_composition_cache_source(int n) const
Returns the source RenderState of the nth element in the composition cache.
static void flush_level()
Flushes the PStatCollectors used during traversal.
int get_invert_composition_cache_num_entries() const
Returns the number of entries in the invert_composition cache for this RenderState.
int get_invert_composition_cache_size() const
Returns the number of slots in the composition cache for this RenderState.
const Value & get_data(int n) const
Returns the data in the nth slot of the table.
TypeHandle is the identifier used to differentiate C++ class types.
bool is_zero() const
Returns true if the entire bitmask is zero, false otherwise.
static RenderAttribRegistry * quick_get_global_ptr()
Returns the global_ptr without first ensuring it has been initialized.
const Key & get_key(int n) const
Returns the key in the nth slot of the table.
void node_ref() const
Overrides this method to update PStats appropriately.
bool has_element(int n) const
Returns true if there is an element stored in the nth slot, false otherwise.