Merge pull request #3746 from phire/cache_max_texture_size

OpenGL: Cache query to max texture size.
This commit is contained in:
Pierre Bourdon 2016-03-25 17:00:56 +01:00
commit b427d58a5f
1 changed files with 5 additions and 3 deletions

View File

@ -52,6 +52,7 @@ void VideoConfig::UpdateProjectionHack()
} }
static int OSDInternalW, OSDInternalH; static int OSDInternalW, OSDInternalH;
static int s_max_texture_size;
namespace OGL namespace OGL
{ {
@ -710,6 +711,9 @@ void Renderer::Init()
s_raster_font = std::make_unique<RasterFont>(); s_raster_font = std::make_unique<RasterFont>();
OpenGL_CreateAttributelessVAO(); 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) 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 Renderer::GetMaxTextureSize()
{ {
int max_size; return s_max_texture_size;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_size);
return max_size;
} }
} }