Mesa (staging/22.1): lavapipe: copy more pNexts for pipeline creation

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 27 16:23:25 UTC 2022


Module: Mesa
Branch: staging/22.1
Commit: d5bcbab926a319f24db1ec839bb77717a3144e05
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d5bcbab926a319f24db1ec839bb77717a3144e05

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed Jun 22 17:06:53 2022 -0400

lavapipe: copy more pNexts for pipeline creation

also add some unreachable() handlers for unknown types

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17219>
(cherry picked from commit 7018b630edd90776029803c3b41df8dbdcaacd45)

---

 .pick_status.json                             |  2 +-
 src/gallium/frontends/lavapipe/lvp_pipeline.c | 46 +++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index d0ccf43838e..e5675b77100 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -301,7 +301,7 @@
         "description": "lavapipe: copy more pNexts for pipeline creation",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/frontends/lavapipe/lvp_pipeline.c b/src/gallium/frontends/lavapipe/lvp_pipeline.c
index 2edfafd7dbc..6b016035575 100644
--- a/src/gallium/frontends/lavapipe/lvp_pipeline.c
+++ b/src/gallium/frontends/lavapipe/lvp_pipeline.c
@@ -158,6 +158,7 @@ deep_copy_vertex_input_state(void *mem_ctx,
             break;
          }
          default:
+            unreachable("unhandled pNext!");
             break;
          }
       }
@@ -213,6 +214,24 @@ deep_copy_viewport_state(void *mem_ctx,
    else
       dst->scissorCount = 0;
 
+   if (src->pNext) {
+      vk_foreach_struct(ext, src->pNext) {
+         switch (ext->sType) {
+         case VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_DEPTH_CLIP_CONTROL_CREATE_INFO_EXT: {
+            VkPipelineViewportDepthClipControlCreateInfoEXT *ext_src = (VkPipelineViewportDepthClipControlCreateInfoEXT *)ext;
+            VkPipelineViewportDepthClipControlCreateInfoEXT *ext_dst = ralloc(mem_ctx, VkPipelineViewportDepthClipControlCreateInfoEXT);
+            memcpy(ext_dst, ext_src, sizeof(*ext_dst));
+            ext_dst->pNext = dst->pNext;
+            dst->pNext = ext_dst;
+            break;
+         }
+         default:
+            unreachable("unhandled pNext!");
+            break;
+         }
+      }
+   }
+
    return VK_SUCCESS;
 }
 
@@ -323,12 +342,33 @@ deep_copy_rasterization_state(void *mem_ctx,
             VkPipelineRasterizationDepthClipStateCreateInfoEXT *ext_src = (VkPipelineRasterizationDepthClipStateCreateInfoEXT *)ext;
             VkPipelineRasterizationDepthClipStateCreateInfoEXT *ext_dst = ralloc(mem_ctx, VkPipelineRasterizationDepthClipStateCreateInfoEXT);
             ext_dst->sType = ext_src->sType;
+            ext_dst->pNext = dst->pNext;
             ext_dst->flags = ext_src->flags;
             ext_dst->depthClipEnable = ext_src->depthClipEnable;
             dst->pNext = ext_dst;
             break;
          }
+         case VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_PROVOKING_VERTEX_STATE_CREATE_INFO_EXT: {
+            VkPipelineRasterizationProvokingVertexStateCreateInfoEXT *ext_src = (VkPipelineRasterizationProvokingVertexStateCreateInfoEXT *)ext;
+            VkPipelineRasterizationProvokingVertexStateCreateInfoEXT *ext_dst = ralloc(mem_ctx, VkPipelineRasterizationProvokingVertexStateCreateInfoEXT);
+            memcpy(ext_dst, ext_src, sizeof(*ext_dst));
+            ext_dst->pNext = dst->pNext;
+            dst->pNext = ext_dst;
+            break;
+         }
+         case VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_LINE_STATE_CREATE_INFO_EXT: {
+            VkPipelineRasterizationLineStateCreateInfoEXT *ext_src = (VkPipelineRasterizationLineStateCreateInfoEXT *)ext;
+            VkPipelineRasterizationLineStateCreateInfoEXT *ext_dst = ralloc(mem_ctx, VkPipelineRasterizationLineStateCreateInfoEXT);
+            memcpy(ext_dst, ext_src, sizeof(*ext_dst));
+            ext_dst->pNext = dst->pNext;
+            dst->pNext = ext_dst;
+            break;
+         }
+         case VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_STREAM_CREATE_INFO_EXT:
+            /* do nothing */
+            break;
          default:
+            unreachable("unhandled pNext!");
             break;
          }
       }
@@ -359,6 +399,12 @@ deep_copy_graphics_create_info(void *mem_ctx,
       dst->subpass = src->subpass;
       dst->renderPass = src->renderPass;
       rp_info = vk_get_pipeline_rendering_create_info(src);
+      if (rp_info && !src->renderPass) {
+         VkPipelineRenderingCreateInfoKHR *r = ralloc(mem_ctx, VkPipelineRenderingCreateInfoKHR);
+         memcpy(r, rp_info, sizeof(VkPipelineRenderingCreateInfoKHR));
+         r->pNext = NULL;
+         dst->pNext = r;
+      }
    }
    bool has_depth = false;
    bool has_stencil = false;



More information about the mesa-commit mailing list