[virglrenderer-devel] [PATCH 1/3] vrend, allocal_texture: Set mip-map levels correctly in the texture's state

Gert Wollny gert.wollny at collabora.com
Wed Jun 20 09:02:24 UTC 2018


OpenGL defaults GL_TEXTURE_MIN_FILTER=GL_NEAREST_MIPMAP_LINEAR and
GL_TEXTURE_MAX_LEVEL=1000, and expects all these mip-map levels to be
defined. With glTexStorage this is set apropriately, but when the mip-map
levels are initialiazed manually, then the GL_TEXTURE_MAX_LEVEL must be set.

Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
---
 src/vrend_renderer.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index f9ec520..b769e8a 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -4934,6 +4934,11 @@ static int vrend_renderer_resource_allocate_texture(struct vrend_resource *gr,
       }
    }
 
+   if (!vrend_state.have_texture_storage) {
+      glTexParameteri(gr->target, GL_TEXTURE_BASE_LEVEL, 0);
+      glTexParameteri(gr->target, GL_TEXTURE_MAX_LEVEL, pr->last_level);
+   }
+
    gt->state.max_lod = -1;
    gt->cur_swizzle_r = gt->cur_swizzle_g = gt->cur_swizzle_b = gt->cur_swizzle_a = -1;
    return 0;
-- 
2.16.4



More information about the virglrenderer-devel mailing list