private void UpdateAtlasTexture() { if (atlas == null) { if (m_UVs.Count > m_Blitter.queueLength) { // This can happen when the graphic device reloads. m_ForceReblitAll = true; } atlas = CreateAtlasTexture(); return; } if (atlas.width != m_Allocator.physicalWidth || atlas.height != m_Allocator.physicalHeight) { RenderTexture newAtlas = CreateAtlasTexture(); if (newAtlas == null) { Debug.LogErrorFormat("Failed to allocate a render texture for the dynamic atlas. Current Size = {0}x{1}. Requested Size = {2}x{3}.", atlas.width, atlas.height, m_Allocator.physicalWidth, m_Allocator.physicalHeight); } else { m_Blitter.BlitOneNow(newAtlas, atlas, new RectInt(0, 0, atlas.width, atlas.height), new Vector2Int(0, 0), false, Color.white); } UIRUtility.Destroy(atlas); atlas = newAtlas; } }
protected virtual void Dispose(bool disposing) { if (disposed) { return; } if (disposing) { UIRUtility.Destroy(atlas); atlas = null; if (m_Allocator != null) { m_Allocator.Dispose(); m_Allocator = null; } if (m_Blitter != null) { m_Blitter.Dispose(); m_Blitter = null; } } else { UnityEngine.UIElements.DisposeHelper.NotifyMissingDispose(this); } disposed = true; }
/// <remarks> /// When textures that have been previously allowed into the atlas manager change, or if the project color /// space changes, this method MUST be called. Textures that had been previously accepted into the atlas may /// now be refused, and previously refused textures may now be accepted. /// </remarks> public void Reset() { if (disposed) { LogDisposeError(); return; } s_ResetSampler.Begin(); m_PendingBlits.Clear(); m_UVs.Clear(); m_Allocator = new UIRAtlasAllocator(64, 4096); m_ForceReblitAll = false; m_ColorSpace = QualitySettings.activeColorSpace; UIRUtility.Destroy(atlas); m_RequiresReset = false; if (ResetPerformed != null) { ResetPerformed(this, EventArgs.Empty); } s_ResetSampler.End(); }
protected virtual void Dispose(bool disposing) { UIRAtlasManager.s_Instances.Remove(this); bool disposed = this.disposed; if (!disposed) { if (disposing) { UIRUtility.Destroy(this.atlas); this.atlas = null; bool flag = this.m_Allocator != null; if (flag) { this.m_Allocator.Dispose(); this.m_Allocator = null; } bool flag2 = this.m_Blitter != null; if (flag2) { this.m_Blitter.Dispose(); this.m_Blitter = null; } bool flag3 = UIRAtlasManager.atlasManagerDisposed != null; if (flag3) { UIRAtlasManager.atlasManagerDisposed(this); } } this.disposed = true; } }
protected virtual void Dispose(bool disposing) { s_Instances.Remove(this); if (disposed) { return; } if (disposing) { UIRUtility.Destroy(atlas); atlas = null; UIRUtility.Destroy(m_BlitMaterial); m_BlitMaterial = null; if (m_Allocator != null) { m_Allocator.Dispose(); m_Allocator = null; } if (atlasManagerDisposed != null) { atlasManagerDisposed(this); } } else { UnityEngine.UIElements.DisposeHelper.NotifyMissingDispose(this); } disposed = true; }
void UpdateAtlasTexture() { if (atlas == null) { atlas = CreateAtlasTexture(); return; } if (atlas.width != m_CurrentSize.x || atlas.height != m_CurrentSize.y) { RenderTexture newAtlas = CreateAtlasTexture(); if (newAtlas == null) { Debug.LogErrorFormat("Failed to allocate a render texture for the dynamic atlas. Current Size = {0}x{1}. Requested Size = {2}x{3}.", atlas.width, atlas.height, m_CurrentSize.x, m_CurrentSize.y); } else { m_Blitter.BlitOneNow(newAtlas, atlas, new RectInt(0, 0, atlas.width, atlas.height), new Vector2Int(0, 0), false, Color.white); } UIRUtility.Destroy(atlas); atlas = newAtlas; } }
/// <remarks> /// When textures that have been previously allowed into the atlas manager change, or if the project color /// space changes, this method MUST be called. Textures that had been previously accepted into the atlas may /// now be refused, and previously refused textures may now be accepted. /// </remarks> public void Reset() { if (disposed) { LogDisposeError(); return; } s_MarkerReset.Begin(); m_Blitter.Reset(); m_UVs.Clear(); m_Allocator = new UIRAtlasAllocator(m_InitialSize, 4096, m_1SidePadding); m_ForceReblitAll = false; m_ColorSpace = QualitySettings.activeColorSpace; UIRUtility.Destroy(atlas); s_MarkerReset.End(); m_ResetVersion = s_GlobalResetVersion; }
/// <remarks> /// When textures that have been previously allowed into the atlas manager change, or if the project color /// space changes, this method MUST be called. Textures that had been previously accepted into the atlas may /// now be refused, and previously refused textures may now be accepted. /// </remarks> public void Reset() { if (disposed) { LogDisposeError(); return; } s_ResetSampler.Begin(); m_Blitter.Reset(); m_UVs.Clear(); m_Allocator = new UIRAtlasAllocator(64, 4096); m_ForceReblitAll = false; m_ColorSpace = QualitySettings.activeColorSpace; UIRUtility.Destroy(atlas); s_ResetSampler.End(); m_ResetVersion = s_GlobalResetVersion; }
protected virtual void Dispose(bool disposing) { if (disposed) { return; } if (disposing) { if (atlas != null) { UIRUtility.Destroy(atlas); atlas = null; } if (m_Allocator != null) { // m_Allocator.Dispose(); TODO once we pool content m_Allocator = null; } if (m_Blitter != null) { m_Blitter.Dispose(); m_Blitter = null; } if (textureId != TextureId.invalid) { TextureRegistry.instance.Release(textureId); textureId = TextureId.invalid; } } else { UnityEngine.UIElements.DisposeHelper.NotifyMissingDispose(this); } disposed = true; }
private void UpdateAtlasTexture() { if (atlas == null) { if (m_UVs.Count > m_Blitter.queueLength) { // This can happen when the graphic device reloads. m_ForceReblitAll = true; } atlas = CreateAtlasTexture(); return; } if (atlas.width != m_Allocator.physicalWidth || atlas.height != m_Allocator.physicalHeight) { RenderTexture newAtlas = CreateAtlasTexture(); m_Blitter.BlitOneNow(newAtlas, atlas, new RectInt(0, 0, atlas.width, atlas.height), new Vector2Int(0, 0), false, Color.white); UIRUtility.Destroy(atlas); atlas = newAtlas; } }
private void UpdateAtlasTexture() { if (atlas == null) { if (m_UVs.Count > m_PendingBlits.Count) { // This can happen when the graphic device reloads. m_ForceReblitAll = true; } atlas = CreateAtlasTexture(); return; } if (atlas.width != m_Allocator.physicalWidth || atlas.height != m_Allocator.physicalHeight) { RenderTexture newAtlas = CreateAtlasTexture(); BlitSingle(atlas, newAtlas, 0, 0, false); UIRUtility.Destroy(atlas); atlas = newAtlas; } }
private void UpdateAtlasTexture() { bool flag = this.atlas == null; if (flag) { bool flag2 = this.m_UVs.Count > this.m_Blitter.queueLength; if (flag2) { this.m_ForceReblitAll = true; } this.atlas = this.CreateAtlasTexture(); } else { bool flag3 = this.atlas.width != this.m_Allocator.physicalWidth || this.atlas.height != this.m_Allocator.physicalHeight; if (flag3) { RenderTexture renderTexture = this.CreateAtlasTexture(); bool flag4 = renderTexture == null; if (flag4) { UnityEngine.Debug.LogErrorFormat("Failed to allocate a render texture for the dynamic atlas. Current Size = {0}x{1}. Requested Size = {2}x{3}.", new object[] { this.atlas.width, this.atlas.height, this.m_Allocator.physicalWidth, this.m_Allocator.physicalHeight }); } else { this.m_Blitter.BlitOneNow(renderTexture, this.atlas, new RectInt(0, 0, this.atlas.width, this.atlas.height), new Vector2Int(0, 0), false, Color.white); } UIRUtility.Destroy(this.atlas); this.atlas = renderTexture; } } }
public void Reset() { bool disposed = this.disposed; if (disposed) { UIRAtlasManager.LogDisposeError(); } else { UIRAtlasManager.s_MarkerReset.Begin(); this.m_Blitter.Reset(); this.m_UVs.Clear(); this.m_Allocator = new UIRAtlasAllocator(this.m_InitialSize, 4096, this.m_1SidePadding); this.m_ForceReblitAll = false; this.m_ColorSpace = QualitySettings.activeColorSpace; UIRUtility.Destroy(this.atlas); this.atlas = null; UIRAtlasManager.s_MarkerReset.End(); this.m_ResetVersion = UIRAtlasManager.s_GlobalResetVersion; } }