Separate T3DCreate* into its own header to avoid including Windows.h etc in some cases.

This commit is contained in:
Henrik Rydgård 2018-02-25 10:27:59 +01:00
parent 5d77c63216
commit 5f8118b82b
19 changed files with 59 additions and 34 deletions

View File

@ -980,6 +980,7 @@ add_library(native STATIC
ext/native/profiler/profiler.h ext/native/profiler/profiler.h
ext/native/thin3d/thin3d.cpp ext/native/thin3d/thin3d.cpp
ext/native/thin3d/thin3d.h ext/native/thin3d/thin3d.h
ext/native/thin3d/thin3d_create.h
${THIN3D_PLATFORMS} ${THIN3D_PLATFORMS}
ext/native/thread/executor.cpp ext/native/thread/executor.cpp
ext/native/thread/executor.h ext/native/thread/executor.h

View File

@ -14,4 +14,5 @@
#undef min #undef min
#undef max #undef max
#undef DrawText
#endif #endif

View File

@ -37,6 +37,7 @@
#include "Common/GraphicsContext.h" #include "Common/GraphicsContext.h"
#ifdef _WIN32 #ifdef _WIN32
#include "Common/CommonWindows.h"
#include "Windows/InputDevice.h" #include "Windows/InputDevice.h"
#endif #endif

View File

@ -39,6 +39,7 @@ QTM_USE_NAMESPACE
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/Config.h" #include "Core/Config.h"
#include "Core/System.h" #include "Core/System.h"
#include "thin3d/thin3d_create.h"
#include "thin3d/GLRenderManager.h" #include "thin3d/GLRenderManager.h"
// Input // Input

View File

@ -42,6 +42,7 @@
#include "UI/GameSettingsScreen.h" #include "UI/GameSettingsScreen.h"
#ifdef _WIN32 #ifdef _WIN32
#include "Common/CommonWindows.h"
// Want to avoid including the full header here as it includes d3dx.h // Want to avoid including the full header here as it includes d3dx.h
int GetD3DXVersion(); int GetD3DXVersion();
#endif #endif

View File

@ -14,6 +14,7 @@
#include "Windows/GPU/D3D11Context.h" #include "Windows/GPU/D3D11Context.h"
#include "Windows/W32Util/Misc.h" #include "Windows/W32Util/Misc.h"
#include "thin3d/thin3d.h" #include "thin3d/thin3d.h"
#include "thin3d/thin3d_create.h"
#include "thin3d/d3d11_loader.h" #include "thin3d/d3d11_loader.h"
#if PPSSPP_PLATFORM(UWP) #if PPSSPP_PLATFORM(UWP)

View File

@ -14,6 +14,7 @@
#include "Windows/GPU/D3D9Context.h" #include "Windows/GPU/D3D9Context.h"
#include "Windows/W32Util/Misc.h" #include "Windows/W32Util/Misc.h"
#include "thin3d/thin3d.h" #include "thin3d/thin3d.h"
#include "thin3d/thin3d_create.h"
#include "thin3d/d3dx9_loader.h" #include "thin3d/d3dx9_loader.h"
void D3D9Context::SwapBuffers() { void D3D9Context::SwapBuffers() {

View File

@ -21,6 +21,7 @@
#include "gfx/gl_common.h" #include "gfx/gl_common.h"
#include "gfx/gl_debug_log.h" #include "gfx/gl_debug_log.h"
#include "gfx_es2/gpu_features.h" #include "gfx_es2/gpu_features.h"
#include "thin3d/thin3d_create.h"
#include "thin3d/GLRenderManager.h" #include "thin3d/GLRenderManager.h"
#include "GL/gl.h" #include "GL/gl.h"
#include "GL/wglew.h" #include "GL/wglew.h"

View File

@ -58,6 +58,7 @@
#include "base/stringutil.h" #include "base/stringutil.h"
#include "thin3d/thin3d.h" #include "thin3d/thin3d.h"
#include "thin3d/thin3d_create.h"
#include "thin3d/VulkanRenderManager.h" #include "thin3d/VulkanRenderManager.h"
#include "util/text/parsers.h" #include "util/text/parsers.h"
#include "Windows/GPU/WindowsVulkanContext.h" #include "Windows/GPU/WindowsVulkanContext.h"

View File

@ -2,6 +2,7 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/NativeApp.h" #include "base/NativeApp.h"
#include "gfx_es2/gpu_features.h" #include "gfx_es2/gpu_features.h"
#include "thin3d/thin3d_create.h"
#include "AndroidEGLContext.h" #include "AndroidEGLContext.h"
#include "GL/GLInterface/EGLAndroid.h" #include "GL/GLInterface/EGLAndroid.h"

View File

@ -6,6 +6,7 @@
#include "AndroidGraphicsContext.h" #include "AndroidGraphicsContext.h"
#include "thin3d/GLRenderManager.h" #include "thin3d/GLRenderManager.h"
#include "thin3d/thin3d_create.h"
// Doesn't do much. Just to fit in. // Doesn't do much. Just to fit in.
class AndroidJavaEGLGraphicsContext : public AndroidGraphicsContext { class AndroidJavaEGLGraphicsContext : public AndroidGraphicsContext {

View File

@ -6,6 +6,7 @@
#include "Common/Vulkan/VulkanLoader.h" #include "Common/Vulkan/VulkanLoader.h"
#include "Common/Vulkan/VulkanContext.h" #include "Common/Vulkan/VulkanContext.h"
#include "thin3d/VulkanRenderManager.h" #include "thin3d/VulkanRenderManager.h"
#include "thin3d/thin3d_create.h"
#include "util/text/parsers.h" #include "util/text/parsers.h"
#include "Core/Config.h" #include "Core/Config.h"
#include "Core/System.h" #include "Core/System.h"

View File

@ -11,8 +11,6 @@
#include "math/lin/matrix4x4.h" #include "math/lin/matrix4x4.h"
#include "thin3d/thin3d.h" #include "thin3d/thin3d.h"
#undef DrawText
struct Atlas; struct Atlas;
enum { enum {

View File

@ -243,6 +243,7 @@
<ClInclude Include="thin3d\DataFormatGL.h" /> <ClInclude Include="thin3d\DataFormatGL.h" />
<ClInclude Include="thin3d\GLQueueRunner.h" /> <ClInclude Include="thin3d\GLQueueRunner.h" />
<ClInclude Include="thin3d\GLRenderManager.h" /> <ClInclude Include="thin3d\GLRenderManager.h" />
<ClInclude Include="thin3d\thin3d_create.h" />
<ClInclude Include="thin3d\VulkanQueueRunner.h" /> <ClInclude Include="thin3d\VulkanQueueRunner.h" />
<ClInclude Include="thin3d\VulkanRenderManager.h" /> <ClInclude Include="thin3d\VulkanRenderManager.h" />
<ClInclude Include="util\text\wrap_text.h" /> <ClInclude Include="util\text\wrap_text.h" />

View File

@ -338,6 +338,9 @@
<ClInclude Include="thin3d\DataFormatGL.h"> <ClInclude Include="thin3d\DataFormatGL.h">
<Filter>thin3d</Filter> <Filter>thin3d</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="thin3d\thin3d_create.h">
<Filter>thin3d</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="gfx\gl_debug_log.cpp"> <ClCompile Include="gfx\gl_debug_log.cpp">

View File

@ -6,7 +6,7 @@
#pragma once #pragma once
#include <stdint.h> #include <cstdint>
#include <cstddef> #include <cstddef>
#include <vector> #include <vector>
#include <string> #include <string>
@ -16,26 +16,6 @@
class Matrix4x4; class Matrix4x4;
#ifdef _WIN32
#ifndef NOMINMAX
#define NOMINMAX
#endif
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <d3dcommon.h>
struct IDirect3DDevice9;
struct IDirect3D9;
struct IDirect3DDevice9Ex;
struct IDirect3D9Ex;
struct ID3D11Device;
struct ID3D11DeviceContext;
struct ID3D11Device1;
struct ID3D11DeviceContext1;
#endif
class VulkanContext;
namespace Draw { namespace Draw {
// Useful in UBOs // Useful in UBOs
@ -664,17 +644,8 @@ protected:
int targetHeight_; int targetHeight_;
}; };
DrawContext *T3DCreateGLContext();
extern const UniformBufferDesc UBPresetDesc; extern const UniformBufferDesc UBPresetDesc;
#ifdef _WIN32
DrawContext *T3DCreateDX9Context(IDirect3D9 *d3d, IDirect3D9Ex *d3dEx, int adapterId, IDirect3DDevice9 *device, IDirect3DDevice9Ex *deviceEx);
DrawContext *T3DCreateD3D11Context(ID3D11Device *device, ID3D11DeviceContext *context, ID3D11Device1 *device1, ID3D11DeviceContext1 *context1, D3D_FEATURE_LEVEL featureLevel, HWND hWnd);
#endif
DrawContext *T3DCreateVulkanContext(VulkanContext *context, bool split);
// UBs for the preset shaders // UBs for the preset shaders
struct VsTexColUB { struct VsTexColUB {

View File

@ -0,0 +1,38 @@
#pragma once
#include "thin3d/thin3d.h"
// Separated this stuff into its own file so we don't get Windows.h included if all we want is the thin3d declarations.
#ifdef _WIN32
#ifndef NOMINMAX
#define NOMINMAX
#endif
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <d3dcommon.h>
struct IDirect3DDevice9;
struct IDirect3D9;
struct IDirect3DDevice9Ex;
struct IDirect3D9Ex;
struct ID3D11Device;
struct ID3D11DeviceContext;
struct ID3D11Device1;
struct ID3D11DeviceContext1;
#endif
class VulkanContext;
namespace Draw {
DrawContext *T3DCreateGLContext();
#ifdef _WIN32
DrawContext *T3DCreateDX9Context(IDirect3D9 *d3d, IDirect3D9Ex *d3dEx, int adapterId, IDirect3DDevice9 *device, IDirect3DDevice9Ex *deviceEx);
DrawContext *T3DCreateD3D11Context(ID3D11Device *device, ID3D11DeviceContext *context, ID3D11Device1 *device1, ID3D11DeviceContext1 *context1, D3D_FEATURE_LEVEL featureLevel, HWND hWnd);
#endif
DrawContext *T3DCreateVulkanContext(VulkanContext *context, bool split);
} // namespace Draw

View File

@ -36,6 +36,7 @@
#include "gfx_es2/gpu_features.h" #include "gfx_es2/gpu_features.h"
#include "file/vfs.h" #include "file/vfs.h"
#include "file/zip_read.h" #include "file/zip_read.h"
#include "thin3d/thin3d_create.h"
const bool WINDOW_VISIBLE = false; const bool WINDOW_VISIBLE = false;
const int WINDOW_WIDTH = 480; const int WINDOW_WIDTH = 480;

View File

@ -16,6 +16,7 @@
#include "net/resolve.h" #include "net/resolve.h"
#include "ui/screen.h" #include "ui/screen.h"
#include "thin3d/thin3d.h" #include "thin3d/thin3d.h"
#include "thin3d/thin3d_create.h"
#include "thin3d/GLRenderManager.h" #include "thin3d/GLRenderManager.h"
#include "input/keycodes.h" #include "input/keycodes.h"
#include "gfx_es2/gpu_features.h" #include "gfx_es2/gpu_features.h"