glsl/linker: eliminate unused and set-but-unused built-in varyings
authorMarek Olšák <maraeo@gmail.com>
Wed, 12 Jun 2013 11:23:48 +0000 (13:23 +0200)
committerMarek Olšák <maraeo@gmail.com>
Tue, 2 Jul 2013 15:02:14 +0000 (17:02 +0200)
commitb3d8b4c0b423539f17c13713673cfeb6d66ff7ed
tree58ea816c6292ff40f5b820a1bdc2398b78708ebd
parent3c555827c3e2fdb84ee4b4b8fd8296985cbb1fda
glsl/linker: eliminate unused and set-but-unused built-in varyings

This eliminates built-in varyings such as gl_Color, gl_SecondaryColor,
gl_TexCoord, and gl_FogFragCoord if they are unused by the next stage or
not written at all (e.g. gl_TexCoord elements). The gl_TexCoord array is
broken down into separate vec4s if needed.

v2: - use a switch statement in varying_info_visitor::visit(ir_variable*)
    - use snprintf
    - disable the optimization for GLES2

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/Makefile.sources
src/glsl/ir_optimization.h
src/glsl/link_varyings.h
src/glsl/linker.cpp
src/glsl/opt_dead_builtin_varyings.cpp [new file with mode: 0644]