diff options
author | George Sapountzis <[email protected]> | 2010-03-27 20:32:52 +0200 |
---|---|---|
committer | George Sapountzis <[email protected]> | 2010-03-27 20:56:36 +0200 |
commit | f4e561ce127cf484d7c76c29b8cd026c9ad5cebc (patch) | |
tree | 38b94af9ee5a6242acdcfcd9d7584a97ad97ad8d /src/mesa/drivers/dri/swrast | |
parent | 02ee7c29502966dffa44243bfc8c20c15907b880 (diff) |
drisw: make stride issue profound
Diffstat (limited to 'src/mesa/drivers/dri/swrast')
-rw-r--r-- | src/mesa/drivers/dri/swrast/swrast.c | 18 | ||||
-rw-r--r-- | src/mesa/drivers/dri/swrast/swrast_priv.h | 8 |
2 files changed, 13 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index e9ca99a86f0..e8df26f3d06 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -206,12 +206,19 @@ swrast_delete_renderbuffer(struct gl_renderbuffer *rb) free(rb); } +static INLINE int +bytes_per_line(unsigned pitch_bits, unsigned mul) +{ + unsigned mask = mul - 1; + + return ((pitch_bits + mask) & ~mask) / 8; +} + static GLboolean swrast_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height) { struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); - unsigned mask = PITCH_ALIGN_BITS - 1; TRACE; @@ -219,8 +226,7 @@ swrast_alloc_front_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->Width = width; rb->Height = height; - /* always pad to PITCH_ALIGN_BITS */ - xrb->pitch = ((width * xrb->bpp + mask) & ~mask) / 8; + xrb->pitch = bytes_per_line(width * xrb->bpp, 32); return GL_TRUE; } @@ -394,8 +400,10 @@ dri_swap_buffers(__DRIdrawable * dPriv) fb = &drawable->Base; - frontrb = swrast_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer); - backrb = swrast_renderbuffer(fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer); + frontrb = + swrast_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer); + backrb = + swrast_renderbuffer(fb->Attachment[BUFFER_BACK_LEFT].Renderbuffer); /* check for signle-buffered */ if (backrb == NULL) diff --git a/src/mesa/drivers/dri/swrast/swrast_priv.h b/src/mesa/drivers/dri/swrast/swrast_priv.h index 007642be95f..6679061a983 100644 --- a/src/mesa/drivers/dri/swrast/swrast_priv.h +++ b/src/mesa/drivers/dri/swrast/swrast_priv.h @@ -124,14 +124,6 @@ swrast_renderbuffer(struct gl_renderbuffer *rb) #define PF_R3G3B2 3 /**< 8bpp TrueColor: 3-R, 3-G, 2-B bits */ #define PF_X8R8G8B8 4 /**< 32bpp TrueColor: 8-R, 8-G, 8-B bits */ -/** - * Renderbuffer pitch alignment (in bits). - * - * The xorg loader requires padding images to 32 bits. However, this should - * become a screen/drawable parameter XXX - */ -#define PITCH_ALIGN_BITS 32 - /* swrast_span.c */ |