From c33106c062ed22e6b651c675a67f308ae3cdefef Mon Sep 17 00:00:00 2001 From: makigumo Date: Mon, 3 Feb 2025 17:56:04 +0100 Subject: [PATCH] value.cpp: fix some issues --- src/shader_recompiler/ir/value.cpp | 31 +++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/shader_recompiler/ir/value.cpp b/src/shader_recompiler/ir/value.cpp index 8826b80f2..7052c6343 100644 --- a/src/shader_recompiler/ir/value.cpp +++ b/src/shader_recompiler/ir/value.cpp @@ -3,6 +3,7 @@ #include #include +#include #include "common/hash.h" #include "shader_recompiler/ir/value.h" @@ -63,21 +64,25 @@ bool Value::operator==(const Value& other) const { return vreg == other.vreg; case Type::Attribute: return attribute == other.attribute; + case Type::Patch: + return patch == other.patch; case Type::U1: return imm_u1 == other.imm_u1; case Type::U8: return imm_u8 == other.imm_u8; case Type::U16: - case Type::F16: return imm_u16 == other.imm_u16; case Type::U32: - case Type::F32: return imm_u32 == other.imm_u32; + case Type::F32: + return imm_f32 == other.imm_f32; case Type::U64: - case Type::F64: return imm_u64 == other.imm_u64; + case Type::F64: + return imm_f64 == other.imm_f64; case Type::StringLiteral: - return std::string_view(string_literal) == other.string_literal; + return std::string_view(string_literal) == std::string_view(other.string_literal); + case Type::F16: case Type::U32x2: case Type::U32x3: case Type::U32x4: @@ -114,24 +119,28 @@ std::size_t hash::operator()(const Shader::IR::Value& v) cons case Type::Opaque: return reinterpret_cast(v.InstRecursive()); case Type::ScalarReg: - return HashCombine(static_cast(v.sreg), h); + return HashCombine(static_cast(std::to_underlying(v.sreg)), h); case Type::VectorReg: - return HashCombine(static_cast(v.vreg), h); + return HashCombine(static_cast(std::to_underlying(v.vreg)), h); case Type::Attribute: - return HashCombine(static_cast(v.attribute), h); + return HashCombine(std::to_underlying(v.attribute), h); + case Type::Patch: + return HashCombine(std::to_underlying(v.patch), h); case Type::U1: - return HashCombine(static_cast(v.attribute), h); + return HashCombine(static_cast(v.imm_u1), h); case Type::U8: return HashCombine(static_cast(v.imm_u8), h); case Type::U16: - case Type::F16: return HashCombine(static_cast(v.imm_u16), h); case Type::U32: - case Type::F32: return HashCombine(static_cast(v.imm_u32), h); + case Type::F32: + return HashCombine(static_cast(v.imm_f32), h); case Type::U64: - case Type::F64: return HashCombine(static_cast(v.imm_u64), h); + case Type::F64: + return HashCombine(static_cast(v.imm_f64), h); + case Type::F16: case Type::U32x2: case Type::U32x3: case Type::U32x4: