Browse Source

Add support for SDL_render_d3d12.c to compile in C++ mode

unknown 3 years ago
parent
commit
51c6488f97

+ 10 - 0
src/core/windows/SDL_windows.h

@@ -65,6 +65,11 @@
 #define SDL_tcsstr SDL_strstr
 #endif
 
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Sets an error message based on a given HRESULT */
 extern int WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr);
 
@@ -104,6 +109,11 @@ extern BOOL WIN_IsEqualIID(REFIID a, REFIID b);
 extern void WIN_RECTToRect(const RECT *winrect, SDL_Rect *sdlrect);
 extern void WIN_RectToRECT(const SDL_Rect *sdlrect, RECT *winrect);
 
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _INCLUDED_WINDOWS_H */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 10 - 0
src/render/SDL_d3dmath.h

@@ -22,6 +22,11 @@
 
 #if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED
 
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* Direct3D matrix math functions */
 
 typedef struct
@@ -67,6 +72,11 @@ Float4X4 MatrixRotationX(float r);
 Float4X4 MatrixRotationY(float r);
 Float4X4 MatrixRotationZ(float r);
 
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED */
 
 /* vi: set ts=4 sw=4 expandtab: */

+ 9 - 0
src/render/SDL_sysrender.h

@@ -28,6 +28,10 @@
 #include "SDL_mutex.h"
 #include "SDL_yuv_sw_c.h"
 
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /**
  * A rectangle, with the origin at the upper left (double precision).
@@ -309,6 +313,11 @@ extern void *SDL_AllocateRenderVertices(SDL_Renderer *renderer, const size_t num
 extern int SDL_PrivateLowerBlitScaled(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect, SDL_ScaleMode scaleMode);
 extern int SDL_PrivateUpperBlitScaled(SDL_Surface * src, const SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect, SDL_ScaleMode scaleMode);
 
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* SDL_sysrender_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

File diff suppressed because it is too large
+ 161 - 140
src/render/direct3d12/SDL_render_d3d12.c


+ 10 - 0
src/render/direct3d12/SDL_shaders_d3d12.h

@@ -22,6 +22,11 @@
 
 /* D3D12 shader implementation */
 
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef enum {
     SHADER_SOLID,
     SHADER_RGB,
@@ -54,4 +59,9 @@ extern void D3D12_GetPixelShader(D3D12_Shader shader, D3D12_SHADER_BYTECODE *out
 extern D3D12_RootSignature D3D12_GetRootSignatureType(D3D12_Shader shader);
 extern void D3D12_GetRootSignatureData(D3D12_RootSignature rootSig, D3D12_SHADER_BYTECODE* outBytecode);
 
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
 /* vi: set ts=4 sw=4 expandtab: */

+ 10 - 0
src/video/windows/SDL_windowswindow.h

@@ -27,6 +27,11 @@
 #include "../SDL_egl_c.h"
 #endif
 
+/* Set up for C function definitions, even when using C++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct
 {
     SDL_Window *window;
@@ -102,6 +107,11 @@ extern void WIN_ClientPointFromSDL(const SDL_Window *window, int *w, int *h);
 extern void WIN_AcceptDragAndDrop(SDL_Window * window, SDL_bool accept);
 extern int WIN_FlashWindow(_THIS, SDL_Window * window, SDL_FlashOperation operation);
 
+/* Ends C function definitions when using C++ */
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* SDL_windowswindow_h_ */
 
 /* vi: set ts=4 sw=4 expandtab: */

Some files were not shown because too many files changed in this diff