summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/mga
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-10-28 21:24:11 -0600
committerBrian Paul <[email protected]>2009-10-28 21:24:11 -0600
commit1f196b786d6bd0c6a5dbdc638574ff716cc3d4de (patch)
tree5ae2753b99070f8b35c51576bd39e52df63879d6 /src/mesa/drivers/dri/mga
parent0ea575d721821262a862ceef010db9b1a8b4a6d9 (diff)
parent086f9fc0e2aef27f54eda87c733685500555bf20 (diff)
Merge branch 'texformat-rework'
Conflicts: src/mesa/drivers/dri/radeon/radeon_fbo.c src/mesa/drivers/dri/s3v/s3v_tex.c src/mesa/drivers/dri/s3v/s3v_xmesa.c src/mesa/drivers/dri/trident/trident_context.c src/mesa/main/debug.c src/mesa/main/mipmap.c src/mesa/main/texformat.c src/mesa/main/texgetimage.c
Diffstat (limited to 'src/mesa/drivers/dri/mga')
-rw-r--r--src/mesa/drivers/dri/mga/mga_texstate.c23
-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/mga/mgatex.c59
-rw-r--r--src/mesa/drivers/dri/mga/mgatexmem.c2
5 files changed, 56 insertions, 62 deletions
diff --git a/src/mesa/drivers/dri/mga/mga_texstate.c b/src/mesa/drivers/dri/mga/mga_texstate.c
index ad765d1dd76..54eda62a96a 100644
--- a/src/mesa/drivers/dri/mga/mga_texstate.c
+++ b/src/mesa/drivers/dri/mga/mga_texstate.c
@@ -27,22 +27,19 @@
* Keith Whitwell <[email protected]>
*/
-#include <stdlib.h>
+#include "main/context.h"
+#include "main/enums.h"
+#include "main/macros.h"
#include "main/mm.h"
+#include "main/imports.h"
+#include "main/simple_list.h"
+
#include "mgacontext.h"
#include "mgatex.h"
#include "mgaregs.h"
#include "mgatris.h"
#include "mgaioctl.h"
-#include "main/context.h"
-#include "main/enums.h"
-#include "main/macros.h"
-#include "main/imports.h"
-
-#include "main/simple_list.h"
-#include "main/texformat.h"
-
#define MGA_USE_TABLE_FOR_FORMAT
#ifdef MGA_USE_TABLE_FOR_FORMAT
#define TMC_nr_tformat (MESA_FORMAT_YCBCR_REV + 1)
@@ -94,14 +91,14 @@ mgaSetTexImages( mgaContextPtr mmesa,
return;
}
#else
- if ( (baseImage->TexFormat->MesaFormat >= TMC_nr_tformat)
- || (TMC_tformat[ baseImage->TexFormat->MesaFormat ] == 0) )
+ if ( (baseImage->TexFormat >= TMC_nr_tformat)
+ || (TMC_tformat[ baseImage->TexFormat ] == 0) )
{
_mesa_problem(NULL, "unexpected texture format in %s", __FUNCTION__);
return;
}
- txformat = TMC_tformat[ baseImage->TexFormat->MesaFormat ];
+ txformat = TMC_tformat[ baseImage->TexFormat ];
#endif /* MGA_USE_TABLE_FOR_FORMAT */
@@ -131,7 +128,7 @@ mgaSetTexImages( mgaContextPtr mmesa,
break;
size = texImage->Width * texImage->Height *
- baseImage->TexFormat->TexelBytes;
+ _mesa_get_format_bytes(baseImage->TexFormat);
t->offsets[i] = totalSize;
t->base.dirty_images[0] |= (1<<i);
diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c
index 03fd9b6fc16..2c7f50c498e 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/mga/mgatex.c b/src/mesa/drivers/dri/mga/mgatex.c
index 33eb0be4496..9163371b332 100644
--- a/src/mesa/drivers/dri/mga/mgatex.c
+++ b/src/mesa/drivers/dri/mga/mgatex.c
@@ -27,23 +27,22 @@
#include "main/glheader.h"
#include "main/mm.h"
-#include "mgacontext.h"
-#include "mgatex.h"
-#include "mgaregs.h"
-#include "mgatris.h"
-#include "mgaioctl.h"
-
#include "main/colormac.h"
#include "main/context.h"
#include "main/enums.h"
#include "main/simple_list.h"
#include "main/imports.h"
#include "main/macros.h"
-#include "main/texformat.h"
#include "main/texstore.h"
#include "main/teximage.h"
#include "main/texobj.h"
+#include "mgacontext.h"
+#include "mgatex.h"
+#include "mgaregs.h"
+#include "mgatris.h"
+#include "mgaioctl.h"
+
#include "swrast/swrast.h"
#include "xmlpool.h"
@@ -164,7 +163,7 @@ static void mgaSetTexBorderColor(mgaTextureObjectPtr t, const GLfloat color[4])
}
-static const struct gl_texture_format *
+static gl_format
mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
@@ -182,15 +181,15 @@ mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
switch ( type ) {
case GL_UNSIGNED_INT_10_10_10_2:
case GL_UNSIGNED_INT_2_10_10_10_REV:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555;
+ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555;
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_UNSIGNED_SHORT_5_5_5_1:
case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
default:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
+ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444;
}
case 3:
@@ -199,15 +198,15 @@ mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
switch ( type ) {
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_UNSIGNED_SHORT_5_5_5_1:
case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
case GL_UNSIGNED_SHORT_5_6_5:
case GL_UNSIGNED_SHORT_5_6_5_REV:
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
default:
- return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
+ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565;
}
case GL_RGBA8:
@@ -215,25 +214,25 @@ mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
case GL_RGBA12:
case GL_RGBA16:
return !force16bpt ?
- &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444;
+ MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444;
case GL_RGBA4:
case GL_RGBA2:
- return &_mesa_texformat_argb4444;
+ return MESA_FORMAT_ARGB4444;
case GL_RGB5_A1:
- return &_mesa_texformat_argb1555;
+ return MESA_FORMAT_ARGB1555;
case GL_RGB8:
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
- return !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;
+ return !force16bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565;
case GL_RGB5:
case GL_RGB4:
case GL_R3_G3_B2:
- return &_mesa_texformat_rgb565;
+ return MESA_FORMAT_RGB565;
case GL_ALPHA:
case GL_ALPHA4:
@@ -242,7 +241,7 @@ mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
case GL_ALPHA16:
case GL_COMPRESSED_ALPHA:
/* FIXME: This will report incorrect component sizes... */
- return MGA_IS_G400(mmesa) ? &_mesa_texformat_al88 : &_mesa_texformat_argb4444;
+ return MGA_IS_G400(mmesa) ? MESA_FORMAT_AL88 : MESA_FORMAT_ARGB4444;
case 1:
case GL_LUMINANCE:
@@ -252,7 +251,7 @@ mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
case GL_LUMINANCE16:
case GL_COMPRESSED_LUMINANCE:
/* FIXME: This will report incorrect component sizes... */
- return MGA_IS_G400(mmesa) ? &_mesa_texformat_al88 : &_mesa_texformat_rgb565;
+ return MGA_IS_G400(mmesa) ? MESA_FORMAT_AL88 : MESA_FORMAT_RGB565;
case 2:
case GL_LUMINANCE_ALPHA:
@@ -264,7 +263,7 @@ mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
case GL_LUMINANCE16_ALPHA16:
case GL_COMPRESSED_LUMINANCE_ALPHA:
/* FIXME: This will report incorrect component sizes... */
- return MGA_IS_G400(mmesa) ? &_mesa_texformat_al88 : &_mesa_texformat_argb4444;
+ return MGA_IS_G400(mmesa) ? MESA_FORMAT_AL88 : MESA_FORMAT_ARGB4444;
case GL_INTENSITY:
case GL_INTENSITY4:
@@ -273,15 +272,15 @@ mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
case GL_INTENSITY16:
case GL_COMPRESSED_INTENSITY:
/* FIXME: This will report incorrect component sizes... */
- return MGA_IS_G400(mmesa) ? &_mesa_texformat_i8 : &_mesa_texformat_argb4444;
+ return MGA_IS_G400(mmesa) ? MESA_FORMAT_I8 : MESA_FORMAT_ARGB4444;
case GL_YCBCR_MESA:
if (MGA_IS_G400(mmesa) &&
(type == GL_UNSIGNED_SHORT_8_8_APPLE ||
type == GL_UNSIGNED_BYTE))
- return &_mesa_texformat_ycbcr;
+ return MESA_FORMAT_YCBCR;
else
- return &_mesa_texformat_ycbcr_rev;
+ return MESA_FORMAT_YCBCR_REV;
case GL_COLOR_INDEX:
case GL_COLOR_INDEX1_EXT:
@@ -290,14 +289,14 @@ mgaChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
case GL_COLOR_INDEX8_EXT:
case GL_COLOR_INDEX12_EXT:
case GL_COLOR_INDEX16_EXT:
- return &_mesa_texformat_ci8;
+ return MESA_FORMAT_CI8;
default:
_mesa_problem( ctx, "unexpected texture format in %s", __FUNCTION__ );
- return NULL;
+ return MESA_FORMAT_NONE;
}
- return NULL; /* never get here */
+ return MESA_FORMAT_NONE; /* never get here */
}
diff --git a/src/mesa/drivers/dri/mga/mgatexmem.c b/src/mesa/drivers/dri/mga/mgatexmem.c
index 9a2d62b53b7..47be6f3c185 100644
--- a/src/mesa/drivers/dri/mga/mgatexmem.c
+++ b/src/mesa/drivers/dri/mga/mgatexmem.c
@@ -137,7 +137,7 @@ static void mgaUploadSubImage( mgaContextPtr mmesa,
* directly used by the hardware for texturing.
*/
- texelBytes = texImage->TexFormat->TexelBytes;
+ texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
length = texImage->Width * texImage->Height * texelBytes;
if ( t->base.heap->heapId == MGA_CARD_HEAP ) {
unsigned tex_offset = 0;