[Mesa-dev] [alternate PATCH 1.2/6] mesa: Make ES3 glDrawBuffers() only accept BACK/NONE for the winsys fbo.

Anuj Phogat anuj.phogat at gmail.com
Tue Dec 18 16:36:57 PST 2012


On Tue, Dec 18, 2012 at 1:26 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> Nothing was explicitly checking this.
> ---
>  src/mesa/main/buffers.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
> index 244f4de..065ef2a 100644
> --- a/src/mesa/main/buffers.c
> +++ b/src/mesa/main/buffers.c
> @@ -316,6 +316,16 @@ _mesa_DrawBuffers(GLsizei n, const GLenum *buffers)
>     supportedMask = supported_buffer_bitmask(ctx, ctx->DrawBuffer);
>     usedBufferMask = 0x0;
>
> +   /* From the ES 3.0 specification, page 180:
> +    * "If the GL is bound to the default framebuffer, then n must be 1
> +    *  and the constant must be BACK or NONE."
> +    */
> +   if (_mesa_is_gles3(ctx) && _mesa_is_winsys_fbo(ctx->DrawBuffer) &&
> +       (n != 1 || (buffers[0] != GL_NONE && buffers[0] != GL_BACK))) {
> +      _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffers(buffer)");
> +      return;
> +   }
> +
>     /* complicated error checking... */
>     for (output = 0; output < n; output++) {
>        if (buffers[output] == GL_NONE) {
> --
> 1.8.0.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the mesa-dev mailing list