mesa: Restore depth texture state on glPopAttrib(GL_TEXTURE_BIT).
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 28 Jan 2012 00:09:48 +0000 (16:09 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Sat, 2 Jun 2012 19:02:42 +0000 (12:02 -0700)
According to Table 6.17 in the GL 2.1 specification, DEPTH_TEXTURE_MODE,
TEXTURE_COMPARE_MODE, and TEXTURE_COMPARE_FUNC need to be restored on
glPopAttrib(GL_TEXTURE_BIT).

Makes a number of oglconform tests happier.

v2: Make restoration conditional on the ARB_shadow and ARB_depth_texture
    extensions, as suggested by Brian.  I'm not sure that any
    implementations still remain that don't support those, but why not?

NOTE: This is a candidate for stable release branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/main/attrib.c

index b114ec9414d4b9dc2a27f20edef83e8ca0c13615..318d576e850c7ac0338c9d37ece808665780277c 100644 (file)
@@ -799,6 +799,14 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate)
             _mesa_TexParameterf(target, GL_TEXTURE_COMPARE_FAIL_VALUE_ARB,
                                 samp->CompareFailValue);
          }
+         if (ctx->Extensions.ARB_shadow) {
+            _mesa_TexParameteri(target, GL_TEXTURE_COMPARE_MODE,
+                                samp->CompareMode);
+            _mesa_TexParameteri(target, GL_TEXTURE_COMPARE_FUNC,
+                                samp->CompareFunc);
+         }
+         if (ctx->Extensions.ARB_depth_texture)
+            _mesa_TexParameteri(target, GL_DEPTH_TEXTURE_MODE, samp->DepthMode);
       }
 
       /* remove saved references to the texture objects */