mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-22 12:05:11 +00:00
Fix the texture dimensions check in DynOS (#67)
This commit is contained in:
parent
ed8b316270
commit
eb45999791
1 changed files with 3 additions and 4 deletions
|
@ -451,8 +451,8 @@ void DynOS_Tex_AddCustom(const SysPath &aFilename, const char *aTexName) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool IsPowerOfTwo(int n) {
|
static inline bool IsPowerOfTwo(s32 n) {
|
||||||
return (ceil(log2(n)) == floor(log2(n)));
|
return (n > 0) && ((n & (n - 1)) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DynOS_Tex_Get(const char* aTexName, struct TextureInfo* aOutTexInfo) {
|
bool DynOS_Tex_Get(const char* aTexName, struct TextureInfo* aOutTexInfo) {
|
||||||
|
@ -487,8 +487,7 @@ bool DynOS_Tex_Get(const char* aTexName, struct TextureInfo* aOutTexInfo) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// texture width or height is NPOT
|
// texture width or height is NPOT
|
||||||
if ((_Data->mRawWidth > 0 && _Data->mRawWidth & (_Data->mRawWidth - 1) == 0) ||
|
if (!IsPowerOfTwo(_Data->mRawWidth) || !IsPowerOfTwo(_Data->mRawHeight)) {
|
||||||
(_Data->mRawHeight > 0 && _Data->mRawHeight & (_Data->mRawHeight - 1) == 0)) {
|
|
||||||
PrintError("Tex file '%s' has non power of two width or height", aTexName);
|
PrintError("Tex file '%s' has non power of two width or height", aTexName);
|
||||||
PrintConsole(CONSOLE_MESSAGE_WARNING, "Tex file '%s' has non power of two width or height", aTexName);
|
PrintConsole(CONSOLE_MESSAGE_WARNING, "Tex file '%s' has non power of two width or height", aTexName);
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue