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 <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29011>
(cherry picked from commit 6223388c73)
This commit is contained in:
Iván Briano 2024-05-01 11:43:40 -07:00 committed by Eric Engestrom
parent db1835d8ca
commit 726c28f92f
3 changed files with 11 additions and 3 deletions

View file

@ -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

View file

@ -4290,7 +4290,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: {

View file

@ -4712,11 +4712,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)