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@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9069>
This commit is contained in:
Jason Ekstrand 2020-10-23 12:26:03 -05:00 committed by Marge Bot
parent 9d1d55f0fd
commit 1ef04f56c1

View file

@ -220,6 +220,12 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode,
case SpvOpFunctionEnd: case SpvOpFunctionEnd:
b->func->end = w; 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; b->func = NULL;
break; break;