|
|
@@ -746,6 +746,14 @@ get_num_unused_states() {
|
|
|
for (size_t si = 0; si < size; ++si) {
|
|
|
const RenderState *state = _states.get_key(si);
|
|
|
|
|
|
+ std::pair<StateCount::iterator, bool> ir =
|
|
|
+ state_count.insert(StateCount::value_type(state, 1));
|
|
|
+ if (!ir.second) {
|
|
|
+ // If the above insert operation fails, then it's already in the
|
|
|
+ // cache; increment its value.
|
|
|
+ (*(ir.first)).second++;
|
|
|
+ }
|
|
|
+
|
|
|
size_t i;
|
|
|
size_t cache_size = state->_composition_cache.get_num_entries();
|
|
|
for (i = 0; i < cache_size; ++i) {
|
|
|
@@ -1843,6 +1851,7 @@ init_states() {
|
|
|
// is declared globally, and lives forever.
|
|
|
RenderState *state = new RenderState;
|
|
|
state->local_object();
|
|
|
+ state->cache_ref_only();
|
|
|
state->_saved_entry = _states.store(state, nullptr);
|
|
|
_empty_state = state;
|
|
|
}
|