ANGLE: Fix compilation with MinGW + D3D11
Provide workarounds for things GCC doesn't like, and define a number of macros not found in the MinGW headers. Change-Id: I254c208209c0071fae5efb6727f2b3cfd5542da6 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
parent
68206db907
commit
8f88cc2c0f
4
src/3rdparty/angle/src/libGLESv2/Context.cpp
vendored
4
src/3rdparty/angle/src/libGLESv2/Context.cpp
vendored
@ -368,7 +368,7 @@ void Context::deleteFenceSync(GLsync fenceSync)
|
||||
// wait commands finish. However, since the name becomes invalid, we cannot query the fence,
|
||||
// and since our API is currently designed for being called from a single thread, we can delete
|
||||
// the fence immediately.
|
||||
mResourceManager->deleteFenceSync(reinterpret_cast<GLuint>(fenceSync));
|
||||
mResourceManager->deleteFenceSync(uintptr_t(fenceSync));
|
||||
}
|
||||
|
||||
void Context::deleteVertexArray(GLuint vertexArray)
|
||||
@ -474,7 +474,7 @@ Renderbuffer *Context::getRenderbuffer(GLuint handle)
|
||||
|
||||
FenceSync *Context::getFenceSync(GLsync handle) const
|
||||
{
|
||||
return mResourceManager->getFenceSync(reinterpret_cast<GLuint>(handle));
|
||||
return mResourceManager->getFenceSync(uintptr_t(handle));
|
||||
}
|
||||
|
||||
VertexArray *Context::getVertexArray(GLuint handle) const
|
||||
|
@ -12,6 +12,10 @@
|
||||
#include "libGLESv2/renderer/d3d/d3d11/Renderer11.h"
|
||||
#include "libGLESv2/renderer/d3d/d3d11/formatutils11.h"
|
||||
|
||||
#if defined(__MINGW32__) && !defined(D3D11_MAP_FLAG_DO_NOT_WAIT)
|
||||
# define D3D11_MAP_FLAG_DO_NOT_WAIT 0x100000L
|
||||
#endif
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
|
@ -12,6 +12,14 @@
|
||||
#include "libGLESv2/renderer/d3d/d3d11/renderer11_utils.h"
|
||||
#include "libGLESv2/main.h"
|
||||
|
||||
#if defined(__MINGW32__) // Provide undefined struct
|
||||
typedef struct D3D11_QUERY_DATA_SO_STATISTICS
|
||||
{
|
||||
UINT64 NumPrimitivesWritten;
|
||||
UINT64 PrimitivesStorageNeeded;
|
||||
} D3D11_QUERY_DATA_SO_STATISTICS;
|
||||
#endif
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
|
@ -51,4 +51,4 @@ class RenderTarget11 : public RenderTarget
|
||||
|
||||
}
|
||||
|
||||
#endif LIBGLESV2_RENDERER_RENDERTARGET11_H_
|
||||
#endif // LIBGLESV2_RENDERER_RENDERTARGET11_H_
|
||||
|
@ -49,6 +49,31 @@
|
||||
#define ANGLE_SUPPRESS_D3D11_HAZARD_WARNINGS 1
|
||||
#endif
|
||||
|
||||
#ifndef D3D11_PS_INPUT_REGISTER_COUNT
|
||||
# define D3D11_PS_INPUT_REGISTER_COUNT 32
|
||||
#endif
|
||||
#ifndef D3D10_1_VS_OUTPUT_REGISTER_COUNT
|
||||
# define D3D10_1_VS_OUTPUT_REGISTER_COUNT 32
|
||||
#endif
|
||||
#ifndef D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT
|
||||
# define D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT 14
|
||||
#endif
|
||||
#ifndef D3D11_SO_BUFFER_SLOT_COUNT
|
||||
# define D3D11_SO_BUFFER_SLOT_COUNT 4
|
||||
#endif
|
||||
#ifndef D3D10_1_SO_BUFFER_SLOT_COUNT
|
||||
# define D3D10_1_SO_BUFFER_SLOT_COUNT 4
|
||||
#endif
|
||||
#ifndef D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT
|
||||
# define D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT 4096
|
||||
#endif
|
||||
#ifndef D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP
|
||||
# define D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP 32
|
||||
#endif
|
||||
#ifndef D3D11_REQ_DRAW_VERTEX_COUNT_2_TO_EXP
|
||||
# define D3D11_REQ_DRAW_VERTEX_COUNT_2_TO_EXP 32
|
||||
#endif
|
||||
|
||||
namespace rx
|
||||
{
|
||||
static const DXGI_FORMAT RenderTargetFormats[] =
|
||||
@ -275,7 +300,7 @@ EGLint Renderer11::initialize()
|
||||
}
|
||||
|
||||
// Disable some spurious D3D11 debug warnings to prevent them from flooding the output log
|
||||
#if defined(ANGLE_SUPPRESS_D3D11_HAZARD_WARNINGS) && defined(_DEBUG)
|
||||
#if !defined(__MINGW32__) && defined(ANGLE_SUPPRESS_D3D11_HAZARD_WARNINGS) && defined(_DEBUG)
|
||||
ID3D11InfoQueue *infoQueue;
|
||||
result = mDevice->QueryInterface(__uuidof(ID3D11InfoQueue), (void **)&infoQueue);
|
||||
|
||||
|
@ -261,7 +261,7 @@ class Renderer11 : public Renderer
|
||||
};
|
||||
MultisampleSupportInfo getMultisampleSupportInfo(DXGI_FORMAT format);
|
||||
|
||||
typedef std::unordered_map<DXGI_FORMAT, MultisampleSupportInfo> MultisampleSupportMap;
|
||||
typedef std::unordered_map<GLenum, MultisampleSupportInfo> MultisampleSupportMap;
|
||||
MultisampleSupportMap mMultisampleSupportMap;
|
||||
|
||||
unsigned int mMaxSupportedSamples;
|
||||
|
@ -36,6 +36,15 @@
|
||||
#ifndef D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION
|
||||
# define D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION 4096
|
||||
#endif
|
||||
#ifndef D3D11_REQ_TEXTURECUBE_DIMENSION
|
||||
# define D3D11_REQ_TEXTURECUBE_DIMENSION 16384
|
||||
#endif
|
||||
#ifndef D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION
|
||||
# define D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION 2048
|
||||
#endif
|
||||
#ifndef D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION
|
||||
# define D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION 2048
|
||||
#endif
|
||||
|
||||
namespace rx
|
||||
{
|
||||
@ -671,7 +680,7 @@ void SetPositionLayerTexCoord3DVertex(PositionLayerTexCoord3DVertex* vertex, flo
|
||||
|
||||
HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name)
|
||||
{
|
||||
#if defined(_DEBUG)
|
||||
#if !defined(__MINGW32__) && defined(_DEBUG)
|
||||
return resource->SetPrivateData(WKPDID_D3DDebugObjectName, strlen(name), name);
|
||||
#else
|
||||
return S_OK;
|
||||
|
@ -0,0 +1,175 @@
|
||||
From ac4e9bb72ca22fd39bfc43f087108694db2ae8ac Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Knight <andrew.knight@digia.com>
|
||||
Date: Thu, 4 Sep 2014 15:32:17 +0300
|
||||
Subject: [PATCH] ANGLE: Fix compilation with MinGW + D3D11
|
||||
|
||||
Provide workarounds for things GCC doesn't like, and define a number
|
||||
of macros not found in the MinGW headers.
|
||||
|
||||
Change-Id: I254c208209c0071fae5efb6727f2b3cfd5542da6
|
||||
---
|
||||
src/3rdparty/angle/src/libGLESv2/Context.cpp | 4 ++--
|
||||
.../src/libGLESv2/renderer/d3d/d3d11/Buffer11.cpp | 4 ++++
|
||||
.../src/libGLESv2/renderer/d3d/d3d11/Query11.cpp | 8 +++++++
|
||||
.../libGLESv2/renderer/d3d/d3d11/RenderTarget11.h | 2 +-
|
||||
.../libGLESv2/renderer/d3d/d3d11/Renderer11.cpp | 27 +++++++++++++++++++++-
|
||||
.../src/libGLESv2/renderer/d3d/d3d11/Renderer11.h | 2 +-
|
||||
.../renderer/d3d/d3d11/renderer11_utils.cpp | 11 ++++++++-
|
||||
7 files changed, 52 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/3rdparty/angle/src/libGLESv2/Context.cpp b/src/3rdparty/angle/src/libGLESv2/Context.cpp
|
||||
index 8201acd..99df85b 100644
|
||||
--- a/src/3rdparty/angle/src/libGLESv2/Context.cpp
|
||||
+++ b/src/3rdparty/angle/src/libGLESv2/Context.cpp
|
||||
@@ -368,7 +368,7 @@ void Context::deleteFenceSync(GLsync fenceSync)
|
||||
// wait commands finish. However, since the name becomes invalid, we cannot query the fence,
|
||||
// and since our API is currently designed for being called from a single thread, we can delete
|
||||
// the fence immediately.
|
||||
- mResourceManager->deleteFenceSync(reinterpret_cast<GLuint>(fenceSync));
|
||||
+ mResourceManager->deleteFenceSync(uintptr_t(fenceSync));
|
||||
}
|
||||
|
||||
void Context::deleteVertexArray(GLuint vertexArray)
|
||||
@@ -474,7 +474,7 @@ Renderbuffer *Context::getRenderbuffer(GLuint handle)
|
||||
|
||||
FenceSync *Context::getFenceSync(GLsync handle) const
|
||||
{
|
||||
- return mResourceManager->getFenceSync(reinterpret_cast<GLuint>(handle));
|
||||
+ return mResourceManager->getFenceSync(uintptr_t(handle));
|
||||
}
|
||||
|
||||
VertexArray *Context::getVertexArray(GLuint handle) const
|
||||
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Buffer11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Buffer11.cpp
|
||||
index 352da96..1301124 100644
|
||||
--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Buffer11.cpp
|
||||
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Buffer11.cpp
|
||||
@@ -12,6 +12,10 @@
|
||||
#include "libGLESv2/renderer/d3d/d3d11/Renderer11.h"
|
||||
#include "libGLESv2/renderer/d3d/d3d11/formatutils11.h"
|
||||
|
||||
+#if defined(__MINGW32__) && !defined(D3D11_MAP_FLAG_DO_NOT_WAIT)
|
||||
+# define D3D11_MAP_FLAG_DO_NOT_WAIT 0x100000L
|
||||
+#endif
|
||||
+
|
||||
namespace rx
|
||||
{
|
||||
|
||||
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Query11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Query11.cpp
|
||||
index 17cf5ca..e5e0032 100644
|
||||
--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Query11.cpp
|
||||
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Query11.cpp
|
||||
@@ -12,6 +12,14 @@
|
||||
#include "libGLESv2/renderer/d3d/d3d11/renderer11_utils.h"
|
||||
#include "libGLESv2/main.h"
|
||||
|
||||
+#if defined(__MINGW32__) // Provide undefined struct
|
||||
+typedef struct D3D11_QUERY_DATA_SO_STATISTICS
|
||||
+{
|
||||
+ UINT64 NumPrimitivesWritten;
|
||||
+ UINT64 PrimitivesStorageNeeded;
|
||||
+} D3D11_QUERY_DATA_SO_STATISTICS;
|
||||
+#endif
|
||||
+
|
||||
namespace rx
|
||||
{
|
||||
|
||||
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/RenderTarget11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/RenderTarget11.h
|
||||
index ba9f76e..8218295 100644
|
||||
--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/RenderTarget11.h
|
||||
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/RenderTarget11.h
|
||||
@@ -51,4 +51,4 @@ class RenderTarget11 : public RenderTarget
|
||||
|
||||
}
|
||||
|
||||
-#endif LIBGLESV2_RENDERER_RENDERTARGET11_H_
|
||||
+#endif // LIBGLESV2_RENDERER_RENDERTARGET11_H_
|
||||
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp
|
||||
index 651b065..3ba0cc7 100644
|
||||
--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp
|
||||
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.cpp
|
||||
@@ -49,6 +49,31 @@
|
||||
#define ANGLE_SUPPRESS_D3D11_HAZARD_WARNINGS 1
|
||||
#endif
|
||||
|
||||
+#ifndef D3D11_PS_INPUT_REGISTER_COUNT
|
||||
+# define D3D11_PS_INPUT_REGISTER_COUNT 32
|
||||
+#endif
|
||||
+#ifndef D3D10_1_VS_OUTPUT_REGISTER_COUNT
|
||||
+# define D3D10_1_VS_OUTPUT_REGISTER_COUNT 32
|
||||
+#endif
|
||||
+#ifndef D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT
|
||||
+# define D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT 14
|
||||
+#endif
|
||||
+#ifndef D3D11_SO_BUFFER_SLOT_COUNT
|
||||
+# define D3D11_SO_BUFFER_SLOT_COUNT 4
|
||||
+#endif
|
||||
+#ifndef D3D10_1_SO_BUFFER_SLOT_COUNT
|
||||
+# define D3D10_1_SO_BUFFER_SLOT_COUNT 4
|
||||
+#endif
|
||||
+#ifndef D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT
|
||||
+# define D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT 4096
|
||||
+#endif
|
||||
+#ifndef D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP
|
||||
+# define D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP 32
|
||||
+#endif
|
||||
+#ifndef D3D11_REQ_DRAW_VERTEX_COUNT_2_TO_EXP
|
||||
+# define D3D11_REQ_DRAW_VERTEX_COUNT_2_TO_EXP 32
|
||||
+#endif
|
||||
+
|
||||
namespace rx
|
||||
{
|
||||
static const DXGI_FORMAT RenderTargetFormats[] =
|
||||
@@ -275,7 +300,7 @@ EGLint Renderer11::initialize()
|
||||
}
|
||||
|
||||
// Disable some spurious D3D11 debug warnings to prevent them from flooding the output log
|
||||
-#if defined(ANGLE_SUPPRESS_D3D11_HAZARD_WARNINGS) && defined(_DEBUG)
|
||||
+#if !defined(__MINGW32__) && defined(ANGLE_SUPPRESS_D3D11_HAZARD_WARNINGS) && defined(_DEBUG)
|
||||
ID3D11InfoQueue *infoQueue;
|
||||
result = mDevice->QueryInterface(__uuidof(ID3D11InfoQueue), (void **)&infoQueue);
|
||||
|
||||
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.h b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.h
|
||||
index a31f15e..b54f75d 100644
|
||||
--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.h
|
||||
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/Renderer11.h
|
||||
@@ -261,7 +261,7 @@ class Renderer11 : public Renderer
|
||||
};
|
||||
MultisampleSupportInfo getMultisampleSupportInfo(DXGI_FORMAT format);
|
||||
|
||||
- typedef std::unordered_map<DXGI_FORMAT, MultisampleSupportInfo> MultisampleSupportMap;
|
||||
+ typedef std::unordered_map<GLenum, MultisampleSupportInfo> MultisampleSupportMap;
|
||||
MultisampleSupportMap mMultisampleSupportMap;
|
||||
|
||||
unsigned int mMaxSupportedSamples;
|
||||
diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/renderer11_utils.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/renderer11_utils.cpp
|
||||
index 8e0c21b..d914a82 100644
|
||||
--- a/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/renderer11_utils.cpp
|
||||
+++ b/src/3rdparty/angle/src/libGLESv2/renderer/d3d/d3d11/renderer11_utils.cpp
|
||||
@@ -36,6 +36,15 @@
|
||||
#ifndef D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION
|
||||
# define D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION 4096
|
||||
#endif
|
||||
+#ifndef D3D11_REQ_TEXTURECUBE_DIMENSION
|
||||
+# define D3D11_REQ_TEXTURECUBE_DIMENSION 16384
|
||||
+#endif
|
||||
+#ifndef D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION
|
||||
+# define D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION 2048
|
||||
+#endif
|
||||
+#ifndef D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION
|
||||
+# define D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION 2048
|
||||
+#endif
|
||||
|
||||
namespace rx
|
||||
{
|
||||
@@ -671,7 +680,7 @@ void SetPositionLayerTexCoord3DVertex(PositionLayerTexCoord3DVertex* vertex, flo
|
||||
|
||||
HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name)
|
||||
{
|
||||
-#if defined(_DEBUG)
|
||||
+#if !defined(__MINGW32__) && defined(_DEBUG)
|
||||
return resource->SetPrivateData(WKPDID_D3DDebugObjectName, strlen(name), name);
|
||||
#else
|
||||
return S_OK;
|
||||
--
|
||||
1.9.0.msysgit.0
|
||||
|
Loading…
Reference in New Issue
Block a user