Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
 public void Cached()
 {
     if (state != CacheableState.Evicted)
     {
         throw new Exception();
     }
     state = CacheableState.Normal;
 }
Esempio n. 3
0
 public void Evict()
 {
     if (state == CacheableState.Normal)
     {
         state      = CacheableState.Evicted;
         touchEvent = null;
     }
 }
Esempio n. 4
0
 public void Cached()
 {
     if (state == CacheableState.Normal)
     {
         throw new Exception("The shape already cached.");
     }
     state = CacheableState.Normal;
 }
Esempio n. 5
0
 public virtual void Evict()
 {
     lock (syncRoot)
     {
         AssertNotDisposed();
         cacheableState = CacheableState.Evicted;
     }
 }
Esempio n. 6
0
 public virtual void Cached()
 {
     lock (syncRoot)
     {
         AssertNotDisposed();
         cacheableState = CacheableState.Normal;
     }
 }
Esempio n. 7
0
 void SharpMedia.Caching.ICacheable.Cached()
 {
     lock (syncRoot)
     {
         if (state == CacheableState.Disposed)
         {
             throw new ObjectDisposedException("Cannot re-claim a vertex shader.");
         }
         state = CacheableState.Normal;
     }
 }
Esempio n. 8
0
 void SharpMedia.Caching.ICacheable.Evict()
 {
     // We treat evict as dispose.
     lock (syncRoot)
     {
         if (usedByDevice == 0)
         {
             Dispose();
         }
         else
         {
             state = CacheableState.Evicted;
         }
     }
 }
Esempio n. 9
0
        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.");
            }
        }
Esempio n. 10
0
        public virtual void Dispose()
        {
            lock (syncRoot)
            {
                if (cacheableState == CacheableState.Disposed)
                {
                    return;
                }
                cacheableState = CacheableState.Disposed;
            }

            Action <IResource> r = onDisposed;

            if (r != null)
            {
                r(this);
            }
        }
Esempio n. 11
0
 public void Dispose()
 {
     state = CacheableState.Disposed;
 }
Esempio n. 12
0
 public void Evict()
 {
     onTouch = null;
     state   = CacheableState.Evicted;
 }
Esempio n. 13
0
 public void Evict()
 {
     cacheableState = CacheableState.Evicted;
 }
Esempio n. 14
0
 public void Cached()
 {
     cacheableState = CacheableState.Normal;
 }