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

Author: Samuel Pitoiset <[email protected]>
Date:   Mon Apr  3 10:11:21 2023 +0200

radv: allow to create/insert PS epilogs from/to the cache for libs

To cache PS epilogs compiled inside graphics pipeline libraries.

Signed-off-by: Samuel Pitoiset <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22264>

---

 src/amd/vulkan/radv_pipeline_cache.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/amd/vulkan/radv_pipeline_cache.c 
b/src/amd/vulkan/radv_pipeline_cache.c
index 48802dc10ec..637d90fbc0a 100644
--- a/src/amd/vulkan/radv_pipeline_cache.c
+++ b/src/amd/vulkan/radv_pipeline_cache.c
@@ -408,9 +408,11 @@ radv_create_shaders_from_pipeline_cache(struct radv_device 
*device,
    }
 
    if (entry->ps_epilog) {
-      struct radv_graphics_pipeline *graphics_pipeline = 
radv_pipeline_to_graphics(pipeline);
-
-      graphics_pipeline->ps_epilog = entry->ps_epilog;
+      if (pipeline->type == RADV_PIPELINE_GRAPHICS) {
+         radv_pipeline_to_graphics(pipeline)->ps_epilog = entry->ps_epilog;
+      } else {
+         radv_pipeline_to_graphics_lib(pipeline)->base.ps_epilog = 
entry->ps_epilog;
+      }
    }
 
    assert(num_rt_groups == entry->num_stack_sizes);
@@ -560,10 +562,16 @@ radv_pipeline_cache_insert_shaders(struct radv_device 
*device, struct radv_pipel
    }
 
    if (ps_epilog_binary) {
-      struct radv_graphics_pipeline *graphics_pipeline = 
radv_pipeline_to_graphics(pipeline);
+      struct radv_shader_part *ps_epilog = NULL;
+
+      if (pipeline->type == RADV_PIPELINE_GRAPHICS) {
+         ps_epilog = radv_pipeline_to_graphics(pipeline)->ps_epilog;
+      } else {
+         ps_epilog = radv_pipeline_to_graphics_lib(pipeline)->base.ps_epilog;
+      }
 
-      entry->ps_epilog = graphics_pipeline->ps_epilog;
-      radv_shader_part_ref(graphics_pipeline->ps_epilog);
+      entry->ps_epilog = ps_epilog;
+      radv_shader_part_ref(ps_epilog);
    }
 
    radv_pipeline_cache_add_entry(cache, entry);

Reply via email to