diff options
author | Brian Paul <[email protected]> | 2002-06-15 03:03:06 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2002-06-15 03:03:06 +0000 |
commit | 8afe7de8deaf3c9613fd68b344de8c52b02b1879 (patch) | |
tree | f600a192c9d0136faea8864a53eabc819eeb791f /src/mesa/main/enable.c | |
parent | 8bdd0dc8d0e9c9cb2c71fbdd4c77e982cfc0b350 (diff) |
Implemented GL_NV_texture_rectangle extension.
Replace struct gl_texure_object's Dimension w/ Target field.
Added _EnabledUnits to struct gl_texture_attrib - the _ReallyEnabled
field is obsolete, but still present for now. This effectively
removes the 8-texture units limit, 32 units now possible, but unlikely!
New TEXTURE_1D/2D/3D/CUBE/RECT_BIT tokens for unit->_ReallyEnabled field.
Updated device drivers to use ctx->Texture._EnabledUnits.
Diffstat (limited to 'src/mesa/main/enable.c')
-rw-r--r-- | src/mesa/main/enable.c | 51 |
1 files changed, 38 insertions, 13 deletions
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index bb0c4b705b2..eb031e8d669 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -1,4 +1,4 @@ -/* $Id: enable.c,v 1.65 2002/06/15 02:38:15 brianp Exp $ */ +/* $Id: enable.c,v 1.66 2002/06/15 03:03:07 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -539,9 +539,9 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_TEXTURE_1D: { const GLuint curr = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - GLuint newenabled = texUnit->Enabled & ~TEXTURE0_1D; + GLuint newenabled = texUnit->Enabled & ~TEXTURE_1D_BIT; if (state) - newenabled |= TEXTURE0_1D; + newenabled |= TEXTURE_1D_BIT; if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); @@ -551,9 +551,9 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_TEXTURE_2D: { const GLuint curr = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - GLuint newenabled = texUnit->Enabled & ~TEXTURE0_2D; + GLuint newenabled = texUnit->Enabled & ~TEXTURE_2D_BIT; if (state) - newenabled |= TEXTURE0_2D; + newenabled |= TEXTURE_2D_BIT; if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); @@ -563,9 +563,9 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) case GL_TEXTURE_3D: { const GLuint curr = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - GLuint newenabled = texUnit->Enabled & ~TEXTURE0_3D; + GLuint newenabled = texUnit->Enabled & ~TEXTURE_3D_BIT; if (state) - newenabled |= TEXTURE0_3D; + newenabled |= TEXTURE_3D_BIT; if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); @@ -720,10 +720,10 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) { const GLuint curr = ctx->Texture.CurrentUnit; struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; - GLuint newenabled = texUnit->Enabled & ~TEXTURE0_CUBE; + GLuint newenabled = texUnit->Enabled & ~TEXTURE_CUBE_BIT; CHECK_EXTENSION(ARB_texture_cube_map); if (state) - newenabled |= TEXTURE0_CUBE; + newenabled |= TEXTURE_CUBE_BIT; if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) return; FLUSH_VERTICES(ctx, _NEW_TEXTURE); @@ -872,6 +872,22 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) } break; + /* GL_NV_texture_rectangle */ + case GL_TEXTURE_RECTANGLE_NV: + { + const GLuint curr = ctx->Texture.CurrentUnit; + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + GLuint newenabled = texUnit->Enabled & ~TEXTURE_RECT_BIT; + CHECK_EXTENSION(NV_texture_rectangle); + if (state) + newenabled |= TEXTURE_RECT_BIT; + if (!ctx->Visual.rgbMode || texUnit->Enabled == newenabled) + return; + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texUnit->Enabled = newenabled; + } + break; + default: _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); return; @@ -1021,19 +1037,19 @@ _mesa_IsEnabled( GLenum cap ) { const struct gl_texture_unit *texUnit; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - return (texUnit->Enabled & TEXTURE0_1D) ? GL_TRUE : GL_FALSE; + return (texUnit->Enabled & TEXTURE_1D_BIT) ? GL_TRUE : GL_FALSE; } case GL_TEXTURE_2D: { const struct gl_texture_unit *texUnit; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - return (texUnit->Enabled & TEXTURE0_2D) ? GL_TRUE : GL_FALSE; + return (texUnit->Enabled & TEXTURE_2D_BIT) ? GL_TRUE : GL_FALSE; } case GL_TEXTURE_3D: { const struct gl_texture_unit *texUnit; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - return (texUnit->Enabled & TEXTURE0_3D) ? GL_TRUE : GL_FALSE; + return (texUnit->Enabled & TEXTURE_3D_BIT) ? GL_TRUE : GL_FALSE; } case GL_TEXTURE_GEN_Q: { @@ -1133,7 +1149,7 @@ _mesa_IsEnabled( GLenum cap ) { const struct gl_texture_unit *texUnit; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - return (texUnit->Enabled & TEXTURE0_CUBE) ? GL_TRUE : GL_FALSE; + return (texUnit->Enabled & TEXTURE_CUBE_BIT) ? GL_TRUE : GL_FALSE; } /* GL_ARB_multisample */ @@ -1236,6 +1252,15 @@ _mesa_IsEnabled( GLenum cap ) return ctx->Eval.Map2Attrib[map]; } + /* GL_NV_texture_rectangle */ + case GL_TEXTURE_RECTANGLE_NV: + CHECK_EXTENSION(NV_texture_rectangle); + { + const struct gl_texture_unit *texUnit; + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + return (texUnit->Enabled & TEXTURE_RECT_BIT) ? GL_TRUE : GL_FALSE; + } + default: _mesa_error( ctx, GL_INVALID_ENUM, "glIsEnabled" ); return GL_FALSE; |