diff --git a/Core/Core.cpp b/Core/Core.cpp index c1caba9f5f..5153b2e4b7 100644 --- a/Core/Core.cpp +++ b/Core/Core.cpp @@ -180,7 +180,6 @@ void GPU_SwapBuffers() { D3D9_SwapBuffers(); break; } - PROFILE_END_FRAME(); } #endif diff --git a/GPU/GLES/TextureCache.cpp b/GPU/GLES/TextureCache.cpp index 797f74a48a..1f87fa3564 100644 --- a/GPU/GLES/TextureCache.cpp +++ b/GPU/GLES/TextureCache.cpp @@ -1893,7 +1893,14 @@ TextureCache::TexCacheEntry::Status TextureCache::CheckAlpha(const u32 *pixelDat } void TextureCache::LoadTextureLevel(TexCacheEntry &entry, int level, bool replaceImages, int scaleFactor, GLenum dstFmt) { - PROFILE_THIS_SCOPE("loadtex"); + int w = gstate.getTextureWidth(level); + int h = gstate.getTextureHeight(level); + bool useUnpack = false; + bool useBGRA; + u32 *pixelData; + { + + PROFILE_THIS_SCOPE("decodetex"); // TODO: only do this once u32 texByteAlign = 1; @@ -1905,13 +1912,9 @@ void TextureCache::LoadTextureLevel(TexCacheEntry &entry, int level, bool replac return; } - int w = gstate.getTextureWidth(level); - int h = gstate.getTextureHeight(level); - gpuStats.numTexturesDecoded++; // Can restore these and remove the fixup at the end of DecodeTextureLevel on desktop GL and GLES 3. - bool useUnpack = false; if ((g_Config.iTexScalingLevel == 1 && gl_extensions.EXT_unpack_subimage) && w != bufw) { glPixelStorei(GL_UNPACK_ROW_LENGTH, bufw); useUnpack = true; @@ -1919,9 +1922,9 @@ void TextureCache::LoadTextureLevel(TexCacheEntry &entry, int level, bool replac glPixelStorei(GL_UNPACK_ALIGNMENT, texByteAlign); - bool useBGRA = UseBGRA8888() && dstFmt == GL_UNSIGNED_BYTE; + useBGRA = UseBGRA8888() && dstFmt == GL_UNSIGNED_BYTE; - u32 *pixelData = (u32 *)finalBuf; + pixelData = (u32 *)finalBuf; if (scaleFactor > 1 && (entry.status & TexCacheEntry::STATUS_CHANGE_FREQUENT) == 0) scaler.Scale(pixelData, dstFmt, w, h, scaleFactor); @@ -1931,6 +1934,7 @@ void TextureCache::LoadTextureLevel(TexCacheEntry &entry, int level, bool replac } else { entry.SetAlphaStatus(TexCacheEntry::STATUS_ALPHA_UNKNOWN); } + } GLuint components = dstFmt == GL_UNSIGNED_SHORT_5_6_5 ? GL_RGB : GL_RGBA; @@ -1940,8 +1944,10 @@ void TextureCache::LoadTextureLevel(TexCacheEntry &entry, int level, bool replac } if (replaceImages) { + PROFILE_THIS_SCOPE("repltex"); glTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, w, h, components2, dstFmt, pixelData); } else { + PROFILE_THIS_SCOPE("loadtex"); glTexImage2D(GL_TEXTURE_2D, level, components, w, h, 0, components2, dstFmt, pixelData); if (!lowMemoryMode_) { GLenum err = glGetError(); diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 264017e052..4182232968 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -48,7 +48,6 @@ #include "file/zip_read.h" #include "thread/thread.h" #include "net/http_client.h" -#include "gfx_es2/gl_state.h" // should've been only for screenshot - but actually not, cleanup? #include "gfx_es2/draw_text.h" #include "gfx/gl_lost_manager.h" #include "gfx/texture.h" @@ -57,6 +56,7 @@ #include "math/fast/fast_math.h" #include "math/math_util.h" #include "math/lin/matrix4x4.h" +#include "profiler/profiler.h" #include "thin3d/thin3d.h" #include "ui/ui.h" #include "ui/screen.h" @@ -762,6 +762,8 @@ void HandleGlobalMessage(const std::string &msg, const std::string &value) { } void NativeUpdate(InputState &input) { + PROFILE_END_FRAME(); + { lock_guard lock(pendingMutex); for (size_t i = 0; i < pendingMessages.size(); i++) {