From a2305ebfa213adb16e72d1a819895a68991c9462 Mon Sep 17 00:00:00 2001 From: Brian Date: Sat, 19 May 2007 09:10:44 -0600 Subject: need to copy new 1D/2D array texture objects in _mesa_PushAttrib() --- src/mesa/main/attrib.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 4654704afd..4699546262 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -363,6 +363,10 @@ _mesa_PushAttrib(GLbitfield mask) attr->Unit[u].CurrentCubeMap); _mesa_copy_texture_object(&attr->Unit[u].SavedRect, attr->Unit[u].CurrentRect); + _mesa_copy_texture_object(&attr->Unit[u].Saved1DArray, + attr->Unit[u].Current1DArray); + _mesa_copy_texture_object(&attr->Unit[u].Saved2DArray, + attr->Unit[u].Current2DArray); } _mesa_unlock_context_textures(ctx); -- cgit v1.2.3 From a8676c45ccab52117c70f2e90fd820d745261f51 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 21 May 2007 08:57:18 -0600 Subject: if light position is local, treat it as a homogeneous coord and divide by W (see bug 11009) --- src/mesa/main/light.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index 92d8a0ae0d..6e057614ba 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 + * Version: 7.0 * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul 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"), @@ -1117,6 +1117,13 @@ compute_light_positions( GLcontext *ctx ) } light->_VP_inf_spot_attenuation = 1.0; } + else { + /* positional light w/ homogeneous coordinate, divide by W */ + GLfloat wInv = 1.0 / light->_Position[3]; + light->_Position[0] *= wInv; + light->_Position[1] *= wInv; + light->_Position[2] *= wInv; + } if (light->_Flags & LIGHT_SPOT) { if (ctx->_NeedEyeCoords) { -- cgit v1.2.3 From 3898e67f49b375bd0127fb2931468653cc29d5f9 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 21 May 2007 21:48:08 -0600 Subject: remove some whitespace --- src/mesa/main/dlist.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index c8c68214ce..91ddcbf9ed 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -6596,9 +6596,6 @@ execute_list(GLcontext *ctx, GLuint list) CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i)); break; - - - case OPCODE_CONTINUE: n = (Node *) n[1].next; break; @@ -8407,8 +8404,6 @@ print_list(GLcontext *ctx, GLuint list) _mesa_printf("EVAL_P2 %d %d\n", n[1].i, n[2].i); break; - - /* * meta opcodes/commands */ -- cgit v1.2.3 From a01ee8ff0bdc9b80907f2fe48ebf1618ce2ded92 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 21 May 2007 21:48:33 -0600 Subject: improve some comments, clean-up formatting --- src/mesa/main/teximage.h | 11 ++++++----- src/mesa/main/texobj.c | 16 ++++++++++++---- src/mesa/main/texobj.h | 7 +++++-- 3 files changed, 23 insertions(+), 11 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index 68457f4728..f2cad7eb2d 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -107,18 +107,19 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, GLint width, GLint height, GLint depth, GLint border); -/* Lock a texture for updating. See also _mesa_lock_context_textures(). +/** + * Lock a texture for updating. See also _mesa_lock_context_textures(). */ -static INLINE void _mesa_lock_texture(GLcontext *ctx, - struct gl_texture_object *texObj) +static INLINE void +_mesa_lock_texture(GLcontext *ctx, struct gl_texture_object *texObj) { _glthread_LOCK_MUTEX(ctx->Shared->TexMutex); ctx->Shared->TextureStateStamp++; (void) texObj; } -static INLINE void _mesa_unlock_texture(GLcontext *ctx, - struct gl_texture_object *texObj) +static INLINE void +_mesa_unlock_texture(GLcontext *ctx, struct gl_texture_object *texObj) { _glthread_UNLOCK_MUTEX(ctx->Shared->TexMutex); } diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index bd447ac068..65e1bc1357 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1097,14 +1097,21 @@ _mesa_IsTexture( GLuint texture ) return t && t->Target; } -/* Simplest implementation of texture locking: Grab the a new mutex in + +/** + * Simplest implementation of texture locking: Grab the a new mutex in * the shared context. Examine the shared context state timestamp and * if there has been a change, set the appropriate bits in * ctx->NewState. * - * See also _mesa_lock/unlock_texture in texobj.h + * This is used to deal with synchronizing things when a texture object + * is used/modified by different contexts (or threads) which are sharing + * the texture. + * + * See also _mesa_lock/unlock_texture() in teximage.h */ -void _mesa_lock_context_textures( GLcontext *ctx ) +void +_mesa_lock_context_textures( GLcontext *ctx ) { _glthread_LOCK_MUTEX(ctx->Shared->TexMutex); @@ -1115,7 +1122,8 @@ void _mesa_lock_context_textures( GLcontext *ctx ) } -void _mesa_unlock_context_textures( GLcontext *ctx ) +void +_mesa_unlock_context_textures( GLcontext *ctx ) { assert(ctx->Shared->TextureStateStamp == ctx->TextureStateTimestamp); _glthread_UNLOCK_MUTEX(ctx->Shared->TexMutex); diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h index ec7cf8cd86..2a2bde3601 100644 --- a/src/mesa/main/texobj.h +++ b/src/mesa/main/texobj.h @@ -61,8 +61,11 @@ extern void _mesa_test_texobj_completeness( const GLcontext *ctx, struct gl_texture_object *obj ); -extern void _mesa_unlock_context_textures( GLcontext *ctx ); -extern void _mesa_lock_context_textures( GLcontext *ctx ); +extern void +_mesa_unlock_context_textures( GLcontext *ctx ); + +extern void +_mesa_lock_context_textures( GLcontext *ctx ); /*@}*/ -- cgit v1.2.3 From 5c5ab90c762614ef1db898e1984137d65fb96b7e Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 21 May 2007 21:49:34 -0600 Subject: remove a VMS-ism that doesn't seem needed elsewhere --- src/mesa/main/texobj.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 65e1bc1357..47d9dd5dcb 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -42,10 +42,6 @@ #include "mtypes.h" -#ifdef __VMS -#define _mesa_sprintf sprintf -#endif - /**********************************************************************/ /** \name Internal functions */ /*@{*/ -- cgit v1.2.3 From c62da91f44c230b6476b5d7409d2c11e88f1620b Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 21 May 2007 21:59:20 -0600 Subject: remove the unused texobj Mutex field --- src/mesa/main/mtypes.h | 1 - src/mesa/main/texobj.c | 5 ----- 2 files changed, 6 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 894b9edb36..fc712def57 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1397,7 +1397,6 @@ struct gl_texture_image */ struct gl_texture_object { - _glthread_Mutex Mutex; /**< for thread safety */ GLint RefCount; /**< reference count */ GLuint Name; /**< the user-visible texture object ID */ GLenum Target; /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */ diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 47d9dd5dcb..55dce60d67 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -106,7 +106,6 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, _mesa_bzero(obj, sizeof(*obj)); /* init the non-zero fields */ - _glthread_INIT_MUTEX(obj->Mutex); obj->RefCount = 1; obj->Name = name; obj->Target = target; @@ -136,7 +135,6 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, obj->CompareFunc = GL_LEQUAL; /* ARB_shadow */ obj->DepthMode = GL_LUMINANCE; /* ARB_depth_texture */ obj->ShadowAmbient = 0.0F; /* ARB/SGIX_shadow_ambient */ - _mesa_init_colortable(&obj->Palette); } @@ -165,9 +163,6 @@ _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj ) } } - /* destroy the mutex -- it may have allocated memory (eg on bsd) */ - _glthread_DESTROY_MUTEX(texObj->Mutex); - /* free this object */ _mesa_free(texObj); } -- cgit v1.2.3 From 9e3e3883fa42ffee82e8e8ecbf75c153a2215acb Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 21 May 2007 22:10:06 -0600 Subject: get rid of GenTexturesLock, used ctx->Shared->Mutex --- src/mesa/main/texobj.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 55dce60d67..0d2946e95a 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -141,6 +141,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, /** * Deallocate a texture object struct. It should have already been * removed from the texture object pool. + * Called via ctx->Driver.DeleteTexture() if not overriden by a driver. * * \param shared the shared GL state to which the object belongs. * \param texOjb the texture object to delete. @@ -523,13 +524,6 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, /** \name API functions */ /*@{*/ -/** - * Texture name generation lock. - * - * Used by _mesa_GenTextures() to guarantee that the generation and allocation - * of texture IDs is atomic. - */ -_glthread_DECLARE_STATIC_MUTEX(GenTexturesLock); /** * Generate texture names. @@ -539,9 +533,9 @@ _glthread_DECLARE_STATIC_MUTEX(GenTexturesLock); * * \sa glGenTextures(). * - * While holding the GenTexturesLock lock, calls _mesa_HashFindFreeKeyBlock() - * to find a block of free texture IDs which are stored in \p textures. - * Corresponding empty texture objects are also generated. + * Calls _mesa_HashFindFreeKeyBlock() to find a block of free texture + * IDs which are stored in \p textures. Corresponding empty texture + * objects are also generated. */ void GLAPIENTRY _mesa_GenTextures( GLsizei n, GLuint *textures ) @@ -562,7 +556,7 @@ _mesa_GenTextures( GLsizei n, GLuint *textures ) /* * This must be atomic (generation and allocation of texture IDs) */ - _glthread_LOCK_MUTEX(GenTexturesLock); + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); first = _mesa_HashFindFreeKeyBlock(ctx->Shared->TexObjects, n); @@ -573,20 +567,18 @@ _mesa_GenTextures( GLsizei n, GLuint *textures ) GLenum target = 0; texObj = (*ctx->Driver.NewTextureObject)( ctx, name, target); if (!texObj) { - _glthread_UNLOCK_MUTEX(GenTexturesLock); + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenTextures"); return; } /* insert into hash table */ - _glthread_LOCK_MUTEX(ctx->Shared->Mutex); _mesa_HashInsert(ctx->Shared->TexObjects, texObj->Name, texObj); - _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); textures[i] = name; } - _glthread_UNLOCK_MUTEX(GenTexturesLock); + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); } -- cgit v1.2.3 From d062b6cd2672f42fdfe20f6d932aacef9895aebc Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 23 May 2007 08:58:08 -0600 Subject: Fix point attentuation problem (bug 11042) ctx->Point._Attentuation was computed in wrong place and the VB->Eye coord Z array wasn't indexed correctly in run_point_stage(). --- src/mesa/main/points.c | 11 +++++------ src/mesa/tnl/t_vb_points.c | 10 ++++++---- 2 files changed, 11 insertions(+), 10 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c index 9caa9ab3ab..8674c7299c 100644 --- a/src/mesa/main/points.c +++ b/src/mesa/main/points.c @@ -5,9 +5,9 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.0 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul 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"), @@ -61,10 +61,6 @@ _mesa_PointSize( GLfloat size ) ctx->Point.MinSize, ctx->Point.MaxSize); - ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 || - ctx->Point.Params[1] != 0.0 || - ctx->Point.Params[2] != 0.0); - if (ctx->Driver.PointSize) ctx->Driver.PointSize(ctx, size); } @@ -122,6 +118,9 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params) return; FLUSH_VERTICES(ctx, _NEW_POINT); COPY_3V(ctx->Point.Params, params); + ctx->Point._Attenuated = (ctx->Point.Params[0] != 1.0 || + ctx->Point.Params[1] != 0.0 || + ctx->Point.Params[2] != 0.0); } else { _mesa_error(ctx, GL_INVALID_ENUM, diff --git a/src/mesa/tnl/t_vb_points.c b/src/mesa/tnl/t_vb_points.c index 9327f8c273..1ac14fedf9 100644 --- a/src/mesa/tnl/t_vb_points.c +++ b/src/mesa/tnl/t_vb_points.c @@ -1,8 +1,8 @@ /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 7.0 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2007 Brian Paul 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"), @@ -50,7 +50,8 @@ run_point_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) if (ctx->Point._Attenuated && !ctx->VertexProgram._Current) { struct point_stage_data *store = POINT_STAGE_DATA(stage); struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - const GLfloat (*eye)[4] = (const GLfloat (*)[4]) VB->EyePtr->data; + const GLfloat *eyeCoord = (GLfloat *) VB->EyePtr->data + 2; + const GLint eyeCoordStride = VB->EyePtr->stride / sizeof(GLfloat); const GLfloat p0 = ctx->Point.Params[0]; const GLfloat p1 = ctx->Point.Params[1]; const GLfloat p2 = ctx->Point.Params[2]; @@ -59,10 +60,11 @@ run_point_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) GLuint i; for (i = 0; i < VB->Count; i++) { - const GLfloat dist = FABSF(eye[i][2]); + const GLfloat dist = FABSF(*eyeCoord); const GLfloat q = p0 + dist * (p1 + dist * p2); const GLfloat atten = (q != 0.0) ? SQRTF(1.0 / q) : 1.0; size[i][0] = pointSize * atten; /* clamping done in rasterization */ + eyeCoord += eyeCoordStride; } VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->PointSize; -- cgit v1.2.3 From e5ed09e60e32cf7d5afc778321e417ea97fe8494 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 23 May 2007 16:42:29 -0600 Subject: incr/decr 1D/2DArray texture refcounts like other targets --- src/mesa/main/attrib.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 4699546262..0ee3418fdd 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 6.5.3 + * Version: 7.1 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * @@ -348,6 +348,8 @@ _mesa_PushAttrib(GLbitfield mask) ctx->Texture.Unit[u].Current3D->RefCount++; ctx->Texture.Unit[u].CurrentCubeMap->RefCount++; ctx->Texture.Unit[u].CurrentRect->RefCount++; + ctx->Texture.Unit[u].Current1DArray->RefCount++; + ctx->Texture.Unit[u].Current2DArray->RefCount++; } attr = MALLOC_STRUCT( gl_texture_attrib ); MEMCPY( attr, &ctx->Texture, sizeof(struct gl_texture_attrib) ); @@ -813,6 +815,8 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib) ctx->Texture.Unit[u].Current3D->RefCount--; ctx->Texture.Unit[u].CurrentCubeMap->RefCount--; ctx->Texture.Unit[u].CurrentRect->RefCount--; + ctx->Texture.Unit[u].Current1DArray->RefCount--; + ctx->Texture.Unit[u].Current2DArray->RefCount--; } } -- cgit v1.2.3 From f116aed1ede0d802e9f3c5989290002975c00330 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 23 May 2007 16:49:32 -0600 Subject: restore GL_TEXTURE_LOD_BIAS in _mesa_PopAttrib(), bug 11049 --- src/mesa/main/attrib.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/mesa/main') diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 0ee3418fdd..1aa0a02fc7 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -782,6 +782,7 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib) _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, obj->MagFilter); _mesa_TexParameterf(target, GL_TEXTURE_MIN_LOD, obj->MinLod); _mesa_TexParameterf(target, GL_TEXTURE_MAX_LOD, obj->MaxLod); + _mesa_TexParameterf(target, GL_TEXTURE_LOD_BIAS, obj->LodBias); _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, obj->BaseLevel); if (target != GL_TEXTURE_RECTANGLE_ARB) _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, obj->MaxLevel); -- cgit v1.2.3