[Mesa-dev] [1/2] i965: Handle texture view min level in brw_generate_mipmap()

Paul Gofman gofmanp at gmail.com
Fri Nov 1 19:07:49 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>
---
    Spotted while debugging Wine d3d11 unit test failures with Nouveau and Intel drivers.

 src/mesa/drivers/dri/i965/brw_generate_mipmap.c | 5 ++++-
 1 file changed, 4 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..6313b070a11 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 ||
-- 
2.23.0



More information about the mesa-dev mailing list