diff --git a/rpcsx/gpu/lib/gcn-shader/include/shader/ir/PointerWrapper.hpp b/rpcsx/gpu/lib/gcn-shader/include/shader/ir/PointerWrapper.hpp index ed2331a9f..01c012e77 100644 --- a/rpcsx/gpu/lib/gcn-shader/include/shader/ir/PointerWrapper.hpp +++ b/rpcsx/gpu/lib/gcn-shader/include/shader/ir/PointerWrapper.hpp @@ -8,16 +8,16 @@ namespace shader::ir { template struct PointerWrapper { using underlying_type = ImplT; ImplT *impl = nullptr; - PointerWrapper() = default; - PointerWrapper(ImplT *impl) : impl(impl) {} + constexpr PointerWrapper() = default; + constexpr PointerWrapper(ImplT *impl) : impl(impl) {} template requires std::is_base_of_v - PointerWrapper(PointerWrapper node) : impl(node.impl) {} + constexpr PointerWrapper(PointerWrapper node) : impl(node.impl) {} - explicit operator bool() const { return impl != nullptr; } - bool operator==(std::nullptr_t) const { return impl == nullptr; } - bool operator==(ImplT *other) const { return impl == other; } + constexpr explicit operator bool() const { return impl != nullptr; } + constexpr bool operator==(std::nullptr_t) const { return impl == nullptr; } + constexpr bool operator==(ImplT *other) const { return impl == other; } template Self &operator=(this Self &self, ImplT *other) { self.impl = other; @@ -26,34 +26,34 @@ template struct PointerWrapper { template requires std::is_base_of_v - Self &operator=(this Self &self, PointerWrapper other) { + constexpr Self &operator=(this Self &self, PointerWrapper other) { self.impl = other.get(); return self; } // ImplT *operator->() const { return impl; } - ImplT *get() const { return impl; } + constexpr ImplT *get() const { return impl; } - auto operator<=>(const PointerWrapper &) const = default; - bool operator==(const PointerWrapper &) const = default; + constexpr auto operator<=>(const PointerWrapper &) const = default; + constexpr bool operator==(const PointerWrapper &) const = default; template - T cast() const + constexpr T cast() const requires requires { static_cast(impl); } { return T(dynamic_cast(impl)); } template - T staticCast() const + constexpr T staticCast() const requires requires { static_cast(impl); } { assert(impl == nullptr || cast() != nullptr); return T(static_cast(impl)); } - template bool isa() const { + template constexpr bool isa() const { if (impl == nullptr) { return false; } @@ -70,7 +70,7 @@ template struct PointerWrapper { template requires(sizeof...(T) > 1) - bool isa() const { + constexpr bool isa() const { return (isa() || ...); } };