Example #1
0
        /// <summary>
        /// Implementation of the texture pool range invalidation.
        /// </summary>
        /// <param name="address">Start address of the range of the texture pool</param>
        /// <param name="size">Size of the range being invalidated</param>
        protected override void InvalidateRangeImpl(ulong address, ulong size)
        {
            ProcessDereferenceQueue();

            ulong endAddress = address + size;

            for (; address < endAddress; address += DescriptorSize)
            {
                int id = (int)((address - Address) / DescriptorSize);

                Texture texture = Items[id];

                if (texture != null)
                {
                    TextureDescriptor descriptor = PhysicalMemory.Read <TextureDescriptor>(address);

                    // If the descriptors are the same, the texture is the same,
                    // we don't need to remove as it was not modified. Just continue.
                    if (descriptor.Equals(ref DescriptorCache[id]))
                    {
                        continue;
                    }

                    texture.DecrementReferenceCount(this, id);

                    Items[id] = null;
                }
            }
        }
Example #2
0
 /// <summary>
 /// Gets the descriptor for a given ID.
 /// </summary>
 /// <param name="id">ID of the descriptor. This is effectively a zero-based index</param>
 /// <returns>The descriptor</returns>
 public T2 GetDescriptor(int id)
 {
     return(PhysicalMemory.Read <T2>(Address + (ulong)id * DescriptorSize));
 }