diff options
author | idr <idr> | 2003-07-22 04:54:31 +0000 |
---|---|---|
committer | idr <idr> | 2003-07-22 04:54:31 +0000 |
commit | b5e66d1b65b40ea7d8183f053644d55610c90a07 (patch) | |
tree | ee89ef39ab50a071437b6fd13f9f6ed25065c1a0 | |
parent | dde340c1c0eb9ae0b4c0fe8cb43f0b1d1d5bc1dd (diff) |
Refactored firstLevel / lastLevel from each driver's derrived texture
object "class" to the base driTextureObject "class."
-rw-r--r-- | xc/lib/GL/mesa/src/drv/common/texmem.h | 19 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/i830/i830_tex.h | 3 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/i830/i830_texmem.c | 4 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/i830/i830_texstate.c | 5 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mga_texstate.c | 4 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgacontext.h | 2 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/mga/mgatexmem.c | 4 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/r128/r128_texmem.c | 6 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/r128/r128_texobj.h | 5 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/r128/r128_texstate.c | 4 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/r200/r200_context.h | 6 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/r200/r200_texmem.c | 8 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/r200/r200_texstate.c | 4 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/radeon/radeon_context.h | 6 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c | 8 | ||||
-rw-r--r-- | xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c | 4 |
16 files changed, 42 insertions, 50 deletions
diff --git a/xc/lib/GL/mesa/src/drv/common/texmem.h b/xc/lib/GL/mesa/src/drv/common/texmem.h index 9b9fed472..719970461 100644 --- a/xc/lib/GL/mesa/src/drv/common/texmem.h +++ b/xc/lib/GL/mesa/src/drv/common/texmem.h @@ -77,14 +77,29 @@ struct dri_texture_object { * need to be uploaded to local or * AGP texture space. One flag set * for each cube face for cubic - * textures. + * textures. Bit zero corresponds to + * the base-level, which may or may + * not be the level zero mipmap. */ unsigned timestamp; /**< Timestamp used to * synchronize with 3d engine * in hardware where textures * are uploaded directly to - * the framebuffer. */ + * the framebuffer. + */ + + unsigned firstLevel; /**< Image in \c tObj->Image that + * corresponds to the base-level of + * this texture object. + */ + + unsigned lastLevel; /**< Last image in \c tObj->Image used + * by the current LOD settings of this + * texture object. This value must be + * greater than or equal to + * \c firstLevel. + */ }; diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_tex.h b/xc/lib/GL/mesa/src/drv/i830/i830_tex.h index 98be8a304..dbfcbe396 100644 --- a/xc/lib/GL/mesa/src/drv/i830/i830_tex.h +++ b/xc/lib/GL/mesa/src/drv/i830/i830_tex.h @@ -42,8 +42,6 @@ struct i830_texture_object_t int Pitch; int Height; char *BufAddr; - GLuint min_level; - GLuint max_level; GLenum palette_format; GLuint palette[256]; struct { @@ -59,7 +57,6 @@ struct i830_texture_object_t GLuint current_unit; GLuint Setup[I830_TEX_SETUP_SIZE]; GLuint dirty; - GLuint firstLevel,lastLevel; GLfloat max_anisotropy; }; diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_texmem.c b/xc/lib/GL/mesa/src/drv/i830/i830_texmem.c index 17dad3e5d..6cb553134 100644 --- a/xc/lib/GL/mesa/src/drv/i830/i830_texmem.c +++ b/xc/lib/GL/mesa/src/drv/i830/i830_texmem.c @@ -199,10 +199,10 @@ int i830UploadTexImagesLocked( i830ContextPtr imesa, i830TextureObjectPtr t ) /* Upload any images that are new */ if (t->base.dirty_images[0]) { int i; - const int numLevels = t->lastLevel - t->firstLevel + 1; + const int numLevels = t->base.lastLevel - t->base.firstLevel + 1; for (i = 0 ; i < numLevels ; i++) { - if ( (t->base.dirty_images[0] & (1 << (i+t->firstLevel))) != 0 ) { + if ( (t->base.dirty_images[0] & (1 << (i+t->base.firstLevel))) != 0 ) { i830UploadTexLevel( imesa, t, i ); } } diff --git a/xc/lib/GL/mesa/src/drv/i830/i830_texstate.c b/xc/lib/GL/mesa/src/drv/i830/i830_texstate.c index 236cbc316..03c98d2ee 100644 --- a/xc/lib/GL/mesa/src/drv/i830/i830_texstate.c +++ b/xc/lib/GL/mesa/src/drv/i830/i830_texstate.c @@ -145,8 +145,8 @@ static void i830SetTexImages( i830ContextPtr imesa, /* save these values */ - t->firstLevel = firstLevel; - t->lastLevel = lastLevel; + t->base.firstLevel = firstLevel; + t->base.lastLevel = lastLevel; /* Figure out the amount of memory required to hold all the mipmap @@ -184,7 +184,6 @@ static void i830SetTexImages( i830ContextPtr imesa, t->Pitch = pitch; t->base.totalSize = total_height*pitch; - t->max_level = i-1; t->Setup[I830_TEXREG_TM0S1] = (((tObj->Image[firstLevel]->Height - 1) << TM0S1_HEIGHT_SHIFT) | ((tObj->Image[firstLevel]->Width - 1) << TM0S1_WIDTH_SHIFT) | diff --git a/xc/lib/GL/mesa/src/drv/mga/mga_texstate.c b/xc/lib/GL/mesa/src/drv/mga/mga_texstate.c index 2623185eb..215f0bd9b 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mga_texstate.c +++ b/xc/lib/GL/mesa/src/drv/mga/mga_texstate.c @@ -151,8 +151,8 @@ mgaSetTexImages( mgaContextPtr mmesa, lastLevel = firstLevel + numLevels - 1; /* save these values */ - t->firstLevel = firstLevel; - t->lastLevel = lastLevel; + t->base.firstLevel = firstLevel; + t->base.lastLevel = lastLevel; t->base.totalSize = totalSize; diff --git a/xc/lib/GL/mesa/src/drv/mga/mgacontext.h b/xc/lib/GL/mesa/src/drv/mga/mgacontext.h index a03ed452b..874a694a6 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgacontext.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgacontext.h @@ -138,8 +138,6 @@ typedef struct mga_texture_object_s */ GLuint offsets[G400_TEX_MAXLEVELS]; - int firstLevel; - int lastLevel; int texelBytes; GLuint age; diff --git a/xc/lib/GL/mesa/src/drv/mga/mgatexmem.c b/xc/lib/GL/mesa/src/drv/mga/mgatexmem.c index f0a527fd4..fd13ef25e 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgatexmem.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgatexmem.c @@ -95,7 +95,7 @@ static void mgaUploadSubImage( mgaContextPtr mmesa, unsigned offset; unsigned texelBytes; unsigned length; - const int level = hwlevel + t->firstLevel; + const int level = hwlevel + t->base.firstLevel; if ( (hwlevel < 0) @@ -265,7 +265,7 @@ int mgaUploadTexImages( mgaContextPtr mmesa, mgaTextureObjectPtr t ) fprintf(stderr, "[%s:%d] dirty_images[0] = 0x%04x\n", __FILE__, __LINE__, t->base.dirty_images[0] ); - for (i = 0 ; i <= t->lastLevel ; i++) { + for (i = 0 ; i <= t->base.lastLevel ; i++) { if ( (t->base.dirty_images[0] & (1U << i)) != 0 ) { mgaUploadSubImage( mmesa, t, i ); } diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_texmem.c b/xc/lib/GL/mesa/src/drv/r128/r128_texmem.c index e29f40129..f6a5dfbbc 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_texmem.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_texmem.c @@ -176,7 +176,7 @@ static void uploadSubImage( r128ContextPtr rmesa, r128TexObjPtr t, } dwords = width * height / texelsPerDword; - offset = t->bufAddr + t->image[level - t->firstLevel].offset; + offset = t->bufAddr + t->image[level - t->base.firstLevel].offset; #if ENABLE_PERF_BOXES /* Bump the performace counter */ @@ -240,7 +240,7 @@ static void uploadSubImage( r128ContextPtr rmesa, r128TexObjPtr t, */ void r128UploadTexImages( r128ContextPtr rmesa, r128TexObjPtr t ) { - const GLint numLevels = t->lastLevel - t->firstLevel + 1; + const GLint numLevels = t->base.lastLevel - t->base.firstLevel + 1; GLint i; if ( R128_DEBUG & DEBUG_VERBOSE_API ) { @@ -288,7 +288,7 @@ void r128UploadTexImages( r128ContextPtr rmesa, r128TexObjPtr t ) /* Upload any images that are new */ if ( t->base.dirty_images[0] ) { for ( i = 0 ; i < numLevels; i++ ) { - const GLint j = t->firstLevel + i; /* the texObj's level */ + const GLint j = t->base.firstLevel + i; /* the texObj's level */ if ( t->base.dirty_images[0] & (1 << j) ) { uploadSubImage( rmesa, t, j, 0, 0, t->image[i].width, t->image[i].height ); diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_texobj.h b/xc/lib/GL/mesa/src/drv/r128/r128_texobj.h index 41fed0ab1..e2ff1ac24 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_texobj.h +++ b/xc/lib/GL/mesa/src/drv/r128/r128_texobj.h @@ -64,11 +64,6 @@ struct r128_tex_obj { CARD32 textureFormat; /* Actual hardware format */ r128_texture_regs_t setup; /* Setup regs for texture */ - - /* texObj->Image[firstLevel] through texObj->Image[lastLevel] are the - * images to upload. - */ - GLint firstLevel, lastLevel; }; #endif /* _R128_TEXOBJ_H_ */ diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_texstate.c b/xc/lib/GL/mesa/src/drv/r128/r128_texstate.c index 0ddcaa598..3f4347b02 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_texstate.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_texstate.c @@ -135,8 +135,8 @@ static void r128SetTexImages( r128ContextPtr rmesa, } t->base.totalSize = totalSize; - t->firstLevel = firstLevel; - t->lastLevel = lastLevel; + t->base.firstLevel = firstLevel; + t->base.lastLevel = lastLevel; /* Set the texture format */ t->setup.tex_cntl &= ~(0xf << 16); diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_context.h b/xc/lib/GL/mesa/src/drv/r200/r200_context.h index 6f53f4d49..3802deead 100644 --- a/xc/lib/GL/mesa/src/drv/r200/r200_context.h +++ b/xc/lib/GL/mesa/src/drv/r200/r200_context.h @@ -163,12 +163,6 @@ struct r200_tex_obj { GLuint pp_cubic_faces; /* cube face 1,2,3,4 log2 sizes */ GLboolean border_fallback; - - /* texObj->Image[firstLevel] through texObj->Image[lastLevel] are the - * images to upload. - */ - GLint firstLevel; - GLint lastLevel; }; diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_texmem.c b/xc/lib/GL/mesa/src/drv/r200/r200_texmem.c index 63dc38ffa..561d9ee18 100644 --- a/xc/lib/GL/mesa/src/drv/r200/r200_texmem.c +++ b/xc/lib/GL/mesa/src/drv/r200/r200_texmem.c @@ -285,7 +285,7 @@ static void uploadSubImage( r200ContextPtr rmesa, r200TexObjPtr t, GLint ret; drmRadeonTexture tex; drmRadeonTexImage tmp; - const int level = hwlevel + t->firstLevel; + const int level = hwlevel + t->base.firstLevel; if ( R200_DEBUG & DEBUG_TEXTURE ) { fprintf( stderr, "%s( %p, %p ) level/width/height/face = %d/%d/%d/%u\n", @@ -438,12 +438,12 @@ static void uploadSubImage( r200ContextPtr rmesa, r200TexObjPtr t, int r200UploadTexImages( r200ContextPtr rmesa, r200TexObjPtr t, GLuint face ) { - const int numLevels = t->lastLevel - t->firstLevel + 1; + const int numLevels = t->base.lastLevel - t->base.firstLevel + 1; if ( R200_DEBUG & (DEBUG_TEXTURE|DEBUG_IOCTL) ) { fprintf( stderr, "%s( %p, %p ) sz=%d lvls=%d-%d\n", __FUNCTION__, rmesa->glCtx, t->base.tObj, t->base.totalSize, - t->firstLevel, t->lastLevel ); + t->base.firstLevel, t->base.lastLevel ); } if ( !t || t->base.totalSize == 0 ) @@ -486,7 +486,7 @@ int r200UploadTexImages( r200ContextPtr rmesa, r200TexObjPtr t, GLuint face ) if (t->base.dirty_images[face]) { int i; for ( i = 0 ; i < numLevels ; i++ ) { - if ( (t->base.dirty_images[face] & (1 << (i+t->firstLevel))) != 0 ) { + if ( (t->base.dirty_images[face] & (1 << (i+t->base.firstLevel))) != 0 ) { uploadSubImage( rmesa, t, i, 0, 0, t->image[face][i].width, t->image[face][i].height, face ); } diff --git a/xc/lib/GL/mesa/src/drv/r200/r200_texstate.c b/xc/lib/GL/mesa/src/drv/r200/r200_texstate.c index 49dbff198..e1dc206d9 100644 --- a/xc/lib/GL/mesa/src/drv/r200/r200_texstate.c +++ b/xc/lib/GL/mesa/src/drv/r200/r200_texstate.c @@ -172,8 +172,8 @@ static void r200SetTexImages( r200ContextPtr rmesa, } /* save these values */ - t->firstLevel = firstLevel; - t->lastLevel = lastLevel; + t->base.firstLevel = firstLevel; + t->base.lastLevel = lastLevel; numLevels = lastLevel - firstLevel + 1; diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h index add1efcf8..cdfdb7e2b 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h @@ -161,12 +161,6 @@ struct radeon_tex_obj { GLuint pp_cubic_faces; /* cube face 1,2,3,4 log2 sizes */ GLboolean border_fallback; - - /* texObj->Image[firstLevel] through texObj->Image[lastLevel] are the - * images to upload. - */ - GLint firstLevel; - GLint lastLevel; }; diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c index 1e7803cb1..e1963047e 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c @@ -184,7 +184,7 @@ static void uploadSubImage( radeonContextPtr rmesa, radeonTexObjPtr t, GLint ret; drmRadeonTexture tex; drmRadeonTexImage tmp; - const int level = hwlevel + t->firstLevel; + const int level = hwlevel + t->base.firstLevel; if ( RADEON_DEBUG & DEBUG_TEXTURE ) { fprintf( stderr, "%s( %p, %p ) level/width/height/face = %d/%d/%d/%u\n", @@ -320,12 +320,12 @@ static void uploadSubImage( radeonContextPtr rmesa, radeonTexObjPtr t, int radeonUploadTexImages( radeonContextPtr rmesa, radeonTexObjPtr t, GLuint face ) { - const int numLevels = t->lastLevel - t->firstLevel + 1; + const int numLevels = t->base.lastLevel - t->base.firstLevel + 1; if ( RADEON_DEBUG & (DEBUG_TEXTURE|DEBUG_IOCTL) ) { fprintf( stderr, "%s( %p, %p ) sz=%d lvls=%d-%d\n", __FUNCTION__, rmesa->glCtx, t->base.tObj, t->base.totalSize, - t->firstLevel, t->lastLevel ); + t->base.firstLevel, t->base.lastLevel ); } if ( !t || t->base.totalSize == 0 ) @@ -365,7 +365,7 @@ int radeonUploadTexImages( radeonContextPtr rmesa, radeonTexObjPtr t, GLuint fac if (t->base.dirty_images[face]) { int i; for ( i = 0 ; i < numLevels ; i++ ) { - if ( (t->base.dirty_images[face] & (1 << (i+t->firstLevel))) != 0 ) { + if ( (t->base.dirty_images[face] & (1 << (i+t->base.firstLevel))) != 0 ) { uploadSubImage( rmesa, t, i, 0, 0, t->image[face][i].width, t->image[face][i].height, face ); } diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c index 606a00ad3..6dccd3118 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c @@ -157,8 +157,8 @@ static void radeonSetTexImages( radeonContextPtr rmesa, } /* save these values */ - t->firstLevel = firstLevel; - t->lastLevel = lastLevel; + t->base.firstLevel = firstLevel; + t->base.lastLevel = lastLevel; numLevels = lastLevel - firstLevel + 1; |