Search Issue Tracker

Fixed in 6000.5.0a5

Fix In Review for 6000.5.X

Fixed in 6000.4.0b4

Votes

0

Found in

6000.0.58f2

6000.2.6f2

6000.3.0b10

6000.4.0a4

Issue ID

UUM-127779

Regression

No

Precision issue found in UnityUIE for texture sampling branching

UI Toolkit Framework

-

I found a precision in the UIE_BRANCH() code path.

Since the Texture index is a half, is it not always correctly forwarded as an exact number
and can sometime suffer from precision issue. Since we are comparing value using less than operation and do not round any values, a value of 0x3F7FFFFF will be computed as less than 1.0f which will cause an invalid texture selection. If the value next to is exactly 0x3F800000 which will not be < 1.0f will have a correct texture selection. This cause a flickering pixel in the texture sampling which should always be the same for a primitive. 

To fix the issue globally, we instead compare with X - 0.5f to have a leeway.

Here is the new code to backport in UIE_BRANCH:
index < X converts to index < X - 0.5
{code:java}
#define UIE_BRANCH(OP) \
    branch] if (index &lt; 3.5 if (index < 1.5 || _UIE_TEXTURE_SLOT_COUNT <= 2) \
        { \
            branch] if (index &lt; 0.5 if (index < 2.5) \
                {OP(2)} \
            else \
                {OP(3)} \
        } \
    } \
    else \
    { \
        [branch] if (index < 5.5) \
        { \
            [branch] if (index < 4.5) \
                {OP(4)} \
            else \
                {OP(5)} \
        } \
        else \
        { \
            [branch] if (index < 6.5) \
                {OP(6)} \
            else \
                {OP(7)} \
        } \
    }
{code}

To reproduce the issue see project in duplicate case:
https://jira.unity3d.com/browse/UUM-129346

  1. Resolution Note (fix version 6000.5.0a5):

  2. Resolution Note (fix version 6000.4.0b4):

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.