shader-slang / slang

Making it easier to work with shaders
MIT License
1.79k stars 160 forks source link

Capabilities System: Inclusive join logic bug #4295

Closed ArielG-NV closed 1 month ago

ArielG-NV commented 1 month ago

fixes: #4293

Currently the code does:

    void inclusiveJoinConjunction(CapabilitySharedContext& context, CapabilityConjunction& c, List<CapabilityConjunction>& toAddAfter)
    {
        if (c.isImpossible())
            return;
        for (auto& conjunction : conjunctions)
        {
            if (c.implies(conjunction))
                return;
        }

This is incorrect because it means that "if the set we are going to add is a super set of an element, don't add it". This does not make sense since inclusive join is meant to be 'additive' of super sets.

Correct behavior code:

    void inclusiveJoinConjunction(CapabilitySharedContext& context, CapabilityConjunction& c, List<CapabilityConjunction>& toAddAfter)
    {
        if (c.isImpossible())
            return;
        for (auto& conjunction : conjunctions)
        {
            if (conjunction.implies(c))
                return;
        }

This is correct behavior because it means that: "if the set we are going to add is a sub set of an element, ignore it". This makes sense since inclusive join can then add super sets in-place of subsets