radv: fix scissor computation when using half-pixel viewport offset
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 17 Apr 2018 20:07:26 +0000 (22:07 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 17 Apr 2018 20:12:14 +0000 (22:12 +0200)
'scale[i]' can be non-integer.

Original patch by Philip Rebohle.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106074
Fixes: 0f3de89a56a ("radv: Use the guard band.")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Niuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/si_cmd_buffer.c

index aed291be35d68349437c83a0cb72bc31d0b33419..15edaa4b2b51caf1b3936d118e5194ac834ac1ce 100644 (file)
@@ -663,10 +663,10 @@ static VkRect2D si_scissor_from_viewport(const VkViewport *viewport)
 
        get_viewport_xform(viewport, scale, translate);
 
-       rect.offset.x = translate[0] - abs(scale[0]);
-       rect.offset.y = translate[1] - abs(scale[1]);
-       rect.extent.width = ceilf(translate[0] + abs(scale[0])) - rect.offset.x;
-       rect.extent.height = ceilf(translate[1] + abs(scale[1])) - rect.offset.y;
+       rect.offset.x = translate[0] - fabs(scale[0]);
+       rect.offset.y = translate[1] - fabs(scale[1]);
+       rect.extent.width = ceilf(translate[0] + fabs(scale[0])) - rect.offset.x;
+       rect.extent.height = ceilf(translate[1] + fabs(scale[1])) - rect.offset.y;
 
        return rect;
 }