Skip to content

Commit

Permalink
Merge pull request #1215 from anatawa12/crunch-optimize-texture
Browse files Browse the repository at this point in the history
fix: Optimize Texture broken with crunch compression
  • Loading branch information
anatawa12 authored Sep 29, 2024
2 parents 6ea0de5 + fc5f66a commit 75700e9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-PRERELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ The format is based on [Keep a Changelog].

### Fixed
- Typo in menu for creating Asset Description `#1213`
- Optimize Texture broken with Crunch Compression `#1215`

### Security

Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The format is based on [Keep a Changelog].
- We may relax some restriction in the future.
- Because we have to check for each condition if we use AnyState but we can check for only one (in best case) with entry/exit, this generally reduces cost for checking an parameter in a state.
- Combined with Entry / Exit to 1D BlendTree optimization, which is implemented in previous release, your AnyState layer may be optimized to 1D BlendTree.
- Optimize Texture in Trace nad Optimize `#1181` `#1184` `#1193`
- Optimize Texture in Trace nad Optimize `#1181` `#1184` `#1193` `#1215`
- Avatar Optimizer will pack texture and tries to reduce the VRAM usage.
- Currently liltoon is only supported.
- `Copy Enablement Animation` to Merge Skinned Mesh `#1173`
Expand Down
4 changes: 2 additions & 2 deletions Editor/Processors/TraceAndOptimize/OptimizeTexture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -735,9 +735,9 @@ private AtlasResult BuildAtlasResult(AtlasIsland[] atlasIslands, Vector2 atlasSi
Texture2D newTexture;

var mipmapCount = Mathf.Min(Utils.MostSignificantBit(Mathf.Min(newWidth, newHeight)), texture2D.mipmapCount);
if (useBlockCopying && GraphicsFormatUtility.IsCompressedFormat(texture2D.format) && mipmapCount == 1)
// Crunch compressed texture will return empty array for `GetRawTextureData`
if (useBlockCopying && GraphicsFormatUtility.IsCompressedFormat(texture2D.format) && !GraphicsFormatUtility.IsCrunchFormat(texture2D.format) && mipmapCount == 1)
{

var destMipmapSize = GraphicsFormatUtility.ComputeMipmapSize(newWidth, newHeight, texture2D.format);
var sourceMipmapSize = GraphicsFormatUtility.ComputeMipmapSize(texture2D.width, texture2D.height, texture2D.format);

Expand Down

0 comments on commit 75700e9

Please sign in to comment.