spirv: Use OpEntryPoint to identify valid I/O variables
OpEntryPoint declares the list of variables in Input and Output storage classes that are used. Use that information to skip creating other variables from such storage classes that are unused by the entry point. After that change, is not necessary to use remove dead variables for those types of variables; and because of that is also not necessary to lower initalizers for output variables. Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8456>
This commit is contained in:

committed by
Marge Bot

parent
4654650d6b
commit
cc98ba2eaf
@@ -2291,9 +2291,16 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
|
||||
case SpvOpVariable: {
|
||||
struct vtn_type *ptr_type = vtn_get_type(b, w[1]);
|
||||
|
||||
struct vtn_value *val = vtn_push_value(b, w[2], vtn_value_type_pointer);
|
||||
|
||||
SpvStorageClass storage_class = w[3];
|
||||
|
||||
/* Skip I/O variables that are not used by the entry point. */
|
||||
if (!b->options->create_library &&
|
||||
(storage_class == SpvStorageClassInput ||
|
||||
storage_class == SpvStorageClassOutput) &&
|
||||
!bsearch(&w[2], b->interface_ids, b->interface_ids_count, 4, cmp_uint32_t))
|
||||
break;
|
||||
|
||||
struct vtn_value *val = vtn_push_value(b, w[2], vtn_value_type_pointer);
|
||||
struct vtn_value *initializer = count > 4 ? vtn_untyped_value(b, w[4]) : NULL;
|
||||
|
||||
vtn_create_variable(b, val, ptr_type, storage_class, initializer);
|
||||
|
Reference in New Issue
Block a user