Skip to content

Commit

Permalink
Debugger: Check for no texture before debug bind.
Browse files Browse the repository at this point in the history
This means a framebuffer texture that is somehow not attached, but better
to avoid the crash.
  • Loading branch information
unknownbrackets committed Aug 23, 2020
1 parent 5ade93a commit 3b11b09
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions GPU/GLES/TextureCacheGLES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,6 @@ void TextureCacheGLES::BuildTexture(TexCacheEntry *const entry) {
}
}

// glBindTexture(GL_TEXTURE_2D, entry->textureName);
lastBoundTexture = entry->textureName;

// GLES2 doesn't have support for a "Max lod" which is critical as PSP games often
Expand Down Expand Up @@ -859,12 +858,15 @@ bool TextureCacheGLES::GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level)
gstate = saved;
}

buffer.Allocate(w, h, GE_FORMAT_8888, false);
renderManager->CopyImageToMemorySync(entry->textureName, level, 0, 0, w, h, Draw::DataFormat::R8G8B8A8_UNORM, (uint8_t *)buffer.GetData(), w, "GetCurrentTextureDebug");
bool result = entry->textureName != nullptr;
if (result) {
buffer.Allocate(w, h, GE_FORMAT_8888, false);
renderManager->CopyImageToMemorySync(entry->textureName, level, 0, 0, w, h, Draw::DataFormat::R8G8B8A8_UNORM, (uint8_t *)buffer.GetData(), w, "GetCurrentTextureDebug");
}
gstate_c.Dirty(DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS);
framebufferManager_->RebindFramebuffer("RebindFramebuffer - GetCurrentTextureDebug");

return true;
return result;
#else
return false;
#endif
Expand Down

0 comments on commit 3b11b09

Please sign in to comment.