shader-slang / slang

Making it easier to work with shaders
MIT License
2.07k stars 178 forks source link

Precompute UIntSet from individual capabilities inside generator #4269

Closed ArielG-NV closed 4 months ago

ArielG-NV commented 4 months ago

fixes: #4163

Precompute UIntSet from individual capabilities inside generator (removes intermediate form of capabilities).

generator changes:

  1. OutputUIntSetGenerator
    • Added to serialize a generator function which generates a UIntSet
  2. SerializedConjunction
    • Added to store serialization information of a single conjunction with the data of "generator function name" and a UIntSet cache. Storing a UIntSet cache of the 'generator function' makes finding duplicate conjunctions easier and faster.
  3. Generator output has 3 objects
    • kCapabilityArray --> has conjunction data
    • kCapabilityConjunctions --> has list of pointers to kCapabilityArray which makeup a list of conjunctions for an atom. There is no separator between lists.
    • kCapabilityNameInfos --> actual conjunction info is fetched by pointing to kCapabilityConjunctions with an offset and array size
  4. CapabilitySet::CapabilitySet
    • changed constructor to support UIntSet initialization instead of a intermediate form.
    • We still expand capabilities which are missing target and stage atoms.
  5. A few other functions were changed to support a UIntSet for when fetching atom info.
ArielG-NV commented 4 months ago

note about CI failure: some issue with code additions is causing Win32 build to hang/fail update: _BitScanForward was used incorrectly.