Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

chore(gates): the 16-bit rule stands apart from the note on the size cap, three lines each

yhh27916a3d920a
diff --git a/pipeline/src/assets/textureCook.ts b/pipeline/src/assets/textureCook.ts
index e339ba5c3..df95a9b0c 100644
--- a/pipeline/src/assets/textureCook.ts
+++ b/pipeline/src/assets/textureCook.ts
@@ -212,9 +212,6 @@ export async function cookTexture(input: TextureCookInput): Promise<TextureCookO
const tex = readTextureCookSettings(input.importer, platform);
const raster = ext.toLowerCase() === '.png';
const textureEnc = input.encoder?.module ?? null;
- // maxSize downscale first — it applies even when a texture opts OUT of
- // compression (a huge UI sprite can ship as a smaller raw PNG), and the
- // ENCODED size is what block alignment is judged on.
// A PNG of 16 bits a channel is numbers, not a picture: a heightmap, a field of measured values. Shrinking, filling and encoding all
// decode to 8 bits first, so a build would ship 256 steps where the file holds 65536, a size smaller, and say nothing. It ships as it is.
if (raster && pngBitDepth(data) === 16) {
@@ -224,6 +221,9 @@ export async function cookTexture(input: TextureCookInput): Promise<TextureCookO
});
return { data, ext, cook, warnings, defeatedByFormat: false };
}
+ // maxSize downscale first — it applies even when a texture opts OUT of
+ // compression (a huge UI sprite can ship as a smaller raw PNG), and the
+ // ENCODED size is what block alignment is judged on.
const sourceSize = raster ? safePngDimensions(data) : null;
const scaled = !!((textureEnc || input.resizeTextures) && sourceSize && tex.maxSize > 0 &&
tex.maxSize < Math.max(sourceSize.width, sourceSize.height));