From 066b6b0bcbac1ed1f9534277498a4965759f9300 Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Sat, 26 Mar 2016 03:14:39 +1300 Subject: [PATCH] OpenGL: Cache query to max texture size. This showed up really high when I was profiling things. --- Source/Core/VideoBackends/OGL/Render.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp index e80ca40ab5..0960bbd5f7 100644 --- a/Source/Core/VideoBackends/OGL/Render.cpp +++ b/Source/Core/VideoBackends/OGL/Render.cpp @@ -52,6 +52,7 @@ void VideoConfig::UpdateProjectionHack() } static int OSDInternalW, OSDInternalH; +static int s_max_texture_size; namespace OGL { @@ -710,6 +711,9 @@ void Renderer::Init() s_raster_font = std::make_unique(); OpenGL_CreateAttributelessVAO(); + + // Cache this, because if you do this multiple times a frame, it shows up really high on a profile. + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &s_max_texture_size); } void Renderer::RenderText(const std::string& text, int left, int top, u32 color) @@ -1693,9 +1697,7 @@ bool Renderer::SaveScreenshot(const std::string &filename, const TargetRectangle int Renderer::GetMaxTextureSize() { - int max_size; - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_size); - return max_size; + return s_max_texture_size; } }