Exemple #1
0
        /// <summary>
        /// Handles removal of textures written to a memory region being unmapped.
        /// </summary>
        /// <param name="sender">Sender object</param>
        /// <param name="e">Event arguments</param>
        public void MemoryUnmappedHandler(object sender, UnmapEventArgs e)
        {
            Texture[] overlaps = new Texture[10];
            int       overlapCount;

            MultiRange unmapped = ((MemoryManager)sender).GetPhysicalRegions(e.Address, e.Size);

            lock (_textures)
            {
                overlapCount = _textures.FindOverlaps(unmapped, ref overlaps);
            }

            for (int i = 0; i < overlapCount; i++)
            {
                overlaps[i].Unmapped(unmapped);
            }

            // If any range was previously unmapped, we also need to purge
            // all partially mapped texture, as they might be fully mapped now.
            for (int i = 0; i < unmapped.Count; i++)
            {
                if (unmapped.GetSubRange(i).Address == MemoryManager.PteUnmapped)
                {
                    lock (_partiallyMappedTextures)
                    {
                        foreach (var texture in _partiallyMappedTextures)
                        {
                            texture.Unmapped(unmapped);
                        }
                    }

                    break;
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Handles removal of textures written to a memory region being unmapped.
        /// </summary>
        /// <param name="sender">Sender object</param>
        /// <param name="e">Event arguments</param>
        public void MemoryUnmappedHandler(object sender, UnmapEventArgs e)
        {
            Texture[] overlaps = new Texture[10];
            int       overlapCount;

            MultiRange unmapped;

            try
            {
                unmapped = ((MemoryManager)sender).GetPhysicalRegions(e.Address, e.Size);
            }
            catch (InvalidMemoryRegionException)
            {
                // This event fires on Map in case any mappings are overwritten. In that case, there may not be an existing mapping.
                return;
            }

            lock (_textures)
            {
                overlapCount = _textures.FindOverlaps(unmapped, ref overlaps);
            }

            for (int i = 0; i < overlapCount; i++)
            {
                overlaps[i].Unmapped(unmapped);
            }
        }
Exemple #3
0
        /// <summary>
        /// Handles removal of textures written to a memory region being unmapped.
        /// </summary>
        /// <param name="sender">Sender object</param>
        /// <param name="e">Event arguments</param>
        public void MemoryUnmappedHandler(object sender, UnmapEventArgs e)
        {
            Texture[] overlaps = new Texture[10];
            int       overlapCount;

            lock (_textures)
            {
                overlapCount = _textures.FindOverlaps(((MemoryManager)sender).Translate(e.Address), e.Size, ref overlaps);
            }

            for (int i = 0; i < overlapCount; i++)
            {
                overlaps[i].Unmapped();
            }
        }