summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/x11
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-04-12 01:41:04 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-04-12 01:41:04 +0000
commit41bddcfa7bbc65bcd2fc60ada9761d3065e71388 (patch)
treebe88ade73a1836d590915399c132b93c3ce324f0 /src/mesa/drivers/x11
parent55ba0dccc92797a0411ce315328100e28f6343b7 (diff)
PF_8A8R8G8B pixel format (Dave Reveman)
Diffstat (limited to 'src/mesa/drivers/x11')
-rw-r--r--src/mesa/drivers/x11/xm_api.c9
-rw-r--r--src/mesa/drivers/x11/xm_line.c44
-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, 419 insertions, 3 deletions
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 873d196c94..665b0bc829 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -1100,7 +1100,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
@@ -1349,6 +1352,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:
@@ -2616,6 +2621,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..24e09ce344 100644
--- a/src/mesa/drivers/x11/xm_line.c
+++ b/src/mesa/drivers/x11/xm_line.c
@@ -151,6 +151,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 +339,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
@@ -511,6 +551,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 +579,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 594554469c..397d596c0c 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 35d9d071f9..8fd22ccf4e 100644
--- a/src/mesa/drivers/x11/xm_tri.c
+++ b/src/mesa/drivers/x11/xm_tri.c
@@ -117,6 +117,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
@@ -451,6 +483,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
@@ -750,6 +809,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
@@ -1005,6 +1087,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
@@ -1202,6 +1304,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)
@@ -1222,6 +1326,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)
@@ -1242,6 +1348,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)
@@ -1264,6 +1372,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)
@@ -1334,6 +1444,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:
@@ -1371,6 +1483,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:
@@ -1405,6 +1519,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:
@@ -1442,6 +1558,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 de989260ae..43712ff21f 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 */
};
@@ -303,6 +304,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) )
+
/*