Mesa (master): mesa: Actually use the Mesa IR optimizer for ARB programs.

Kenneth Graunke kwg at kemper.freedesktop.org
Mon Aug 4 22:47:29 UTC 2014


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Sat Aug  2 05:33:14 2014 -0700

mesa: Actually use the Mesa IR optimizer for ARB programs.

On Haswell, this cuts 1-3 instructions from 183 vertex shaders in
"Shadowrun Returns", "Shatter", and "Trine 2."  It adds 2 instructions
to a single fragment shader in "Closure."

total instructions in shared programs: 278803 -> 278546 (-0.09%)
instructions in affected programs:     41930 -> 41673 (-0.61%)

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/program/arbprogparse.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/mesa/program/arbprogparse.c b/src/mesa/program/arbprogparse.c
index 5b96650..7dec399 100644
--- a/src/mesa/program/arbprogparse.c
+++ b/src/mesa/program/arbprogparse.c
@@ -60,6 +60,7 @@ having three separate program parameter arrays.
 #include "prog_parameter.h"
 #include "prog_statevars.h"
 #include "prog_instruction.h"
+#include "prog_optimize.h"
 #include "program_parser.h"
 
 
@@ -84,6 +85,9 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
       return;
    }
 
+   if ((ctx->_Shader->Flags & GLSL_NO_OPT) == 0)
+      _mesa_optimize_program(ctx, &prog);
+
    free(program->Base.String);
 
    /* Copy the relevant contents of the arb_program struct into the
@@ -177,6 +181,9 @@ _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
       return;
    }
 
+   if ((ctx->_Shader->Flags & GLSL_NO_OPT) == 0)
+      _mesa_optimize_program(ctx, &prog);
+
    free(program->Base.String);
 
    /* Copy the relevant contents of the arb_program struct into the 




More information about the mesa-commit mailing list