summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-10-22 19:49:21 -0600
committerBrian Paul <[email protected]>2009-10-22 19:57:32 -0600
commit1160acbfea986a821761d18f5f14d5d2cb0dea8c (patch)
tree81e14117fc5b73e2f53b2cc6deb35e416036f3bb /src
parentcf0e25d4c89b62f37ff8d1f11c50efcab6557c7f (diff)
dri/drivers: update driNewRenderbuffer() to take a gl_format
Now pass a specific MESA_FORMAT_x token to indicate the renderbuffer's format. This is better than passing a GLenum and having to guess the specific format. I'm unable to test all the drivers, but any issues should be easy to fix.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/common/drirenderbuffer.c61
-rw-r--r--src/mesa/drivers/dri/common/drirenderbuffer.h3
-rw-r--r--src/mesa/drivers/dri/fb/fb_dri.c4
-rw-r--r--src/mesa/drivers/dri/fb/fb_egl.c4
-rw-r--r--src/mesa/drivers/dri/ffb/ffb_xmesa.c8
-rw-r--r--src/mesa/drivers/dri/i810/i810screen.c6
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_screen.c8
-rw-r--r--src/mesa/drivers/dri/mach64/mach64_span.c14
-rw-r--r--src/mesa/drivers/dri/mga/mga_xmesa.c14
-rw-r--r--src/mesa/drivers/dri/mga/mgaspan.c20
-rw-r--r--src/mesa/drivers/dri/r128/r128_screen.c10
-rw-r--r--src/mesa/drivers/dri/r128/r128_span.c18
-rw-r--r--src/mesa/drivers/dri/s3v/s3v_xmesa.c10
-rw-r--r--src/mesa/drivers/dri/savage/savage_xmesa.c10
-rw-r--r--src/mesa/drivers/dri/savage/savagespan.c18
-rw-r--r--src/mesa/drivers/dri/sis/sis_span.c20
-rw-r--r--src/mesa/drivers/dri/tdfx/tdfx_screen.c10
-rw-r--r--src/mesa/drivers/dri/trident/trident_context.c10
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.c12
-rw-r--r--src/mesa/drivers/dri/unichrome/via_span.c21
20 files changed, 136 insertions, 145 deletions
diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.c b/src/mesa/drivers/dri/common/drirenderbuffer.c
index 6fa1c6caa01..4e7e92c82bc 100644
--- a/src/mesa/drivers/dri/common/drirenderbuffer.c
+++ b/src/mesa/drivers/dri/common/drirenderbuffer.c
@@ -54,7 +54,7 @@ driDeleteRenderbuffer(struct gl_renderbuffer *rb)
* \param pitch pixels per row
*/
driRenderbuffer *
-driNewRenderbuffer(GLenum format, GLvoid *addr,
+driNewRenderbuffer(gl_format format, GLvoid *addr,
GLint cpp, GLint offset, GLint pitch,
__DRIdrawablePrivate *dPriv)
{
@@ -80,46 +80,47 @@ driNewRenderbuffer(GLenum format, GLvoid *addr,
/* Make sure we're using a null-valued GetPointer routine */
assert(drb->Base.GetPointer(NULL, &drb->Base, 0, 0) == NULL);
- drb->Base.InternalFormat = format;
-
- if (format == GL_RGBA || format == GL_RGB5 || format == GL_RGBA8) {
- /* Color */
- drb->Base.DataType = GL_UNSIGNED_BYTE;
- if (format == GL_RGB5) {
- drb->Base.Format = MESA_FORMAT_RGB565;
+ switch (format) {
+ case MESA_FORMAT_ARGB8888:
+ if (cpp == 2) {
+ /* override format */
+ format = MESA_FORMAT_RGB565;
}
- else {
- drb->Base.Format = MESA_FORMAT_ARGB8888;
- }
- }
- else if (format == GL_DEPTH_COMPONENT16) {
- /* Depth */
- /* we always Get/Put 32-bit Z values */
- drb->Base.DataType = GL_UNSIGNED_INT;
- drb->Base.Format = MESA_FORMAT_Z16;
- }
- else if (format == GL_DEPTH_COMPONENT24) {
+ drb->Base.DataType = GL_UNSIGNED_BYTE;
+ break;
+ case MESA_FORMAT_Z16:
/* Depth */
/* we always Get/Put 32-bit Z values */
drb->Base.DataType = GL_UNSIGNED_INT;
- drb->Base.Format = MESA_FORMAT_Z32;
- }
- else if (format == GL_DEPTH_COMPONENT32) {
+ assert(cpp == 2);
+ break;
+ case MESA_FORMAT_Z32:
/* Depth */
/* we always Get/Put 32-bit Z values */
drb->Base.DataType = GL_UNSIGNED_INT;
- drb->Base.Format = MESA_FORMAT_Z32;
- }
- else {
+ assert(cpp == 4);
+ break;
+ case MESA_FORMAT_Z24_S8:
+ drb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
+ assert(cpp == 4);
+ break;
+ case MESA_FORMAT_S8_Z24:
+ drb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT;
+ assert(cpp == 4);
+ break;
+ case MESA_FORMAT_S8:
/* Stencil */
- ASSERT(format == GL_STENCIL_INDEX8_EXT);
drb->Base.DataType = GL_UNSIGNED_BYTE;
- drb->Base.Format = MESA_FORMAT_S8;
+ break;
+ default:
+ _mesa_problem(NULL, "Bad format 0x%x in driNewRenderbuffer", format);
+ return NULL;
}
- /* XXX if we were allocating a user-created renderbuffer, we'd have
- * to fill in the Red/Green/Blue/.../Bits values too.
- */
+ drb->Base.Format = format;
+
+ drb->Base.InternalFormat =
+ drb->Base._BaseFormat = _mesa_get_format_base_format(format);
drb->Base.AllocStorage = driRenderbufferStorage;
drb->Base.Delete = driDeleteRenderbuffer;
diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.h b/src/mesa/drivers/dri/common/drirenderbuffer.h
index cf55286b30f..9712c0017ba 100644
--- a/src/mesa/drivers/dri/common/drirenderbuffer.h
+++ b/src/mesa/drivers/dri/common/drirenderbuffer.h
@@ -11,6 +11,7 @@
#define DRIRENDERBUFFER_H
#include "main/mtypes.h"
+#include "main/formats.h"
#include "dri_util.h"
@@ -63,7 +64,7 @@ typedef struct {
extern driRenderbuffer *
-driNewRenderbuffer(GLenum format, GLvoid *addr,
+driNewRenderbuffer(gl_format format, GLvoid *addr,
GLint cpp, GLint offset, GLint pitch,
__DRIdrawablePrivate *dPriv);
diff --git a/src/mesa/drivers/dri/fb/fb_dri.c b/src/mesa/drivers/dri/fb/fb_dri.c
index 571b8922d5d..fd869b2fe7d 100644
--- a/src/mesa/drivers/dri/fb/fb_dri.c
+++ b/src/mesa/drivers/dri/fb/fb_dri.c
@@ -437,7 +437,7 @@ fbCreateBuffer( __DRIscreenPrivate *driScrnPriv,
/* XXX double-check these parameters (bpp vs cpp, etc) */
{
- driRenderbuffer *drb = driNewRenderbuffer(GL_RGBA,
+ driRenderbuffer *drb = driNewRenderbuffer(MESA_FORMAT_ARGB8888,
driScrnPriv->pFB,
driScrnPriv->fbBPP / 8,
driScrnPriv->fbOrigin,
@@ -451,7 +451,7 @@ fbCreateBuffer( __DRIscreenPrivate *driScrnPriv,
/* XXX what are the correct origin/stride values? */
GLvoid *backBuf = _mesa_malloc(driScrnPriv->fbStride
* driScrnPriv->fbHeight);
- driRenderbuffer *drb = driNewRenderbuffer(GL_RGBA,
+ driRenderbuffer *drb = driNewRenderbuffer(MESA_FORMAT_ARGB8888,
backBuf,
driScrnPriv->fbBPP /8,
driScrnPriv->fbOrigin,
diff --git a/src/mesa/drivers/dri/fb/fb_egl.c b/src/mesa/drivers/dri/fb/fb_egl.c
index 4e41860d8c8..eb7adf8224b 100644
--- a/src/mesa/drivers/dri/fb/fb_egl.c
+++ b/src/mesa/drivers/dri/fb/fb_egl.c
@@ -692,7 +692,7 @@ fbCreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig cfg,
/* front color renderbuffer */
{
- driRenderbuffer *drb = driNewRenderbuffer(GL_RGBA, display->pFB,
+ driRenderbuffer *drb = driNewRenderbuffer(MESA_FORMAT_ARGB8888, display->pFB,
bytesPerPixel,
origin, stride, NULL);
fbSetSpanFunctions(drb, &vis);
@@ -703,7 +703,7 @@ fbCreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig cfg,
/* back color renderbuffer */
if (vis.doubleBufferMode) {
GLubyte *backBuf = _mesa_malloc(stride * height);
- driRenderbuffer *drb = driNewRenderbuffer(GL_RGBA, backBuf,
+ driRenderbuffer *drb = driNewRenderbuffer(MESA_FORMAT_ARGB8888, backBuf,
bytesPerPixel,
origin, stride, NULL);
fbSetSpanFunctions(drb, &vis);
diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c
index 3b9f5c67591..09cc26d09eb 100644
--- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c
+++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c
@@ -347,7 +347,7 @@ ffbCreateBuffer(__DRIscreenPrivate *driScrnPriv,
{
driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, NULL, bpp, offset, bogusPitch,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, bpp, offset, bogusPitch,
driDrawPriv);
ffbSetSpanFunctions(frontRb, mesaVis);
_mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
@@ -355,7 +355,7 @@ ffbCreateBuffer(__DRIscreenPrivate *driScrnPriv,
if (mesaVis->doubleBufferMode) {
driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, NULL, bpp, offset, bogusPitch,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, bpp, offset, bogusPitch,
driDrawPriv);
ffbSetSpanFunctions(backRb, mesaVis);
_mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
@@ -363,7 +363,7 @@ ffbCreateBuffer(__DRIscreenPrivate *driScrnPriv,
if (mesaVis->depthBits == 16) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL, bpp, offset,
+ = driNewRenderbuffer(MESA_FORMAT_Z16, NULL, bpp, offset,
bogusPitch, driDrawPriv);
ffbSetDepthFunctions(depthRb, mesaVis);
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
@@ -371,7 +371,7 @@ ffbCreateBuffer(__DRIscreenPrivate *driScrnPriv,
if (mesaVis->stencilBits > 0 && !swStencil) {
driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, NULL, bpp, offset,
+ = driNewRenderbuffer(MESA_FORMAT_S8, NULL, bpp, offset,
bogusPitch, driDrawPriv);
ffbSetStencilFunctions(stencilRb, mesaVis);
_mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c
index 6e49f3466c3..b0256abbfb3 100644
--- a/src/mesa/drivers/dri/i810/i810screen.c
+++ b/src/mesa/drivers/dri/i810/i810screen.c
@@ -293,7 +293,7 @@ i810CreateBuffer( __DRIscreenPrivate *driScrnPriv,
{
driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888,
driScrnPriv->pFB,
screen->cpp,
/*screen->frontOffset*/0, screen->backPitch,
@@ -304,7 +304,7 @@ i810CreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->doubleBufferMode) {
driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888,
screen->back.map,
screen->cpp,
screen->backOffset, screen->backPitch,
@@ -315,7 +315,7 @@ i810CreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->depthBits == 16) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16,
+ = driNewRenderbuffer(MESA_FORMAT_Z16,
screen->depth.map,
screen->cpp,
screen->depthOffset, screen->backPitch,
diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c
index 6440027ca4a..a7222ec9600 100644
--- a/src/mesa/drivers/dri/mach64/mach64_screen.c
+++ b/src/mesa/drivers/dri/mach64/mach64_screen.c
@@ -316,7 +316,7 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv,
{
driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888,
NULL,
screen->cpp,
screen->frontOffset, screen->frontPitch,
@@ -327,7 +327,7 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->doubleBufferMode) {
driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888,
NULL,
screen->cpp,
screen->backOffset, screen->backPitch,
@@ -338,7 +338,7 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->depthBits == 16) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16,
+ = driNewRenderbuffer(MESA_FORMAT_Z16,
NULL, screen->cpp,
screen->depthOffset, screen->depthPitch,
driDrawPriv);
@@ -348,7 +348,7 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv,
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,
+ = driNewRenderbuffer(MESA_FORMAT_Z24_S8,
NULL,
screen->cpp,
screen->depthOffset, screen->depthPitch,
diff --git a/src/mesa/drivers/dri/mach64/mach64_span.c b/src/mesa/drivers/dri/mach64/mach64_span.c
index 91d46ce32eb..500319e0e31 100644
--- a/src/mesa/drivers/dri/mach64/mach64_span.c
+++ b/src/mesa/drivers/dri/mach64/mach64_span.c
@@ -157,15 +157,13 @@ void mach64DDInitSpanFuncs( GLcontext *ctx )
void
mach64SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
{
- if (drb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- mach64InitPointers_RGB565(&drb->Base);
- }
- else {
- mach64InitPointers_ARGB8888(&drb->Base);
- }
+ if (drb->Base.Format == MESA_FORMAT_RGB565) {
+ mach64InitPointers_RGB565(&drb->Base);
}
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
+ else if (drb->Base.Format == MESA_FORMAT_ARGB8888) {
+ mach64InitPointers_ARGB8888(&drb->Base);
+ }
+ else if (drb->Base.Format == MESA_FORMAT_Z16) {
mach64InitDepthPointers_z16(&drb->Base);
}
}
diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c
index 0dc76fea50a..4ca71ca505a 100644
--- a/src/mesa/drivers/dri/mga/mga_xmesa.c
+++ b/src/mesa/drivers/dri/mga/mga_xmesa.c
@@ -723,7 +723,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
{
driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888,
NULL,
screen->cpp,
screen->frontOffset, screen->frontPitch,
@@ -734,7 +734,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->doubleBufferMode) {
driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888,
NULL,
screen->cpp,
screen->backOffset, screen->backPitch,
@@ -745,7 +745,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->depthBits == 16) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16,
+ = driNewRenderbuffer(MESA_FORMAT_Z16,
NULL,
screen->cpp,
screen->depthOffset, screen->depthPitch,
@@ -757,7 +757,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
/* XXX is this right? */
if (mesaVis->stencilBits) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24,
+ = driNewRenderbuffer(MESA_FORMAT_Z24_S8,
NULL,
screen->cpp,
screen->depthOffset, screen->depthPitch,
@@ -767,7 +767,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
}
else {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT32,
+ = driNewRenderbuffer(MESA_FORMAT_Z32,
NULL,
screen->cpp,
screen->depthOffset, screen->depthPitch,
@@ -778,7 +778,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
}
else if (mesaVis->depthBits == 32) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT32,
+ = driNewRenderbuffer(MESA_FORMAT_Z32,
NULL,
screen->cpp,
screen->depthOffset, screen->depthPitch,
@@ -789,7 +789,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->stencilBits > 0 && !swStencil) {
driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT,
+ = driNewRenderbuffer(MESA_FORMAT_S8,
NULL,
screen->cpp,
screen->depthOffset, screen->depthPitch,
diff --git a/src/mesa/drivers/dri/mga/mgaspan.c b/src/mesa/drivers/dri/mga/mgaspan.c
index 5b6d323ca98..2ff1cac8e24 100644
--- a/src/mesa/drivers/dri/mga/mgaspan.c
+++ b/src/mesa/drivers/dri/mga/mgaspan.c
@@ -206,24 +206,22 @@ void mgaDDInitSpanFuncs( GLcontext *ctx )
void
mgaSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
{
- if (drb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- mgaInitPointers_565(&drb->Base);
- }
- else {
- mgaInitPointers_8888(&drb->Base);
- }
+ if (drb->Base.Format == MESA_FORMAT_RGB565) {
+ mgaInitPointers_565(&drb->Base);
}
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
+ else if (drb->Base.Format == MESA_FORMAT_ARGB8888) {
+ mgaInitPointers_8888(&drb->Base);
+ }
+ else if (drb->Base.Format == MESA_FORMAT_Z16) {
mgaInitDepthPointers_z16(&drb->Base);
}
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
+ else if (drb->Base.Format == MESA_FORMAT_Z24_S8) {
mgaInitDepthPointers_z24_s8(&drb->Base);
}
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT32) {
+ else if (drb->Base.Format == MESA_FORMAT_Z32) {
mgaInitDepthPointers_z32(&drb->Base);
}
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
+ else if (drb->Base.Format == MESA_FORMAT_S8) {
mgaInitStencilPointers_z24_s8(&drb->Base);
}
}
diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c
index f5bcc2f2906..652dad51f2a 100644
--- a/src/mesa/drivers/dri/r128/r128_screen.c
+++ b/src/mesa/drivers/dri/r128/r128_screen.c
@@ -284,7 +284,7 @@ r128CreateBuffer( __DRIscreenPrivate *driScrnPriv,
{
driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888,
NULL,
screen->cpp,
screen->frontOffset, screen->frontPitch,
@@ -295,7 +295,7 @@ r128CreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->doubleBufferMode) {
driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888,
NULL,
screen->cpp,
screen->backOffset, screen->backPitch,
@@ -306,7 +306,7 @@ r128CreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->depthBits == 16) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16,
+ = driNewRenderbuffer(MESA_FORMAT_Z16,
NULL,
screen->cpp,
screen->depthOffset, screen->depthPitch,
@@ -316,7 +316,7 @@ r128CreateBuffer( __DRIscreenPrivate *driScrnPriv,
}
else if (mesaVis->depthBits == 24) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24,
+ = driNewRenderbuffer(MESA_FORMAT_S8_Z24,
NULL,
screen->cpp,
screen->depthOffset, screen->depthPitch,
@@ -327,7 +327,7 @@ r128CreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->stencilBits > 0 && !swStencil) {
driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT,
+ = driNewRenderbuffer(MESA_FORMAT_S8,
NULL,
screen->cpp,
screen->depthOffset, screen->depthPitch,
diff --git a/src/mesa/drivers/dri/r128/r128_span.c b/src/mesa/drivers/dri/r128/r128_span.c
index dd177e0def5..d238cc3c941 100644
--- a/src/mesa/drivers/dri/r128/r128_span.c
+++ b/src/mesa/drivers/dri/r128/r128_span.c
@@ -433,21 +433,19 @@ void r128DDInitSpanFuncs( GLcontext *ctx )
void
r128SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
{
- if (drb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- r128InitPointers_RGB565(&drb->Base);
- }
- else {
- r128InitPointers_ARGB8888(&drb->Base);
- }
+ if (drb->Base.Format == MESA_FORMAT_RGB565) {
+ r128InitPointers_RGB565(&drb->Base);
}
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
+ else if (drb->Base.Format == MESA_FORMAT_ARGB8888) {
+ r128InitPointers_ARGB8888(&drb->Base);
+ }
+ else if (drb->Base.Format == MESA_FORMAT_Z16) {
r128InitDepthPointers_z16(&drb->Base);
}
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
+ else if (drb->Base.Format == MESA_FORMAT_S8_Z24) {
r128InitDepthPointers_z24_s8(&drb->Base);
}
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
+ else if (drb->Base.Format == MESA_FORMAT_S8) {
radeonInitStencilPointers_z24_s8(&drb->Base);
}
}
diff --git a/src/mesa/drivers/dri/s3v/s3v_xmesa.c b/src/mesa/drivers/dri/s3v/s3v_xmesa.c
index 85f14817696..f1e123d6769 100644
--- a/src/mesa/drivers/dri/s3v/s3v_xmesa.c
+++ b/src/mesa/drivers/dri/s3v/s3v_xmesa.c
@@ -70,7 +70,7 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv,
{
driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp,
screen->frontOffset, screen->frontPitch,
driDrawPriv);
s3vSetSpanFunctions(frontRb, mesaVis);
@@ -79,7 +79,7 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->doubleBufferMode) {
driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp,
screen->backOffset, screen->backPitch,
driDrawPriv);
s3vSetSpanFunctions(backRb, mesaVis);
@@ -89,7 +89,7 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->depthBits == 16) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL, screen->cpp,
+ = driNewRenderbuffer(MESA_FORMAT_Z16, NULL, screen->cpp,
screen->depthOffset, screen->depthPitch,
driDrawPriv);
s3vSetSpanFunctions(depthRb, mesaVis);
@@ -97,7 +97,7 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv,
}
else if (mesaVis->depthBits == 24) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, NULL, screen->cpp,
+ = driNewRenderbuffer(MESA_FORMAT_Z24_S8, NULL, screen->cpp,
screen->depthOffset, screen->depthPitch,
driDrawPriv);
s3vSetSpanFunctions(depthRb, mesaVis);
@@ -107,7 +107,7 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv,
/* no h/w stencil yet?
if (mesaVis->stencilBits > 0) {
driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, NULL,
+ = driNewRenderbuffer(MESA_FORMAT_S8, NULL,
screen->cpp, screen->depthOffset,
screen->depthPitch, driDrawPriv);
s3vSetSpanFunctions(stencilRb, mesaVis);
diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c
index 048fbe452c2..9eea7283196 100644
--- a/src/mesa/drivers/dri/savage/savage_xmesa.c
+++ b/src/mesa/drivers/dri/savage/savage_xmesa.c
@@ -602,7 +602,7 @@ savageCreateBuffer( __DRIscreenPrivate *driScrnPriv,
{
driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888,
(GLubyte *) screen->aperture.map
+ 0x01000000 * TARGET_FRONT,
screen->cpp,
@@ -615,7 +615,7 @@ savageCreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->doubleBufferMode) {
driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888,
(GLubyte *) screen->aperture.map
+ 0x01000000 * TARGET_BACK,
screen->cpp,
@@ -628,7 +628,7 @@ savageCreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->depthBits == 16) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16,
+ = driNewRenderbuffer(MESA_FORMAT_Z16,
(GLubyte *) screen->aperture.map
+ 0x01000000 * TARGET_DEPTH,
screen->zpp,
@@ -639,7 +639,7 @@ savageCreateBuffer( __DRIscreenPrivate *driScrnPriv,
}
else if (mesaVis->depthBits == 24) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24,
+ = driNewRenderbuffer(MESA_FORMAT_S8_Z24,
(GLubyte *) screen->aperture.map
+ 0x01000000 * TARGET_DEPTH,
screen->zpp,
@@ -651,7 +651,7 @@ savageCreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->stencilBits > 0 && !swStencil) {
driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT,
+ = driNewRenderbuffer(MESA_FORMAT_S8,
(GLubyte *) screen->aperture.map
+ 0x01000000 * TARGET_DEPTH,
screen->zpp,
diff --git a/src/mesa/drivers/dri/savage/savagespan.c b/src/mesa/drivers/dri/savage/savagespan.c
index 9615e34013c..3bb6fbcc63c 100644
--- a/src/mesa/drivers/dri/savage/savagespan.c
+++ b/src/mesa/drivers/dri/savage/savagespan.c
@@ -255,15 +255,13 @@ void
savageSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis,
GLboolean float_depth)
{
- if (drb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- savageInitPointers_565(&drb->Base);
- }
- else {
- savageInitPointers_8888(&drb->Base);
- }
+ if (drb->Base.Format == MESA_FORMAT_RGB565) {
+ savageInitPointers_565(&drb->Base);
+ }
+ else if (drb->Base.Format == MESA_FORMAT_ARGB8888) {
+ savageInitPointers_8888(&drb->Base);
}
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
+ else if (drb->Base.Format == MESA_FORMAT_Z16) {
if (float_depth) {
savageInitDepthPointers_z16f(&drb->Base);
}
@@ -271,7 +269,7 @@ savageSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis,
savageInitDepthPointers_z16(&drb->Base);
}
}
- else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
+ else if (drb->Base.Format == MESA_FORMAT_S8_Z24) {
if (float_depth) {
savageInitDepthPointers_s8_z24f(&drb->Base);
}
@@ -279,7 +277,7 @@ savageSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis,
savageInitDepthPointers_s8_z24(&drb->Base);
}
}
- else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
+ else if (drb->Base.Format == MESA_FORMAT_S8) {
savageInitStencilPointers_s8_z24(&drb->Base);
}
}
diff --git a/src/mesa/drivers/dri/sis/sis_span.c b/src/mesa/drivers/dri/sis/sis_span.c
index 9e9a509755d..cfbb51007d1 100644
--- a/src/mesa/drivers/dri/sis/sis_span.c
+++ b/src/mesa/drivers/dri/sis/sis_span.c
@@ -176,24 +176,22 @@ sisDDInitSpanFuncs( GLcontext *ctx )
void
sisSetSpanFunctions(struct sis_renderbuffer *srb, const GLvisual *vis)
{
- if (srb->Base.InternalFormat == GL_RGBA) {
- if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
- sisInitPointers_RGB565( &srb->Base );
- }
- else {
- sisInitPointers_ARGB8888( &srb->Base );
- }
+ if (srb->Base.Format == MESA_FORMAT_RGB565) {
+ sisInitPointers_RGB565( &srb->Base );
}
- else if (srb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
+ else if (srb->Base.Format == MESA_FORMAT_ARGB8888) {
+ sisInitPointers_ARGB8888( &srb->Base );
+ }
+ else if (srb->Base.Format == MESA_FORMAT_Z16) {
sisInitDepthPointers_z16(&srb->Base);
}
- else if (srb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
+ else if (srb->Base.Format == MESA_FORMAT_S8_Z24) {
sisInitDepthPointers_z24_s8(&srb->Base);
}
- else if (srb->Base.InternalFormat == GL_DEPTH_COMPONENT32) {
+ else if (srb->Base.Format == MESA_FORMAT_Z32) {
sisInitDepthPointers_z32(&srb->Base);
}
- else if (srb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
+ else if (srb->Base.Format == MESA_FORMAT_S8) {
sisInitStencilPointers_z24_s8(&srb->Base);
}
}
diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c
index 58bd48b294c..c29694679de 100644
--- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c
+++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c
@@ -173,7 +173,7 @@ tdfxCreateBuffer( __DRIscreenPrivate *driScrnPriv,
{
driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp,
screen->fbOffset, screen->width, driDrawPriv);
tdfxSetSpanFunctions(frontRb, mesaVis);
_mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
@@ -181,7 +181,7 @@ tdfxCreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->doubleBufferMode) {
driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp,
screen->backOffset, screen->width,
driDrawPriv);
tdfxSetSpanFunctions(backRb, mesaVis);
@@ -191,7 +191,7 @@ tdfxCreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->depthBits == 16) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL, screen->cpp,
+ = driNewRenderbuffer(MESA_FORMAT_Z16, NULL, screen->cpp,
screen->depthOffset, screen->width,
driDrawPriv);
tdfxSetSpanFunctions(depthRb, mesaVis);
@@ -199,7 +199,7 @@ tdfxCreateBuffer( __DRIscreenPrivate *driScrnPriv,
}
else if (mesaVis->depthBits == 24) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, NULL, screen->cpp,
+ = driNewRenderbuffer(MESA_FORMAT_Z24_S8, NULL, screen->cpp,
screen->depthOffset, screen->width,
driDrawPriv);
tdfxSetSpanFunctions(depthRb, mesaVis);
@@ -208,7 +208,7 @@ tdfxCreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->stencilBits > 0) {
driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, NULL, screen->cpp,
+ = driNewRenderbuffer(MESA_FORMAT_S8, NULL, screen->cpp,
screen->depthOffset, screen->width,
driDrawPriv);
tdfxSetSpanFunctions(stencilRb, mesaVis);
diff --git a/src/mesa/drivers/dri/trident/trident_context.c b/src/mesa/drivers/dri/trident/trident_context.c
index b5126b07ea6..b693a95ece0 100644
--- a/src/mesa/drivers/dri/trident/trident_context.c
+++ b/src/mesa/drivers/dri/trident/trident_context.c
@@ -215,7 +215,7 @@ tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv,
{
driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp,
screen->frontOffset, screen->frontPitch,
driDrawPriv);
/*
@@ -226,7 +226,7 @@ tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->doubleBufferMode) {
driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp,
screen->backOffset, screen->backPitch,
driDrawPriv);
/*
@@ -237,7 +237,7 @@ tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv,
if (mesaVis->depthBits == 16) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL, screen->cpp,
+ = driNewRenderbuffer(MESA_FORMAT_Z16, NULL, screen->cpp,
screen->depthOffset, screen->depthPitch,
driDrawPriv);
/*
@@ -247,7 +247,7 @@ tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv,
}
else if (mesaVis->depthBits == 24) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, NULL, screen->cpp,
+ = driNewRenderbuffer(MESA_FORMAT_Z24_S8, NULL, screen->cpp,
screen->depthOffset, screen->depthPitch,
driDrawPriv);
/*
@@ -259,7 +259,7 @@ tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv,
/* no h/w stencil?
if (mesaVis->stencilBits > 0 && !swStencil) {
driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT);
+ = driNewRenderbuffer(MESA_FORMAT_S8);
tridentSetSpanFunctions(stencilRb, mesaVis);
_mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
}
diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c
index 3dbb5705710..5b5477d8e01 100644
--- a/src/mesa/drivers/dri/unichrome/via_screen.c
+++ b/src/mesa/drivers/dri/unichrome/via_screen.c
@@ -248,7 +248,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
/* XXX check/fix the offset/pitch parameters! */
{
driRenderbuffer *frontRb
- = driNewRenderbuffer(GL_RGBA, NULL,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL,
screen->bytesPerPixel,
0, screen->width, driDrawPriv);
viaSetSpanFunctions(frontRb, mesaVis);
@@ -257,7 +257,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
if (mesaVis->doubleBufferMode) {
driRenderbuffer *backRb
- = driNewRenderbuffer(GL_RGBA, NULL,
+ = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL,
screen->bytesPerPixel,
0, screen->width, driDrawPriv);
viaSetSpanFunctions(backRb, mesaVis);
@@ -266,7 +266,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
if (mesaVis->depthBits == 16) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL,
+ = driNewRenderbuffer(MESA_FORMAT_Z16, NULL,
screen->bytesPerPixel,
0, screen->width, driDrawPriv);
viaSetSpanFunctions(depthRb, mesaVis);
@@ -274,7 +274,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
}
else if (mesaVis->depthBits == 24) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT24, NULL,
+ = driNewRenderbuffer(MESA_FORMAT_Z24_S8, NULL,
screen->bytesPerPixel,
0, screen->width, driDrawPriv);
viaSetSpanFunctions(depthRb, mesaVis);
@@ -282,7 +282,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
}
else if (mesaVis->depthBits == 32) {
driRenderbuffer *depthRb
- = driNewRenderbuffer(GL_DEPTH_COMPONENT32, NULL,
+ = driNewRenderbuffer(MESA_FORMAT_Z32, NULL,
screen->bytesPerPixel,
0, screen->width, driDrawPriv);
viaSetSpanFunctions(depthRb, mesaVis);
@@ -291,7 +291,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
if (mesaVis->stencilBits > 0 && !swStencil) {
driRenderbuffer *stencilRb
- = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, NULL,
+ = driNewRenderbuffer(MESA_FORMAT_S8, NULL,
screen->bytesPerPixel,
0, screen->width, driDrawPriv);
viaSetSpanFunctions(stencilRb, mesaVis);
diff --git a/src/mesa/drivers/dri/unichrome/via_span.c b/src/mesa/drivers/dri/unichrome/via_span.c
index b908f0fb23a..e847164cd02 100644
--- a/src/mesa/drivers/dri/unichrome/via_span.c
+++ b/src/mesa/drivers/dri/unichrome/via_span.c
@@ -23,6 +23,7 @@
*/
#include "main/glheader.h"
+#include "main/formats.h"
#include "main/macros.h"
#include "main/mtypes.h"
#include "main/colormac.h"
@@ -177,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.InternalFormat == GL_DEPTH_COMPONENT16) {
+ else if (vrb->Base.Format == MESA_FORMAT_ARGB8888) {
+ viaInitPointers_8888(&vrb->Base);
+ }
+ 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);
}
}