OpenGL: Cache query to max texture size.

This showed up really high when I was profiling things.
This commit is contained in:
Scott Mansell 2016-03-26 03:14:39 +13:00
parent 3ff56aa192
commit 066b6b0bcb
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;
} }
} }