summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorSoren Jorvang <soren.jorvang@gmail.com>2011-01-06 01:11:32 +0000
committerSoren Jorvang <soren.jorvang@gmail.com>2011-01-06 01:11:32 +0000
commit95b6d3f4453fa3fa02fffcb889cb8f5018a24263 (patch)
tree28da8077beda42bf32f3c13df1f7873b20637828 /Source/Core
parent5ca3adde3c30d4f0563c425282f24450c7791859 (diff)
Kill HAVE_OPENCL.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6756 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/Src/OpenCL.cpp17
-rw-r--r--Source/Core/Common/Src/OpenCL.h31
-rw-r--r--Source/Core/Common/Src/SConscript1
-rw-r--r--Source/Core/DolphinWX/Src/SConscript6
-rw-r--r--Source/Core/VideoCommon/Src/OpcodeDecoding.cpp6
-rw-r--r--Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp8
-rw-r--r--Source/Core/VideoCommon/Src/TextureDecoder.cpp5
-rw-r--r--Source/Core/VideoCommon/Src/XFBConvert.cpp59
8 files changed, 8 insertions, 125 deletions
diff --git a/Source/Core/Common/Src/OpenCL.cpp b/Source/Core/Common/Src/OpenCL.cpp
index c3d3f7e796..d1658ae486 100644
--- a/Source/Core/Common/Src/OpenCL.cpp
+++ b/Source/Core/Common/Src/OpenCL.cpp
@@ -21,18 +21,12 @@
#include "Common.h"
#include "Timer.h"
-#ifndef __APPLE__
-#include "clrun.h"
-#endif
-
namespace OpenCL
{
-#if defined(HAVE_OPENCL) && HAVE_OPENCL
cl_device_id device_id = NULL;
cl_context g_context = NULL;
cl_command_queue g_cmdq = NULL;
-#endif
bool g_bInitialized = false;
@@ -41,7 +35,6 @@ bool Initialize()
if(g_bInitialized)
return true;
-#if defined(HAVE_OPENCL) && HAVE_OPENCL
if(g_context)
return false;
int err; // error code returned from api calls
@@ -127,12 +120,8 @@ bool Initialize()
g_bInitialized = true;
return true;
-#else
- return false;
-#endif
}
-#if defined(HAVE_OPENCL) && HAVE_OPENCL
cl_context GetContext()
{
return g_context;
@@ -204,11 +193,9 @@ cl_kernel CompileKernel(cl_program program, const char *Function)
(float)(Common::Timer::GetTimeMs() - compileStart) / 1000.0);
return kernel;
}
-#endif
void Destroy()
{
-#if defined(HAVE_OPENCL) && HAVE_OPENCL
if (g_cmdq)
{
clReleaseCommandQueue(g_cmdq);
@@ -220,13 +207,10 @@ void Destroy()
g_context = NULL;
}
g_bInitialized = false;
-#endif
}
void HandleCLError(cl_int error, const char* str)
{
-#if defined(HAVE_OPENCL) && HAVE_OPENCL
-
const char* name;
switch(error)
{
@@ -284,6 +268,5 @@ void HandleCLError(cl_int error, const char* str)
if(!str)
str = "";
ERROR_LOG(COMMON, "OpenCL error: %s %s (%d)", str, name, error);
-#endif
}
}
diff --git a/Source/Core/Common/Src/OpenCL.h b/Source/Core/Common/Src/OpenCL.h
index 411a1697be..f299e9ff1e 100644
--- a/Source/Core/Common/Src/OpenCL.h
+++ b/Source/Core/Common/Src/OpenCL.h
@@ -20,46 +20,21 @@
#include "Common.h"
-// The CLRun library provides the headers and all the imports
-#ifndef __APPLE__
-#define HAVE_OPENCL 1
-#endif
-
-// We detect the presence of the 10.6 SDK, which has the OpenCL headers,
-// by looking for the new blocks feature in the 10.6 version of gcc.
-// This allows us to have the 10.5 SDK first in the search path.
-#if defined __APPLE__ && defined __BLOCKS__
-#define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER WEAK_IMPORT_ATTRIBUTE
-#define HAVE_OPENCL 1
-#endif
-
-#if defined(HAVE_OPENCL) && HAVE_OPENCL
-
#ifdef __APPLE__
+#define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER WEAK_IMPORT_ATTRIBUTE
#include <OpenCL/cl.h>
#else
+// The CLRun library provides the headers and all the imports.
#include <CL/cl.h>
-#endif
-
-#else
-
-typedef void *cl_context;
-typedef void *cl_command_queue;
-typedef void *cl_program;
-typedef void *cl_kernel;
-typedef void *cl_mem;
-typedef void *cl_int;
-
+#include <clrun.h>
#endif
namespace OpenCL
{
-#if defined(HAVE_OPENCL) && HAVE_OPENCL
extern cl_device_id device_id;
extern cl_context g_context;
extern cl_command_queue g_cmdq;
-#endif
bool Initialize();
diff --git a/Source/Core/Common/Src/SConscript b/Source/Core/Common/Src/SConscript
index 8c5ca2d832..34dcec56bb 100644
--- a/Source/Core/Common/Src/SConscript
+++ b/Source/Core/Common/Src/SConscript
@@ -5,7 +5,6 @@ import os
import sys
from SconsTests import utils
-Execute(Delete(File('#Source/Core/Common/Src/svnrev.h').abspath))
utils.GenerateRevFile(env['flavor'], Dir('#Source/Core/Common/Src').abspath +
os.sep + 'svnrev_template.h', 'svnrev.h')
diff --git a/Source/Core/DolphinWX/Src/SConscript b/Source/Core/DolphinWX/Src/SConscript
index 4372c2f701..1838ed9c14 100644
--- a/Source/Core/DolphinWX/Src/SConscript
+++ b/Source/Core/DolphinWX/Src/SConscript
@@ -75,9 +75,9 @@ elif sys.platform == 'darwin' and env['HAVE_WX']:
for mo in mo_files:
index_lo = mo.find("Languages/") + len("Languages/")
index_hi = mo.find("/dolphin-emu.mo")
- lang_name = mo[index_lo:index_hi]
- install_loc = env['data_dir'] + "/" + lang_name + ".lproj/dolphin-emu.mo"
- env.InstallAs(install_loc, mo)
+ lang = mo[index_lo:index_hi]
+ lproj = env['data_dir'] + '/' + lang + ".lproj/dolphin-emu.mo"
+ env.InstallAs(lproj, mo)
from plistlib import writePlist
def createPlist(target, source, env):
diff --git a/Source/Core/VideoCommon/Src/OpcodeDecoding.cpp b/Source/Core/VideoCommon/Src/OpcodeDecoding.cpp
index fbb81fb40d..ff4d6d1d97 100644
--- a/Source/Core/VideoCommon/Src/OpcodeDecoding.cpp
+++ b/Source/Core/VideoCommon/Src/OpcodeDecoding.cpp
@@ -43,10 +43,8 @@
#include "DataReader.h"
#include "OpenCL.h"
-#if defined(HAVE_OPENCL) && HAVE_OPENCL
#include "OpenCL/OCLTextureDecoder.h"
#include "VideoConfig.h"
-#endif
u8* g_pVideoData = 0;
DataReadU32xNfunc DataReadU32xFuncs[16] = {
@@ -403,25 +401,21 @@ void OpcodeDecoder_Init()
{
g_pVideoData = FAKE_GetFifoStartPtr();
-#if defined(HAVE_OPENCL) && HAVE_OPENCL
if (g_Config.bEnableOpenCL)
{
OpenCL::Initialize();
TexDecoder_OpenCL_Initialize();
}
-#endif
}
void OpcodeDecoder_Shutdown()
{
-#if defined(HAVE_OPENCL) && HAVE_OPENCL
if (g_Config.bEnableOpenCL)
{
TexDecoder_OpenCL_Shutdown();
OpenCL::Destroy();
}
-#endif
}
void OpcodeDecoder_Run(bool skipped_frame)
diff --git a/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp b/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp
index 0340952733..cacfcdf47d 100644
--- a/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp
+++ b/Source/Core/VideoCommon/Src/OpenCL/OCLTextureDecoder.cpp
@@ -86,7 +86,6 @@ cl_mem g_clsrc, g_cldst; // texture buffer memory objects
void TexDecoder_OpenCL_Initialize()
{
-#if defined(HAVE_OPENCL) && HAVE_OPENCL
if(!g_Inited)
{
if(!OpenCL::Initialize())
@@ -240,12 +239,10 @@ void TexDecoder_OpenCL_Initialize()
g_Inited = true;
}
-#endif
}
void TexDecoder_OpenCL_Shutdown()
{
-#if defined(HAVE_OPENCL) && HAVE_OPENCL && !defined(DEBUG_OPENCL)
if (g_program)
clReleaseProgram(g_program);
@@ -264,12 +261,10 @@ void TexDecoder_OpenCL_Shutdown()
clReleaseMemObject(g_cldst);
g_Inited = false;
-#endif
}
PC_TexFormat TexDecoder_Decode_OpenCL(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt, bool rgba)
{
-#if defined(HAVE_OPENCL) && HAVE_OPENCL
cl_int err;
sDecoderParameter& decoder = rgba ? g_DecodeParametersRGBA[texformat] : g_DecodeParametersNative[texformat];
if(!g_Inited || !decoder.name || !decoder.kernel || decoder.format == PC_TEX_FMT_NONE)
@@ -310,7 +305,4 @@ PC_TexFormat TexDecoder_Decode_OpenCL(u8 *dst, const u8 *src, int width, int hei
#endif
return decoder.format;
-#else
- return PC_TEX_FMT_NONE;
-#endif
}
diff --git a/Source/Core/VideoCommon/Src/TextureDecoder.cpp b/Source/Core/VideoCommon/Src/TextureDecoder.cpp
index 7e6c168cc7..150f2b7ae2 100644
--- a/Source/Core/VideoCommon/Src/TextureDecoder.cpp
+++ b/Source/Core/VideoCommon/Src/TextureDecoder.cpp
@@ -21,10 +21,8 @@
#include "CPUDetect.h"
#include "TextureDecoder.h"
#include "OpenCL.h"
-#if defined(HAVE_OPENCL) && HAVE_OPENCL
#include "OpenCL/OCLTextureDecoder.h"
#include "VideoConfig.h"
-#endif
#include "LookUpTables.h"
@@ -1733,7 +1731,6 @@ PC_TexFormat TexDecoder_Decode_RGBA(u32 * dst, const u8 * src, int width, int he
const __m128i dxt = _mm_loadu_si128((__m128i *)(src + sizeof(struct DXTBlock) * 0));
__m128i argb888x4;
const __m128i allFF = _mm_set_epi32(0xFFFFFFFFL, 0xFFFFFFFFL, 0xFFFFFFFFL, 0xFFFFFFFFL);
- const __m128i lowMask = _mm_srli_si128( allFF, 8 );
__m128i c1 = _mm_unpackhi_epi16(dxt, dxt);
c1 = _mm_slli_si128(c1, 8);
const __m128i c0 = _mm_or_si128(c1, _mm_srli_si128(_mm_slli_si128(_mm_unpacklo_epi16(dxt, dxt), 8), 8));
@@ -2039,10 +2036,8 @@ PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, in
{
PC_TexFormat retval = PC_TEX_FMT_NONE;
-#if defined(HAVE_OPENCL) && HAVE_OPENCL
if (g_Config.bEnableOpenCL)
retval = TexDecoder_Decode_OpenCL(dst, src, width, height, texformat, tlutaddr, tlutfmt, rgbaOnly);
-#endif
if(retval == PC_TEX_FMT_NONE)
retval = rgbaOnly ? TexDecoder_Decode_RGBA((u32*)dst,src,width,height,texformat,tlutaddr,tlutfmt) : TexDecoder_Decode_real(dst,src,width,height,texformat,tlutaddr,tlutfmt);
diff --git a/Source/Core/VideoCommon/Src/XFBConvert.cpp b/Source/Core/VideoCommon/Src/XFBConvert.cpp
index 72b0286b7d..de78f2a4f3 100644
--- a/Source/Core/VideoCommon/Src/XFBConvert.cpp
+++ b/Source/Core/VideoCommon/Src/XFBConvert.cpp
@@ -43,8 +43,7 @@ __m128i _b1[256];
__m128i _b2[256];
} // namespace
-#if defined(HAVE_OPENCL) && HAVE_OPENCL
-bool Inited = false;
+ bool Inited = false;
cl_kernel To_kernel;
cl_program To_program;
@@ -110,7 +109,7 @@ void InitKernels()
To_kernel = OpenCL::CompileKernel(To_program, "ConvertToXFB");
Inited = true;
}
-#endif
+
void InitXFBConvTables()
{
for (int i = 0; i < 256; i++)
@@ -138,7 +137,6 @@ void ConvertFromXFB(u32 *dst, const u8* _pXFB, int width, int height)
}
const unsigned char *src = _pXFB;
u32 numBlocks = ((width * height) / 2) / 2;
- #if defined(HAVE_OPENCL) && HAVE_OPENCL
if(!Inited)
InitKernels();
int err;
@@ -209,29 +207,6 @@ void ConvertFromXFB(u32 *dst, const u8* _pXFB, int width, int height)
}
clReleaseMemObject(_dst);
clReleaseMemObject(_src);
- #else
- for (u32 i = 0; i < numBlocks; i++)
- {
- __m128i y1 = _y[src[0]];
- __m128i u = _u[src[1]];
- __m128i y2 = _y[src[2]];
- __m128i v = _v[src[3]];
- __m128i y1_2 = _y[src[4+0]];
- __m128i u_2 = _u[src[4+1]];
- __m128i y2_2 = _y[src[4+2]];
- __m128i v_2 = _v[src[4+3]];
-
- __m128i c1 = _mm_srai_epi32(_mm_add_epi32(y1, _mm_add_epi32(u, v)), 16);
- __m128i c2 = _mm_srai_epi32(_mm_add_epi32(y2, _mm_add_epi32(u, v)), 16);
- __m128i c3 = _mm_srai_epi32(_mm_add_epi32(y1_2, _mm_add_epi32(u_2, v_2)), 16);
- __m128i c4 = _mm_srai_epi32(_mm_add_epi32(y2_2, _mm_add_epi32(u_2, v_2)), 16);
-
- __m128i four_dest = _mm_packus_epi16(_mm_packs_epi32(c1, c2), _mm_packs_epi32(c3, c4));
- _mm_store_si128((__m128i *)dst, four_dest);
- dst += 4;
- src += 8;
- }
- #endif
}
@@ -243,7 +218,6 @@ void ConvertToXFB(u32 *dst, const u8* _pEFB, int width, int height)
if (((size_t)dst & 0xF) != 0) {
PanicAlert("ConvertToXFB - unaligned XFB");
}
- #if defined(HAVE_OPENCL) && HAVE_OPENCL
if(!Inited)
InitKernels();
@@ -315,33 +289,4 @@ void ConvertToXFB(u32 *dst, const u8* _pEFB, int width, int height)
}
clReleaseMemObject(_dst);
clReleaseMemObject(_src);
- #else
- for (u32 i = 0; i < numBlocks; i++)
- {
- __m128i yuyv0 = _mm_srai_epi32(
- _mm_add_epi32(
- _mm_add_epi32(_r1[src[0]], _mm_add_epi32(_g1[src[1]], _b1[src[2]])),
- _mm_add_epi32(_r2[src[4]], _mm_add_epi32(_g2[src[5]], _b2[src[6]]))), 16);
- src += 8;
- __m128i yuyv1 = _mm_srai_epi32(
- _mm_add_epi32(
- _mm_add_epi32(_r1[src[0]], _mm_add_epi32(_g1[src[1]], _b1[src[2]])),
- _mm_add_epi32(_r2[src[4]], _mm_add_epi32(_g2[src[5]], _b2[src[6]]))), 16);
- src += 8;
- __m128i yuyv2 = _mm_srai_epi32(
- _mm_add_epi32(
- _mm_add_epi32(_r1[src[0]], _mm_add_epi32(_g1[src[1]], _b1[src[2]])),
- _mm_add_epi32(_r2[src[4]], _mm_add_epi32(_g2[src[5]], _b2[src[6]]))), 16);
- src += 8;
- __m128i yuyv3 = _mm_srai_epi32(
- _mm_add_epi32(
- _mm_add_epi32(_r1[src[0]], _mm_add_epi32(_g1[src[1]], _b1[src[2]])),
- _mm_add_epi32(_r2[src[4]], _mm_add_epi32(_g2[src[5]], _b2[src[6]]))), 16);
- src += 8;
- __m128i four_dest = _mm_packus_epi16(_mm_packs_epi32(yuyv0, yuyv1), _mm_packs_epi32(yuyv2, yuyv3));
- _mm_store_si128((__m128i *)dst, four_dest);
- dst += 4;
- }
- #endif
}
-