/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 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"),
#include "glxheader.h"
-#include "depth.h"
-#include "macros.h"
-#include "mtypes.h"
+#include "main/depth.h"
+#include "main/macros.h"
+#include "main/mtypes.h"
#include "xmesaP.h"
/* Internal swrast includes:
color[2], color[3],
xmesa->pixelformat);
XMesaSetForeground( dpy, gc, pixel );
- x = (GLint) vert->win[0];
+ x = (GLint) vert->win[0];
y = YFLIP( xrb, (GLint) vert->win[1] );
XMesaDrawPoint( dpy, buffer, gc, x, y);
}
/**********************************************************************/
+#if CHAN_BITS == 8
+
+
#define GET_XRB(XRB) struct xmesa_renderbuffer *XRB = \
- (struct xmesa_renderbuffer *) ctx->DrawBuffer->_ColorDrawBuffers[0][0]->Wrapped
+ xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped)
/*
#define SETUP_CODE \
GET_XRB(xrb); \
const GLubyte *color = vert1->color; \
- GLuint pixel = PACK_8B8G8R( color[0], color[1], color[2] );
+ GLuint pixel = PACK_8A8B8G8R(color[0], color[1], color[2], color[3]);
#define PIXEL_TYPE GLuint
#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y)
#define SETUP_CODE \
GET_XRB(xrb); \
const GLubyte *color = vert1->color; \
- GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] );
+ GLuint pixel = PACK_8A8R8G8B(color[0], color[1], color[2], color[3]);
#define PIXEL_TYPE GLuint
#define BYTES_PER_ROW (xrb->ximage->bytes_per_line)
#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR4(xrb, X, Y)
#define SETUP_CODE \
GET_XRB(xrb); \
const GLubyte *color = vert1->color; \
- GLuint pixel = PACK_8B8G8R( color[0], color[1], color[2] );
+ GLuint pixel = PACK_8A8B8G8R(color[0], color[1], color[2], color[3]);
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define PIXEL_TYPE GLuint
#define SETUP_CODE \
GET_XRB(xrb); \
const GLubyte *color = vert1->color; \
- GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] );
+ GLuint pixel = PACK_8A8R8G8B(color[0], color[1], color[2], color[3]);
#define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define PIXEL_TYPE GLuint
+
#ifndef XFree86Server
/**
* Draw fast, XOR line with XDrawLine in front color buffer.
XMesaContext xmesa = XMESA_CONTEXT(ctx);
XMesaDisplay *dpy = xmesa->xm_visual->display;
XMesaGC gc = xmesa->xm_buffer->gc;
- struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *)
- ctx->DrawBuffer->_ColorDrawBuffers[0][0];
+ GET_XRB(xrb);
unsigned long pixel = xmesa_color_to_pixel(ctx,
vert1->color[0], vert1->color[1],
vert1->color[2], vert1->color[3],
xmesa->pixelformat);
- int x0 = (int) vert0->win[0];
- int y0 = YFLIP(xrb, (GLint) vert0->win[1]);
- int x1 = (int) vert1->win[0];
- int y1 = YFLIP(xrb, (GLint) vert1->win[1]);
+ int x0 = (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][0];
+ int y0 = YFLIP(xrb, (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][1]);
+ int x1 = (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][0];
+ int y1 = YFLIP(xrb, (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][1]);
XMesaSetForeground(dpy, gc, pixel);
XMesaSetFunction(dpy, gc, GXxor);
XSetLineAttributes(dpy, gc, (int) ctx->Line.Width,
#endif /* XFree86Server */
+#endif /* CHAN_BITS == 8 */
+
+
/**
* Return pointer to line drawing function, or NULL if we should use a
* swrast fallback.
static swrast_line_func
get_line_func(GLcontext *ctx)
{
- XMesaContext xmesa = XMESA_CONTEXT(ctx);
+#if CHAN_BITS == 8
SWcontext *swrast = SWRAST_CONTEXT(ctx);
- int depth = GET_VISUAL_DEPTH(xmesa->xm_visual);
- struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *)
- ctx->DrawBuffer->_ColorDrawBuffers[0][0];
+ XMesaContext xmesa = XMESA_CONTEXT(ctx);
+ XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer);
+ const int depth = GET_VISUAL_DEPTH(xmesa->xm_visual);
+ const struct xmesa_renderbuffer *xrb;
- if ((ctx->DrawBuffer->_ColorDrawBufferMask[0]
- & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)) == 0)
+ if ((ctx->DrawBuffer->_ColorDrawBufferIndexes[0] != BUFFER_BIT_FRONT_LEFT) &&
+ (ctx->DrawBuffer->_ColorDrawBufferIndexes[0] != BUFFER_BIT_BACK_LEFT))
return (swrast_line_func) NULL;
if (ctx->RenderMode != GL_RENDER) return (swrast_line_func) NULL;
if (ctx->Line.SmoothFlag) return (swrast_line_func) NULL;
if (ctx->Light.ShadeModel != GL_FLAT) return (swrast_line_func) NULL;
if (ctx->Line.StippleFlag) return (swrast_line_func) NULL;
if (swrast->_RasterMask & MULTI_DRAW_BIT) return (swrast_line_func) NULL;
+ if (xmbuf->swAlpha) return (swrast_line_func) NULL;
+
+ xrb = xmesa_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0]->Wrapped);
if (xrb->ximage
&& swrast->_RasterMask==DEPTH_BIT
}
#ifndef XFree86Server
- if (ctx->DrawBuffer->_NumColorDrawBuffers[0] == 1
- && ctx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT
+ if (ctx->DrawBuffer->_NumColorDrawBuffers == 1
+ && ctx->DrawBuffer->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT
&& swrast->_RasterMask == LOGIC_OP_BIT
&& ctx->Color.LogicOp == GL_XOR
&& !ctx->Line.StippleFlag
}
#endif /* XFree86Server */
+#endif /* CHAN_BITS == 8 */
return (swrast_line_func) NULL;
}