[Fix] (Tessellation): compare the default patch levels by bit pattern, so a NaN level stops re-linking the program on every draw

This commit is contained in:
Swung0x48
2026-08-27 03:18:13 -04:00
parent e3163233a5
commit 2635fe84b6
2 changed files with 19 additions and 2 deletions
+12
View File
@@ -10,6 +10,8 @@
#include <Includes.h>
#include <cstring>
namespace MobileGL {
template <typename Derived, typename T, SizeT N>
struct VecBase {
@@ -84,6 +86,16 @@ namespace MobileGL {
}
};
// Bit-pattern equality, for a vector used as a cache or staleness KEY rather than as a
// number. IEEE `==` - which operator== above is - says a NaN never equals itself, so a single
// NaN component makes every comparison answer "changed" and whatever the key guards is
// rebuilt on every use, forever. Two zeros of opposite sign compare unequal here, which only
// ever costs one extra rebuild.
template <typename Derived, typename T, SizeT N>
Bool BitwiseEqual(const VecBase<Derived, T, N>& a, const VecBase<Derived, T, N>& b) {
return std::memcmp(a.data.data(), b.data.data(), sizeof(T) * N) == 0;
}
template <typename T>
struct Vec2 : public VecBase<Vec2<T>, T, 2> {
using Base = VecBase<Vec2<T>, T, 2>;