summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/mach64
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2005-09-03 16:43:02 +0000
committerBrian Paul <[email protected]>2005-09-03 16:43:02 +0000
commit687918b794d12a0ff5d395b8cf87880dbe8012bf (patch)
tree280d1b882dc3bfd0e105d14a1f9d90c7cef935dd /src/mesa/drivers/dri/mach64
parente6925b51e1e71dc45079636ce336a09806356999 (diff)
SetBuffer, renderbuffer changes
Diffstat (limited to 'src/mesa/drivers/dri/mach64')
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_screen.c11
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_span.c93
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_state.c5
3 files changed, 19 insertions, 90 deletions
diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c
index bcdaea166d0..62b1bc2ba52 100644
--- a/src/mesa/drivers/dri/mach64/mach64_screen.c
+++ b/src/mesa/drivers/dri/mach64/mach64_screen.c
@@ -372,14 +372,6 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv,
return GL_FALSE; /* not implemented */
}
else {
-#if 0
- driDrawPriv->driverPrivate = (void *)
- _mesa_create_framebuffer( mesaVis,
- GL_FALSE, /* software depth buffer? */
- mesaVis->stencilBits > 0,
- mesaVis->accumRedBits > 0,
- mesaVis->alphaBits > 0 );
-#else
struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
{
@@ -406,6 +398,7 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv,
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
}
else if (mesaVis->depthBits == 24) {
+ /* XXX I don't think 24-bit Z is supported - so this isn't used */
driRenderbuffer *depthRb
= driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
screen->depthOffset, screen->depthPitch);
@@ -421,7 +414,7 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv,
GL_FALSE, /* alpha */
GL_FALSE /* aux */);
driDrawPriv->driverPrivate = (void *) fb;
-#endif
+
return (driDrawPriv->driverPrivate != NULL);
}
}
diff --git a/src/mesa/drivers/dri/mach64/mach64_span.c b/src/mesa/drivers/dri/mach64/mach64_span.c
index 0ac0eeaa604..dc9f27caeec 100644
--- a/src/mesa/drivers/dri/mach64/mach64_span.c
+++ b/src/mesa/drivers/dri/mach64/mach64_span.c
@@ -38,35 +38,26 @@
#define DBG 0
+#define GET_PTR(X,Y) (sPriv->pFB + drb->offset \
+ + ((dPriv->y + (Y)) * drb->pitch + (dPriv->x + (X))) * drb->cpp)
+
#define LOCAL_VARS \
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); \
- mach64ScreenRec *mach64Screen = mmesa->mach64Screen; \
- __DRIscreenPrivate *driScreen = mmesa->driScreen; \
+ __DRIscreenPrivate *sPriv = mmesa->driScreen; \
__DRIdrawablePrivate *dPriv = mmesa->driDrawable; \
- GLuint pitch = mmesa->drawPitch * mach64Screen->cpp; \
+ driRenderbuffer *drb = (driRenderbuffer *) rb; \
GLuint height = dPriv->h; \
- char *buf = (char *)(driScreen->pFB + \
- mmesa->drawOffset + \
- (dPriv->x * mach64Screen->cpp) + \
- (dPriv->y * pitch)); \
- char *read_buf = (char *)(driScreen->pFB + \
- mmesa->readOffset + \
- (dPriv->x * mach64Screen->cpp) + \
- (dPriv->y * pitch)); \
GLushort p; \
- (void) read_buf; (void) buf; (void) p
+ (void) p;
#define LOCAL_DEPTH_VARS \
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx); \
- mach64ScreenRec *mach64Screen = mmesa->mach64Screen; \
__DRIdrawablePrivate *dPriv = mmesa->driDrawable; \
__DRIscreenPrivate *driScreen = mmesa->driScreen; \
- GLuint pitch = mach64Screen->depthPitch * 2; \
+ driRenderbuffer *drb = (driRenderbuffer *) rb; \
GLuint height = dPriv->h; \
- char *buf = (char *)(driScreen->pFB + \
- mach64Screen->depthOffset + \
- dPriv->x * 2 + \
- dPriv->y * pitch)
+ char *buf = (char *)(driScreen->pFB + drb->offset + \
+ (dPriv->x + dPriv->y * drb->pitch) * 2)
#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
@@ -104,6 +95,8 @@
#define TAG(x) mach64##x##_RGB565
#define TAG2(x,y) mach64##x##_RGB565##y
+#define GET_SRC_PTR(X,Y) GET_PTR(X,Y)
+#define GET_DST_PTR(X,Y) GET_SRC_PTR(X,Y)
#include "spantmp2.h"
@@ -116,6 +109,8 @@
#define TAG(x) mach64##x##_ARGB8888
#define TAG2(x,y) mach64##x##_ARGB8888##y
+#define GET_SRC_PTR(X,Y) GET_PTR(X,Y)
+#define GET_DST_PTR(X,Y) GET_SRC_PTR(X,Y)
#include "spantmp2.h"
@@ -126,44 +121,15 @@
/* 16 bit depthbuffer functions.
*/
#define WRITE_DEPTH( _x, _y, d ) \
- *(GLushort *)(buf + (_x)*2 + (_y)*pitch) = d;
+ *(GLushort *)(buf + ((_x) + (_y) * drb->pitch) * 2) = d;
#define READ_DEPTH( d, _x, _y ) \
- d = *(GLushort *)(buf + (_x)*2 + (_y)*pitch);
+ d = *(GLushort *)(buf + ((_x) + (_y) * drb->pitch) * 2);
-#define TAG(x) mach64##x##_16
+#define TAG(x) mach64##x##_z16
#include "depthtmp.h"
-/*
- * 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 mach64DDSetBuffer( GLcontext *ctx,
- GLframebuffer *colorBuffer,
- GLuint bufferBit )
-{
- mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
-
- switch ( bufferBit ) {
- case BUFFER_BIT_FRONT_LEFT:
- if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf(stderr,"%s: BUFFER_BIT_FRONT_LEFT\n", __FUNCTION__);
- mmesa->drawOffset = mmesa->readOffset = mmesa->mach64Screen->frontOffset;
- mmesa->drawPitch = mmesa->readPitch = mmesa->mach64Screen->frontPitch;
- break;
- case BUFFER_BIT_BACK_LEFT:
- if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
- fprintf(stderr,"%s: BUFFER_BIT_BACK_LEFT\n", __FUNCTION__);
- mmesa->drawOffset = mmesa->readOffset = mmesa->mach64Screen->backOffset;
- mmesa->drawPitch = mmesa->readPitch = mmesa->mach64Screen->backPitch;
- break;
- default:
- break;
- }
-}
-
static void mach64SpanRenderStart( GLcontext *ctx )
{
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
@@ -181,8 +147,6 @@ static void mach64SpanRenderFinish( GLcontext *ctx )
void mach64DDInitSpanFuncs( GLcontext *ctx )
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
- swdd->SetBuffer = mach64DDSetBuffer;
swdd->SpanRenderStart = mach64SpanRenderStart;
swdd->SpanRenderFinish = mach64SpanRenderFinish;
}
@@ -203,29 +167,6 @@ mach64SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
}
}
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
- drb->Base.GetRow = mach64ReadDepthSpan_16;
- drb->Base.GetValues = mach64ReadDepthPixels_16;
- drb->Base.PutRow = mach64WriteDepthSpan_16;
- drb->Base.PutMonoRow = mach64WriteMonoDepthSpan_16;
- drb->Base.PutValues = mach64WriteDepthPixels_16;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
- /* never */
- drb->Base.GetRow = NULL;
- drb->Base.GetValues = NULL;
- drb->Base.PutRow = NULL;
- drb->Base.PutMonoRow = NULL;
- drb->Base.PutValues = NULL;
- drb->Base.PutMonoValues = NULL;
- }
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
- /* never */
- drb->Base.GetRow = NULL;
- drb->Base.GetValues = NULL;
- drb->Base.PutRow = NULL;
- drb->Base.PutMonoRow = NULL;
- drb->Base.PutValues = NULL;
- drb->Base.PutMonoValues = NULL;
+ mach64InitDepthPointers_z16(&drb->Base);
}
}
diff --git a/src/mesa/drivers/dri/mach64/mach64_state.c b/src/mesa/drivers/dri/mach64/mach64_state.c
index d9b5725a638..1eb4b6e73c2 100644
--- a/src/mesa/drivers/dri/mach64/mach64_state.c
+++ b/src/mesa/drivers/dri/mach64/mach64_state.c
@@ -753,11 +753,6 @@ static void mach64DDDrawBuffer( GLcontext *ctx, GLenum mode )
break;
}
- /* We want to update the s/w rast state too so that mach64SetBuffer()
- * gets called.
- */
- _swrast_DrawBuffer(ctx, mode);
-
mmesa->setup.dst_off_pitch = (((mmesa->drawPitch/8) << 22) |
(mmesa->drawOffset >> 3));