Mesa (master): mesa: use loop in pop_texture_group() to restore 4 combiner terms

Brian Paul brianp at kemper.freedesktop.org
Sat Oct 1 07:23:00 PDT 2011


Module: Mesa
Branch: master
Commit: 986a9bb1806174b70b756165ece555856a705dfb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=986a9bb1806174b70b756165ece555856a705dfb

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Sep 30 21:03:42 2011 -0600

mesa: use loop in pop_texture_group() to restore 4 combiner terms

There's four combiner terms (not 3) with GL_NV_texture_env_combine4.
Use a loop to make the code a little more compact.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/main/attrib.c |   37 +++++++++++++------------------------
 1 files changed, 13 insertions(+), 24 deletions(-)

diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 6f427e0..82d7259 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -733,30 +733,19 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate)
 		    unit->Combine.ModeRGB);
       _mesa_TexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA,
 		    unit->Combine.ModeA);
-      _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB,
-		    unit->Combine.SourceRGB[0]);
-      _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB,
-		    unit->Combine.SourceRGB[1]);
-      _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB,
-		    unit->Combine.SourceRGB[2]);
-      _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA,
-		    unit->Combine.SourceA[0]);
-      _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA,
-		    unit->Combine.SourceA[1]);
-      _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_ALPHA,
-		    unit->Combine.SourceA[2]);
-      _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB,
-		    unit->Combine.OperandRGB[0]);
-      _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB,
-		    unit->Combine.OperandRGB[1]);
-      _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB,
-		    unit->Combine.OperandRGB[2]);
-      _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA,
-		    unit->Combine.OperandA[0]);
-      _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA,
-		    unit->Combine.OperandA[1]);
-      _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_ALPHA,
-		    unit->Combine.OperandA[2]);
+      {
+         GLuint i;
+         for (i = 0; i < MAX_COMBINER_TERMS; i++) {
+            _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB + i,
+                          unit->Combine.SourceRGB[i]);
+            _mesa_TexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA + i,
+                          unit->Combine.SourceA[i]);
+            _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB + i,
+                          unit->Combine.OperandRGB[i]);
+            _mesa_TexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA + i,
+                          unit->Combine.OperandA[i]);
+         }
+      }
       _mesa_TexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE,
 		    1 << unit->Combine.ScaleShiftRGB);
       _mesa_TexEnvi(GL_TEXTURE_ENV, GL_ALPHA_SCALE,



More information about the mesa-commit mailing list