mirror of https://github.com/PCSX2/pcsx2.git
gs: xbyak and gs type incompat workarounds for the merge
This commit is contained in:
parent
fc1e00b7ef
commit
5f0699d382
|
@ -37,16 +37,16 @@
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <cpuid.h>
|
#include "xbyak_intrin.h"
|
||||||
|
|
||||||
static __inline__ __attribute__((always_inline)) void cpuidex(int CPUInfo[], const int InfoType, const int count)
|
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]);
|
__cpuid_count(InfoType, count, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline__ __attribute__((always_inline)) void cpuid(int CPUInfo[], const int InfoType)
|
static __inline__ __attribute__((always_inline)) void cpuid(int CPUInfo[], const int InfoType)
|
||||||
{
|
{
|
||||||
__cpuid(InfoType, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
|
__cpuid(InfoType, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -59,12 +59,12 @@ static __inline__ __attribute__((always_inline)) void cpuid(int CPUInfo[], const
|
||||||
// Seriously what is so complicated to provided this bunch of intrinsics in clangs.
|
// Seriously what is so complicated to provided this bunch of intrinsics in clangs.
|
||||||
static unsigned int _rotr(unsigned int x, int s)
|
static unsigned int _rotr(unsigned int x, int s)
|
||||||
{
|
{
|
||||||
return (x >> s) | (x << (32 - s));
|
return (x >> s) | (x << (32 - s));
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int _rotl(unsigned int x, int s)
|
static unsigned int _rotl(unsigned int x, int s)
|
||||||
{
|
{
|
||||||
return (x << s) | (x >> (32 - s));
|
return (x << s) | (x >> (32 - s));
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
/* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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 <xbyak/xbyak.h>
|
||||||
|
#include <xbyak/xbyak_util.h>
|
||||||
|
#define MIE_INTEGER_TYPE_DEFINED
|
||||||
|
#define XBYAK_ENABLE_OMITTED_OPERAND
|
||||||
|
|
|
@ -12,6 +12,8 @@ set(CommonFlags
|
||||||
|
|
||||||
set(UtilitiesFinalFlags ${CommonFlags})
|
set(UtilitiesFinalFlags ${CommonFlags})
|
||||||
|
|
||||||
|
include_directories ("${CMAKE_SOURCE_DIR}/3rdparty/xbyak/")
|
||||||
|
|
||||||
# variable with all sources of this library
|
# variable with all sources of this library
|
||||||
set(UtilitiesSources
|
set(UtilitiesSources
|
||||||
VirtualMemory.cpp
|
VirtualMemory.cpp
|
||||||
|
|
|
@ -11,6 +11,8 @@ set(Output x86emitter)
|
||||||
set(CommonFlags
|
set(CommonFlags
|
||||||
)
|
)
|
||||||
|
|
||||||
|
include_directories ("${CMAKE_SOURCE_DIR}/3rdparty/xbyak/")
|
||||||
|
|
||||||
set(x86emitterFinalFlags ${CommonFlags})
|
set(x86emitterFinalFlags ${CommonFlags})
|
||||||
|
|
||||||
# variable with all sources of this library
|
# variable with all sources of this library
|
||||||
|
|
|
@ -14,15 +14,22 @@ if(NOT TOP_CMAKE_WAS_SOURCED)
|
||||||
It is advice to delete all wrongly generated cmake stuff => CMakeFiles & CMakeCache.txt")
|
It is advice to delete all wrongly generated cmake stuff => CMakeFiles & CMakeCache.txt")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
include_directories ("${CMAKE_SOURCE_DIR}/3rdparty/xbyak/")
|
||||||
|
|
||||||
set(CommonFlags
|
set(CommonFlags
|
||||||
-fno-strict-aliasing
|
-fno-strict-aliasing
|
||||||
-Wstrict-aliasing # Allow to track strict aliasing issue.
|
-Wstrict-aliasing # Allow to track strict aliasing issue.
|
||||||
-Wno-parentheses
|
-Wno-parentheses
|
||||||
-Wno-missing-braces
|
-Wno-missing-braces
|
||||||
|
-Wno-unknown-pragmas
|
||||||
-DWX_PRECOMP
|
-DWX_PRECOMP
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(GCC_VERSION VERSION_EQUAL "8.0" OR GCC_VERSION VERSION_GREATER "8.0")
|
||||||
|
# gs is pretty bad at this
|
||||||
|
set(CommonFlags ${CommonFlags} -Wno-packed-not-aligned)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Largely turning off because LegacyPluginAPI_Common in Plugins.h spams really badly in gcc 8 due to the memzero initialization.
|
# Largely turning off because LegacyPluginAPI_Common in Plugins.h spams really badly in gcc 8 due to the memzero initialization.
|
||||||
# Should probably be fixed properly, but for now this should work.
|
# Should probably be fixed properly, but for now this should work.
|
||||||
if(GCC_VERSION VERSION_EQUAL "8.0" OR GCC_VERSION VERSION_GREATER "8.0")
|
if(GCC_VERSION VERSION_EQUAL "8.0" OR GCC_VERSION VERSION_GREATER "8.0")
|
||||||
|
@ -576,8 +583,6 @@ set(pcsx2PADHeaders
|
||||||
${PADImgHeader}/arrow_right.h
|
${PADImgHeader}/arrow_right.h
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories ("${CMAKE_SOURCE_DIR}/3rdparty/xbyak/")
|
|
||||||
|
|
||||||
# GS sources
|
# GS sources
|
||||||
set(pcsx2GSSources
|
set(pcsx2GSSources
|
||||||
GS/GS.cpp
|
GS/GS.cpp
|
||||||
|
@ -599,6 +604,7 @@ set(pcsx2GSSources
|
||||||
GS/GSVector.cpp
|
GS/GSVector.cpp
|
||||||
GS/GSdx.cpp
|
GS/GSdx.cpp
|
||||||
GS/GS_res.cpp
|
GS/GS_res.cpp
|
||||||
|
GS/GS_types.h
|
||||||
GS/Renderers/Common/GSDevice.cpp
|
GS/Renderers/Common/GSDevice.cpp
|
||||||
GS/Renderers/Common/GSDirtyRect.cpp
|
GS/Renderers/Common/GSDirtyRect.cpp
|
||||||
GS/Renderers/Common/GSFunctionMap.cpp
|
GS/Renderers/Common/GSFunctionMap.cpp
|
||||||
|
|
|
@ -160,7 +160,7 @@ void GSclose()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int threads = -1)
|
int _GSopen(void** dsp, const char* title, GSRendererType renderer, int threads = -1)
|
||||||
{
|
{
|
||||||
GSDevice* dev = NULL;
|
GSDevice* dev = NULL;
|
||||||
bool old_api = *dsp == NULL;
|
bool old_api = *dsp == NULL;
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "Pcsx2Types.h"
|
#include "Pcsx2Types.h"
|
||||||
|
#include "GS_types.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
@ -56,20 +57,6 @@
|
||||||
// put these into vc9/common7/ide/usertype.dat to have them highlighted
|
// put these into vc9/common7/ide/usertype.dat to have them highlighted
|
||||||
|
|
||||||
|
|
||||||
typedef unsigned char uint8;
|
|
||||||
typedef signed char int8;
|
|
||||||
typedef unsigned short uint16;
|
|
||||||
typedef signed short int16;
|
|
||||||
typedef unsigned int uint32;
|
|
||||||
typedef signed int int32;
|
|
||||||
typedef unsigned long long uint64;
|
|
||||||
typedef signed long long int64;
|
|
||||||
|
|
||||||
// xbyak compatibilities
|
|
||||||
typedef int64 sint64;
|
|
||||||
#define MIE_INTEGER_TYPE_DEFINED
|
|
||||||
#define XBYAK_ENABLE_OMITTED_OPERAND
|
|
||||||
|
|
||||||
// stdc
|
// stdc
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
@ -1889,7 +1876,7 @@ void GSsetSettingsDir(const char* dir);
|
||||||
int GSinit();
|
int GSinit();
|
||||||
void GSshutdown();
|
void GSshutdown();
|
||||||
void GSclose();
|
void GSclose();
|
||||||
int _GSopen(void** dsp, const char* title, GSRendererType renderer, int threads = -1);
|
int _GSopen(void** dsp, const char* title, GSRendererType renderer, int threads);
|
||||||
void GSosdLog(const char* utf8, uint32 color);
|
void GSosdLog(const char* utf8, uint32 color);
|
||||||
void GSosdMonitor(const char* key, const char* value, uint32 color);
|
void GSosdMonitor(const char* key, const char* value, uint32 color);
|
||||||
int GSopen2(void** dsp, uint32 flags);
|
int GSopen2(void** dsp, uint32 flags);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "GS.h"
|
#include "GS.h"
|
||||||
#include "xbyak/xbyak_util.h"
|
#include "x86emitter/xbyak_intrin.h"
|
||||||
|
|
||||||
class GSUtil
|
class GSUtil
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "GS_types.h"
|
||||||
|
|
||||||
class alignas(16) GSVector4i
|
class alignas(16) GSVector4i
|
||||||
{
|
{
|
||||||
static const GSVector4i m_xff[17];
|
static const GSVector4i m_xff[17];
|
||||||
|
@ -253,7 +255,7 @@ public:
|
||||||
case Align_Outside: v = *this + mask.zwxy(); break;
|
case Align_Outside: v = *this + mask.zwxy(); break;
|
||||||
case Align_NegInf: v = *this; break;
|
case Align_NegInf: v = *this; break;
|
||||||
case Align_PosInf: v = *this + mask.zwzw(); break;
|
case Align_PosInf: v = *this + mask.zwzw(); break;
|
||||||
default: ASSERT(0); break;
|
default: pxAssert(0); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return v.andnot(mask.xyxy());
|
return v.andnot(mask.xyxy());
|
||||||
|
@ -1745,7 +1747,7 @@ public:
|
||||||
|
|
||||||
__forceinline static bool compare16(const void* dst, const void* src, size_t size)
|
__forceinline static bool compare16(const void* dst, const void* src, size_t size)
|
||||||
{
|
{
|
||||||
ASSERT((size & 15) == 0);
|
pxAssert((size & 15) == 0);
|
||||||
|
|
||||||
size >>= 4;
|
size >>= 4;
|
||||||
|
|
||||||
|
@ -1765,7 +1767,7 @@ public:
|
||||||
|
|
||||||
__forceinline static bool compare64(const void* dst, const void* src, size_t size)
|
__forceinline static bool compare64(const void* dst, const void* src, size_t size)
|
||||||
{
|
{
|
||||||
ASSERT((size & 63) == 0);
|
pxAssert((size & 63) == 0);
|
||||||
|
|
||||||
size >>= 6;
|
size >>= 6;
|
||||||
|
|
||||||
|
@ -1793,7 +1795,7 @@ public:
|
||||||
|
|
||||||
__forceinline static bool update(const void* dst, const void* src, size_t size)
|
__forceinline static bool update(const void* dst, const void* src, size_t size)
|
||||||
{
|
{
|
||||||
ASSERT((size & 15) == 0);
|
pxAssert((size & 15) == 0);
|
||||||
|
|
||||||
size >>= 4;
|
size >>= 4;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
typedef unsigned char uint8;
|
||||||
|
typedef signed char int8;
|
||||||
|
typedef unsigned short uint16;
|
||||||
|
typedef signed short int16;
|
||||||
|
typedef unsigned int uint32;
|
||||||
|
typedef signed int int32;
|
||||||
|
typedef unsigned long long uint64;
|
||||||
|
typedef signed long long int64;
|
||||||
|
|
||||||
|
#ifndef RESTRICT
|
||||||
|
|
||||||
|
#ifdef __INTEL_COMPILER
|
||||||
|
|
||||||
|
#define RESTRICT restrict
|
||||||
|
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
|
||||||
|
#define RESTRICT __restrict
|
||||||
|
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
|
||||||
|
#define RESTRICT __restrict__
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define RESTRICT
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -23,10 +23,9 @@
|
||||||
|
|
||||||
#include "../../GS.h"
|
#include "../../GS.h"
|
||||||
#include "../../GSCodeBuffer.h"
|
#include "../../GSCodeBuffer.h"
|
||||||
#include "xbyak/xbyak.h"
|
|
||||||
#include "xbyak/xbyak_util.h"
|
|
||||||
|
|
||||||
#include "../SW/GSScanlineEnvironment.h"
|
#include "../SW/GSScanlineEnvironment.h"
|
||||||
|
#include "x86emitter/xbyak_intrin.h"
|
||||||
|
|
||||||
template <class KEY, class VALUE>
|
template <class KEY, class VALUE>
|
||||||
class GSFunctionMap
|
class GSFunctionMap
|
||||||
|
|
|
@ -25,16 +25,19 @@
|
||||||
#include "../Common/GSFunctionMap.h"
|
#include "../Common/GSFunctionMap.h"
|
||||||
#include "../../GSUtil.h"
|
#include "../../GSUtil.h"
|
||||||
|
|
||||||
using namespace Xbyak;
|
|
||||||
|
|
||||||
#if defined(_M_AMD64) || defined(_WIN64)
|
#if defined(_M_AMD64) || defined(_WIN64)
|
||||||
#define RegLong Reg64
|
#define RegLong Xbyak::Reg64
|
||||||
#else
|
#else
|
||||||
#define RegLong Reg32
|
#define RegLong Xbyak::Reg32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class GSDrawScanlineCodeGenerator : public GSCodeGenerator
|
class GSDrawScanlineCodeGenerator : public GSCodeGenerator
|
||||||
{
|
{
|
||||||
|
typedef Xbyak::Ymm Ymm;
|
||||||
|
typedef Xbyak::Xmm Xmm;
|
||||||
|
typedef Xbyak::Reg8 Reg8;
|
||||||
|
typedef Xbyak::Operand Operand;
|
||||||
|
|
||||||
void operator=(const GSDrawScanlineCodeGenerator&);
|
void operator=(const GSDrawScanlineCodeGenerator&);
|
||||||
|
|
||||||
GSScanlineSelector m_sel;
|
GSScanlineSelector m_sel;
|
||||||
|
|
Loading…
Reference in New Issue