Mesa (master): ff_fragment_shader: Use FRAG_RESULT_COLOR to write all our colors at once.

Eric Anholt anholt at kemper.freedesktop.org
Tue Oct 18 11:06:44 PDT 2011


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

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Jul 13 15:52:04 2011 -0700

ff_fragment_shader: Use FRAG_RESULT_COLOR to write all our colors at once.

This is a slight simplification on the way to actually generating GLSL
fragment shaders.

---

 src/mesa/main/ff_fragment_shader.cpp |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
index e6451c9..2b52929 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -1427,7 +1427,6 @@ create_new_program(struct gl_context *ctx, struct state_key *key,
    struct texenv_fragment_program p;
    GLuint unit;
    struct ureg cf, out;
-   int i;
 
    memset(&p, 0, sizeof(p));
    p.state = key;
@@ -1450,12 +1449,8 @@ create_new_program(struct gl_context *ctx, struct state_key *key,
    p.program->Base.Parameters = _mesa_new_parameter_list();
    p.program->Base.InputsRead = 0x0;
 
-   if (key->num_draw_buffers == 1)
+   if (key->num_draw_buffers >= 1)
       p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLOR;
-   else {
-      for (i = 0; i < key->num_draw_buffers; i++)
-	 p.program->Base.OutputsWritten |= (1 << (FRAG_RESULT_DATA0 + i));
-   }
 
    for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
       p.src_texture[unit] = undef;
@@ -1505,12 +1500,8 @@ create_new_program(struct gl_context *ctx, struct state_key *key,
 
    cf = get_source( &p, SRC_PREVIOUS, 0 );
 
-   for (i = 0; i < key->num_draw_buffers; i++) {
-      if (key->num_draw_buffers == 1)
-	 out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLOR );
-      else {
-	 out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_DATA0 + i );
-      }
+   if (key->num_draw_buffers >= 1) {
+      out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLOR );
 
       if (key->separate_specular) {
 	 /* Emit specular add.



More information about the mesa-commit mailing list