diff options
author | Brian Paul <[email protected]> | 2000-05-23 17:14:49 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2000-05-23 17:14:49 +0000 |
commit | 35d5301a54153930ee6fd60dff1010ce9f901397 (patch) | |
tree | e73b11ab258b81b00ac9a5b33b007c9adedbe558 /src/mesa | |
parent | fc4b44399a07a7a7559f20ceab8a791209b4d875 (diff) |
more texture cube work, misc code clean-up
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/get.c | 8 | ||||
-rw-r--r-- | src/mesa/main/teximage.c | 71 | ||||
-rw-r--r-- | src/mesa/main/teximage.h | 7 | ||||
-rw-r--r-- | src/mesa/main/texobj.c | 4 | ||||
-rw-r--r-- | src/mesa/main/texobj.h | 9 | ||||
-rw-r--r-- | src/mesa/main/texstate.c | 97 |
6 files changed, 97 insertions, 99 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 8302b3459ee..a7d3d5658ad 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1,4 +1,4 @@ -/* $Id: get.c,v 1.27 2000/05/23 15:17:13 brianp Exp $ */ +/* $Id: get.c,v 1.28 2000/05/23 17:14:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -4309,10 +4309,10 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_STRICT_SCISSOR_HINT_PGI: case GL_FULL_STIPPLE_HINT_PGI: - *params = (GL_TRUE); + *params = GL_TRUE; break; case GL_CONSERVE_MEMORY_HINT_PGI: - *params = (GL_FALSE); + *params = GL_FALSE; break; case GL_ALWAYS_FAST_HINT_PGI: *params = (ctx->Hint.AllowDrawWin == GL_TRUE && @@ -4344,7 +4344,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = GL_DONT_CARE; break; case GL_BACK_NORMALS_HINT_PGI: - *params = (GL_TRUE); + *params = GL_TRUE; break; case GL_NATIVE_GRAPHICS_HANDLE_PGI: *params = 0; diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 74be5546f88..d3d8bd75c29 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -385,34 +385,6 @@ set_teximage_component_sizes( struct gl_texture_image *texImage ) } -/* - * Given a texture unit and a texture target, return the corresponding - * texture object. - */ -static struct gl_texture_object * -select_tex_object(struct gl_texture_unit *unit, GLenum target) -{ - switch (target) { - case GL_TEXTURE_1D: - return unit->CurrentD[1]; - case GL_TEXTURE_2D: - return unit->CurrentD[2]; - case GL_TEXTURE_3D: - return unit->CurrentD[3]; - case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: - return unit->CurrentCubeMap; - default: - gl_problem(NULL, "bad target in select_tex_object()"); - return NULL; - } -} - - static void set_tex_image(struct gl_texture_object *tObj, GLenum target, GLint level, @@ -507,6 +479,45 @@ _mesa_free_texture_image( struct gl_texture_image *teximage ) /* + * Given a texture unit and a texture target, return the corresponding + * texture object. + */ +struct gl_texture_object * +_mesa_select_tex_object(GLcontext *ctx, struct gl_texture_unit *texUnit, + GLenum target) +{ + switch (target) { + case GL_TEXTURE_1D: + return texUnit->CurrentD[1]; + case GL_PROXY_TEXTURE_1D: + return ctx->Texture.Proxy1D; + case GL_TEXTURE_2D: + return texUnit->CurrentD[2]; + case GL_PROXY_TEXTURE_2D: + return ctx->Texture.Proxy2D; + case GL_TEXTURE_3D: + return texUnit->CurrentD[3]; + case GL_PROXY_TEXTURE_3D: + return ctx->Texture.Proxy3D; + case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: + return ctx->Extensions.HaveTextureCubeMap + ? texUnit->CurrentCubeMap : NULL; + case GL_PROXY_TEXTURE_CUBE_MAP_ARB: + return ctx->Extensions.HaveTextureCubeMap + ? ctx->Texture.ProxyCubeMap : NULL; + default: + gl_problem(NULL, "bad target in _mesa_select_tex_object()"); + return NULL; + } +} + + +/* * Return the texture image struct which corresponds to target and level * for the given texture unit. */ @@ -1349,7 +1360,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texObj = select_tex_object(texUnit, target); + texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_select_tex_image(ctx, texUnit, target, level); if (!texImage) { @@ -1917,7 +1928,7 @@ _mesa_TexSubImage2D( GLenum target, GLint level, } texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texObj = select_tex_object(texUnit, target); + texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = texObj->Image[level]; assert(texImage); diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index 51e47202103..433bdc34e6c 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -1,4 +1,4 @@ -/* $Id: teximage.h,v 1.7 2000/05/23 15:17:13 brianp Exp $ */ +/* $Id: teximage.h,v 1.8 2000/05/23 17:14:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -47,6 +47,11 @@ extern void _mesa_free_texture_image( struct gl_texture_image *teximage ); +extern struct gl_texture_object * +_mesa_select_tex_object(GLcontext *ctx, struct gl_texture_unit *texUnit, + GLenum target); + + extern struct gl_texture_image * _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, GLenum target, GLint level); diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index cdd9aa475b9..81833a3fa62 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -159,7 +159,9 @@ void gl_free_texture_object( struct gl_shared_state *shared, * Examine a texture object to determine if it is complete or not. * The t->Complete flag will be set to GL_TRUE or GL_FALSE accordingly. */ -void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_texture_object *t ) +void +_mesa_test_texobj_completeness( const GLcontext *ctx, + struct gl_texture_object *t ) { t->Complete = GL_TRUE; /* be optimistic */ diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h index a4bf3961518..52bf621be83 100644 --- a/src/mesa/main/texobj.h +++ b/src/mesa/main/texobj.h @@ -1,4 +1,4 @@ -/* $Id: texobj.h,v 1.2 1999/11/11 01:22:28 brianp Exp $ */ +/* $Id: texobj.h,v 1.3 2000/05/23 17:14:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -32,9 +32,6 @@ #include "types.h" -#ifdef VMS -#define gl_test_texture_object_completeness gl_test_texture_object_complete -#endif /* * Internal functions @@ -49,7 +46,9 @@ extern void gl_free_texture_object( struct gl_shared_state *shared, struct gl_texture_object *t ); -extern void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_texture_object *t ); +extern void +_mesa_test_texobj_completeness( const GLcontext *ctx, + struct gl_texture_object *t ); /* diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 4fe440ee15d..0e55fc9b1f3 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -1,4 +1,4 @@ -/* $Id: texstate.c,v 1.11 2000/05/23 15:17:13 brianp Exp $ */ +/* $Id: texstate.c,v 1.12 2000/05/23 17:14:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -472,13 +472,12 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, } dimensions = tex_image_dimensions(ctx, target); /* 1, 2 or 3 */ - img = _mesa_select_tex_image(ctx, texUnit, target, level); - if (dimensions == 0) { gl_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(target)"); return; } + img = _mesa_select_tex_image(ctx, texUnit, target, level); if (!img) { if (pname == GL_TEXTURE_COMPONENTS) *params = 1; @@ -553,19 +552,10 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexParameterfv"); - switch (target) { - case GL_TEXTURE_1D: - obj = texUnit->CurrentD[1]; - break; - case GL_TEXTURE_2D: - obj = texUnit->CurrentD[2]; - break; - case GL_TEXTURE_3D_EXT: - obj = texUnit->CurrentD[3]; - break; - default: - gl_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(target)"); - return; + obj = _mesa_select_tex_object(ctx, texUnit, target); + if (!obj) { + gl_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(target)"); + return; } switch (pname) { @@ -623,19 +613,10 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexParameteriv"); - switch (target) { - case GL_TEXTURE_1D: - obj = texUnit->CurrentD[1]; - break; - case GL_TEXTURE_2D: - obj = texUnit->CurrentD[2]; - break; - case GL_TEXTURE_3D_EXT: - obj = texUnit->CurrentD[3]; - break; - default: - gl_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(target)"); - return; + obj = _mesa_select_tex_object(ctx, texUnit, target); + if (!obj) { + gl_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(target)"); + return; } switch (pname) { @@ -764,30 +745,30 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) case GL_T: if (pname==GL_TEXTURE_GEN_MODE) { GLenum mode = (GLenum) (GLint) *params; - switch(mode) { - case GL_OBJECT_LINEAR: - texUnit->GenModeT = GL_OBJECT_LINEAR; - texUnit->GenBitT = TEXGEN_OBJ_LINEAR; - break; - case GL_EYE_LINEAR: - texUnit->GenModeT = GL_EYE_LINEAR; - texUnit->GenBitT = TEXGEN_EYE_LINEAR; - break; - case GL_REFLECTION_MAP_NV: - texUnit->GenModeT = GL_REFLECTION_MAP_NV; - texUnit->GenBitT = TEXGEN_REFLECTION_MAP_NV; - break; - case GL_NORMAL_MAP_NV: - texUnit->GenModeT = GL_NORMAL_MAP_NV; - texUnit->GenBitT = TEXGEN_NORMAL_MAP_NV; - break; - case GL_SPHERE_MAP: - texUnit->GenModeT = GL_SPHERE_MAP; - texUnit->GenBitT = TEXGEN_SPHERE_MAP; - break; - default: - gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); - return; + switch (mode) { + case GL_OBJECT_LINEAR: + texUnit->GenModeT = GL_OBJECT_LINEAR; + texUnit->GenBitT = TEXGEN_OBJ_LINEAR; + break; + case GL_EYE_LINEAR: + texUnit->GenModeT = GL_EYE_LINEAR; + texUnit->GenBitT = TEXGEN_EYE_LINEAR; + break; + case GL_REFLECTION_MAP_NV: + texUnit->GenModeT = GL_REFLECTION_MAP_NV; + texUnit->GenBitT = TEXGEN_REFLECTION_MAP_NV; + break; + case GL_NORMAL_MAP_NV: + texUnit->GenModeT = GL_NORMAL_MAP_NV; + texUnit->GenBitT = TEXGEN_NORMAL_MAP_NV; + break; + case GL_SPHERE_MAP: + texUnit->GenModeT = GL_SPHERE_MAP; + texUnit->GenBitT = TEXGEN_SPHERE_MAP; + break; + default: + gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); + return; } } else if (pname==GL_OBJECT_PLANE) { @@ -954,7 +935,7 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexGendv"); - switch( coord ) { + switch (coord) { case GL_S: if (pname==GL_TEXTURE_GEN_MODE) { params[0] = ENUM_TO_DOUBLE(texUnit->GenModeS); @@ -1032,7 +1013,7 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexGenfv"); - switch( coord ) { + switch (coord) { case GL_S: if (pname==GL_TEXTURE_GEN_MODE) { params[0] = ENUM_TO_FLOAT(texUnit->GenModeS); @@ -1110,7 +1091,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexGeniv"); - switch( coord ) { + switch (coord) { case GL_S: if (pname==GL_TEXTURE_GEN_MODE) { params[0] = texUnit->GenModeS; @@ -1316,8 +1297,8 @@ void gl_update_dirty_texobjs( GLcontext *ctx ) struct gl_texture_object *t, *next; for (t = ctx->Shared->DirtyTexObjList; t; t = next) { next = t->NextDirty; - gl_test_texture_object_completeness(ctx, t); - gl_set_texture_sampler(t); + _mesa_test_texobj_completeness(ctx, t); + _mesa_set_texture_sampler(t); t->NextDirty = NULL; t->Dirty = GL_FALSE; } |