[Mesa-dev] [v2, 1/2] i965: Handle texture view min level in brw_generate_mipmap()
Paul Gofman
gofmanp at gmail.com
Mon Nov 4 12:31:09 UTC 2019
Currently minlevel set with glTextureView() is ignored for
mipmap generation and original texture's first layer is used as
the source layer in glGenerateMipmap().
Signed-off-by: Paul Gofman <gofmanp at gmail.com>
---
Corresponding piglit test patch: https://patchwork.freedesktop.org/patch/338798/
src/mesa/drivers/dri/i965/brw_generate_mipmap.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/mesa/drivers/dri/i965/brw_generate_mipmap.c b/src/mesa/drivers/dri/i965/brw_generate_mipmap.c
index 4125ae6e11c..6999e751b9d 100644
--- a/src/mesa/drivers/dri/i965/brw_generate_mipmap.c
+++ b/src/mesa/drivers/dri/i965/brw_generate_mipmap.c
@@ -41,9 +41,12 @@ brw_generate_mipmap(struct gl_context *ctx, GLenum target,
struct brw_context *brw = brw_context(ctx);
struct gen_device_info *devinfo = &brw->screen->devinfo;
struct intel_texture_object *intel_obj = intel_texture_object(tex_obj);
- const unsigned base_level = tex_obj->BaseLevel;
+ unsigned base_level = tex_obj->BaseLevel;
unsigned last_level, first_layer, last_layer;
+ if (tex_obj->Immutable)
+ base_level += tex_obj->MinLevel;
+
/* Blorp doesn't handle combined depth/stencil surfaces on Gen4-5 yet. */
if (devinfo->gen <= 5 &&
(tex_obj->Image[0][base_level]->_BaseFormat == GL_DEPTH_COMPONENT ||
@@ -55,6 +58,9 @@ brw_generate_mipmap(struct gl_context *ctx, GLenum target,
/* find expected last mipmap level to generate */
last_level = _mesa_compute_num_levels(ctx, tex_obj, target) - 1;
+ if (tex_obj->Immutable)
+ last_level += tex_obj->MinLevel;
+
if (last_level == 0)
return;
--
2.23.0
More information about the mesa-dev
mailing list