From c9c848dedeacc1e0296f5d53f0c6a7745aca9f12 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Fri, 17 Jul 2020 15:18:15 +0200 Subject: [PATCH] tu: Use common guardband helper Part-of: --- src/freedreno/vulkan/tu_pipeline.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/freedreno/vulkan/tu_pipeline.c b/src/freedreno/vulkan/tu_pipeline.c index 84c578ae53e..062102c02fb 100644 --- a/src/freedreno/vulkan/tu_pipeline.c +++ b/src/freedreno/vulkan/tu_pipeline.c @@ -25,6 +25,7 @@ * DEALINGS IN THE SOFTWARE. */ +#include "common/freedreno_guardband.h" #include "tu_private.h" #include "ir3/ir3_nir.h" @@ -1498,15 +1499,6 @@ tu6_emit_vertex_input(struct tu_cs *cs, .decode_cnt = vfd_decode_idx)); } -static uint32_t -tu6_guardband_adj(uint32_t v) -{ - if (v > 256) - return (uint32_t)(511.0 - 65.0 * (log2(v) - 8.0)); - else - return 511; -} - void tu6_emit_viewport(struct tu_cs *cs, const VkViewport *viewport) { @@ -1537,8 +1529,8 @@ tu6_emit_viewport(struct tu_cs *cs, const VkViewport *viewport) assert(min.y >= 0 && min.y < max.y); VkExtent2D guardband_adj; - guardband_adj.width = tu6_guardband_adj(max.x - min.x); - guardband_adj.height = tu6_guardband_adj(max.y - min.y); + guardband_adj.width = fd_calc_guardband(offsets[0], scales[0], false); + guardband_adj.height = fd_calc_guardband(offsets[1], scales[1], false); tu_cs_emit_regs(cs, A6XX_GRAS_CL_VPORT_XOFFSET(0, offsets[0]), -- 2.30.2