Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/ir.c:
- if (!(normaliser_signature_transform_clip_or_cull(signature, VKD3D_SHADER_SV_CLIP_DISTANCE, normaliser)
| normaliser_signature_transform_clip_or_cull(signature, VKD3D_SHADER_SV_CULL_DISTANCE, normaliser)))
- {
return;
- }
- /* Delete the remapped clip/cull elements. */
- for (i = 0, j = 0; i < s->element_count; ++i)
- {
struct signature_element *e = &s->elements[i];
if (signature->scan[i].remap)
continue;
signature->scan[i].remap = j;
s->elements[j++] = *e;
- }
This logic isn't *too* hard to understand, at least I can tell what it's trying to do and I think it's done correctly. But I do also wonder if it'd be simpler just to let the signature have "nop" elements that spirv_compiler_emit_io_declarations() is supposed to ignore.
I haven't read the other signature normalization passes (recently?) but I guess they do something similar?