Implement shader resource tables (#1165)

* Implement shader resource tables

* fix after rebase + squash

* address some review comments

* fix pipeline_common

* cleanup debug stuff

* switch to using single codegenerator
This commit is contained in:
baggins183
2024-10-31 23:55:53 -07:00
committed by GitHub
parent 7b16085c59
commit 9ec75c3feb
30 changed files with 740 additions and 119 deletions

View File

@@ -1,7 +1,9 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <string>
#include <cstddef>
#include <string_view>
#include "common/hash.h"
#include "shader_recompiler/ir/value.h"
namespace Shader::IR {
@@ -97,3 +99,52 @@ bool Value::operator!=(const Value& other) const {
}
} // namespace Shader::IR
namespace std {
std::size_t hash<Shader::IR::Value>::operator()(const Shader::IR::Value& v) const {
using namespace Shader::IR;
u64 h = HashCombine(static_cast<u64>(v.type), 0ULL);
switch (v.type) {
case Type::Void:
return h;
case Type::Opaque:
return reinterpret_cast<u64>(v.InstRecursive());
case Type::ScalarReg:
return HashCombine(static_cast<u64>(v.sreg), h);
case Type::VectorReg:
return HashCombine(static_cast<u64>(v.vreg), h);
case Type::Attribute:
return HashCombine(static_cast<u64>(v.attribute), h);
case Type::U1:
return HashCombine(static_cast<u64>(v.attribute), h);
case Type::U8:
return HashCombine(static_cast<u64>(v.imm_u8), h);
case Type::U16:
case Type::F16:
return HashCombine(static_cast<u64>(v.imm_u16), h);
case Type::U32:
case Type::F32:
return HashCombine(static_cast<u64>(v.imm_u32), h);
case Type::U64:
case Type::F64:
return HashCombine(static_cast<u64>(v.imm_u64), h);
case Type::U32x2:
case Type::U32x3:
case Type::U32x4:
case Type::F16x2:
case Type::F16x3:
case Type::F16x4:
case Type::F32x2:
case Type::F32x3:
case Type::F32x4:
case Type::F64x2:
case Type::F64x3:
case Type::F64x4:
default:
break;
}
UNREACHABLE_MSG("Invalid type {}", v.type);
}
} // namespace std