GS: Header cleanup

This commit is contained in:
TellowKrinkle 2021-08-30 22:06:04 -05:00 committed by tellowkrinkle
parent b74be70ffc
commit ed90e2fcf9
29 changed files with 41 additions and 143 deletions

View File

@ -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"

View File

@ -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 <d3d11_1.h>
#include <dxgi1_3.h>
#else
#include <fcntl.h>
#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 <cstddef>
#include <cstdio>
#include <cstdarg>
#include <cstdlib>
#include <cmath>
#include <cfloat>
#include <ctime>
#include <climits>
#include <cstring>
#include <cassert>
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 4)
#include <codecvt>
#include <locale>
#endif
#include <complex>
#include <string>
#include <array>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <thread>
#include <atomic>
#include <mutex>
#include <condition_variable>
#include <functional>
#include <memory>
#include <bitset>
#ifdef __POSIX__
#include <zlib.h>
@ -99,86 +57,25 @@
#include <zlib/zlib.h>
#endif
#include <unordered_map>
#include <unordered_set>
// 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 <xmmintrin.h>
#include <emmintrin.h>
#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 <tmmintrin.h>
#include <smmintrin.h>
@ -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

View File

@ -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)

View File

@ -15,8 +15,6 @@
#pragma once
#include "GS_types.h"
class GSCodeBuffer
{
std::vector<void*> m_buffers;

View File

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

View File

@ -16,6 +16,7 @@
#include "PrecompiledHeader.h"
#include "GSLocalMemory.h"
#include "GS.h"
#include <unordered_set>
template <typename Fn>
static void foreachBlock(const GSOffset& off, GSLocalMemory* mem, const GSVector4i& r, u8* dst, int dstpitch, int bpp, Fn&& fn)

View File

@ -20,6 +20,8 @@
#include "GSVector.h"
#include "GSBlock.h"
#include "GSClut.h"
#include <array>
#include <unordered_map>
struct GSPixelOffset
{

View File

@ -15,7 +15,6 @@
#include "PrecompiledHeader.h"
#include "GSPerfMon.h"
#include "GS_types.h"
GSPerfMon::GSPerfMon()
: m_frame(0)

View File

@ -15,8 +15,6 @@
#pragma once
#include "GS_types.h"
class GSPerfMon
{
public:

View File

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

View File

@ -17,7 +17,6 @@
#include "PrecompiledHeader.h"
#include "GSTables.h"
#include "GS_types.h"
template <int Width, int Height>
static constexpr GSSizedBlockSwizzleTable<Height, Width> makeSwizzleTable(const u8 (&arr)[Height][Width]) {

View File

@ -15,8 +15,6 @@
#pragma once
#include "GS_types.h"
/// Table for storing swizzling of blocks within a page
struct alignas(64) GSBlockSwizzleTable
{

View File

@ -18,6 +18,9 @@
#include "GS.h"
#include "common/boost_spsc_queue.hpp"
#include "common/General.h"
#include <condition_variable>
#include <functional>
#include <mutex>
template <class T, int CAPACITY>
class GSJobQueue final

View File

@ -16,6 +16,7 @@
#include "PrecompiledHeader.h"
#include "GS.h"
#include "GSVector.h"
#include <cfloat>
CONSTINIT const GSVector4i GSVector4i::m_xff[17] =
{

View File

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

View File

@ -13,8 +13,6 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "GS_types.h"
class alignas(16) GSVector4i
{
static const GSVector4i m_xff[17];
@ -1670,7 +1668,14 @@ public:
__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)

View File

@ -15,8 +15,6 @@
#pragma once
#include <cfloat>
// 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);

View File

@ -21,6 +21,7 @@
#include "GSVertex.h"
#include "GS/GSAlignedClass.h"
#include "GSOsdManager.h"
#include <array>
enum ShaderConvert
{

View File

@ -15,8 +15,6 @@
#pragma once
#include "GS/GS_types.h"
template <class T>
struct Element
{

View File

@ -20,6 +20,11 @@
#include "GS/resource.h"
#endif
#if __GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ >= 4)
#include <codecvt>
#include <locale>
#endif
void GSOsdManager::LoadFont()
{
FT_Error error = FT_New_Face(m_library, theApp.GetConfigS("osd_fontname").c_str(), 0, &m_face);

View File

@ -17,6 +17,7 @@
#include "GSVertexTrace.h"
#include "GS/GSUtil.h"
#include "GS/GSState.h"
#include <cfloat>
CONSTINIT const GSVector4 GSVertexTrace::s_minmax = GSVector4::cxpr(FLT_MAX, -FLT_MAX, 0.f, 0.f);

View File

@ -20,6 +20,7 @@
#include "GS/GSUtil.h"
#include "GS/resource.h"
#include <fstream>
#include <sstream>
#include <VersionHelpers.h>
GSDevice11::GSDevice11()

View File

@ -18,6 +18,7 @@
#include "GSTexture11.h"
#include "GS/GSVector.h"
#include "GS/Renderers/Common/GSDevice.h"
#include <unordered_map>
#include <wil/com.h>
struct GSVertexShader11

View File

@ -18,6 +18,7 @@
#include "GS/Renderers/Common/GSRenderer.h"
#include "GS/Renderers/Common/GSFastList.h"
#include "GS/Renderers/Common/GSDirtyRect.h"
#include <unordered_set>
class GSTextureCache
{

View File

@ -16,6 +16,7 @@
#include "PrecompiledHeader.h"
#include "GLLoader.h"
#include "GS.h"
#include <unordered_set>
namespace GLExtension
{

View File

@ -19,6 +19,7 @@
#include "GLState.h"
#include "GS/GSUtil.h"
#include <fstream>
#include <sstream>
//#define ONLY_LINES

View File

@ -16,6 +16,7 @@
#pragma once
#include "GS.h"
#include <unordered_map>
class GSShaderOGL
{

View File

@ -17,6 +17,7 @@
#include "GS/Renderers/Common/GSRenderer.h"
#include "GS/Renderers/Common/GSFastList.h"
#include <unordered_set>
class GSTextureCacheSW
{

View File

@ -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.