From 2aa34e53f0607ade9e699bb901e6b7abdfb6e62b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tur=C3=A1nszki=20J=C3=A1nos?= Date: Tue, 28 Jan 2025 17:06:12 +0100 Subject: [PATCH] compatibility fix for the clang compiler --- WickedEngine/wiGraphics.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/WickedEngine/wiGraphics.h b/WickedEngine/wiGraphics.h index dd2de2041..3360bef3c 100644 --- a/WickedEngine/wiGraphics.h +++ b/WickedEngine/wiGraphics.h @@ -1286,7 +1286,14 @@ namespace wi::graphics } constexpr uint64_t get_hash() const { - return (uint64_t(pso) ^ (renderpass_hash << 1)) >> 1; + union + { + const PipelineState* ptr; + uint64_t value; + } pso_hasher = {}; + static_assert(sizeof(pso_hasher) == sizeof(uint64_t)); + pso_hasher.ptr = pso; // reinterpret_cast in constexpr workaround + return (pso_hasher.value ^ (renderpass_hash << 1)) >> 1; } };