mesa: Allow setting GL_TEXTURE_MAX_LEVEL to 0 with GL_TEXTURE_RECTANGLE.
[mesa.git] / src / mesa / main / texenv.c
index 0fe5fbd7a6445f8d24d4931dc1ee5e0136eb7294..4848208f574f8a283c6d8bd581c2eda8fbf0938f 100644 (file)
@@ -1,6 +1,5 @@
 /*
  * 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.
  * 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.
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
  */
 
 /** 
@@ -32,6 +32,7 @@
 
 #include "main/glheader.h"
 #include "main/context.h"
+#include "main/blend.h"
 #include "main/enums.h"
 #include "main/macros.h"
 #include "main/mtypes.h"
@@ -680,7 +681,7 @@ _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
       if (pname == GL_TEXTURE_ENV_COLOR) {
          if(ctx->NewState & (_NEW_BUFFERS | _NEW_FRAG_CLAMP))
             _mesa_update_state(ctx);
-         if(ctx->Color._ClampFragmentColor)
+         if (_mesa_get_clamp_fragment_color(ctx))
             COPY_4FV( params, texUnit->EnvColor );
          else
             COPY_4FV( params, texUnit->EnvColorUnclamped );
@@ -878,7 +879,7 @@ _mesa_GetTexBumpParameterivATI( GLenum pname, GLint *param )
    }
    else if (pname == GL_BUMP_NUM_TEX_UNITS_ATI) {
       GLint count = 0;
-      for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
+      for (i = 0; i < ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits; i++) {
          if (ctx->Const.SupportedBumpUnits & (1 << i)) {
             count++;
          }
@@ -886,7 +887,7 @@ _mesa_GetTexBumpParameterivATI( GLenum pname, GLint *param )
       *param = count;
    }
    else if (pname == GL_BUMP_TEX_UNITS_ATI) {
-      for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
+      for (i = 0; i < ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits; i++) {
          if (ctx->Const.SupportedBumpUnits & (1 << i)) {
             *param++ = i + GL_TEXTURE0;
          }
@@ -927,7 +928,7 @@ _mesa_GetTexBumpParameterfvATI( GLenum pname, GLfloat *param )
    }
    else if (pname == GL_BUMP_NUM_TEX_UNITS_ATI) {
       GLint count = 0;
-      for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
+      for (i = 0; i < ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits; i++) {
          if (ctx->Const.SupportedBumpUnits & (1 << i)) {
             count++;
          }
@@ -935,7 +936,7 @@ _mesa_GetTexBumpParameterfvATI( GLenum pname, GLfloat *param )
       *param = (GLfloat) count;
    }
    else if (pname == GL_BUMP_TEX_UNITS_ATI) {
-      for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
+      for (i = 0; i < ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits; i++) {
          if (ctx->Const.SupportedBumpUnits & (1 << i)) {
             *param++ = (GLfloat) (i + GL_TEXTURE0);
          }