build: Update to support multi-arch builds.

This commit is contained in:
Steveice10 2023-01-06 07:28:02 -08:00
parent 0e325255f3
commit a8848cce43
25 changed files with 114 additions and 66 deletions

View file

@ -4,6 +4,7 @@
#include <cmath>
#include <cstring>
#include "common/arch.h"
#include "common/bit_set.h"
#include "common/logging/log.h"
#include "common/microprofile.h"
@ -12,9 +13,9 @@
#include "video_core/regs_shader.h"
#include "video_core/shader/shader.h"
#include "video_core/shader/shader_interpreter.h"
#ifdef ARCHITECTURE_x86_64
#if CITRA_ARCH(x86_64)
#include "video_core/shader/shader_jit_x64.h"
#endif // ARCHITECTURE_x86_64
#endif // CITRA_ARCH(x86_64)
#include "video_core/video_core.h"
namespace Pica::Shader {
@ -134,13 +135,13 @@ void GSUnitState::ConfigOutput(const ShaderRegs& config) {
MICROPROFILE_DEFINE(GPU_Shader, "GPU", "Shader", MP_RGB(50, 50, 240));
#ifdef ARCHITECTURE_x86_64
#if CITRA_ARCH(x86_64)
static std::unique_ptr<JitX64Engine> jit_engine;
#endif // ARCHITECTURE_x86_64
#endif // CITRA_ARCH(x86_64)
static InterpreterEngine interpreter_engine;
ShaderEngine* GetEngine() {
#ifdef ARCHITECTURE_x86_64
#if CITRA_ARCH(x86_64)
// TODO(yuriks): Re-initialize on each change rather than being persistent
if (VideoCore::g_shader_jit_enabled) {
if (jit_engine == nullptr) {
@ -148,15 +149,15 @@ ShaderEngine* GetEngine() {
}
return jit_engine.get();
}
#endif // ARCHITECTURE_x86_64
#endif // CITRA_ARCH(x86_64)
return &interpreter_engine;
}
void Shutdown() {
#ifdef ARCHITECTURE_x86_64
#if CITRA_ARCH(x86_64)
jit_engine = nullptr;
#endif // ARCHITECTURE_x86_64
#endif // CITRA_ARCH(x86_64)
}
} // namespace Pica::Shader

View file

@ -2,6 +2,9 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/arch.h"
#if CITRA_ARCH(x86_64)
#include "common/microprofile.h"
#include "video_core/shader/shader.h"
#include "video_core/shader/shader_jit_x64.h"
@ -43,3 +46,5 @@ void JitX64Engine::Run(const ShaderSetup& setup, UnitState& state) const {
}
} // namespace Pica::Shader
#endif // CITRA_ARCH(x86_64)

View file

@ -4,6 +4,9 @@
#pragma once
#include "common/arch.h"
#if CITRA_ARCH(x86_64)
#include <memory>
#include <unordered_map>
#include "common/common_types.h"
@ -26,3 +29,5 @@ private:
};
} // namespace Pica::Shader
#endif // CITRA_ARCH(x86_64)

View file

@ -2,6 +2,9 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/arch.h"
#if CITRA_ARCH(x86_64)
#include <algorithm>
#include <cmath>
#include <cstdint>
@ -1131,3 +1134,5 @@ Xbyak::Label JitShader::CompilePrelude_Exp2() {
}
} // namespace Pica::Shader
#endif // CITRA_ARCH(x86_64)

View file

@ -4,6 +4,9 @@
#pragma once
#include "common/arch.h"
#if CITRA_ARCH(x86_64)
#include <array>
#include <bitset>
#include <cstddef>
@ -138,3 +141,5 @@ private:
};
} // namespace Pica::Shader
#endif