From fef8dfd05beb593f7a8c579791b0c76e03f4efc7 Mon Sep 17 00:00:00 2001 From: Gauvain 'GovanifY' Roussel-Tarbouriech Date: Wed, 12 May 2021 10:09:15 +0200 Subject: [PATCH] gs-merge: make xbyak intrinsics includes scoped, avoid cross project linking with x86_intrin --- common/include/x86emitter/x86_intrin.h | 22 ------------------- common/include/x86emitter/xbyak_intrin.h | 26 ----------------------- common/src/Utilities/CMakeLists.txt | 2 -- common/src/x86emitter/CMakeLists.txt | 2 -- common/src/x86emitter/cpudetect.cpp | 22 +++++++++++++++++++ pcsx2/GS/GSUtil.h | 1 - pcsx2/GS/GS_types.h | 5 +++++ pcsx2/GS/Renderers/Common/GSFunctionMap.h | 1 - pcsx2/GS/Renderers/HW/GSHwHack.cpp | 2 +- 9 files changed, 28 insertions(+), 55 deletions(-) delete mode 100644 common/include/x86emitter/xbyak_intrin.h diff --git a/common/include/x86emitter/x86_intrin.h b/common/include/x86emitter/x86_intrin.h index ef9fa1c11e..8b3a1a475c 100644 --- a/common/include/x86emitter/x86_intrin.h +++ b/common/include/x86emitter/x86_intrin.h @@ -29,28 +29,6 @@ #endif -// CPU information support -#if defined(_WIN32) - -#define cpuid __cpuid -#define cpuidex __cpuidex - -#else - -#include "xbyak_intrin.h" - -static __inline__ __attribute__((always_inline)) void cpuidex(int CPUInfo[], const int InfoType, const int count) -{ - __cpuid_count(InfoType, count, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]); -} - -static __inline__ __attribute__((always_inline)) void cpuid(int CPUInfo[], const int InfoType) -{ - __cpuid(InfoType, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]); -} - -#endif - // Rotate instruction #if defined(__clang__) && __clang_major__ < 9 #pragma clang diagnostic push diff --git a/common/include/x86emitter/xbyak_intrin.h b/common/include/x86emitter/xbyak_intrin.h deleted file mode 100644 index 7c4893b95b..0000000000 --- a/common/include/x86emitter/xbyak_intrin.h +++ /dev/null @@ -1,26 +0,0 @@ -/* PCSX2 - PS2 Emulator for PCs - * Copyright (C) 2002-2021 PCSX2 Dev Team - * - * PCSX2 is free software: you can redistribute it and/or modify it under the terms - * of the GNU Lesser General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with PCSX2. - * If not, see . - */ - -#pragma once - - -// unfortunately both our x86 recompiler and xbyak requires cpuid on posix -// compatible systems, which has no include guards. As such we currently include -// xbyak inside our recompiler -#include -#include -#define MIE_INTEGER_TYPE_DEFINED -#define XBYAK_ENABLE_OMITTED_OPERAND - diff --git a/common/src/Utilities/CMakeLists.txt b/common/src/Utilities/CMakeLists.txt index 10ae42e7cc..034afe6b2f 100644 --- a/common/src/Utilities/CMakeLists.txt +++ b/common/src/Utilities/CMakeLists.txt @@ -12,8 +12,6 @@ set(CommonFlags set(UtilitiesFinalFlags ${CommonFlags}) -include_directories ("${CMAKE_SOURCE_DIR}/3rdparty/xbyak/") - # variable with all sources of this library set(UtilitiesSources VirtualMemory.cpp diff --git a/common/src/x86emitter/CMakeLists.txt b/common/src/x86emitter/CMakeLists.txt index bc6659eb18..6bbc355e5c 100644 --- a/common/src/x86emitter/CMakeLists.txt +++ b/common/src/x86emitter/CMakeLists.txt @@ -11,8 +11,6 @@ set(Output x86emitter) set(CommonFlags ) -include_directories ("${CMAKE_SOURCE_DIR}/3rdparty/xbyak/") - set(x86emitterFinalFlags ${CommonFlags}) # variable with all sources of this library diff --git a/common/src/x86emitter/cpudetect.cpp b/common/src/x86emitter/cpudetect.cpp index 46b2fafdc3..80da68bc98 100644 --- a/common/src/x86emitter/cpudetect.cpp +++ b/common/src/x86emitter/cpudetect.cpp @@ -18,6 +18,28 @@ #include "internal.h" #include "x86_intrin.h" +// CPU information support +#if defined(_WIN32) + +#define cpuid __cpuid +#define cpuidex __cpuidex + +#else + +#include + +static __inline__ __attribute__((always_inline)) void cpuidex(int CPUInfo[], const int InfoType, const int count) +{ + __cpuid_count(InfoType, count, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]); +} + +static __inline__ __attribute__((always_inline)) void cpuid(int CPUInfo[], const int InfoType) +{ + __cpuid(InfoType, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]); +} + +#endif + using namespace x86Emitter; __aligned16 x86capabilities x86caps; diff --git a/pcsx2/GS/GSUtil.h b/pcsx2/GS/GSUtil.h index 593931d83e..f3b853ddfd 100644 --- a/pcsx2/GS/GSUtil.h +++ b/pcsx2/GS/GSUtil.h @@ -22,7 +22,6 @@ #pragma once #include "GS.h" -#include "x86emitter/xbyak_intrin.h" class GSUtil { diff --git a/pcsx2/GS/GS_types.h b/pcsx2/GS/GS_types.h index c8c95e03a3..20cb8d346a 100644 --- a/pcsx2/GS/GS_types.h +++ b/pcsx2/GS/GS_types.h @@ -1,6 +1,11 @@ #pragma once +#include +#include +#define MIE_INTEGER_TYPE_DEFINED +#define XBYAK_ENABLE_OMITTED_OPERAND + #include typedef unsigned char uint8; diff --git a/pcsx2/GS/Renderers/Common/GSFunctionMap.h b/pcsx2/GS/Renderers/Common/GSFunctionMap.h index 59b07693eb..20df0dd232 100644 --- a/pcsx2/GS/Renderers/Common/GSFunctionMap.h +++ b/pcsx2/GS/Renderers/Common/GSFunctionMap.h @@ -25,7 +25,6 @@ #include "../../GSCodeBuffer.h" #include "../SW/GSScanlineEnvironment.h" -#include "x86emitter/xbyak_intrin.h" template class GSFunctionMap diff --git a/pcsx2/GS/Renderers/HW/GSHwHack.cpp b/pcsx2/GS/Renderers/HW/GSHwHack.cpp index 441a163070..87b5c73248 100644 --- a/pcsx2/GS/Renderers/HW/GSHwHack.cpp +++ b/pcsx2/GS/Renderers/HW/GSHwHack.cpp @@ -75,7 +75,7 @@ bool GSC_DBZBT3(const GSFrameInfo& fi, int& skip) bool GSC_DeathByDegreesTekkenNinaWilliams(const GSFrameInfo& fi, int& skip) { // Note: Game also has issues with texture shuffle not supported on strange clamp mode. - // See https://forums.pcsx2.net/Thread-GS-Texture-Cache-Bug-Report-Death-By-Degrees-SLUS-20934-NTSC + // See https://forums.pcsx2.net/Thread-GSDX-Texture-Cache-Bug-Report-Death-By-Degrees-SLUS-20934-NTSC if (skip == 0) { if ((Aggressive || !s_nativeres) && fi.TME && fi.FBP == 0 && fi.TBP0 == 0x34a0 && fi.TPSM == PSM_PSMCT32)