diff options
author | gareth <gareth> | 2001-03-06 05:10:24 +0000 |
---|---|---|
committer | gareth <gareth> | 2001-03-06 05:10:24 +0000 |
commit | 5b330a99173aa36fb6b4b51bc2d6b5be996194a0 (patch) | |
tree | 43c890027ab547b28eed53551f6ea44e9a57791d | |
parent | 86e3f5696de77926473bad2a1d700eb5569f8c6c (diff) |
- Fix MGA texturing.tdfx-3-1-0-20010306-merge
- Fix VB flushing in Mesa's *TexSubImage* calls.
-rw-r--r-- | xc/extras/Mesa/src/teximage.c | 24 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgadd.c | 2 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgatex.c | 147 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c | 8 |
4 files changed, 26 insertions, 155 deletions
diff --git a/xc/extras/Mesa/src/teximage.c b/xc/extras/Mesa/src/teximage.c index fc610cb0b..3cc03cc2b 100644 --- a/xc/extras/Mesa/src/teximage.c +++ b/xc/extras/Mesa/src/teximage.c @@ -1878,11 +1878,10 @@ void _mesa_GetTexImage( GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels ) { - GET_CURRENT_CONTEXT(ctx); const struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLboolean discardImage; - + GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexImage"); if (level < 0 || level >= ctx->Const.MaxTextureLevels) { @@ -2058,11 +2057,12 @@ _mesa_TexSubImage1D( GLenum target, GLint level, GLenum format, GLenum type, const GLvoid *pixels ) { - GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLboolean success = GL_FALSE; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexSubImage1D"); if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0, width, 1, 1, format, type)) { @@ -2141,11 +2141,12 @@ _mesa_TexSubImage2D( GLenum target, GLint level, GLenum format, GLenum type, const GLvoid *pixels ) { - GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLboolean success = GL_FALSE; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexSubImage2D"); if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0, width, height, 1, format, type)) { @@ -2254,11 +2255,12 @@ _mesa_TexSubImage3D( GLenum target, GLint level, GLenum format, GLenum type, const GLvoid *pixels ) { - GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLboolean success = GL_FALSE; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexSubImage3D"); if (subtexture_error_check(ctx, 3, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type)) { @@ -3000,11 +3002,12 @@ _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data) { - GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLboolean success = GL_FALSE; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexSubImage1DARB"); if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0, width, 1, 1, format, GL_NONE)) { @@ -3037,11 +3040,12 @@ _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, GLenum format, GLsizei imageSize, const GLvoid *data) { - GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLboolean success = GL_FALSE; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexSubImage2DARB"); if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0, width, height, 1, format, GL_NONE)) { @@ -3075,11 +3079,12 @@ _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data) { - GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLboolean success = GL_FALSE; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexSubImage2DARB"); if (subtexture_error_check(ctx, 3, target, level, xoffset, yoffset, zoffset, width, height, depth, format, GL_NONE)) { @@ -3110,10 +3115,9 @@ _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, void _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) { - GET_CURRENT_CONTEXT(ctx); const struct gl_texture_object *texObj; struct gl_texture_image *texImage; - + GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetCompressedTexImageARB"); if (level < 0 || level >= ctx->Const.MaxTextureLevels) { diff --git a/xc/lib/GL/mesa/src/drv/mga/mgadd.c b/xc/lib/GL/mesa/src/drv/mga/mgadd.c index dced4235b..6f055c5be 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgadd.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgadd.c @@ -51,7 +51,7 @@ #include "X86/common_x86_asm.h" #endif -#define MGA_DATE "20010215" +#define MGA_DATE "20010306" diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatex.c b/xc/lib/GL/mesa/src/drv/mga/mgatex.c index 0986b04be..0bb912645 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgatex.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgatex.c @@ -251,8 +251,8 @@ static GLint mgaChooseTexFormat( mgaContextPtr mmesa, case GL_ALPHA8: case GL_ALPHA12: case GL_ALPHA16: - /* FIXME: This breaks the G200... */ - SET_FORMAT( TMC_tformat_tw8a, _mesa_texformat_a8 ); + /* FIXME: This will report incorrect component sizes... */ + SET_FORMAT( TMC_tformat_tw12, _mesa_texformat_argb4444 ); break; case 1: @@ -261,8 +261,8 @@ static GLint mgaChooseTexFormat( mgaContextPtr mmesa, case GL_LUMINANCE8: case GL_LUMINANCE12: case GL_LUMINANCE16: - /* FIXME: This breaks the G200... */ - SET_FORMAT( TMC_tformat_tw8al, _mesa_texformat_al88 ); + /* FIXME: This will report incorrect component sizes... */ + SET_FORMAT( TMC_tformat_tw16, _mesa_texformat_rgb565 ); break; case 2: @@ -273,8 +273,8 @@ static GLint mgaChooseTexFormat( mgaContextPtr mmesa, case GL_LUMINANCE12_ALPHA4: case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: - /* FIXME: This breaks the G200... */ - SET_FORMAT( TMC_tformat_tw8al, _mesa_texformat_al88 ); + /* FIXME: This will report incorrect component sizes... */ + SET_FORMAT( TMC_tformat_tw12, _mesa_texformat_argb4444 ); break; case GL_INTENSITY: @@ -282,8 +282,8 @@ static GLint mgaChooseTexFormat( mgaContextPtr mmesa, case GL_INTENSITY8: case GL_INTENSITY12: case GL_INTENSITY16: - /* FIXME: This breaks the G200... */ - SET_FORMAT( TMC_tformat_tw8al, _mesa_texformat_al88 ); + /* FIXME: This will report incorrect component sizes... */ + SET_FORMAT( TMC_tformat_tw12, _mesa_texformat_argb4444 ); break; case GL_COLOR_INDEX: @@ -308,135 +308,6 @@ static GLint mgaChooseTexFormat( mgaContextPtr mmesa, } -#if 0 -/* - * Input: - * baseFormat - base texture format - * intFormat - user's prefered internal format - * allow32bpt - allow 32-bit texels? - * Output: - * texelBytes - bytes per texel - * mgaFormat - mga hardware texture format - * redBits - actual bits of red - * greenBits - actual bits of green - * blueBits - ... - * ... - */ -static void mgaChooseTexelFormat(GLenum baseFormat, GLenum intFormat, - GLboolean allow32bpt, - GLint *texelBytes, GLint *mgaFormat, - GLubyte *redBits, GLubyte *greenBits, - GLubyte *blueBits, GLubyte *alphaBits, - GLubyte *luminanceBits, - GLubyte *intensityBits, - GLubyte *indexBits) -{ - *redBits = 0; - *greenBits = 0; - *blueBits = 0; - *alphaBits = 0; - *intensityBits = 0; - *luminanceBits = 0; - *indexBits = 0; - - switch (baseFormat) { - case GL_RGB: - if (intFormat != GL_RGB5 && (intFormat == GL_RGB8 || allow32bpt)) { - *texelBytes = 4; - *mgaFormat = TMC_tformat_tw32; - *redBits = 8; - *greenBits = 8; - *blueBits = 8; - } - else { - *texelBytes = 2; - *mgaFormat = TMC_tformat_tw16; - *redBits = 5; - *greenBits = 6; - *blueBits = 5; - } - break; - case GL_LUMINANCE: - if (intFormat != GL_RGB5 && (intFormat == GL_RGB8 || allow32bpt)) { - *texelBytes = 4; - *mgaFormat = TMC_tformat_tw32; - *luminanceBits = 8; - } - else { - *texelBytes = 2; - *mgaFormat = TMC_tformat_tw16; - *luminanceBits = 5; - } - break; - case GL_ALPHA: - if (intFormat != GL_RGBA4 && (intFormat == GL_RGBA8 || allow32bpt)) { - *texelBytes = 4; - *mgaFormat = TMC_tformat_tw32; - *alphaBits = 8; - } - else { - *texelBytes = 2; - *mgaFormat = TMC_tformat_tw12; - *alphaBits = 4; - } - break; - case GL_LUMINANCE_ALPHA: - if (intFormat != GL_RGBA4 && (intFormat == GL_RGBA8 || allow32bpt)) { - *texelBytes = 4; - *mgaFormat = TMC_tformat_tw32; - *luminanceBits = 8; - *alphaBits = 8; - } - else { - *texelBytes = 2; - *mgaFormat = TMC_tformat_tw12; - *luminanceBits = 4; - *alphaBits = 4; - } - break; - case GL_INTENSITY: - if (intFormat != GL_RGBA4 && (intFormat == GL_RGBA8 || allow32bpt)) { - *texelBytes = 4; - *mgaFormat = TMC_tformat_tw32; - *intensityBits = 8; - } - else { - *texelBytes = 2; - *mgaFormat = TMC_tformat_tw12; - *intensityBits = 4; - } - break; - case GL_RGBA: - if (intFormat != GL_RGBA4 && (intFormat == GL_RGBA8 || allow32bpt)) { - *texelBytes = 4; - *mgaFormat = TMC_tformat_tw32; - *redBits = 8; - *greenBits = 8; - *blueBits = 8; - *alphaBits = 8; - } - else { - *texelBytes = 2; - *mgaFormat = TMC_tformat_tw12; - *redBits = 4; - *greenBits = 4; - *blueBits = 4; - *alphaBits = 4; - } - break; - case GL_COLOR_INDEX: - *mgaFormat = TMC_tformat_tw8; - *texelBytes = 1; - *indexBits = 8; - break; - default: - gl_problem(NULL, "bad format in mgaChooseTexelFormat()"); - return; - } -} -#endif - - /* * mgaCreateTexObj * Allocate space for and load the mesa images into the texture memory block. @@ -466,6 +337,7 @@ static void mgaCreateTexObj(mgaContextPtr mmesa, */ tformat = mgaChooseTexFormat( mmesa, image, image->Format, GL_UNSIGNED_BYTE ); + t->texelBytes = image->TexFormat->TexelBytes; /* We are going to upload all levels that are present, even if * later levels wouldn't be used by the current filtering mode. This @@ -495,7 +367,6 @@ static void mgaCreateTexObj(mgaContextPtr mmesa, t->age = 0; t->bound = 0; t->MemBlock = 0; - t->texelBytes = image->TexFormat->TexelBytes; insert_at_tail(&(mmesa->SwappedOut), t); diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c index 6659f7abe..205b99770 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c @@ -558,10 +558,8 @@ radeonDDTexSubImage1D( GLcontext *ctx, GLenum target, GLint level, */ ASSERT( t ); - if ( t->bound ) { - FLUSH_VB( ctx, "radeonDDTexSubImage2D" ); + if ( t->bound ) FLUSH_BATCH( rmesa ); - } texFormat = texImage->TexFormat; @@ -599,10 +597,8 @@ radeonDDTexSubImage2D( GLcontext *ctx, GLenum target, GLint level, */ ASSERT( t ); - if ( t->bound ) { - FLUSH_VB( ctx, "radeonDDTexSubImage2D" ); + if ( t->bound ) FLUSH_BATCH( rmesa ); - } texFormat = texImage->TexFormat; |