panvk: Gate rasterization on !discard, not fs req
authorAlyssa Rosenzweig <alyssa@collabora.com>
Wed, 27 Apr 2022 22:54:49 +0000 (18:54 -0400)
committerMarge Bot <emma+marge@anholt.net>
Mon, 2 May 2022 13:12:31 +0000 (13:12 +0000)
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@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16204>

src/panfrost/vulkan/panvk_private.h
src/panfrost/vulkan/panvk_vX_cmd_buffer.c
src/panfrost/vulkan/panvk_vX_pipeline.c

index f44356a..e1e54ba 100644 (file)
@@ -870,6 +870,7 @@ struct panvk_pipeline {
       bool front_ccw;
       bool cull_front_face;
       bool cull_back_face;
+      bool enable;
    } rast;
 
    struct {
index a15ebb5..e9b3690 100644 (file)
@@ -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);
index 880f698..753546d 100644 (file)
@@ -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