From cb9960c6e2d3fa59b88bbde9fa15b4c509c0ec49 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 9 Nov 2015 01:19:09 +0100 Subject: [PATCH] Compile video_texture as C++ for Win32 --- Makefile.common | 7 ++++++- gfx/d3d/d3d_wrapper.h | 8 ++++++++ gfx/video_texture.cpp | 1 + gfx/video_texture.h | 4 ++-- gfx/{video_texture.c => video_texture_c.c} | 0 griffin/griffin.c | 5 ++++- griffin/griffin_cpp.cpp | 3 +++ 7 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 gfx/video_texture.cpp rename gfx/{video_texture.c => video_texture_c.c} (100%) diff --git a/Makefile.common b/Makefile.common index c52d68ffcf..cd19227cdc 100644 --- a/Makefile.common +++ b/Makefile.common @@ -569,10 +569,15 @@ endif OBJ += gfx/video_context_driver.o \ gfx/drivers_context/gfx_null_ctx.o \ gfx/video_state_tracker.o \ - gfx/video_texture.o \ libretro-common/gfx/math/matrix_4x4.o \ libretro-common/gfx/math/matrix_3x3.o +ifneq ($(findstring Win32,$(OS)),) +OBJ += gfx/video_texture.o +else +OBJ += gfx/video_texture_c.o +endif + ifeq ($(HAVE_GL_CONTEXT), 1) DEFINES += -DHAVE_OPENGL -DHAVE_GLSL OBJ += gfx/drivers/gl.o \ diff --git a/gfx/d3d/d3d_wrapper.h b/gfx/d3d/d3d_wrapper.h index 16a02beebc..4e2c4a71e1 100644 --- a/gfx/d3d/d3d_wrapper.h +++ b/gfx/d3d/d3d_wrapper.h @@ -22,6 +22,10 @@ #include "../common/win32_common.h" #include "d3d_defines.h" +#ifdef __cplusplus +extern "C" { +#endif + bool d3d_swap(void *data, LPDIRECT3DDEVICE dev); LPDIRECT3DVERTEXBUFFER d3d_vertex_buffer_new(LPDIRECT3DDEVICE dev, @@ -95,4 +99,8 @@ void d3d_enable_alpha_blend_texture_func(void *data); void d3d_frame_postprocess(void *data); +#ifdef __cplusplus +} +#endif + #endif diff --git a/gfx/video_texture.cpp b/gfx/video_texture.cpp new file mode 100644 index 0000000000..3f4447b2cc --- /dev/null +++ b/gfx/video_texture.cpp @@ -0,0 +1 @@ +#include "video_texture.c" diff --git a/gfx/video_texture.h b/gfx/video_texture.h index d26e02d391..993f189e67 100644 --- a/gfx/video_texture.h +++ b/gfx/video_texture.h @@ -26,7 +26,7 @@ enum texture_backend_type TEXTURE_BACKEND_DIRECT3D }; -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(_WIN32) extern "C" { #endif @@ -36,7 +36,7 @@ unsigned video_texture_load(void *data, void video_texture_unload(enum texture_backend_type type, uintptr_t *id); -#ifdef __cplusplus +#if defined(__cplusplus) && !defined(_WIN32) } #endif diff --git a/gfx/video_texture.c b/gfx/video_texture_c.c similarity index 100% rename from gfx/video_texture.c rename to gfx/video_texture_c.c diff --git a/griffin/griffin.c b/griffin/griffin.c index 7a86cfc961..784c5b8155 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -192,7 +192,10 @@ VIDEO IMAGE ============================================================ */ #include "../gfx/image/image.c" -#include "../gfx/video_texture.c" + +#if !defined(_WIN32) +#include "../gfx/video_texture_c.c" +#endif #include "../libretro-common/formats/tga/rtga.c" diff --git a/griffin/griffin_cpp.cpp b/griffin/griffin_cpp.cpp index ae5aead24f..199c3a6024 100644 --- a/griffin/griffin_cpp.cpp +++ b/griffin/griffin_cpp.cpp @@ -53,6 +53,9 @@ VIDEO DRIVER #ifdef _XBOX #include "../frontend/drivers/platform_xdk.cpp" #endif +#ifdef _WIN32 +#include "../gfx/video_texture.cpp" +#endif #if defined(HAVE_D3D) #include "../gfx/d3d/d3d_wrapper.cpp"