diff options
author | idr <idr> | 2003-02-19 17:28:57 +0000 |
---|---|---|
committer | idr <idr> | 2003-02-19 17:28:57 +0000 |
commit | 7b64c3db73eb9eeb327e1af99bef3c61f1c1a691 (patch) | |
tree | f69ef9f2bf32796af1f755c7bccd31e61d81fca1 | |
parent | e173846e055c8e2c33929543801cebe428efa9b9 (diff) |
Comment changes to minimise diffs with r200 driver. Some framework
support for cube_maps.
-rw-r--r-- | xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c | 99 |
1 files changed, 69 insertions, 30 deletions
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 dc3b8a5af..22841f0fb 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c @@ -1,29 +1,32 @@ /* $XFree86: xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c,v 1.6 2002/09/16 18:05:20 eich Exp $ */ /* - * Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and - * VA Linux Systems Inc., Fremont, California. - * - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * +Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and + VA Linux Systems Inc., Fremont, California. + +All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice (including the +next paragraph) shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +/* * Authors: * Gareth Hughes <gareth@valinux.com> * Brian Paul <brianp@valinux.com> @@ -81,6 +84,8 @@ static void radeonSetTexWrap( radeonTexObjPtr t, GLenum swrap, GLenum twrap ) case GL_MIRROR_CLAMP_TO_EDGE_ATI: t->pp_txfilter |= RADEON_CLAMP_S_MIRROR_CLAMP_LAST; break; + default: + _mesa_problem(NULL, "bad S wrap mode in %s", __FUNCTION__); } switch ( twrap ) { @@ -105,6 +110,8 @@ static void radeonSetTexWrap( radeonTexObjPtr t, GLenum swrap, GLenum twrap ) case GL_MIRROR_CLAMP_TO_EDGE_ATI: t->pp_txfilter |= RADEON_CLAMP_T_MIRROR_CLAMP_LAST; break; + default: + _mesa_problem(NULL, "bad T wrap mode in %s", __FUNCTION__); } } @@ -354,7 +361,7 @@ static void radeonTexImage1D( GLcontext *ctx, GLenum target, GLint level, } } - /* Note, this will call radeonChooseTextureFormat */ + /* Note, this will call ChooseTextureFormat */ _mesa_store_teximage1d(ctx, target, level, internalFormat, width, border, format, type, pixels, &ctx->Unpack, texObj, texImage); @@ -403,7 +410,22 @@ static void radeonTexImage2D( GLcontext *ctx, GLenum target, GLint level, struct gl_texture_image *texImage ) { driTextureObject * t = (driTextureObject *) texObj->DriverData; - + GLuint face; + + /* which cube face or ordinary 2D image */ + switch (target) { + case GL_TEXTURE_CUBE_MAP_POSITIVE_X: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: + face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X; + ASSERT(face < 6); + break; + default: + face = 0; + } if ( t != NULL ) { driSwapOutTextureObject( t ); @@ -416,14 +438,15 @@ static void radeonTexImage2D( GLcontext *ctx, GLenum target, GLint level, } } - /* Note, this will call radeonChooseTextureFormat */ + /* Note, this will call ChooseTextureFormat */ _mesa_store_teximage2d(ctx, target, level, internalFormat, width, height, border, format, type, pixels, &ctx->Unpack, texObj, texImage); - t->dirty_images[0] |= (1 << level); + t->dirty_images[face] |= (1 << level); } + static void radeonTexSubImage2D( GLcontext *ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, @@ -434,7 +457,23 @@ static void radeonTexSubImage2D( GLcontext *ctx, GLenum target, GLint level, struct gl_texture_image *texImage ) { driTextureObject * t = (driTextureObject *) texObj->DriverData; - + GLuint face; + + + /* which cube face or ordinary 2D image */ + switch (target) { + case GL_TEXTURE_CUBE_MAP_POSITIVE_X: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: + face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X; + ASSERT(face < 6); + break; + default: + face = 0; + } assert( t ); /* this _should_ be true */ if ( t ) { @@ -452,7 +491,7 @@ static void radeonTexSubImage2D( GLcontext *ctx, GLenum target, GLint level, height, format, type, pixels, packing, texObj, texImage); - t->dirty_images[0] |= (1 << level); + t->dirty_images[face] |= (1 << level); } |