mesa/st: calculate texture size based on EGLImage miplevel
authorTapani Pälli <tapani.palli@intel.com>
Tue, 24 Sep 2019 11:34:40 +0000 (14:34 +0300)
committerTapani Pälli <tapani.palli@intel.com>
Thu, 26 Sep 2019 04:55:24 +0000 (07:55 +0300)
Fixes issues with 'egl-gl_oes_egl_image' Piglit test.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/state_tracker/st_cb_eglimage.c

index 77abe55cfb2e5b81c0cc32fa2de234e9cb18852f..c4eac0ce44a6ba2fb95927e9d6c77eba31f60d7a 100644 (file)
@@ -271,8 +271,11 @@ st_bind_egl_image(struct gl_context *ctx,
    }
    assert(texFormat != MESA_FORMAT_NONE);
 
-   _mesa_init_teximage_fields(ctx, texImage,
-                              stimg->texture->width0, stimg->texture->height0,
+   /* Minify texture size based on level set on the EGLImage. */
+   uint32_t width = u_minify(stimg->texture->width0, stimg->level);
+   uint32_t height = u_minify(stimg->texture->height0, stimg->level);
+
+   _mesa_init_teximage_fields(ctx, texImage, width, height,
                               1, 0, internalFormat, texFormat);
 
    pipe_resource_reference(&stObj->pt, stimg->texture);