render parity unit K: 40250 DDS mip levels
DXT DDS textures upload the file's own mip levels like 40250 CGraphicImageTexture::CreateDDSTexture (max(1, dwMipMapCount), level i read at sum(dwLinearSize>>2k), Copy of dwLinearSize>>2i bytes) instead of a regenerated chain. Non-DDS images keep the D3DX_DEFAULT full chain and mem: textures get one level. The invented is_ui_tex no-mip rule (icon/, ui/, locale/, <=128px) is deleted. dxt_decode_test is registered in ctest with mip-level cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
dda885a17a
commit
d2356d59c3
+5
-1
@@ -12,11 +12,15 @@ namespace mtgodot {
|
||||
struct Image {
|
||||
uint16_t w = 0, h = 0;
|
||||
std::vector<uint8_t> rgba; // w*h*4,level 0
|
||||
// DXT DDS only: level count 40250 CreateDDSTexture gives the texture (0 = not a DXT
|
||||
// DDS, caller follows the D3DX_DEFAULT full-chain path) and levels 1.. decoded to RGBA8.
|
||||
uint8_t file_mip_levels = 0;
|
||||
std::vector<std::vector<uint8_t>> mips;
|
||||
const char* format = ""; // "DXT1" / "DXT3" / "DXT5" / "BGRA8" / ""
|
||||
bool ok() const { return w && h && rgba.size() == size_t(w) * h * 4; }
|
||||
};
|
||||
|
||||
// 读整个 .dds 文件字节,解 level 0 到 RGBA8。失败返回 !ok()。
|
||||
// 读整个 .dds 文件字节,解 level 0 到 RGBA8(DXT 另解文件内 mip 到 mips)。失败返回 !ok()。
|
||||
Image load_dds(const uint8_t* bytes, size_t len);
|
||||
Image load_dds_path(const char* path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user