Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/tpf.c:
- return memcmp(a, b, sizeof(struct sm4_index_range));
+}
+static void shader_sm4_validate_default_phase_index_ranges(struct vkd3d_shader_sm4_parser *sm4) +{
- if (!sm4->input_index_ranges.count || !sm4->output_index_ranges.count)
return;
- if (sm4->input_index_ranges.count == sm4->output_index_ranges.count)
- {
qsort(sm4->input_index_ranges.ranges, sm4->input_index_ranges.count, sizeof(sm4->input_index_ranges.ranges[0]),
index_range_compare);
qsort(sm4->output_index_ranges.ranges, sm4->output_index_ranges.count, sizeof(sm4->output_index_ranges.ranges[0]),
index_range_compare);
if (!memcmp(sm4->input_index_ranges.ranges, sm4->output_index_ranges.ranges,
sm4->input_index_ranges.count * sizeof(sm4->input_index_ranges.ranges[0])))
I think that's correct, but quite fragile: as soon as, for any reason, `sm4_index_range_array` is modified in a way that causes it to have some padding, the compare might break.
No need to change for me, let's just keep this in mind.