OpenCL: A bit more work.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4347 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
XTra.KrazzY 2009-09-30 00:39:32 +00:00
parent fb258e3ca5
commit aa1fd81e37
3 changed files with 13 additions and 4 deletions

View File

@ -240,6 +240,9 @@ if sys.platform == 'darwin':
env['HAVE_SDL'] = conf.CheckSDL('1.0.0') env['HAVE_SDL'] = conf.CheckSDL('1.0.0')
# OpenCL
env['HAVE_OPENCL'] = conf.CheckPKG('opencl')
# Bluetooth for wii support # Bluetooth for wii support
env['HAVE_BLUEZ'] = conf.CheckPKG('bluez') env['HAVE_BLUEZ'] = conf.CheckPKG('bluez')

View File

@ -58,6 +58,8 @@ sDecoders Decoders[] = { {NULL, NULL, &Kernel},
}; };
bool Inited = false; bool Inited = false;
// TODO: Deinit (clRelease...)
bool Init_OpenCL() bool Init_OpenCL()
{ {
int err; // error code returned from api calls int err; // error code returned from api calls
@ -124,15 +126,19 @@ bool Init_OpenCL()
} */ } */
} }
PC_TexFormat TexDecoder_Decode_real(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt) PC_TexFormat TexDecoder_Decode_OpenCL(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt)
{ {
if(!Inited) if(!Inited)
{ {
// Not yet inited, let's init now // Not yet inited, let's init now
// Need to make a init function later // Need to make a init function later
if(!Init_OpenCL()) if(!Init_OpenCL())
;// Crap, seems we can't use OpenCL, should fallback on regular decoding PanicAlert("OpenCL could not initialize successfully");
} }
// clEnqueueNDRangeKernel
/*switch (texformat) /*switch (texformat)
{ {
case GX_TF_C4: case GX_TF_C4:

View File

@ -21,7 +21,7 @@
#include "CPUDetect.h" #include "CPUDetect.h"
#include "TextureDecoder.h" #include "TextureDecoder.h"
#ifdef OPENCL #ifdef HAVE_OPENCL
#include "OpenCL/TextureDecoder.h" #include "OpenCL/TextureDecoder.h"
#endif #endif
@ -581,7 +581,7 @@ void TexDecoder_SetTexFmtOverlayOptions(bool enable, bool center)
PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt) PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt)
{ {
#ifdef OPENCL #ifdef HAVE_OPENCL
PC_TexFormat retval = TexDecoder_Decode_OpenCL(dst, src, width, height, texformat, tlutaddr, tlutfmt); PC_TexFormat retval = TexDecoder_Decode_OpenCL(dst, src, width, height, texformat, tlutaddr, tlutfmt);
#else #else
PC_TexFormat retval = TexDecoder_Decode_real(dst,src,width,height,texformat,tlutaddr,tlutfmt); PC_TexFormat retval = TexDecoder_Decode_real(dst,src,width,height,texformat,tlutaddr,tlutfmt);