From: Samuel Pitoiset Date: Tue, 17 Apr 2018 20:07:26 +0000 (+0200) Subject: radv: fix scissor computation when using half-pixel viewport offset X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=893e19efb74edd6133a607e09338bf5d449632f1;p=mesa.git radv: fix scissor computation when using half-pixel viewport offset '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 Reviewed-by: Bas Niuwenhuizen --- diff --git a/src/amd/vulkan/si_cmd_buffer.c b/src/amd/vulkan/si_cmd_buffer.c index aed291be35d..15edaa4b2b5 100644 --- a/src/amd/vulkan/si_cmd_buffer.c +++ b/src/amd/vulkan/si_cmd_buffer.c @@ -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; }