diff options
author | Jonathan Marek <[email protected]> | 2020-06-20 23:20:32 -0400 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-06-25 03:02:56 +0000 |
commit | 9c0ae5704d654108fd36b8de3f7364601ba30c53 (patch) | |
tree | e6b35aec01d80991b9c8dac39a83f558ee85ba19 /src/freedreno | |
parent | 7c008c293d7b220eec0c98cefb794cab95ee344e (diff) |
turnip: fix empty scissor case
Fixes these two tests:
dEQP-VK.draw.scissor.empty_dynamic_scissor_first_draw
dEQP-VK.draw.scissor.empty_static_scissor
Signed-off-by: Jonathan Marek <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5586>
Diffstat (limited to 'src/freedreno')
-rw-r--r-- | src/freedreno/vulkan/tu_pipeline.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/freedreno/vulkan/tu_pipeline.c b/src/freedreno/vulkan/tu_pipeline.c index add032bcc74..281695d16cb 100644 --- a/src/freedreno/vulkan/tu_pipeline.c +++ b/src/freedreno/vulkan/tu_pipeline.c @@ -1547,17 +1547,21 @@ tu6_emit_viewport(struct tu_cs *cs, const VkViewport *viewport) void tu6_emit_scissor(struct tu_cs *cs, const VkRect2D *scissor) { - const VkOffset2D min = scissor->offset; - const VkOffset2D max = { + VkOffset2D min = scissor->offset; + VkOffset2D max = { scissor->offset.x + scissor->extent.width, scissor->offset.y + scissor->extent.height, }; - tu_cs_emit_pkt4(cs, REG_A6XX_GRAS_SC_SCREEN_SCISSOR_TL_0, 2); - tu_cs_emit(cs, A6XX_GRAS_SC_SCREEN_SCISSOR_TL_0_X(min.x) | - A6XX_GRAS_SC_SCREEN_SCISSOR_TL_0_Y(min.y)); - tu_cs_emit(cs, A6XX_GRAS_SC_SCREEN_SCISSOR_TL_0_X(max.x - 1) | - A6XX_GRAS_SC_SCREEN_SCISSOR_TL_0_Y(max.y - 1)); + /* special case for empty scissor with max == 0 to avoid overflow */ + if (max.x == 0) + min.x = max.x = 1; + if (max.y == 0) + min.y = max.y = 1; + + tu_cs_emit_regs(cs, + A6XX_GRAS_SC_SCREEN_SCISSOR_TL_0(.x = min.x, .y = min.y), + A6XX_GRAS_SC_SCREEN_SCISSOR_BR_0(.x = max.x - 1, .y = max.y - 1)); } void |