mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-23 09:03:22 -05:00
A hull program may read its input control points from LDS at an index it computes from data, such as an index loaded from memory or min(invocation, n). The tessellation lowering refused such a read because its address is not affine in the invocation and relative patch. The address evaluator now carries a dynamic term for a hull LDS read: a value that is not affine but does not depend on the relative patch index, with the multiple it is scaled by. Terms of the same value add up ((t << 1) + t of t = index << 3 is 24 * index); terms of different values keep the greatest common divisor of their multiples. The read is lowered from the program's own address arithmetic, and the relative index may reach it only with the stride of a patch's inputs. A computed offset that is not a whole number of control points is refused. The SPIR-V emitter clamps a hull input control-point index to the patch's last input, recorded as technical debt: on the console an index past the patch reads LDS of a neighbouring patch.