private void Dispose(bool finalizer) { if (cacheableState == CacheableState.Disposed) { return; } cacheableState = CacheableState.Disposed; device = null; if (driverPart != null) { driverPart.Dispose(); driverPart = null; } // To free asocaited data (if buffer still referenced). swData = null; if (!finalizer) { GC.SuppressFinalize(this); } Action <IResource> t = onDisposed; if (t != null) { t(this); } }
public void Cached() { if (state != CacheableState.Evicted) { throw new Exception(); } state = CacheableState.Normal; }
public void Evict() { if (state == CacheableState.Normal) { state = CacheableState.Evicted; touchEvent = null; } }
public void Cached() { if (state == CacheableState.Normal) { throw new Exception("The shape already cached."); } state = CacheableState.Normal; }
public virtual void Evict() { lock (syncRoot) { AssertNotDisposed(); cacheableState = CacheableState.Evicted; } }
public virtual void Cached() { lock (syncRoot) { AssertNotDisposed(); cacheableState = CacheableState.Normal; } }
void SharpMedia.Caching.ICacheable.Cached() { lock (syncRoot) { if (state == CacheableState.Disposed) { throw new ObjectDisposedException("Cannot re-claim a vertex shader."); } state = CacheableState.Normal; } }
void SharpMedia.Caching.ICacheable.Evict() { // We treat evict as dispose. lock (syncRoot) { if (usedByDevice == 0) { Dispose(); } else { state = CacheableState.Evicted; } } }
void Dispose(bool fin) { state = CacheableState.Disposed; if (driverPart != null) { driverPart.Dispose(); driverPart = null; } if (!fin) { GC.SuppressFinalize(this); } else { Common.NotDisposed(this, "If shader is created manually, you must dispose it, otherwise dispose the ShaderCode."); } }
public virtual void Dispose() { lock (syncRoot) { if (cacheableState == CacheableState.Disposed) { return; } cacheableState = CacheableState.Disposed; } Action <IResource> r = onDisposed; if (r != null) { r(this); } }
public void Dispose() { state = CacheableState.Disposed; }
public void Evict() { onTouch = null; state = CacheableState.Evicted; }
public void Evict() { cacheableState = CacheableState.Evicted; }
public void Cached() { cacheableState = CacheableState.Normal; }