vkd3d-shader/ir: Set the signature sort indices in shader_signature_merge().

Since the sort index is just a convenience field it is more
appropriate to only set it where it is required, instead of
requiring all frontends and passes to retain sensible values for
it.
This commit is contained in:
Giovanni Mascellani 2024-10-08 16:26:53 +02:00 committed by Henri Verbeet
parent c332adaa68
commit cd74461d6d
Notes: Henri Verbeet 2024-10-08 22:12:25 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1161
3 changed files with 6 additions and 2 deletions

View File

@ -419,8 +419,6 @@ static int shader_parse_signature(const struct vkd3d_shader_dxbc_section_desc *s
const char *name;
uint32_t mask;
e[i].sort_index = i;
if (has_stream_index)
e[i].stream_index = read_u32(&ptr);
else

View File

@ -1471,6 +1471,9 @@ static bool shader_signature_merge(struct shader_signature *s, uint8_t range_map
return false;
memcpy(elements, s->elements, element_count * sizeof(*elements));
for (i = 0; i < element_count; ++i)
elements[i].sort_index = i;
qsort(elements, element_count, sizeof(elements[0]), signature_element_register_compare);
for (i = 0, new_count = 0; i < element_count; i = j, elements[new_count++] = *e)

View File

@ -1061,6 +1061,9 @@ enum vkd3d_shader_input_sysval_semantic
struct signature_element
{
/* sort_index is not a property of the signature element, it is just a
* convenience field used to retain the original order in a signature and
* recover it after having permuted the signature itself. */
unsigned int sort_index;
const char *semantic_name;
unsigned int semantic_index;