From aad74e3c738a281fa0e8ab9821fa1dcc88d61673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Briano?= Date: Wed, 1 May 2024 11:43:40 -0700 Subject: [PATCH] anv: fix casting to graphics_pipeline_base The macro takes the type of the pipeline to check for, but the cast to base checks for a full graphics pipeline, so if used on a library one it fails. Cc: mesa-stable Reviewed-by: Lionel Landwerlin Part-of: (cherry picked from commit 6223388c738e37a6d509ba54e2d179ee5773a4d6) --- .pick_status.json | 2 +- src/intel/vulkan/anv_pipeline.c | 2 +- src/intel/vulkan/anv_private.h | 10 +++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 8fc2b0350e0..c136376337a 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -804,7 +804,7 @@ "description": "anv: fix casting to graphics_pipeline_base", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index fcf57756c3a..7d3c974254e 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -4252,7 +4252,7 @@ VkResult anv_GetPipelineExecutableStatisticsKHR( switch (pipeline->type) { case ANV_PIPELINE_GRAPHICS: case ANV_PIPELINE_GRAPHICS_LIB: { - prog_data = anv_pipeline_to_graphics(pipeline)->base.shaders[exe->stage]->prog_data; + prog_data = anv_pipeline_to_graphics_base(pipeline)->shaders[exe->stage]->prog_data; break; } case ANV_PIPELINE_COMPUTE: { diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index b0c728b1a06..cb87ebe5f80 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -4372,11 +4372,19 @@ struct anv_ray_tracing_pipeline { } ANV_DECL_PIPELINE_DOWNCAST(graphics, ANV_PIPELINE_GRAPHICS) -ANV_DECL_PIPELINE_DOWNCAST(graphics_base, ANV_PIPELINE_GRAPHICS) ANV_DECL_PIPELINE_DOWNCAST(graphics_lib, ANV_PIPELINE_GRAPHICS_LIB) ANV_DECL_PIPELINE_DOWNCAST(compute, ANV_PIPELINE_COMPUTE) ANV_DECL_PIPELINE_DOWNCAST(ray_tracing, ANV_PIPELINE_RAY_TRACING) +/* Can't use the macro because we need to handle both types. */ +static inline struct anv_graphics_base_pipeline * +anv_pipeline_to_graphics_base(struct anv_pipeline *pipeline) +{ + assert(pipeline->type == ANV_PIPELINE_GRAPHICS || + pipeline->type == ANV_PIPELINE_GRAPHICS_LIB); + return (struct anv_graphics_base_pipeline *) pipeline; +} + static inline bool anv_pipeline_has_stage(const struct anv_graphics_pipeline *pipeline, gl_shader_stage stage)