Mesa (main): v3dv: don't try to access pColorBlendState if rasterization is disabled

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Aug 12 10:19:55 UTC 2021


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

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Thu Aug 12 09:26:40 2021 +0200

v3dv: don't try to access pColorBlendState if rasterization is disabled

Fixes:
dEQP-VK.api.pipeline.pipeline_invalid_pointers_unused_structs.graphics

Reviewed-by: Juan A. Suarez <jasuarez at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12337>

---

 src/broadcom/vulkan/v3dv_pipeline.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c
index aaf828ac426..5f05bd3867d 100644
--- a/src/broadcom/vulkan/v3dv_pipeline.c
+++ b/src/broadcom/vulkan/v3dv_pipeline.c
@@ -1140,7 +1140,8 @@ pipeline_populate_v3d_fs_key(struct v3d_fs_key *key,
    key->has_gs = has_geometry_shader;
 
    const VkPipelineColorBlendStateCreateInfo *cb_info =
-      pCreateInfo->pColorBlendState;
+      !pCreateInfo->pRasterizationState->rasterizerDiscardEnable ?
+      pCreateInfo->pColorBlendState : NULL;
 
    key->logicop_func = cb_info && cb_info->logicOpEnable == VK_TRUE ?
                        vk_to_pipe_logicop[cb_info->logicOp] :
@@ -1955,19 +1956,20 @@ pipeline_populate_graphics_key(struct v3dv_pipeline *pipeline,
    key->robust_buffer_access =
       pipeline->device->features.robustBufferAccess;
 
+   const bool raster_enabled =
+      !pCreateInfo->pRasterizationState->rasterizerDiscardEnable;
+
    const VkPipelineInputAssemblyStateCreateInfo *ia_info =
       pCreateInfo->pInputAssemblyState;
    key->topology = vk_to_pipe_prim_type[ia_info->topology];
 
    const VkPipelineColorBlendStateCreateInfo *cb_info =
-      pCreateInfo->pColorBlendState;
+      raster_enabled ? pCreateInfo->pColorBlendState : NULL;
+
    key->logicop_func = cb_info && cb_info->logicOpEnable == VK_TRUE ?
       vk_to_pipe_logicop[cb_info->logicOp] :
       PIPE_LOGICOP_COPY;
 
-   const bool raster_enabled =
-      !pCreateInfo->pRasterizationState->rasterizerDiscardEnable;
-
    /* Multisample rasterization state must be ignored if rasterization
     * is disabled.
     */



More information about the mesa-commit mailing list