aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/x11/xm_tri.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2005-05-04 20:11:35 +0000
committerBrian Paul <[email protected]>2005-05-04 20:11:35 +0000
commite4b2356c07d31fbeeabb13b2fb47db703b473080 (patch)
treed8b7f1c7c9e7c84d84349485f942dd205dd4c16d /src/mesa/drivers/x11/xm_tri.c
parentebef61f5c0950572f9c6a81b08f447957461675c (diff)
Major check-in of changes for GL_EXT_framebuffer_object extension.
Main driver impacts: - new code for creating the Mesa GLframebuffer - new span/pixel read/write code Some drivers not yet updated/tested.
Diffstat (limited to 'src/mesa/drivers/x11/xm_tri.c')
-rw-r--r--src/mesa/drivers/x11/xm_tri.c337
1 files changed, 178 insertions, 159 deletions
diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c
index 8fd22ccf4e8..8b5c39392a9 100644
--- a/src/mesa/drivers/x11/xm_tri.c
+++ b/src/mesa/drivers/x11/xm_tri.c
@@ -44,6 +44,9 @@
#include "swrast/s_triangle.h"
+#define GET_XRB(XRB) struct xmesa_renderbuffer *XRB = \
+ (struct xmesa_renderbuffer *) ctx->DrawBuffer->_ColorDrawBuffers[0][0]
+
/**********************************************************************/
/*** Triangle rendering ***/
@@ -59,10 +62,10 @@
#define INTERP_RGB 1
#define SETUP_CODE \
XMesaContext xmesa = XMESA_CONTEXT(ctx); \
- XMesaImage *img = xmesa->xm_buffer->backimage;
+ GET_XRB(xrb);
#define RENDER_SPAN( span ) \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
GLuint i; \
for (i = 0; i < span.end; i++, x++) { \
const DEPTH_TYPE z = FixedToDepth(span.z); \
@@ -70,7 +73,7 @@
unsigned long p; \
PACK_TRUECOLOR(p, FixedToInt(span.red), \
FixedToInt(span.green), FixedToInt(span.blue)); \
- XMesaPutPixel(img, x, y, p); \
+ XMesaPutPixel(xrb->ximage, x, y, p); \
zRow[i] = z; \
} \
span.red += span.redStep; \
@@ -91,12 +94,11 @@
#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_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y)
#define PIXEL_TYPE GLuint
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx); \
-
+ GET_XRB(xrb);
#define RENDER_SPAN( span ) \
GLuint i; \
for (i = 0; i < span.end; i++) { \
@@ -123,11 +125,11 @@
#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_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y)
#define PIXEL_TYPE GLuint
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ GET_XRB(xrb);
#define RENDER_SPAN( span ) \
GLuint i; \
@@ -155,11 +157,11 @@
#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_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y)
#define PIXEL_TYPE GLuint
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ GET_XRB(xrb);
#define RENDER_SPAN( span ) \
GLuint i; \
@@ -187,11 +189,11 @@
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define INTERP_RGB 1
-#define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR3(xrb, X, Y)
#define PIXEL_TYPE bgr_t
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ GET_XRB(xrb);
#define RENDER_SPAN( span ) \
GLuint i; \
for (i = 0; i < span.end; i++) { \
@@ -221,17 +223,17 @@
#define INTERP_RGB 1
#define SETUP_CODE \
XMesaContext xmesa = XMESA_CONTEXT(ctx); \
- XMesaImage *img = xmesa->xm_buffer->backimage;
+ GET_XRB(xrb);
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
for (i = 0; i < span.end; i++, x++) { \
const DEPTH_TYPE z = FixedToDepth(span.z); \
if (z < zRow[i]) { \
unsigned long p; \
PACK_TRUEDITHER(p, x, y, FixedToInt(span.red), \
FixedToInt(span.green), FixedToInt(span.blue)); \
- XMesaPutPixel(img, x, y, p); \
+ XMesaPutPixel(xrb->ximage, x, y, p); \
zRow[i] = z; \
} \
span.red += span.redStep; \
@@ -250,11 +252,11 @@
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define INTERP_RGB 1
-#define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y)
#define PIXEL_TYPE GLushort
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ GET_XRB(xrb);
#define RENDER_SPAN( span ) \
GLuint i; \
for (i = 0; i < span.end; i++) { \
@@ -280,14 +282,15 @@
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define INTERP_RGB 1
-#define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y)
#define PIXEL_TYPE GLushort
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ GET_XRB(xrb);
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
for (i = 0; i < span.end; i++, x++) { \
const DEPTH_TYPE z = FixedToDepth(span.z); \
if (z < zRow[i]) { \
@@ -311,14 +314,14 @@
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define INTERP_RGB 1
-#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y)
#define PIXEL_TYPE GLubyte
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ GET_XRB(xrb);
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
XDITHER_SETUP(y); \
for (i = 0; i < span.end; i++, x++) { \
const DEPTH_TYPE z = FixedToDepth(span.z); \
@@ -344,11 +347,11 @@
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define INTERP_RGB 1
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx); \
- XMesaImage *img = xmesa->xm_buffer->backimage;
+ GET_XRB(xrb); \
+ XMesaImage *img = xrb->ximage;
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
XDITHER_SETUP(y); \
for (i = 0; i < span.end; i++, x++) { \
const DEPTH_TYPE z = FixedToDepth(span.z); \
@@ -374,11 +377,11 @@
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define INTERP_RGB 1
-#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y)
#define PIXEL_TYPE GLubyte
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ GET_XRB(xrb);
#define RENDER_SPAN( span ) \
GLuint i; \
LOOKUP_SETUP; \
@@ -405,14 +408,15 @@
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define INTERP_RGB 1
-#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y)
#define PIXEL_TYPE GLubyte
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ GET_XRB(xrb);
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
for (i = 0; i < span.end; i++, x++) { \
const DEPTH_TYPE z = FixedToDepth(span.z); \
if (z < zRow[i]) { \
@@ -437,12 +441,13 @@
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define SETUP_CODE \
XMesaContext xmesa = XMESA_CONTEXT(ctx); \
- XMesaImage *img = xmesa->xm_buffer->backimage; \
+ GET_XRB(xrb); \
+ XMesaImage *img = xrb->ximage; \
unsigned long pixel; \
PACK_TRUECOLOR(pixel, v2->color[0], v2->color[1], v2->color[2]);
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
for (i = 0; i < span.end; i++, x++) { \
const DEPTH_TYPE z = FixedToDepth(span.z); \
if (z < zRow[i]) { \
@@ -461,13 +466,12 @@
#define NAME flat_8A8B8G8R_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_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y)
#define PIXEL_TYPE GLuint
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx); \
- unsigned long p = PACK_8B8G8R( v2->color[0], \
- v2->color[1], v2->color[2] );
+ GET_XRB(xrb); \
+ GLuint p = PACK_8B8G8R( v2->color[0], v2->color[1], v2->color[2] );
#define RENDER_SPAN( span ) \
GLuint i; \
for (i = 0; i < span.end; i++) { \
@@ -488,13 +492,12 @@
#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_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y)
#define PIXEL_TYPE GLuint
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->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] );
+ GET_XRB(xrb); \
+ GLuint 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++) { \
@@ -515,13 +518,12 @@
#define NAME flat_8R8G8B_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_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y)
#define PIXEL_TYPE GLuint
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->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] );
+ GET_XRB(xrb); \
+ GLuint 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++) { \
@@ -529,9 +531,12 @@
if (z < zRow[i]) { \
pRow[i] = (PIXEL_TYPE) p; \
zRow[i] = z; \
+ if (span.y == 100) printf("pass\n");\
} \
+ else if (span.y == 100) printf("fail\n");\
span.z += span.zStep; \
}
+
#include "swrast/s_tritemp.h"
@@ -542,11 +547,11 @@
#define NAME flat_8R8G8B24_z_triangle
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
-#define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR3(xrb, X, Y)
#define PIXEL_TYPE bgr_t
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ GET_XRB(xrb); \
const GLubyte *color = v2->color;
#define RENDER_SPAN( span ) \
GLuint i; \
@@ -573,10 +578,11 @@
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define SETUP_CODE \
XMesaContext xmesa = XMESA_CONTEXT(ctx); \
- XMesaImage *img = xmesa->xm_buffer->backimage;
+ GET_XRB(xrb); \
+ XMesaImage *img = xrb->ximage;
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
for (i = 0; i < span.end; i++, x++) { \
const DEPTH_TYPE z = FixedToDepth(span.z); \
if (z < zRow[i]) { \
@@ -598,13 +604,12 @@
#define NAME flat_5R6G5B_z_triangle
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
-#define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y)
#define PIXEL_TYPE GLushort
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx); \
- unsigned long p = PACK_5R6G5B( v2->color[0], \
- v2->color[1], v2->color[2] );
+ GET_XRB(xrb); \
+ GLushort p = PACK_5R6G5B( v2->color[0], v2->color[1], v2->color[2] );
#define RENDER_SPAN( span ) \
GLuint i; \
for (i = 0; i < span.end; i++) { \
@@ -625,15 +630,16 @@
#define NAME flat_DITHER_5R6G5B_z_triangle
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
-#define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y)
#define PIXEL_TYPE GLushort
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ GET_XRB(xrb); \
const GLubyte *color = v2->color;
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
for (i = 0; i < span.end; i++, x++) { \
const DEPTH_TYPE z = FixedToDepth(span.z); \
if (z < zRow[i]) { \
@@ -653,16 +659,16 @@
#define NAME flat_DITHER8_z_triangle
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
-#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y)
#define PIXEL_TYPE GLubyte
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ GET_XRB(xrb); \
FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] );
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
- FLAT_DITHER_ROW_SETUP(FLIP(xmesa->xm_buffer, y)); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
+ FLAT_DITHER_ROW_SETUP(YFLIP(xrb, y)); \
for (i = 0; i < span.end; i++, x++) { \
const DEPTH_TYPE z = FixedToDepth(span.z); \
if (z < zRow[i]) { \
@@ -682,12 +688,12 @@
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx); \
- XMesaImage *img = xmesa->xm_buffer->backimage; \
+ GET_XRB(xrb); \
+ XMesaImage *img = xrb->ximage; \
FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] );
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
FLAT_DITHER_ROW_SETUP(y); \
for (i = 0; i < span.end; i++, x++) { \
const DEPTH_TYPE z = FixedToDepth(span.z); \
@@ -708,17 +714,18 @@
#define NAME flat_HPCR_z_triangle
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
-#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y)
#define PIXEL_TYPE GLubyte
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ GET_XRB(xrb); \
GLubyte r = v2->color[0]; \
GLubyte g = v2->color[1]; \
GLubyte b = v2->color[2];
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
for (i = 0; i < span.end; i++, x++) { \
const DEPTH_TYPE z = FixedToDepth(span.z); \
if (z < zRow[i]) { \
@@ -737,11 +744,11 @@
#define NAME flat_LOOKUP8_z_triangle
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
-#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y)
#define PIXEL_TYPE GLubyte
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ GET_XRB(xrb); \
LOOKUP_SETUP; \
GLubyte r = v2->color[0]; \
GLubyte g = v2->color[1]; \
@@ -768,10 +775,11 @@
#define INTERP_RGB 1
#define SETUP_CODE \
XMesaContext xmesa = XMESA_CONTEXT(ctx); \
- XMesaImage *img = xmesa->xm_buffer->backimage;
+ GET_XRB(xrb); \
+ XMesaImage *img = xrb->ximage;
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
for (i = 0; i < span.end; i++, x++) { \
unsigned long p; \
PACK_TRUECOLOR(p, FixedToInt(span.red), \
@@ -790,11 +798,11 @@
*/
#define NAME smooth_8A8B8G8R_triangle
#define INTERP_RGB 1
-#define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y)
#define PIXEL_TYPE GLuint
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ GET_XRB(xrb);
#define RENDER_SPAN( span ) \
GLuint i; \
for (i = 0; i < span.end; i++) { \
@@ -813,11 +821,11 @@
*/
#define NAME smooth_8A8R8G8B_triangle
#define INTERP_RGB 1
-#define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y)
#define PIXEL_TYPE GLuint
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ GET_XRB(xrb);
#define RENDER_SPAN( span ) \
GLuint i; \
for (i = 0; i < span.end; i++) { \
@@ -836,11 +844,11 @@
*/
#define NAME smooth_8R8G8B_triangle
#define INTERP_RGB 1
-#define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y)
#define PIXEL_TYPE GLuint
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ GET_XRB(xrb);
#define RENDER_SPAN( span ) \
GLuint i; \
for (i = 0; i < span.end; i++) { \
@@ -859,11 +867,11 @@
*/
#define NAME smooth_8R8G8B24_triangle
#define INTERP_RGB 1
-#define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR3(xrb, X, Y)
#define PIXEL_TYPE bgr_t
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ GET_XRB(xrb);
#define RENDER_SPAN( span ) \
GLuint i; \
PIXEL_TYPE *pixel = pRow; \
@@ -886,10 +894,11 @@
#define INTERP_RGB 1
#define SETUP_CODE \
XMesaContext xmesa = XMESA_CONTEXT(ctx); \
- XMesaImage *img = xmesa->xm_buffer->backimage;
+ GET_XRB(xrb); \
+ XMesaImage *img = xrb->ximage;
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
for (i = 0; i < span.end; i++, x++) { \
unsigned long p; \
PACK_TRUEDITHER(p, x, y, FixedToInt(span.red), \
@@ -908,11 +917,11 @@
*/
#define NAME smooth_5R6G5B_triangle
#define INTERP_RGB 1
-#define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y)
#define PIXEL_TYPE GLushort
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ GET_XRB(xrb);
#define RENDER_SPAN( span ) \
GLuint i; \
for (i = 0; i < span.end; i++) { \
@@ -931,14 +940,15 @@
*/
#define NAME smooth_DITHER_5R6G5B_triangle
#define INTERP_RGB 1
-#define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y)
#define PIXEL_TYPE GLushort
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ GET_XRB(xrb);
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
for (i = 0; i < span.end; i++, x++) { \
PACK_TRUEDITHER(pRow[i], x, y, FixedToInt(span.red), \
FixedToInt(span.green), FixedToInt(span.blue)); \
@@ -955,14 +965,14 @@
*/
#define NAME smooth_DITHER8_triangle
#define INTERP_RGB 1
-#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y)
#define PIXEL_TYPE GLubyte
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ GET_XRB(xrb);
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
XDITHER_SETUP(y); \
for (i = 0; i < span.end; i++, x++) { \
pRow[i] = (PIXEL_TYPE) XDITHER(x, FixedToInt(span.red), \
@@ -981,11 +991,11 @@
#define NAME smooth_DITHER_triangle
#define INTERP_RGB 1
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx); \
- XMesaImage *img = xmesa->xm_buffer->backimage;
+ GET_XRB(xrb); \
+ XMesaImage *img = xrb->ximage;
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
XDITHER_SETUP(y); \
for (i = 0; i < span.end; i++, x++) { \
unsigned long p = XDITHER(x, FixedToInt(span.red), \
@@ -1004,11 +1014,11 @@
*/
#define NAME smooth_LOOKUP8_triangle
#define INTERP_RGB 1
-#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y)
#define PIXEL_TYPE GLubyte
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ GET_XRB(xrb);
#define RENDER_SPAN( span ) \
GLuint i; \
LOOKUP_SETUP; \
@@ -1028,14 +1038,15 @@
*/
#define NAME smooth_HPCR_triangle
#define INTERP_RGB 1
-#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y)
#define PIXEL_TYPE GLubyte
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ GET_XRB(xrb);
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
for (i = 0; i < span.end; i++, x++) { \
pRow[i] = DITHER_HPCR(x, y, FixedToInt(span.red), \
FixedToInt(span.green), FixedToInt(span.blue)); \
@@ -1053,12 +1064,13 @@
#define NAME flat_TRUECOLOR_triangle
#define SETUP_CODE \
XMesaContext xmesa = XMESA_CONTEXT(ctx); \
- XMesaImage *img = xmesa->xm_buffer->backimage; \
+ GET_XRB(xrb); \
+ XMesaImage *img = xrb->ximage; \
unsigned long pixel; \
PACK_TRUECOLOR(pixel, v2->color[0], v2->color[1], v2->color[2]);
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
for (i = 0; i < span.end; i++, x++) { \
XMesaPutPixel(img, x, y, pixel); \
}
@@ -1070,11 +1082,11 @@
* XImage, flat, NON-depth-buffered, PF_8A8B8G8R triangle.
*/
#define NAME flat_8A8B8G8R_triangle
-#define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y)
#define PIXEL_TYPE GLuint
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ GET_XRB(xrb); \
unsigned long p = PACK_8B8G8R( v2->color[0], \
v2->color[1], v2->color[2] );
#define RENDER_SPAN( span ) \
@@ -1090,11 +1102,11 @@
* 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_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y)
#define PIXEL_TYPE GLuint
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ GET_XRB(xrb); \
unsigned long p = PACK_8R8G8B( v2->color[0], \
v2->color[1], v2->color[2] );
#define RENDER_SPAN( span ) \
@@ -1110,11 +1122,11 @@
* XImage, flat, NON-depth-buffered, PF_8R8G8B triangle.
*/
#define NAME flat_8R8G8B_triangle
-#define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y)
#define PIXEL_TYPE GLuint
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ GET_XRB(xrb); \
unsigned long p = PACK_8R8G8B( v2->color[0], \
v2->color[1], v2->color[2] );
#define RENDER_SPAN( span ) \
@@ -1130,11 +1142,11 @@
* XImage, flat, NON-depth-buffered, PF_8R8G8B24 triangle.
*/
#define NAME flat_8R8G8B24_triangle
-#define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR3(xrb, X, Y)
#define PIXEL_TYPE bgr_t
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ GET_XRB(xrb); \
const GLubyte *color = v2->color;
#define RENDER_SPAN( span ) \
GLuint i; \
@@ -1154,10 +1166,11 @@
#define NAME flat_TRUEDITHER_triangle
#define SETUP_CODE \
XMesaContext xmesa = XMESA_CONTEXT(ctx); \
- XMesaImage *img = xmesa->xm_buffer->backimage;
+ GET_XRB(xrb); \
+ XMesaImage *img = xrb->ximage;
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
for (i = 0; i < span.end; i++, x++) { \
unsigned long p; \
PACK_TRUEDITHER(p, x, y, v2->color[0], \
@@ -1172,11 +1185,11 @@
* XImage, flat, NON-depth-buffered, PF_5R6G5B triangle.
*/
#define NAME flat_5R6G5B_triangle
-#define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y)
#define PIXEL_TYPE GLushort
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ GET_XRB(xrb); \
unsigned long p = PACK_5R6G5B( v2->color[0], \
v2->color[1], v2->color[2] );
#define RENDER_SPAN( span ) \
@@ -1192,15 +1205,16 @@
* XImage, flat, NON-depth-buffered, PF_DITHER_5R6G5B triangle.
*/
#define NAME flat_DITHER_5R6G5B_triangle
-#define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR2(xrb, X, Y)
#define PIXEL_TYPE GLushort
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ GET_XRB(xrb); \
const GLubyte *color = v2->color;
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
for (i = 0; i < span.end; i++, x++) { \
PACK_TRUEDITHER(pRow[i], x, y, color[RCOMP], \
color[GCOMP], color[BCOMP]); \
@@ -1213,16 +1227,16 @@
* XImage, flat, NON-depth-buffered, 8-bit PF_DITHER triangle.
*/
#define NAME flat_DITHER8_triangle
-#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y)
#define PIXEL_TYPE GLubyte
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ GET_XRB(xrb); \
FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] );
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
- FLAT_DITHER_ROW_SETUP(FLIP(xmesa->xm_buffer, y)); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
+ FLAT_DITHER_ROW_SETUP(YFLIP(xrb, y)); \
for (i = 0; i < span.end; i++, x++) { \
pRow[i] = (PIXEL_TYPE) FLAT_DITHER(x); \
}
@@ -1235,12 +1249,12 @@
*/
#define NAME flat_DITHER_triangle
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx); \
- XMesaImage *img = xmesa->xm_buffer->backimage; \
+ GET_XRB(xrb); \
+ XMesaImage *img = xrb->ximage; \
FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] );
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
FLAT_DITHER_ROW_SETUP(y); \
for (i = 0; i < span.end; i++, x++) { \
unsigned long p = FLAT_DITHER(x); \
@@ -1254,17 +1268,18 @@
* XImage, flat, NON-depth-buffered, 8-bit PF_HPCR triangle.
*/
#define NAME flat_HPCR_triangle
-#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y)
#define PIXEL_TYPE GLubyte
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ GET_XRB(xrb); \
GLubyte r = v2->color[0]; \
GLubyte g = v2->color[1]; \
GLubyte b = v2->color[2];
#define RENDER_SPAN( span ) \
GLuint i; \
- GLint x = span.x, y = FLIP(xmesa->xm_buffer, span.y); \
+ GLint x = span.x, y = YFLIP(xrb, span.y); \
for (i = 0; i < span.end; i++, x++) { \
pRow[i] = (PIXEL_TYPE) DITHER_HPCR(x, y, r, g, b); \
}
@@ -1276,11 +1291,11 @@
* XImage, flat, NON-depth-buffered, 8-bit PF_LOOKUP triangle.
*/
#define NAME flat_LOOKUP8_triangle
-#define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y)
+#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y)
#define PIXEL_TYPE GLubyte
-#define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line)
+#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define SETUP_CODE \
- XMesaContext xmesa = XMESA_CONTEXT(ctx); \
+ GET_XRB(xrb); \
LOOKUP_SETUP; \
GLubyte r = v2->color[0]; \
GLubyte g = v2->color[1]; \
@@ -1417,12 +1432,16 @@ static swrast_tri_func get_triangle_func( GLcontext *ctx )
SWcontext *swrast = SWRAST_CONTEXT(ctx);
XMesaContext xmesa = XMESA_CONTEXT(ctx);
int depth = GET_VISUAL_DEPTH(xmesa->xm_visual);
+ struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *)
+ ctx->DrawBuffer->_ColorDrawBuffers[0][0];
+ return NULL;
#ifdef DEBUG
triFuncName = NULL;
#endif
- if ((ctx->Color._DrawDestMask[0] & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) ==0)
+ if ((ctx->DrawBuffer->_ColorDrawBufferMask[0]
+ & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)) == 0)
return (swrast_tri_func) NULL;
if (ctx->RenderMode != GL_RENDER) return (swrast_tri_func) NULL;
if (ctx->Polygon.SmoothFlag) return (swrast_tri_func) NULL;
@@ -1432,7 +1451,7 @@ static swrast_tri_func get_triangle_func( GLcontext *ctx )
ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK)
return (swrast_tri_func) NULL;
- if (xmesa->xm_buffer->buffer==XIMAGE) {
+ if (xrb->ximage) {
if ( ctx->Light.ShadeModel==GL_SMOOTH
&& swrast->_RasterMask==DEPTH_BIT
&& ctx->Depth.Func==GL_LESS