diff options
author | Paul Berry <[email protected]> | 2012-12-05 10:19:19 -0800 |
---|---|---|
committer | Paul Berry <[email protected]> | 2012-12-14 10:49:12 -0800 |
commit | f3993107f0b997195c4d97b95c47e84220f10b6d (patch) | |
tree | ad54b867da0db60a52c48d7c5136c450f6101650 /src/glsl/opt_function_inlining.cpp | |
parent | eb989e37cb7ed2e3268959bdd869dc305177e468 (diff) |
glsl/linker: Sort varyings by packing class, then vector size.
This patch paves the way for varying packing by adding a sorting step
before varying assignment, which sorts the varyings into an order that
increases the likelihood of being able to find an efficient packing.
First, varyings are sorted into "packing classes" by considering
attributes that can't be mixed during varying packing--at the moment
this includes base type (float/int/uint/bool) and interpolation mode
(smooth/noperspective/flat/centroid), though later we will hopefully
be able to relax some of these restrictions. The number of packing
classes places an upper limit on the amount of space that must be
wasted by varying packing, since in theory a shader might nave 4n+1
components worth of varyings in each of m packing classes, resulting
in 3m components worth of wasted space.
Then, within each packing class, varyings are sorted by vector size,
with vec4's coming first, then vec2's, then scalars, and then finally
vec3's. The motivation for this order is that it ensures that the
only vectors that might be "double parked" (with part of the vector in
one varying slot and the remainder in another) are vec3's.
Note that the varyings aren't actually packed yet, merely placed in an
order that will facilitate packing.
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/glsl/opt_function_inlining.cpp')
0 files changed, 0 insertions, 0 deletions