From 4182cf60d96a077a66675e89694529b5f9e4b329 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 15 Feb 2002 16:32:06 +0000 Subject: Finished up GL_ARB_depth_texture and GL_ARB_shadow. --- src/mesa/main/extensions.c | 6 +++--- src/mesa/main/texobj.c | 19 +++++++++++++++---- src/mesa/main/texstate.c | 27 +++++++++++++-------------- 3 files changed, 31 insertions(+), 21 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index ee8eb4f538..8054360fd2 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -1,10 +1,10 @@ -/* $Id: extensions.c,v 1.68 2001/12/14 02:50:01 brianp Exp $ */ +/* $Id: extensions.c,v 1.69 2002/02/15 16:32:06 brianp Exp $ */ /* * Mesa 3-D graphics library * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -56,7 +56,7 @@ static struct { const char *name; int flag_offset; } default_extensions[] = { - { OFF, "GL_ARB_depth_texture", F(SGIX_depth_texture) }, + { OFF, "GL_ARB_depth_texture", F(ARB_depth_texture) }, { OFF, "GL_ARB_imaging", F(ARB_imaging) }, { OFF, "GL_ARB_multisample", F(ARB_multisample) }, { OFF, "GL_ARB_multitexture", F(ARB_multitexture) }, diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index a8a27ef3ed..39f65940b5 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1,10 +1,10 @@ -/* $Id: texobj.c,v 1.51 2001/12/04 23:44:56 brianp Exp $ */ +/* $Id: texobj.c,v 1.52 2002/02/15 16:32:06 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.5 + * Version: 4.1 * - * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2002 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"), @@ -84,7 +84,7 @@ _mesa_alloc_texture_object( struct gl_shared_state *shared, obj->CompareOperator = GL_TEXTURE_LEQUAL_R_SGIX; /* SGIX_shadow */ obj->CompareMode = GL_LUMINANCE; /* ARB_shadow */ obj->CompareFunc = GL_LEQUAL; /* ARB_shadow */ - obj->CompareResult = GL_LUMINANCE; /* ARB_shadow */ + obj->DepthMode = GL_LUMINANCE; /* ARB_depth_texture */ obj->ShadowAmbient = 0; /* ARB/SGIX_shadow_ambient */ _mesa_init_colortable(&obj->Palette); @@ -360,6 +360,11 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, t->Complete = GL_FALSE; return; } + if (t->Image[i]->Format == GL_DEPTH_COMPONENT) { + t->Complete = GL_FALSE; + incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex"); + return; + } if (t->Image[i]->Width2 != width) { t->Complete = GL_FALSE; incomplete(t, "3D Image[i] bad width"); @@ -393,6 +398,12 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, height /= 2; } if (i >= minLevel && i <= maxLevel) { + /* Don't support GL_DEPTH_COMPONENT for cube maps */ + if (t->Image[i]->Format == GL_DEPTH_COMPONENT) { + t->Complete = GL_FALSE; + incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex"); + return; + } /* check that we have images defined */ if (!t->Image[i] || !t->NegX[i] || !t->PosY[i] || !t->NegY[i] || diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index a8c70f0a4c..19e8984ad9 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -1,4 +1,4 @@ -/* $Id: texstate.c,v 1.63 2002/01/09 02:14:29 brianp Exp $ */ +/* $Id: texstate.c,v 1.64 2002/02/15 16:32:06 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -46,7 +46,6 @@ #ifndef GL_TEXTURE_COMPARE_MODE_ARB #define GL_TEXTURE_COMPARE_MODE_ARB 0x9990 #define GL_TEXTURE_COMPARE_FUNC_ARB 0x9991 -#define GL_TEXTURE_COMPARE_RESULT_ARB 0x9992 #define GL_COMPARE_R_TO_TEXTURE_ARB 0x9993 #endif @@ -1109,7 +1108,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) case GL_TEXTURE_COMPARE_MODE_ARB: if (ctx->Extensions.ARB_shadow) { const GLenum mode = (GLenum) params[0]; - if (mode == GL_LUMINANCE || mode == GL_COMPARE_R_TO_TEXTURE_ARB) { + if (mode == GL_NONE || mode == GL_COMPARE_R_TO_TEXTURE_ARB) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->CompareMode = params[0]; } @@ -1144,23 +1143,23 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) return; } break; - case GL_TEXTURE_COMPARE_RESULT_ARB: - if (ctx->Extensions.ARB_shadow) { + case GL_DEPTH_TEXTURE_MODE_ARB: + if (ctx->Extensions.ARB_depth_texture) { const GLenum result = (GLenum) params[0]; if (result == GL_LUMINANCE || result == GL_INTENSITY || result == GL_ALPHA) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); - texObj->CompareResult = params[0]; + texObj->DepthMode = params[0]; } else { _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(bad GL_TEXTURE_COMPARE_RESULT_ARB)"); + "glTexParameter(bad GL_DEPTH_TEXTURE_MODE_ARB)"); return; } } else { _mesa_error(ctx, GL_INVALID_ENUM, - "glTexParameter(pname=GL_TEXTURE_COMPARE_RESULT_ARB)"); + "glTexParameter(pname=GL_DEPTH_TEXTURE_MODE_ARB)"); return; } break; @@ -1504,9 +1503,9 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) return; } break; - case GL_TEXTURE_COMPARE_RESULT_ARB: - if (ctx->Extensions.ARB_shadow) { - *params = (GLfloat) obj->CompareResult; + case GL_DEPTH_TEXTURE_MODE_ARB: + if (ctx->Extensions.ARB_depth_texture) { + *params = (GLfloat) obj->DepthMode; return; } break; @@ -1633,9 +1632,9 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) return; } break; - case GL_TEXTURE_COMPARE_RESULT_ARB: - if (ctx->Extensions.ARB_shadow) { - *params = (GLint) obj->CompareResult; + case GL_DEPTH_TEXTURE_MODE_ARB: + if (ctx->Extensions.ARB_depth_texture) { + *params = (GLint) obj->DepthMode; return; } break; -- cgit v1.2.3