summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-04-12 01:40:29 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-04-12 01:40:29 +0000
commit14bd073f1df3eab21fd5d6f7b464221c2d170745 (patch)
tree66e2d41aef1186e44af9f91bcc1064f072c36f1b
parent4901bf50fb6a71872b0cd726534a95da736ca5c0 (diff)
PF_8A8R8G8B pixel format (Dave Reveman)
-rw-r--r--src/mesa/drivers/x11/xm_api.c9
-rw-r--r--src/mesa/drivers/x11/xm_line.c51
-rw-r--r--src/mesa/drivers/x11/xm_span.c242
-rw-r--r--src/mesa/drivers/x11/xm_tri.c118
-rw-r--r--src/mesa/drivers/x11/xmesaP.h9
5 files changed, 423 insertions, 6 deletions
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 1249ba9b2d..d714b555b0 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -1113,7 +1113,10 @@ static void setup_truecolor( XMesaVisual v, XMesaBuffer buffer,
&& sizeof(GLuint)==4
&& v->RedGamma==1.0 && v->GreenGamma==1.0 && v->BlueGamma==1.0) {
/* common 32 bpp config used on Linux, HP, IBM */
- v->undithered_pf = v->dithered_pf = PF_8R8G8B;
+ if (GET_VISUAL_DEPTH(v)==32)
+ v->undithered_pf = v->dithered_pf = PF_8A8R8G8B;
+ else
+ v->undithered_pf = v->dithered_pf = PF_8R8G8B;
}
else if (GET_REDMASK(v) ==0xff0000
&& GET_GREENMASK(v)==0x00ff00
@@ -1368,6 +1371,8 @@ xmesa_color_to_pixel( XMesaContext xmesa, GLubyte r, GLubyte g, GLubyte b, GLuby
}
case PF_8A8B8G8R:
return PACK_8A8B8G8R( r, g, b, a );
+ case PF_8A8R8G8B:
+ return PACK_8A8R8G8B( r, g, b, a );
case PF_8R8G8B:
/* fall through */
case PF_8R8G8B24:
@@ -2621,6 +2626,8 @@ unsigned long XMesaDitherColor( XMesaContext xmesa, GLint x, GLint y,
}
case PF_8A8B8G8R:
return PACK_8A8B8G8R( r, g, b, a );
+ case PF_8A8R8G8B:
+ return PACK_8A8R8G8B( r, g, b, a );
case PF_8R8G8B:
return PACK_8R8G8B( r, g, b );
case PF_5R6G5B:
diff --git a/src/mesa/drivers/x11/xm_line.c b/src/mesa/drivers/x11/xm_line.c
index ccb54a391c..5cd5cf7a54 100644
--- a/src/mesa/drivers/x11/xm_line.c
+++ b/src/mesa/drivers/x11/xm_line.c
@@ -1,8 +1,9 @@
+
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 5.1
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -151,6 +152,23 @@ void xmesa_choose_point( GLcontext *ctx )
/*
+ * Draw a flat-shaded, PF_8A8R8G8B line into an XImage.
+ */
+#define NAME flat_8A8R8G8B_line
+#define SETUP_CODE \
+ XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ const GLubyte *color = vert1->color; \
+ GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] );
+#define PIXEL_TYPE GLuint
+#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
+#define CLIP_HACK 1
+#define PLOT(X,Y) *pixelPtr = pixel;
+#include "swrast/s_linetemp.h"
+
+
+
+/*
* Draw a flat-shaded, PF_8R8G8B line into an XImage.
*/
#define NAME flat_8R8G8B_line
@@ -322,6 +340,29 @@ void xmesa_choose_point( GLcontext *ctx )
/*
+ * Draw a flat-shaded, Z-less, PF_8A8R8G8B line into an XImage.
+ */
+#define NAME flat_8A8R8G8B_z_line
+#define SETUP_CODE \
+ XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ const GLubyte *color = vert1->color; \
+ GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] );
+#define INTERP_Z 1
+#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
+#define PIXEL_TYPE GLuint
+#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
+#define CLIP_HACK 1
+#define PLOT(X,Y) \
+ if (Z < *zPtr) { \
+ *zPtr = Z; \
+ *pixelPtr = pixel; \
+ }
+#include "swrast/s_linetemp.h"
+
+
+
+/*
* Draw a flat-shaded, Z-less, PF_8R8G8B line into an XImage.
*/
#define NAME flat_8R8G8B_z_line
@@ -491,7 +532,7 @@ static swrast_line_func get_line_func( GLcontext *ctx )
SWcontext *swrast = SWRAST_CONTEXT(ctx);
int depth = GET_VISUAL_DEPTH(xmesa->xm_visual);
- if ((ctx->Color._DrawDestMask[0] & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) ==0)
+ if ((ctx->Color._DrawDestMask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) ==0)
return (swrast_line_func) NULL;
if (ctx->RenderMode != GL_RENDER) return (swrast_line_func) NULL;
if (ctx->Line.SmoothFlag) return (swrast_line_func) NULL;
@@ -511,6 +552,8 @@ static swrast_line_func get_line_func( GLcontext *ctx )
return flat_TRUECOLOR_z_line;
case PF_8A8B8G8R:
return flat_8A8B8G8R_z_line;
+ case PF_8A8R8G8B:
+ return flat_8A8R8G8B_z_line;
case PF_8R8G8B:
return flat_8R8G8B_z_line;
case PF_8R8G8B24:
@@ -537,6 +580,8 @@ static swrast_line_func get_line_func( GLcontext *ctx )
return flat_TRUECOLOR_line;
case PF_8A8B8G8R:
return flat_8A8B8G8R_line;
+ case PF_8A8R8G8B:
+ return flat_8A8R8G8B_line;
case PF_8R8G8B:
return flat_8R8G8B_line;
case PF_8R8G8B24:
diff --git a/src/mesa/drivers/x11/xm_span.c b/src/mesa/drivers/x11/xm_span.c
index e8813681b0..0783ba3fc2 100644
--- a/src/mesa/drivers/x11/xm_span.c
+++ b/src/mesa/drivers/x11/xm_span.c
@@ -374,6 +374,69 @@ static void write_span_rgb_8A8B8G8R_pixmap( RGB_SPAN_ARGS )
}
}
+/*
+ * Write a span of PF_8A8R8G8B pixels to a pixmap.
+ */
+static void write_span_8A8R8G8B_pixmap( RGBA_SPAN_ARGS )
+{
+ const XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ XMesaDisplay *dpy = xmesa->xm_visual->display;
+ XMesaDrawable buffer = xmesa->xm_buffer->buffer;
+ XMesaGC gc = xmesa->xm_buffer->gc;
+ register GLuint i;
+ y = FLIP(xmesa->xm_buffer, y);
+ if (mask) {
+ for (i=0;i<n;i++,x++) {
+ if (mask[i]) {
+ XMesaSetForeground( dpy, gc,
+ PACK_8A8R8G8B(rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP], rgba[i][ACOMP]) );
+ XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y );
+ }
+ }
+ }
+ else {
+ /* draw all pixels */
+ XMesaImage *rowimg = xmesa->xm_buffer->rowimage;
+ register GLuint *ptr4 = (GLuint *) rowimg->data;
+ for (i=0;i<n;i++) {
+ *ptr4++ = PACK_8A8R8G8B( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP], rgba[i][ACOMP] );
+ }
+ XMesaPutImage( dpy, buffer, gc, rowimg, 0, 0, x, y, n, 1 );
+ }
+}
+
+
+/*
+ * Write a span of PF_8A8R8G8B pixels to a pixmap (no alpha).
+ */
+static void write_span_rgb_8A8R8G8B_pixmap( RGB_SPAN_ARGS )
+{
+ const XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ XMesaDisplay *dpy = xmesa->xm_visual->display;
+ XMesaDrawable buffer = xmesa->xm_buffer->buffer;
+ XMesaGC gc = xmesa->xm_buffer->gc;
+ register GLuint i;
+ y = FLIP(xmesa->xm_buffer, y);
+ if (mask) {
+ for (i=0;i<n;i++,x++) {
+ if (mask[i]) {
+ XMesaSetForeground( dpy, gc,
+ PACK_8R8G8B(rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]) );
+ XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y );
+ }
+ }
+ }
+ else {
+ /* draw all pixels */
+ XMesaImage *rowimg = xmesa->xm_buffer->rowimage;
+ register GLuint *ptr4 = (GLuint *) rowimg->data;
+ for (i=0;i<n;i++) {
+ *ptr4++ = PACK_8R8G8B(rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]);
+ }
+ XMesaPutImage( dpy, buffer, gc, rowimg, 0, 0, x, y, n, 1 );
+ }
+}
+
/*
* Write a span of PF_8R8G8B pixels to a pixmap.
@@ -1231,6 +1294,53 @@ static void write_span_rgb_8A8B8G8R_ximage( RGB_SPAN_ARGS )
}
}
+/*
+ * Write a span of PF_8A8R8G8B-format pixels to an ximage.
+ */
+static void write_span_8A8R8G8B_ximage( RGBA_SPAN_ARGS )
+{
+ const XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ register GLuint i;
+ register GLuint *ptr = PIXELADDR4( xmesa->xm_buffer, x, y );
+ if (mask) {
+ for (i=0;i<n;i++) {
+ if (mask[i]) {
+ ptr[i] = PACK_8A8R8G8B( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP], rgba[i][ACOMP] );
+ }
+ }
+ }
+ else {
+ /* draw all pixels */
+ for (i=0;i<n;i++) {
+ ptr[i] = PACK_8A8R8G8B( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP], rgba[i][ACOMP] );
+ }
+ }
+}
+
+
+/*
+ * Write a span of PF_8A8R8G8B-format pixels to an ximage (no alpha).
+ */
+static void write_span_rgb_8A8R8G8B_ximage( RGB_SPAN_ARGS )
+{
+ const XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ register GLuint i;
+ register GLuint *ptr = PIXELADDR4( xmesa->xm_buffer, x, y );
+ if (mask) {
+ for (i=0;i<n;i++) {
+ if (mask[i]) {
+ ptr[i] = PACK_8A8R8G8B( rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP], 255 );
+ }
+ }
+ }
+ else {
+ /* draw all pixels */
+ for (i=0;i<n;i++) {
+ ptr[i] = PACK_8A8R8G8B( rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP], 255 );
+ }
+ }
+}
+
/*
* Write a span of PF_8R8G8B-format pixels to an ximage.
@@ -2091,6 +2201,24 @@ static void write_pixels_8A8B8G8R_pixmap( RGBA_PIXEL_ARGS )
}
}
+/*
+ * Write an array of PF_8A8R8G8B pixels to a pixmap.
+ */
+static void write_pixels_8A8R8G8B_pixmap( RGBA_PIXEL_ARGS )
+{
+ const XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ XMesaDisplay *dpy = xmesa->xm_visual->display;
+ XMesaDrawable buffer = xmesa->xm_buffer->buffer;
+ XMesaGC gc = xmesa->xm_buffer->gc;
+ register GLuint i;
+ for (i=0;i<n;i++) {
+ if (mask[i]) {
+ XMesaSetForeground( dpy, gc,
+ PACK_8A8R8G8B( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP], rgba[i][ACOMP] ));
+ XMesaDrawPoint( dpy, buffer, gc, (int) x[i], (int) FLIP(xmesa->xm_buffer, y[i]) );
+ }
+ }
+}
/*
* Write an array of PF_8R8G8B pixels to a pixmap.
@@ -2322,6 +2450,21 @@ static void write_pixels_8A8B8G8R_ximage( RGBA_PIXEL_ARGS )
}
}
+/*
+ * Write an array of PF_8A8R8G8B pixels to an ximage.
+ */
+static void write_pixels_8A8R8G8B_ximage( RGBA_PIXEL_ARGS )
+{
+ const XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ register GLuint i;
+ for (i=0;i<n;i++) {
+ if (mask[i]) {
+ GLuint *ptr = PIXELADDR4( xmesa->xm_buffer, x[i], y[i] );
+ *ptr = PACK_8A8R8G8B( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP], rgba[i][ACOMP] );
+ }
+ }
+}
+
/*
* Write an array of PF_8R8G8B pixels to an ximage.
@@ -2750,6 +2893,23 @@ static void write_span_mono_8A8B8G8R_ximage( MONO_SPAN_ARGS )
}
}
+/*
+ * Write a span of identical 8A8R8G8B pixels to an XImage.
+ */
+static void write_span_mono_8A8R8G8B_ximage( MONO_SPAN_ARGS )
+{
+ const XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ GLuint i, *ptr;
+ const unsigned long pixel = xmesa_color_to_pixel(xmesa, color[RCOMP],
+ color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat);
+ ptr = PIXELADDR4( xmesa->xm_buffer, x, y );
+ for (i=0;i<n;i++) {
+ if (mask[i]) {
+ ptr[i] = pixel;
+ }
+ }
+}
+
/*
* Write a span of identical 8R8G8B pixels to an XImage.
@@ -3105,6 +3265,22 @@ static void write_pixels_mono_8A8B8G8R_ximage( MONO_PIXEL_ARGS )
}
}
+/*
+ * Write an array of identical 8A8R8G8B pixels to an XImage
+ */
+static void write_pixels_mono_8A8R8G8B_ximage( MONO_PIXEL_ARGS )
+{
+ const XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ const GLuint p = PACK_8A8R8G8B(color[RCOMP], color[GCOMP],
+ color[BCOMP], color[ACOMP]);
+ register GLuint i;
+ for (i=0;i<n;i++) {
+ if (mask[i]) {
+ GLuint *ptr = PIXELADDR4( xmesa->xm_buffer, x[i], y[i] );
+ *ptr = p;
+ }
+ }
+}
/*
* Write an array of identical 8R8G8B pixels to an XImage.
@@ -3648,6 +3824,19 @@ static void read_color_span( const GLcontext *ctx,
}
}
break;
+ case PF_8A8R8G8B:
+ {
+ const GLuint *ptr4 = (GLuint *) span->data;
+ GLuint i;
+ for (i=0;i<n;i++) {
+ GLuint p4 = *ptr4++;
+ rgba[i][RCOMP] = (GLubyte) ((p4 >> 16) & 0xff);
+ rgba[i][GCOMP] = (GLubyte) ((p4 >> 8) & 0xff);
+ rgba[i][BCOMP] = (GLubyte) ( p4 & 0xff);
+ rgba[i][ACOMP] = (GLubyte) ((p4 >> 24) & 0xff);
+ }
+ }
+ break;
case PF_8R8G8B:
{
const GLuint *ptr4 = (GLuint *) span->data;
@@ -3835,6 +4024,19 @@ static void read_color_span( const GLcontext *ctx,
}
}
break;
+ case PF_8A8R8G8B:
+ {
+ const GLuint *ptr4 = PIXELADDR4( source, x, y );
+ GLuint i;
+ for (i=0;i<n;i++) {
+ GLuint p4 = *ptr4++;
+ rgba[i][RCOMP] = (GLubyte) ((p4 >> 16) & 0xff);
+ rgba[i][GCOMP] = (GLubyte) ((p4 >> 8) & 0xff);
+ rgba[i][BCOMP] = (GLubyte) ( p4 & 0xff);
+ rgba[i][ACOMP] = (GLint) ((p4 >> 24) & 0xff);
+ }
+ }
+ break;
case PF_8R8G8B:
{
const GLuint *ptr4 = PIXELADDR4( source, x, y );
@@ -4012,6 +4214,18 @@ static void read_color_pixels( const GLcontext *ctx,
}
}
break;
+ case PF_8A8R8G8B:
+ for (i=0;i<n;i++) {
+ if (mask[i]) {
+ unsigned long p = read_pixel( dpy, buffer,
+ x[i], FLIP(source, y[i]) );
+ rgba[i][RCOMP] = (GLubyte) ((p >> 16) & 0xff);
+ rgba[i][GCOMP] = (GLubyte) ((p >> 8) & 0xff);
+ rgba[i][BCOMP] = (GLubyte) ( p & 0xff);
+ rgba[i][ACOMP] = (GLubyte) ((p >> 24) & 0xff);
+ }
+ }
+ break;
case PF_8R8G8B:
for (i=0;i<n;i++) {
if (mask[i]) {
@@ -4130,6 +4344,18 @@ static void read_color_pixels( const GLcontext *ctx,
}
}
break;
+ case PF_8A8R8G8B:
+ for (i=0;i<n;i++) {
+ if (mask[i]) {
+ GLuint *ptr4 = PIXELADDR4( source, x[i], y[i] );
+ GLuint p4 = *ptr4;
+ rgba[i][RCOMP] = (GLubyte) ((p4 >> 16) & 0xff);
+ rgba[i][GCOMP] = (GLubyte) ((p4 >> 8) & 0xff);
+ rgba[i][BCOMP] = (GLubyte) ( p4 & 0xff);
+ rgba[i][ACOMP] = (GLubyte) ((p4 >> 24) & 0xff);
+ }
+ }
+ break;
case PF_8R8G8B:
for (i=0;i<n;i++) {
if (mask[i]) {
@@ -4324,6 +4550,13 @@ void xmesa_update_span_funcs( GLcontext *ctx )
dd->WriteRGBAPixels = write_pixels_8A8B8G8R_pixmap;
dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap;
break;
+ case PF_8A8R8G8B:
+ dd->WriteRGBASpan = write_span_8A8R8G8B_pixmap;
+ dd->WriteRGBSpan = write_span_rgb_8A8R8G8B_pixmap;
+ dd->WriteMonoRGBASpan = write_span_mono_pixmap;
+ dd->WriteRGBAPixels = write_pixels_8A8R8G8B_pixmap;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap;
+ break;
case PF_8R8G8B:
dd->WriteRGBASpan = write_span_8R8G8B_pixmap;
dd->WriteRGBSpan = write_span_rgb_8R8G8B_pixmap;
@@ -4430,7 +4663,14 @@ void xmesa_update_span_funcs( GLcontext *ctx )
dd->WriteRGBAPixels = write_pixels_8A8B8G8R_ximage;
dd->WriteMonoRGBAPixels = write_pixels_mono_8A8B8G8R_ximage;
break;
- case PF_8R8G8B:
+ case PF_8A8R8G8B:
+ dd->WriteRGBASpan = write_span_8A8R8G8B_ximage;
+ dd->WriteRGBSpan = write_span_rgb_8A8R8G8B_ximage;
+ dd->WriteMonoRGBASpan = write_span_mono_8A8R8G8B_ximage;
+ dd->WriteRGBAPixels = write_pixels_8A8R8G8B_ximage;
+ dd->WriteMonoRGBAPixels = write_pixels_mono_8A8R8G8B_ximage;
+ break;
+ case PF_8R8G8B:
dd->WriteRGBASpan = write_span_8R8G8B_ximage;
dd->WriteRGBSpan = write_span_rgb_8R8G8B_ximage;
dd->WriteMonoRGBASpan = write_span_mono_8R8G8B_ximage;
diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c
index 970fb0e477..9a71f917dc 100644
--- a/src/mesa/drivers/x11/xm_tri.c
+++ b/src/mesa/drivers/x11/xm_tri.c
@@ -118,6 +118,38 @@
/*
+ * XImage, smooth, depth-buffered, PF_8A8R8G8B triangle.
+ */
+#define NAME smooth_8A8R8G8B_z_triangle
+#define INTERP_Z 1
+#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
+#define INTERP_RGB 1
+#define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
+#define PIXEL_TYPE GLuint
+#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define SETUP_CODE \
+ XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+
+#define RENDER_SPAN( span ) \
+ GLuint i; \
+ for (i = 0; i < span.end; i++) { \
+ const DEPTH_TYPE z = FixedToDepth(span.z); \
+ if (z < zRow[i]) { \
+ pRow[i] = PACK_8R8G8B(FixedToInt(span.red), \
+ FixedToInt(span.green), FixedToInt(span.blue)); \
+ zRow[i] = z; \
+ } \
+ span.red += span.redStep; \
+ span.green += span.greenStep; \
+ span.blue += span.blueStep; \
+ span.z += span.zStep; \
+ }
+
+#include "swrast/s_tritemp.h"
+
+
+
+/*
* XImage, smooth, depth-buffered, PF_8R8G8B triangle.
*/
#define NAME smooth_8R8G8B_z_triangle
@@ -452,6 +484,33 @@
/*
+ * XImage, flat, depth-buffered, PF_8A8R8G8B triangle.
+ */
+#define NAME flat_8A8R8G8B_z_triangle
+#define INTERP_Z 1
+#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
+#define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
+#define PIXEL_TYPE GLuint
+#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define SETUP_CODE \
+ XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ unsigned long p = PACK_8R8G8B( v2->color[0], \
+ v2->color[1], v2->color[2] );
+#define RENDER_SPAN( span ) \
+ GLuint i; \
+ for (i = 0; i < span.end; i++) { \
+ const DEPTH_TYPE z = FixedToDepth(span.z); \
+ if (z < zRow[i]) { \
+ pRow[i] = (PIXEL_TYPE) p; \
+ zRow[i] = z; \
+ } \
+ span.z += span.zStep; \
+ }
+#include "swrast/s_tritemp.h"
+
+
+
+/*
* XImage, flat, depth-buffered, PF_8R8G8B triangle.
*/
#define NAME flat_8R8G8B_z_triangle
@@ -751,6 +810,29 @@
/*
+ * XImage, smooth, NON-depth-buffered, PF_8A8R8G8B triangle.
+ */
+#define NAME smooth_8A8R8G8B_triangle
+#define INTERP_RGB 1
+#define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
+#define PIXEL_TYPE GLuint
+#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define SETUP_CODE \
+ XMesaContext xmesa = XMESA_CONTEXT(ctx);
+#define RENDER_SPAN( span ) \
+ GLuint i; \
+ for (i = 0; i < span.end; i++) { \
+ pRow[i] = PACK_8R8G8B(FixedToInt(span.red), \
+ FixedToInt(span.green), FixedToInt(span.blue) ); \
+ span.red += span.redStep; \
+ span.green += span.greenStep; \
+ span.blue += span.blueStep; \
+ }
+#include "swrast/s_tritemp.h"
+
+
+
+/*
* XImage, smooth, NON-depth-buffered, PF_8R8G8B triangle.
*/
#define NAME smooth_8R8G8B_triangle
@@ -1006,6 +1088,26 @@
/*
+ * XImage, flat, NON-depth-buffered, PF_8A8R8G8B triangle.
+ */
+#define NAME flat_8A8R8G8B_triangle
+#define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
+#define PIXEL_TYPE GLuint
+#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define SETUP_CODE \
+ XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ unsigned long p = PACK_8R8G8B( v2->color[0], \
+ v2->color[1], v2->color[2] );
+#define RENDER_SPAN( span ) \
+ GLuint i; \
+ for (i = 0; i < span.end; i++) { \
+ pRow[i] = (PIXEL_TYPE) p; \
+ }
+#include "swrast/s_tritemp.h"
+
+
+
+/*
* XImage, flat, NON-depth-buffered, PF_8R8G8B triangle.
*/
#define NAME flat_8R8G8B_triangle
@@ -1203,6 +1305,8 @@ void _xmesa_print_triangle_func( swrast_tri_func triFunc )
_mesa_printf("smooth_TRUECOLOR_z_triangle\n");
else if (triFunc ==smooth_8A8B8G8R_z_triangle)
_mesa_printf("smooth_8A8B8G8R_z_triangle\n");
+ else if (triFunc ==smooth_8A8R8G8B_z_triangle)
+ _mesa_printf("smooth_8A8R8G8B_z_triangle\n");
else if (triFunc ==smooth_8R8G8B_z_triangle)
_mesa_printf("smooth_8R8G8B_z_triangle\n");
else if (triFunc ==smooth_8R8G8B24_z_triangle)
@@ -1223,6 +1327,8 @@ void _xmesa_print_triangle_func( swrast_tri_func triFunc )
_mesa_printf("flat_TRUECOLOR_z_triangle\n");
else if (triFunc ==flat_8A8B8G8R_z_triangle)
_mesa_printf("flat_8A8B8G8R_z_triangle\n");
+ else if (triFunc ==flat_8A8R8G8B_z_triangle)
+ _mesa_printf("flat_8A8R8G8B_z_triangle\n");
else if (triFunc ==flat_8R8G8B_z_triangle)
_mesa_printf("flat_8R8G8B_z_triangle\n");
else if (triFunc ==flat_8R8G8B24_z_triangle)
@@ -1243,6 +1349,8 @@ void _xmesa_print_triangle_func( swrast_tri_func triFunc )
_mesa_printf("smooth_TRUECOLOR_triangle\n");
else if (triFunc ==smooth_8A8B8G8R_triangle)
_mesa_printf("smooth_8A8B8G8R_triangle\n");
+ else if (triFunc ==smooth_8A8R8G8B_triangle)
+ _mesa_printf("smooth_8A8R8G8B_triangle\n");
else if (triFunc ==smooth_8R8G8B_triangle)
_mesa_printf("smooth_8R8G8B_triangle\n");
else if (triFunc ==smooth_8R8G8B24_triangle)
@@ -1265,6 +1373,8 @@ void _xmesa_print_triangle_func( swrast_tri_func triFunc )
_mesa_printf("flat_TRUEDITHER_triangle\n");
else if (triFunc ==flat_8A8B8G8R_triangle)
_mesa_printf("flat_8A8B8G8R_triangle\n");
+ else if (triFunc ==flat_8A8R8G8B_triangle)
+ _mesa_printf("flat_8A8R8G8B_triangle\n");
else if (triFunc ==flat_8R8G8B_triangle)
_mesa_printf("flat_8R8G8B_triangle\n");
else if (triFunc ==flat_8R8G8B24_triangle)
@@ -1335,6 +1445,8 @@ static swrast_tri_func get_triangle_func( GLcontext *ctx )
USE(smooth_TRUECOLOR_z_triangle);
case PF_8A8B8G8R:
USE(smooth_8A8B8G8R_z_triangle);
+ case PF_8A8R8G8B:
+ USE(smooth_8A8R8G8B_z_triangle);
case PF_8R8G8B:
USE(smooth_8R8G8B_z_triangle);
case PF_8R8G8B24:
@@ -1372,6 +1484,8 @@ static swrast_tri_func get_triangle_func( GLcontext *ctx )
USE(flat_TRUECOLOR_z_triangle);
case PF_8A8B8G8R:
USE(flat_8A8B8G8R_z_triangle);
+ case PF_8A8R8G8B:
+ USE(flat_8A8R8G8B_z_triangle);
case PF_8R8G8B:
USE(flat_8R8G8B_z_triangle);
case PF_8R8G8B24:
@@ -1406,6 +1520,8 @@ static swrast_tri_func get_triangle_func( GLcontext *ctx )
USE(smooth_TRUECOLOR_triangle);
case PF_8A8B8G8R:
USE(smooth_8A8B8G8R_triangle);
+ case PF_8A8R8G8B:
+ USE(smooth_8A8R8G8B_triangle);
case PF_8R8G8B:
USE(smooth_8R8G8B_triangle);
case PF_8R8G8B24:
@@ -1443,6 +1559,8 @@ static swrast_tri_func get_triangle_func( GLcontext *ctx )
USE(flat_TRUEDITHER_triangle);
case PF_8A8B8G8R:
USE(flat_8A8B8G8R_triangle);
+ case PF_8A8R8G8B:
+ USE(flat_8A8R8G8B_triangle);
case PF_8R8G8B:
USE(flat_8R8G8B_triangle);
case PF_8R8G8B24:
diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h
index b6fa3a1e1d..455d7afebf 100644
--- a/src/mesa/drivers/x11/xmesaP.h
+++ b/src/mesa/drivers/x11/xmesaP.h
@@ -74,7 +74,8 @@ enum pixel_format {
PF_1Bit, /**< monochrome dithering of RGB */
PF_Grayscale, /**< Grayscale or StaticGray */
PF_8R8G8B24, /**< 24-bit TrueColor: 8-R, 8-G, 8-B bits */
- PF_Dither_5R6G5B /**< 16-bit dithered TrueColor: 5-R, 6-G, 5-B */
+ PF_Dither_5R6G5B, /**< 16-bit dithered TrueColor: 5-R, 6-G, 5-B */
+ PF_8A8R8G8B /**< 32-bit TrueColor: 8-A, 8-R, 8-G, 8-B */
};
@@ -305,6 +306,12 @@ struct xmesa_buffer {
#define PACK_5R6G5B( R, G, B) ( (((R) & 0xf8) << 8) | (((G) & 0xfc) << 3) | ((B) >> 3) )
+/*
+ * If pixelformat==PF_8A8R8G8B:
+ */
+#define PACK_8A8R8G8B( R, G, B, A ) \
+ ( ((A) << 24) | ((R) << 16) | ((G) << 8) | (B) )
+
/*