Mesa (main): anv: Remove FS executables when applying the null FS optimization
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 10 00:55:35 UTC 2022
Module: Mesa
Branch: main
Commit: 65d6708bc33694b662d1195fd65842b85b7afc99
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=65d6708bc33694b662d1195fd65842b85b7afc99
Author: Ian Romanick <ian.d.romanick at intel.com>
Date: Mon Jun 6 15:50:53 2022 -0700
anv: Remove FS executables when applying the null FS optimization
If the executables are still hanging out,
anv_GetPipelineExecutableStatisticsKHR will try to dereference NULL
pointers in pipeline->shaders[MESA_SHADER_FRAGMENT].
At least in terms of fossil-db output, this matches the behavior from
before 73b3efcd59a.
Fixes: 73b3efcd59a ("anv: Handle the null FS optimization after compiling shaders")
Closes: #6590
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16898>
---
src/intel/vulkan/anv_pipeline.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 1c7f8b05804..41e2131f58e 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -1865,6 +1865,25 @@ done:
anv_shader_bin_unref(pipeline->base.device, fs);
pipeline->shaders[MESA_SHADER_FRAGMENT] = NULL;
pipeline->active_stages &= ~VK_SHADER_STAGE_FRAGMENT_BIT;
+
+ /* The per-SIMD size fragment shaders should be last in the
+ * executables array. Remove all of them.
+ */
+ ASSERTED unsigned removed = 0;
+
+ util_dynarray_foreach_reverse(&pipeline->base.executables,
+ struct anv_pipeline_executable,
+ tail) {
+ /* There must be at least one fragment shader. */
+ assert(removed > 0 || tail->stage == MESA_SHADER_FRAGMENT);
+
+ if (tail->stage != MESA_SHADER_FRAGMENT)
+ break;
+
+ (void) util_dynarray_pop(&pipeline->base.executables,
+ struct anv_pipeline_executable);
+ removed++;
+ }
}
}
More information about the mesa-commit
mailing list