feat(gx): add TextureCalcMipCount

This commit is contained in:
fallenoak 2025-10-20 16:50:40 -05:00
parent 9e46e15e0b
commit 77622566d7
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
2 changed files with 22 additions and 0 deletions

View File

@ -856,6 +856,26 @@ void TextureCacheNewTexture(CTexture* texture, const CImVector& color) {
// TODO
}
uint32_t TextureCalcMipCount(uint32_t width, uint32_t height) {
uint32_t count = 1;
while (width > 1 || height > 1) {
width /= 2;
if (width == 0) {
width = 1;
}
height /= 2;
if (height == 0) {
height = 1;
}
count++;
}
return count;
}
HTEXTURE TextureCreate(const char* fileName, CGxTexFlags texFlags, CStatus* status, int32_t createFlags) {
STORM_ASSERT(fileName);
STORM_ASSERT(*fileName);

View File

@ -55,6 +55,8 @@ void TextureCacheNewTexture(CTexture*, CGxTexFlags);
void TextureCacheNewTexture(CTexture*, const CImVector&);
uint32_t TextureCalcMipCount(uint32_t width, uint32_t height);
HTEXTURE TextureCreate(const char*, CGxTexFlags, CStatus*, int32_t);
HTEXTURE TextureCreate(uint32_t, uint32_t, EGxTexFormat, EGxTexFormat, CGxTexFlags, void*, void (*)(EGxTexCommand, uint32_t, uint32_t, uint32_t, uint32_t, void*, uint32_t&, const void*&), const char*, int32_t);