gsdx-ocl: Add a ENABLE_OPENCL option

* Allow to compile GSdx on linux without opencl yet.
This commit is contained in:
Gregory Hainaut 2014-12-01 23:06:24 +01:00
parent b9b02cf749
commit 76f719e5d0
8 changed files with 30 additions and 4 deletions

View File

@ -104,6 +104,7 @@ set(GSdxSources
GSPerfMon.cpp GSPerfMon.cpp
GSRasterizer.cpp GSRasterizer.cpp
GSRenderer.cpp GSRenderer.cpp
GSRendererCL.cpp
GSRendererHW.cpp GSRendererHW.cpp
GSRendererNull.cpp GSRendererNull.cpp
GSRendererOGL.cpp GSRendererOGL.cpp

View File

@ -27,6 +27,7 @@
#include "GSDeviceNull.h" #include "GSDeviceNull.h"
#include "GSDeviceOGL.h" #include "GSDeviceOGL.h"
#include "GSRendererOGL.h" #include "GSRendererOGL.h"
#include "GSRendererCL.h"
#ifdef _WINDOWS #ifdef _WINDOWS
@ -37,7 +38,6 @@
#include "GSWndDX.h" #include "GSWndDX.h"
#include "GSWndWGL.h" #include "GSWndWGL.h"
#include "GSRendererCS.h" #include "GSRendererCS.h"
#include "GSRendererCL.h"
#include "GSSettingsDlg.h" #include "GSSettingsDlg.h"
static HRESULT s_hr = E_FAIL; static HRESULT s_hr = E_FAIL;
@ -265,7 +265,9 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1)
s_gs = new GSRendererNull(); s_gs = new GSRendererNull();
break; break;
case 14: case 15: case 16: case 17: case 14: case 15: case 16: case 17:
#ifdef ENABLE_OPENCL
s_gs = new GSRendererCL(); s_gs = new GSRendererCL();
#endif
break; break;
} }

View File

@ -22,6 +22,8 @@
#include "stdafx.h" #include "stdafx.h"
#include "GSRendererCL.h" #include "GSRendererCL.h"
#ifdef ENABLE_OPENCL
#define LOG 0 #define LOG 0
static FILE* s_fp = LOG ? fopen("c:\\temp1\\_.txt", "w") : NULL; static FILE* s_fp = LOG ? fopen("c:\\temp1\\_.txt", "w") : NULL;
@ -2002,3 +2004,4 @@ cl::Kernel& GSRendererCL::CL::GetTFXKernel(const TFXSelector& sel)
return tfx_map[sel]; return tfx_map[sel];
} }
#endif

View File

@ -23,6 +23,8 @@
#include "GSRenderer.h" #include "GSRenderer.h"
#ifdef ENABLE_OPENCL
__aligned(struct, 32) GSVertexCL __aligned(struct, 32) GSVertexCL
{ {
GSVector4 p, t; GSVector4 p, t;
@ -252,3 +254,5 @@ public:
GSRendererCL(); GSRendererCL();
virtual ~GSRendererCL(); virtual ~GSRendererCL();
}; };
#endif

View File

@ -228,6 +228,7 @@ bool GSUtil::CheckSSE()
#define OCL_PROGRAM_VERSION 1 #define OCL_PROGRAM_VERSION 1
#ifdef ENABLE_OPENCL
void GSUtil::GetDeviceDescs(list<OCLDeviceDesc>& dl) void GSUtil::GetDeviceDescs(list<OCLDeviceDesc>& dl)
{ {
dl.clear(); dl.clear();
@ -319,6 +320,7 @@ string GSUtil::GetDeviceUniqueName(cl::Device& device)
return vendor + " " + name + " " + version + " " + type; return vendor + " " + name + " " + version + " " + type;
} }
#endif
#ifdef _WINDOWS #ifdef _WINDOWS

View File

@ -25,7 +25,9 @@
struct OCLDeviceDesc struct OCLDeviceDesc
{ {
#ifdef ENABLE_OPENCL
cl::Device device; cl::Device device;
#endif
string name; string name;
int version; int version;
string tmppath; string tmppath;
@ -48,8 +50,10 @@ public:
static bool CheckSSE(); static bool CheckSSE();
#ifdef ENABLE_OPENCL
static void GetDeviceDescs(list<OCLDeviceDesc>& dl); static void GetDeviceDescs(list<OCLDeviceDesc>& dl);
static string GetDeviceUniqueName(cl::Device& device); static string GetDeviceUniqueName(cl::Device& device);
#endif
#ifdef _WINDOWS #ifdef _WINDOWS

View File

@ -45,3 +45,7 @@
// Output stencil to a color buffer // Output stencil to a color buffer
//#define ENABLE_OGL_STENCIL_DEBUG //#define ENABLE_OGL_STENCIL_DEBUG
#ifdef _WINDOWS
#define ENABLE_OPENCL
#endif

View File

@ -44,9 +44,6 @@
#include <comutil.h> #include <comutil.h>
#include "../../common/include/comptr.h" #include "../../common/include/comptr.h"
#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
#define __CL_ENABLE_EXCEPTIONS
#include <CL/cl.hpp>
#define D3DCOLORWRITEENABLE_RGBA (D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_ALPHA) #define D3DCOLORWRITEENABLE_RGBA (D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_ALPHA)
#define D3D11_SHADER_MACRO D3D10_SHADER_MACRO #define D3D11_SHADER_MACRO D3D10_SHADER_MACRO
@ -54,6 +51,15 @@
#endif #endif
#ifdef ENABLE_OPENCL
#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
#define __CL_ENABLE_EXCEPTIONS
#include <CL/cl.hpp>
#endif
// put these into vc9/common7/ide/usertype.dat to have them highlighted // put these into vc9/common7/ide/usertype.dat to have them highlighted
typedef unsigned char uint8; typedef unsigned char uint8;