OSDN Git Service

i965/vec4: Ignore swizzle of VGRF for use by var_range_end().
authorMatt Turner <mattst88@gmail.com>
Thu, 18 Aug 2016 22:54:47 +0000 (15:54 -0700)
committerEmil Velikov <emil.l.velikov@gmail.com>
Thu, 1 Sep 2016 10:39:43 +0000 (11:39 +0100)
commitbf61f2e5c3daf257fcfb0d484df05bad59265887
treef03481a644624b20d86ca45f6f5191d9874d44a9
parentd2f0a2925f2f1cd3d95e36f0cc8540371257641b
i965/vec4: Ignore swizzle of VGRF for use by var_range_end().

var_range_end(v, n) loops over the n components of variable number v and
finds the maximum value, giving the last use of any component of v.
Therefore it expects v to correspond to the variable associated with the
.x channel of the VGRF.

var_from_reg() however returns the variable for the first channel of the
VGRF, post-swizzle.

So, if the last register had a swizzle with y, z, or w in the swizzle
component, we would read out of bounds. For any other register, we would
read liveness information from the next register.

The fix is to convert the src_reg to a dst_reg in order to call the
dst_reg version of var_from_reg() that doesn't consider the swizzle.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit e7c376adfdecd4c1333997c8be8bb066a87c67b4)
src/mesa/drivers/dri/i965/brw_vec4.cpp
src/mesa/drivers/dri/i965/brw_vec4_cse.cpp