SetBuffer, renderbuffer changes
authorBrian Paul <brian.paul@tungstengraphics.com>
Sat, 3 Sep 2005 16:54:20 +0000 (16:54 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Sat, 3 Sep 2005 16:54:20 +0000 (16:54 +0000)
src/mesa/drivers/dri/i915/intel_context.h
src/mesa/drivers/dri/i915/intel_screen.c
src/mesa/drivers/dri/i915/intel_span.c
src/mesa/drivers/dri/i915/intel_state.c

index da1ef701bf520f7197cf6c677e8bf9b8a6f1ac00..20e2660dc374929774bc3ce1c42eaa9d0e955dd1 100644 (file)
@@ -206,8 +206,6 @@ struct intel_context
 
    /* These refer to the current draw (front vs. back) buffer:
     */
-   char *drawMap;              /* draw buffer address in virtual mem */
-   char *readMap;      
    GLuint drawOffset;          /* agp offset of drawbuffer */
    int drawX;                  /* origin of drawable in draw buffer */
    int drawY;
index 57c7504bf28e2bfc8c6524b8babc4c2c859047e3..27faf6ba127301a209aa7c933ecaf6cf1ca597f3 100644 (file)
@@ -239,14 +239,6 @@ static GLboolean intelCreateBuffer( __DRIscreenPrivate *driScrnPriv,
       GLboolean swStencil = (mesaVis->stencilBits > 0 && 
                             mesaVis->depthBits != 24);
 
-#if 0
-      driDrawPriv->driverPrivate = (void *) 
-        _mesa_create_framebuffer(mesaVis,
-                                 GL_FALSE,  /* software depth buffer? */
-                                 swStencil,
-                                 mesaVis->accumRedBits > 0,
-                                 GL_FALSE /* s/w alpha planes */);
-#else
       struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
 
       {
@@ -255,6 +247,7 @@ static GLboolean intelCreateBuffer( __DRIscreenPrivate *driScrnPriv,
                                  screen->frontOffset, screen->frontPitch);
          intelSetSpanFunctions(frontRb, mesaVis);
          _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
+         frontRb->Base.Data = driScrnPriv->pFB;
       }
 
       if (mesaVis->doubleBufferMode) {
@@ -263,6 +256,7 @@ static GLboolean intelCreateBuffer( __DRIscreenPrivate *driScrnPriv,
                                  screen->backOffset, screen->backPitch);
          intelSetSpanFunctions(backRb, mesaVis);
          _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
+         backRb->Base.Data = screen->back.map;
       }
 
       if (mesaVis->depthBits == 16) {
@@ -271,6 +265,7 @@ static GLboolean intelCreateBuffer( __DRIscreenPrivate *driScrnPriv,
                                  screen->depthOffset, screen->depthPitch);
          intelSetSpanFunctions(depthRb, mesaVis);
          _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
+         depthRb->Base.Data = screen->depth.map;
       }
       else if (mesaVis->depthBits == 24) {
          driRenderbuffer *depthRb
@@ -278,6 +273,7 @@ static GLboolean intelCreateBuffer( __DRIscreenPrivate *driScrnPriv,
                                  screen->depthOffset, screen->depthPitch);
          intelSetSpanFunctions(depthRb, mesaVis);
          _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
+         depthRb->Base.Data = screen->depth.map;
       }
 
       if (mesaVis->stencilBits > 0 && !swStencil) {
@@ -286,6 +282,7 @@ static GLboolean intelCreateBuffer( __DRIscreenPrivate *driScrnPriv,
                                  screen->depthOffset, screen->depthPitch);
          intelSetSpanFunctions(stencilRb, mesaVis);
          _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
+         stencilRb->Base.Data = screen->depth.map;
       }
 
       _mesa_add_soft_renderbuffers(fb,
@@ -296,7 +293,7 @@ static GLboolean intelCreateBuffer( __DRIscreenPrivate *driScrnPriv,
                                    GL_FALSE, /* alpha */
                                    GL_FALSE /* aux */);
       driDrawPriv->driverPrivate = (void *) fb;
-#endif
+
       return (driDrawPriv->driverPrivate != NULL);
    }
 }
index 3522f4f38fc3ed68c4fddf2fb69fcd59ceedd133..9a9decff0141ca691551919ef6762241213cea65 100644 (file)
 #define DBG 0
 
 #define LOCAL_VARS                                             \
-   intelContextPtr intel = INTEL_CONTEXT(ctx);                    \
+   intelContextPtr intel = INTEL_CONTEXT(ctx);                 \
    __DRIdrawablePrivate *dPriv = intel->driDrawable;           \
-   intelScreenPrivate *intelScreen = intel->intelScreen;               \
-   GLuint pitch = intelScreen->backPitch * intelScreen->cpp;   \
+   driRenderbuffer *drb = (driRenderbuffer *) rb;              \
+   GLuint pitch = drb->pitch * drb->cpp;                       \
    GLuint height = dPriv->h;                                   \
-   char *buf = (char *)(intel->drawMap +                       \
-                       dPriv->x * intelScreen->cpp +           \
-                       dPriv->y * pitch);                      \
-   char *read_buf = (char *)(intel->readMap +                  \
-                            dPriv->x * intelScreen->cpp +      \
-                            dPriv->y * pitch);                 \
-   GLushort p;                                                         \
+   char *buf = (char *) drb->Base.Data +                       \
+                       dPriv->x * drb->cpp +                   \
+                       dPriv->y * pitch;                       \
+   char *read_buf = buf;                                       \
+   GLushort p;                                                 \
    (void) read_buf; (void) buf; (void) p
 
 #define LOCAL_DEPTH_VARS                                       \
-   intelContextPtr intel = INTEL_CONTEXT(ctx);                    \
+   intelContextPtr intel = INTEL_CONTEXT(ctx);                 \
    __DRIdrawablePrivate *dPriv = intel->driDrawable;           \
-   intelScreenPrivate *intelScreen = intel->intelScreen;               \
-   GLuint pitch = intelScreen->backPitch * intelScreen->cpp;   \
+   driRenderbuffer *drb = (driRenderbuffer *) rb;              \
+   GLuint pitch = drb->pitch * drb->cpp;                       \
    GLuint height = dPriv->h;                                   \
-   char *buf = (char *)(intelScreen->depth.map +                       \
-                       dPriv->x * intelScreen->cpp +           \
-                       dPriv->y * pitch)
+   char *buf = (char *) drb->Base.Data +                       \
+                       dPriv->x * drb->cpp +                   \
+                       dPriv->y * pitch
 
 #define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS 
 
@@ -127,7 +125,7 @@ do {                                                                \
    d = *(GLushort *)(buf + (_x)*2 + (_y)*pitch);        
 
 
-#define TAG(x) intel##x##_16
+#define TAG(x) intel##x##_z16
 #include "depthtmp.h"
 
 
@@ -135,15 +133,13 @@ do {                                                              \
 #define LOCAL_VARS                                             \
    intelContextPtr intel = INTEL_CONTEXT(ctx);                 \
    __DRIdrawablePrivate *dPriv = intel->driDrawable;           \
-   intelScreenPrivate *intelScreen = intel->intelScreen;               \
-   GLuint pitch = intelScreen->backPitch * intelScreen->cpp;   \
+   driRenderbuffer *drb = (driRenderbuffer *) rb;              \
+   GLuint pitch = drb->pitch * drb->cpp;                       \
    GLuint height = dPriv->h;                                   \
-   char *buf = (char *)(intel->drawMap +                       \
-                       dPriv->x * intelScreen->cpp +           \
-                       dPriv->y * pitch);                      \
-   char *read_buf = (char *)(intel->readMap +                  \
-                            dPriv->x * intelScreen->cpp +      \
-                            dPriv->y * pitch);                 \
+   char *buf = (char *)drb->Base.Data +                                \
+                       dPriv->x * drb->cpp +                   \
+                       dPriv->y * pitch;                       \
+   char *read_buf = buf;                                       \
    GLuint p;                                                   \
    (void) read_buf; (void) buf; (void) p
 
@@ -189,7 +185,7 @@ do {                                                                \
    d = *(GLuint *)(buf + (_x)*4 + (_y)*pitch) & 0xffffff;
 
 
-#define TAG(x) intel##x##_24_8
+#define TAG(x) intel##x##_z24_s8
 #include "depthtmp.h"
 
 #define WRITE_STENCIL( _x, _y, d ) {                   \
@@ -202,31 +198,10 @@ do {                                                              \
 #define READ_STENCIL( d, _x, _y )                      \
    d = *(GLuint *)(buf + (_x)*4 + (_y)*pitch) >> 24;
 
-#define TAG(x) intel##x##_24_8
+#define TAG(x) intel##x##_z24_s8
 #include "stenciltmp.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 intelSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
-                          GLuint bufferBit)
-{
-   intelContextPtr intel = INTEL_CONTEXT(ctx);
-   if (bufferBit == BUFFER_BIT_FRONT_LEFT) {
-      intel->drawMap = (char *)intel->driScreen->pFB;
-      intel->readMap = (char *)intel->driScreen->pFB;
-   } else if (bufferBit == BUFFER_BIT_BACK_LEFT) {
-      intel->drawMap = intel->intelScreen->back.map;
-      intel->readMap = intel->intelScreen->back.map;
-   } else {
-      ASSERT(0);
-   }
-}
-
-
 /* Move locking out to get reasonable span performance.
  */
 void intelSpanRenderStart( GLcontext *ctx )
@@ -247,68 +222,7 @@ void intelSpanRenderFinish( GLcontext *ctx )
 
 void intelInitSpanFuncs( GLcontext *ctx )
 {
-   intelContextPtr intel = INTEL_CONTEXT(ctx);
-   intelScreenPrivate *intelScreen = intel->intelScreen;
-
    struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
-
-   swdd->SetBuffer = intelSetBuffer;
-
-   switch (intelScreen->fbFormat) {
-   case DV_PF_555:
-#if 0
-      swdd->WriteRGBASpan = intelWriteRGBASpan_555;
-      swdd->WriteRGBSpan = intelWriteRGBSpan_555;
-      swdd->WriteMonoRGBASpan = intelWriteMonoRGBASpan_555;
-      swdd->WriteRGBAPixels = intelWriteRGBAPixels_555;
-      swdd->WriteMonoRGBAPixels = intelWriteMonoRGBAPixels_555;
-      swdd->ReadRGBASpan = intelReadRGBASpan_555;
-      swdd->ReadRGBAPixels = intelReadRGBAPixels_555;
-      swdd->ReadDepthSpan = intelReadDepthSpan_16;
-      swdd->WriteDepthSpan = intelWriteDepthSpan_16;
-      swdd->ReadDepthPixels = intelReadDepthPixels_16;
-      swdd->WriteDepthPixels = intelWriteDepthPixels_16;
-#endif
-      break;
-
-   case DV_PF_565:
-#if 0
-      swdd->WriteRGBASpan = intelWriteRGBASpan_565;
-      swdd->WriteRGBSpan = intelWriteRGBSpan_565;
-      swdd->WriteMonoRGBASpan = intelWriteMonoRGBASpan_565;
-      swdd->WriteRGBAPixels = intelWriteRGBAPixels_565;
-      swdd->WriteMonoRGBAPixels = intelWriteMonoRGBAPixels_565; 
-      swdd->ReadRGBASpan = intelReadRGBASpan_565;
-      swdd->ReadRGBAPixels = intelReadRGBAPixels_565;
-      swdd->ReadDepthSpan = intelReadDepthSpan_16;
-      swdd->WriteDepthSpan = intelWriteDepthSpan_16;
-      swdd->ReadDepthPixels = intelReadDepthPixels_16;
-      swdd->WriteDepthPixels = intelWriteDepthPixels_16;
-#endif
-      break;
-
-   case DV_PF_8888:
-#if 0
-      swdd->WriteRGBASpan = intelWriteRGBASpan_8888;
-      swdd->WriteRGBSpan = intelWriteRGBSpan_8888;
-      swdd->WriteMonoRGBASpan = intelWriteMonoRGBASpan_8888;
-      swdd->WriteRGBAPixels = intelWriteRGBAPixels_8888;
-      swdd->WriteMonoRGBAPixels = intelWriteMonoRGBAPixels_8888;
-      swdd->ReadRGBASpan = intelReadRGBASpan_8888;
-      swdd->ReadRGBAPixels = intelReadRGBAPixels_8888;
-      swdd->ReadDepthSpan = intelReadDepthSpan_24_8;
-      swdd->WriteDepthSpan = intelWriteDepthSpan_24_8;
-      swdd->ReadDepthPixels = intelReadDepthPixels_24_8;
-      swdd->WriteDepthPixels = intelWriteDepthPixels_24_8;
-
-      swdd->WriteStencilSpan = intelWriteStencilSpan_24_8;
-      swdd->ReadStencilSpan = intelReadStencilSpan_24_8;
-      swdd->WriteStencilPixels = intelWriteStencilPixels_24_8;
-      swdd->ReadStencilPixels = intelReadStencilPixels_24_8;
-#endif
-      break;
-   }
-
    swdd->SpanRenderStart = intelSpanRenderStart;
    swdd->SpanRenderFinish = intelSpanRenderFinish; 
 }
@@ -353,27 +267,12 @@ intelSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
       }
    }
    else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
-      drb->Base.GetRow        = intelReadDepthSpan_16;
-      drb->Base.GetValues     = intelReadDepthPixels_16;
-      drb->Base.PutRow        = intelWriteDepthSpan_16;
-      drb->Base.PutMonoRow    = intelWriteMonoDepthSpan_16;
-      drb->Base.PutValues     = intelWriteDepthPixels_16;
-      drb->Base.PutMonoValues = NULL;
+      intelInitDepthPointers_z16(&drb->Base);
    }
    else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
-      drb->Base.GetRow        = intelReadDepthSpan_24_8;
-      drb->Base.GetValues     = intelReadDepthPixels_24_8;
-      drb->Base.PutRow        = intelWriteDepthSpan_24_8;
-      drb->Base.PutMonoRow    = intelWriteMonoDepthSpan_24_8;
-      drb->Base.PutValues     = intelWriteDepthPixels_24_8;
-      drb->Base.PutMonoValues = NULL;
+      intelInitDepthPointers_z24_s8(&drb->Base);
    }
    else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
-      drb->Base.GetRow        = intelReadStencilSpan_24_8;
-      drb->Base.GetValues     = intelReadStencilPixels_24_8;
-      drb->Base.PutRow        = intelWriteStencilSpan_24_8;
-      drb->Base.PutMonoRow    = intelWriteMonoStencilSpan_24_8;
-      drb->Base.PutValues     = intelWriteStencilPixels_24_8;
-      drb->Base.PutMonoValues = NULL;
+      intelInitStencilPointers_z24_s8(&drb->Base);
    }
 }
index cf1f3c5803616ae01b964ba3d9784704e87eaae8..f018f01762fe583bfe61d006fdad6a0539854f46 100644 (file)
@@ -187,11 +187,6 @@ static void intelDrawBuffer(GLcontext *ctx, GLenum mode )
       return;
    }
 
-   /* We want to update the s/w rast state too so that r200SetBuffer()
-    * gets called.
-    */
-   _swrast_DrawBuffer(ctx, mode);
-
    if ( intel->sarea->pf_current_page == 1 ) 
       front ^= 1;
    
@@ -199,12 +194,8 @@ static void intelDrawBuffer(GLcontext *ctx, GLenum mode )
 
    if (front) {
       intel->drawOffset = screen->frontOffset;
-      intel->drawMap = (char *)intel->driScreen->pFB;
-      intel->readMap = (char *)intel->driScreen->pFB;
    } else {
       intel->drawOffset = screen->backOffset;
-      intel->drawMap = screen->back.map;
-      intel->readMap = screen->back.map;
    }
 
    intel->vtbl.set_draw_offset( intel, intel->drawOffset );