[Mesa-dev] [PATCH] mesa: Reject glDrawPixels(integer format) on GL 3.0 or greater.

Ian Romanick idr at freedesktop.org
Tue Nov 29 12:25:14 PST 2011


On 11/27/2011 06:08 PM, Eric Anholt wrote:
> When folding GL_EXT_texture_integer into the core, a new (and very
> sensible) restriction was added.
> ---
>   src/mesa/main/drawpix.c |   13 +++++++++++++
>   1 files changed, 13 insertions(+), 0 deletions(-)
>
> diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c
> index 412cc15..5d1bd5a 100644
> --- a/src/mesa/main/drawpix.c
> +++ b/src/mesa/main/drawpix.c
> @@ -30,6 +30,7 @@
>   #include "enums.h"
>   #include "feedback.h"
>   #include "framebuffer.h"
> +#include "image.h"
>   #include "mfeatures.h"
>   #include "pbo.h"
>   #include "readpix.h"
> @@ -76,6 +77,18 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
>         goto end;      /* the error code was recorded */
>      }
>
> +   /* GL 3.0 introduced a new restriction on glDrawPixels() over what was in
> +    * GL_EXT_texture_integer.  From section 3.7.4 ("Rasterization of Pixel
> +    * Rectangles) on page 151 of the GL 3.0 specification:
> +    *
> +    *     "If format contains integer components, as shown in table 3.6, an
> +    *      INVALID OPERATION error is generated."
> +    */
> +   if (ctx->VersionMajor>= 3&&  _mesa_is_integer_format(format)) {

I'd be in favor of making this check not depend on the GL version.  The 
EXT spec says DrawPixels only works with a shader.  The only way to get 
integer data from a shader is with EXT_gpu_shader4 or GLSL 1.30.  So... 
yeah.

> +      _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels(integer format)");
> +      goto end;
> +   }
> +
>      if (_mesa_error_check_format_type(ctx, format, type, GL_TRUE)) {
>         goto end;      /* the error code was recorded */
>      }


More information about the mesa-dev mailing list