Mesa (main): panvk: Gate rasterization on !discard, not fs req

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 2 13:28:49 UTC 2022


Module: Mesa
Branch: main
Commit: dcf8cdde68b14a9e5cd7b00296de19c62ac82c17
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dcf8cdde68b14a9e5cd7b00296de19c62ac82c17

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Wed Apr 27 18:54:49 2022 -0400

panvk: Gate rasterization on !discard, not fs req

The "fragment shader required?" computed state is about fragment shader side
effects. There may be no fragment shader required but depth/stencil side effects
meaning that rasterization is nonoptional. What actually gates rasterization is
the rasterizer discard bit. Use that instead.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16204>

---

 src/panfrost/vulkan/panvk_private.h       | 1 +
 src/panfrost/vulkan/panvk_vX_cmd_buffer.c | 4 ++--
 src/panfrost/vulkan/panvk_vX_pipeline.c   | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/panfrost/vulkan/panvk_private.h b/src/panfrost/vulkan/panvk_private.h
index f44356ab28c..e1e54bae0e2 100644
--- a/src/panfrost/vulkan/panvk_private.h
+++ b/src/panfrost/vulkan/panvk_private.h
@@ -870,6 +870,7 @@ struct panvk_pipeline {
       bool front_ccw;
       bool cull_front_face;
       bool cull_back_face;
+      bool enable;
    } rast;
 
    struct {
diff --git a/src/panfrost/vulkan/panvk_vX_cmd_buffer.c b/src/panfrost/vulkan/panvk_vX_cmd_buffer.c
index a15ebb5dea8..e9b36902f3c 100644
--- a/src/panfrost/vulkan/panvk_vX_cmd_buffer.c
+++ b/src/panfrost/vulkan/panvk_vX_cmd_buffer.c
@@ -900,7 +900,7 @@ panvk_cmd_draw(struct panvk_cmd_buffer *cmdbuf,
       batch = panvk_cmd_open_batch(cmdbuf);
    }
 
-   if (pipeline->fs.required)
+   if (pipeline->rast.enable)
       panvk_per_arch(cmd_alloc_fb_desc)(cmdbuf);
 
    panvk_per_arch(cmd_alloc_tls_desc)(cmdbuf, true);
@@ -949,7 +949,7 @@ panvk_cmd_draw(struct panvk_cmd_buffer *cmdbuf,
                        MALI_JOB_TYPE_VERTEX, false, false, 0, 0,
                        &draw->jobs.vertex, false);
 
-   if (pipeline->fs.required) {
+   if (pipeline->rast.enable) {
       panfrost_add_job(&cmdbuf->desc_pool.base, &batch->scoreboard,
                        MALI_JOB_TYPE_TILER, false, false, vjob_id, 0,
                        &draw->jobs.tiler, false);
diff --git a/src/panfrost/vulkan/panvk_vX_pipeline.c b/src/panfrost/vulkan/panvk_vX_pipeline.c
index 880f698dbf2..753546d1d2a 100644
--- a/src/panfrost/vulkan/panvk_vX_pipeline.c
+++ b/src/panfrost/vulkan/panvk_vX_pipeline.c
@@ -760,6 +760,7 @@ panvk_pipeline_builder_parse_rast(struct panvk_pipeline_builder *builder,
    pipeline->rast.cull_front_face = builder->create_info.gfx->pRasterizationState->cullMode & VK_CULL_MODE_FRONT_BIT;
    pipeline->rast.cull_back_face = builder->create_info.gfx->pRasterizationState->cullMode & VK_CULL_MODE_BACK_BIT;
    pipeline->rast.line_width = builder->create_info.gfx->pRasterizationState->lineWidth;
+   pipeline->rast.enable = !builder->create_info.gfx->pRasterizationState->rasterizerDiscardEnable;
 }
 
 static bool



More information about the mesa-commit mailing list