From 4a89e51c5f88b57040b361b62e80a57c8248ba4b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 28 Jan 2009 10:27:33 -0700 Subject: mesa: set/get new state for GL_EXT_texture_swizzle --- src/mesa/main/texobj.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/mesa/main/texobj.c') diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 7848f0be35..fad39a0634 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -42,6 +42,8 @@ #include "texstate.h" #include "texobj.h" #include "mtypes.h" +#include "shader/prog_instruction.h" + /**********************************************************************/ @@ -138,6 +140,11 @@ _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 */ + obj->Swizzle[0] = GL_RED; + obj->Swizzle[1] = GL_GREEN; + obj->Swizzle[2] = GL_BLUE; + obj->Swizzle[3] = GL_ALPHA; + obj->_Swizzle = SWIZZLE_NOOP; } @@ -252,6 +259,8 @@ _mesa_copy_texture_object( struct gl_texture_object *dest, dest->GenerateMipmap = src->GenerateMipmap; dest->Palette = src->Palette; dest->_Complete = src->_Complete; + COPY_4V(dest->Swizzle, src->Swizzle); + dest->_Swizzle = src->_Swizzle; } -- cgit v1.2.3 From 26da28c995557c8b913e5ccfe31b31dc32e6c735 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 28 Jan 2009 16:49:28 -0700 Subject: mesa: remove GL_SGIX_shadow, GL_SGIX_shadow_ambient and GL_SGIX_depth_texture Everyone should be using the newer/better ARB versions of these extensions. --- docs/relnotes-7.5.html | 2 + src/mesa/main/attrib.c | 12 ++--- src/mesa/main/extensions.c | 7 +-- src/mesa/main/mtypes.h | 7 +-- src/mesa/main/texobj.c | 8 +--- src/mesa/main/texparam.c | 82 +++++---------------------------- src/mesa/main/texstate.c | 10 ---- src/mesa/shader/prog_statevars.c | 10 ++-- src/mesa/swrast/s_texfilter.c | 99 +--------------------------------------- 9 files changed, 29 insertions(+), 208 deletions(-) (limited to 'src/mesa/main/texobj.c') diff --git a/docs/relnotes-7.5.html b/docs/relnotes-7.5.html index ef8759ba6a..621bd4afac 100644 --- a/docs/relnotes-7.5.html +++ b/docs/relnotes-7.5.html @@ -48,6 +48,8 @@ including GL_ATI_separate_stencil, GL_EXT_stencil_two_side and OpenGL 2.0

Changes

diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 825c841ee2..3be7fd5a2d 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -820,15 +820,9 @@ pop_texture_group(GLcontext *ctx, struct texture_state *texstate) _mesa_TexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, obj->MaxAnisotropy); } - if (ctx->Extensions.SGIX_shadow) { - _mesa_TexParameteri(target, GL_TEXTURE_COMPARE_SGIX, - obj->CompareFlag); - _mesa_TexParameteri(target, GL_TEXTURE_COMPARE_OPERATOR_SGIX, - obj->CompareOperator); - } - if (ctx->Extensions.SGIX_shadow_ambient) { - _mesa_TexParameterf(target, GL_SHADOW_AMBIENT_SGIX, - obj->ShadowAmbient); + if (ctx->Extensions.ARB_shadow_ambient) { + _mesa_TexParameterf(target, GL_TEXTURE_COMPARE_FAIL_VALUE_ARB, + obj->CompareFailValue); } } diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 86144c42ad..4ebdb5d9ae 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -62,7 +62,7 @@ static const struct { { OFF, "GL_ARB_shading_language_100", F(ARB_shading_language_100) }, { OFF, "GL_ARB_shading_language_120", F(ARB_shading_language_120) }, { OFF, "GL_ARB_shadow", F(ARB_shadow) }, - { OFF, "GL_ARB_shadow_ambient", F(SGIX_shadow_ambient) }, + { OFF, "GL_ARB_shadow_ambient", F(ARB_shadow_ambient) }, { OFF, "GL_ARB_texture_border_clamp", F(ARB_texture_border_clamp) }, { OFF, "GL_ARB_texture_compression", F(ARB_texture_compression) }, { OFF, "GL_ARB_texture_cube_map", F(ARB_texture_cube_map) }, @@ -170,8 +170,6 @@ static const struct { { ON, "GL_SGIS_texture_edge_clamp", F(SGIS_texture_edge_clamp) }, { ON, "GL_SGIS_texture_lod", F(SGIS_texture_lod) }, { OFF, "GL_SGIX_depth_texture", F(ARB_depth_texture) }, - { OFF, "GL_SGIX_shadow", F(SGIX_shadow) }, - { OFF, "GL_SGIX_shadow_ambient", F(SGIX_shadow_ambient) }, { OFF, "GL_SUN_multi_draw_arrays", F(EXT_multi_draw_arrays) }, { OFF, "GL_S3_s3tc", F(S3_s3tc) }, }; @@ -214,6 +212,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.ARB_shading_language_120 = GL_FALSE; /* not quite done */ #endif ctx->Extensions.ARB_shadow = GL_TRUE; + ctx->Extensions.ARB_shadow_ambient = GL_TRUE; ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; ctx->Extensions.ARB_texture_cube_map = GL_TRUE; ctx->Extensions.ARB_texture_env_combine = GL_TRUE; @@ -302,8 +301,6 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.SGI_texture_color_table = GL_TRUE; ctx->Extensions.SGIS_generate_mipmap = GL_TRUE; ctx->Extensions.SGIS_texture_edge_clamp = GL_TRUE; - ctx->Extensions.SGIX_shadow = GL_TRUE; - ctx->Extensions.SGIX_shadow_ambient = GL_TRUE; #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program ctx->Extensions.EXT_gpu_program_parameters = GL_TRUE; #endif diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 8ab0d26f45..da243eceac 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1433,11 +1433,9 @@ struct gl_texture_object GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */ GLint MaxLevel; /**< max mipmap level, OpenGL 1.2 */ GLfloat MaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */ - GLboolean CompareFlag; /**< GL_SGIX_shadow */ - GLenum CompareOperator; /**< GL_SGIX_shadow */ - GLfloat ShadowAmbient; /**< GL_ARB_shadow_ambient */ GLenum CompareMode; /**< GL_ARB_shadow */ GLenum CompareFunc; /**< GL_ARB_shadow */ + GLfloat CompareFailValue; /**< GL_ARB_shadow_ambient */ GLenum _Function; /**< Comparison function derived from * \c CompareOperator, \c CompareMode, and * \c CompareFunc. @@ -2563,6 +2561,7 @@ struct gl_extensions GLboolean ARB_shading_language_100; GLboolean ARB_shading_language_120; GLboolean ARB_shadow; + GLboolean ARB_shadow_ambient; /* or GL_ARB_shadow_ambient */ GLboolean ARB_texture_border_clamp; GLboolean ARB_texture_compression; GLboolean ARB_texture_cube_map; @@ -2660,8 +2659,6 @@ struct gl_extensions GLboolean SGIS_generate_mipmap; GLboolean SGIS_texture_edge_clamp; GLboolean SGIS_texture_lod; - GLboolean SGIX_shadow; - GLboolean SGIX_shadow_ambient; /* or GL_ARB_shadow_ambient */ GLboolean TDFX_texture_compression_FXT1; GLboolean S3_s3tc; /*@}*/ diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index fad39a0634..4e6cf439fc 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -134,12 +134,10 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj, obj->BaseLevel = 0; obj->MaxLevel = 1000; obj->MaxAnisotropy = 1.0; - obj->CompareFlag = GL_FALSE; /* SGIX_shadow */ - obj->CompareOperator = GL_TEXTURE_LEQUAL_R_SGIX; /* SGIX_shadow */ obj->CompareMode = GL_NONE; /* ARB_shadow */ obj->CompareFunc = GL_LEQUAL; /* ARB_shadow */ + obj->CompareFailValue = 0.0F; /* ARB_shadow_ambient */ obj->DepthMode = GL_LUMINANCE; /* ARB_depth_texture */ - obj->ShadowAmbient = 0.0F; /* ARB/SGIX_shadow_ambient */ obj->Swizzle[0] = GL_RED; obj->Swizzle[1] = GL_GREEN; obj->Swizzle[2] = GL_BLUE; @@ -248,11 +246,9 @@ _mesa_copy_texture_object( struct gl_texture_object *dest, dest->BaseLevel = src->BaseLevel; dest->MaxLevel = src->MaxLevel; dest->MaxAnisotropy = src->MaxAnisotropy; - dest->CompareFlag = src->CompareFlag; - dest->CompareOperator = src->CompareOperator; - dest->ShadowAmbient = src->ShadowAmbient; dest->CompareMode = src->CompareMode; dest->CompareFunc = src->CompareFunc; + dest->CompareFailValue = src->CompareFailValue; dest->DepthMode = src->DepthMode; dest->_MaxLevel = src->_MaxLevel; dest->_MaxLambda = src->_MaxLambda; diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 41c914e5b3..f610fa8dda 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -260,30 +260,6 @@ set_tex_parameteri(GLcontext *ctx, texObj->MaxLevel = params[0]; return; - case GL_TEXTURE_COMPARE_SGIX: - if (ctx->Extensions.SGIX_shadow) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->CompareFlag = params[0] ? GL_TRUE : GL_FALSE; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(pname=GL_TEXTURE_COMPARE_SGIX)"); - } - return; - - case GL_TEXTURE_COMPARE_OPERATOR_SGIX: - if (ctx->Extensions.SGIX_shadow && - (params[0] == GL_TEXTURE_LEQUAL_R_SGIX || - params[0] == GL_TEXTURE_GEQUAL_R_SGIX)) { - FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->CompareOperator = params[0]; - } - else { - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(GL_TEXTURE_COMPARE_OPERATOR_SGIX)"); - } - return; - case GL_GENERATE_MIPMAP_SGIS: if (ctx->Extensions.SGIS_generate_mipmap) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); @@ -454,14 +430,14 @@ set_tex_parameterf(GLcontext *ctx, } return; - case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ - if (ctx->Extensions.SGIX_shadow_ambient) { + case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: + if (ctx->Extensions.ARB_shadow_ambient) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->ShadowAmbient = CLAMP(params[0], 0.0F, 1.0F); + texObj->CompareFailValue = CLAMP(params[0], 0.0F, 1.0F); } else { _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(pname=GL_SHADOW_AMBIENT_SGIX)"); + "glTexParameter(pname=GL_TEXTURE_COMPARE_FAIL_VALUE_ARB)"); } return; @@ -512,8 +488,6 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param) case GL_TEXTURE_WRAP_R: case GL_TEXTURE_BASE_LEVEL: case GL_TEXTURE_MAX_LEVEL: - case GL_TEXTURE_COMPARE_SGIX: - case GL_TEXTURE_COMPARE_OPERATOR_SGIX: case GL_GENERATE_MIPMAP_SGIS: case GL_TEXTURE_COMPARE_MODE_ARB: case GL_TEXTURE_COMPARE_FUNC_ARB: @@ -556,8 +530,6 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params) case GL_TEXTURE_WRAP_R: case GL_TEXTURE_BASE_LEVEL: case GL_TEXTURE_MAX_LEVEL: - case GL_TEXTURE_COMPARE_SGIX: - case GL_TEXTURE_COMPARE_OPERATOR_SGIX: case GL_GENERATE_MIPMAP_SGIS: case GL_TEXTURE_COMPARE_MODE_ARB: case GL_TEXTURE_COMPARE_FUNC_ARB: @@ -613,7 +585,7 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param) case GL_TEXTURE_PRIORITY: case GL_TEXTURE_MAX_ANISOTROPY_EXT: case GL_TEXTURE_LOD_BIAS: - case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: { GLfloat fparam = (GLfloat) param; /* convert int param to float */ @@ -662,7 +634,7 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params) case GL_TEXTURE_PRIORITY: case GL_TEXTURE_MAX_ANISOTROPY_EXT: case GL_TEXTURE_LOD_BIAS: - case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: { /* convert int param to float */ GLfloat fparam = (GLfloat) params[0]; @@ -1060,23 +1032,9 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) else error = GL_TRUE; break; - case GL_TEXTURE_COMPARE_SGIX: - if (ctx->Extensions.SGIX_shadow) { - *params = (GLfloat) obj->CompareFlag; - } - else - error = GL_TRUE; - break; - case GL_TEXTURE_COMPARE_OPERATOR_SGIX: - if (ctx->Extensions.SGIX_shadow) { - *params = (GLfloat) obj->CompareOperator; - } - else - error = GL_TRUE; - break; - case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ - if (ctx->Extensions.SGIX_shadow_ambient) { - *params = obj->ShadowAmbient; + case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: + if (ctx->Extensions.ARB_shadow_ambient) { + *params = obj->CompareFailValue; } else error = GL_TRUE; @@ -1248,25 +1206,9 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) error = GL_TRUE; } break; - case GL_TEXTURE_COMPARE_SGIX: - if (ctx->Extensions.SGIX_shadow) { - *params = (GLint) obj->CompareFlag; - } - else { - error = GL_TRUE; - } - break; - case GL_TEXTURE_COMPARE_OPERATOR_SGIX: - if (ctx->Extensions.SGIX_shadow) { - *params = (GLint) obj->CompareOperator; - } - else { - error = GL_TRUE; - } - break; - case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ - if (ctx->Extensions.SGIX_shadow_ambient) { - *params = (GLint) FLOAT_TO_INT(obj->ShadowAmbient); + case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: + if (ctx->Extensions.ARB_shadow_ambient) { + *params = (GLint) FLOAT_TO_INT(obj->CompareFailValue); } else { error = GL_TRUE; diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 7cddec0bce..f7a4d8b323 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -404,16 +404,6 @@ update_texture_compare_function(GLcontext *ctx, */ tObj->_Function = GL_NONE; } - else if (tObj->CompareFlag) { - /* GL_SGIX_shadow */ - if (tObj->CompareOperator == GL_TEXTURE_LEQUAL_R_SGIX) { - tObj->_Function = GL_LEQUAL; - } - else { - ASSERT(tObj->CompareOperator == GL_TEXTURE_GEQUAL_R_SGIX); - tObj->_Function = GL_GEQUAL; - } - } else if (tObj->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) { /* GL_ARB_shadow */ tObj->_Function = tObj->CompareFunc; diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c index 615826b210..3ce60427bf 100644 --- a/src/mesa/shader/prog_statevars.c +++ b/src/mesa/shader/prog_statevars.c @@ -493,10 +493,10 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current; if (texObj) { - value[0] = texObj->ShadowAmbient; - value[1] = texObj->ShadowAmbient; - value[2] = texObj->ShadowAmbient; - value[3] = texObj->ShadowAmbient; + value[0] = + value[1] = + value[2] = + value[3] = texObj->CompareFailValue; } } return; @@ -777,7 +777,7 @@ append_token(char *dst, gl_state_index k) append(dst, "PCMbias"); break; case STATE_SHADOW_AMBIENT: - append(dst, "ShadowAmbient"); + append(dst, "CompareFailValue"); break; default: /* probably STATE_INTERNAL_DRIVER+i (driver private state) */ diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index a095b255ab..8d72018cf4 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -2826,7 +2826,7 @@ sample_depth_texture( GLcontext *ctx, tObj->Target == GL_TEXTURE_1D_ARRAY_EXT || tObj->Target == GL_TEXTURE_2D_ARRAY_EXT); - UNCLAMPED_FLOAT_TO_CHAN(ambient, tObj->ShadowAmbient); + UNCLAMPED_FLOAT_TO_CHAN(ambient, tObj->CompareFailValue); /* XXXX if tObj->MinFilter != tObj->MagFilter, we're ignoring lambda */ @@ -3156,103 +3156,6 @@ sample_depth_texture( GLcontext *ctx, } -#if 0 -/* - * Experimental depth texture sampling function. - */ -static void -sample_depth_texture2(const GLcontext *ctx, - const struct gl_texture_unit *texUnit, - GLuint n, const GLfloat texcoords[][4], - GLchan texel[][4]) -{ - const struct gl_texture_object *texObj = texUnit->_Current; - const GLint baseLevel = texObj->BaseLevel; - const struct gl_texture_image *texImage = texObj->Image[0][baseLevel]; - const GLuint width = texImage->Width; - const GLuint height = texImage->Height; - GLchan ambient; - GLboolean lequal, gequal; - - if (texObj->Target != GL_TEXTURE_2D) { - _mesa_problem(ctx, "only 2-D depth textures supported at this time"); - return; - } - - if (texObj->MinFilter != texObj->MagFilter) { - _mesa_problem(ctx, "mipmapped depth textures not supported at this time"); - return; - } - - /* XXX the GL_SGIX_shadow extension spec doesn't say what to do if - * GL_TEXTURE_COMPARE_SGIX == GL_TRUE but the current texture object - * isn't a depth texture. - */ - if (texImage->TexFormat->BaseFormat != GL_DEPTH_COMPONENT) { - _mesa_problem(ctx,"GL_TEXTURE_COMPARE_SGIX enabled with non-depth texture"); - return; - } - - UNCLAMPED_FLOAT_TO_CHAN(ambient, tObj->ShadowAmbient); - - if (texObj->CompareOperator == GL_TEXTURE_LEQUAL_R_SGIX) { - lequal = GL_TRUE; - gequal = GL_FALSE; - } - else { - lequal = GL_FALSE; - gequal = GL_TRUE; - } - - { - GLuint i; - for (i = 0; i < n; i++) { - const GLint K = 3; - GLint col, row, ii, jj, imin, imax, jmin, jmax, samples, count; - GLfloat w; - GLchan lum; - col = nearest_texel_location(texObj->WrapS, img, width, - texcoords[i][0]); - row = nearest_texel_location(texObj->WrapT, img, height, - texcoords[i][1]); - - imin = col - K; - imax = col + K; - jmin = row - K; - jmax = row + K; - - if (imin < 0) imin = 0; - if (imax >= width) imax = width - 1; - if (jmin < 0) jmin = 0; - if (jmax >= height) jmax = height - 1; - - samples = (imax - imin + 1) * (jmax - jmin + 1); - count = 0; - for (jj = jmin; jj <= jmax; jj++) { - for (ii = imin; ii <= imax; ii++) { - GLfloat depthSample; - texImage->FetchTexelf(texImage, ii, jj, 0, &depthSample); - if ((depthSample <= r[i] && lequal) || - (depthSample >= r[i] && gequal)) { - count++; - } - } - } - - w = (GLfloat) count / (GLfloat) samples; - w = CHAN_MAXF - w * (CHAN_MAXF - (GLfloat) ambient); - lum = (GLint) w; - - texel[i][RCOMP] = lum; - texel[i][GCOMP] = lum; - texel[i][BCOMP] = lum; - texel[i][ACOMP] = CHAN_MAX; - } - } -} -#endif - - /** * We use this function when a texture object is in an "incomplete" state. * When a fragment program attempts to sample an incomplete texture we -- cgit v1.2.3 From 7c48719a5f22648302bbd0026681770d8cc43914 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 30 Jan 2009 15:34:55 -0700 Subject: mesa: add missing _mesa_reference_texobj() calls for texture array targets --- src/mesa/main/texobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/main/texobj.c') diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 4e6cf439fc..0fee21c490 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -984,11 +984,11 @@ _mesa_BindTexture( GLenum target, GLuint texName ) ASSERT(texUnit->CurrentRect); break; case GL_TEXTURE_1D_ARRAY_EXT: - texUnit->Current1DArray = newTexObj; + _mesa_reference_texobj(&texUnit->Current1DArray, newTexObj); ASSERT(texUnit->Current1DArray); break; case GL_TEXTURE_2D_ARRAY_EXT: - texUnit->Current2DArray = newTexObj; + _mesa_reference_texobj(&texUnit->Current2DArray, newTexObj); ASSERT(texUnit->Current2DArray); break; default: -- cgit v1.2.3 From 5199774dc6a2a65d24ac26fe15715654f2568a02 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 7 Feb 2009 11:50:24 -0700 Subject: mesa: minor fixes to incomplete texture debug code --- src/mesa/main/texobj.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/mesa/main/texobj.c') diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 0fee21c490..b4e30c8bb7 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -393,8 +393,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, */ if ((baseLevel < 0) || (baseLevel > MAX_TEXTURE_LEVELS)) { char s[100]; - _mesa_sprintf(s, "obj %p (%d) base level = %d is invalid", - (void *) t, t->Name, baseLevel); + _mesa_sprintf(s, "base level = %d is invalid", baseLevel); incomplete(t, s); t->_Complete = GL_FALSE; return; @@ -403,8 +402,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, /* Always need the base level image */ if (!t->Image[0][baseLevel]) { char s[100]; - _mesa_sprintf(s, "obj %p (%d) Image[baseLevel=%d] == NULL", - (void *) t, t->Name, baseLevel); + _mesa_sprintf(s, "Image[baseLevel=%d] == NULL", baseLevel); incomplete(t, s); t->_Complete = GL_FALSE; return; -- cgit v1.2.3 From 4d24b639d160fe485a3e8f7395e7654538be29e0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 21 Feb 2009 13:59:29 -0700 Subject: mesa: use an array for default texture objects Replace Default1D/2D/3D/Cube/etc with DefaultTex[TEXTURE_x_INDEX]. The same should be done with the Current1D/2D/3D/etc pointers... --- src/mesa/main/context.c | 75 +++++++++++++++++------------------------------- src/mesa/main/mtypes.h | 14 ++------- src/mesa/main/texobj.c | 35 +++++++++++++--------- src/mesa/main/texstate.c | 38 ++++++++++++++---------- 4 files changed, 72 insertions(+), 90 deletions(-) (limited to 'src/mesa/main/texobj.c') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 9705fd8a98..04848794aa 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -423,6 +423,7 @@ one_time_init( GLcontext *ctx ) static GLboolean alloc_shared_state( GLcontext *ctx ) { + GLuint i; struct gl_shared_state *ss = CALLOC_STRUCT(gl_shared_state); if (!ss) return GL_FALSE; @@ -464,36 +465,24 @@ alloc_shared_state( GLcontext *ctx ) ss->ShaderObjects = _mesa_NewHashTable(); #endif - ss->Default1D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_1D); - if (!ss->Default1D) - goto cleanup; - - ss->Default2D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_2D); - if (!ss->Default2D) - goto cleanup; - - ss->Default3D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_3D); - if (!ss->Default3D) - goto cleanup; - - ss->DefaultCubeMap = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_CUBE_MAP_ARB); - if (!ss->DefaultCubeMap) - goto cleanup; - - ss->DefaultRect = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_RECTANGLE_NV); - if (!ss->DefaultRect) - goto cleanup; - - ss->Default1DArray = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_1D_ARRAY_EXT); - if (!ss->Default1DArray) - goto cleanup; - - ss->Default2DArray = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_2D_ARRAY_EXT); - if (!ss->Default2DArray) - goto cleanup; + /* Create default texture objects */ + for (i = 0; i < NUM_TEXTURE_TARGETS; i++) { + static const GLenum targets[NUM_TEXTURE_TARGETS] = { + GL_TEXTURE_1D, + GL_TEXTURE_2D, + GL_TEXTURE_3D, + GL_TEXTURE_CUBE_MAP, + GL_TEXTURE_RECTANGLE_NV, + GL_TEXTURE_1D_ARRAY_EXT, + GL_TEXTURE_2D_ARRAY_EXT + }; + ss->DefaultTex[i] = ctx->Driver.NewTextureObject(ctx, 0, targets[i]); + if (!ss->DefaultTex[i]) + goto cleanup; + } /* sanity check */ - assert(ss->Default1D->RefCount == 1); + assert(ss->DefaultTex[TEXTURE_1D_INDEX]->RefCount == 1); _glthread_INIT_MUTEX(ss->TexMutex); ss->TextureStateStamp = 0; @@ -547,20 +536,10 @@ cleanup: _mesa_DeleteHashTable(ss->RenderBuffers); #endif - if (ss->Default1D) - (*ctx->Driver.DeleteTexture)(ctx, ss->Default1D); - if (ss->Default2D) - (*ctx->Driver.DeleteTexture)(ctx, ss->Default2D); - if (ss->Default3D) - (*ctx->Driver.DeleteTexture)(ctx, ss->Default3D); - if (ss->DefaultCubeMap) - (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultCubeMap); - if (ss->DefaultRect) - (*ctx->Driver.DeleteTexture)(ctx, ss->DefaultRect); - if (ss->Default1DArray) - (*ctx->Driver.DeleteTexture)(ctx, ss->Default1DArray); - if (ss->Default2DArray) - (*ctx->Driver.DeleteTexture)(ctx, ss->Default2DArray); + for (i = 0; i < NUM_TEXTURE_TARGETS; i++) { + if (ss->DefaultTex[i]) + ctx->Driver.DeleteTexture(ctx, ss->DefaultTex[i]); + } _mesa_free(ss); @@ -723,6 +702,8 @@ delete_renderbuffer_cb(GLuint id, void *data, void *userData) static void free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) { + GLuint i; + /* * Free display lists */ @@ -772,13 +753,9 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) */ ASSERT(ctx->Driver.DeleteTexture); /* the default textures */ - ctx->Driver.DeleteTexture(ctx, ss->Default1D); - ctx->Driver.DeleteTexture(ctx, ss->Default2D); - ctx->Driver.DeleteTexture(ctx, ss->Default3D); - ctx->Driver.DeleteTexture(ctx, ss->DefaultCubeMap); - ctx->Driver.DeleteTexture(ctx, ss->DefaultRect); - ctx->Driver.DeleteTexture(ctx, ss->Default1DArray); - ctx->Driver.DeleteTexture(ctx, ss->Default2DArray); + for (i = 0; i < NUM_TEXTURE_TARGETS; i++) { + ctx->Driver.DeleteTexture(ctx, ss->DefaultTex[i]); + } /* all other textures */ _mesa_HashDeleteAll(ss->TexObjects, delete_texture_cb, ctx); _mesa_DeleteHashTable(ss->TexObjects); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 92fe4cb77d..bd7d6f0784 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2198,18 +2198,8 @@ struct gl_shared_state struct _mesa_HashTable *DisplayList; /**< Display lists hash table */ struct _mesa_HashTable *TexObjects; /**< Texture objects hash table */ - /** - * \name Default texture objects (shared by all multi-texture units) - */ - /*@{*/ - struct gl_texture_object *Default1D; - struct gl_texture_object *Default2D; - struct gl_texture_object *Default3D; - struct gl_texture_object *DefaultCubeMap; - struct gl_texture_object *DefaultRect; - struct gl_texture_object *Default1DArray; - struct gl_texture_object *Default2DArray; - /*@}*/ + /** Default texture objects (shared by all texture units) */ + struct gl_texture_object *DefaultTex[NUM_TEXTURE_TARGETS]; /** * \name Thread safety and statechange notification for texture diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index b4e30c8bb7..52a651c4b6 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -764,31 +764,38 @@ unbind_texobj_from_texunits(GLcontext *ctx, struct gl_texture_object *texObj) for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) { struct gl_texture_unit *unit = &ctx->Texture.Unit[u]; if (texObj == unit->Current1D) { - _mesa_reference_texobj(&unit->Current1D, ctx->Shared->Default1D); + _mesa_reference_texobj(&unit->Current1D, + ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]); ASSERT(unit->Current1D); } else if (texObj == unit->Current2D) { - _mesa_reference_texobj(&unit->Current2D, ctx->Shared->Default2D); + _mesa_reference_texobj(&unit->Current2D, + ctx->Shared->DefaultTex[TEXTURE_2D_INDEX]); ASSERT(unit->Current2D); } else if (texObj == unit->Current3D) { - _mesa_reference_texobj(&unit->Current3D, ctx->Shared->Default3D); + _mesa_reference_texobj(&unit->Current3D, + ctx->Shared->DefaultTex[TEXTURE_3D_INDEX]); ASSERT(unit->Current3D); } else if (texObj == unit->CurrentCubeMap) { - _mesa_reference_texobj(&unit->CurrentCubeMap, ctx->Shared->DefaultCubeMap); + _mesa_reference_texobj(&unit->CurrentCubeMap, + ctx->Shared->DefaultTex[TEXTURE_CUBE_INDEX]); ASSERT(unit->CurrentCubeMap); } else if (texObj == unit->CurrentRect) { - _mesa_reference_texobj(&unit->CurrentRect, ctx->Shared->DefaultRect); + _mesa_reference_texobj(&unit->CurrentRect, + ctx->Shared->DefaultTex[TEXTURE_RECT_INDEX]); ASSERT(unit->CurrentRect); } else if (texObj == unit->Current1DArray) { - _mesa_reference_texobj(&unit->Current1DArray, ctx->Shared->Default1DArray); + _mesa_reference_texobj(&unit->Current1DArray, + ctx->Shared->DefaultTex[TEXTURE_1D_ARRAY_INDEX]); ASSERT(unit->Current1DArray); } else if (texObj == unit->Current2DArray) { - _mesa_reference_texobj(&unit->Current2DArray, ctx->Shared->Default2DArray); + _mesa_reference_texobj(&unit->Current2DArray, + ctx->Shared->DefaultTex[TEXTURE_2D_ARRAY_INDEX]); ASSERT(unit->Current2DArray); } } @@ -889,25 +896,25 @@ _mesa_BindTexture( GLenum target, GLuint texName ) switch (target) { case GL_TEXTURE_1D: - defaultTexObj = ctx->Shared->Default1D; + defaultTexObj = ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]; break; case GL_TEXTURE_2D: - defaultTexObj = ctx->Shared->Default2D; + defaultTexObj = ctx->Shared->DefaultTex[TEXTURE_2D_INDEX]; break; case GL_TEXTURE_3D: - defaultTexObj = ctx->Shared->Default3D; + defaultTexObj = ctx->Shared->DefaultTex[TEXTURE_3D_INDEX]; break; case GL_TEXTURE_CUBE_MAP_ARB: - defaultTexObj = ctx->Shared->DefaultCubeMap; + defaultTexObj = ctx->Shared->DefaultTex[TEXTURE_CUBE_INDEX]; break; case GL_TEXTURE_RECTANGLE_NV: - defaultTexObj = ctx->Shared->DefaultRect; + defaultTexObj = ctx->Shared->DefaultTex[TEXTURE_RECT_INDEX]; break; case GL_TEXTURE_1D_ARRAY_EXT: - defaultTexObj = ctx->Shared->Default1DArray; + defaultTexObj = ctx->Shared->DefaultTex[TEXTURE_1D_ARRAY_INDEX]; break; case GL_TEXTURE_2D_ARRAY_EXT: - defaultTexObj = ctx->Shared->Default2DArray; + defaultTexObj = ctx->Shared->DefaultTex[TEXTURE_2D_ARRAY_INDEX]; break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glBindTexture(target)"); diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 053097cec0..b9e1a2a687 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -763,13 +763,13 @@ init_texture_unit( GLcontext *ctx, GLuint unit ) ASSIGN_4V( texUnit->GenQ.EyePlane, 0.0, 0.0, 0.0, 0.0 ); /* initialize current texture object ptrs to the shared default objects */ - _mesa_reference_texobj(&texUnit->Current1D, ctx->Shared->Default1D); - _mesa_reference_texobj(&texUnit->Current2D, ctx->Shared->Default2D); - _mesa_reference_texobj(&texUnit->Current3D, ctx->Shared->Default3D); - _mesa_reference_texobj(&texUnit->CurrentCubeMap, ctx->Shared->DefaultCubeMap); - _mesa_reference_texobj(&texUnit->CurrentRect, ctx->Shared->DefaultRect); - _mesa_reference_texobj(&texUnit->Current1DArray, ctx->Shared->Default1DArray); - _mesa_reference_texobj(&texUnit->Current2DArray, ctx->Shared->Default2DArray); + _mesa_reference_texobj(&texUnit->Current1D, ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]); + _mesa_reference_texobj(&texUnit->Current2D, ctx->Shared->DefaultTex[TEXTURE_2D_INDEX]); + _mesa_reference_texobj(&texUnit->Current3D, ctx->Shared->DefaultTex[TEXTURE_3D_INDEX]); + _mesa_reference_texobj(&texUnit->CurrentCubeMap, ctx->Shared->DefaultTex[TEXTURE_CUBE_INDEX]); + _mesa_reference_texobj(&texUnit->CurrentRect, ctx->Shared->DefaultTex[TEXTURE_RECT_INDEX]); + _mesa_reference_texobj(&texUnit->Current1DArray, ctx->Shared->DefaultTex[TEXTURE_1D_ARRAY_INDEX]); + _mesa_reference_texobj(&texUnit->Current2DArray, ctx->Shared->DefaultTex[TEXTURE_2D_ARRAY_INDEX]); } @@ -798,7 +798,8 @@ _mesa_init_texture(GLcontext *ctx) /* After we're done initializing the context's texture state the default * texture objects' refcounts should be at least MAX_TEXTURE_UNITS + 1. */ - assert(ctx->Shared->Default1D->RefCount >= MAX_TEXTURE_UNITS + 1); + assert(ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]->RefCount + >= MAX_TEXTURE_UNITS + 1); /* Allocate proxy textures */ if (!alloc_proxy_textures( ctx )) @@ -855,12 +856,19 @@ _mesa_update_default_objects_texture(GLcontext *ctx) for (i = 0; i < MAX_TEXTURE_UNITS; i++) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; - _mesa_reference_texobj(&texUnit->Current1D, ctx->Shared->Default1D); - _mesa_reference_texobj(&texUnit->Current2D, ctx->Shared->Default2D); - _mesa_reference_texobj(&texUnit->Current3D, ctx->Shared->Default3D); - _mesa_reference_texobj(&texUnit->CurrentCubeMap, ctx->Shared->DefaultCubeMap); - _mesa_reference_texobj(&texUnit->CurrentRect, ctx->Shared->DefaultRect); - _mesa_reference_texobj(&texUnit->Current1DArray, ctx->Shared->Default1DArray); - _mesa_reference_texobj(&texUnit->Current2DArray, ctx->Shared->Default2DArray); + _mesa_reference_texobj(&texUnit->Current1D, + ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]); + _mesa_reference_texobj(&texUnit->Current2D, + ctx->Shared->DefaultTex[TEXTURE_2D_INDEX]); + _mesa_reference_texobj(&texUnit->Current3D, + ctx->Shared->DefaultTex[TEXTURE_3D_INDEX]); + _mesa_reference_texobj(&texUnit->CurrentCubeMap, + ctx->Shared->DefaultTex[TEXTURE_CUBE_INDEX]); + _mesa_reference_texobj(&texUnit->CurrentRect, + ctx->Shared->DefaultTex[TEXTURE_RECT_INDEX]); + _mesa_reference_texobj(&texUnit->Current1DArray, + ctx->Shared->DefaultTex[TEXTURE_1D_ARRAY_INDEX]); + _mesa_reference_texobj(&texUnit->Current2DArray, + ctx->Shared->DefaultTex[TEXTURE_2D_ARRAY_INDEX]); } } -- cgit v1.2.3 From 9818734e0148510967ca9ee0d1aa8b196b509f02 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 21 Feb 2009 14:53:25 -0700 Subject: mesa: use an array for current texture objects Use loops to consolidate lots of texture object code. --- src/mesa/drivers/dri/common/texmem.c | 10 +-- src/mesa/drivers/dri/gamma/gamma_tex.c | 8 +- src/mesa/drivers/dri/mga/mga_texstate.c | 8 +- src/mesa/drivers/dri/r300/r300_state.c | 2 +- src/mesa/drivers/dri/s3v/s3v_tex.c | 8 +- src/mesa/drivers/x11/xm_api.c | 6 +- src/mesa/main/attrib.c | 38 +++------ src/mesa/main/get.c | 42 +++++----- src/mesa/main/get_gen.py | 14 ++-- src/mesa/main/mtypes.h | 14 ++-- src/mesa/main/teximage.c | 14 ++-- src/mesa/main/texobj.c | 136 +++++++++++--------------------- src/mesa/main/texparam.c | 14 ++-- src/mesa/main/texstate.c | 103 +++++++++--------------- src/mesa/state_tracker/st_texture.c | 2 +- src/mesa/swrast/s_triangle.c | 15 ++-- 16 files changed, 169 insertions(+), 265 deletions(-) (limited to 'src/mesa/main/texobj.c') diff --git a/src/mesa/drivers/dri/common/texmem.c b/src/mesa/drivers/dri/common/texmem.c index ff174a251d..041d8c6e97 100644 --- a/src/mesa/drivers/dri/common/texmem.c +++ b/src/mesa/drivers/dri/common/texmem.c @@ -1063,31 +1063,31 @@ void driInitTextureObjects( GLcontext *ctx, driTextureObject * swapped, ctx->Texture.CurrentUnit = i; if ( (targets & DRI_TEXMGR_DO_TEXTURE_1D) != 0 ) { - texObj = ctx->Texture.Unit[i].Current1D; + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_1D_INDEX]; ctx->Driver.BindTexture( ctx, GL_TEXTURE_1D, texObj ); move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); } if ( (targets & DRI_TEXMGR_DO_TEXTURE_2D) != 0 ) { - texObj = ctx->Texture.Unit[i].Current2D; + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_2D_INDEX]; ctx->Driver.BindTexture( ctx, GL_TEXTURE_2D, texObj ); move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); } if ( (targets & DRI_TEXMGR_DO_TEXTURE_3D) != 0 ) { - texObj = ctx->Texture.Unit[i].Current3D; + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_3D_INDEX]; ctx->Driver.BindTexture( ctx, GL_TEXTURE_3D, texObj ); move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); } if ( (targets & DRI_TEXMGR_DO_TEXTURE_CUBE) != 0 ) { - texObj = ctx->Texture.Unit[i].CurrentCubeMap; + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_CUBE_INDEX]Map; ctx->Driver.BindTexture( ctx, GL_TEXTURE_CUBE_MAP_ARB, texObj ); move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); } if ( (targets & DRI_TEXMGR_DO_TEXTURE_RECT) != 0 ) { - texObj = ctx->Texture.Unit[i].CurrentRect; + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_RECT_INDEX]; ctx->Driver.BindTexture( ctx, GL_TEXTURE_RECTANGLE_NV, texObj ); move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); } diff --git a/src/mesa/drivers/dri/gamma/gamma_tex.c b/src/mesa/drivers/dri/gamma/gamma_tex.c index 2ffb790f28..ca33c1740f 100644 --- a/src/mesa/drivers/dri/gamma/gamma_tex.c +++ b/src/mesa/drivers/dri/gamma/gamma_tex.c @@ -400,19 +400,19 @@ void gammaInitTextureObjects( GLcontext *ctx ) ctx->Texture.CurrentUnit = 0; - texObj = ctx->Texture.Unit[0].Current1D; + texObj = ctx->Texture.Unit[0].CurrentTex[TEXTURE_1D_INDEX]; gammaBindTexture( ctx, GL_TEXTURE_1D, texObj ); - texObj = ctx->Texture.Unit[0].Current2D; + texObj = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; gammaBindTexture( ctx, GL_TEXTURE_2D, texObj ); #if 0 ctx->Texture.CurrentUnit = 1; - texObj = ctx->Texture.Unit[1].Current1D; + texObj = ctx->Texture.Unit[1].CurrentTex[TEXTURE_1D_INDEX]; gammaBindTexture( ctx, GL_TEXTURE_1D, texObj ); - texObj = ctx->Texture.Unit[1].Current2D; + texObj = ctx->Texture.Unit[1].CurrentTex[TEXTURE_2D_INDEX]; gammaBindTexture( ctx, GL_TEXTURE_2D, texObj ); #endif diff --git a/src/mesa/drivers/dri/mga/mga_texstate.c b/src/mesa/drivers/dri/mga/mga_texstate.c index d4c5b6fd97..ad765d1dd7 100644 --- a/src/mesa/drivers/dri/mga/mga_texstate.c +++ b/src/mesa/drivers/dri/mga/mga_texstate.c @@ -206,8 +206,8 @@ static void mgaUpdateTextureEnvG200( GLcontext *ctx, GLuint unit ) mgaTextureObjectPtr t = (mgaTextureObjectPtr) tObj->DriverData; GLenum format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; - if (tObj != ctx->Texture.Unit[0].Current2D && - tObj != ctx->Texture.Unit[0].CurrentRect) + if (tObj != ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX] && + tObj != ctx->Texture.Unit[0].CurrentTex[TEXTURE_RECT_INDEX]) return; @@ -635,8 +635,8 @@ static void mgaUpdateTextureEnvG400( GLcontext *ctx, GLuint unit ) mgaTextureObjectPtr t = (mgaTextureObjectPtr) tObj->DriverData; GLenum format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; - if (tObj != ctx->Texture.Unit[source].Current2D && - tObj != ctx->Texture.Unit[source].CurrentRect) + if (tObj != ctx->Texture.Unit[source].CurrentTex[TEXTURE_2D_INDEX] && + tObj != ctx->Texture.Unit[source].CurrentTex[TEXTURE_RECT_INDEX]) return; switch (ctx->Texture.Unit[source].EnvMode) { diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index c192fecca4..ade45f581c 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1199,7 +1199,7 @@ r300FetchStateParameter(GLcontext * ctx, case STATE_R300_TEXRECT_FACTOR:{ struct gl_texture_object *t = - ctx->Texture.Unit[state[2]].CurrentRect; + ctx->Texture.Unit[state[2]].CurrentTex[TEXTURE_RECT_INDEX]; if (t && t->Image[0][t->BaseLevel]) { struct gl_texture_image *image = diff --git a/src/mesa/drivers/dri/s3v/s3v_tex.c b/src/mesa/drivers/dri/s3v/s3v_tex.c index 8bf2ea9878..db66026363 100644 --- a/src/mesa/drivers/dri/s3v/s3v_tex.c +++ b/src/mesa/drivers/dri/s3v/s3v_tex.c @@ -502,20 +502,20 @@ static void s3vInitTextureObjects( GLcontext *ctx ) #if 1 ctx->Texture.CurrentUnit = 0; - texObj = ctx->Texture.Unit[0].Current1D; + texObj = ctx->Texture.Unit[0].CurrentTex[TEXTURE_1D_INDEX]; s3vBindTexture( ctx, GL_TEXTURE_1D, texObj ); - texObj = ctx->Texture.Unit[0].Current2D; + texObj = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; s3vBindTexture( ctx, GL_TEXTURE_2D, texObj ); #endif #if 0 ctx->Texture.CurrentUnit = 1; - texObj = ctx->Texture.Unit[1].Current1D; + texObj = ctx->Texture.Unit[1].CurrentTex[TEXTURE_1D_INDEX]; s3vBindTexture( ctx, GL_TEXTURE_1D, texObj ); - texObj = ctx->Texture.Unit[1].Current2D; + texObj = ctx->Texture.Unit[1].CurrentTex[TEXTURE_2D_INDEX]; s3vBindTexture( ctx, GL_TEXTURE_2D, texObj ); #endif diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 2a8c3a4fd3..62d30a6987 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -2461,13 +2461,13 @@ XMesaBindTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer, #if 0 switch (drawable->TextureTarget) { case GLX_TEXTURE_1D_EXT: - texObj = texUnit->Current1D; + texObj = texUnit->CurrentTex[TEXTURE_1D_INDEX]; break; case GLX_TEXTURE_2D_EXT: - texObj = texUnit->Current2D; + texObj = texUnit->CurrentTex[TEXTURE_2D_INDEX]; break; case GLX_TEXTURE_RECTANGLE_EXT: - texObj = texUnit->CurrentRect; + texObj = texUnit->CurrentTex[TEXTURE_RECT_INDEX]; break; default: return; /* BadMatch error */ diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index dc33eb1fac..996033a2d8 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -365,7 +365,7 @@ _mesa_PushAttrib(GLbitfield mask) if (mask & GL_TEXTURE_BIT) { struct texture_state *texstate = CALLOC_STRUCT(texture_state); - GLuint u; + GLuint u, tex; if (!texstate) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushAttrib(GL_TEXTURE_BIT)"); @@ -381,38 +381,18 @@ _mesa_PushAttrib(GLbitfield mask) * accidentally get deleted while referenced in the attribute stack. */ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { - _mesa_reference_texobj(&texstate->SavedTexRef[u][TEXTURE_1D_INDEX], - ctx->Texture.Unit[u].Current1D); - _mesa_reference_texobj(&texstate->SavedTexRef[u][TEXTURE_2D_INDEX], - ctx->Texture.Unit[u].Current2D); - _mesa_reference_texobj(&texstate->SavedTexRef[u][TEXTURE_3D_INDEX], - ctx->Texture.Unit[u].Current3D); - _mesa_reference_texobj(&texstate->SavedTexRef[u][TEXTURE_CUBE_INDEX], - ctx->Texture.Unit[u].CurrentCubeMap); - _mesa_reference_texobj(&texstate->SavedTexRef[u][TEXTURE_RECT_INDEX], - ctx->Texture.Unit[u].CurrentRect); - _mesa_reference_texobj(&texstate->SavedTexRef[u][TEXTURE_1D_ARRAY_INDEX], - ctx->Texture.Unit[u].Current1DArray); - _mesa_reference_texobj(&texstate->SavedTexRef[u][TEXTURE_2D_ARRAY_INDEX], - ctx->Texture.Unit[u].Current2DArray); + for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) { + _mesa_reference_texobj(&texstate->SavedTexRef[u][tex], + ctx->Texture.Unit[u].CurrentTex[tex]); + } } /* copy state/contents of the currently bound texture objects */ for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { - _mesa_copy_texture_object(&texstate->SavedObj[u][TEXTURE_1D_INDEX], - ctx->Texture.Unit[u].Current1D); - _mesa_copy_texture_object(&texstate->SavedObj[u][TEXTURE_2D_INDEX], - ctx->Texture.Unit[u].Current2D); - _mesa_copy_texture_object(&texstate->SavedObj[u][TEXTURE_3D_INDEX], - ctx->Texture.Unit[u].Current3D); - _mesa_copy_texture_object(&texstate->SavedObj[u][TEXTURE_CUBE_INDEX], - ctx->Texture.Unit[u].CurrentCubeMap); - _mesa_copy_texture_object(&texstate->SavedObj[u][TEXTURE_RECT_INDEX], - ctx->Texture.Unit[u].CurrentRect); - _mesa_copy_texture_object(&texstate->SavedObj[u][TEXTURE_1D_ARRAY_INDEX], - ctx->Texture.Unit[u].Current1DArray); - _mesa_copy_texture_object(&texstate->SavedObj[u][TEXTURE_2D_ARRAY_INDEX], - ctx->Texture.Unit[u].Current2DArray); + for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) { + _mesa_copy_texture_object(&texstate->SavedObj[u][tex], + ctx->Texture.Unit[u].CurrentTex[tex]); + } } _mesa_unlock_context_textures(ctx); diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 87a821b12d..3a8d56140f 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -884,21 +884,21 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) params[0] = _mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT); break; case GL_TEXTURE_BINDING_1D: - params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name); + params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name); break; case GL_TEXTURE_BINDING_2D: - params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name); + params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name); break; case GL_TEXTURE_BINDING_3D: - params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name); + params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name); break; case GL_TEXTURE_BINDING_1D_ARRAY_EXT: CHECK_EXT1(MESA_texture_array, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1DArray->Name); + params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name); break; case GL_TEXTURE_BINDING_2D_ARRAY_EXT: CHECK_EXT1(MESA_texture_array, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name); + params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name); break; case GL_TEXTURE_GEN_S: params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0); @@ -1071,7 +1071,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_TEXTURE_BINDING_CUBE_MAP_ARB: CHECK_EXT1(ARB_texture_cube_map, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name); + params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name); break; case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: CHECK_EXT1(ARB_texture_cube_map, "GetBooleanv"); @@ -1558,7 +1558,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_TEXTURE_BINDING_RECTANGLE_NV: CHECK_EXT1(NV_texture_rectangle, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name); + params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name); break; case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: CHECK_EXT1(NV_texture_rectangle, "GetBooleanv"); @@ -2710,21 +2710,21 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[0] = BOOLEAN_TO_FLOAT(_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)); break; case GL_TEXTURE_BINDING_1D: - params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name); + params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name); break; case GL_TEXTURE_BINDING_2D: - params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name); + params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name); break; case GL_TEXTURE_BINDING_3D: - params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name); + params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name); break; case GL_TEXTURE_BINDING_1D_ARRAY_EXT: CHECK_EXT1(MESA_texture_array, "GetFloatv"); - params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1DArray->Name); + params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name); break; case GL_TEXTURE_BINDING_2D_ARRAY_EXT: CHECK_EXT1(MESA_texture_array, "GetFloatv"); - params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name); + params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name); break; case GL_TEXTURE_GEN_S: params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)); @@ -2897,7 +2897,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_TEXTURE_BINDING_CUBE_MAP_ARB: CHECK_EXT1(ARB_texture_cube_map, "GetFloatv"); - params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name); + params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name); break; case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: CHECK_EXT1(ARB_texture_cube_map, "GetFloatv"); @@ -3384,7 +3384,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_TEXTURE_BINDING_RECTANGLE_NV: CHECK_EXT1(NV_texture_rectangle, "GetFloatv"); - params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name); + params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name); break; case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: CHECK_EXT1(NV_texture_rectangle, "GetFloatv"); @@ -4536,21 +4536,21 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) params[0] = BOOLEAN_TO_INT(_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)); break; case GL_TEXTURE_BINDING_1D: - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name; + params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name; break; case GL_TEXTURE_BINDING_2D: - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name; + params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name; break; case GL_TEXTURE_BINDING_3D: - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name; + params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name; break; case GL_TEXTURE_BINDING_1D_ARRAY_EXT: CHECK_EXT1(MESA_texture_array, "GetIntegerv"); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1DArray->Name; + params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name; break; case GL_TEXTURE_BINDING_2D_ARRAY_EXT: CHECK_EXT1(MESA_texture_array, "GetIntegerv"); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name; + params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name; break; case GL_TEXTURE_GEN_S: params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)); @@ -4723,7 +4723,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_TEXTURE_BINDING_CUBE_MAP_ARB: CHECK_EXT1(ARB_texture_cube_map, "GetIntegerv"); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name; + params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name; break; case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: CHECK_EXT1(ARB_texture_cube_map, "GetIntegerv"); @@ -5210,7 +5210,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_TEXTURE_BINDING_RECTANGLE_NV: CHECK_EXT1(NV_texture_rectangle, "GetIntegerv"); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name; + params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name; break; case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: CHECK_EXT1(NV_texture_rectangle, "GetIntegerv"); diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py index 3b2496c663..729f382b4b 100644 --- a/src/mesa/main/get_gen.py +++ b/src/mesa/main/get_gen.py @@ -432,15 +432,15 @@ StateVars = [ ( "GL_TEXTURE_1D_ARRAY_EXT", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_1D_ARRAY_EXT)"], "", ["MESA_texture_array"] ), ( "GL_TEXTURE_2D_ARRAY_EXT", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)"], "", ["MESA_texture_array"] ), ( "GL_TEXTURE_BINDING_1D", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name"], "", None ), + ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name"], "", None ), ( "GL_TEXTURE_BINDING_2D", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name"], "", None ), + ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name"], "", None ), ( "GL_TEXTURE_BINDING_3D", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name"], "", None ), + ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name"], "", None ), ( "GL_TEXTURE_BINDING_1D_ARRAY_EXT", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1DArray->Name"], "", ["MESA_texture_array"] ), + ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name"], "", ["MESA_texture_array"] ), ( "GL_TEXTURE_BINDING_2D_ARRAY_EXT", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2DArray->Name"], "", ["MESA_texture_array"] ), + ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name"], "", ["MESA_texture_array"] ), ( "GL_TEXTURE_GEN_S", GLboolean, ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)"], "", None ), ( "GL_TEXTURE_GEN_T", GLboolean, @@ -515,7 +515,7 @@ StateVars = [ ( "GL_TEXTURE_CUBE_MAP_ARB", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)"], "", ["ARB_texture_cube_map"] ), ( "GL_TEXTURE_BINDING_CUBE_MAP_ARB", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name"], + ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name"], "", ["ARB_texture_cube_map"] ), ( "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB", GLint, ["(1 << (ctx->Const.MaxCubeTextureLevels - 1))"], @@ -795,7 +795,7 @@ StateVars = [ ( "GL_TEXTURE_RECTANGLE_NV", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV)"], "", ["NV_texture_rectangle"] ), ( "GL_TEXTURE_BINDING_RECTANGLE_NV", GLint, - ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name"], + ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name"], "", ["NV_texture_rectangle"] ), ( "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV", GLint, ["ctx->Const.MaxTextureRectSize"], "", ["NV_texture_rectangle"] ), diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index bd7d6f0784..06cef3d670 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1543,15 +1543,11 @@ struct gl_texture_unit */ struct gl_tex_env_combine_state *_CurrentCombine; - struct gl_texture_object *Current1D; - struct gl_texture_object *Current2D; - struct gl_texture_object *Current3D; - struct gl_texture_object *CurrentCubeMap; /**< GL_ARB_texture_cube_map */ - struct gl_texture_object *CurrentRect; /**< GL_NV_texture_rectangle */ - struct gl_texture_object *Current1DArray; /**< GL_MESA_texture_array */ - struct gl_texture_object *Current2DArray; /**< GL_MESA_texture_array */ - - struct gl_texture_object *_Current; /**< Points to really enabled tex obj */ + /** Current texture object pointers */ + struct gl_texture_object *CurrentTex[NUM_TEXTURE_TARGETS]; + + /** Points to highest priority, complete and enabled texture object */ + struct gl_texture_object *_Current; /** GL_SGI_texture_color_table */ /*@{*/ diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 8fd69c4f6a..e3d4404759 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -766,15 +766,15 @@ _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit, { switch (target) { case GL_TEXTURE_1D: - return texUnit->Current1D; + return texUnit->CurrentTex[TEXTURE_1D_INDEX]; case GL_PROXY_TEXTURE_1D: return ctx->Texture.ProxyTex[TEXTURE_1D_INDEX]; case GL_TEXTURE_2D: - return texUnit->Current2D; + return texUnit->CurrentTex[TEXTURE_2D_INDEX]; case GL_PROXY_TEXTURE_2D: return ctx->Texture.ProxyTex[TEXTURE_2D_INDEX]; case GL_TEXTURE_3D: - return texUnit->Current3D; + return texUnit->CurrentTex[TEXTURE_3D_INDEX]; case GL_PROXY_TEXTURE_3D: return ctx->Texture.ProxyTex[TEXTURE_3D_INDEX]; case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: @@ -785,25 +785,25 @@ _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit, case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: case GL_TEXTURE_CUBE_MAP_ARB: return ctx->Extensions.ARB_texture_cube_map - ? texUnit->CurrentCubeMap : NULL; + ? texUnit->CurrentTex[TEXTURE_CUBE_INDEX] : NULL; case GL_PROXY_TEXTURE_CUBE_MAP_ARB: return ctx->Extensions.ARB_texture_cube_map ? ctx->Texture.ProxyTex[TEXTURE_CUBE_INDEX] : NULL; case GL_TEXTURE_RECTANGLE_NV: return ctx->Extensions.NV_texture_rectangle - ? texUnit->CurrentRect : NULL; + ? texUnit->CurrentTex[TEXTURE_RECT_INDEX] : NULL; case GL_PROXY_TEXTURE_RECTANGLE_NV: return ctx->Extensions.NV_texture_rectangle ? ctx->Texture.ProxyTex[TEXTURE_RECT_INDEX] : NULL; case GL_TEXTURE_1D_ARRAY_EXT: return ctx->Extensions.MESA_texture_array - ? texUnit->Current1DArray : NULL; + ? texUnit->CurrentTex[TEXTURE_1D_ARRAY_INDEX] : NULL; case GL_PROXY_TEXTURE_1D_ARRAY_EXT: return ctx->Extensions.MESA_texture_array ? ctx->Texture.ProxyTex[TEXTURE_1D_ARRAY_INDEX] : NULL; case GL_TEXTURE_2D_ARRAY_EXT: return ctx->Extensions.MESA_texture_array - ? texUnit->Current2DArray : NULL; + ? texUnit->CurrentTex[TEXTURE_2D_ARRAY_INDEX] : NULL; case GL_PROXY_TEXTURE_2D_ARRAY_EXT: return ctx->Extensions.MESA_texture_array ? ctx->Texture.ProxyTex[TEXTURE_2D_ARRAY_INDEX] : NULL; diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 52a651c4b6..2de2dcc95d 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -759,44 +759,17 @@ unbind_texobj_from_fbo(GLcontext *ctx, struct gl_texture_object *texObj) static void unbind_texobj_from_texunits(GLcontext *ctx, struct gl_texture_object *texObj) { - GLuint u; + GLuint u, tex; for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) { struct gl_texture_unit *unit = &ctx->Texture.Unit[u]; - if (texObj == unit->Current1D) { - _mesa_reference_texobj(&unit->Current1D, - ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]); - ASSERT(unit->Current1D); - } - else if (texObj == unit->Current2D) { - _mesa_reference_texobj(&unit->Current2D, - ctx->Shared->DefaultTex[TEXTURE_2D_INDEX]); - ASSERT(unit->Current2D); - } - else if (texObj == unit->Current3D) { - _mesa_reference_texobj(&unit->Current3D, - ctx->Shared->DefaultTex[TEXTURE_3D_INDEX]); - ASSERT(unit->Current3D); - } - else if (texObj == unit->CurrentCubeMap) { - _mesa_reference_texobj(&unit->CurrentCubeMap, - ctx->Shared->DefaultTex[TEXTURE_CUBE_INDEX]); - ASSERT(unit->CurrentCubeMap); - } - else if (texObj == unit->CurrentRect) { - _mesa_reference_texobj(&unit->CurrentRect, - ctx->Shared->DefaultTex[TEXTURE_RECT_INDEX]); - ASSERT(unit->CurrentRect); - } - else if (texObj == unit->Current1DArray) { - _mesa_reference_texobj(&unit->Current1DArray, - ctx->Shared->DefaultTex[TEXTURE_1D_ARRAY_INDEX]); - ASSERT(unit->Current1DArray); - } - else if (texObj == unit->Current2DArray) { - _mesa_reference_texobj(&unit->Current2DArray, - ctx->Shared->DefaultTex[TEXTURE_2D_ARRAY_INDEX]); - ASSERT(unit->Current2DArray); + for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) { + if (texObj == unit->CurrentTex[tex]) { + _mesa_reference_texobj(&unit->CurrentTex[tex], + ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]); + ASSERT(unit->CurrentTex[tex]); + break; + } } } } @@ -866,6 +839,35 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures) } +/** + * Convert a GL texture target enum such as GL_TEXTURE_2D or GL_TEXTURE_3D + * into the corresponding Mesa texture target index. + * Return -1 if target is invalid. + */ +static GLint +target_enum_to_index(GLenum target) +{ + switch (target) { + case GL_TEXTURE_1D: + return TEXTURE_1D_INDEX; + case GL_TEXTURE_2D: + return TEXTURE_2D_INDEX; + case GL_TEXTURE_3D: + return TEXTURE_3D_INDEX; + case GL_TEXTURE_CUBE_MAP_ARB: + return TEXTURE_CUBE_INDEX; + case GL_TEXTURE_RECTANGLE_NV: + return TEXTURE_RECT_INDEX; + case GL_TEXTURE_1D_ARRAY_EXT: + return TEXTURE_1D_ARRAY_INDEX; + case GL_TEXTURE_2D_ARRAY_EXT: + return TEXTURE_2D_ARRAY_INDEX; + default: + return -1; + } +} + + /** * Bind a named texture to a texturing target. * @@ -888,38 +890,20 @@ _mesa_BindTexture( GLenum target, GLuint texName ) const GLuint unit = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; struct gl_texture_object *newTexObj = NULL, *defaultTexObj = NULL; + GLint targetIndex; ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glBindTexture %s %d\n", _mesa_lookup_enum_by_nr(target), (GLint) texName); - switch (target) { - case GL_TEXTURE_1D: - defaultTexObj = ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]; - break; - case GL_TEXTURE_2D: - defaultTexObj = ctx->Shared->DefaultTex[TEXTURE_2D_INDEX]; - break; - case GL_TEXTURE_3D: - defaultTexObj = ctx->Shared->DefaultTex[TEXTURE_3D_INDEX]; - break; - case GL_TEXTURE_CUBE_MAP_ARB: - defaultTexObj = ctx->Shared->DefaultTex[TEXTURE_CUBE_INDEX]; - break; - case GL_TEXTURE_RECTANGLE_NV: - defaultTexObj = ctx->Shared->DefaultTex[TEXTURE_RECT_INDEX]; - break; - case GL_TEXTURE_1D_ARRAY_EXT: - defaultTexObj = ctx->Shared->DefaultTex[TEXTURE_1D_ARRAY_INDEX]; - break; - case GL_TEXTURE_2D_ARRAY_EXT: - defaultTexObj = ctx->Shared->DefaultTex[TEXTURE_2D_ARRAY_INDEX]; - break; - default: + targetIndex = target_enum_to_index(target); + if (targetIndex < 0) { _mesa_error(ctx, GL_INVALID_ENUM, "glBindTexture(target)"); return; } + assert(targetIndex < NUM_TEXTURE_TARGETS); + defaultTexObj = ctx->Shared->DefaultTex[targetIndex]; /* * Get pointer to new texture object (newTexObj) @@ -967,40 +951,8 @@ _mesa_BindTexture( GLenum target, GLuint texName ) * texture object will be decremented. It'll be deleted if the * count hits zero. */ - switch (target) { - case GL_TEXTURE_1D: - _mesa_reference_texobj(&texUnit->Current1D, newTexObj); - ASSERT(texUnit->Current1D); - break; - case GL_TEXTURE_2D: - _mesa_reference_texobj(&texUnit->Current2D, newTexObj); - ASSERT(texUnit->Current2D); - break; - case GL_TEXTURE_3D: - _mesa_reference_texobj(&texUnit->Current3D, newTexObj); - ASSERT(texUnit->Current3D); - break; - case GL_TEXTURE_CUBE_MAP_ARB: - _mesa_reference_texobj(&texUnit->CurrentCubeMap, newTexObj); - ASSERT(texUnit->CurrentCubeMap); - break; - case GL_TEXTURE_RECTANGLE_NV: - _mesa_reference_texobj(&texUnit->CurrentRect, newTexObj); - ASSERT(texUnit->CurrentRect); - break; - case GL_TEXTURE_1D_ARRAY_EXT: - _mesa_reference_texobj(&texUnit->Current1DArray, newTexObj); - ASSERT(texUnit->Current1DArray); - break; - case GL_TEXTURE_2D_ARRAY_EXT: - _mesa_reference_texobj(&texUnit->Current2DArray, newTexObj); - ASSERT(texUnit->Current2DArray); - break; - default: - /* Bad target should be caught above */ - _mesa_problem(ctx, "bad target in BindTexture"); - return; - } + _mesa_reference_texobj(&texUnit->CurrentTex[targetIndex], newTexObj); + ASSERT(texUnit->CurrentTex[targetIndex]); /* Pass BindTexture call to device driver */ if (ctx->Driver.BindTexture) diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 865aae8627..50f867e1c1 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -92,29 +92,29 @@ get_texobj(GLcontext *ctx, GLenum target) switch (target) { case GL_TEXTURE_1D: - return texUnit->Current1D; + return texUnit->CurrentTex[TEXTURE_1D_INDEX]; case GL_TEXTURE_2D: - return texUnit->Current2D; + return texUnit->CurrentTex[TEXTURE_2D_INDEX]; case GL_TEXTURE_3D: - return texUnit->Current3D; + return texUnit->CurrentTex[TEXTURE_3D_INDEX]; case GL_TEXTURE_CUBE_MAP: if (ctx->Extensions.ARB_texture_cube_map) { - return texUnit->CurrentCubeMap; + return texUnit->CurrentTex[TEXTURE_CUBE_INDEX]; } break; case GL_TEXTURE_RECTANGLE_NV: if (ctx->Extensions.NV_texture_rectangle) { - return texUnit->CurrentRect; + return texUnit->CurrentTex[TEXTURE_RECT_INDEX]; } break; case GL_TEXTURE_1D_ARRAY_EXT: if (ctx->Extensions.MESA_texture_array) { - return texUnit->Current1DArray; + return texUnit->CurrentTex[TEXTURE_1D_ARRAY_INDEX]; } break; case GL_TEXTURE_2D_ARRAY_EXT: if (ctx->Extensions.MESA_texture_array) { - return texUnit->Current2DArray; + return texUnit->CurrentTex[TEXTURE_2D_ARRAY_INDEX]; } break; default: diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index b9e1a2a687..27927d60b0 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -68,7 +68,7 @@ static const struct gl_tex_env_combine_state default_combine_state = { void _mesa_copy_texture_state( const GLcontext *src, GLcontext *dst ) { - GLuint i; + GLuint i, tex; ASSERT(src); ASSERT(dst); @@ -104,20 +104,10 @@ _mesa_copy_texture_state( const GLcontext *src, GLcontext *dst ) /* copy texture object bindings, not contents of texture objects */ _mesa_lock_context_textures(dst); - _mesa_reference_texobj(&dst->Texture.Unit[i].Current1D, - src->Texture.Unit[i].Current1D); - _mesa_reference_texobj(&dst->Texture.Unit[i].Current2D, - src->Texture.Unit[i].Current2D); - _mesa_reference_texobj(&dst->Texture.Unit[i].Current3D, - src->Texture.Unit[i].Current3D); - _mesa_reference_texobj(&dst->Texture.Unit[i].CurrentCubeMap, - src->Texture.Unit[i].CurrentCubeMap); - _mesa_reference_texobj(&dst->Texture.Unit[i].CurrentRect, - src->Texture.Unit[i].CurrentRect); - _mesa_reference_texobj(&dst->Texture.Unit[i].Current1DArray, - src->Texture.Unit[i].Current1DArray); - _mesa_reference_texobj(&dst->Texture.Unit[i].Current2DArray, - src->Texture.Unit[i].Current2DArray); + for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) { + _mesa_reference_texobj(&dst->Texture.Unit[i].CurrentTex[tex], + src->Texture.Unit[i].CurrentTex[tex]); + } _mesa_unlock_context_textures(dst); } @@ -558,6 +548,7 @@ update_texture_state( GLcontext *ctx ) for (unit = 0; unit < ctx->Const.MaxTextureImageUnits; unit++) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; GLbitfield enableBits; + GLuint tex; texUnit->_Current = NULL; texUnit->_ReallyEnabled = 0; @@ -584,32 +575,29 @@ update_texture_state( GLcontext *ctx ) if (enableBits == 0x0) continue; - ASSERT(texUnit->Current1D); - ASSERT(texUnit->Current2D); - ASSERT(texUnit->Current3D); - ASSERT(texUnit->CurrentCubeMap); - ASSERT(texUnit->CurrentRect); - ASSERT(texUnit->Current1DArray); - ASSERT(texUnit->Current2DArray); + for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) { + ASSERT(texUnit->CurrentTex[tex]); + } /* Look for the highest-priority texture target that's enabled and * complete. That's the one we'll use for texturing. If we're using * a fragment program we're guaranteed that bitcount(enabledBits) <= 1. */ - texture_override(ctx, texUnit, enableBits, - texUnit->Current2DArray, TEXTURE_2D_ARRAY_BIT); - texture_override(ctx, texUnit, enableBits, - texUnit->Current1DArray, TEXTURE_1D_ARRAY_BIT); - texture_override(ctx, texUnit, enableBits, - texUnit->CurrentCubeMap, TEXTURE_CUBE_BIT); - texture_override(ctx, texUnit, enableBits, - texUnit->Current3D, TEXTURE_3D_BIT); - texture_override(ctx, texUnit, enableBits, - texUnit->CurrentRect, TEXTURE_RECT_BIT); - texture_override(ctx, texUnit, enableBits, - texUnit->Current2D, TEXTURE_2D_BIT); - texture_override(ctx, texUnit, enableBits, - texUnit->Current1D, TEXTURE_1D_BIT); + for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) { + /* texture indexes from highest to lowest priority */ + static const GLuint targets[NUM_TEXTURE_TARGETS] = { + TEXTURE_2D_ARRAY_INDEX, + TEXTURE_1D_ARRAY_INDEX, + TEXTURE_CUBE_INDEX, + TEXTURE_3D_INDEX, + TEXTURE_RECT_INDEX, + TEXTURE_2D_INDEX, + TEXTURE_1D_INDEX + }; + GLuint texIndex = targets[tex]; + texture_override(ctx, texUnit, enableBits, + texUnit->CurrentTex[texIndex], 1 << texIndex); + } if (!texUnit->_ReallyEnabled) { continue; @@ -734,6 +722,7 @@ static void init_texture_unit( GLcontext *ctx, GLuint unit ) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + GLuint tex; texUnit->EnvMode = GL_MODULATE; ASSIGN_4V( texUnit->EnvColor, 0.0, 0.0, 0.0, 0.0 ); @@ -763,13 +752,10 @@ init_texture_unit( GLcontext *ctx, GLuint unit ) ASSIGN_4V( texUnit->GenQ.EyePlane, 0.0, 0.0, 0.0, 0.0 ); /* initialize current texture object ptrs to the shared default objects */ - _mesa_reference_texobj(&texUnit->Current1D, ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]); - _mesa_reference_texobj(&texUnit->Current2D, ctx->Shared->DefaultTex[TEXTURE_2D_INDEX]); - _mesa_reference_texobj(&texUnit->Current3D, ctx->Shared->DefaultTex[TEXTURE_3D_INDEX]); - _mesa_reference_texobj(&texUnit->CurrentCubeMap, ctx->Shared->DefaultTex[TEXTURE_CUBE_INDEX]); - _mesa_reference_texobj(&texUnit->CurrentRect, ctx->Shared->DefaultTex[TEXTURE_RECT_INDEX]); - _mesa_reference_texobj(&texUnit->Current1DArray, ctx->Shared->DefaultTex[TEXTURE_1D_ARRAY_INDEX]); - _mesa_reference_texobj(&texUnit->Current2DArray, ctx->Shared->DefaultTex[TEXTURE_2D_ARRAY_INDEX]); + for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) { + _mesa_reference_texobj(&texUnit->CurrentTex[tex], + ctx->Shared->DefaultTex[tex]); + } } @@ -820,13 +806,9 @@ _mesa_free_texture_data(GLcontext *ctx) /* unreference current textures */ for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) { struct gl_texture_unit *unit = ctx->Texture.Unit + u; - _mesa_reference_texobj(&unit->Current1D, NULL); - _mesa_reference_texobj(&unit->Current2D, NULL); - _mesa_reference_texobj(&unit->Current3D, NULL); - _mesa_reference_texobj(&unit->CurrentCubeMap, NULL); - _mesa_reference_texobj(&unit->CurrentRect, NULL); - _mesa_reference_texobj(&unit->Current1DArray, NULL); - _mesa_reference_texobj(&unit->Current2DArray, NULL); + for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) { + _mesa_reference_texobj(&unit->CurrentTex[tgt], NULL); + } } /* Free proxy texture objects */ @@ -851,24 +833,13 @@ _mesa_free_texture_data(GLcontext *ctx) void _mesa_update_default_objects_texture(GLcontext *ctx) { - GLuint i; + GLuint i, tex; for (i = 0; i < MAX_TEXTURE_UNITS; i++) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; - - _mesa_reference_texobj(&texUnit->Current1D, - ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]); - _mesa_reference_texobj(&texUnit->Current2D, - ctx->Shared->DefaultTex[TEXTURE_2D_INDEX]); - _mesa_reference_texobj(&texUnit->Current3D, - ctx->Shared->DefaultTex[TEXTURE_3D_INDEX]); - _mesa_reference_texobj(&texUnit->CurrentCubeMap, - ctx->Shared->DefaultTex[TEXTURE_CUBE_INDEX]); - _mesa_reference_texobj(&texUnit->CurrentRect, - ctx->Shared->DefaultTex[TEXTURE_RECT_INDEX]); - _mesa_reference_texobj(&texUnit->Current1DArray, - ctx->Shared->DefaultTex[TEXTURE_1D_ARRAY_INDEX]); - _mesa_reference_texobj(&texUnit->Current2DArray, - ctx->Shared->DefaultTex[TEXTURE_2D_ARRAY_INDEX]); + for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) { + _mesa_reference_texobj(&texUnit->CurrentTex[tex], + ctx->Shared->DefaultTex[tex]); + } } } diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index 63a36324d4..fcf76ef82e 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -429,7 +429,7 @@ st_bind_teximage(struct st_framebuffer *stfb, uint surfIndex, } if (target == ST_TEXTURE_2D) { - texObj = texUnit->Current2D; + texObj = texUnit->CurrentTex[TEXTURE_2D_INDEX]; texImage = _mesa_get_tex_image(ctx, texObj, GL_TEXTURE_2D, level); stImage = st_texture_image(texImage); } diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 0598052f50..ab08b7325a 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -132,7 +132,8 @@ _swrast_culltriangle( GLcontext *ctx, #define SETUP_CODE \ struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; \ - struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \ + struct gl_texture_object *obj = \ + ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \ const GLint b = obj->BaseLevel; \ const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ @@ -183,7 +184,8 @@ _swrast_culltriangle( GLcontext *ctx, #define SETUP_CODE \ struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; \ - struct gl_texture_object *obj = ctx->Texture.Unit[0].Current2D; \ + struct gl_texture_object *obj = \ + ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \ const GLint b = obj->BaseLevel; \ const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ @@ -524,7 +526,8 @@ affine_span(GLcontext *ctx, SWspan *span, #define SETUP_CODE \ struct affine_info info; \ struct gl_texture_unit *unit = ctx->Texture.Unit+0; \ - struct gl_texture_object *obj = unit->Current2D; \ + struct gl_texture_object *obj = \ + ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \ const GLint b = obj->BaseLevel; \ const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ @@ -794,7 +797,8 @@ fast_persp_span(GLcontext *ctx, SWspan *span, #define SETUP_CODE \ struct persp_info info; \ const struct gl_texture_unit *unit = ctx->Texture.Unit+0; \ - const struct gl_texture_object *obj = unit->Current2D; \ + struct gl_texture_object *obj = \ + ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \ const GLint b = obj->BaseLevel; \ info.texture = (const GLchan *) obj->Image[0][b]->Data; \ info.twidth_log2 = obj->Image[0][b]->WidthLog2; \ @@ -1050,7 +1054,8 @@ _swrast_choose_triangle( GLcontext *ctx ) const struct gl_texture_image *texImg; GLenum minFilter, magFilter, envMode; GLint format; - texObj2D = ctx->Texture.Unit[0].Current2D; + texObj2D = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; + texImg = texObj2D ? texObj2D->Image[0][texObj2D->BaseLevel] : NULL; format = texImg ? texImg->TexFormat->MesaFormat : -1; minFilter = texObj2D ? texObj2D->MinFilter : (GLenum) 0; -- cgit v1.2.3 From f2c023291a1f2887294d2aac504f8b82857ad092 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 22 Feb 2009 15:43:29 -0700 Subject: mesa: move a bunch of compiler-related stuff into new compiler.h header This trims down and cleans up imports.h and glheader.h quite a bit. --- src/mesa/drivers/x11/glxapi.c | 1 + src/mesa/glapi/gl_enums.py | 3 +- src/mesa/glapi/glapi.c | 2 + src/mesa/glapi/glapi_getproc.c | 1 + src/mesa/glapi/glthread.c | 2 +- src/mesa/main/api_exec.c | 2 +- src/mesa/main/compiler.h | 479 +++++++++++++++++++++++++++++++++ src/mesa/main/config.h | 5 +- src/mesa/main/context.c | 1 + src/mesa/main/dispatch.c | 1 + src/mesa/main/dlist.c | 1 + src/mesa/main/enums.c | 3 +- src/mesa/main/glheader.h | 265 +----------------- src/mesa/main/imports.h | 171 +----------- src/mesa/main/mtypes.h | 16 +- src/mesa/main/texobj.c | 2 +- src/mesa/main/texstate.c | 1 + src/mesa/state_tracker/st_cb_texture.c | 3 +- 18 files changed, 515 insertions(+), 444 deletions(-) create mode 100644 src/mesa/main/compiler.h (limited to 'src/mesa/main/texobj.c') diff --git a/src/mesa/drivers/x11/glxapi.c b/src/mesa/drivers/x11/glxapi.c index c2ccce6f52..19aca605bc 100644 --- a/src/mesa/drivers/x11/glxapi.c +++ b/src/mesa/drivers/x11/glxapi.c @@ -35,6 +35,7 @@ #include #include #include "main/glheader.h" +#include "main/compiler.h" #include "glapi/glapi.h" #include "glxapi.h" diff --git a/src/mesa/glapi/gl_enums.py b/src/mesa/glapi/gl_enums.py index 67fec7968a..b32e012663 100644 --- a/src/mesa/glapi/gl_enums.py +++ b/src/mesa/glapi/gl_enums.py @@ -43,6 +43,7 @@ class PrintGlEnums(gl_XML.gl_print_base): def printRealHeader(self): print '#include "glheader.h"' + print '#include "mfeatures.h"' print '#include "enums.h"' print '#include "imports.h"' print '' @@ -55,8 +56,6 @@ class PrintGlEnums(gl_XML.gl_print_base): def print_code(self): print """ -#define Elements(x) sizeof(x)/sizeof(*x) - typedef int (*cfunc)(const void *, const void *); /** diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c index 9b5144a88b..e20618abc1 100644 --- a/src/mesa/glapi/glapi.c +++ b/src/mesa/glapi/glapi.c @@ -61,6 +61,8 @@ #endif +#include "main/compiler.h" + #include #include #ifdef DEBUG diff --git a/src/mesa/glapi/glapi_getproc.c b/src/mesa/glapi/glapi_getproc.c index 1238c4cf93..4adc1aece0 100644 --- a/src/mesa/glapi/glapi_getproc.c +++ b/src/mesa/glapi/glapi_getproc.c @@ -33,6 +33,7 @@ #include #include #include "main/glheader.h" +#include "main/compiler.h" #include "glapi.h" #include "glapioffsets.h" #include "glapitable.h" diff --git a/src/mesa/glapi/glthread.c b/src/mesa/glapi/glthread.c index 56ddf7c25a..e3abb0f4ae 100644 --- a/src/mesa/glapi/glthread.c +++ b/src/mesa/glapi/glthread.c @@ -32,7 +32,7 @@ #include #endif -#include "main/glheader.h" +#include "main/compiler.h" #include "glthread.h" diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index f8ee0d59dd..c2c29c4f3d 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -29,7 +29,7 @@ */ -#include "glheader.h" +#include "mfeatures.h" #if FEATURE_accum #include "accum.h" #endif diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h new file mode 100644 index 0000000000..39b19bb776 --- /dev/null +++ b/src/mesa/main/compiler.h @@ -0,0 +1,479 @@ +/* + * Mesa 3-D graphics library + * Version: 7.5 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. 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 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 + * BRIAN PAUL 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. + */ + + +/** + * \file compiler.h + * Compiler-related stuff. + */ + + +#ifndef COMPILER_H +#define COMPILER_H + + +#include +#include +#if defined(__alpha__) && defined(CCPML) +#include /* use Compaq's Fast Math Library on Alpha */ +#else +#include +#endif +#include +#include +#include +#include +#if defined(__linux__) && defined(__i386__) +#include +#endif +#include +#include + + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * Get standard integer types + */ +#if defined(_MSC_VER) + typedef __int8 int8_t; + typedef unsigned __int8 uint8_t; + typedef __int16 int16_t; + typedef unsigned __int16 uint16_t; +# ifndef __eglplatform_h_ + typedef __int32 int32_t; +# endif + typedef unsigned __int32 uint32_t; + typedef __int64 int64_t; + typedef unsigned __int64 uint64_t; + +# if defined(_WIN64) + typedef __int64 intptr_t; + typedef unsigned __int64 uintptr_t; +# else + typedef __int32 intptr_t; + typedef unsigned __int32 uintptr_t; +# endif + +# define INT64_C(__val) __val##i64 +# define UINT64_C(__val) __val##ui64 +#else +# include +#endif + + +/** + * Sun compilers define __i386 instead of the gcc-style __i386__ + */ +#ifdef __SUNPRO_C +# if !defined(__i386__) && defined(__i386) +# define __i386__ +# elif !defined(__amd64__) && defined(__amd64) +# define __amd64__ +# elif !defined(__sparc__) && defined(__sparc) +# define __sparc__ +# endif +# if !defined(__volatile) +# define __volatile volatile +# endif +#endif + + +/** + * finite macro. + */ +#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP) +# define __WIN32__ +# define finite _finite +#endif +#if defined(__WATCOMC__) +# define finite _finite +# pragma disable_message(201) /* Disable unreachable code warnings */ +#endif + + +/** + * Disable assorted warnings + */ +#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP) +# if !defined(__GNUC__) /* mingw environment */ +# pragma warning( disable : 4068 ) /* unknown pragma */ +# pragma warning( disable : 4710 ) /* function 'foo' not inlined */ +# pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */ +# pragma warning( disable : 4127 ) /* conditional expression is constant */ +# if defined(MESA_MINWARN) +# pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */ +# pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */ +# pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */ +# pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */ +# pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */ +# endif +# endif +#endif + + +/** + * Function inlining + */ +#if defined(__GNUC__) +# define INLINE __inline__ +#elif defined(__MSC__) +# define INLINE __inline +#elif defined(_MSC_VER) +# define INLINE __inline +#elif defined(__ICL) +# define INLINE __inline +#elif defined(__INTEL_COMPILER) +# define INLINE inline +#elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100) +# define INLINE __inline +#elif defined(__SUNPRO_C) && defined(__C99FEATURES__) +# define INLINE inline +# define __inline inline +# define __inline__ inline +#elif (__STDC_VERSION__ >= 199901L) /* C99 */ +# define INLINE inline +#else +# define INLINE +#endif + + +/** + * PUBLIC/USED macros + * + * If we build the library with gcc's -fvisibility=hidden flag, we'll + * use the PUBLIC macro to mark functions that are to be exported. + * + * We also need to define a USED attribute, so the optimizer doesn't + * inline a static function that we later use in an alias. - ajax + */ +#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303 +# define PUBLIC __attribute__((visibility("default"))) +# define USED __attribute__((used)) +#else +# define PUBLIC +# define USED +#endif + + +/** + * Some compilers don't like some of Mesa's const usage. In those places use + * CONST instead of const. Pass -DNO_CONST to compilers where this matters. + */ +#ifdef NO_CONST +# define CONST +#else +# define CONST const +#endif + + +/** + * __builtin_expect macros + */ +#if (!defined(__GNUC__) || __GNUC__ < 3) && (!defined(__IBMC__) || __IBMC__ < 900) +# define __builtin_expect(x, y) x +#endif + + +/** + * The __FUNCTION__ gcc variable is generally only used for debugging. + * If we're not using gcc, define __FUNCTION__ as a cpp symbol here. + * Don't define it if using a newer Windows compiler. + */ +#ifndef __FUNCTION__ +# if defined(__VMS) +# define __FUNCTION__ "VMS$NL:" +# elif ((!defined __GNUC__) || (__GNUC__ < 2)) && (!defined __xlC__) && \ + (!defined(_MSC_VER) || _MSC_VER < 1300) +# if (__STDC_VERSION__ >= 199901L) /* C99 */ || \ + (defined(__SUNPRO_C) && defined(__C99FEATURES__)) +# define __FUNCTION__ __func__ +# else +# define __FUNCTION__ "" +# endif +# endif +#endif + + +/** + * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN. + * Do not use them unless absolutely necessary! + * Try to use a runtime test instead. + * For now, only used by some DRI hardware drivers for color/texel packing. + */ +#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN +#if defined(__linux__) +#include +#define CPU_TO_LE32( x ) bswap_32( x ) +#else /*__linux__*/ +#include +#define CPU_TO_LE32( x ) bswap32( x ) +#endif /*__linux__*/ +#define MESA_BIG_ENDIAN 1 +#else +#define CPU_TO_LE32( x ) ( x ) +#define MESA_LITTLE_ENDIAN 1 +#endif +#define LE32_TO_CPU( x ) CPU_TO_LE32( x ) + + + +#if !defined(CAPI) && defined(WIN32) && !defined(BUILD_FOR_SNAP) +#define CAPI _cdecl +#endif + + +/** + * Create a macro so that asm functions can be linked into compilers other + * than GNU C + */ +#ifndef _ASMAPI +#if defined(WIN32) && !defined(BUILD_FOR_SNAP)/* was: !defined( __GNUC__ ) && !defined( VMS ) && !defined( __INTEL_COMPILER )*/ +#define _ASMAPI __cdecl +#else +#define _ASMAPI +#endif +#ifdef PTR_DECL_IN_FRONT +#define _ASMAPIP * _ASMAPI +#else +#define _ASMAPIP _ASMAPI * +#endif +#endif + +#ifdef USE_X86_ASM +#define _NORMAPI _ASMAPI +#define _NORMAPIP _ASMAPIP +#else +#define _NORMAPI +#define _NORMAPIP * +#endif + + +/* This is a macro on IRIX */ +#ifdef _P +#undef _P +#endif + + +/* Turn off macro checking systems used by other libraries */ +#ifdef CHECK +#undef CHECK +#endif + + +/** + * ASSERT macro + */ +#if !defined(_WIN32_WCE) +#if defined(BUILD_FOR_SNAP) && defined(CHECKED) +# define ASSERT(X) _CHECK(X) +#elif defined(DEBUG) +# define ASSERT(X) assert(X) +#else +# define ASSERT(X) +#endif +#endif + + +#ifndef NULL +#define NULL 0 +#endif + + +/** + * LONGSTRING macro + * gcc -pedantic warns about long string literals, LONGSTRING silences that. + */ +#if !defined(__GNUC__) || (__GNUC__ < 2) || \ + ((__GNUC__ == 2) && (__GNUC_MINOR__ <= 7)) +# define LONGSTRING +#else +# define LONGSTRING __extension__ +#endif + + +#ifndef M_PI +#define M_PI (3.1415926536) +#endif + +#ifndef M_E +#define M_E (2.7182818284590452354) +#endif + +#ifndef ONE_DIV_LN2 +#define ONE_DIV_LN2 (1.442695040888963456) +#endif + +#ifndef ONE_DIV_SQRT_LN2 +#define ONE_DIV_SQRT_LN2 (1.201122408786449815) +#endif + +#ifndef FLT_MAX_EXP +#define FLT_MAX_EXP 128 +#endif + + +/** + * USE_IEEE: Determine if we're using IEEE floating point + */ +#if defined(__i386__) || defined(__386__) || defined(__sparc__) || \ + defined(__s390x__) || defined(__powerpc__) || \ + defined(__x86_64__) || \ + defined(ia64) || defined(__ia64__) || \ + defined(__hppa__) || defined(hpux) || \ + defined(__mips) || defined(_MIPS_ARCH) || \ + defined(__arm__) || \ + defined(__sh__) || defined(__m32r__) || \ + (defined(__sun) && defined(_IEEE_754)) || \ + (defined(__alpha__) && (defined(__IEEE_FLOAT) || !defined(VMS))) +#define USE_IEEE +#define IEEE_ONE 0x3f800000 +#endif + + +/** + * START/END_FAST_MATH macros: + * + * START_FAST_MATH: Set x86 FPU to faster, 32-bit precision mode (and save + * original mode to a temporary). + * END_FAST_MATH: Restore x86 FPU to original mode. + */ +#if defined(__GNUC__) && defined(__i386__) +/* + * Set the x86 FPU control word to guarentee only 32 bits of precision + * are stored in registers. Allowing the FPU to store more introduces + * differences between situations where numbers are pulled out of memory + * vs. situations where the compiler is able to optimize register usage. + * + * In the worst case, we force the compiler to use a memory access to + * truncate the float, by specifying the 'volatile' keyword. + */ +/* Hardware default: All exceptions masked, extended double precision, + * round to nearest (IEEE compliant): + */ +#define DEFAULT_X86_FPU 0x037f +/* All exceptions masked, single precision, round to nearest: + */ +#define FAST_X86_FPU 0x003f +/* The fldcw instruction will cause any pending FP exceptions to be + * raised prior to entering the block, and we clear any pending + * exceptions before exiting the block. Hence, asm code has free + * reign over the FPU while in the fast math block. + */ +#if defined(NO_FAST_MATH) +#define START_FAST_MATH(x) \ +do { \ + static GLuint mask = DEFAULT_X86_FPU; \ + __asm__ ( "fnstcw %0" : "=m" (*&(x)) ); \ + __asm__ ( "fldcw %0" : : "m" (mask) ); \ +} while (0) +#else +#define START_FAST_MATH(x) \ +do { \ + static GLuint mask = FAST_X86_FPU; \ + __asm__ ( "fnstcw %0" : "=m" (*&(x)) ); \ + __asm__ ( "fldcw %0" : : "m" (mask) ); \ +} while (0) +#endif +/* Restore original FPU mode, and clear any exceptions that may have + * occurred in the FAST_MATH block. + */ +#define END_FAST_MATH(x) \ +do { \ + __asm__ ( "fnclex ; fldcw %0" : : "m" (*&(x)) ); \ +} while (0) + +#elif defined(__WATCOMC__) && defined(__386__) +#define DEFAULT_X86_FPU 0x037f /* See GCC comments above */ +#define FAST_X86_FPU 0x003f /* See GCC comments above */ +void _watcom_start_fast_math(unsigned short *x,unsigned short *mask); +#pragma aux _watcom_start_fast_math = \ + "fnstcw word ptr [eax]" \ + "fldcw word ptr [ecx]" \ + parm [eax] [ecx] \ + modify exact []; +void _watcom_end_fast_math(unsigned short *x); +#pragma aux _watcom_end_fast_math = \ + "fnclex" \ + "fldcw word ptr [eax]" \ + parm [eax] \ + modify exact []; +#if defined(NO_FAST_MATH) +#define START_FAST_MATH(x) \ +do { \ + static GLushort mask = DEFAULT_X86_FPU; \ + _watcom_start_fast_math(&x,&mask); \ +} while (0) +#else +#define START_FAST_MATH(x) \ +do { \ + static GLushort mask = FAST_X86_FPU; \ + _watcom_start_fast_math(&x,&mask); \ +} while (0) +#endif +#define END_FAST_MATH(x) _watcom_end_fast_math(&x) + +#elif defined(_MSC_VER) && defined(_M_IX86) +#define DEFAULT_X86_FPU 0x037f /* See GCC comments above */ +#define FAST_X86_FPU 0x003f /* See GCC comments above */ +#if defined(NO_FAST_MATH) +#define START_FAST_MATH(x) do {\ + static GLuint mask = DEFAULT_X86_FPU;\ + __asm fnstcw word ptr [x]\ + __asm fldcw word ptr [mask]\ +} while(0) +#else +#define START_FAST_MATH(x) do {\ + static GLuint mask = FAST_X86_FPU;\ + __asm fnstcw word ptr [x]\ + __asm fldcw word ptr [mask]\ +} while(0) +#endif +#define END_FAST_MATH(x) do {\ + __asm fnclex\ + __asm fldcw word ptr [x]\ +} while(0) + +#else +#define START_FAST_MATH(x) x = 0 +#define END_FAST_MATH(x) (void)(x) +#endif + + + +#define Elements(x) (sizeof(x)/sizeof(*(x))) + + + + +#ifdef __cplusplus +} +#endif + + +#endif /* COMPILER_H */ diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 7044b61e4a..bb3e980bfa 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.3 + * Version: 7.5 * * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. * Copyright (C) 2008 VMware, Inc. All Rights Reserved. @@ -32,9 +32,6 @@ #define MESA_CONFIG_H_INCLUDED -#include "main/mfeatures.h" - - /** * \name OpenGL implementation limits */ diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 75b3992a29..a94bbf3fdf 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -77,6 +77,7 @@ #include "glheader.h" +#include "mfeatures.h" #include "imports.h" #if FEATURE_accum #include "accum.h" diff --git a/src/mesa/main/dispatch.c b/src/mesa/main/dispatch.c index 34127cb248..bf1a013789 100644 --- a/src/mesa/main/dispatch.c +++ b/src/mesa/main/dispatch.c @@ -40,6 +40,7 @@ #ifndef GLX_USE_APPLEGL #include "main/glheader.h" +#include "main/compiler.h" #include "glapi/glapi.h" #include "glapi/glapitable.h" #include "glapi/glthread.h" diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 76b3315034..d4bd56be83 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -33,6 +33,7 @@ #include "api_arrayelt.h" #include "api_loopback.h" #include "config.h" +#include "mfeatures.h" #include "attrib.h" #include "blend.h" #include "buffers.h" diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c index a864f5a070..ca5db92265 100644 --- a/src/mesa/main/enums.c +++ b/src/mesa/main/enums.c @@ -26,6 +26,7 @@ */ #include "glheader.h" +#include "mfeatures.h" #include "enums.h" #include "imports.h" @@ -4973,8 +4974,6 @@ static const unsigned reduced_enums[1308] = 30, /* GL_ALL_CLIENT_ATTRIB_BITS */ }; -#define Elements(x) sizeof(x)/sizeof(*x) - typedef int (*cfunc)(const void *, const void *); /** diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index 5657976711..482a36de93 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -1,28 +1,8 @@ -/** - * \file glheader.h - * Top-most include file. - * - * This is the top-most include file of the Mesa sources. - * It includes gl.h and all system headers which are needed. - * Other Mesa source files should \e not directly include any system - * headers. This allows system-dependent hacks/workarounds to be - * collected in one place. - * - * \note Actually, a lot of system-dependent stuff is now in imports.[ch]. - * - * If you touch this file, everything gets recompiled! - * - * This file should be included before any other header in the .c files. - * - * Put compiler/OS/assembly pragmas and macros here to avoid - * cluttering other source files. - */ - /* * Mesa 3-D graphics library - * Version: 6.5 + * Version: 7.5 * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 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"), @@ -43,99 +23,22 @@ */ -#ifndef GLHEADER_H -#define GLHEADER_H - -#include -#include -#if defined(__alpha__) && defined(CCPML) -#include /* use Compaq's Fast Math Library on Alpha */ -#else -#include -#endif -#include -#include -#include -#include -#if defined(__linux__) && defined(__i386__) -#include -#endif -#include -#include - - -/* Get standard integer types */ -#if defined(_MSC_VER) - - typedef __int8 int8_t; - typedef unsigned __int8 uint8_t; - typedef __int16 int16_t; - typedef unsigned __int16 uint16_t; -# ifndef __eglplatform_h_ - typedef __int32 int32_t; -# endif - typedef unsigned __int32 uint32_t; - typedef __int64 int64_t; - typedef unsigned __int64 uint64_t; - -# if defined(_WIN64) - typedef __int64 intptr_t; - typedef unsigned __int64 uintptr_t; -# else - typedef __int32 intptr_t; - typedef unsigned __int32 uintptr_t; -# endif - -# define INT64_C(__val) __val##i64 -# define UINT64_C(__val) __val##ui64 - -#else -# include -#endif - +/** + * \file glheader.h + * Wrapper for GL/gl.h and GL/glext.h + */ -/* Sun compilers define __i386 instead of the gcc-style __i386__ */ -#ifdef __SUNPRO_C -# if !defined(__i386__) && defined(__i386) -# define __i386__ -# elif !defined(__amd64__) && defined(__amd64) -# define __amd64__ -# elif !defined(__sparc__) && defined(__sparc) -# define __sparc__ -# endif -# if !defined(__volatile) -# define __volatile volatile -# endif -#endif -#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP) -# define __WIN32__ -# define finite _finite -#endif +#ifndef GLHEADER_H +#define GLHEADER_H -#if defined(__WATCOMC__) -# define finite _finite -# pragma disable_message(201) /* Disable unreachable code warnings */ -#endif #ifdef WGLAPI -# undef WGLAPI +#undef WGLAPI #endif + #if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP) -# if !defined(__GNUC__) /* mingw environment */ -# pragma warning( disable : 4068 ) /* unknown pragma */ -# pragma warning( disable : 4710 ) /* function 'foo' not inlined */ -# pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */ -# pragma warning( disable : 4127 ) /* conditional expression is constant */ -# if defined(MESA_MINWARN) -# pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */ -# pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */ -# pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */ -# pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */ -# pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */ -# endif -# endif # if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */ # define WGLAPI __declspec(dllexport) # elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ @@ -146,31 +49,10 @@ #endif /* WIN32 / CYGWIN bracket */ -/* - * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN. - * Do not use them unless absolutely necessary! - * Try to use a runtime test instead. - * For now, only used by some DRI hardware drivers for color/texel packing. - */ -#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN -#if defined(__linux__) -#include -#define CPU_TO_LE32( x ) bswap_32( x ) -#else /*__linux__*/ -#include -#define CPU_TO_LE32( x ) bswap32( x ) -#endif /*__linux__*/ -#define MESA_BIG_ENDIAN 1 -#else -#define CPU_TO_LE32( x ) ( x ) -#define MESA_LITTLE_ENDIAN 1 -#endif -#define LE32_TO_CPU( x ) CPU_TO_LE32( x ) - - #define GL_GLEXT_PROTOTYPES #include "GL/gl.h" #include "GL/glext.h" +#include #ifndef GL_FIXED @@ -192,129 +74,10 @@ #endif -#if !defined(CAPI) && defined(WIN32) && !defined(BUILD_FOR_SNAP) -#define CAPI _cdecl -#endif - - -/* This is a macro on IRIX */ -#ifdef _P -#undef _P -#endif - - -/* Turn off macro checking systems used by other libraries */ -#ifdef CHECK -#undef CHECK -#endif - - -/* Create a macro so that asm functions can be linked into compilers other - * than GNU C - */ -#ifndef _ASMAPI -#if defined(WIN32) && !defined(BUILD_FOR_SNAP)/* was: !defined( __GNUC__ ) && !defined( VMS ) && !defined( __INTEL_COMPILER )*/ -#define _ASMAPI __cdecl -#else -#define _ASMAPI -#endif -#ifdef PTR_DECL_IN_FRONT -#define _ASMAPIP * _ASMAPI -#else -#define _ASMAPIP _ASMAPI * -#endif -#endif - -#ifdef USE_X86_ASM -#define _NORMAPI _ASMAPI -#define _NORMAPIP _ASMAPIP -#else -#define _NORMAPI -#define _NORMAPIP * -#endif - - -/* Function inlining */ -#if defined(__GNUC__) -# define INLINE __inline__ -#elif defined(__MSC__) -# define INLINE __inline -#elif defined(_MSC_VER) -# define INLINE __inline -#elif defined(__ICL) -# define INLINE __inline -#elif defined(__INTEL_COMPILER) -# define INLINE inline -#elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100) -# define INLINE __inline -#elif defined(__SUNPRO_C) && defined(__C99FEATURES__) -# define INLINE inline -# define __inline inline -# define __inline__ inline -#elif (__STDC_VERSION__ >= 199901L) /* C99 */ -# define INLINE inline -#else -# define INLINE -#endif - - -/* If we build the library with gcc's -fvisibility=hidden flag, we'll - * use the PUBLIC macro to mark functions that are to be exported. - * - * We also need to define a USED attribute, so the optimizer doesn't - * inline a static function that we later use in an alias. - ajax - */ -#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303 -# define PUBLIC __attribute__((visibility("default"))) -# define USED __attribute__((used)) -#else -# define PUBLIC -# define USED -#endif - - -/* Some compilers don't like some of Mesa's const usage */ -#ifdef NO_CONST -# define CONST -#else -# define CONST const -#endif - - -#if !defined(_WIN32_WCE) -#if defined(BUILD_FOR_SNAP) && defined(CHECKED) -# define ASSERT(X) _CHECK(X) -#elif defined(DEBUG) -# define ASSERT(X) assert(X) -#else -# define ASSERT(X) -#endif -#endif - - -#if (!defined(__GNUC__) || __GNUC__ < 3) && (!defined(__IBMC__) || __IBMC__ < 900) -# define __builtin_expect(x, y) x -#endif - -/* The __FUNCTION__ gcc variable is generally only used for debugging. - * If we're not using gcc, define __FUNCTION__ as a cpp symbol here. - * Don't define it if using a newer Windows compiler. +/** + * Special, internal token */ -#ifndef __FUNCTION__ -# if defined(__VMS) -# define __FUNCTION__ "VMS$NL:" -# elif ((!defined __GNUC__) || (__GNUC__ < 2)) && (!defined __xlC__) && \ - (!defined(_MSC_VER) || _MSC_VER < 1300) -# if (__STDC_VERSION__ >= 199901L) /* C99 */ || \ - (defined(__SUNPRO_C) && defined(__C99FEATURES__)) -# define __FUNCTION__ __func__ -# else -# define __FUNCTION__ "" -# endif -# endif -#endif - +#define GL_SHADER_PROGRAM_MESA 0x9999 -#include "config.h" #endif /* GLHEADER_H */ diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index a421eb5e75..d28860f170 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.1 + * Version: 7.5 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * @@ -36,10 +36,8 @@ #define IMPORTS_H -/* XXX some of the stuff in glheader.h should be moved into this file. - */ +#include "compiler.h" #include "glheader.h" -#include #ifdef __cplusplus @@ -47,26 +45,6 @@ extern "C" { #endif -/**********************************************************************/ -/** \name General macros */ -/*@{*/ - -#ifndef NULL -#define NULL 0 -#endif - - -/** gcc -pedantic warns about long string literals, LONGSTRING silences that */ -#if !defined(__GNUC__) || (__GNUC__ < 2) || \ - ((__GNUC__ == 2) && (__GNUC_MINOR__ <= 7)) -# define LONGSTRING -#else -# define LONGSTRING __extension__ -#endif - -/*@}*/ - - /**********************************************************************/ /** Memory macros */ /*@{*/ @@ -130,48 +108,10 @@ typedef union { GLfloat f; GLint i; } fi_type; #define MAX_GLUSHORT 0xffff #define MAX_GLUINT 0xffffffff -#ifndef M_PI -#define M_PI (3.1415926536) -#endif - -#ifndef M_E -#define M_E (2.7182818284590452354) -#endif - -#ifndef ONE_DIV_LN2 -#define ONE_DIV_LN2 (1.442695040888963456) -#endif - -#ifndef ONE_DIV_SQRT_LN2 -#define ONE_DIV_SQRT_LN2 (1.201122408786449815) -#endif - -#ifndef FLT_MAX_EXP -#define FLT_MAX_EXP 128 -#endif - /* Degrees to radians conversion: */ #define DEG2RAD (M_PI/180.0) -/*** - *** USE_IEEE: Determine if we're using IEEE floating point - ***/ -#if defined(__i386__) || defined(__386__) || defined(__sparc__) || \ - defined(__s390x__) || defined(__powerpc__) || \ - defined(__x86_64__) || \ - defined(ia64) || defined(__ia64__) || \ - defined(__hppa__) || defined(hpux) || \ - defined(__mips) || defined(_MIPS_ARCH) || \ - defined(__arm__) || \ - defined(__sh__) || defined(__m32r__) || \ - (defined(__sun) && defined(_IEEE_754)) || \ - (defined(__alpha__) && (defined(__IEEE_FLOAT) || !defined(VMS))) -#define USE_IEEE -#define IEEE_ONE 0x3f800000 -#endif - - /*** *** SQRTF: single-precision square root ***/ @@ -508,113 +448,6 @@ _mesa_is_pow_two(int x) #endif -/*** - *** START_FAST_MATH: Set x86 FPU to faster, 32-bit precision mode (and save - *** original mode to a temporary). - *** END_FAST_MATH: Restore x86 FPU to original mode. - ***/ -#if defined(__GNUC__) && defined(__i386__) -/* - * Set the x86 FPU control word to guarentee only 32 bits of precision - * are stored in registers. Allowing the FPU to store more introduces - * differences between situations where numbers are pulled out of memory - * vs. situations where the compiler is able to optimize register usage. - * - * In the worst case, we force the compiler to use a memory access to - * truncate the float, by specifying the 'volatile' keyword. - */ -/* Hardware default: All exceptions masked, extended double precision, - * round to nearest (IEEE compliant): - */ -#define DEFAULT_X86_FPU 0x037f -/* All exceptions masked, single precision, round to nearest: - */ -#define FAST_X86_FPU 0x003f -/* The fldcw instruction will cause any pending FP exceptions to be - * raised prior to entering the block, and we clear any pending - * exceptions before exiting the block. Hence, asm code has free - * reign over the FPU while in the fast math block. - */ -#if defined(NO_FAST_MATH) -#define START_FAST_MATH(x) \ -do { \ - static GLuint mask = DEFAULT_X86_FPU; \ - __asm__ ( "fnstcw %0" : "=m" (*&(x)) ); \ - __asm__ ( "fldcw %0" : : "m" (mask) ); \ -} while (0) -#else -#define START_FAST_MATH(x) \ -do { \ - static GLuint mask = FAST_X86_FPU; \ - __asm__ ( "fnstcw %0" : "=m" (*&(x)) ); \ - __asm__ ( "fldcw %0" : : "m" (mask) ); \ -} while (0) -#endif -/* Restore original FPU mode, and clear any exceptions that may have - * occurred in the FAST_MATH block. - */ -#define END_FAST_MATH(x) \ -do { \ - __asm__ ( "fnclex ; fldcw %0" : : "m" (*&(x)) ); \ -} while (0) - -#elif defined(__WATCOMC__) && defined(__386__) -#define DEFAULT_X86_FPU 0x037f /* See GCC comments above */ -#define FAST_X86_FPU 0x003f /* See GCC comments above */ -void _watcom_start_fast_math(unsigned short *x,unsigned short *mask); -#pragma aux _watcom_start_fast_math = \ - "fnstcw word ptr [eax]" \ - "fldcw word ptr [ecx]" \ - parm [eax] [ecx] \ - modify exact []; -void _watcom_end_fast_math(unsigned short *x); -#pragma aux _watcom_end_fast_math = \ - "fnclex" \ - "fldcw word ptr [eax]" \ - parm [eax] \ - modify exact []; -#if defined(NO_FAST_MATH) -#define START_FAST_MATH(x) \ -do { \ - static GLushort mask = DEFAULT_X86_FPU; \ - _watcom_start_fast_math(&x,&mask); \ -} while (0) -#else -#define START_FAST_MATH(x) \ -do { \ - static GLushort mask = FAST_X86_FPU; \ - _watcom_start_fast_math(&x,&mask); \ -} while (0) -#endif -#define END_FAST_MATH(x) _watcom_end_fast_math(&x) - -#elif defined(_MSC_VER) && defined(_M_IX86) -#define DEFAULT_X86_FPU 0x037f /* See GCC comments above */ -#define FAST_X86_FPU 0x003f /* See GCC comments above */ -#if defined(NO_FAST_MATH) -#define START_FAST_MATH(x) do {\ - static GLuint mask = DEFAULT_X86_FPU;\ - __asm fnstcw word ptr [x]\ - __asm fldcw word ptr [mask]\ -} while(0) -#else -#define START_FAST_MATH(x) do {\ - static GLuint mask = FAST_X86_FPU;\ - __asm fnstcw word ptr [x]\ - __asm fldcw word ptr [mask]\ -} while(0) -#endif -#define END_FAST_MATH(x) do {\ - __asm fnclex\ - __asm fldcw word ptr [x]\ -} while(0) - -#else -#define START_FAST_MATH(x) x = 0 -#define END_FAST_MATH(x) (void)(x) -#endif - - /** * Return 1 if this is a little endian machine, 0 if big endian. */ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 73dccf7817..3390fac250 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -34,20 +34,16 @@ #define TYPES_H -#include "glheader.h" +#include "main/glheader.h" +#include "main/config.h" +#include "main/compiler.h" +#include "main/mfeatures.h" #include /* __GLcontextModes (GLvisual) */ -#include "config.h" /* Hardwired parameters */ #include "glapi/glapi.h" #include "math/m_matrix.h" /* GLmatrix */ #include "bitset.h" -/** - * Special, internal token - */ -#define GL_SHADER_PROGRAM_MESA 0x9999 - - /** * Color channel data type. */ @@ -126,7 +122,6 @@ struct gl_texture_format; struct gl_texture_image; struct gl_texture_object; struct st_context; -struct pipe_surface; typedef struct __GLcontextRec GLcontext; typedef struct __GLcontextModesRec GLvisual; typedef struct gl_framebuffer GLframebuffer; @@ -3166,7 +3161,4 @@ enum _debug -#define Elements(x) sizeof(x)/sizeof(*(x)) - - #endif /* TYPES_H */ diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 2de2dcc95d..9ccb8fa100 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -28,7 +28,7 @@ */ -#include "glheader.h" +#include "mfeatures.h" #if FEATURE_colortable #include "colortab.h" #endif diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 1719effdee..3e6b09baa1 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -29,6 +29,7 @@ */ #include "glheader.h" +#include "mfeatures.h" #include "colormac.h" #if FEATURE_colortable #include "colortab.h" diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 0ece8f9514..3039eb2a87 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -25,12 +25,13 @@ * **************************************************************************/ -#include "main/imports.h" +#include "main/mfeatures.h" #if FEATURE_convolve #include "main/convolve.h" #endif #include "main/enums.h" #include "main/image.h" +#include "main/imports.h" #include "main/macros.h" #include "main/mipmap.h" #include "main/pixel.h" -- cgit v1.2.3 From 1eee1bac1f6d911e6124daafc9b9291666d91cef Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 17 Mar 2009 09:34:30 -0600 Subject: mesa: update/fix doxygen comments --- src/mesa/glapi/glapi_getproc.c | 2 +- src/mesa/main/context.c | 4 ++-- src/mesa/main/dlist.c | 2 +- src/mesa/main/execmem.c | 2 +- src/mesa/main/feedback.c | 4 ++-- src/mesa/main/imports.c | 2 +- src/mesa/main/mipmap.c | 2 +- src/mesa/main/shared.c | 2 +- src/mesa/main/teximage.c | 7 +++---- src/mesa/main/texobj.c | 2 +- src/mesa/shader/prog_parameter.c | 2 +- src/mesa/shader/prog_print.c | 2 +- 12 files changed, 16 insertions(+), 17 deletions(-) (limited to 'src/mesa/main/texobj.c') diff --git a/src/mesa/glapi/glapi_getproc.c b/src/mesa/glapi/glapi_getproc.c index 764e2ef98e..ed443c12c8 100644 --- a/src/mesa/glapi/glapi_getproc.c +++ b/src/mesa/glapi/glapi_getproc.c @@ -23,7 +23,7 @@ */ /** - * \file glapi_getproc. + * \file glapi_getproc.c * * Code for implementing glXGetProcAddress(), etc. * This was originally in glapi.c but refactored out. diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 84bf0205a8..b24a3b4409 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -179,7 +179,7 @@ GLfloat _mesa_ubyte_to_float_color_tab[256]; /** * Swap buffers notification callback. * - * \param gc GL context. + * \param ctx GL context. * * Called by window system just before swapping buffers. * We have to finish any pending rendering. @@ -923,7 +923,7 @@ _mesa_initialize_context(GLcontext *ctx, * \param share_list another context to share display lists with or NULL * \param driverFunctions points to the dd_function_table into which the * driver has plugged in all its special functions. - * \param driverCtx points to the device driver's private context state + * \param driverContext points to the device driver's private context state * * \return pointer to a new __GLcontextRec or NULL if error. */ diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index ebcef0268a..8f7f703da9 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -707,7 +707,7 @@ unpack_image(GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth, /** * Allocate space for a display list instruction. * \param opcode the instruction opcode (OPCODE_* value) - * \param size instruction size in bytes, not counting opcode. + * \param bytes instruction size in bytes, not counting opcode. * \return pointer to the usable data area (not including the internal * opcode). */ diff --git a/src/mesa/main/execmem.c b/src/mesa/main/execmem.c index b71846c904..57c1e117c8 100644 --- a/src/mesa/main/execmem.c +++ b/src/mesa/main/execmem.c @@ -24,7 +24,7 @@ /** - * \file exemem.c + * \file execmem.c * Functions for allocating executable memory. * * \author Keith Whitwell diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c index beab535b15..818a804540 100644 --- a/src/mesa/main/feedback.c +++ b/src/mesa/main/feedback.c @@ -197,8 +197,8 @@ _mesa_SelectBuffer( GLsizei size, GLuint *buffer ) /** * Write a value of a record into the selection buffer. * - * \param CTX GL context. - * \param V value. + * \param ctx GL context. + * \param value value. * * Verifies there is free space in the buffer to write the value and * increments the pointer. diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index cb04594c1f..20b8342064 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -1011,7 +1011,7 @@ _mesa_warning( GLcontext *ctx, const char *fmtString, ... ) * Prints the message to stderr via fprintf(). * * \param ctx GL context. - * \param s problem description string. + * \param fmtString problem description string. */ void _mesa_problem( const GLcontext *ctx, const char *fmtString, ... ) diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index af2bf8fe22..4a79430c34 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1186,7 +1186,7 @@ make_1d_stack_mipmap(GLenum datatype, GLuint comps, GLint border, /** - * \bugs + * \bug * There is quite a bit of refactoring that could be done with this function * and \c make_2d_mipmap. */ diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c index 936ee9061b..fa45e466b7 100644 --- a/src/mesa/main/shared.c +++ b/src/mesa/main/shared.c @@ -278,7 +278,7 @@ delete_renderbuffer_cb(GLuint id, void *data, void *userData) * Deallocate a shared state object and all children structures. * * \param ctx GL context. - * \param ss shared state pointer. + * \param shared shared state pointer. * * Frees the display lists, the texture objects (calling the driver texture * deletion callback to free its private data) and the vertex programs, as well diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index bf28986066..4f297738df 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -712,7 +712,7 @@ _mesa_new_texture_image( GLcontext *ctx ) * Free texture image data. * This function is a fallback called via ctx->Driver.FreeTexImageData(). * - * \param teximage texture image. + * \param texImage texture image. * * Free the texture image data if it's not marked as client data. */ @@ -734,7 +734,7 @@ _mesa_free_texture_image_data(GLcontext *ctx, /** * Free texture image. * - * \param teximage texture image. + * \param texImage texture image. * * Free the texture image structure and the associated image data. */ @@ -844,7 +844,7 @@ _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit, * of the given texture unit. * * \param ctx GL context. - * \param texUnit texture unit. + * \param texObj texture unit. * \param target texture target. * \param level image level. * @@ -1852,7 +1852,6 @@ subtexture_error_check2( GLcontext *ctx, GLuint dimensions, * \param internalFormat internal format given by the user. * \param width image width given by the user. * \param height image height given by the user. - * \param depth image depth given by the user. * \param border texture border. * * \return GL_TRUE if an error was detected, or GL_FALSE if no errors. diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 9ccb8fa100..b63f747fe8 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -180,7 +180,7 @@ finish_texture_init(GLcontext *ctx, GLenum target, * 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. + * \param texObj the texture object to delete. */ void _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj ) diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c index 60e9d07423..66edae9001 100644 --- a/src/mesa/shader/prog_parameter.c +++ b/src/mesa/shader/prog_parameter.c @@ -517,7 +517,7 @@ _mesa_lookup_parameter_index(const struct gl_program_parameter_list *paramList, * swizzling to find a match. * \param list the parameter list to search * \param v the float vector to search for - * \param size number of element in v + * \param vSize number of element in v * \param posOut returns the position of the constant, if found * \param swizzleOut returns a swizzle mask describing location of the * vector elements if found. diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index 3e006a4927..b832ddb477 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -213,7 +213,7 @@ arb_output_attrib_string(GLint index, GLenum progType) * Return string representation of the given register. * Note that some types of registers (like PROGRAM_UNIFORM) aren't defined * by the ARB/NV program languages so we've taken some liberties here. - * \param file the register file (PROGRAM_INPUT, PROGRAM_TEMPORARY, etc) + * \param f the register file (PROGRAM_INPUT, PROGRAM_TEMPORARY, etc) * \param index number of the register in the register file * \param mode the output format/mode/style * \param prog pointer to containing program -- cgit v1.2.3 From 3f25219c7bf0f090502489928f0f018e62c4f6cf Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 1 May 2009 09:30:32 -0600 Subject: mesa: create/use a fallback texture when bound texture is incomplete When a GLSL sampler reads from an incomplete texture it should return (0,0,0,1). Instead of jumping through hoops in all the drivers to make this happen, just create/install a fallback texture with those texel values. Fixes piglit/fp-incomplete-tex on i965 and more importantly, fixes some GPU lockups when trying to sample from missing surfaces. If a binding table entry is NULL, it seems that sampling sometimes works, but not always (lockup). Todo: create a fallback texture for each type of texture target? --- src/mesa/main/mtypes.h | 3 +++ src/mesa/main/texobj.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/texobj.h | 3 +++ src/mesa/main/texstate.c | 9 ++++++-- 4 files changed, 66 insertions(+), 2 deletions(-) (limited to 'src/mesa/main/texobj.c') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 30c7cca3b5..38c3b1bb40 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2050,6 +2050,9 @@ struct gl_shared_state /** Default texture objects (shared by all texture units) */ struct gl_texture_object *DefaultTex[NUM_TEXTURE_TARGETS]; + /** Fallback texture used when a bound texture is incomplete */ + struct gl_texture_object *FallbackTex; + /** * \name Thread safety and statechange notification for texture * objects. diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index b63f747fe8..0024efc0e6 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -662,6 +662,59 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, } } + +/** + * Return pointer to a default/fallback texture. + * The texture is a 2D 8x8 RGBA texture with all texels = (0,0,0,1). + * That's the value a sampler should get when sampling from an + * incomplete texture. + */ +struct gl_texture_object * +_mesa_get_fallback_texture(GLcontext *ctx) +{ + if (!ctx->Shared->FallbackTex) { + /* create fallback texture now */ + static GLubyte texels[8 * 8][4]; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLuint i; + + for (i = 0; i < 8 * 8; i++) { + texels[i][0] = + texels[i][1] = + texels[i][2] = 0x0; + texels[i][3] = 0xff; + } + + /* create texture object */ + texObj = ctx->Driver.NewTextureObject(ctx, 0, GL_TEXTURE_2D); + assert(texObj->RefCount == 1); + texObj->MinFilter = GL_NEAREST; + texObj->MagFilter = GL_NEAREST; + + /* create level[0] texture image */ + texImage = _mesa_get_tex_image(ctx, texObj, GL_TEXTURE_2D, 0); + + /* init the image fields */ + _mesa_init_teximage_fields(ctx, GL_TEXTURE_2D, texImage, + 8, 8, 1, 0, GL_RGBA); + + /* set image data */ + ctx->Driver.TexImage2D(ctx, GL_TEXTURE_2D, 0, GL_RGBA, + 8, 8, 0, + GL_RGBA, GL_UNSIGNED_BYTE, texels, + &ctx->DefaultPacking, texObj, texImage); + + _mesa_test_texobj_completeness(ctx, texObj); + assert(texObj->_Complete); + + ctx->Shared->FallbackTex = texObj; + } + return ctx->Shared->FallbackTex; +} + + + /*@}*/ diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h index d5374c5d6c..2599c0816a 100644 --- a/src/mesa/main/texobj.h +++ b/src/mesa/main/texobj.h @@ -65,6 +65,9 @@ extern void _mesa_test_texobj_completeness( const GLcontext *ctx, struct gl_texture_object *obj ); +extern struct gl_texture_object * +_mesa_get_fallback_texture(GLcontext *ctx); + extern void _mesa_unlock_context_textures( GLcontext *ctx ); diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 73f8a5339e..32d55ba8d5 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -561,8 +561,13 @@ update_texture_state( GLcontext *ctx ) } if (!texUnit->_ReallyEnabled) { - _mesa_reference_texobj(&texUnit->_Current, NULL); - continue; + /* If we get here it means the shader (or fixed-function state) + * is expecting a texture object, but there isn't one (or it's + * incomplete). Use the fallback texture. + */ + struct gl_texture_object *texObj = _mesa_get_fallback_texture(ctx); + texUnit->_ReallyEnabled = 1 << TEXTURE_2D_INDEX; + _mesa_reference_texobj(&texUnit->_Current, texObj); } /* if we get here, we know this texture unit is enabled */ -- cgit v1.2.3 From 43d8ace88da80848035827c7bb4bbf5530b59a7c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 19 May 2009 09:21:27 -0600 Subject: mesa: print more info when valid_texture_object() fails --- src/mesa/main/texobj.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/mesa/main/texobj.c') diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 0024efc0e6..d51e7b76ec 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -281,7 +281,8 @@ valid_texture_object(const struct gl_texture_object *tex) _mesa_problem(NULL, "invalid reference to a deleted texture object"); return GL_FALSE; default: - _mesa_problem(NULL, "invalid texture object Target value"); + _mesa_problem(NULL, "invalid texture object Target 0x%x, Id = %u", + tex->Target, tex->Name); return GL_FALSE; } } -- cgit v1.2.3 From 7f8000db8bd45bb95bda4a4f8535c49b8ef74254 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 3 Jun 2009 17:49:05 +0100 Subject: Fast path when rebinding the same texture in single context environment If there is no shared context, there is no purpose in rebinding the same texture. In some artificial tests this improves performance 10% - 30%. --- src/mesa/main/texobj.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/mesa/main/texobj.c') diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index d51e7b76ec..2082f945f1 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -945,6 +945,7 @@ _mesa_BindTexture( GLenum target, GLuint texName ) struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; struct gl_texture_object *newTexObj = NULL, *defaultTexObj = NULL; GLint targetIndex; + GLboolean early_out = GL_FALSE; ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) @@ -998,6 +999,17 @@ _mesa_BindTexture( GLenum target, GLuint texName ) assert(valid_texture_object(newTexObj)); + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); + if ((ctx->Shared->RefCount == 1) + && (newTexObj == texUnit->CurrentTex[targetIndex])) { + early_out = GL_TRUE; + } + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); + + if (early_out) { + return; + } + /* flush before changing binding */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); -- cgit v1.2.3 From 42b6b067ac68ac1309d0570613bea4a88f745559 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 5 Aug 2009 16:06:50 -0600 Subject: mesa/main: Add functions to clear and dirty texture objects. This commit adds a function to clear a texture object such that there is no image data associated with it, and a function to dirty it so that it will be re-tested for completeness. Signed-off-by: Chia-I Wu --- src/mesa/main/teximage.c | 17 +++++++++++++++++ src/mesa/main/teximage.h | 4 ++++ src/mesa/main/texobj.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- src/mesa/main/texobj.h | 8 +++++++- 4 files changed, 72 insertions(+), 2 deletions(-) (limited to 'src/mesa/main/texobj.c') diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 3549b68829..83f025f86f 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1218,6 +1218,23 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, } +/** + * Free and clear fields of the gl_texture_image struct. + * + * \param ctx GL context. + * \param texImage texture image structure to be cleared. + * + * After the call, \p texImage will have no data associated with it. Its + * fields are cleared so that its parent object will test incomplete. + */ +void +_mesa_clear_texture_image(GLcontext *ctx, struct gl_texture_image *texImage) +{ + ctx->Driver.FreeTexImageData(ctx, texImage); + clear_teximage_fields(texImage); +} + + /** * This is the fallback for Driver.TestProxyTexImage(). Test the texture * level, width, height and depth against the ctx->Const limits for textures. diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index eb60a1fa8f..b0d7c1c3aa 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -72,6 +72,10 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, GLint border, GLenum internalFormat); +extern void +_mesa_clear_texture_image(GLcontext *ctx, struct gl_texture_image *texImage); + + extern void _mesa_set_tex_image(struct gl_texture_object *tObj, GLenum target, GLint level, diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 2082f945f1..9a7773df81 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -260,6 +260,32 @@ _mesa_copy_texture_object( struct gl_texture_object *dest, } +/** + * Clear all texture images of the given texture object. + * + * \param ctx GL context. + * \param t texture object. + * + * \sa _mesa_clear_texture_image(). + */ +void +_mesa_clear_texture_object(GLcontext *ctx, struct gl_texture_object *texObj) +{ + GLuint i, j; + + if (texObj->Target == 0) + return; + + for (i = 0; i < MAX_FACES; i++) { + for (j = 0; j < MAX_TEXTURE_LEVELS; j++) { + struct gl_texture_image *texImage = texObj->Image[i][j]; + if (texImage) + _mesa_clear_texture_image(ctx, texImage); + } + } +} + + /** * Check if the given texture object is valid by examining its Target field. * For debugging only. @@ -664,6 +690,24 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, } +/** + * Mark a texture object dirty. It forces the object to be incomplete + * and optionally forces the context to re-validate its state. + * + * \param ctx GL context. + * \param texObj texture object. + * \param invalidate_state also invalidate context state. + */ +void +_mesa_dirty_texobj(GLcontext *ctx, struct gl_texture_object *texObj, + GLboolean invalidate_state) +{ + texObj->_Complete = GL_FALSE; + if (invalidate_state) + ctx->NewState |= _NEW_TEXTURE; +} + + /** * Return pointer to a default/fallback texture. * The texture is a 2D 8x8 RGBA texture with all texels = (0,0,0,1). @@ -715,7 +759,6 @@ _mesa_get_fallback_texture(GLcontext *ctx) } - /*@}*/ diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h index 2599c0816a..9bfebd45c8 100644 --- a/src/mesa/main/texobj.h +++ b/src/mesa/main/texobj.h @@ -57,6 +57,9 @@ extern void _mesa_copy_texture_object( struct gl_texture_object *dest, const struct gl_texture_object *src ); +extern void +_mesa_clear_texture_object(GLcontext *ctx, struct gl_texture_object *obj); + extern void _mesa_reference_texobj(struct gl_texture_object **ptr, struct gl_texture_object *tex); @@ -65,6 +68,10 @@ extern void _mesa_test_texobj_completeness( const GLcontext *ctx, struct gl_texture_object *obj ); +extern void +_mesa_dirty_texobj(GLcontext *ctx, struct gl_texture_object *texObj, + GLboolean invalidate_state); + extern struct gl_texture_object * _mesa_get_fallback_texture(GLcontext *ctx); @@ -76,7 +83,6 @@ _mesa_lock_context_textures( GLcontext *ctx ); /*@}*/ - /** * \name API functions */ -- cgit v1.2.3 From 3105fd760b8a6fc34438d51d36b65670810626a2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 4 Aug 2009 17:02:12 -0600 Subject: mesa: fix comment --- src/mesa/main/texobj.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/mesa/main/texobj.c') diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 9a7773df81..22657ed81b 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1203,10 +1203,9 @@ _mesa_IsTexture( GLuint texture ) /** - * 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. + * Simplest implementation of texture locking: grab the shared tex + * mutex. Examine the shared context state timestamp and if there has + * been a change, set the appropriate bits in ctx->NewState. * * This is used to deal with synchronizing things when a texture object * is used/modified by different contexts (or threads) which are sharing -- cgit v1.2.3 From c10002361c3bc175ec12d667e762e51a2cc79b47 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 13 Aug 2009 10:29:15 -0600 Subject: mesa: s/assert/ASSERT/ in _mesa_reference_texobj() We want the no-op ASSERT for non-debug builds. --- src/mesa/main/texobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/main/texobj.c') diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 22657ed81b..d09c439250 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -334,7 +334,7 @@ _mesa_reference_texobj(struct gl_texture_object **ptr, GLboolean deleteFlag = GL_FALSE; struct gl_texture_object *oldTex = *ptr; - assert(valid_texture_object(oldTex)); + ASSERT(valid_texture_object(oldTex)); _glthread_LOCK_MUTEX(oldTex->Mutex); ASSERT(oldTex->RefCount > 0); @@ -357,7 +357,7 @@ _mesa_reference_texobj(struct gl_texture_object **ptr, if (tex) { /* reference new texture */ - assert(valid_texture_object(tex)); + ASSERT(valid_texture_object(tex)); _glthread_LOCK_MUTEX(tex->Mutex); if (tex->RefCount == 0) { /* this texture's being deleted (look just above) */ -- cgit v1.2.3 From 5bcfe4b5c81f850d68d3100b8bcd2f2b74a258a6 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 7 Sep 2009 17:17:11 +0800 Subject: mesa/main: Make FEATURE_colortable follow feature conventions. As shown in mfeatures.h, this allows users of colortab.h to work without knowing if the feature is available. --- src/mesa/main/api_exec.c | 14 +------------- src/mesa/main/colortab.c | 23 +++++++++++++++++++++++ src/mesa/main/colortab.h | 41 +++++++++++++++++++++++------------------ src/mesa/main/context.c | 6 ------ src/mesa/main/texobj.c | 4 ---- src/mesa/main/texstate.c | 6 ------ 6 files changed, 47 insertions(+), 47 deletions(-) (limited to 'src/mesa/main/texobj.c') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 39941a1b03..30c142e53a 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -54,9 +54,7 @@ #endif #include "clear.h" #include "clip.h" -#if FEATURE_colortable #include "colortab.h" -#endif #include "context.h" #if FEATURE_convolve #include "convolve.h" @@ -385,17 +383,7 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_BlendEquation(exec, _mesa_BlendEquation); SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT); -#if FEATURE_colortable - SET_ColorSubTable(exec, _mesa_ColorSubTable); - SET_ColorTable(exec, _mesa_ColorTable); - SET_ColorTableParameterfv(exec, _mesa_ColorTableParameterfv); - SET_ColorTableParameteriv(exec, _mesa_ColorTableParameteriv); - SET_CopyColorSubTable(exec, _mesa_CopyColorSubTable); - SET_CopyColorTable(exec, _mesa_CopyColorTable); - SET_GetColorTable(exec, _mesa_GetColorTable); - SET_GetColorTableParameterfv(exec, _mesa_GetColorTableParameterfv); - SET_GetColorTableParameteriv(exec, _mesa_GetColorTableParameteriv); -#endif + _mesa_init_colortable_dispatch(exec); #if FEATURE_convolve SET_ConvolutionFilter1D(exec, _mesa_ConvolutionFilter1D); diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index 5a7de5f209..d6f3121cb4 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -31,6 +31,10 @@ #include "macros.h" #include "state.h" #include "teximage.h" +#include "glapi/dispatch.h" + + +#if FEATURE_colortable /** @@ -1044,6 +1048,25 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) } } + +void +_mesa_init_colortable_dispatch(struct _glapi_table *disp) +{ + SET_ColorSubTable(disp, _mesa_ColorSubTable); + SET_ColorTable(disp, _mesa_ColorTable); + SET_ColorTableParameterfv(disp, _mesa_ColorTableParameterfv); + SET_ColorTableParameteriv(disp, _mesa_ColorTableParameteriv); + SET_CopyColorSubTable(disp, _mesa_CopyColorSubTable); + SET_CopyColorTable(disp, _mesa_CopyColorTable); + SET_GetColorTable(disp, _mesa_GetColorTable); + SET_GetColorTableParameterfv(disp, _mesa_GetColorTableParameterfv); + SET_GetColorTableParameteriv(disp, _mesa_GetColorTableParameteriv); +} + + +#endif /* FEATURE_colortable */ + + /**********************************************************************/ /***** Initialization *****/ /**********************************************************************/ diff --git a/src/mesa/main/colortab.h b/src/mesa/main/colortab.h index b6ff737a65..ec28ceca9d 100644 --- a/src/mesa/main/colortab.h +++ b/src/mesa/main/colortab.h @@ -27,9 +27,16 @@ #define COLORTAB_H -#include "mtypes.h" +#include "main/mtypes.h" -#if _HAVE_FULL_GL +#if FEATURE_colortable + +#define _MESA_INIT_COLORTABLE_FUNCTIONS(driver, impl) \ + do { \ + (driver)->CopyColorTable = impl ## CopyColorTable; \ + (driver)->CopyColorSubTable = impl ## CopyColorSubTable; \ + (driver)->UpdateTexturePalette = impl ## UpdateTexturePalette; \ + } while (0) extern void GLAPIENTRY _mesa_ColorTable( GLenum target, GLenum internalformat, @@ -67,6 +74,19 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ); extern void GLAPIENTRY _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ); +extern void +_mesa_init_colortable_dispatch(struct _glapi_table *disp); + +#else /* FEATURE_colortable */ + +#define _MESA_INIT_COLORTABLE_FUNCTIONS(driver, impl) do { } while (0) + +static INLINE void +_mesa_init_colortable_dispatch(struct _glapi_table *disp) +{ +} + +#endif /* FEATURE_colortable */ extern void @@ -81,20 +101,5 @@ _mesa_init_colortables( GLcontext *ctx ); extern void _mesa_free_colortables_data( GLcontext *ctx ); -#else - -/** No-op */ -#define _mesa_init_colortable( p ) ((void) 0) - -/** No-op */ -#define _mesa_free_colortable_data( p ) ((void) 0) - -/** No-op */ -#define _mesa_init_colortables( p ) ((void)0) - -/** No-op */ -#define _mesa_free_colortables_data( p ) ((void)0) - -#endif -#endif +#endif /* COLORTAB_H */ diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index f6d4ac4595..1907c799df 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -90,9 +90,7 @@ #include "blend.h" #include "buffers.h" #include "bufferobj.h" -#if FEATURE_colortable #include "colortab.h" -#endif #include "context.h" #include "cpuinfo.h" #include "debug.h" @@ -686,9 +684,7 @@ init_attrib_groups(GLcontext *ctx) #endif _mesa_init_buffer_objects( ctx ); _mesa_init_color( ctx ); -#if FEATURE_colortable _mesa_init_colortables( ctx ); -#endif _mesa_init_current( ctx ); _mesa_init_depth( ctx ); _mesa_init_debug( ctx ); @@ -1015,9 +1011,7 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_free_texture_data( ctx ); _mesa_free_matrix_data( ctx ); _mesa_free_viewport_data( ctx ); -#if FEATURE_colortable _mesa_free_colortables_data( ctx ); -#endif _mesa_free_program_data(ctx); _mesa_free_shader_state(ctx); #if FEATURE_ARB_occlusion_query diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index d09c439250..678845ece0 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -29,9 +29,7 @@ #include "mfeatures.h" -#if FEATURE_colortable #include "colortab.h" -#endif #include "context.h" #include "enums.h" #include "fbobject.h" @@ -194,9 +192,7 @@ _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj ) */ texObj->Target = 0x99; -#if FEATURE_colortable _mesa_free_colortable_data(&texObj->Palette); -#endif /* free the texture images */ for (face = 0; face < 6; face++) { diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 861c5f37c4..b9311d0ffc 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -31,9 +31,7 @@ #include "glheader.h" #include "mfeatures.h" #include "colormac.h" -#if FEATURE_colortable #include "colortab.h" -#endif #include "context.h" #include "enums.h" #include "macros.h" @@ -753,9 +751,7 @@ _mesa_init_texture(GLcontext *ctx) ctx->Texture.CurrentUnit = 0; /* multitexture */ ctx->Texture._EnabledUnits = 0x0; ctx->Texture.SharedPalette = GL_FALSE; -#if FEATURE_colortable _mesa_init_colortable(&ctx->Texture.Palette); -#endif for (u = 0; u < MAX_TEXTURE_UNITS; u++) init_texture_unit(ctx, u); @@ -796,10 +792,8 @@ _mesa_free_texture_data(GLcontext *ctx) for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]); -#if FEATURE_colortable for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) _mesa_free_colortable_data(&ctx->Texture.Unit[u].ColorTable); -#endif } -- cgit v1.2.3