From 6d37d9f1f503a5af2929db77616dd4c3a2b89c93 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Tue, 5 Feb 2019 22:09:11 +0100 Subject: [PATCH] renderer: do not repeat base_level and max_level unpacking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We're going to have to do this anyway, so let's just do it cleanly right away. Signed-off-by: Erik Faye-Lund Reviewed-by: Stéphane Marchesin --- src/vrend_renderer.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 412ccc0..c915ecf 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -2610,13 +2610,14 @@ void vrend_set_single_sampler_view(struct vrend_context *ctx, } } - if (tex->cur_base != (view->val1 & 0xff)) { - int base_level = view->val1 & 0xff; + GLuint base_level = view->val1 & 0xff; + GLuint max_level = (view->val1 >> 8) & 0xff; + + if (tex->cur_base != base_level) { glTexParameteri(view->texture->target, GL_TEXTURE_BASE_LEVEL, base_level); tex->cur_base = base_level; } - if (tex->cur_max != ((view->val1 >> 8) & 0xff)) { - int max_level = (view->val1 >> 8) & 0xff; + if (tex->cur_max != max_level) { glTexParameteri(view->texture->target, GL_TEXTURE_MAX_LEVEL, max_level); tex->cur_max = max_level; }