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);
110 INLINE
bool RenderState::
121 INLINE
bool RenderState::
122 has_attrib(
int slot)
const {
137 return _attributes[slot]._attrib;
148 get_attrib(
int slot)
const {
149 return _attributes[slot]._attrib;
160 get_attrib_def(
int slot)
const {
161 if (_attributes[slot]._attrib != (
RenderAttrib *)NULL) {
162 return _attributes[slot]._attrib;
164 return make_full_default()->get_attrib(slot);
174 INLINE
int RenderState::
178 return _attributes[slot]._override;
188 INLINE
int RenderState::
189 get_override(
int slot)
const {
190 return _attributes[slot]._override;
213 INLINE
void RenderState::
218 consider_update_pstats(old_referenced_bits);
229 INLINE
bool RenderState::
230 cache_unref()
const {
233 bool result = do_cache_unref();
234 consider_update_pstats(old_referenced_bits);
237 return do_cache_unref();
246 INLINE
void RenderState::
251 consider_update_pstats(old_referenced_bits);
262 INLINE
bool RenderState::
266 bool result = do_node_unref();
267 consider_update_pstats(old_referenced_bits);
270 return do_node_unref();
283 INLINE
int RenderState::
284 get_composition_cache_num_entries()
const {
298 INLINE
int RenderState::
299 get_invert_composition_cache_num_entries()
const {
316 INLINE
int RenderState::
317 get_composition_cache_size()
const {
319 return _composition_cache.
get_size();
334 get_composition_cache_source(
int n)
const {
339 return _composition_cache.
get_key(n);
357 get_composition_cache_result(
int n)
const {
362 return _composition_cache.
get_data(n)._result;
377 INLINE
int RenderState::
378 get_invert_composition_cache_size()
const {
380 return _invert_composition_cache.
get_size();
395 get_invert_composition_cache_source(
int n)
const {
400 return _invert_composition_cache.
get_key(n);
419 get_invert_composition_cache_result(
int n)
const {
424 return _invert_composition_cache.
get_data(n)._result;
434 INLINE
int RenderState::
435 get_draw_order()
const {
436 if ((_flags & F_checked_bin_index) == 0) {
453 INLINE
int RenderState::
454 get_bin_index()
const {
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>
636 INLINE
bool RenderState::
637 get_attrib(
const AttribType *&attrib)
const {
638 attrib = (
const AttribType *)get_attrib((
int)AttribType::get_class_slot());
639 return (attrib != (
const AttribType *)NULL);
648 template<
class AttribType>
649 INLINE
void RenderState::
650 get_attrib_def(
const AttribType *&attrib)
const {
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 is_empty() const
Returns true if the state is empty, false otherwise.
This is the base class for a number of render attributes (other than transform) that may be set on sc...
size_t get_hash() const
Returns a suitable hash value for phash_map.
void node_ref() const
Explicitly increments the reference count.
const Key & get_key(int n) const
Returns the key in the nth slot of the table.
virtual bool unref() const
Explicitly decrements the reference count.
int get_num_entries() const
Returns the number of active entries in the table.
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...
bool has_element(int n) const
Returns true if there is an element stored in the nth slot, false otherwise.
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.
Similar to MutexHolder, but for a light reentrant mutex.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
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 Value & get_data(int n) const
Returns the data in the nth slot of the table.
static void flush_level()
Flushes the PStatCollectors used during traversal.
TypeHandle is the identifier used to differentiate C++ class types.
int get_referenced_bits() const
Returns the union of the values defined in the Referenced enum that represents the various things tha...
static RenderAttribRegistry * quick_get_global_ptr()
Returns the global_ptr without first ensuring it has been initialized.
int get_size() const
Returns the total number of slots in the table.
bool is_zero() const
Returns true if the entire bitmask is zero, false otherwise.