mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-08 04:08:32 +09:00
[Fix] (MG_State/Texture): relaxing completeness check on reasonable 0x0 mipmap
This commit is contained in:
@@ -328,7 +328,7 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
// 4. Mipmap levels changed
|
||||
|
||||
if (!stateTextureObject->IsComplete()) {
|
||||
MGLOG_D("Texture object with ID: %u is not complete, skipping sync.", m_backendTextureId);
|
||||
MGLOG_D("Texture object with ID: %u is not complete, skipping sync.", stateTextureObject->GetExternalIndex());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ namespace MobileGL {
|
||||
auto& bindingSlot = activeUnit.GetBindingSlot(textureTarget);
|
||||
auto textureObject = bindingSlot.GetBoundObject();
|
||||
TextureInternalFormat textureInternalFormat = textureObject->GetFormat();
|
||||
MGLOG_D("%s: working on texture %d", __func__, textureObject->GetExternalIndex());
|
||||
|
||||
// ===================== Error Checking ==============================
|
||||
if (!TextureImpl::ValidateTextureObject(textureObject)) return;
|
||||
@@ -682,6 +683,8 @@ namespace MobileGL {
|
||||
const SizeT internalBpp = MG_Util::GetInternalBytesPerPixel(textureInternalFormat, texturePixelDataType);
|
||||
const SizeT internalBytes = width * height * internalBpp;
|
||||
|
||||
MGLOG_D("%s: working on texture %d", __func__, textureObject->GetExternalIndex());
|
||||
|
||||
MGLOG_D("%s: texture object had internal format %s, new format %s", __func__,
|
||||
MG_Util::ConvertTextureInternalFormatToString(textureObject->GetFormat()).c_str(),
|
||||
MG_Util::ConvertTextureInternalFormatToString(textureInternalFormat).c_str());
|
||||
|
||||
@@ -164,13 +164,24 @@ namespace MobileGL {
|
||||
|
||||
SizeT levelCount = m_textureStorage.GetLevelCount();
|
||||
if (levelCount == 0) {
|
||||
MGLOG_D("%s: not complete because levelCount == 0", __func__);
|
||||
return false;
|
||||
}
|
||||
|
||||
// For some reason mojang decided to have 0x0 in last level mipmap
|
||||
// Relaxing checks for that
|
||||
bool hadZero = false;
|
||||
for (SizeT i = 0; i < levelCount; ++i) {
|
||||
const auto& levelSize = m_textureStorage.GetTexelSize(0, i);
|
||||
if (levelSize.x() <= 0 || levelSize.y() <= 0 || levelSize.z() <= 0) {
|
||||
return false;
|
||||
hadZero = true;
|
||||
} else {
|
||||
if (hadZero) {
|
||||
// We're checking for "zero - not zero - zero" here
|
||||
// "not zero - zero - zero" should pass this test
|
||||
MGLOG_D("%s: not complete because 0x0 occurred, and is not last level mipmap", __func__);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -108,8 +108,8 @@ namespace MobileGL::MG_Util::PixelStoreProcessor {
|
||||
const Int copyHeight = height;
|
||||
const Int copyDepth = depth;
|
||||
|
||||
MGLOG_D("%s: start at: (%d, %d, %d), copy size: (%d, %d, %d), i/o row stride: (%d, %d)", __func__,
|
||||
startX, startY, startZ, copyWidth, copyHeight, copyDepth, inputRowStride, outputRowStride);
|
||||
MGLOG_D("%s: start at: (%d, %d, %d), copy size: (%d, %d, %d), i/o row stride: (%d, %dx%d)", __func__,
|
||||
startX, startY, startZ, copyWidth, copyHeight, copyDepth, inputRowStride, width, pixelSize);
|
||||
|
||||
if (copyWidth <= 0 || copyHeight <= 0 || copyDepth <= 0) {
|
||||
outSize = 0;
|
||||
|
||||
Reference in New Issue
Block a user