lavapipe: copy fragment shader when merging GPL pipelines
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Thu, 6 Apr 2023 23:08:06 +0000 (19:08 -0400)
committerMarge Bot <emma+marge@anholt.net>
Mon, 10 Apr 2023 21:35:57 +0000 (21:35 +0000)
this otherwise loses access data and causes flakiness with atomic ops

Fixes: 6e5fe71599b ("lavapipe: split out shader struct members into their own struct")

Reviewed-by: Brian Paul <brianp@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22352>

src/gallium/frontends/lavapipe/lvp_pipeline.c

index 5468aba..8fb207d 100644 (file)
@@ -830,8 +830,12 @@ lvp_graphics_pipeline_init(struct lvp_pipeline *pipeline,
                pipeline->shaders[i].tess_ccw = NULL; //this gets handled later
             }
          }
-         if (p->stages & VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_SHADER_BIT_EXT)
+         if (p->stages & VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_SHADER_BIT_EXT) {
             pipeline->force_min_sample = p->force_min_sample;
+            memcpy(&pipeline->shaders[MESA_SHADER_FRAGMENT], &p->shaders[MESA_SHADER_FRAGMENT], sizeof(struct lvp_shader));
+            pipeline->shaders[MESA_SHADER_FRAGMENT].pipeline_nir = NULL; //this gets handled later
+            pipeline->shaders[MESA_SHADER_FRAGMENT].tess_ccw = NULL; //this gets handled later
+         }
          if (p->stages & layout_stages) {
             if (!layout || (layout->vk.create_flags & VK_PIPELINE_LAYOUT_CREATE_INDEPENDENT_SETS_BIT_EXT))
                merge_layouts(&device->vk, pipeline, p->layout);