Mesa (master): spirv: Delete the impl for prototype-only functions

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Feb 16 21:05:23 UTC 2021


Module: Mesa
Branch: master
Commit: 1ef04f56c110e20363bac80935172e35a101c2e5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1ef04f56c110e20363bac80935172e35a101c2e5

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Fri Oct 23 12:26:03 2020 -0500

spirv: Delete the impl for prototype-only functions

Previously, when we had a prototype-only function in SPIR-V, we would
compile it just fine and the function would have an impl that did
nothing.  This commit changes that so that the nir_function::impl is
NULL to indicate a prototype-only function.

Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9069>

---

 src/compiler/spirv/vtn_cfg.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c
index 0e3454ab44a..8d0794ed4af 100644
--- a/src/compiler/spirv/vtn_cfg.c
+++ b/src/compiler/spirv/vtn_cfg.c
@@ -220,6 +220,12 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode,
 
    case SpvOpFunctionEnd:
       b->func->end = w;
+      if (b->func->start_block == NULL) {
+         /* In this case, the function didn't have any actual blocks.  It's
+          * just a prototype so delete the function_impl.
+          */
+         b->func->nir_func->impl = NULL;
+      }
       b->func = NULL;
       break;
 



More information about the mesa-commit mailing list