From 6b4d7f5cf8160a880cf281f189af557c5f7de506 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Wed, 20 Jun 2018 11:02:24 +0200 Subject: [PATCH] vrend, allocal_texture: Set mip-map levels correctly in the texture's state 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. Tested-by: Jakob Bornecrantz Signed-off-by: Gert Wollny Signed-off-by: Jakob Bornecrantz --- src/vrend_renderer.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 00c42ff..03079e7 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -4932,6 +4932,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;