nv50/ir: always return 0 when trying to read thread id along unit dim
authorIlia Mirkin <imirkin@alum.mit.edu>
Thu, 26 Jan 2017 03:16:56 +0000 (22:16 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Thu, 9 Feb 2017 20:15:36 +0000 (15:15 -0500)
commite4a698cb97224ef22469b0d8fd703cf164d380f1
tree3bd121d85c5453d858e6bb5fad10b39c73a98c50
parent1acdd62847cf0da8a8e9c7915d698208d73a5be8
nv50/ir: always return 0 when trying to read thread id along unit dim

Many many many compute shaders only define a 1- or 2-dimensional block,
but then continue to use system values that take the full 3d into
account (like gl_LocalInvocationIndex, etc). So for the special case
that a dimension is exactly 1, we know that the thread id along that
axis will always be 0, so return it as such and allow constant folding
to fix things up.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
src/gallium/drivers/nouveau/codegen/nv50_ir_target.h