/** * <p> * Clears all currently associated texture ids for this texture. * </p> * <p> * Note: This does not remove the texture from the card and is provided for use by code that does remove textures * from the card. * </p> */ public void removeFromIdCache() { _idCache.clear(); }
@SuppressWarnings("unchecked") private static Multimap<Object, Integer> gatherGCdIds() { Multimap<Object, Integer> idMap = null; // Pull all expired textures from ref queue and add to an id multimap. ContextIdReference<TextureKey> ref; Integer id; while ((ref = (ContextIdReference<TextureKey>) _textureRefQueue.poll()) != null) { // lazy init if (idMap == null) { idMap = ArrayListMultimap.create(); } if (Constants.useMultipleContexts) { final Set<Object> contextObjects = ref.getContextObjects(); for (final Object o : contextObjects) { id = ref.getValue(o); if (id != null && id.intValue() != 0) { // Add id to map idMap.put(o, id); } } } else { id = ref.getValue(null); if (id != null && id.intValue() != 0) { idMap.put(ContextManager.getCurrentContext().getGlContextRep(), id); } } ref.clear(); } return idMap; }
@SuppressWarnings("unchecked") private static final Multimap<Object, Integer> gatherGCdIds(Multimap<Object, Integer> store) { // Pull all expired vbos from ref queue and add to an id multimap. ContextIdReference<AbstractBufferData<?>> ref; while ((ref = (ContextIdReference<AbstractBufferData<?>>) _vboRefQueue.poll()) != null) { if (Constants.useMultipleContexts) { final Set<Object> contextObjects = ref.getContextObjects(); for (final Object o : contextObjects) { // Add id to map final Integer id = ref.getValue(o); if (id != null) { if (store == null) { // lazy init store = ArrayListMultimap.create(); } store.put(o, id); } } } else { final Integer id = ref.getValue(null); if (id != null) { if (store == null) { // lazy init store = ArrayListMultimap.create(); } store.put(ContextManager.getCurrentContext().getGlContextRep(), id); } } ref.clear(); } return store; }
public static void cleanAllVBOs(final Renderer deleter) { final Multimap<Object, Integer> idMap = ArrayListMultimap.create(); // gather up expired vbos... these don't exist in our cache gatherGCdIds(idMap); // Walk through the cached items and delete those too. for (final AbstractBufferData<?> buf : _identityCache.keySet()) { if (buf._vboIdCache != null) { if (Constants.useMultipleContexts) { final Set<Object> contextObjects = buf._vboIdCache.getContextObjects(); for (final Object o : contextObjects) { // Add id to map idMap.put(o, buf.getVBOID(o)); } } else { idMap.put(ContextManager.getCurrentContext().getGlContextRep(), buf.getVBOID(null)); } buf._vboIdCache.clear(); } } handleVBODelete(deleter, idMap); }