vtn: plumb through OpEntryPoint

mark nir_functions as entrypoints according to the source.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32382>
This commit is contained in:
Alyssa Rosenzweig 2024-11-17 18:17:17 -04:00 committed by Marge Bot
parent 5555769102
commit 9c37745f9d
3 changed files with 15 additions and 0 deletions

View file

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

View file

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

View file

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