call FLUSH_VERTICES() in _mesaTexParameterfv() (bug 491832)
authorBrian Paul <brian.paul@tungstengraphics.com>
Thu, 13 Dec 2001 16:02:11 +0000 (16:02 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Thu, 13 Dec 2001 16:02:11 +0000 (16:02 +0000)
src/mesa/main/texstate.c

index 6621ea417bf1f30e41ad60318985a84665765f6f..f711ab31ce64b4a8d6ba3f7e95fc44ffbf0504de 100644 (file)
@@ -1,8 +1,8 @@
-/* $Id: texstate.c,v 1.60 2001/12/04 23:44:56 brianp Exp $ */
+/* $Id: texstate.c,v 1.61 2001/12/13 16:02:11 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
- * Version:  3.5
+ * Version:  4.1
  *
  * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
  *
@@ -904,6 +904,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
              || eparam==GL_LINEAR_MIPMAP_NEAREST
              || eparam==GL_NEAREST_MIPMAP_LINEAR
              || eparam==GL_LINEAR_MIPMAP_LINEAR) {
+            FLUSH_VERTICES(ctx, _NEW_TEXTURE);
             texObj->MinFilter = eparam;
          }
          else {
@@ -917,6 +918,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
             return;
 
          if (eparam==GL_NEAREST || eparam==GL_LINEAR) {
+            FLUSH_VERTICES(ctx, _NEW_TEXTURE);
             texObj->MagFilter = eparam;
          }
          else {
@@ -934,6 +936,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
               ctx->Extensions.ARB_texture_border_clamp) ||
              (eparam == GL_MIRRORED_REPEAT_ARB &&
               ctx->Extensions.ARB_texture_mirrored_repeat)) {
+            FLUSH_VERTICES(ctx, _NEW_TEXTURE);
             texObj->WrapS = eparam;
          }
          else {
@@ -951,6 +954,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
               ctx->Extensions.ARB_texture_border_clamp) ||
              (eparam == GL_MIRRORED_REPEAT_ARB &&
               ctx->Extensions.ARB_texture_mirrored_repeat)) {
+            FLUSH_VERTICES(ctx, _NEW_TEXTURE);
             texObj->WrapT = eparam;
          }
          else {
@@ -968,6 +972,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
               ctx->Extensions.ARB_texture_border_clamp) ||
              (eparam == GL_MIRRORED_REPEAT_ARB &&
               ctx->Extensions.ARB_texture_mirrored_repeat)) {
+            FLUSH_VERTICES(ctx, _NEW_TEXTURE);
             texObj->WrapR = eparam;
          }
          else {
@@ -977,6 +982,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
 #if 0 /* someday */
       case GL_TEXTUER_BORDER_VALUES_NV:
          /* don't clamp */
+         FLUSH_VERTICES(ctx, _NEW_TEXTURE);
          COPY_4V(texObj->BorderValues, params);
          UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[0], params[0]);
          UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[1], params[1]);
@@ -986,6 +992,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
 #endif
       case GL_TEXTURE_BORDER_COLOR:
          /* clamp */
+         FLUSH_VERTICES(ctx, _NEW_TEXTURE);
          texObj->BorderValues[0] = CLAMP(params[0], 0.0F, 1.0F);
          texObj->BorderValues[1] = CLAMP(params[1], 0.0F, 1.0F);
          texObj->BorderValues[2] = CLAMP(params[2], 0.0F, 1.0F);
@@ -996,9 +1003,15 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
          UNCLAMPED_FLOAT_TO_CHAN(texObj->BorderColor[3], texObj->BorderValues[3]);
          break;
       case GL_TEXTURE_MIN_LOD:
+         if (texObj->MinLod == params[0])
+            return;
+         FLUSH_VERTICES(ctx, _NEW_TEXTURE);
          texObj->MinLod = params[0];
          break;
       case GL_TEXTURE_MAX_LOD:
+         if (texObj->MaxLod == params[0])
+            return;
+         FLUSH_VERTICES(ctx, _NEW_TEXTURE);
          texObj->MaxLod = params[0];
          break;
       case GL_TEXTURE_BASE_LEVEL:
@@ -1006,6 +1019,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
             _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
             return;
          }
+         FLUSH_VERTICES(ctx, _NEW_TEXTURE);
          texObj->BaseLevel = (GLint) params[0];
          break;
       case GL_TEXTURE_MAX_LEVEL:
@@ -1013,10 +1027,12 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
             _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
             return;
          }
+         FLUSH_VERTICES(ctx, _NEW_TEXTURE);
          texObj->MaxLevel = (GLint) params[0];
          break;
       case GL_TEXTURE_PRIORITY:
          /* (keithh@netcomuk.co.uk) */
+         FLUSH_VERTICES(ctx, _NEW_TEXTURE);
          texObj->Priority = CLAMP( params[0], 0.0F, 1.0F );
          break;
       case GL_TEXTURE_MAX_ANISOTROPY_EXT:
@@ -1025,6 +1041,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
               _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
               return;
            }
+            FLUSH_VERTICES(ctx, _NEW_TEXTURE);
             texObj->MaxAnisotropy = params[0];
          }
          else {
@@ -1035,6 +1052,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
          break;
       case GL_TEXTURE_COMPARE_SGIX:
          if (ctx->Extensions.SGIX_shadow) {
+            FLUSH_VERTICES(ctx, _NEW_TEXTURE);
             texObj->CompareFlag = params[0] ? GL_TRUE : GL_FALSE;
          }
          else {
@@ -1048,6 +1066,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
             GLenum op = (GLenum) params[0];
             if (op == GL_TEXTURE_LEQUAL_R_SGIX ||
                 op == GL_TEXTURE_GEQUAL_R_SGIX) {
+               FLUSH_VERTICES(ctx, _NEW_TEXTURE);
                texObj->CompareOperator = op;
             }
             else {
@@ -1062,6 +1081,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
          break;
       case GL_SHADOW_AMBIENT_SGIX: /* aka GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
          if (ctx->Extensions.SGIX_shadow_ambient) {
+            FLUSH_VERTICES(ctx, _NEW_TEXTURE);
             UNCLAMPED_FLOAT_TO_CHAN(texObj->ShadowAmbient, params[0]);
          }
          else {
@@ -1084,6 +1104,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
          if (ctx->Extensions.ARB_shadow) {
             const GLenum mode = (GLenum) params[0];
             if (mode == GL_LUMINANCE || mode == GL_COMPARE_R_TO_TEXTURE_ARB) {
+               FLUSH_VERTICES(ctx, _NEW_TEXTURE);
                texObj->CompareMode = params[0];
             }
             else {
@@ -1102,6 +1123,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
          if (ctx->Extensions.ARB_shadow) {
             const GLenum func = (GLenum) params[0];
             if (func == GL_LEQUAL || func == GL_GEQUAL) {
+               FLUSH_VERTICES(ctx, _NEW_TEXTURE);
                texObj->CompareFunc = params[0];
             }
             else {
@@ -1121,6 +1143,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
             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];
             }
             else {
@@ -1145,7 +1168,6 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
          return;
    }
 
-   ctx->NewState |= _NEW_TEXTURE;
    texObj->Complete = GL_FALSE;
 
    if (ctx->Driver.TexParameter) {