diff options
| author | Orphis <orphiss@gmail.com> | 2010-06-29 02:23:09 +0000 |
|---|---|---|
| committer | Orphis <orphiss@gmail.com> | 2010-06-29 02:23:09 +0000 |
| commit | 685bae34e511aa2632807c7e7ae6bfd37b4c60d8 (patch) | |
| tree | 9c3e84b5780092315513eaff02fabb41ea64de48 /Source/Core/Common | |
| parent | 374999d750dc91838aea9feedf8b28871d66623f (diff) | |
Dynamically load OpenCL on Windows with CLRun. There shouldn't be the need to make a separate build now or download a big SDK to link Dolphin.
If compilation fails, rebuild the whole solution as Visual Studio struggles with the not so complex project dependencies.
ATI users still need to install the Stream SDK as it's the only way to have an OpenCL driver.
NVidia users just have to install a recent driver (version 197 is tested and working).
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5808 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common')
| -rw-r--r-- | Source/Core/Common/Common.vcproj | 12 | ||||
| -rw-r--r-- | Source/Core/Common/Src/OpenCL.cpp | 12 | ||||
| -rw-r--r-- | Source/Core/Common/Src/OpenCL.h | 8 |
3 files changed, 22 insertions, 10 deletions
diff --git a/Source/Core/Common/Common.vcproj b/Source/Core/Common/Common.vcproj index ab6088be32..c2268b0c11 100644 --- a/Source/Core/Common/Common.vcproj +++ b/Source/Core/Common/Common.vcproj @@ -46,7 +46,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="../../PluginSpecs" + AdditionalIncludeDirectories="../../PluginSpecs;../../../Externals/CLRun/include" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_SECURE_SCL=0" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -116,7 +116,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="../../PluginSpecs" + AdditionalIncludeDirectories="../../PluginSpecs;../../../Externals/CLRun/include" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_SECURE_SCL=0" StringPooling="true" MinimalRebuild="true" @@ -190,7 +190,7 @@ Optimization="2" EnableIntrinsicFunctions="true" FavorSizeOrSpeed="2" - AdditionalIncludeDirectories="../../PluginSpecs" + AdditionalIncludeDirectories="../../PluginSpecs;../../../Externals/CLRun/include" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS" RuntimeLibrary="0" BufferSecurityCheck="false" @@ -264,7 +264,7 @@ Optimization="2" EnableIntrinsicFunctions="true" FavorSizeOrSpeed="1" - AdditionalIncludeDirectories="../../PluginSpecs" + AdditionalIncludeDirectories="../../PluginSpecs;../../../Externals/CLRun/include" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" StringPooling="true" RuntimeLibrary="0" @@ -336,7 +336,7 @@ Name="VCCLCompilerTool" Optimization="3" FavorSizeOrSpeed="1" - AdditionalIncludeDirectories="../../PluginSpecs" + AdditionalIncludeDirectories="../../PluginSpecs;../../../Externals/CLRun/include" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0;DEBUGFAST;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" RuntimeLibrary="0" BufferSecurityCheck="false" @@ -407,7 +407,7 @@ Name="VCCLCompilerTool" Optimization="3" FavorSizeOrSpeed="1" - AdditionalIncludeDirectories="../../PluginSpecs" + AdditionalIncludeDirectories="../../PluginSpecs;../../../Externals/CLRun/include" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0;DEBUGFAST;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" RuntimeLibrary="0" FloatingPointModel="0" diff --git a/Source/Core/Common/Src/OpenCL.cpp b/Source/Core/Common/Src/OpenCL.cpp index 55a2453512..05cb6112ec 100644 --- a/Source/Core/Common/Src/OpenCL.cpp +++ b/Source/Core/Common/Src/OpenCL.cpp @@ -21,6 +21,10 @@ #include "Common.h" #include "Timer.h" +#ifdef _WIN32 +#include "clrun.h" +#endif + namespace OpenCL { @@ -41,7 +45,13 @@ bool Initialize() if(g_context) return false; int err; // error code returned from api calls - + +#ifdef _WIN32 + clrInit(); + if(!clrHasOpenCL()) + return false; +#endif + // Connect to a compute device cl_uint numPlatforms; cl_platform_id platform = NULL; diff --git a/Source/Core/Common/Src/OpenCL.h b/Source/Core/Common/Src/OpenCL.h index 977b0bc4f7..a9400013c0 100644 --- a/Source/Core/Common/Src/OpenCL.h +++ b/Source/Core/Common/Src/OpenCL.h @@ -19,9 +19,11 @@ #define __OPENCL_H__ #include "Common.h" -// Change to #if 1 if you want to test OpenCL (and you have it) on Windows -#if 0 -#pragma comment(lib, "OpenCL.lib") +// OpenCL on Windows is linked through the CLRun library +// It provides the headers and all the imports +// It could be safe to use it for Linux too, but will require to edit the SCons first +// OpenCL is linked on OSX when possible, it shouldn't require CLRun for now +#ifdef _WIN32 #define HAVE_OPENCL 1 #endif |
