OSDN Git Service

i965: vs optimization fix: Check val.{negate,abs} in accumulator_contains()
authorPaul Berry <stereotype441@gmail.com>
Fri, 22 Jul 2011 21:05:52 +0000 (14:05 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 28 Jul 2011 18:47:45 +0000 (11:47 -0700)
commit2d64d34cb99c0e8144a1127475e593ee1efed555
tree51fc888740305f8cefccccc82cfab87f2eb1d6a7
parent66b41af39119cced3dbdc1c9a8995df51539d887
i965: vs optimization fix: Check val.{negate,abs} in accumulator_contains()

When emitting a MAC instruction in a vertex shader, brw_vs_emit()
calls accumulator_contains() to determine whether the accumulator
already contains the appropriate addend; if it does, then we can avoid
emitting an unnecessary MOV instruction.

However, accumulator_contains() wasn't checking the val.negate or
val.abs flags.  As a result, if the desired value was the negation, or
the absolute value, of what was already in the accumulator, we would
generate an incorrect shader.

Fixes piglit test vs-refract-vec4-vec4-float.

Tested on Gen5 and Gen6.

Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit d92463d5dc42aca09a54588c322fc60582cf9131)
src/mesa/drivers/dri/i965/brw_vs_emit.c