[Mesa-dev] Optimize GLSL clamp operation

Abdiel Janulgue abdiel.janulgue at linux.intel.com
Mon Jun 23 22:32:27 PDT 2014


Optimize clamp(x, 0, 1), clamp(x, 0.0, b), where b < 1.0,
and clamp(x, b, 1.0), where b > 0.0 as saturate operations.

Shader-db output:

helped: shaders/0ad/9.shader_test fs16:                   38 -> 37 (-2.63%)
helped: shaders/0ad/9.shader_test fs8:                    38 -> 37 (-2.63%)
helped: shaders/gst-gl-tunnel.frag fs16:                  65 -> 64 (-1.54%)
helped: shaders/gst-gl-tunnel.frag fs8:                   65 -> 64 (-1.54%)

total instructions in shared programs: 41800 -> 41796 (-0.01%)
instructions in affected programs:     206 -> 202 (-1.94%)
GAINED:                                0
LOST:                                  0

 src/glsl/opt_algebraic.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)



More information about the mesa-dev mailing list