Oh, now I realized that you sent the Brian's patch to me :) It's indeed simpler and it works. I also suggest removing the assertion "ASSERT(_mesa_bitcount(destMask[buf]) == 1);". It's no longer needed with this patch.
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index b13a7af..b91fdb7 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -494,10 +494,11 @@ _mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers, } . /* - * If n==1, destMask[0] may have up to four bits set. + * destMask[0] may have up to four bits set + * (ex: glDrawBuffer(GL_FRONT_AND_BACK)). * Otherwise, destMask[x] can only have one bit set. */ - if (n == 1) { + if (_mesa_bitcount(destMask[0]) > 1) { GLuint count = 0, destMask0 = destMask[0]; while (destMask0) { GLint bufIndex = ffs(destMask0) - 1; @@ -516,8 +517,6 @@ _mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers, for (buf = 0; buf < n; buf++ ) { if (destMask[buf]) { GLint bufIndex = ffs(destMask[buf]) - 1; - /* only one bit should be set in the destMask[buf] field */ - ASSERT(_mesa_bitcount(destMask[buf]) == 1); if (fb->_ColorDrawBufferIndexes[buf] != bufIndex) { <-----> updated_drawbuffers(ctx); fb->_ColorDrawBufferIndexes[buf] = bufIndex; -Pavel -----Original Message----- From: mesa-dev [mailto:mesa-dev-boun...@lists.freedesktop.org] On Behalf Of Popov, Pavel E Sent: Monday, August 11, 2014 10:31 AM To: Ian Romanick; Brian Paul; mesa-dev@lists.freedesktop.org Cc: 10.2 Subject: Re: [Mesa-dev] [PATCH 7/8] mesa: fix assertion in _mesa_drawbuffers() Hi Ian, Yes, it fixes this problem for Debug Mesa. But it doesn't matter now. Brain said that he found a simpler solution and working on patch now. Regards, Pavel -----Original Message----- From: Ian Romanick [mailto:i...@freedesktop.org] Sent: Saturday, August 09, 2014 4:54 AM To: Brian Paul; mesa-dev@lists.freedesktop.org; Popov, Pavel E Cc: 10.2 Subject: Re: [Mesa-dev] [PATCH 7/8] mesa: fix assertion in _mesa_drawbuffers() Pavel, Does this patch fix the problem you were trying to solve? On 08/08/2014 02:20 PM, Brian Paul wrote: > Fixes failed assertion when _mesa_update_draw_buffers() was called > with GL_DRAW_BUFFER == GL_FRONT_AND_BACK. The piglit gl30basic hit > this. > > Cc: "10.2" <mesa-sta...@lists.freedesktop.org> > --- > src/mesa/main/buffers.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index > b13a7af..6b4fac9 100644 > --- a/src/mesa/main/buffers.c > +++ b/src/mesa/main/buffers.c > @@ -494,10 +494,11 @@ _mesa_drawbuffers(struct gl_context *ctx, GLuint n, > const GLenum *buffers, > } > > /* > - * If n==1, destMask[0] may have up to four bits set. > + * destMask[0] may have up to four bits set > + * (ex: glDrawBuffer(GL_FRONT_AND_BACK)). > * Otherwise, destMask[x] can only have one bit set. > */ > - if (n == 1) { > + if (_mesa_bitcount(destMask[0]) > 1) { > GLuint count = 0, destMask0 = destMask[0]; > while (destMask0) { > GLint bufIndex = ffs(destMask0) - 1; > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev