From f8209ddc5b9e21a513da43e56fc667e1710017d2 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Thu, 25 Aug 2022 17:19:12 +0200 Subject: [PATCH] radv: import PS epilog from libraries if present MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This enables using PS epilogs with GPL. Signed-off-by: Samuel Pitoiset Reviewed-by: Timur Kristóf Part-of: --- 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 72ab2f7..c344dd4 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; } -- 2.7.4