[Mesa-dev] [PATCH] texgetimage: Check that a multisample tex is not passed to GetTextureSubImage

Ilia Mirkin imirkin at alum.mit.edu
Thu Feb 2 18:36:11 UTC 2017


On Thu, Feb 2, 2017 at 1:29 PM, Eduardo Lima Mitev <elima at igalia.com> wrote:
> OpenGL 4.5 spec, section "8.11.4 Texture Image Queries", page 233 of
> the PDF states:
>
>     "An INVALID_OPERATION error is generated if texture is the name of a buffer
>      or multisample texture."
>
> Currently, this is not being checked and the multisample texture image is passed
> down to the driver hook. On i965, it is crashing the driver with an assertion:
>
> intel_mipmap_tree.c:3125: intel_miptree_map: Assertion `mt->num_samples <= 1' failed.
> ---
>  src/mesa/main/texgetimage.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
> index d5cb1636605..6a23e4bbb8c 100644
> --- a/src/mesa/main/texgetimage.c
> +++ b/src/mesa/main/texgetimage.c
> @@ -1185,6 +1185,20 @@ getteximage_error_check(struct gl_context *ctx,
>     texImage = select_tex_image(texObj, target, level, zoffset);
>     assert(texImage);
>
> +   /* Check that texObj is not a buffer or multisample texture if called
> +    * from glGetTextureSubImage. OpenGL 4.5 spec, section "8.11.4 Texture
> +    * Image Queries", page 233 of the PDF states:
> +    *
> +    *     "An INVALID_OPERATION error is generated if texture is the
> +    *      name of a buffer or multisample texture."
> +    */
> +   if (texImage->NumSamples > 0 &&
> +       strcmp(caller, "glGetTextureSubImage") == 0) {

So... glGetTextureSubImage is not OK but glGetTextureImage is OK?

I think the issue is a missing

   if (!legal_getteximage_target(ctx, texObj->Target, true)) {
      _mesa_error(ctx, GL_INVALID_ENUM, "%s", caller);
      return;
   }

block in _mesa_GetTextureSubImage.

> +      _mesa_error(ctx, GL_INVALID_OPERATION,
> +                  "%s(multisample texture)", caller);
> +      return true;
> +   }
> +
>     /*
>      * Format and type checking has been moved up to GetnTexImage and
>      * GetTextureImage so that it happens before getting the texImage object.
> --
> 2.11.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list