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

Author: Samuel Pitoiset <[email protected]>
Date:   Thu Aug 25 17:19:12 2022 +0200

radv: import PS epilog from libraries if present

This enables using PS epilogs with GPL.

Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timur Kristóf <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18255>

---

 src/amd/vulkan/radv_pipeline.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 72ab2f75f3b..c344dd43ebf 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -197,6 +197,9 @@ radv_pipeline_destroy(struct radv_device *device, struct 
radv_pipeline *pipeline
    if (pipeline->type == RADV_PIPELINE_GRAPHICS) {
       struct radv_graphics_pipeline *graphics_pipeline = 
radv_pipeline_to_graphics(pipeline);
 
+      if (graphics_pipeline->ps_epilog)
+         radv_shader_part_unref(device, graphics_pipeline->ps_epilog);
+
       vk_free(&device->vk.alloc, graphics_pipeline->state_data);
    } else if (pipeline->type == RADV_PIPELINE_COMPUTE) {
       struct radv_compute_pipeline *compute_pipeline = 
radv_pipeline_to_compute(pipeline);
@@ -1610,6 +1613,12 @@ radv_graphics_pipeline_import_lib(struct 
radv_graphics_pipeline *pipeline,
       pipeline->base.retained_shaders[s] = lib->base.base.retained_shaders[s];
    }
 
+   /* Import the PS epilog if present. */
+   if (lib->base.ps_epilog) {
+      assert(!pipeline->ps_epilog);
+      pipeline->ps_epilog = radv_shader_part_ref(lib->base.ps_epilog);
+   }
+
    /* Import the pipeline layout. */
    struct radv_pipeline_layout *lib_layout = &lib->layout;
    for (uint32_t s = 0; s < lib_layout->num_sets; s++) {
@@ -2766,7 +2775,7 @@ radv_generate_graphics_pipeline_key(const struct 
radv_graphics_pipeline *pipelin
    if (device->primitives_generated_query)
       key.primitives_generated_query = true;
 
-   key.ps.has_epilog = false; /* TODO: hook up PS epilogs */
+   key.ps.has_epilog = !!pipeline->ps_epilog;
 
    return key;
 }

Reply via email to