summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/swrast/swrast.c
diff options
context:
space:
mode:
authorGeorge Sapountzis <[email protected]>2010-03-27 20:32:52 +0200
committerGeorge Sapountzis <[email protected]>2010-03-27 20:56:36 +0200
commitf4e561ce127cf484d7c76c29b8cd026c9ad5cebc (patch)
tree38b94af9ee5a6242acdcfcd9d7584a97ad97ad8d /src/mesa/drivers/dri/swrast/swrast.c
parent02ee7c29502966dffa44243bfc8c20c15907b880 (diff)
drisw: make stride issue profound
Diffstat (limited to 'src/mesa/drivers/dri/swrast/swrast.c')
-rw-r--r--src/mesa/drivers/dri/swrast/swrast.c18
1 files changed, 13 insertions, 5 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)