diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c index e079ee3f9b6..28d4c50fefb 100644 --- a/src/compiler/spirv/spirv_to_nir.c +++ b/src/compiler/spirv/spirv_to_nir.c @@ -4869,6 +4869,7 @@ vtn_handle_entry_point(struct vtn_builder *b, const uint32_t *w, /* Let this be a name label regardless */ unsigned name_words; entry_point->name = vtn_string_literal(b, &w[3], count - 3, &name_words); + entry_point->is_entrypoint = true; gl_shader_stage stage = vtn_stage_for_execution_model(w[1]); vtn_fail_if(stage == MESA_SHADER_NONE, diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c index aa6939c7181..f6c659d943a 100644 --- a/src/compiler/spirv/vtn_cfg.c +++ b/src/compiler/spirv/vtn_cfg.c @@ -280,6 +280,17 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode, func->dont_inline = b->func->control & SpvFunctionControlDontInlineMask; func->is_exported = b->func->linkage == SpvLinkageTypeExport; + /* This is a bit subtle: if we are compiling a non-library, we will have + * exactly one entrypoint. But in library mode, we can have 0, 1, or even + * multiple entrypoints. This is OK. + * + * So, we set is_entrypoint for libraries here (plumbing OpEntryPoint), + * but set is_entrypoint elsewhere for graphics shaders. + */ + if (b->options->create_library) { + func->is_entrypoint = val->is_entrypoint; + } + func->num_params = num_params; func->params = rzalloc_array(b->shader, nir_parameter, num_params); diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h index 7df6148e36d..7a0c5013759 100644 --- a/src/compiler/spirv/vtn_private.h +++ b/src/compiler/spirv/vtn_private.h @@ -569,6 +569,9 @@ struct vtn_value { /* Valid when all the members of the value are undef. */ bool is_undef_constant:1; + /* Marked as OpEntryPoint */ + bool is_entrypoint:1; + const char *name; struct vtn_decoration *decoration; struct vtn_type *type;