mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
pgraph: fix RenderState/TransformState count in PStats exploding
This was a regression in 1.10.6 that caused PStats to misreport the amount of RenderState/TransformStates in the application.
This commit is contained in:
parent
80ab6a28c4
commit
c59a039fa8
@ -481,6 +481,34 @@ flush_level() {
|
|||||||
_cache_counter.flush_level();
|
_cache_counter.flush_level();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overrides this method to update PStats appropriately.
|
||||||
|
*/
|
||||||
|
INLINE void RenderState::
|
||||||
|
cache_ref_only() const {
|
||||||
|
#ifdef DO_PSTATS
|
||||||
|
int old_referenced_bits = get_referenced_bits();
|
||||||
|
NodeCachedReferenceCount::cache_ref_only();
|
||||||
|
consider_update_pstats(old_referenced_bits);
|
||||||
|
#else // DO_PSTATS
|
||||||
|
NodeCachedReferenceCount::cache_ref_only();
|
||||||
|
#endif // DO_PSTATS
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overrides this method to update PStats appropriately.
|
||||||
|
*/
|
||||||
|
INLINE void RenderState::
|
||||||
|
cache_unref_only() const {
|
||||||
|
#ifdef DO_PSTATS
|
||||||
|
int old_referenced_bits = get_referenced_bits();
|
||||||
|
NodeCachedReferenceCount::cache_unref_only();
|
||||||
|
consider_update_pstats(old_referenced_bits);
|
||||||
|
#else // DO_PSTATS
|
||||||
|
NodeCachedReferenceCount::cache_unref_only();
|
||||||
|
#endif // DO_PSTATS
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef CPPPARSER
|
#ifndef CPPPARSER
|
||||||
/**
|
/**
|
||||||
* Handy templated version of get_attrib that casts to the right type.
|
* Handy templated version of get_attrib that casts to the right type.
|
||||||
@ -533,7 +561,7 @@ check_hash() const {
|
|||||||
*/
|
*/
|
||||||
INLINE bool RenderState::
|
INLINE bool RenderState::
|
||||||
do_cache_unref() const {
|
do_cache_unref() const {
|
||||||
cache_unref_only();
|
NodeCachedReferenceCount::cache_unref_only();
|
||||||
return unref();
|
return unref();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,6 +169,11 @@ public:
|
|||||||
INLINE void get_attrib_def(CPT(AttribType) &attrib) const;
|
INLINE void get_attrib_def(CPT(AttribType) &attrib) const;
|
||||||
#endif // CPPPARSER
|
#endif // CPPPARSER
|
||||||
|
|
||||||
|
INLINE void cache_ref_only() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
INLINE void cache_unref_only() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
INLINE void check_hash() const;
|
INLINE void check_hash() const;
|
||||||
bool validate_filled_slots() const;
|
bool validate_filled_slots() const;
|
||||||
|
@ -753,6 +753,34 @@ flush_level() {
|
|||||||
_cache_counter.flush_level();
|
_cache_counter.flush_level();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overrides this method to update PStats appropriately.
|
||||||
|
*/
|
||||||
|
INLINE void TransformState::
|
||||||
|
cache_ref_only() const {
|
||||||
|
#ifdef DO_PSTATS
|
||||||
|
int old_referenced_bits = get_referenced_bits();
|
||||||
|
NodeCachedReferenceCount::cache_ref_only();
|
||||||
|
consider_update_pstats(old_referenced_bits);
|
||||||
|
#else // DO_PSTATS
|
||||||
|
NodeCachedReferenceCount::cache_ref_only();
|
||||||
|
#endif // DO_PSTATS
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overrides this method to update PStats appropriately.
|
||||||
|
*/
|
||||||
|
INLINE void TransformState::
|
||||||
|
cache_unref_only() const {
|
||||||
|
#ifdef DO_PSTATS
|
||||||
|
int old_referenced_bits = get_referenced_bits();
|
||||||
|
NodeCachedReferenceCount::cache_unref_only();
|
||||||
|
consider_update_pstats(old_referenced_bits);
|
||||||
|
#else // DO_PSTATS
|
||||||
|
NodeCachedReferenceCount::cache_unref_only();
|
||||||
|
#endif // DO_PSTATS
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reimplements NodeReferenceCount::node_unref(). We do this because we have
|
* Reimplements NodeReferenceCount::node_unref(). We do this because we have
|
||||||
* a non-virtual unref() method.
|
* a non-virtual unref() method.
|
||||||
@ -769,7 +797,7 @@ do_node_unref() const {
|
|||||||
*/
|
*/
|
||||||
INLINE bool TransformState::
|
INLINE bool TransformState::
|
||||||
do_cache_unref() const {
|
do_cache_unref() const {
|
||||||
cache_unref_only();
|
NodeCachedReferenceCount::cache_unref_only();
|
||||||
return unref();
|
return unref();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,6 +213,11 @@ public:
|
|||||||
|
|
||||||
INLINE static void flush_level();
|
INLINE static void flush_level();
|
||||||
|
|
||||||
|
INLINE void cache_ref_only() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
INLINE void cache_unref_only() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
INLINE bool do_cache_unref() const;
|
INLINE bool do_cache_unref() const;
|
||||||
INLINE bool do_node_unref() const;
|
INLINE bool do_node_unref() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user