From fe9a2374e6d5514739cff14cf24017e8c190e660 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 26 May 2022 14:32:17 -0700 Subject: [PATCH] turnip: include stencil test for drawcall costs Stencil test reads from and writes to the stencil buffer. Part-of: --- src/freedreno/vulkan/tu_cmd_buffer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/freedreno/vulkan/tu_cmd_buffer.c b/src/freedreno/vulkan/tu_cmd_buffer.c index abd600d8ed9..4ef64585922 100644 --- a/src/freedreno/vulkan/tu_cmd_buffer.c +++ b/src/freedreno/vulkan/tu_cmd_buffer.c @@ -3992,11 +3992,17 @@ tu6_draw_common(struct tu_cmd_buffer *cmd, cmd->state.drawcall_count++; cmd->state.total_drawcalls_cost += cmd->state.pipeline->drawcall_base_cost; + + /* add depth memory bandwidth cost */ if (cmd->state.rb_depth_cntl & A6XX_RB_DEPTH_CNTL_Z_WRITE_ENABLE) cmd->state.total_drawcalls_cost++; if (cmd->state.rb_depth_cntl & A6XX_RB_DEPTH_CNTL_Z_TEST_ENABLE) cmd->state.total_drawcalls_cost++; + /* add stencil memory bandwidth cost */ + if (cmd->state.rb_stencil_cntl & A6XX_RB_STENCIL_CONTROL_STENCIL_ENABLE) + cmd->state.total_drawcalls_cost += 2; + tu_emit_cache_flush_renderpass(cmd, cs); bool primitive_restart_enabled = pipeline->ia.primitive_restart;