feat(gx): add TextureCalcMipCount

This commit is contained in:
fallenoak committed 2025-10-20 16:50:40 -05:00
1 parent 9e46e15e0b
commit 77622566d7
2 files changed
+22

No files matched your search

+20
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);
+2
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);