Upgrade codebase to C++ 20 + fix warnings + update submodules (#6115)

This commit is contained in:
GPUCode 2022-09-21 19:36:12 +03:00 committed by GitHub
parent 90b418fd1a
commit cbd5d1c15c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
67 changed files with 6837 additions and 7475 deletions

View file

@ -155,6 +155,7 @@ create_target_directory_groups(video_core)
target_link_libraries(video_core PUBLIC common core)
target_link_libraries(video_core PRIVATE glad nihstro-headers Boost::serialization)
set_target_properties(video_core PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
if (ARCHITECTURE_x86_64)
target_link_libraries(video_core PUBLIC xbyak)

View file

@ -205,7 +205,7 @@ public:
// printing the character '{' is desirable. Ditto for }} and '}',
// etc).
template <typename... Args>
void AddLine(std::string_view text, Args&&... args) {
void AddLine(fmt::format_string<Args...> text, Args&&... args) {
AddExpression(fmt::format(text, std::forward<Args>(args)...));
AddNewLine();
}

View file

@ -6,7 +6,6 @@
#include <set>
#include <thread>
#include <unordered_map>
#include <boost/functional/hash.hpp>
#include <boost/variant.hpp>
#include "core/frontend/scope_acquire_context.h"
#include "video_core/renderer_opengl/gl_resource_manager.h"
@ -21,12 +20,14 @@ namespace OpenGL {
static u64 GetUniqueIdentifier(const Pica::Regs& regs, const ProgramCode& code) {
std::size_t hash = 0;
u64 regs_uid = Common::ComputeHash64(regs.reg_array.data(), Pica::Regs::NUM_REGS * sizeof(u32));
boost::hash_combine(hash, regs_uid);
hash = Common::HashCombine(hash, regs_uid);
if (code.size() > 0) {
u64 code_uid = Common::ComputeHash64(code.data(), code.size() * sizeof(u32));
boost::hash_combine(hash, code_uid);
hash = Common::HashCombine(hash, code_uid);
}
return static_cast<u64>(hash);
return hash;
}
static OGLProgram GeneratePrecompiledProgram(const ShaderDiskCacheDump& dump,
@ -336,14 +337,14 @@ public:
}
struct ShaderTuple {
GLuint vs = 0;
GLuint gs = 0;
GLuint fs = 0;
std::size_t vs_hash = 0;
std::size_t gs_hash = 0;
std::size_t fs_hash = 0;
GLuint vs = 0;
GLuint gs = 0;
GLuint fs = 0;
bool operator==(const ShaderTuple& rhs) const {
return std::tie(vs, gs, fs) == std::tie(rhs.vs, rhs.gs, rhs.fs);
}
@ -353,14 +354,14 @@ public:
}
std::size_t GetConfigHash() const {
std::size_t hash = 0;
boost::hash_combine(hash, vs_hash);
boost::hash_combine(hash, gs_hash);
boost::hash_combine(hash, fs_hash);
return hash;
return Common::ComputeHash64(this, sizeof(std::size_t) * 3);
}
};
static_assert(offsetof(ShaderTuple, vs_hash) == 0, "ShaderTuple layout changed!");
static_assert(offsetof(ShaderTuple, fs_hash) == sizeof(std::size_t) * 2,
"ShaderTuple layout changed!");
bool is_amd;
bool separable;

View file

@ -91,7 +91,7 @@ ASSERT_POS(tc0_w, RasterizerRegs::VSOutputAttributes::TEXCOORD0_W);
ASSERT_POS(view, RasterizerRegs::VSOutputAttributes::VIEW_X);
ASSERT_POS(tc2, RasterizerRegs::VSOutputAttributes::TEXCOORD2_U);
#undef ASSERT_POS
static_assert(std::is_pod<OutputVertex>::value, "Structure is not POD");
static_assert(std::is_trivial_v<OutputVertex>, "Structure is not POD");
static_assert(sizeof(OutputVertex) == 24 * sizeof(float), "OutputVertex has invalid size");
/**
@ -153,7 +153,7 @@ struct UnitState {
ar& output;
}
} registers;
static_assert(std::is_pod<Registers>::value, "Structure is not POD");
static_assert(std::is_trivial_v<Registers>, "Structure is not POD");
bool conditional_code[2];

View file

@ -83,7 +83,7 @@ std::tuple<Common::Vec4<u8>, Common::Vec4<u8>> ComputeFragmentsColors(
else
light_vector = position + view;
light_vector.Normalize();
[[maybe_unused]] float length = light_vector.Normalize();
Common::Vec3<float> norm_view = view.Normalized();
Common::Vec3<float> half_vector = norm_view + light_vector;