i965: Fix cube array coordinate normalization
authorChris Forbes <chrisf@ijw.co.nz>
Sun, 15 Sep 2013 10:25:45 +0000 (22:25 +1200)
committerChris Forbes <chrisf@ijw.co.nz>
Thu, 26 Sep 2013 06:24:22 +0000 (18:24 +1200)
commitfe2528c0b69d5719b15d926ada9424cac7569b9c
tree68db9405f6eebadab83caa0f5e2e2f1c24c7063b
parentd83ef680e2c6d11c446aae16a65445f12984fb85
i965: Fix cube array coordinate normalization

Hardware requires the magnitude of the largest component to not exceed
1; brw_cubemap_normalize ensures that this is the case.

Unfortunately, we would previously multiply the array index for cube
arrays by the normalization factor. The incorrect array index would then
cause the sampler to attempt to access either the wrong cube, or memory
outside the cube surface entirely, resulting in garbage rendering or in
the worst case, hangs.

Alter the normalization pass to only multiply the .xyz components.

Fixes broken rendering in the arb_texture_cube_map_array-cubemap piglit,
which was recently adjusted to provoke this behavior.

V2: Fix indent.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Cc: "9.2" mesa-stable@lists.freedesktop.org
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_cubemap_normalize.cpp