~registry/dolphin-emu/triforce

« back to all changes in this revision

Viewing changes to Externals/CLRun/clrun/clrun.c

  • Committer: Sérgio Benjamim
  • Date: 2015-02-13 05:54:40 UTC
  • Revision ID: sergio_br2@yahoo.com.br-20150213055440-ey2rt3sjpy27km78
Dolphin Triforce branch from code.google, commit b957980 (4.0-315).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "clrun.h"
 
2
#include "dynamiclib.h"
 
3
 
 
4
#ifdef _WIN32
 
5
#include <windows.h>
 
6
#endif
 
7
 
 
8
int isCL = 0;
 
9
 
 
10
// 0 means no opencl, 1 means opencl
 
11
int clrInit() {
 
12
        int ret = 0;
 
13
        
 
14
#ifdef _WIN32
 
15
        const char *libname = "OpenCL.dll";
 
16
#else
 
17
        const char *libname = "libOpenCL.so";
 
18
#endif
 
19
 
 
20
        if((ret = loadLib(libname))) {
 
21
                if(ret == -3) // No OpenCL
 
22
                        return 0;
 
23
                else
 
24
                        return ret;
 
25
        }
 
26
 
 
27
        isCL = 1;
 
28
        
 
29
        // TODO: optimize by loading all functions here?
 
30
 
 
31
        return 0;
 
32
}
 
33
 
 
34
int clrHasOpenCL() {
 
35
        return isCL;
 
36
}
 
37
 
 
38
 
 
39
// Windows-specific DLL code
 
40
#if defined _WIN32 && defined CLRUN_DYNAMICLIB
 
41
HINSTANCE g_hInstance;
 
42
 
 
43
BOOL APIENTRY DllMain(HINSTANCE hinstDLL,       // DLL module handle
 
44
                                          DWORD dwReason,               // reason called
 
45
                                          LPVOID lpvReserved)   // reserved
 
46
{
 
47
        switch (dwReason)
 
48
        {
 
49
        case DLL_PROCESS_ATTACH:
 
50
                break; 
 
51
 
 
52
        case DLL_PROCESS_DETACH:
 
53
                break;
 
54
        default:
 
55
                break;
 
56
        }
 
57
 
 
58
        g_hInstance = hinstDLL;
 
59
        return TRUE;
 
60
}
 
61
#endif