mesa: number of combiner terms to pop depends on GL_NV_texture_env_combine4
authorBrian Paul <brianp@vmware.com>
Sat, 1 Oct 2011 14:27:46 +0000 (08:27 -0600)
committerBrian Paul <brianp@vmware.com>
Sat, 1 Oct 2011 14:29:34 +0000 (08:29 -0600)
If GL_NV_texture_env_combine4 is not supported, setting the fourth
combiner term would generate a GL error.
Of course, I noticed this right after committing the previous patch
to use a loop in the first place.  <sigh>

Note that GL_EXT_texture_env_combine is always supported so the first
three combiner terms are always accepted.

src/mesa/main/attrib.c

index df7116eec1e1bee2c272d2aea56375536cc55462..e67957d4d181c388ef6bd47dc60976eb9fe879cb 100644 (file)
@@ -720,8 +720,9 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate)
       _mesa_TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA,
                    unit->Combine.ModeA);
       {
+         const GLuint n = ctx->Extensions.NV_texture_env_combine4 ? 4 : 3;
          GLuint i;
-         for (i = 0; i < MAX_COMBINER_TERMS; i++) {
+         for (i = 0; i < n; i++) {
             _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB + i,
                           unit->Combine.SourceRGB[i]);
             _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA + i,