mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
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
This commit is contained in:
61
Externals/CLRun/clrun/clrun.c
vendored
Normal file
61
Externals/CLRun/clrun/clrun.c
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
#include "clrun.h"
|
||||
#include "dynamiclib.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
int isCL = 0;
|
||||
|
||||
// 0 means no opencl, 1 means opencl
|
||||
int clrInit() {
|
||||
int ret = 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
const char *libname = "OpenCL.dll";
|
||||
#else
|
||||
const char *libname = "libOpenCL.so";
|
||||
#endif
|
||||
|
||||
if((ret = loadLib(libname))) {
|
||||
if(ret == -3) // No OpenCL
|
||||
return 0;
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
|
||||
isCL = 1;
|
||||
|
||||
// TODO: optimize by loading all functions here?
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int clrHasOpenCL() {
|
||||
return isCL;
|
||||
}
|
||||
|
||||
|
||||
// Windows-specific DLL code
|
||||
#if defined _WIN32 && defined CLRUN_DYNAMICLIB
|
||||
HINSTANCE g_hInstance;
|
||||
|
||||
BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
|
||||
DWORD dwReason, // reason called
|
||||
LPVOID lpvReserved) // reserved
|
||||
{
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
g_hInstance = hinstDLL;
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user