i965: Add support for non-color render target write data to new FS backend.
[mesa.git] / src / mesa / drivers / dri / unichrome / via_span.c
index f1ed98036bf0c19b0a0d283d5faa80e1317be848..fa3cbf7a79e30c0e172eca72c6b149db386d5b86 100644 (file)
  * DEALINGS IN THE SOFTWARE.
  */
 
-#include "glheader.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "colormac.h"
+#include "main/glheader.h"
+#include "main/formats.h"
+#include "main/macros.h"
+#include "main/mtypes.h"
+#include "main/colormac.h"
 #include "via_context.h"
 #include "via_span.h"
 #include "via_ioctl.h"
 #undef LOCAL_VARS
 #define LOCAL_VARS                                                     \
     struct via_renderbuffer *vrb = (struct via_renderbuffer *) rb;     \
-    __DRIdrawablePrivate *dPriv = vrb->dPriv;                           \
+    __DRIdrawable *dPriv = vrb->dPriv;                           \
     GLuint pitch = vrb->pitch;                                          \
     GLuint height = dPriv->h;                                          \
     GLint p = 0;                                                       \
-    char *buf = (char *)(vrb->origMap + vrb->drawXoff * vrb->bpp);      \
+    char *buf = (char *)(vrb->origMap);                                        \
     (void) p;
 
 /* ================================================================
  */
 #define LOCAL_DEPTH_VARS                                            \
     struct via_renderbuffer *vrb = (struct via_renderbuffer *) rb;  \
-    __DRIdrawablePrivate *dPriv = vrb->dPriv;                       \
+    __DRIdrawable *dPriv = vrb->dPriv;                       \
     GLuint depth_pitch = vrb->pitch;                                \
     GLuint height = dPriv->h;                                       \
-    char *buf = (char *)(vrb->map + (vrb->drawXoff * vrb->bpp/8))
+    char *buf = (char *)(vrb->map)
 
 #define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS 
 
+#define VALUE_TYPE GLushort
 
 #define WRITE_DEPTH(_x, _y, d)                      \
     *(GLushort *)(buf + (_x) * 2 + (_y) * depth_pitch) = d;
 
 /* 32 bit depthbuffer functions.
  */
+#define VALUE_TYPE GLuint
+
 #define WRITE_DEPTH(_x, _y, d)                      \
     *(GLuint *)(buf + (_x) * 4 + (_y) * depth_pitch) = d;
 
 
 /* 24/8 bit interleaved depth/stencil functions
  */
+#define VALUE_TYPE GLuint
+
 #define WRITE_DEPTH( _x, _y, d ) {                     \
    GLuint tmp = *(GLuint *)(buf + (_x)*4 + (_y)*depth_pitch);  \
    tmp &= 0x000000ff;                                  \
@@ -172,24 +178,22 @@ void viaInitSpanFuncs(GLcontext *ctx)
 void
 viaSetSpanFunctions(struct via_renderbuffer *vrb, const GLvisual *vis)
 {
-   if (vrb->Base.InternalFormat == GL_RGBA) {
-      if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
-         viaInitPointers_565(&vrb->Base);
-      }
-      else {
-         viaInitPointers_8888(&vrb->Base);
-      }
+   if (vrb->Base.Format == MESA_FORMAT_RGB565) {
+      viaInitPointers_565(&vrb->Base);
+   }
+   else if (vrb->Base.Format == MESA_FORMAT_ARGB8888) {
+      viaInitPointers_8888(&vrb->Base);
    }
-   else if (vrb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
+   else if (vrb->Base.Format == MESA_FORMAT_Z16) {
       viaInitDepthPointers_z16(&vrb->Base);
    }
-   else if (vrb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
+   else if (vrb->Base.Format == MESA_FORMAT_Z24_S8) {
       viaInitDepthPointers_z24_s8(&vrb->Base);
    }
-   else if (vrb->Base.InternalFormat == GL_DEPTH_COMPONENT32) {
+   else if (vrb->Base.Format == MESA_FORMAT_Z32) {
       viaInitDepthPointers_z32(&vrb->Base);
    }
-   else if (vrb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
+   else if (vrb->Base.Format == MESA_FORMAT_S8) {
       viaInitStencilPointers_z24_s8(&vrb->Base);
    }
 }