[Mesa-dev] GL 3.0 glDrawPixels(integer format)

Ian Romanick idr at freedesktop.org
Tue Nov 29 12:22:54 PST 2011

On 11/27/2011 06:08 PM, Eric Anholt wrote:
> While looking into MapRenderbuffer for glDrawPixels, I ended up
> looking at integer again.  It looks like GL 3.0 has added sanity to
> drawpixels for integer, which is to say that they've disallowed it.
> I don't think there was any way to usefully use drawpixels of integer.
> Assuming you want to output to an integer FBO, you have to have a
> fragment shader bound.  You would also need to have the input to that
> fragment shader be integer, or you're going to lose your precision.
> But how does the glDrawPixels() input data get bound to some
> user-defined shader input?
> The fbo-integer-precision-drawpixels testcase currently binds a shader
> that does gl_FragColor = gl_Color.  But if the output to an integer
> FBO is written through a floating-point shader output, the result is
> undefined (from GL_EXT_texture_integer):
>     "The color components used for per-fragment operations and written into a
>      color buffer are undefined:
>        * for fragment shaders that write floating-point color components to an
>          integer color buffer, or..."
> What should we do with that testcase?  If pre-3.0
> GL_EXT_texture_integer allows drawpixels for integer, what behavior
> would we actually want for making use of the user's shader?  (I'm
> assuming that testcase passed for whatever code it was supposed to
> test because that code just no-opped the shader.  Imagine the shader
> doing some actual math on the color instead.).  I'm inclined to adopt
> 3.0 behavior generally, and assume that the 3.0 wording was a
> correction after someone noticed that making drawpixels for integer
> actually work was hopeless.

If other drivers report EXT_texture_integer with OpenGL 3.0 and generate 
the DrawPixels errors (per the 3.0 spec), then, in a practical sense, 
it's impossible for any application to use the DrawPixels functionality 
in EXT_texture_integer.

If there are no applications and there never will be any applications 
that use this quirk of the EXT, then I would opt for the 3.0 behavior.

I suspect that there may be apps that look for the EXT in the absence of 
3.0 to use integer textures.  We should continue to report the EXT.

I think this is a case where the EXT spec should have been updated to 
match 3.0 when 3.0 was released.  Alas.

More information about the mesa-dev mailing list