-/* $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
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 &&
*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;
}
-/*
- * 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,
+/*
+ * 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.
}
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) {
}
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);
-/* $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
_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);
* 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 */
-/* $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
#include "types.h"
-#ifdef VMS
-#define gl_test_texture_object_completeness gl_test_texture_object_complete
-#endif
/*
* Internal functions
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 );
/*
-/* $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
}
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;
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) {
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) {
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) {
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);
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);
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;
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;
}