i965: Fix undefined df bits in brw_reg comparisons.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 13 May 2016 23:41:13 +0000 (16:41 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Sat, 14 May 2016 07:18:37 +0000 (00:18 -0700)
commit59156b2e96315910f1e929c14c5b25ce88f75911
treea69391012a086db66ffc5d77b9d6008a57ab72d5
parent9f8867d8779c7f402b9614ec334924aafc58cd64
i965: Fix undefined df bits in brw_reg comparisons.

Commit 5310bca024f77da40ea6f4c275455f9cb0528f9e added a new "double df"
field to the brw_reg struct, adding an extra 4 bytes of data that isn't
usually initialized (or may contain irrelevant garbage if the struct is
mutated).  This means that it's no longer safe to memcmp().

Instead, add a brw_regs_equal() function which ignores the extra df bits
unless they matter.  To keep the implementation cheap, we wrap the first
set of fields in a union/struct so that we can use a single DWord
comparison.

v2: Drop unnecessary casts (caught by Francisco Jerez).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
src/mesa/drivers/dri/i965/brw_fs_generator.cpp
src/mesa/drivers/dri/i965/brw_reg.h
src/mesa/drivers/dri/i965/brw_shader.cpp
src/mesa/drivers/dri/i965/brw_vec4_generator.cpp