spirv: Expose stage enum conversion in vtn_private.h
Refactor it to not fail, just return MESA_SHADER_NONE. Caller takes care of handling error. Exposed so can be used by spirv2nir program. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25461>
This commit is contained in:
@@ -4540,8 +4540,8 @@ vertices_in_from_spv_execution_mode(struct vtn_builder *b,
|
||||
}
|
||||
}
|
||||
|
||||
static gl_shader_stage
|
||||
stage_for_execution_model(struct vtn_builder *b, SpvExecutionModel model)
|
||||
gl_shader_stage
|
||||
vtn_stage_for_execution_model(SpvExecutionModel model)
|
||||
{
|
||||
switch (model) {
|
||||
case SpvExecutionModelVertex:
|
||||
@@ -4577,8 +4577,7 @@ stage_for_execution_model(struct vtn_builder *b, SpvExecutionModel model)
|
||||
case SpvExecutionModelMeshEXT:
|
||||
return MESA_SHADER_MESH;
|
||||
default:
|
||||
vtn_fail("Unsupported execution model: %s (%u)",
|
||||
spirv_executionmodel_to_string(model), model);
|
||||
return MESA_SHADER_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4598,8 +4597,12 @@ vtn_handle_entry_point(struct vtn_builder *b, const uint32_t *w,
|
||||
unsigned name_words;
|
||||
entry_point->name = vtn_string_literal(b, &w[3], count - 3, &name_words);
|
||||
|
||||
gl_shader_stage stage = vtn_stage_for_execution_model(w[1]);
|
||||
vtn_fail_if(stage == MESA_SHADER_NONE,
|
||||
"Unsupported execution model: %s (%u)",
|
||||
spirv_executionmodel_to_string(w[1]), w[1]);
|
||||
if (strcmp(entry_point->name, b->entry_point_name) != 0 ||
|
||||
stage_for_execution_model(b, w[1]) != b->entry_point_stage)
|
||||
stage != b->entry_point_stage)
|
||||
return;
|
||||
|
||||
vtn_assert(b->entry_point == NULL);
|
||||
|
||||
@@ -1071,4 +1071,6 @@ struct vtn_ssa_value *vtn_cooperative_matrix_insert(struct vtn_builder *b, struc
|
||||
nir_deref_instr *vtn_create_cmat_temporary(struct vtn_builder *b,
|
||||
const struct glsl_type *t, const char *name);
|
||||
|
||||
gl_shader_stage vtn_stage_for_execution_model(SpvExecutionModel model);
|
||||
|
||||
#endif /* _VTN_PRIVATE_H_ */
|
||||
|
||||
Reference in New Issue
Block a user