Exemple #1
0
        void Destructor()
        {
            if (m_StaticIndex >= 0)
            {
                RenderChainStaticIndexAllocator.FreeIndex(m_StaticIndex);
            }
            m_StaticIndex = -1;

            UIRUtility.Destroy(m_DefaultMat);
            UIRUtility.Destroy(m_DefaultWorldSpaceMat);
            m_DefaultMat = m_DefaultWorldSpaceMat = null;

            Font.textureRebuilt -= OnFontReset;
            painter?.Dispose();
            m_TextUpdatePainter?.Dispose();
            atlasManager?.Dispose();
            vectorImageManager?.Dispose();
            shaderInfoAllocator.Dispose();
            device?.Dispose();

            painter             = null;
            m_TextUpdatePainter = null;
            atlasManager        = null;
            shaderInfoAllocator = new UIRVEShaderInfoAllocator();
            device = null;

            m_ActiveRenderNodes = 0;
            m_RenderNodesData.Clear();
        }
        public void Reset()
        {
            if (disposed)
            {
                DisposeHelper.NotifyDisposedUsed(this);
                return;
            }

            m_Allocator = new BestFitAllocator((uint)m_Length);
            UIRUtility.Destroy(m_Atlas);
            m_RawAtlas = new RawTexture();
            MustCommit = false;
        }
        protected virtual void Dispose(bool disposing)
        {
            bool disposed = this.disposed;

            if (!disposed)
            {
                if (disposing)
                {
                    UIRUtility.Destroy(this.m_Atlas);
                }
                this.disposed = true;
            }
        }
 protected virtual void Dispose(bool disposing)
 {
     bool disposed = this.disposed;
     if (!disposed)
     {
         if (disposing)
         {
             UIRUtility.Destroy(this.m_BlitMaterial);
             this.m_BlitMaterial = null;
         }
         this.disposed = true;
     }
 }
Exemple #5
0
        protected override void Dispose(bool disposing)
        {
            if (!disposed && disposing)
            {
                UIRUtility.Destroy(m_Texture);
                m_Texture = null;
                m_Texels  = new NativeArray <T>();
                m_Allocator?.Dispose();
                m_Allocator = null;
            }

            base.Dispose(disposing);
        }
        public void Reset()
        {
            bool disposed = this.disposed;

            if (disposed)
            {
                DisposeHelper.NotifyDisposedUsed(this);
            }
            else
            {
                this.m_Allocator = new BestFitAllocator((uint)this.m_Length);
                UIRUtility.Destroy(this.m_Atlas);
                this.m_RawAtlas = default(GradientSettingsAtlas.RawTexture);
                this.MustCommit = false;
            }
        }
Exemple #7
0
        void Destructor()
        {
            if (m_StaticIndex >= 0)
            {
                RenderChainStaticIndexAllocator.FreeIndex(m_StaticIndex);
            }
            m_StaticIndex = -1;

            var ve = GetFirstElementInPanel(m_FirstCommand?.owner);

            while (ve != null)
            {
                ResetTextures(ve);
                ve = ve.renderChainData.next;
            }

            UIRUtility.Destroy(m_DefaultMat);
            UIRUtility.Destroy(m_DefaultWorldSpaceMat);
            m_DefaultMat = m_DefaultWorldSpaceMat = null;

            vertsPool.Dispose();
            indicesPool.Dispose();
            jobManager.Dispose();
            vectorImageManager?.Dispose();
            shaderInfoAllocator.Dispose();
            device?.Dispose();
            opacityIdAccelerator?.Dispose();

            if (painter != null)
            {
                // todo: move painter2d to the render chain instead of the mgc
                if (painter.meshGenerationContext.hasPainter2D)
                {
                    painter.meshGenerationContext.painter2D.Destroy();
                }
                painter = null;
            }

            atlas = null;
            shaderInfoAllocator = new UIRVEShaderInfoAllocator();
            device = null;

            m_ActiveRenderNodes = 0;
            m_RenderNodesData.Clear();
        }
Exemple #8
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposed)
            {
                return;
            }

            if (disposing)
            {
                UIRUtility.Destroy(m_Atlas);
            }
            else
            {
                UnityEngine.UIElements.DisposeHelper.NotifyMissingDispose(this);
            }

            disposed = true;
        }
Exemple #9
0
        void CreateOrExpandTexture()
        {
            int newWidth  = m_Allocator.physicalWidth;
            int newHeight = m_Allocator.physicalHeight;

            bool copy = false;

            if (m_Texture != null)
            {
                if (m_Texture.width == newWidth && m_Texture.height == newHeight)
                {
                    return;
                }
                copy = true;
            }

            var newTexture = new Texture2D(m_Allocator.physicalWidth, m_Allocator.physicalHeight, m_Format, false)
            {
                name      = "UIR Shader Info " + s_TextureCounter++,
                hideFlags = HideFlags.HideAndDontSave,
            };

            if (copy)
            {
                s_MarkerCopyTexture.Begin();
                var oldTexels = m_Texels.IsCreated ? m_Texels : m_Texture.GetRawTextureData <T>();
                var newTexels = newTexture.GetRawTextureData <T>();
                CpuBlit(oldTexels, m_Texture.width, m_Texture.height, newTexels, newTexture.width, newTexture.height);
                m_Texels = newTexels;
                s_MarkerCopyTexture.End();
            }
            else
            {
                m_Texels = new NativeArray <T>();
            }

            UIRUtility.Destroy(m_Texture);
            m_Texture = newTexture;
        }