Figure out the cause of precision issues from a packed integer midTexCoord
IMS212 opened this issue ยท 3 comments
As discussed in the Iris Discord, this issue does not affect 1.16. It is likely the result of Sodium 1.16 and 1.18 encoding UVs differently. Sodium 1.16 multiplies UVs by 32768
whereas Sodium 1.18 multiples UVs by 65536
. Multiplying the midU and midV by 65536
instead of 65535
fixes the issue, but the case of midU == 1
and midV == 1
should be handled separately. This can be accomplished by either intentionally falling back to 0 ((short) (65536) == 0
) or using 65535.0f/65536.0f
as the upper limit.
midU == 1 and midV == 1 shouldn't be possible/sensible under normal circumstances, since that would mean that the texture coordinates of all vertices involved would have to be at the lower right corner of the atlas. So we don't really need to worry about that edge case I don't think.