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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(native): a KTX2 that is not whole blocks transcodes to RGBA32
esengine0313ebe38354
diff --git a/native/host/media/ktx2_decode.cpp b/native/host/media/ktx2_decode.cppindex 2444e48fe..f99deb132 100644--- a/native/host/media/ktx2_decode.cpp+++ b/native/host/media/ktx2_decode.cpp@@ -60,7 +60,12 @@ KTX2Result transcodeKTX2(const uint8_t* bytes, size_t n, bool srgb,basist::transcoder_texture_format basisFmt = basist::transcoder_texture_format::cTFRGBA32;GfxCompressedFormat gfxFmt = GfxCompressedFormat::ETC2_RGBA8;bool compressed = false;+ // Every choice below is a 4x4 block format, and WebGPU refuses a compressed+ // texture whose size is not whole blocks — a 70x70 sprite fails CreateTexture+ // and the game draws nothing. Device support is not the only question.+ const bool wholeBlocks = (w % 4 == 0) && (h % 4 == 0);for (const FormatChoice& c : kChoices) {+ if (!wholeBlocks) break;const GfxCompressedFormat want = srgb ? c.srgb : c.linear;if (device.supportsCompressedFormat(want)) {basisFmt = c.basisFmt;