From 1160acbfea986a821761d18f5f14d5d2cb0dea8c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Oct 2009 19:49:21 -0600 Subject: 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. --- src/mesa/drivers/dri/mga/mga_xmesa.c | 14 +++++++------- src/mesa/drivers/dri/mga/mgaspan.c | 20 +++++++++----------- 2 files changed, 16 insertions(+), 18 deletions(-) (limited to 'src/mesa/drivers/dri/mga') diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 0dc76fea50..4ca71ca505 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 5b6d323ca9..2ff1cac8e2 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); } } -- cgit v1.2.3