From e8c949c1e7d188cd239d89e69a302ee1fa75228b Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Fri, 29 May 2020 16:47:21 +1000 Subject: [PATCH] [client] egl: dont re-setup the fps texture on each update --- VERSION | 2 +- client/renderers/EGL/fps.c | 30 ++++++++++++++++++------------ 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/VERSION b/VERSION index fdae0430..f4f49787 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -B2-rc2-5-gd7921c5d5f+1 \ No newline at end of file +B2-rc2-6-g28c93ef5ac+1 \ No newline at end of file diff --git a/client/renderers/EGL/fps.c b/client/renderers/EGL/fps.c index 93a4fda0..624ad6e9 100644 --- a/client/renderers/EGL/fps.c +++ b/client/renderers/EGL/fps.c @@ -44,6 +44,7 @@ struct EGL_FPS EGL_Model * model; bool ready; + int iwidth, iheight; float width, height; // uniforms @@ -144,14 +145,22 @@ void egl_fps_update(EGL_FPS * fps, const float avgFPS, const float renderFPS) return; } - egl_texture_setup( - fps->texture, - EGL_PF_BGRA, - bmp->width , - bmp->height, - bmp->width * bmp->bpp, - false - ); + if (fps->iwidth != bmp->width || fps->iheight != bmp->height) + { + fps->iwidth = bmp->width; + fps->iheight = bmp->height; + fps->width = (float)bmp->width; + fps->height = (float)bmp->height; + + egl_texture_setup( + fps->texture, + EGL_PF_BGRA, + bmp->width , + bmp->height, + bmp->width * bmp->bpp, + false + ); + } egl_texture_update ( @@ -159,10 +168,7 @@ void egl_fps_update(EGL_FPS * fps, const float avgFPS, const float renderFPS) bmp->pixels ); - fps->width = bmp->width; - fps->height = bmp->height; fps->ready = true; - fps->font->release(fps->fontObj, bmp); } @@ -187,4 +193,4 @@ void egl_fps_render(EGL_FPS * fps, const float scaleX, const float scaleY) egl_model_render(fps->model); glDisable(GL_BLEND); -} \ No newline at end of file +}