nir/lower_tex: add support to clamp texture coords
authorRob Clark <robclark@freedesktop.org>
Fri, 18 Sep 2015 14:44:27 +0000 (10:44 -0400)
committerRob Clark <robclark@freedesktop.org>
Sat, 19 Sep 2015 01:07:49 +0000 (21:07 -0400)
commit3745c38425b3e1da5c94a5f900eb5fdc44da9439
tree65c54abf5346216f4e5ab90a13bb3fa9a91f1bdd
parent1ce8060c25c7f2c7a54159fab6a6974c0ba182a8
nir/lower_tex: add support to clamp texture coords

Some hardware needs to clamp texture coordinates to [0.0, 1.0] in the
shader to emulate GL_CLAMP.  This is added to lower_tex_proj since, in
the case of projected coords, the clamping needs to happen *after*
projection.

v2: comments/suggestions from Ilia and Eric, use txs to get texture size
and clamp RECT textures to their dimensions rather than [0.0, 1.0] to
avoid having to lower RECT textures to 2D.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/nir/nir.h
src/glsl/nir/nir_lower_tex.c