[Mesa-dev] [PATCH] intel: Fix accum buffer mapping since the swrast rework.

Eric Anholt eric at anholt.net
Fri Jan 27 11:20:17 PST 2012


On Tue, 24 Jan 2012 17:55:49 -0800, Ian Romanick <idr at freedesktop.org> wrote:
> On 01/24/2012 03:59 PM, Eric Anholt wrote:
> > A pure swrast-allocated buffer gets an irb of NULL, so we segfaulted
> > in the clear-accum test.  Just look at the swrast renderbuffer pointer
> > for handling swrast rbs.
> > ---
> >   src/mesa/drivers/dri/intel/intel_fbo.c |   12 +++++++-----
> >   1 files changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
> > index 3a35a01..27b0bfc 100644
> > --- a/src/mesa/drivers/dri/intel/intel_fbo.c
> > +++ b/src/mesa/drivers/dri/intel/intel_fbo.c
> > @@ -128,15 +128,16 @@ intel_map_renderbuffer(struct gl_context *ctx,
> >   		       GLint *out_stride)
> >   {
> >      struct intel_context *intel = intel_context(ctx);
> > +   struct swrast_renderbuffer *srb = (struct swrast_renderbuffer *)rb;
> >      struct intel_renderbuffer *irb = intel_renderbuffer(rb);
> >      void *map;
> >      int stride;
> >
> > -   if (!irb&&  irb->Base.Buffer) {
> > -      /* this is a malloc'd renderbuffer (accum buffer) */
> > +   if (srb->Buffer) {
> > +      /* this is a malloc'd renderbuffer (accum buffer), not an irb */
> >         GLint bpp = _mesa_get_format_bytes(rb->Format);
> > -      GLint rowStride = irb->Base.RowStride;
> > -      *out_map = (GLubyte *) irb->Base.Buffer + y * rowStride + x * bpp;
> > +      GLint rowStride = srb->RowStride;
> > +      *out_map = (GLubyte *) srb->Buffer + y * rowStride + x * bpp;
> 
> Would it be better to use _swrast_pixel_address here?

Looks like no, because that uses srb->Map, which is not srb->Buffer and
gets set to a MapRenderbuffer returned pointer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120127/dbecfd19/attachment.pgp>


More information about the mesa-dev mailing list