diff --git a/pcsx2/GS/GS.cpp b/pcsx2/GS/GS.cpp index a336ce5842777..7a9c3e3857213 100644 --- a/pcsx2/GS/GS.cpp +++ b/pcsx2/GS/GS.cpp @@ -17,6 +17,7 @@ #include "GS/Window/GSwxDialog.h" #include "GS.h" #include "GSUtil.h" +#include "GS_types.h" #include "Renderers/SW/GSRendererSW.h" #include "Renderers/Null/GSRendererNull.h" #include "Renderers/Null/GSDeviceNull.h" diff --git a/pcsx2/GS/GS.h b/pcsx2/GS/GS.h index 54956cee16db3..8cccdaefcc0a6 100644 --- a/pcsx2/GS/GS.h +++ b/pcsx2/GS/GS.h @@ -20,8 +20,6 @@ #include "config.h" #include "common/Pcsx2Types.h" -#include "common/WindowInfo.h" -#include "GS_types.h" #include "Window/GSSetting.h" #include "SaveState.h" @@ -35,10 +33,6 @@ #include #include -#else - -#include - #endif #include "Renderers/OpenGL/GLLoader.h" @@ -55,43 +49,7 @@ #endif -// put these into vc9/common7/ide/usertype.dat to have them highlighted - - -// stdc - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 4) -#include -#include -#endif - -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #ifdef __POSIX__ #include @@ -99,86 +57,25 @@ #include #endif -#include -#include - // Don't un-indent our ifdefs // clang-format off #ifdef _MSC_VER - - #define EXPORT_C_(type) extern "C" type __stdcall - #define EXPORT_C EXPORT_C_(void) - #define ALIGN_STACK(n) alignas(n) int dummy__; (void)dummy__; - #else - - #ifndef __fastcall - #define __fastcall __attribute__((fastcall)) - #endif - - #define EXPORT_C_(type) extern "C" __attribute__((stdcall, externally_visible, visibility("default"))) type - #define EXPORT_C EXPORT_C_(void) - #ifdef __GNUC__ // GCC removes the variable as dead code and generates some warnings. // Stack is automatically realigned due to SSE/AVX operations #define ALIGN_STACK(n) (void)0; - #else - // TODO Check clang behavior #define ALIGN_STACK(n) alignas(n) int dummy__; - #endif - - -#endif - -#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 #include #include -#ifndef _MM_DENORMALS_ARE_ZERO -#define _MM_DENORMALS_ARE_ZERO 0x0040 -#endif - -#define MXCSR (_MM_DENORMALS_ARE_ZERO | _MM_MASK_MASK | _MM_ROUND_NEAREST | _MM_FLUSH_ZERO_ON) - -#define _MM_TRANSPOSE4_SI128(row0, row1, row2, row3) \ -{ \ - __m128 tmp0 = _mm_shuffle_ps(_mm_castsi128_ps(row0), _mm_castsi128_ps(row1), 0x44); \ - __m128 tmp2 = _mm_shuffle_ps(_mm_castsi128_ps(row0), _mm_castsi128_ps(row1), 0xEE); \ - __m128 tmp1 = _mm_shuffle_ps(_mm_castsi128_ps(row2), _mm_castsi128_ps(row3), 0x44); \ - __m128 tmp3 = _mm_shuffle_ps(_mm_castsi128_ps(row2), _mm_castsi128_ps(row3), 0xEE); \ - (row0) = _mm_castps_si128(_mm_shuffle_ps(tmp0, tmp1, 0x88)); \ - (row1) = _mm_castps_si128(_mm_shuffle_ps(tmp0, tmp1, 0xDD)); \ - (row2) = _mm_castps_si128(_mm_shuffle_ps(tmp2, tmp3, 0x88)); \ - (row3) = _mm_castps_si128(_mm_shuffle_ps(tmp2, tmp3, 0xDD)); \ -} - #include #include @@ -238,21 +135,21 @@ extern void fifo_free(void* ptr, size_t size, size_t repeat); while(0); #if defined(_DEBUG) -# define GL_CACHE(...) GL_INSERT(GL_DEBUG_TYPE_OTHER, 0xFEAD, GL_DEBUG_SEVERITY_NOTIFICATION, __VA_ARGS__) + #define GL_CACHE(...) GL_INSERT(GL_DEBUG_TYPE_OTHER, 0xFEAD, GL_DEBUG_SEVERITY_NOTIFICATION, __VA_ARGS__) #else -# define GL_CACHE(...) (void)(0); + #define GL_CACHE(...) (void)(0); #endif #if defined(ENABLE_TRACE_REG) && defined(_DEBUG) -# define GL_REG(...) GL_INSERT(GL_DEBUG_TYPE_OTHER, 0xB0B0, GL_DEBUG_SEVERITY_NOTIFICATION, __VA_ARGS__) + #define GL_REG(...) GL_INSERT(GL_DEBUG_TYPE_OTHER, 0xB0B0, GL_DEBUG_SEVERITY_NOTIFICATION, __VA_ARGS__) #else -# define GL_REG(...) (void)(0); + #define GL_REG(...) (void)(0); #endif #if defined(ENABLE_EXTRA_LOG) && defined(_DEBUG) -# define GL_DBG(...) GL_INSERT(GL_DEBUG_TYPE_OTHER, 0xD0D0, GL_DEBUG_SEVERITY_NOTIFICATION, __VA_ARGS__) + #define GL_DBG(...) GL_INSERT(GL_DEBUG_TYPE_OTHER, 0xD0D0, GL_DEBUG_SEVERITY_NOTIFICATION, __VA_ARGS__) #else -# define GL_DBG(...) (void)(0); + #define GL_DBG(...) (void)(0); #endif #if defined(ENABLE_OGL_DEBUG) @@ -284,7 +181,7 @@ extern const std::string root_hw; // MacOS headers define PAGE_SIZE to the size of an x86 page #ifdef PAGE_SIZE -# undef PAGE_SIZE + #undef PAGE_SIZE #endif #define VM_SIZE 4194304u diff --git a/pcsx2/GS/GSCodeBuffer.cpp b/pcsx2/GS/GSCodeBuffer.cpp index fc537d0a5563b..253b7fc19af5b 100644 --- a/pcsx2/GS/GSCodeBuffer.cpp +++ b/pcsx2/GS/GSCodeBuffer.cpp @@ -15,7 +15,7 @@ #include "PrecompiledHeader.h" #include "GSCodeBuffer.h" -#include "GS_types.h" +#include "GS.h" GSCodeBuffer::GSCodeBuffer(size_t blocksize) : m_blocksize(blocksize) diff --git a/pcsx2/GS/GSCodeBuffer.h b/pcsx2/GS/GSCodeBuffer.h index df68527c353bd..50b345a7b8ecf 100644 --- a/pcsx2/GS/GSCodeBuffer.h +++ b/pcsx2/GS/GSCodeBuffer.h @@ -15,8 +15,6 @@ #pragma once -#include "GS_types.h" - class GSCodeBuffer { std::vector m_buffers; diff --git a/pcsx2/GS/GSDump.cpp b/pcsx2/GS/GSDump.cpp index ba8f3107fc6fa..7857b16ec879e 100644 --- a/pcsx2/GS/GSDump.cpp +++ b/pcsx2/GS/GSDump.cpp @@ -15,6 +15,7 @@ #include "PrecompiledHeader.h" #include "GSDump.h" +#include "GS_types.h" GSDumpBase::GSDumpBase(const std::string& fn) : m_frames(0) diff --git a/pcsx2/GS/GSLocalMemory.cpp b/pcsx2/GS/GSLocalMemory.cpp index 4cf570e836d41..d399615fc2a02 100644 --- a/pcsx2/GS/GSLocalMemory.cpp +++ b/pcsx2/GS/GSLocalMemory.cpp @@ -16,6 +16,7 @@ #include "PrecompiledHeader.h" #include "GSLocalMemory.h" #include "GS.h" +#include template static void foreachBlock(const GSOffset& off, GSLocalMemory* mem, const GSVector4i& r, u8* dst, int dstpitch, int bpp, Fn&& fn) diff --git a/pcsx2/GS/GSLocalMemory.h b/pcsx2/GS/GSLocalMemory.h index 06e71bb5fb0a2..b855a45c4e07d 100644 --- a/pcsx2/GS/GSLocalMemory.h +++ b/pcsx2/GS/GSLocalMemory.h @@ -20,6 +20,8 @@ #include "GSVector.h" #include "GSBlock.h" #include "GSClut.h" +#include +#include struct GSPixelOffset { diff --git a/pcsx2/GS/GSPerfMon.cpp b/pcsx2/GS/GSPerfMon.cpp index 3c553d0fc31f6..be64adfad5310 100644 --- a/pcsx2/GS/GSPerfMon.cpp +++ b/pcsx2/GS/GSPerfMon.cpp @@ -15,7 +15,6 @@ #include "PrecompiledHeader.h" #include "GSPerfMon.h" -#include "GS_types.h" GSPerfMon::GSPerfMon() : m_frame(0) diff --git a/pcsx2/GS/GSPerfMon.h b/pcsx2/GS/GSPerfMon.h index 061860c5a2d76..f7cc7b0009852 100644 --- a/pcsx2/GS/GSPerfMon.h +++ b/pcsx2/GS/GSPerfMon.h @@ -15,8 +15,6 @@ #pragma once -#include "GS_types.h" - class GSPerfMon { public: diff --git a/pcsx2/GS/GSPng.cpp b/pcsx2/GS/GSPng.cpp index b41afa2b995eb..f6423dbc02cf0 100644 --- a/pcsx2/GS/GSPng.cpp +++ b/pcsx2/GS/GSPng.cpp @@ -15,6 +15,7 @@ #include "PrecompiledHeader.h" #include "GSPng.h" +#include "GS_types.h" #include #include diff --git a/pcsx2/GS/GSTables.cpp b/pcsx2/GS/GSTables.cpp index fbaf8017982de..478060896e989 100644 --- a/pcsx2/GS/GSTables.cpp +++ b/pcsx2/GS/GSTables.cpp @@ -17,7 +17,6 @@ #include "PrecompiledHeader.h" #include "GSTables.h" -#include "GS_types.h" template static constexpr GSSizedBlockSwizzleTable makeSwizzleTable(const u8 (&arr)[Height][Width]) { diff --git a/pcsx2/GS/GSTables.h b/pcsx2/GS/GSTables.h index 0280d29b146ab..9600ac4191ae6 100644 --- a/pcsx2/GS/GSTables.h +++ b/pcsx2/GS/GSTables.h @@ -15,8 +15,6 @@ #pragma once -#include "GS_types.h" - /// Table for storing swizzling of blocks within a page struct alignas(64) GSBlockSwizzleTable { diff --git a/pcsx2/GS/GSThread_CXX11.h b/pcsx2/GS/GSThread_CXX11.h index d95df48beeb12..32e5e5d391434 100644 --- a/pcsx2/GS/GSThread_CXX11.h +++ b/pcsx2/GS/GSThread_CXX11.h @@ -18,6 +18,9 @@ #include "GS.h" #include "common/boost_spsc_queue.hpp" #include "common/General.h" +#include +#include +#include template class GSJobQueue final diff --git a/pcsx2/GS/GSVector.cpp b/pcsx2/GS/GSVector.cpp index 89762638b943e..6d788a1aacd20 100644 --- a/pcsx2/GS/GSVector.cpp +++ b/pcsx2/GS/GSVector.cpp @@ -16,6 +16,7 @@ #include "PrecompiledHeader.h" #include "GS.h" #include "GSVector.h" +#include CONSTINIT const GSVector4i GSVector4i::m_xff[17] = { diff --git a/pcsx2/GS/GSVector.h b/pcsx2/GS/GSVector.h index 490c53c6b838e..66e58e7b73a7e 100644 --- a/pcsx2/GS/GSVector.h +++ b/pcsx2/GS/GSVector.h @@ -14,7 +14,6 @@ */ #include "PrecompiledHeader.h" -#include "GS_types.h" #pragma once diff --git a/pcsx2/GS/GSVector4i.h b/pcsx2/GS/GSVector4i.h index c602d4cfa69fa..09784d5a4f532 100644 --- a/pcsx2/GS/GSVector4i.h +++ b/pcsx2/GS/GSVector4i.h @@ -13,8 +13,6 @@ * If not, see . */ -#include "GS_types.h" - class alignas(16) GSVector4i { static const GSVector4i m_xff[17]; @@ -1670,7 +1668,14 @@ class alignas(16) GSVector4i __forceinline static void transpose(GSVector4i& a, GSVector4i& b, GSVector4i& c, GSVector4i& d) { - _MM_TRANSPOSE4_SI128(a.m, b.m, c.m, d.m); + __m128 tmp0 = _mm_shuffle_ps(_mm_castsi128_ps(a.m), _mm_castsi128_ps(b.m), 0x44); + __m128 tmp2 = _mm_shuffle_ps(_mm_castsi128_ps(a.m), _mm_castsi128_ps(b.m), 0xEE); + __m128 tmp1 = _mm_shuffle_ps(_mm_castsi128_ps(c.m), _mm_castsi128_ps(d.m), 0x44); + __m128 tmp3 = _mm_shuffle_ps(_mm_castsi128_ps(c.m), _mm_castsi128_ps(d.m), 0xEE); + a = _mm_castps_si128(_mm_shuffle_ps(tmp0, tmp1, 0x88)); + b = _mm_castps_si128(_mm_shuffle_ps(tmp0, tmp1, 0xDD)); + c = _mm_castps_si128(_mm_shuffle_ps(tmp2, tmp3, 0x88)); + d = _mm_castps_si128(_mm_shuffle_ps(tmp2, tmp3, 0xDD)); } __forceinline static void sw4(GSVector4i& a, GSVector4i& b, GSVector4i& c, GSVector4i& d) diff --git a/pcsx2/GS/GS_types.h b/pcsx2/GS/GS_types.h index 2cfc59b68fc8a..c304d883188d4 100644 --- a/pcsx2/GS/GS_types.h +++ b/pcsx2/GS/GS_types.h @@ -15,8 +15,6 @@ #pragma once -#include - // clang-format off #ifdef _WIN32 @@ -46,19 +44,3 @@ inline FILE* px_fopen(const std::string& filename, const std::string& mode) return fopen(filename.c_str(), mode.c_str()); #endif } - -#define _MM_TRANSPOSE4_SI128(row0, row1, row2, row3) \ - { \ - __m128 tmp0 = _mm_shuffle_ps(_mm_castsi128_ps(row0), _mm_castsi128_ps(row1), 0x44); \ - __m128 tmp2 = _mm_shuffle_ps(_mm_castsi128_ps(row0), _mm_castsi128_ps(row1), 0xEE); \ - __m128 tmp1 = _mm_shuffle_ps(_mm_castsi128_ps(row2), _mm_castsi128_ps(row3), 0x44); \ - __m128 tmp3 = _mm_shuffle_ps(_mm_castsi128_ps(row2), _mm_castsi128_ps(row3), 0xEE); \ - (row0) = _mm_castps_si128(_mm_shuffle_ps(tmp0, tmp1, 0x88)); \ - (row1) = _mm_castps_si128(_mm_shuffle_ps(tmp0, tmp1, 0xDD)); \ - (row2) = _mm_castps_si128(_mm_shuffle_ps(tmp2, tmp3, 0x88)); \ - (row3) = _mm_castps_si128(_mm_shuffle_ps(tmp2, tmp3, 0xDD)); \ - } - - -extern void* vmalloc(size_t size, bool code); -extern void vmfree(void* ptr, size_t size); diff --git a/pcsx2/GS/Renderers/Common/GSDevice.h b/pcsx2/GS/Renderers/Common/GSDevice.h index ed3f4bec4c248..533a48f98a135 100644 --- a/pcsx2/GS/Renderers/Common/GSDevice.h +++ b/pcsx2/GS/Renderers/Common/GSDevice.h @@ -21,6 +21,7 @@ #include "GSVertex.h" #include "GS/GSAlignedClass.h" #include "GSOsdManager.h" +#include enum ShaderConvert { diff --git a/pcsx2/GS/Renderers/Common/GSFastList.h b/pcsx2/GS/Renderers/Common/GSFastList.h index d9fe27fbb25b6..df1ac8cbbfc34 100644 --- a/pcsx2/GS/Renderers/Common/GSFastList.h +++ b/pcsx2/GS/Renderers/Common/GSFastList.h @@ -15,8 +15,6 @@ #pragma once -#include "GS/GS_types.h" - template struct Element { diff --git a/pcsx2/GS/Renderers/Common/GSOsdManager.cpp b/pcsx2/GS/Renderers/Common/GSOsdManager.cpp index 7bec8130eff79..acaf06a43a4c8 100644 --- a/pcsx2/GS/Renderers/Common/GSOsdManager.cpp +++ b/pcsx2/GS/Renderers/Common/GSOsdManager.cpp @@ -20,6 +20,11 @@ #include "GS/resource.h" #endif +#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 4) +#include +#include +#endif + void GSOsdManager::LoadFont() { FT_Error error = FT_New_Face(m_library, theApp.GetConfigS("osd_fontname").c_str(), 0, &m_face); diff --git a/pcsx2/GS/Renderers/Common/GSVertexTrace.cpp b/pcsx2/GS/Renderers/Common/GSVertexTrace.cpp index 451c6e3da33b8..2eb2686055255 100644 --- a/pcsx2/GS/Renderers/Common/GSVertexTrace.cpp +++ b/pcsx2/GS/Renderers/Common/GSVertexTrace.cpp @@ -17,6 +17,7 @@ #include "GSVertexTrace.h" #include "GS/GSUtil.h" #include "GS/GSState.h" +#include CONSTINIT const GSVector4 GSVertexTrace::s_minmax = GSVector4::cxpr(FLT_MAX, -FLT_MAX, 0.f, 0.f); diff --git a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp index d2f78f1703172..c11f5958b2377 100644 --- a/pcsx2/GS/Renderers/DX11/GSDevice11.cpp +++ b/pcsx2/GS/Renderers/DX11/GSDevice11.cpp @@ -20,6 +20,7 @@ #include "GS/GSUtil.h" #include "GS/resource.h" #include +#include #include GSDevice11::GSDevice11() diff --git a/pcsx2/GS/Renderers/DX11/GSDevice11.h b/pcsx2/GS/Renderers/DX11/GSDevice11.h index 6affe583b857f..e74197c9cb241 100644 --- a/pcsx2/GS/Renderers/DX11/GSDevice11.h +++ b/pcsx2/GS/Renderers/DX11/GSDevice11.h @@ -18,6 +18,7 @@ #include "GSTexture11.h" #include "GS/GSVector.h" #include "GS/Renderers/Common/GSDevice.h" +#include #include struct GSVertexShader11 diff --git a/pcsx2/GS/Renderers/HW/GSTextureCache.h b/pcsx2/GS/Renderers/HW/GSTextureCache.h index 0c083162abc3b..5a93ee7e71b38 100644 --- a/pcsx2/GS/Renderers/HW/GSTextureCache.h +++ b/pcsx2/GS/Renderers/HW/GSTextureCache.h @@ -18,6 +18,7 @@ #include "GS/Renderers/Common/GSRenderer.h" #include "GS/Renderers/Common/GSFastList.h" #include "GS/Renderers/Common/GSDirtyRect.h" +#include class GSTextureCache { diff --git a/pcsx2/GS/Renderers/OpenGL/GLLoader.cpp b/pcsx2/GS/Renderers/OpenGL/GLLoader.cpp index 0f99cf6831117..5cfa0be60f20c 100644 --- a/pcsx2/GS/Renderers/OpenGL/GLLoader.cpp +++ b/pcsx2/GS/Renderers/OpenGL/GLLoader.cpp @@ -16,6 +16,7 @@ #include "PrecompiledHeader.h" #include "GLLoader.h" #include "GS.h" +#include namespace GLExtension { diff --git a/pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp b/pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp index 5be1034265a2f..c1b9ef1aabc60 100644 --- a/pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp +++ b/pcsx2/GS/Renderers/OpenGL/GSDeviceOGL.cpp @@ -19,6 +19,7 @@ #include "GLState.h" #include "GS/GSUtil.h" #include +#include //#define ONLY_LINES diff --git a/pcsx2/GS/Renderers/OpenGL/GSShaderOGL.h b/pcsx2/GS/Renderers/OpenGL/GSShaderOGL.h index f012ab4d8ba46..5c0cd145acb3b 100644 --- a/pcsx2/GS/Renderers/OpenGL/GSShaderOGL.h +++ b/pcsx2/GS/Renderers/OpenGL/GSShaderOGL.h @@ -16,6 +16,7 @@ #pragma once #include "GS.h" +#include class GSShaderOGL { diff --git a/pcsx2/GS/Renderers/SW/GSTextureCacheSW.h b/pcsx2/GS/Renderers/SW/GSTextureCacheSW.h index 679a64e5016f3..81ea3eca21b69 100644 --- a/pcsx2/GS/Renderers/SW/GSTextureCacheSW.h +++ b/pcsx2/GS/Renderers/SW/GSTextureCacheSW.h @@ -17,6 +17,7 @@ #include "GS/Renderers/Common/GSRenderer.h" #include "GS/Renderers/Common/GSFastList.h" +#include class GSTextureCacheSW { diff --git a/pcsx2/GS/Window/GSCaptureDlg.cpp b/pcsx2/GS/Window/GSCaptureDlg.cpp index 94012ccc4525e..3403dab81b669 100644 --- a/pcsx2/GS/Window/GSCaptureDlg.cpp +++ b/pcsx2/GS/Window/GSCaptureDlg.cpp @@ -16,6 +16,7 @@ #include "PrecompiledHeader.h" #include "GS.h" #include "GSCaptureDlg.h" +#include "GS/GS_types.h" // Ideally this belongs in WIL, but CAUUID is used by a *single* COM function in WinAPI. // That's presumably why it's omitted and is unlikely to make it to upstream WIL.