GS: Split GS.h into multiple smaller headers

This commit is contained in:
TellowKrinkle 2021-09-02 16:02:02 -05:00 committed by tellowkrinkle
parent ed90e2fcf9
commit 648a958290
61 changed files with 1651 additions and 1590 deletions

View File

@ -216,6 +216,10 @@ static const int __pagesize = PCSX2_PAGESIZE;
#define __has_attribute(x) 0
#endif
#ifndef __has_builtin
#define __has_builtin(x) 0
#endif
#ifdef __cpp_constinit
#define CONSTINIT constinit
#elif __has_attribute(require_constant_initialization)

View File

@ -670,7 +670,10 @@ set(pcsx2GSHeaders
GS/GSDrawingContext.h
GS/GSDrawingEnvironment.h
GS/GSDump.h
GS/GS_types.h
GS/GSExtra.h
GS/GSGL.h
GS/GSIntrin.h
GS/GSRegs.h
GS/GS.h
GS/GSLocalMemory.h
GS/GSLzma.h

View File

@ -18,7 +18,6 @@
#include <list>
#include "GS.h"
#include "Gif_Unit.h"
#include "Counters.h"
#include "Config.h"

View File

@ -17,7 +17,7 @@
#include "GS/Window/GSwxDialog.h"
#include "GS.h"
#include "GSUtil.h"
#include "GS_types.h"
#include "GSExtra.h"
#include "Renderers/SW/GSRendererSW.h"
#include "Renderers/Null/GSRendererNull.h"
#include "Renderers/Null/GSDeviceNull.h"

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@
#pragma once
#include "GS.h"
#include "GSRegs.h"
#include "GSTables.h"
#include "GSVector.h"

View File

@ -17,7 +17,7 @@
#include "GSCapture.h"
#include "GSPng.h"
#include "GSUtil.h"
#include "GS_types.h"
#include "GSExtra.h"
#ifdef _WIN32

View File

@ -16,6 +16,7 @@
#include "PrecompiledHeader.h"
#include "GSClut.h"
#include "GSLocalMemory.h"
#include "GSGL.h"
#define CLUT_ALLOC_SIZE (2 * 4096)

View File

@ -15,7 +15,7 @@
#pragma once
#include "GS.h"
#include "GSRegs.h"
#include "GSVector.h"
#include "GSTables.h"
#include "GSAlignedClass.h"

View File

@ -15,7 +15,7 @@
#include "PrecompiledHeader.h"
#include "GSCodeBuffer.h"
#include "GS.h"
#include "GSExtra.h"
GSCodeBuffer::GSCodeBuffer(size_t blocksize)
: m_blocksize(blocksize)

View File

@ -14,8 +14,9 @@
*/
#include "PrecompiledHeader.h"
#include "GS.h"
#include "GSCrc.h"
#include "GSExtra.h"
#include "GS.h"
const CRC::Game CRC::m_games[] =
{

View File

@ -15,6 +15,8 @@
#pragma once
#include <map>
class CRC
{
public:

View File

@ -15,6 +15,7 @@
#include "PrecompiledHeader.h"
#include "GSDrawingContext.h"
#include "GSGL.h"
#include "GS.h"
static int findmax(int tl, int br, int limit, int wm, int minuv, int maxuv)

View File

@ -19,7 +19,6 @@
#pragma clang diagnostic ignored "-Wformat"
#endif
#include "GS.h"
#include "GSLocalMemory.h"
class alignas(32) GSDrawingContext

View File

@ -15,8 +15,6 @@
#pragma once
#include "GS.h"
class alignas(32) GSDrawingEnvironment
{
public:

View File

@ -15,7 +15,7 @@
#include "PrecompiledHeader.h"
#include "GSDump.h"
#include "GS_types.h"
#include "GSExtra.h"
GSDumpBase::GSDumpBase(const std::string& fn)
: m_frames(0)

View File

@ -15,7 +15,8 @@
#pragma once
#include "GS.h"
#include "SaveState.h"
#include "GSRegs.h"
#include "Renderers/SW/GSVertexSW.h"
#include <lzma.h>

View File

@ -15,7 +15,7 @@
#pragma once
// clang-format off
#include "GSVector.h"
#ifdef _WIN32
inline std::string convert_utf16_to_utf8(const std::wstring& utf16_string)
@ -44,3 +44,56 @@ inline FILE* px_fopen(const std::string& filename, const std::string& mode)
return fopen(filename.c_str(), mode.c_str());
#endif
}
#ifdef ENABLE_ACCURATE_BUFFER_EMULATION
static const GSVector2i default_rt_size(2048, 2048);
#else
static const GSVector2i default_rt_size(1280, 1024);
#endif
// Helper path to dump texture
extern const std::string root_sw;
extern const std::string root_hw;
extern std::string format(const char* fmt, ...);
extern void* vmalloc(size_t size, bool code);
extern void vmfree(void* ptr, size_t size);
extern void* fifo_alloc(size_t size, size_t repeat);
extern void fifo_free(void* ptr, size_t size, size_t repeat);
// clang-format off
#ifdef __POSIX__
#include <zlib.h>
#else
#include <zlib/zlib.h>
#endif
#ifdef _MSC_VER
#define ALIGN_STACK(n) alignas(n) int dummy__; (void)dummy__;
#else
#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
#ifdef ENABLE_VTUNE
#include "jitprofiling.h"
#ifdef _WIN32
#pragma comment(lib, "jitprofiling.lib")
#endif
#endif
#ifdef _WIN32
#define DIRECTORY_SEPARATOR '\\'
#else
#include <sys/stat.h> // mkdir
#define DIRECTORY_SEPARATOR '/'
#endif

67
pcsx2/GS/GSGL.h Normal file
View File

@ -0,0 +1,67 @@
/* 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
#include "Renderers/OpenGL/GLLoader.h"
#include "GSExtra.h"
// Note: GL messages are present in common code, so in all renderers.
#define GL_INSERT(type, code, sev, ...) \
do \
if (glDebugMessageInsert) glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, type, code, sev, -1, format(__VA_ARGS__).c_str()); \
while(0);
#if defined(_DEBUG)
#define GL_CACHE(...) GL_INSERT(GL_DEBUG_TYPE_OTHER, 0xFEAD, GL_DEBUG_SEVERITY_NOTIFICATION, __VA_ARGS__)
#else
#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__)
#else
#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__)
#else
#define GL_DBG(...) (void)(0);
#endif
#if defined(ENABLE_OGL_DEBUG)
struct GLAutoPop
{
~GLAutoPop()
{
if (glPopDebugGroup)
glPopDebugGroup();
}
};
#define GL_PUSH_(...) do if (glPushDebugGroup) glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0xBAD, -1, format(__VA_ARGS__).c_str()); while(0);
#define GL_PUSH(...) do if (glPushDebugGroup) glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0xBAD, -1, format(__VA_ARGS__).c_str()); while(0); GLAutoPop gl_auto_pop;
#define GL_POP() do if (glPopDebugGroup) glPopDebugGroup(); while(0);
#define GL_INS(...) GL_INSERT(GL_DEBUG_TYPE_ERROR, 0xDEAD, GL_DEBUG_SEVERITY_MEDIUM, __VA_ARGS__)
#define GL_PERF(...) GL_INSERT(GL_DEBUG_TYPE_PERFORMANCE, 0xFEE1, GL_DEBUG_SEVERITY_NOTIFICATION, __VA_ARGS__)
#else
#define GL_PUSH_(...) (void)(0);
#define GL_PUSH(...) (void)(0);
#define GL_POP() (void)(0);
#define GL_INS(...) (void)(0);
#define GL_PERF(...) (void)(0);
#endif

44
pcsx2/GS/GSIntrin.h Normal file
View File

@ -0,0 +1,44 @@
/* 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
#include <xmmintrin.h>
#include <emmintrin.h>
#include <tmmintrin.h>
#include <smmintrin.h>
#if _M_SSE >= 0x500
#include <immintrin.h>
#endif
#if !defined(_MSC_VER)
// http://svn.reactos.org/svn/reactos/trunk/reactos/include/crt/mingw32/intrin_x86.h?view=markup
static int _BitScanForward(unsigned long* const Index, const unsigned long Mask)
{
#if __has_builtin(__builtin_ctz)
if (Mask == 0)
return 0;
*Index = __builtin_ctz(Mask);
return 1;
#else
__asm__("bsfl %k[Mask], %k[Index]" : [Index] "=r" (*Index) : [Mask] "mr" (Mask) : "cc");
return Mask ? 1 : 0;
#endif
}
#endif

View File

@ -16,6 +16,7 @@
#include "PrecompiledHeader.h"
#include "GSLocalMemory.h"
#include "GS.h"
#include "GSExtra.h"
#include <unordered_set>
template <typename Fn>

View File

@ -15,7 +15,6 @@
#pragma once
#include "GS.h"
#include "GSTables.h"
#include "GSVector.h"
#include "GSBlock.h"

View File

@ -15,7 +15,7 @@
#include "PrecompiledHeader.h"
#include "GSPng.h"
#include "GS_types.h"
#include "GSExtra.h"
#include <zlib.h>
#include <png.h>

1411
pcsx2/GS/GSRegs.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@
#include "PrecompiledHeader.h"
#include "GSState.h"
#include "GS.h"
#include "GSGL.h"
#include "GSUtil.h"
#include <algorithm> // clamp

View File

@ -14,6 +14,8 @@
*/
#include "PrecompiledHeader.h"
#include "GS.h"
#include "GSExtra.h"
#include "GSUtil.h"
#include <locale>
#include <codecvt>

View File

@ -16,6 +16,7 @@
#pragma once
#include "GS.h"
#include "GSRegs.h"
#include <xbyak/xbyak_util.h>

View File

@ -14,7 +14,6 @@
*/
#include "PrecompiledHeader.h"
#include "GS.h"
#include "GSVector.h"
#include <cfloat>

View File

@ -14,6 +14,7 @@
*/
#include "PrecompiledHeader.h"
#include "GSIntrin.h"
#pragma once

View File

@ -14,8 +14,9 @@
*/
#include "PrecompiledHeader.h"
#include "GS/GS.h"
#include "GSDevice.h"
#include "GS/GSGL.h"
#include "GS/GS.h"
GSDevice::GSDevice()
: m_vsync(false)

View File

@ -22,6 +22,9 @@
#include "GS/GSAlignedClass.h"
#include "GSOsdManager.h"
#include <array>
#ifdef _WIN32
#include <dxgi.h>
#endif
enum ShaderConvert
{

View File

@ -15,9 +15,8 @@
#pragma once
#include "GS/GS.h"
#include "GS/GSCodeBuffer.h"
#include "GS/GSExtra.h"
#include "GS/Renderers/SW/GSScanlineEnvironment.h"
#include "common/emitter/tools.h"

View File

@ -14,8 +14,8 @@
*/
#include "PrecompiledHeader.h"
#include "GS/GS.h"
#include "GSOsdManager.h"
#include "GS/GS.h"
#ifdef _WIN32
#include "GS/resource.h"
#endif

View File

@ -21,6 +21,7 @@
#include "GSTexture.h"
#include "ft2build.h"
#include FT_FREETYPE_H
#include <map>
class GSOsdManager
{

View File

@ -15,8 +15,8 @@
#include "PrecompiledHeader.h"
#include "GSRenderer.h"
#include "Host.h"
#include "pcsx2/Config.h"
#include "gui/AppConfig.h"
#include "GS/GSGL.h"
#if defined(__unix__)
#include <X11/keysym.h>
#endif

View File

@ -15,7 +15,6 @@
#pragma once
#include "GS/GS.h"
#include "GS/GSState.h"
#include "GS/GSCapture.h"

View File

@ -15,7 +15,7 @@
#pragma once
#include "GS/GS.h"
#include "GS/GSRegs.h"
#include "GS/GSVector.h"
#include "GS/Renderers/HW/GSVertexHW.h"
#include "GS/Renderers/SW/GSVertexSW.h"

View File

@ -15,6 +15,7 @@
#pragma once
#include "GS/GS.h"
#include "GS/GSDrawingContext.h"
#include "GSVertex.h"
#include "GS/Renderers/SW/GSVertexSW.h"

View File

@ -15,7 +15,7 @@
#include "PrecompiledHeader.h"
#include "GS/Renderers/DX11/D3D.h"
#include "GS/GS.h"
#include "GS/GSExtra.h"
#include <d3d11.h>

View File

@ -17,6 +17,7 @@
#include "GS.h"
#include "GSDevice11.h"
#include "GS/Renderers/DX11/D3D.h"
#include "GS/GSExtra.h"
#include "GS/GSUtil.h"
#include "GS/resource.h"
#include <fstream>

View File

@ -15,7 +15,6 @@
#include "PrecompiledHeader.h"
#include "GS/GSState.h"
#include "GS.h"
bool s_nativeres;
static CRCHackLevel s_crc_hack_level = CRCHackLevel::Full;

View File

@ -15,6 +15,7 @@
#include "PrecompiledHeader.h"
#include "GSRendererHW.h"
#include "GS/GSGL.h"
const float GSRendererHW::SSR_UV_TOLERANCE = 1e-3f;

View File

@ -16,6 +16,8 @@
#include "PrecompiledHeader.h"
#include "GSTextureCache.h"
#include "GSRendererHW.h"
#include "GS/GSGL.h"
#include "GS/GSIntrin.h"
#include "GS/GSUtil.h"
bool GSTextureCache::m_disable_partial_invalidation = false;

View File

@ -15,7 +15,6 @@
#pragma once
#include "GS/GS.h"
#include "GS/GSVector.h"
#pragma pack(push, 1)

View File

@ -15,7 +15,7 @@
#include "PrecompiledHeader.h"
#include "GLLoader.h"
#include "GS.h"
#include "GS/GS.h"
#include <unordered_set>
namespace GLExtension

View File

@ -15,7 +15,7 @@
#pragma once
#include "GS/GS.h"
#include "GS/GSGL.h"
#include "GS/GSVector.h"
namespace GLState

View File

@ -19,7 +19,6 @@
#include "common/GL/StreamBuffer.h"
#include "GS/Renderers/Common/GSDevice.h"
#include "GSTextureOGL.h"
#include "GS/GS.h"
#include "GSUniformBufferOGL.h"
#include "GSShaderOGL.h"
#include "GLState.h"

View File

@ -16,6 +16,7 @@
#include "PrecompiledHeader.h"
#include "GSShaderOGL.h"
#include "GLState.h"
#include "GS/GS.h"
#ifdef _WIN32
#include "GS/resource.h"

View File

@ -15,7 +15,7 @@
#pragma once
#include "GS.h"
#include "GS/GSGL.h"
#include <unordered_map>
class GSShaderOGL

View File

@ -16,7 +16,7 @@
#pragma once
#include "GS/Renderers/Common/GSTexture.h"
#include "GS.h"
#include "GS/GSGL.h"
namespace PboPool
{

View File

@ -15,7 +15,6 @@
#pragma once
#include "GS/GS_types.h"
#include "xbyak/xbyak.h"
#include "xbyak/xbyak_util.h"

View File

@ -17,7 +17,7 @@
#include "PrecompiledHeader.h"
#include "GSRasterizer.h"
#include "common/General.h"
#include "GS/GSExtra.h"
int GSRasterizerData::s_counter = 0;

View File

@ -15,7 +15,6 @@
#pragma once
#include "GS.h"
#include "GSVertexSW.h"
#include "GS/Renderers/Common/GSFunctionMap.h"
#include "GS/GSAlignedClass.h"

View File

@ -15,6 +15,7 @@
#include "PrecompiledHeader.h"
#include "GSRendererSW.h"
#include "GS/GSGL.h"
#define LOG 0

View File

@ -14,7 +14,6 @@
*/
#include "PrecompiledHeader.h"
#include "GS/GS_types.h"
#include "GSSetupPrimCodeGenerator.all.h"
#include "GSVertexSW.h"

View File

@ -16,7 +16,7 @@
#include "PrecompiledHeader.h"
#include "GS.h"
#include "GSCaptureDlg.h"
#include "GS/GS_types.h"
#include "GS/GSExtra.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.

View File

@ -18,6 +18,7 @@
#include "gui/AppConfig.h"
#ifdef _WIN32
#include "GS/GSExtra.h"
#include "GS/Renderers/DX11/D3D.h"
#endif

View File

@ -16,7 +16,6 @@
#include "PrecompiledHeader.h"
#include "Common.h"
#include "GS.h"
#include "Gif_Unit.h"
#include "Vif_Dma.h"
#include "MTVU.h"

View File

@ -19,6 +19,7 @@
#include "Gif.h"
#include "Vif.h"
#include "GS.h"
#include "GS/GSRegs.h"
// FIXME common path ?
#include "common/boost_spsc_queue.hpp"

View File

@ -812,7 +812,10 @@
<ClInclude Include="GS\Renderers\OpenGL\GLLoader.h" />
<ClInclude Include="GS\Renderers\OpenGL\GLState.h" />
<ClInclude Include="GS\GS.h" />
<ClInclude Include="GS\GS_types.h" />
<ClInclude Include="GS\GSExtra.h" />
<ClInclude Include="GS\GSGL.h" />
<ClInclude Include="GS\GSIntrin.h" />
<ClInclude Include="GS\GSRegs.h" />
<ClInclude Include="GS\GSAlignedClass.h" />
<ClInclude Include="GS\GSBlock.h" />
<ClInclude Include="GS\GSCapture.h" />

View File

@ -2490,7 +2490,16 @@
<ClInclude Include="GS\GS.h">
<Filter>System\Ps2\GS</Filter>
</ClInclude>
<ClInclude Include="GS\GS_types.h">
<ClInclude Include="GS\GSExtra.h">
<Filter>System\Ps2\GS</Filter>
</ClInclude>
<ClInclude Include="GS\GSIntrin.h">
<Filter>System\Ps2\GS</Filter>
</ClInclude>
<ClInclude Include="GS\GSGL.h">
<Filter>System\Ps2\GS</Filter>
</ClInclude>
<ClInclude Include="GS\GSRegs.h">
<Filter>System\Ps2\GS</Filter>
</ClInclude>
<ClInclude Include="GS\GSAlignedClass.h">