#define LOCAL_VARS \
+ GrBuffer_t currentFB = GR_BUFFER_BACKBUFFER; \
GLuint pitch = info.strideInBytes; \
GLuint height = fxMesa->height; \
char *buf = (char *)((char *)info.lfbPtr + 0 /* x, y offset */); \
GrLfbInfo_t info; \
info.size = sizeof(GrLfbInfo_t); \
if ( grLfbLock( GR_LFB_WRITE_ONLY, \
- fxMesa->currentFB, LFB_MODE, \
+ currentFB, LFB_MODE, \
GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) {
#define HW_WRITE_UNLOCK() \
- grLfbUnlock( GR_LFB_WRITE_ONLY, fxMesa->currentFB ); \
+ grLfbUnlock( GR_LFB_WRITE_ONLY, currentFB ); \
}
#define HW_READ_LOCK() \
fxMesaContext fxMesa = FX_CONTEXT(ctx); \
GrLfbInfo_t info; \
info.size = sizeof(GrLfbInfo_t); \
- if ( grLfbLock( GR_LFB_READ_ONLY, fxMesa->currentFB, \
+ if ( grLfbLock( GR_LFB_READ_ONLY, currentFB, \
LFB_MODE, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info ) ) {
#define HW_READ_UNLOCK() \
- grLfbUnlock( GR_LFB_READ_ONLY, fxMesa->currentFB ); \
+ grLfbUnlock( GR_LFB_READ_ONLY, currentFB ); \
}
#define HW_WRITE_CLIPLOOP() \
#undef BYTESPERPIXEL
#define BYTESPERPIXEL 2
+#define VALUE_TYPE GLushort
+
#define WRITE_DEPTH( _x, _y, d ) \
*(GLushort *)(buf + _x*BYTESPERPIXEL + _y*pitch) = d
#undef BYTESPERPIXEL
#define BYTESPERPIXEL 4
+#define VALUE_TYPE GLuint
+
#define WRITE_DEPTH( _x, _y, d ) \
*(GLuint *)(buf + _x*BYTESPERPIXEL + _y*pitch) = d << 8
* since OpenGL says obscured pixels have undefined values.
*/
static void fxReadRGBASpan_ARGB1555 (const GLcontext * ctx,
+ struct gl_renderbuffer *rb,
GLuint n,
GLint x, GLint y,
GLubyte rgba[][4])
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ GrBuffer_t currentFB = GR_BUFFER_BACKBUFFER;
GrLfbInfo_t info;
info.size = sizeof(GrLfbInfo_t);
- if (grLfbLock(GR_LFB_READ_ONLY, fxMesa->currentFB,
+ if (grLfbLock(GR_LFB_READ_ONLY, currentFB,
GR_LFBWRITEMODE_ANY, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
const GLint winX = 0;
const GLint winY = fxMesa->height - 1;
rgba[n][3] = (pixel & 0x8000) ? 255 : 0;
}
- grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB);
+ grLfbUnlock(GR_LFB_READ_ONLY, currentFB);
}
}
* since OpenGL says obscured pixels have undefined values.
*/
static void fxReadRGBASpan_RGB565 (const GLcontext * ctx,
+ struct gl_renderbuffer *rb,
GLuint n,
GLint x, GLint y,
GLubyte rgba[][4])
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ GrBuffer_t currentFB = GR_BUFFER_BACKBUFFER;
GrLfbInfo_t info;
info.size = sizeof(GrLfbInfo_t);
- if (grLfbLock(GR_LFB_READ_ONLY, fxMesa->currentFB,
+ if (grLfbLock(GR_LFB_READ_ONLY, currentFB,
GR_LFBWRITEMODE_ANY, GR_ORIGIN_UPPER_LEFT, FXFALSE, &info)) {
const GLint winX = 0;
const GLint winY = fxMesa->height - 1;
rgba[n][3] = 255;
}
- grLfbUnlock(GR_LFB_READ_ONLY, fxMesa->currentFB);
+ grLfbUnlock(GR_LFB_READ_ONLY, currentFB);
}
}
* since OpenGL says obscured pixels have undefined values.
*/
static void fxReadRGBASpan_ARGB8888 (const GLcontext * ctx,
+ struct gl_renderbuffer *rb,
GLuint n,
GLint x, GLint y,
GLubyte rgba[][4])
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
+ GrBuffer_t currentFB = GR_BUFFER_BACKBUFFER;
GLuint i;
- grLfbReadRegion(fxMesa->currentFB, x, fxMesa->height - 1 - y, n, 1, n * 4, rgba);
+ grLfbReadRegion(currentFB, x, fxMesa->height - 1 - y, n, 1, n * 4, rgba);
for (i = 0; i < n; i++) {
GLubyte c = rgba[i][0];
rgba[i][0] = rgba[i][2];
/************************************************************************/
static void
-fxReadDepthSpan_Z16(GLcontext * ctx,
- GLuint n, GLint x, GLint y, GLdepth depth[])
+fxReadDepthSpan_Z16(GLcontext * ctx, struct gl_renderbuffer *rb,
+ GLuint n, GLint x, GLint y, GLuint depth[])
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLint bottom = fxMesa->height - 1;
static void
-fxReadDepthSpan_Z24(GLcontext * ctx,
- GLuint n, GLint x, GLint y, GLdepth depth[])
+fxReadDepthSpan_Z24(GLcontext * ctx, struct gl_renderbuffer *rb,
+ GLuint n, GLint x, GLint y, GLuint depth[])
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
GLint bottom = fxMesa->height - 1;
/************************************************************************/
static void
-fxWriteStencilSpan (GLcontext *ctx, GLuint n, GLint x, GLint y,
+fxWriteStencilSpan (GLcontext *ctx, struct gl_renderbuffer *rb,
+ GLuint n, GLint x, GLint y,
const GLstencil stencil[], const GLubyte mask[])
{
/*
}
static void
-fxReadStencilSpan(GLcontext * ctx,
+fxReadStencilSpan(GLcontext * ctx, struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y, GLstencil stencil[])
{
fxMesaContext fxMesa = FX_CONTEXT(ctx);
}
static void
-fxWriteStencilPixels (GLcontext *ctx, GLuint n,
+fxWriteStencilPixels (GLcontext *ctx, struct gl_renderbuffer *rb, GLuint n,
const GLint x[], const GLint y[],
const GLstencil stencil[],
const GLubyte mask[])
}
static void
-fxReadStencilPixels (GLcontext *ctx, GLuint n,
+fxReadStencilPixels (GLcontext *ctx, struct gl_renderbuffer *rb, GLuint n,
const GLint x[], const GLint y[],
GLstencil stencil[])
{
}
-
-/*
- * This function is called to specify which buffer to read and write
- * for software rasterization (swrast) fallbacks. This doesn't necessarily
- * correspond to glDrawBuffer() or glReadBuffer() calls.
- */
-static void
-fxDDSetBuffer(GLcontext * ctx, GLframebuffer * buffer, GLuint bufferBit)
-{
- fxMesaContext fxMesa = FX_CONTEXT(ctx);
- (void) buffer;
-
- if (TDFX_DEBUG & VERBOSE_DRIVER) {
- fprintf(stderr, "fxDDSetBuffer(%x)\n", (int)bufferBit);
- }
-
- if (bufferBit == DD_FRONT_LEFT_BIT) {
- fxMesa->currentFB = GR_BUFFER_FRONTBUFFER;
- grRenderBuffer(fxMesa->currentFB);
- }
- else if (bufferBit == DD_BACK_LEFT_BIT) {
- fxMesa->currentFB = GR_BUFFER_BACKBUFFER;
- grRenderBuffer(fxMesa->currentFB);
- }
-}
-
-
-/************************************************************************/
-
-
-
void
fxSetupDDSpanPointers(GLcontext * ctx)
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx );
fxMesaContext fxMesa = FX_CONTEXT(ctx);
- swdd->SetBuffer = fxDDSetBuffer;
-
switch (fxMesa->colDepth) {
case 15:
swdd->WriteRGBASpan = tdfxWriteRGBASpan_ARGB1555;