mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 13:27:45 -07:00
Remove all instances of OpenCL in the Dolphin Project. A brief history of OpenCL in Dolphin. OpenCL was originally added to the Dolphin codebase 1 month after it was released with OS X Snow Leopard in 2009. OpenCL was one of the largest group projects that Dolphin ever has had. The OpenCL texture decoder was originally aded with version 1.0 of the OpenCL spec; This version didn't have the capability of a OpenCL-OpenGL interop which would allow for uploading textures once and have it decoded directly to a OpenGL texure. This was to be worked out when the OpenCL 1.1 spec was released and allowed the interop. This work has never been done, and no one in the team is willing to work on it for various reasons. OpenCL has had the unreasonable expectation that it increases the performance of video games that require a large amount of EFB copies like NSMBW. In reality, enabling OpenCL just put the graphics card in a higher power mode which increased the game speed. This is due to the unfortunate effect of Dolphin tending to not push GPUs out of their lower frequency power savings modes. Thanks to everyone that had contributed to the OpenCL texture decoder.
This commit is contained in:
parent
c016d02c66
commit
eb3b933dd0
@ -510,7 +510,7 @@ include_directories(Source/Core/VideoUICommon/Src)
|
||||
# - make sure to tell cmake to link them statically or dynamically (most
|
||||
# should be linked statically)
|
||||
# - place the CMakeLists.txt in the first-level subdirectory, e.g.
|
||||
# Externals/CLRun/CMakeLists.txt (that is: NOT in some Src/ subdirectory)
|
||||
# Externals/zlib/CMakeLists.txt (that is: NOT in some Src/ subdirectory)
|
||||
#
|
||||
add_subdirectory(Externals/Bochs_disasm)
|
||||
include_directories(Externals/Bochs_disasm)
|
||||
@ -673,14 +673,6 @@ if (ANDROID)
|
||||
add_subdirectory(Externals/libiconv-1.14)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID)
|
||||
find_library(CL OpenCL)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-weak_framework,OpenCL")
|
||||
else()
|
||||
include_directories(Externals/CLRun/include)
|
||||
add_subdirectory(Externals/CLRun)
|
||||
endif()
|
||||
|
||||
if(NOT DISABLE_WX AND NOT ANDROID)
|
||||
include(FindwxWidgets OPTIONAL)
|
||||
FIND_PACKAGE(wxWidgets COMPONENTS core aui adv)
|
||||
|
@ -1,348 +0,0 @@
|
||||
// Copyright 2013 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
kernel void DecodeI4(global uchar *dst,
|
||||
const global uchar *src, int width)
|
||||
{
|
||||
int x = get_global_id(0) * 8, y = get_global_id(1) * 8;
|
||||
int srcOffset = x + y * width / 8;
|
||||
for (int iy = 0; iy < 8; iy++)
|
||||
{
|
||||
uchar4 val = vload4(srcOffset, src);
|
||||
uchar8 res;
|
||||
res.even = (val >> (uchar4)4) & (uchar4)0x0F;
|
||||
res.odd = val & (uchar4)0x0F;
|
||||
res |= res << (uchar8)4;
|
||||
vstore8(res, 0, dst + ((y + iy)*width + x));
|
||||
srcOffset++;
|
||||
}
|
||||
}
|
||||
|
||||
kernel void DecodeI4_RGBA(global uint *dst,
|
||||
const global uchar *src, int width)
|
||||
{
|
||||
int x = get_global_id(0) * 8, y = get_global_id(1) * 8;
|
||||
int srcOffset = x + y * width / 8;
|
||||
for (int iy = 0; iy < 8; iy++)
|
||||
{
|
||||
uchar4 val = vload4(srcOffset, src);
|
||||
uchar8 res;
|
||||
res.even = (val >> (uchar4)4) & (uchar4)0x0F;
|
||||
res.odd = val & (uchar4)0x0F;
|
||||
res |= res << (uchar8)4;
|
||||
vstore8(upsample(upsample(res,res),upsample(res,res)), 0, dst + ((y + iy)*width + x));
|
||||
srcOffset++;
|
||||
}
|
||||
}
|
||||
|
||||
kernel void DecodeI8(global uchar *dst,
|
||||
const global uchar *src, int width)
|
||||
{
|
||||
int x = get_global_id(0) * 8, y = get_global_id(1) * 4;
|
||||
int srcOffset = ((x * 4) + (y * width)) / 8;
|
||||
for (int iy = 0; iy < 4; iy++)
|
||||
{
|
||||
vstore8(vload8(srcOffset++, src),
|
||||
0, dst + ((y + iy)*width + x));
|
||||
}
|
||||
}
|
||||
|
||||
kernel void DecodeI8_RGBA(global uint *dst,
|
||||
const global uchar *src, int width)
|
||||
{
|
||||
int x = get_global_id(0) * 8, y = get_global_id(1) * 4;
|
||||
int srcOffset = ((x * 4) + (y * width)) / 8;
|
||||
for (int iy = 0; iy < 4; iy++)
|
||||
{
|
||||
uchar8 val = vload8(srcOffset++, src);
|
||||
vstore8(upsample(upsample(val,val),upsample(val,val)),
|
||||
0, dst + ((y + iy)*width + x));
|
||||
}
|
||||
}
|
||||
|
||||
kernel void DecodeIA8(global ushort *dst,
|
||||
const global uchar *src, int width)
|
||||
{
|
||||
int x = get_global_id(0) * 4, y = get_global_id(1) * 4;
|
||||
int srcOffset = ((x * 4) + (y * width)) / 4;
|
||||
for (int iy = 0; iy < 4; iy++)
|
||||
{
|
||||
uchar8 val = vload8(srcOffset++, src);
|
||||
vstore4(upsample(val.even, val.odd), 0, dst + ((y + iy)*width + x));
|
||||
}
|
||||
}
|
||||
|
||||
kernel void DecodeIA8_RGBA(global uint *dst,
|
||||
const global uchar *src, int width)
|
||||
{
|
||||
int x = get_global_id(0) * 4, y = get_global_id(1) * 4;
|
||||
int srcOffset = ((x * 4) + (y * width)) / 4;
|
||||
for (int iy = 0; iy < 4; iy++)
|
||||
{
|
||||
uchar8 val = vload8(srcOffset++, src);
|
||||
vstore4(upsample(upsample(val.even,val.odd),upsample(val.odd, val.odd)), 0, dst + ((y + iy)*width + x));
|
||||
}
|
||||
}
|
||||
|
||||
kernel void DecodeIA4(global ushort *dst,
|
||||
const global uchar *src, int width)
|
||||
{
|
||||
int x = get_global_id(0) * 8, y = get_global_id(1) * 4;
|
||||
int srcOffset = ((x * 4) + (y * width)) / 8;
|
||||
uchar8 val;
|
||||
ushort8 res;
|
||||
for (int iy = 0; iy < 4; iy++)
|
||||
{
|
||||
val = vload8(srcOffset++, src);
|
||||
res = upsample(val >> (uchar8)4, val & (uchar8)0xF);
|
||||
res |= res << (ushort8)4;
|
||||
vstore8(res, 0, dst + y*width + x);
|
||||
dst+=width;
|
||||
}
|
||||
}
|
||||
|
||||
kernel void DecodeIA4_RGBA(global uint *dst,
|
||||
const global uchar *src, int width)
|
||||
{
|
||||
int x = get_global_id(0) * 8, y = get_global_id(1) * 4;
|
||||
int srcOffset = ((x * 4) + (y * width)) / 8;
|
||||
uchar8 val;
|
||||
uint8 res;
|
||||
for (int iy = 0; iy < 4; iy++)
|
||||
{
|
||||
val = vload8(srcOffset++, src);
|
||||
uchar8 a = val >> (uchar8)4;
|
||||
uchar8 l = val & (uchar8)0xF;
|
||||
res = upsample(upsample(a, l), upsample(l,l));
|
||||
res |= res << (uint8)4;
|
||||
vstore8(res, 0, dst + y*width + x);
|
||||
dst+=width;
|
||||
}
|
||||
}
|
||||
|
||||
kernel void DecodeRGBA8(global ushort *dst,
|
||||
const global ushort *src, int width)
|
||||
{
|
||||
int x = get_global_id(0) * 4, y = get_global_id(1) * 4;
|
||||
int srcOffset = (x * 2) + (y * width) / 2;
|
||||
for (int iy = 0; iy < 4; iy++)
|
||||
{
|
||||
ushort8 val = (ushort8)(vload4(srcOffset, src), vload4(srcOffset + 4, src));
|
||||
ushort8 temp = rotate(val, (ushort8)4);
|
||||
ushort8 bgra = rotate(temp, (ushort8)4).s40516273;
|
||||
vstore8(bgra, 0, dst + ((y + iy)*width + x) * 2);
|
||||
srcOffset++;
|
||||
}
|
||||
}
|
||||
|
||||
kernel void DecodeRGBA8_RGBA(global uchar *dst,
|
||||
const global uchar *src, int width)
|
||||
{
|
||||
int x = get_global_id(0) * 4, y = get_global_id(1) * 4;
|
||||
int srcOffset = (x * 2) + (y * width) / 2;
|
||||
for (int iy = 0; iy < 4; iy++)
|
||||
{
|
||||
uchar8 ar = vload8(srcOffset, src);
|
||||
uchar8 gb = vload8(srcOffset + 4, src);
|
||||
uchar16 res;
|
||||
res.even.even = ar.odd;
|
||||
res.even.odd = gb.odd;
|
||||
res.odd.even = gb.even;
|
||||
res.odd.odd = ar.even;
|
||||
vstore16(res, 0, dst + ((y + iy)*width + x) * 4);
|
||||
srcOffset++;
|
||||
}
|
||||
}
|
||||
|
||||
kernel void DecodeRGB565(global ushort *dst,
|
||||
const global ushort *src, int width)
|
||||
{
|
||||
int x = get_global_id(0) * 4, y = get_global_id(1) * 4;
|
||||
int srcOffset = x + (y * width) / 4;
|
||||
dst += width*y + x;
|
||||
for (int iy = 0; iy < 4; iy++)
|
||||
{
|
||||
ushort4 val = rotate(vload4(srcOffset++, src),(ushort4)4);
|
||||
vstore4(rotate(val,(ushort4)4), 0, dst + iy*width);
|
||||
}
|
||||
}
|
||||
|
||||
kernel void DecodeRGB565_RGBA(global uchar *dst,
|
||||
const global uchar *src, int width)
|
||||
{
|
||||
int x = get_global_id(0) * 4, y = get_global_id(1) * 4;
|
||||
int srcOffset = x + (y * width) / 4;
|
||||
for (int iy = 0; iy < 4; iy++)
|
||||
{
|
||||
uchar8 val = vload8(srcOffset++, src);
|
||||
|
||||
uchar16 res;
|
||||
res.even.even = bitselect(val.even, val.even >> (uchar4)5, (uchar4)7);
|
||||
res.odd.even = bitselect((val.odd >> (uchar4)3) | (val.even << (uchar4)5), val.even >> (uchar4)1, (uchar4)3);
|
||||
res.even.odd = bitselect(val.odd << (uchar4)3, val.odd >> (uchar4)2, (uchar4)7);
|
||||
res.odd.odd = (uchar4)0xFF;
|
||||
|
||||
vstore16(res, 0, dst + ((y + iy)*width + x) * 4);
|
||||
}
|
||||
}
|
||||
|
||||
kernel void DecodeRGB5A3(global uchar *dst,
|
||||
const global uchar *src, int width)
|
||||
{
|
||||
int x = get_global_id(0) * 4, y = get_global_id(1) * 4;
|
||||
int srcOffset = x + (y * width) / 4;
|
||||
uchar8 val;
|
||||
uchar16 resNoAlpha, resAlpha, choice;
|
||||
#define iterateRGB5A3() \
|
||||
val = vload8(srcOffset++, src); \
|
||||
resNoAlpha.s26AE = val.even << (uchar4)1; \
|
||||
resNoAlpha.s159D = val.even << (uchar4)6 | val.odd >> (uchar4)2; \
|
||||
resNoAlpha.s048C = val.odd << (uchar4)3; \
|
||||
resNoAlpha = bitselect(resNoAlpha, resNoAlpha >> (uchar16)5, (uchar16)0x3); \
|
||||
resNoAlpha.s37BF = (uchar4)(0xFF); \
|
||||
resAlpha.s26AE = bitselect(val.even << (uchar4)4, val.even, (uchar4)0xF); \
|
||||
resAlpha.s159D = bitselect(val.odd, val.odd >> (uchar4)4, (uchar4)0xF); \
|
||||
resAlpha.s048C = bitselect(val.odd << (uchar4)4, val.odd, (uchar4)0xF); \
|
||||
resAlpha.s37BF = bitselect(val.even << (uchar4)1, val.even >> (uchar4)2, (uchar4)0x1C); \
|
||||
resAlpha.s37BF = bitselect(resAlpha.s37BF, val.even >> (uchar4)5, (uchar4)0x3); \
|
||||
choice = (uchar16)((uchar4)(val.even.s0), \
|
||||
(uchar4)(val.even.s1), \
|
||||
(uchar4)(val.even.s2), \
|
||||
(uchar4)(val.even.s3)); \
|
||||
vstore16(select(resAlpha, resNoAlpha, choice), 0, dst + (y * width + x) * 4);
|
||||
iterateRGB5A3(); dst += width*4;
|
||||
iterateRGB5A3(); dst += width*4;
|
||||
iterateRGB5A3(); dst += width*4;
|
||||
iterateRGB5A3();
|
||||
}
|
||||
|
||||
kernel void DecodeRGB5A3_RGBA(global uchar *dst,
|
||||
const global uchar *src, int width)
|
||||
{
|
||||
int x = get_global_id(0) * 4, y = get_global_id(1) * 4;
|
||||
int srcOffset = x + (y * width) / 4;
|
||||
uchar8 val;
|
||||
uchar16 resNoAlpha, resAlpha, choice;
|
||||
#define iterateRGB5A3_RGBA() \
|
||||
val = vload8(srcOffset++, src); \
|
||||
resNoAlpha.s048C = val.even << (uchar4)1; \
|
||||
resNoAlpha.s159D = val.even << (uchar4)6 | val.odd >> (uchar4)2; \
|
||||
resNoAlpha.s26AE = val.odd << (uchar4)3; \
|
||||
resNoAlpha = bitselect(resNoAlpha, resNoAlpha >> (uchar16)5, (uchar16)0x3); \
|
||||
resNoAlpha.s37BF = (uchar4)(0xFF); \
|
||||
resAlpha.s048C = bitselect(val.even << (uchar4)4, val.even, (uchar4)0xF); \
|
||||
resAlpha.s159D = bitselect(val.odd, val.odd >> (uchar4)4, (uchar4)0xF); \
|
||||
resAlpha.s26AE = bitselect(val.odd << (uchar4)4, val.odd, (uchar4)0xF); \
|
||||
resAlpha.s37BF = bitselect(val.even << (uchar4)1, val.even >> (uchar4)2, (uchar4)0x1C); \
|
||||
resAlpha.s37BF = bitselect(resAlpha.s37BF, val.even >> (uchar4)5, (uchar4)0x3); \
|
||||
choice = (uchar16)((uchar4)(val.even.s0), \
|
||||
(uchar4)(val.even.s1), \
|
||||
(uchar4)(val.even.s2), \
|
||||
(uchar4)(val.even.s3)); \
|
||||
vstore16(select(resAlpha, resNoAlpha, choice), 0, dst + (y * width + x) * 4);
|
||||
iterateRGB5A3_RGBA(); dst += width*4;
|
||||
iterateRGB5A3_RGBA(); dst += width*4;
|
||||
iterateRGB5A3_RGBA(); dst += width*4;
|
||||
iterateRGB5A3_RGBA();
|
||||
}
|
||||
|
||||
uint16 unpack(uchar b)
|
||||
{
|
||||
return (uint16)((uint4)(b >> 3 & 0x18),
|
||||
(uint4)(b >> 1 & 0x18),
|
||||
(uint4)(b << 1 & 0x18),
|
||||
(uint4)(b << 3 & 0x18));
|
||||
}
|
||||
|
||||
kernel void decodeCMPRBlock(global uchar *dst,
|
||||
const global uchar *src, int width)
|
||||
{
|
||||
int x = get_global_id(0) * 4, y = get_global_id(1) * 4;
|
||||
uchar8 val = vload8(0, src);
|
||||
|
||||
uchar2 colora565 = (uchar2)(val.s1, val.s3);
|
||||
uchar2 colorb565 = (uchar2)(val.s0, val.s2);
|
||||
uchar8 color32 = (uchar8)(bitselect(colora565 << (uchar2)3, colora565 >> (uchar2)2, (uchar2)7),
|
||||
bitselect((colora565 >> (uchar2)3) | (colorb565 << (uchar2)5), colorb565 >> (uchar2)1, (uchar2)3),
|
||||
bitselect(colorb565, colorb565 >> (uchar2)5, (uchar2)7),
|
||||
(uchar2)0xFF);
|
||||
|
||||
ushort4 frac2 = convert_ushort4(color32.even) - convert_ushort4(color32.odd);
|
||||
uchar4 frac = convert_uchar4((frac2 * (ushort4)3) / (ushort4)8);
|
||||
|
||||
ushort4 colorAlpha = upsample((uchar4)(color32.even.s0,color32.even.s1,color32.even.s2,0),
|
||||
rhadd(color32.odd, color32.even));
|
||||
colorAlpha.s3 = 0xFF;
|
||||
ushort4 colorNoAlpha = upsample(color32.odd + frac, color32.even - frac);
|
||||
|
||||
uint4 colors = upsample((upsample(val.s0,val.s1) > upsample(val.s2,val.s3))?colorNoAlpha:colorAlpha,
|
||||
upsample(color32.odd, color32.even));
|
||||
|
||||
uint16 colorsFull = (uint16)(colors, colors, colors, colors);
|
||||
|
||||
vstore16(convert_uchar16(colorsFull >> unpack(val.s4)), 0, dst);
|
||||
vstore16(convert_uchar16(colorsFull >> unpack(val.s5)), 0, dst+=width*4);
|
||||
vstore16(convert_uchar16(colorsFull >> unpack(val.s6)), 0, dst+=width*4);
|
||||
vstore16(convert_uchar16(colorsFull >> unpack(val.s7)), 0, dst+=width*4);
|
||||
}
|
||||
|
||||
kernel void DecodeCMPR(global uchar *dst,
|
||||
const global uchar *src, int width)
|
||||
{
|
||||
int x = get_global_id(0) * 8, y = get_global_id(1) * 8;
|
||||
|
||||
src += x * 4 + (y * width) / 2;
|
||||
dst += (y * width + x) * 4;
|
||||
|
||||
decodeCMPRBlock(dst, src, width); src += 8;
|
||||
decodeCMPRBlock(dst + 16, src, width); src += 8;
|
||||
decodeCMPRBlock(dst + 16 * width, src, width); src += 8;
|
||||
decodeCMPRBlock(dst + 16 * (width + 1), src, width);
|
||||
}
|
||||
|
||||
kernel void decodeCMPRBlock_RGBA(global uchar *dst,
|
||||
const global uchar *src, int width)
|
||||
{
|
||||
int x = get_global_id(0) * 4, y = get_global_id(1) * 4;
|
||||
uchar8 val = vload8(0, src);
|
||||
|
||||
uchar2 colora565 = (uchar2)(val.s1, val.s3);
|
||||
uchar2 colorb565 = (uchar2)(val.s0, val.s2);
|
||||
uchar8 color32 = (uchar8)(bitselect(colorb565, colorb565 >> (uchar2)5, (uchar2)7),
|
||||
bitselect((colora565 >> (uchar2)3) | (colorb565 << (uchar2)5), colorb565 >> (uchar2)1, (uchar2)3),
|
||||
bitselect(colora565 << (uchar2)3, colora565 >> (uchar2)2, (uchar2)7),
|
||||
(uchar2)0xFF);
|
||||
|
||||
ushort4 frac2 = convert_ushort4(color32.even) - convert_ushort4(color32.odd);
|
||||
uchar4 frac = convert_uchar4((frac2 * (ushort4)3) / (ushort4)8);
|
||||
|
||||
ushort4 colorAlpha = upsample((uchar4)(color32.even.s0,color32.even.s1,color32.even.s2,0),
|
||||
rhadd(color32.odd, color32.even));
|
||||
colorAlpha.s3 = 0xFF;
|
||||
ushort4 colorNoAlpha = upsample(color32.odd + frac, color32.even - frac);
|
||||
|
||||
uint4 colors = upsample((upsample(val.s0,val.s1) > upsample(val.s2,val.s3))?colorNoAlpha:colorAlpha,
|
||||
upsample(color32.odd, color32.even));
|
||||
|
||||
uint16 colorsFull = (uint16)(colors, colors, colors, colors);
|
||||
|
||||
vstore16(convert_uchar16(colorsFull >> unpack(val.s4)), 0, dst);
|
||||
vstore16(convert_uchar16(colorsFull >> unpack(val.s5)), 0, dst+=width*4);
|
||||
vstore16(convert_uchar16(colorsFull >> unpack(val.s6)), 0, dst+=width*4);
|
||||
vstore16(convert_uchar16(colorsFull >> unpack(val.s7)), 0, dst+=width*4);
|
||||
}
|
||||
|
||||
kernel void DecodeCMPR_RGBA(global uchar *dst,
|
||||
const global uchar *src, int width)
|
||||
{
|
||||
int x = get_global_id(0) * 8, y = get_global_id(1) * 8;
|
||||
|
||||
src += x * 4 + (y * width) / 2;
|
||||
dst += (y * width + x) * 4;
|
||||
|
||||
decodeCMPRBlock_RGBA(dst, src, width); src += 8;
|
||||
decodeCMPRBlock_RGBA(dst + 16, src, width); src += 8;
|
||||
decodeCMPRBlock_RGBA(dst + 16 * width, src, width); src += 8;
|
||||
decodeCMPRBlock_RGBA(dst + 16 * (width + 1), src, width);
|
||||
}
|
10
Externals/CLRun/CMakeLists.txt
vendored
10
Externals/CLRun/CMakeLists.txt
vendored
@ -1,10 +0,0 @@
|
||||
set(SRCS clrun/clrun.c
|
||||
clrun/dynamiclib.c
|
||||
clrun/gencl.c
|
||||
clrun/genclgl.c
|
||||
clrun/genclext.c
|
||||
clrun/genclglext.c
|
||||
)
|
||||
|
||||
add_library(clrun STATIC ${SRCS})
|
||||
target_link_libraries(clrun ${CMAKE_DL_LIBS})
|
64
Externals/CLRun/clrun/CLRun.vcxproj
vendored
64
Externals/CLRun/clrun/CLRun.vcxproj
vendored
@ -1,64 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{AA862E5E-A993-497A-B6A0-0E8E94B10050}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\..\Source\VSProps\Base.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemGroup>
|
||||
<ClCompile Include="clrun.c" />
|
||||
<ClCompile Include="dynamiclib.c" />
|
||||
<ClCompile Include="gencl.c" />
|
||||
<ClCompile Include="genclgl.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\clrun.h" />
|
||||
<ClInclude Include="..\include\CL\cl.h" />
|
||||
<ClInclude Include="..\include\CL\cl_gl.h" />
|
||||
<ClInclude Include="..\include\CL\cl_platform.h" />
|
||||
<ClInclude Include="dynamiclib.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\CMakeLists.txt" />
|
||||
<None Include="generateClRun.pl" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
54
Externals/CLRun/clrun/CLRun.vcxproj.filters
vendored
54
Externals/CLRun/clrun/CLRun.vcxproj.filters
vendored
@ -1,54 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="genclgl.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="gencl.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dynamiclib.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="clrun.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\clrun.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="dynamiclib.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\CL\cl_platform.h">
|
||||
<Filter>Header Files\OpenCL</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\CL\cl.h">
|
||||
<Filter>Header Files\OpenCL</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\CL\cl_gl.h">
|
||||
<Filter>Header Files\OpenCL</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{106ccba4-ab19-42b5-b57a-e758dc5a2ed1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{db71af5e-c0f4-4099-a280-11cd0039b790}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{a28bc4a7-a663-44a5-a120-6ca71a89b55c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\OpenCL">
|
||||
<UniqueIdentifier>{17baf6ec-fbcb-4dfd-a963-5f9a091de41e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\CMakeLists.txt" />
|
||||
<None Include="generateClRun.pl">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
21
Externals/CLRun/clrun/Makefile
vendored
21
Externals/CLRun/clrun/Makefile
vendored
@ -1,21 +0,0 @@
|
||||
all: compile
|
||||
|
||||
compile: genclrun gencl.c genclgl.c
|
||||
gcc -Wall -c gencl.c -o gencl.o
|
||||
gcc -Wall -c genclgl.c -o genclgl.o
|
||||
gcc -Wall -c clrun.c -o clrun.o -I../include
|
||||
gcc -Wall --shared dynamiclib.c clrun.o gencl.o genclgl.o -o libclrun.so -ldl
|
||||
strip libclrun.so
|
||||
|
||||
genclrun: ../include/CL/cl.h ../include/CL/cl_gl.h
|
||||
./generateClRun.pl ../include/CL/cl.h > gencl.c
|
||||
./generateClRun.pl ../include/CL/cl_gl.h > genclgl.c
|
||||
./generateClRun.pl ../include/CL/cl_ext.h > genclext.c
|
||||
./generateClRun.pl ../include/CL/cl_gl_ext.h > genclglext.c
|
||||
./generateClRun.pl ../include/CL/cl_d3d10.h > gencld3d10.c
|
||||
./generateClRun.pl ../include/CL/cl_d3d11.h > gencld3d11.c
|
||||
./generateClRun.pl ../include/CL/cl_dx9_media_sharing.h > gencldx9.c
|
||||
|
||||
|
||||
clean:
|
||||
rm -rf *~ *.o
|
61
Externals/CLRun/clrun/clrun.c
vendored
61
Externals/CLRun/clrun/clrun.c
vendored
@ -1,61 +0,0 @@
|
||||
#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
|
63
Externals/CLRun/clrun/dynamiclib.c
vendored
63
Externals/CLRun/clrun/dynamiclib.c
vendored
@ -1,63 +0,0 @@
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
HINSTANCE library = NULL;
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#include <stdio.h>
|
||||
void *library = NULL;
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
int loadLib(const char *filename) {
|
||||
if (library)
|
||||
return -1;
|
||||
|
||||
if (!filename || strlen(filename) == 0)
|
||||
return -2;
|
||||
|
||||
#ifdef _WIN32
|
||||
library = LoadLibraryA(filename);
|
||||
#else
|
||||
library = dlopen(filename, RTLD_NOW | RTLD_LOCAL);
|
||||
#endif
|
||||
|
||||
if (!library)
|
||||
return -3;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int unloadLib()
|
||||
{
|
||||
int retval;
|
||||
if (!library)
|
||||
return -1;
|
||||
|
||||
#ifdef _WIN32
|
||||
retval = FreeLibrary(library);
|
||||
#else
|
||||
retval = dlclose(library);
|
||||
#endif
|
||||
|
||||
library = NULL;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void *getFunction(const char *funcname) {
|
||||
void* retval;
|
||||
|
||||
if (!library) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
retval = GetProcAddress(library, funcname);
|
||||
#else
|
||||
retval = dlsym(library, funcname);
|
||||
#endif
|
||||
|
||||
if (!retval)
|
||||
return NULL;
|
||||
|
||||
return retval;
|
||||
}
|
9
Externals/CLRun/clrun/dynamiclib.h
vendored
9
Externals/CLRun/clrun/dynamiclib.h
vendored
@ -1,9 +0,0 @@
|
||||
|
||||
#ifndef __DYNAMIC_LIBRARY_H
|
||||
#define __DYNAMIC_LIBRARY_H
|
||||
|
||||
int loadLib(const char *filename);
|
||||
int unloadLib();
|
||||
void *getFunction(const char *funcname);
|
||||
|
||||
#endif
|
546
Externals/CLRun/clrun/gencl.c
vendored
546
Externals/CLRun/clrun/gencl.c
vendored
@ -1,546 +0,0 @@
|
||||
// Automatically generated by generateClRun.pl
|
||||
#include "dynamiclib.h"
|
||||
#include "../include/CL/cl.h"
|
||||
|
||||
|
||||
static cl_int (*clGetPlatformIDs_ptr)(cl_uint, cl_platform_id *, cl_uint *) = NULL;
|
||||
cl_int CL_API_CALL clGetPlatformIDs (cl_uint num_entries,cl_platform_id * platforms,cl_uint * num_platforms) {
|
||||
if(!clGetPlatformIDs_ptr) clGetPlatformIDs_ptr = getFunction("clGetPlatformIDs");
|
||||
return (*clGetPlatformIDs_ptr)(num_entries, platforms, num_platforms);
|
||||
}
|
||||
|
||||
static cl_int (*clGetPlatformInfo_ptr)(cl_platform_id, cl_platform_info, size_t, void *, size_t *) = NULL;
|
||||
cl_int CL_API_CALL clGetPlatformInfo (cl_platform_id platform,cl_platform_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) {
|
||||
if(!clGetPlatformInfo_ptr) clGetPlatformInfo_ptr = getFunction("clGetPlatformInfo");
|
||||
return (*clGetPlatformInfo_ptr)(platform, param_name, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clGetDeviceIDs_ptr)(cl_platform_id, cl_device_type, cl_uint, cl_device_id *, cl_uint *) = NULL;
|
||||
cl_int CL_API_CALL clGetDeviceIDs (cl_platform_id platform,cl_device_type device_type,cl_uint num_entries,cl_device_id * devices,cl_uint * num_devices) {
|
||||
if(!clGetDeviceIDs_ptr) clGetDeviceIDs_ptr = getFunction("clGetDeviceIDs");
|
||||
return (*clGetDeviceIDs_ptr)(platform, device_type, num_entries, devices, num_devices);
|
||||
}
|
||||
|
||||
static cl_int (*clGetDeviceInfo_ptr)(cl_device_id, cl_device_info, size_t, void *, size_t *) = NULL;
|
||||
cl_int CL_API_CALL clGetDeviceInfo (cl_device_id device,cl_device_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) {
|
||||
if(!clGetDeviceInfo_ptr) clGetDeviceInfo_ptr = getFunction("clGetDeviceInfo");
|
||||
return (*clGetDeviceInfo_ptr)(device, param_name, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clCreateSubDevices_ptr)(cl_device_id, const cl_device_partition_property *, cl_uint, cl_device_id *, cl_uint *) = NULL;
|
||||
cl_int CL_API_CALL clCreateSubDevices (cl_device_id in_device,const cl_device_partition_property * properties,cl_uint num_devices,cl_device_id * out_devices,cl_uint * num_devices_ret) {
|
||||
if(!clCreateSubDevices_ptr) clCreateSubDevices_ptr = getFunction("clCreateSubDevices");
|
||||
return (*clCreateSubDevices_ptr)(in_device, properties, num_devices, out_devices, num_devices_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clRetainDevice_ptr)(cl_device_id) = NULL;
|
||||
cl_int CL_API_CALL clRetainDevice (cl_device_id device) {
|
||||
if(!clRetainDevice_ptr) clRetainDevice_ptr = getFunction("clRetainDevice");
|
||||
return (*clRetainDevice_ptr)(device);
|
||||
}
|
||||
|
||||
static cl_int (*clReleaseDevice_ptr)(cl_device_id) = NULL;
|
||||
cl_int CL_API_CALL clReleaseDevice (cl_device_id device) {
|
||||
if(!clReleaseDevice_ptr) clReleaseDevice_ptr = getFunction("clReleaseDevice");
|
||||
return (*clReleaseDevice_ptr)(device);
|
||||
}
|
||||
|
||||
static cl_context (*clCreateContext_ptr)(const cl_context_properties *, cl_uint, const cl_device_id *, void (CL_CALLBACK *pfn_notify)(const char *, const void *, size_t, void *), void*, cl_int*) = NULL;
|
||||
cl_context CL_API_CALL clCreateContext(const cl_context_properties * properties,
|
||||
cl_uint num_devices,
|
||||
const cl_device_id * devices,
|
||||
void (CL_CALLBACK *pfn_notify)(const char *, const void *, size_t, void *),
|
||||
void * user_data,
|
||||
cl_int * errcode_ret) {
|
||||
if(!clCreateContext_ptr) clCreateContext_ptr = getFunction("clCreateContext");
|
||||
return (*clCreateContext_ptr)(properties, num_devices, devices, pfn_notify, user_data, errcode_ret);
|
||||
}
|
||||
|
||||
static cl_context (*clCreateContextFromType_ptr)(const cl_context_properties *, cl_device_type, void (CL_CALLBACK * /* pfn_notify */)(const char *, const void *, size_t, void *), void*, cl_int*) = NULL;
|
||||
cl_context CL_API_CALL clCreateContextFromType(const cl_context_properties * properties,
|
||||
cl_device_type device_type,
|
||||
void (CL_CALLBACK * pfn_notify)(const char *, const void *, size_t, void *),
|
||||
void * user_data,
|
||||
cl_int * errcode_ret) {
|
||||
if(!clCreateContextFromType_ptr) clCreateContextFromType_ptr = getFunction("clCreateContextFromType");
|
||||
return (*clCreateContextFromType_ptr)(properties, device_type, pfn_notify, user_data, errcode_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clRetainContext_ptr)(cl_context) = NULL;
|
||||
cl_int CL_API_CALL clRetainContext (cl_context context) {
|
||||
if(!clRetainContext_ptr) clRetainContext_ptr = getFunction("clRetainContext");
|
||||
return (*clRetainContext_ptr)(context);
|
||||
}
|
||||
|
||||
static cl_int (*clReleaseContext_ptr)(cl_context) = NULL;
|
||||
cl_int CL_API_CALL clReleaseContext (cl_context context) {
|
||||
if(!clReleaseContext_ptr) clReleaseContext_ptr = getFunction("clReleaseContext");
|
||||
return (*clReleaseContext_ptr)(context);
|
||||
}
|
||||
|
||||
static cl_int (*clGetContextInfo_ptr)(cl_context, cl_context_info, size_t, void *, size_t *) = NULL;
|
||||
cl_int CL_API_CALL clGetContextInfo (cl_context context,cl_context_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) {
|
||||
if(!clGetContextInfo_ptr) clGetContextInfo_ptr = getFunction("clGetContextInfo");
|
||||
return (*clGetContextInfo_ptr)(context, param_name, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
|
||||
static cl_command_queue (*clCreateCommandQueue_ptr)(cl_context, cl_device_id, cl_command_queue_properties, cl_int *) = NULL;
|
||||
cl_command_queue CL_API_CALL clCreateCommandQueue (cl_context context,cl_device_id device,cl_command_queue_properties properties,cl_int * errcode_ret) {
|
||||
if(!clCreateCommandQueue_ptr) clCreateCommandQueue_ptr = getFunction("clCreateCommandQueue");
|
||||
return (*clCreateCommandQueue_ptr)(context, device, properties, errcode_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clRetainCommandQueue_ptr)(cl_command_queue) = NULL;
|
||||
cl_int CL_API_CALL clRetainCommandQueue (cl_command_queue command_queue) {
|
||||
if(!clRetainCommandQueue_ptr) clRetainCommandQueue_ptr = getFunction("clRetainCommandQueue");
|
||||
return (*clRetainCommandQueue_ptr)(command_queue);
|
||||
}
|
||||
|
||||
static cl_int (*clReleaseCommandQueue_ptr)(cl_command_queue) = NULL;
|
||||
cl_int CL_API_CALL clReleaseCommandQueue (cl_command_queue command_queue) {
|
||||
if(!clReleaseCommandQueue_ptr) clReleaseCommandQueue_ptr = getFunction("clReleaseCommandQueue");
|
||||
return (*clReleaseCommandQueue_ptr)(command_queue);
|
||||
}
|
||||
|
||||
static cl_int (*clGetCommandQueueInfo_ptr)(cl_command_queue, cl_command_queue_info, size_t, void *, size_t *) = NULL;
|
||||
cl_int CL_API_CALL clGetCommandQueueInfo (cl_command_queue command_queue,cl_command_queue_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) {
|
||||
if(!clGetCommandQueueInfo_ptr) clGetCommandQueueInfo_ptr = getFunction("clGetCommandQueueInfo");
|
||||
return (*clGetCommandQueueInfo_ptr)(command_queue, param_name, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
|
||||
static cl_mem (*clCreateBuffer_ptr)(cl_context, cl_mem_flags, size_t, void *, cl_int *) = NULL;
|
||||
cl_mem CL_API_CALL clCreateBuffer (cl_context context,cl_mem_flags flags,size_t size,void * host_ptr,cl_int * errcode_ret) {
|
||||
if(!clCreateBuffer_ptr) clCreateBuffer_ptr = getFunction("clCreateBuffer");
|
||||
return (*clCreateBuffer_ptr)(context, flags, size, host_ptr, errcode_ret);
|
||||
}
|
||||
|
||||
static cl_mem (*clCreateSubBuffer_ptr)(cl_mem, cl_mem_flags, cl_buffer_create_type, const void *, cl_int *) = NULL;
|
||||
cl_mem CL_API_CALL clCreateSubBuffer (cl_mem buffer,cl_mem_flags flags,cl_buffer_create_type buffer_create_type,const void * buffer_create_info,cl_int * errcode_ret) {
|
||||
if(!clCreateSubBuffer_ptr) clCreateSubBuffer_ptr = getFunction("clCreateSubBuffer");
|
||||
return (*clCreateSubBuffer_ptr)(buffer, flags, buffer_create_type, buffer_create_info, errcode_ret);
|
||||
}
|
||||
|
||||
static cl_mem (*clCreateImage_ptr)(cl_context, cl_mem_flags, const cl_image_format *, const cl_image_desc *, void *, cl_int *) = NULL;
|
||||
cl_mem CL_API_CALL clCreateImage (cl_context context,cl_mem_flags flags,const cl_image_format * image_format,const cl_image_desc * image_desc,void * host_ptr,cl_int * errcode_ret) {
|
||||
if(!clCreateImage_ptr) clCreateImage_ptr = getFunction("clCreateImage");
|
||||
return (*clCreateImage_ptr)(context, flags, image_format, image_desc, host_ptr, errcode_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clRetainMemObject_ptr)(cl_mem) = NULL;
|
||||
cl_int CL_API_CALL clRetainMemObject (cl_mem memobj) {
|
||||
if(!clRetainMemObject_ptr) clRetainMemObject_ptr = getFunction("clRetainMemObject");
|
||||
return (*clRetainMemObject_ptr)(memobj);
|
||||
}
|
||||
|
||||
static cl_int (*clReleaseMemObject_ptr)(cl_mem) = NULL;
|
||||
cl_int CL_API_CALL clReleaseMemObject (cl_mem memobj) {
|
||||
if(!clReleaseMemObject_ptr) clReleaseMemObject_ptr = getFunction("clReleaseMemObject");
|
||||
return (*clReleaseMemObject_ptr)(memobj);
|
||||
}
|
||||
|
||||
static cl_int (*clGetSupportedImageFormats_ptr)(cl_context, cl_mem_flags, cl_mem_object_type, cl_uint, cl_image_format *, cl_uint *) = NULL;
|
||||
cl_int CL_API_CALL clGetSupportedImageFormats (cl_context context,cl_mem_flags flags,cl_mem_object_type image_type,cl_uint num_entries,cl_image_format * image_formats,cl_uint * num_image_formats) {
|
||||
if(!clGetSupportedImageFormats_ptr) clGetSupportedImageFormats_ptr = getFunction("clGetSupportedImageFormats");
|
||||
return (*clGetSupportedImageFormats_ptr)(context, flags, image_type, num_entries, image_formats, num_image_formats);
|
||||
}
|
||||
|
||||
static cl_int (*clGetMemObjectInfo_ptr)(cl_mem, cl_mem_info, size_t, void *, size_t *) = NULL;
|
||||
cl_int CL_API_CALL clGetMemObjectInfo (cl_mem memobj,cl_mem_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) {
|
||||
if(!clGetMemObjectInfo_ptr) clGetMemObjectInfo_ptr = getFunction("clGetMemObjectInfo");
|
||||
return (*clGetMemObjectInfo_ptr)(memobj, param_name, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clGetImageInfo_ptr)(cl_mem, cl_image_info, size_t, void *, size_t *) = NULL;
|
||||
cl_int CL_API_CALL clGetImageInfo (cl_mem image,cl_image_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) {
|
||||
if(!clGetImageInfo_ptr) clGetImageInfo_ptr = getFunction("clGetImageInfo");
|
||||
return (*clGetImageInfo_ptr)(image, param_name, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
|
||||
/* Sampler APIs */
|
||||
static cl_int (*clSetMemObjectDestructorCallback_ptr)(cl_mem memobj,void (CL_CALLBACK *pfn_notify)( cl_mem memobj, void*) ,void *user_data ) = NULL;
|
||||
cl_int CL_API_CALL clSetMemObjectDestructorCallback (cl_mem memobj,void (CL_CALLBACK *pfn_notify)( cl_mem memobj, void*) ,void *user_data )
|
||||
{
|
||||
if(!clSetMemObjectDestructorCallback_ptr) clSetMemObjectDestructorCallback_ptr = getFunction("clSetMemObjectDestructorCallback");
|
||||
return (*clSetMemObjectDestructorCallback_ptr)(memobj, pfn_notify, user_data);
|
||||
}
|
||||
|
||||
/* Sampler APIs */
|
||||
static cl_sampler (*clCreateSampler_ptr)(cl_context, cl_bool, cl_addressing_mode, cl_filter_mode, cl_int *) = NULL;
|
||||
cl_sampler CL_API_CALL clCreateSampler(cl_context context,cl_bool normalized_coords,cl_addressing_mode addressing_mode,cl_filter_mode filter_mode,cl_int * errcode_ret) {
|
||||
if(!clCreateSampler_ptr) clCreateSampler_ptr = getFunction("clCreateSampler");
|
||||
return (*clCreateSampler_ptr)(context, normalized_coords, addressing_mode, filter_mode, errcode_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clRetainSampler_ptr)(cl_sampler) = NULL;
|
||||
cl_int CL_API_CALL clRetainSampler (cl_sampler sampler) {
|
||||
if(!clRetainSampler_ptr) clRetainSampler_ptr = getFunction("clRetainSampler");
|
||||
return (*clRetainSampler_ptr)(sampler);
|
||||
}
|
||||
|
||||
static cl_int (*clReleaseSampler_ptr)(cl_sampler) = NULL;
|
||||
cl_int CL_API_CALL clReleaseSampler (cl_sampler sampler) {
|
||||
if(!clReleaseSampler_ptr) clReleaseSampler_ptr = getFunction("clReleaseSampler");
|
||||
return (*clReleaseSampler_ptr)(sampler);
|
||||
}
|
||||
|
||||
static cl_int (*clGetSamplerInfo_ptr)(cl_sampler, cl_sampler_info, size_t, void *, size_t *) = NULL;
|
||||
cl_int CL_API_CALL clGetSamplerInfo (cl_sampler sampler,cl_sampler_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) {
|
||||
if(!clGetSamplerInfo_ptr) clGetSamplerInfo_ptr = getFunction("clGetSamplerInfo");
|
||||
return (*clGetSamplerInfo_ptr)(sampler, param_name, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
|
||||
static cl_program (*clCreateProgramWithSource_ptr)(cl_context, cl_uint, const char **, const size_t *, cl_int *) = NULL;
|
||||
cl_program CL_API_CALL clCreateProgramWithSource (cl_context context,cl_uint count,const char ** strings,const size_t * lengths,cl_int * errcode_ret) {
|
||||
if(!clCreateProgramWithSource_ptr) clCreateProgramWithSource_ptr = getFunction("clCreateProgramWithSource");
|
||||
return (*clCreateProgramWithSource_ptr)(context, count, strings, lengths, errcode_ret);
|
||||
}
|
||||
|
||||
static cl_program (*clCreateProgramWithBinary_ptr)(cl_context, cl_uint, const cl_device_id *, const size_t *, const unsigned char **, cl_int *, cl_int *) = NULL;
|
||||
cl_program CL_API_CALL clCreateProgramWithBinary (cl_context context,cl_uint num_devices,const cl_device_id * device_list,const size_t * lengths,const unsigned char ** binaries,cl_int * binary_status,cl_int * errcode_ret) {
|
||||
if(!clCreateProgramWithBinary_ptr) clCreateProgramWithBinary_ptr = getFunction("clCreateProgramWithBinary");
|
||||
return (*clCreateProgramWithBinary_ptr)(context, num_devices, device_list, lengths, binaries, binary_status, errcode_ret);
|
||||
}
|
||||
|
||||
static cl_program (*clCreateProgramWithBuiltInKernels_ptr)(cl_context, cl_uint, const cl_device_id *, const char *, cl_int *) = NULL;
|
||||
cl_program CL_API_CALL clCreateProgramWithBuiltInKernels (cl_context context,cl_uint num_devices,const cl_device_id * device_list,const char * kernel_names,cl_int * errcode_ret) {
|
||||
if(!clCreateProgramWithBuiltInKernels_ptr) clCreateProgramWithBuiltInKernels_ptr = getFunction("clCreateProgramWithBuiltInKernels");
|
||||
return (*clCreateProgramWithBuiltInKernels_ptr)(context, num_devices, device_list, kernel_names, errcode_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clRetainProgram_ptr)(cl_program) = NULL;
|
||||
cl_int CL_API_CALL clRetainProgram (cl_program program) {
|
||||
if(!clRetainProgram_ptr) clRetainProgram_ptr = getFunction("clRetainProgram");
|
||||
return (*clRetainProgram_ptr)(program);
|
||||
}
|
||||
|
||||
static cl_int (*clReleaseProgram_ptr)(cl_program) = NULL;
|
||||
cl_int CL_API_CALL clReleaseProgram (cl_program program) {
|
||||
if(!clReleaseProgram_ptr) clReleaseProgram_ptr = getFunction("clReleaseProgram");
|
||||
return (*clReleaseProgram_ptr)(program);
|
||||
}
|
||||
|
||||
static cl_int (*clBuildProgram_ptr)(cl_program, cl_uint, const cl_device_id *, const char *, void (CL_CALLBACK * /* pfn_notify */)(cl_program /* program */, void * /* user_data */), void *) = NULL;
|
||||
cl_int CL_API_CALL clBuildProgram (cl_program program,cl_uint num_devices,const cl_device_id * device_list,const char * options, void (CL_CALLBACK * pfn_notify)(cl_program /* program */, void * /* user_data */),void * user_data) {
|
||||
if(!clBuildProgram_ptr) clBuildProgram_ptr = getFunction("clBuildProgram");
|
||||
return (*clBuildProgram_ptr)(program, num_devices, device_list, options, user_data, user_data);
|
||||
}
|
||||
|
||||
static cl_int (*clCompileProgram_ptr)(cl_program, cl_uint, const cl_device_id *, const char *, cl_uint, const cl_program *, const char **, void (CL_CALLBACK * /* pfn_notify */)(cl_program /* program */, void * /* user_data */), void *) = NULL;
|
||||
cl_int CL_API_CALL clCompileProgram (cl_program program,cl_uint num_devices,const cl_device_id * device_list,const char * options,cl_uint num_input_headers,const cl_program * input_headers,const char ** header_include_names,void (CL_CALLBACK * pfn_notify)(cl_program /* program */, void * /* user_data */),void * user_data) {
|
||||
if(!clCompileProgram_ptr) clCompileProgram_ptr = getFunction("clCompileProgram");
|
||||
return (*clCompileProgram_ptr)(program, num_devices, device_list, options, num_input_headers, input_headers, header_include_names, user_data, user_data);
|
||||
}
|
||||
|
||||
static cl_program (*clLinkProgram_ptr)(cl_context, cl_uint, const cl_device_id *, const char *, cl_uint, const cl_program *, void (CL_CALLBACK * /* pfn_notify */)(cl_program /* program */, void * /* user_data */), void *, cl_int *) = NULL;
|
||||
cl_program CL_API_CALL clLinkProgram (cl_context context,cl_uint num_devices,const cl_device_id * device_list,const char * options,cl_uint num_input_programs,const cl_program * input_programs,void (CL_CALLBACK * pfn_notify)(cl_program /* program */, void * /* user_data */),void * user_data,cl_int * errcode_ret) {
|
||||
if(!clLinkProgram_ptr) clLinkProgram_ptr = getFunction("clLinkProgram");
|
||||
return (*clLinkProgram_ptr)(context, num_devices, device_list, options, num_input_programs, input_programs, user_data, user_data, errcode_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clUnloadPlatformCompiler_ptr)(cl_platform_id) = NULL;
|
||||
cl_int CL_API_CALL clUnloadPlatformCompiler (cl_platform_id platform) {
|
||||
if(!clUnloadPlatformCompiler_ptr) clUnloadPlatformCompiler_ptr = getFunction("clUnloadPlatformCompiler");
|
||||
return (*clUnloadPlatformCompiler_ptr)(platform);
|
||||
}
|
||||
|
||||
static cl_int (*clGetProgramInfo_ptr)(cl_program, cl_program_info, size_t, void *, size_t *) = NULL;
|
||||
cl_int CL_API_CALL clGetProgramInfo (cl_program program,cl_program_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) {
|
||||
if(!clGetProgramInfo_ptr) clGetProgramInfo_ptr = getFunction("clGetProgramInfo");
|
||||
return (*clGetProgramInfo_ptr)(program, param_name, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clGetProgramBuildInfo_ptr)(cl_program, cl_device_id, cl_program_build_info, size_t, void *, size_t *) = NULL;
|
||||
cl_int CL_API_CALL clGetProgramBuildInfo (cl_program program,cl_device_id device,cl_program_build_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) {
|
||||
if(!clGetProgramBuildInfo_ptr) clGetProgramBuildInfo_ptr = getFunction("clGetProgramBuildInfo");
|
||||
return (*clGetProgramBuildInfo_ptr)(program, device, param_name, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
|
||||
static cl_kernel (*clCreateKernel_ptr)(cl_program, const char *, cl_int *) = NULL;
|
||||
cl_kernel CL_API_CALL clCreateKernel (cl_program program,const char * kernel_name,cl_int * errcode_ret) {
|
||||
if(!clCreateKernel_ptr) clCreateKernel_ptr = getFunction("clCreateKernel");
|
||||
return (*clCreateKernel_ptr)(program, kernel_name, errcode_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clCreateKernelsInProgram_ptr)(cl_program, cl_uint, cl_kernel *, cl_uint *) = NULL;
|
||||
cl_int CL_API_CALL clCreateKernelsInProgram (cl_program program,cl_uint num_kernels,cl_kernel * kernels,cl_uint * num_kernels_ret) {
|
||||
if(!clCreateKernelsInProgram_ptr) clCreateKernelsInProgram_ptr = getFunction("clCreateKernelsInProgram");
|
||||
return (*clCreateKernelsInProgram_ptr)(program, num_kernels, kernels, num_kernels_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clRetainKernel_ptr)(cl_kernel) = NULL;
|
||||
cl_int CL_API_CALL clRetainKernel (cl_kernel kernel) {
|
||||
if(!clRetainKernel_ptr) clRetainKernel_ptr = getFunction("clRetainKernel");
|
||||
return (*clRetainKernel_ptr)(kernel);
|
||||
}
|
||||
|
||||
static cl_int (*clReleaseKernel_ptr)(cl_kernel) = NULL;
|
||||
cl_int CL_API_CALL clReleaseKernel (cl_kernel kernel) {
|
||||
if(!clReleaseKernel_ptr) clReleaseKernel_ptr = getFunction("clReleaseKernel");
|
||||
return (*clReleaseKernel_ptr)(kernel);
|
||||
}
|
||||
|
||||
static cl_int (*clSetKernelArg_ptr)(cl_kernel, cl_uint, size_t, const void *) = NULL;
|
||||
cl_int CL_API_CALL clSetKernelArg (cl_kernel kernel,cl_uint arg_index,size_t arg_size,const void * arg_value) {
|
||||
if(!clSetKernelArg_ptr) clSetKernelArg_ptr = getFunction("clSetKernelArg");
|
||||
return (*clSetKernelArg_ptr)(kernel, arg_index, arg_size, arg_value);
|
||||
}
|
||||
|
||||
static cl_int (*clGetKernelInfo_ptr)(cl_kernel, cl_kernel_info, size_t, void *, size_t *) = NULL;
|
||||
cl_int CL_API_CALL clGetKernelInfo (cl_kernel kernel,cl_kernel_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) {
|
||||
if(!clGetKernelInfo_ptr) clGetKernelInfo_ptr = getFunction("clGetKernelInfo");
|
||||
return (*clGetKernelInfo_ptr)(kernel, param_name, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clGetKernelArgInfo_ptr)(cl_kernel, cl_uint, cl_kernel_arg_info, size_t, void *, size_t *) = NULL;
|
||||
cl_int CL_API_CALL clGetKernelArgInfo (cl_kernel kernel,cl_uint arg_indx,cl_kernel_arg_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) {
|
||||
if(!clGetKernelArgInfo_ptr) clGetKernelArgInfo_ptr = getFunction("clGetKernelArgInfo");
|
||||
return (*clGetKernelArgInfo_ptr)(kernel, arg_indx, param_name, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clGetKernelWorkGroupInfo_ptr)(cl_kernel, cl_device_id, cl_kernel_work_group_info, size_t, void *, size_t *) = NULL;
|
||||
cl_int CL_API_CALL clGetKernelWorkGroupInfo (cl_kernel kernel,cl_device_id device,cl_kernel_work_group_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) {
|
||||
if(!clGetKernelWorkGroupInfo_ptr) clGetKernelWorkGroupInfo_ptr = getFunction("clGetKernelWorkGroupInfo");
|
||||
return (*clGetKernelWorkGroupInfo_ptr)(kernel, device, param_name, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clWaitForEvents_ptr)(cl_uint, const cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clWaitForEvents (cl_uint num_events,const cl_event * event_list) {
|
||||
if(!clWaitForEvents_ptr) clWaitForEvents_ptr = getFunction("clWaitForEvents");
|
||||
return (*clWaitForEvents_ptr)(num_events, event_list);
|
||||
}
|
||||
|
||||
static cl_int (*clGetEventInfo_ptr)(cl_event, cl_event_info, size_t, void *, size_t *) = NULL;
|
||||
cl_int CL_API_CALL clGetEventInfo (cl_event event,cl_event_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) {
|
||||
if(!clGetEventInfo_ptr) clGetEventInfo_ptr = getFunction("clGetEventInfo");
|
||||
return (*clGetEventInfo_ptr)(event, param_name, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
|
||||
static cl_event (*clCreateUserEvent_ptr)(cl_context, cl_int * /* errcode_ret */) = NULL;
|
||||
cl_event CL_API_CALL clCreateUserEvent (cl_context context,cl_int * errcode_ret)
|
||||
{
|
||||
if(!clCreateUserEvent_ptr) clCreateUserEvent_ptr = getFunction("clCreateUserEvent");
|
||||
return (*clCreateUserEvent_ptr)(context,errcode_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clRetainEvent_ptr)(cl_event) = NULL;
|
||||
cl_int CL_API_CALL clRetainEvent(cl_event event) {
|
||||
if(!clRetainEvent_ptr) clRetainEvent_ptr = getFunction("clRetainEvent");
|
||||
return (*clRetainEvent_ptr)(event);
|
||||
}
|
||||
|
||||
static cl_int (*clReleaseEvent_ptr)(cl_event) = NULL;
|
||||
cl_int CL_API_CALL clReleaseEvent (cl_event event) {
|
||||
if(!clReleaseEvent_ptr) clReleaseEvent_ptr = getFunction("clReleaseEvent");
|
||||
return (*clReleaseEvent_ptr)(event);
|
||||
}
|
||||
|
||||
static cl_int (*clSetUserEventStatus_ptr)(cl_event, cl_int) = NULL;
|
||||
cl_int CL_API_CALL clSetUserEventStatus (cl_event event,cl_int execution_status) {
|
||||
if(!clSetUserEventStatus_ptr) clSetUserEventStatus_ptr = getFunction("clSetUserEventStatus");
|
||||
return (*clSetUserEventStatus_ptr)(event, execution_status);
|
||||
}
|
||||
|
||||
static cl_int (*clSetEventCallback_ptr)(cl_event, cl_int, void (CL_CALLBACK * /* pfn_notify */)(cl_event, cl_int, void *), void*) = NULL;
|
||||
cl_int CL_API_CALL clSetEventCallback (cl_event event,cl_int command_exec_callback_type, void (CL_CALLBACK * pfn_notify)(cl_event, cl_int, void *), void* user_data) {
|
||||
if(!clSetEventCallback_ptr) clSetEventCallback_ptr = getFunction("clSetEventCallback");
|
||||
return (*clSetEventCallback_ptr)(event, command_exec_callback_type, pfn_notify, user_data);
|
||||
}
|
||||
|
||||
static cl_int (*clGetEventProfilingInfo_ptr)(cl_event, cl_profiling_info, size_t, void *, size_t *) = NULL;
|
||||
cl_int CL_API_CALL clGetEventProfilingInfo (cl_event event,cl_profiling_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) {
|
||||
if(!clGetEventProfilingInfo_ptr) clGetEventProfilingInfo_ptr = getFunction("clGetEventProfilingInfo");
|
||||
return (*clGetEventProfilingInfo_ptr)(event, param_name, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clFlush_ptr)(cl_command_queue) = NULL;
|
||||
cl_int CL_API_CALL clFlush (cl_command_queue command_queue) {
|
||||
if(!clFlush_ptr) clFlush_ptr = getFunction("clFlush");
|
||||
return (*clFlush_ptr)(command_queue);
|
||||
}
|
||||
|
||||
static cl_int (*clFinish_ptr)(cl_command_queue) = NULL;
|
||||
cl_int CL_API_CALL clFinish (cl_command_queue command_queue) {
|
||||
if(!clFinish_ptr) clFinish_ptr = getFunction("clFinish");
|
||||
return (*clFinish_ptr)(command_queue);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueReadBuffer_ptr)(cl_command_queue, cl_mem, cl_bool, size_t, size_t, void *, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueReadBuffer (cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_read,size_t offset,size_t size,void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueReadBuffer_ptr) clEnqueueReadBuffer_ptr = getFunction("clEnqueueReadBuffer");
|
||||
return (*clEnqueueReadBuffer_ptr)(command_queue, buffer, blocking_read, offset, size, ptr, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueReadBufferRect_ptr)(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, const size_t *, size_t, size_t, size_t, size_t, void *, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueReadBufferRect (cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_read,const size_t * buffer_offset,const size_t * host_offset,const size_t * region,size_t buffer_row_pitch,size_t buffer_slice_pitch,size_t host_row_pitch,size_t host_slice_pitch,void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueReadBufferRect_ptr) clEnqueueReadBufferRect_ptr = getFunction("clEnqueueReadBufferRect");
|
||||
return (*clEnqueueReadBufferRect_ptr)(command_queue, buffer, blocking_read, buffer_offset, host_offset, region, buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueWriteBuffer_ptr)(cl_command_queue, cl_mem, cl_bool, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueWriteBuffer (cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_write,size_t offset,size_t size,const void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueWriteBuffer_ptr) clEnqueueWriteBuffer_ptr = getFunction("clEnqueueWriteBuffer");
|
||||
return (*clEnqueueWriteBuffer_ptr)(command_queue, buffer, blocking_write, offset, size, ptr, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueWriteBufferRect_ptr)(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, const size_t *, size_t, size_t, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueWriteBufferRect (cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_write,const size_t * buffer_offset,const size_t * host_offset,const size_t * region,size_t buffer_row_pitch,size_t buffer_slice_pitch,size_t host_row_pitch,size_t host_slice_pitch,const void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueWriteBufferRect_ptr) clEnqueueWriteBufferRect_ptr = getFunction("clEnqueueWriteBufferRect");
|
||||
return (*clEnqueueWriteBufferRect_ptr)(command_queue, buffer, blocking_write, buffer_offset, host_offset, region, buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueFillBuffer_ptr)(cl_command_queue, cl_mem, const void *, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueFillBuffer (cl_command_queue command_queue,cl_mem buffer,const void * pattern,size_t pattern_size,size_t offset,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueFillBuffer_ptr) clEnqueueFillBuffer_ptr = getFunction("clEnqueueFillBuffer");
|
||||
return (*clEnqueueFillBuffer_ptr)(command_queue, buffer, pattern, pattern_size, offset, size, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueCopyBuffer_ptr)(cl_command_queue, cl_mem, cl_mem, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueCopyBuffer (cl_command_queue command_queue,cl_mem src_buffer,cl_mem dst_buffer,size_t src_offset,size_t dst_offset,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueCopyBuffer_ptr) clEnqueueCopyBuffer_ptr = getFunction("clEnqueueCopyBuffer");
|
||||
return (*clEnqueueCopyBuffer_ptr)(command_queue, src_buffer, dst_buffer, src_offset, dst_offset, size, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueCopyBufferRect_ptr)(cl_command_queue, cl_mem, cl_mem, const size_t *, const size_t *, const size_t *, size_t, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueCopyBufferRect (cl_command_queue command_queue,cl_mem src_buffer,cl_mem dst_buffer,const size_t * src_origin,const size_t * dst_origin,const size_t * region,size_t src_row_pitch,size_t src_slice_pitch,size_t dst_row_pitch,size_t dst_slice_pitch,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueCopyBufferRect_ptr) clEnqueueCopyBufferRect_ptr = getFunction("clEnqueueCopyBufferRect");
|
||||
return (*clEnqueueCopyBufferRect_ptr)(command_queue, src_buffer, dst_buffer, src_origin, dst_origin, region, src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueReadImage_ptr)(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, size_t, size_t, void *, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueReadImage (cl_command_queue command_queue,cl_mem image,cl_bool blocking_read,const size_t * origin,const size_t * region,size_t row_pitch,size_t slice_pitch,void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueReadImage_ptr) clEnqueueReadImage_ptr = getFunction("clEnqueueReadImage");
|
||||
return (*clEnqueueReadImage_ptr)(command_queue, image, blocking_read, origin, region, row_pitch, slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueWriteImage_ptr)(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueWriteImage (cl_command_queue command_queue,cl_mem image,cl_bool blocking_write,const size_t * origin,const size_t * region,size_t input_row_pitch,size_t input_slice_pitch,const void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueWriteImage_ptr) clEnqueueWriteImage_ptr = getFunction("clEnqueueWriteImage");
|
||||
return (*clEnqueueWriteImage_ptr)(command_queue, image, blocking_write, origin, region, input_row_pitch, input_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueFillImage_ptr)(cl_command_queue, cl_mem, const void *, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueFillImage (cl_command_queue command_queue,cl_mem image,const void * fill_color,const size_t * origin,const size_t * region,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueFillImage_ptr) clEnqueueFillImage_ptr = getFunction("clEnqueueFillImage");
|
||||
return (*clEnqueueFillImage_ptr)(command_queue, image, fill_color, origin, region, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueCopyImage_ptr)(cl_command_queue, cl_mem, cl_mem, const size_t *, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueCopyImage (cl_command_queue command_queue,cl_mem src_image,cl_mem dst_image,const size_t * src_origin,const size_t * dst_origin,const size_t * region,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueCopyImage_ptr) clEnqueueCopyImage_ptr = getFunction("clEnqueueCopyImage");
|
||||
return (*clEnqueueCopyImage_ptr)(command_queue, src_image, dst_image, src_origin, dst_origin, region, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueCopyImageToBuffer_ptr)(cl_command_queue, cl_mem, cl_mem, const size_t *, const size_t *, size_t, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueCopyImageToBuffer (cl_command_queue command_queue,cl_mem src_image,cl_mem dst_buffer,const size_t * src_origin,const size_t * region,size_t dst_offset,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueCopyImageToBuffer_ptr) clEnqueueCopyImageToBuffer_ptr = getFunction("clEnqueueCopyImageToBuffer");
|
||||
return (*clEnqueueCopyImageToBuffer_ptr)(command_queue, src_image, dst_buffer, src_origin, region, dst_offset, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueCopyBufferToImage_ptr)(cl_command_queue, cl_mem, cl_mem, size_t, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueCopyBufferToImage (cl_command_queue command_queue,cl_mem src_buffer,cl_mem dst_image,size_t src_offset,const size_t * dst_origin,const size_t * region,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueCopyBufferToImage_ptr) clEnqueueCopyBufferToImage_ptr = getFunction("clEnqueueCopyBufferToImage");
|
||||
return (*clEnqueueCopyBufferToImage_ptr)(command_queue, src_buffer, dst_image, src_offset, dst_origin, region, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static void * (*clEnqueueMapBuffer_ptr)(cl_command_queue, cl_mem, cl_bool, cl_map_flags, size_t, size_t, cl_uint, const cl_event *, cl_event *, cl_int *) = NULL;
|
||||
void * CL_API_CALL clEnqueueMapBuffer (cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_map,cl_map_flags map_flags,size_t offset,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int * errcode_ret) {
|
||||
if(!clEnqueueMapBuffer_ptr) clEnqueueMapBuffer_ptr = getFunction("clEnqueueMapBuffer");
|
||||
return (*clEnqueueMapBuffer_ptr)(command_queue, buffer, blocking_map, map_flags, offset, size, num_events_in_wait_list, event_wait_list, event, errcode_ret);
|
||||
}
|
||||
|
||||
static void * (*clEnqueueMapImage_ptr)(cl_command_queue, cl_mem, cl_bool, cl_map_flags, const size_t *, const size_t *, size_t *, size_t *, cl_uint, const cl_event *, cl_event *, cl_int *) = NULL;
|
||||
void * CL_API_CALL clEnqueueMapImage (cl_command_queue command_queue,cl_mem image,cl_bool blocking_map,cl_map_flags map_flags,const size_t * origin,const size_t * region,size_t * image_row_pitch,size_t * image_slice_pitch,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int * errcode_ret) {
|
||||
if(!clEnqueueMapImage_ptr) clEnqueueMapImage_ptr = getFunction("clEnqueueMapImage");
|
||||
return (*clEnqueueMapImage_ptr)(command_queue, image, blocking_map, map_flags, origin, region, image_row_pitch, image_slice_pitch, num_events_in_wait_list, event_wait_list, event, errcode_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueUnmapMemObject_ptr)(cl_command_queue, cl_mem, void *, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueUnmapMemObject (cl_command_queue command_queue,cl_mem memobj,void * mapped_ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueUnmapMemObject_ptr) clEnqueueUnmapMemObject_ptr = getFunction("clEnqueueUnmapMemObject");
|
||||
return (*clEnqueueUnmapMemObject_ptr)(command_queue, memobj, mapped_ptr, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueMigrateMemObjects_ptr)(cl_command_queue, cl_uint, const cl_mem *, cl_mem_migration_flags, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueMigrateMemObjects (cl_command_queue command_queue,cl_uint num_mem_objects,const cl_mem * mem_objects,cl_mem_migration_flags flags,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueMigrateMemObjects_ptr) clEnqueueMigrateMemObjects_ptr = getFunction("clEnqueueMigrateMemObjects");
|
||||
return (*clEnqueueMigrateMemObjects_ptr)(command_queue, num_mem_objects, mem_objects, flags, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueNDRangeKernel_ptr)(cl_command_queue, cl_kernel, cl_uint, const size_t *, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueNDRangeKernel (cl_command_queue command_queue,cl_kernel kernel,cl_uint work_dim,const size_t * global_work_offset,const size_t * global_work_size,const size_t * local_work_size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueNDRangeKernel_ptr) clEnqueueNDRangeKernel_ptr = getFunction("clEnqueueNDRangeKernel");
|
||||
return (*clEnqueueNDRangeKernel_ptr)(command_queue, kernel, work_dim, global_work_offset, global_work_size, local_work_size, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueTask_ptr)(cl_command_queue, cl_kernel, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueTask (cl_command_queue command_queue,cl_kernel kernel,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueTask_ptr) clEnqueueTask_ptr = getFunction("clEnqueueTask");
|
||||
return (*clEnqueueTask_ptr)(command_queue, kernel, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueNativeKernel_ptr)(cl_command_queue, void (CL_CALLBACK * /*user_func*/)(void *), void *, size_t, cl_uint, const cl_mem *, const void **, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueNativeKernel (cl_command_queue command_queue,void (CL_CALLBACK *user_func)(void *) ,void * args,size_t cb_args,cl_uint num_mem_objects,const cl_mem * mem_list,const void ** args_mem_loc,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueNativeKernel_ptr) clEnqueueNativeKernel_ptr = getFunction("clEnqueueNativeKernel");
|
||||
return (*clEnqueueNativeKernel_ptr)(command_queue, user_func, args, cb_args, num_mem_objects, mem_list, args_mem_loc, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueMarkerWithWaitList_ptr)(cl_command_queue, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueMarkerWithWaitList (cl_command_queue command_queue,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueMarkerWithWaitList_ptr) clEnqueueMarkerWithWaitList_ptr = getFunction("clEnqueueMarkerWithWaitList");
|
||||
return (*clEnqueueMarkerWithWaitList_ptr)(command_queue, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueBarrierWithWaitList_ptr)(cl_command_queue, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueBarrierWithWaitList (cl_command_queue command_queue,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueBarrierWithWaitList_ptr) clEnqueueBarrierWithWaitList_ptr = getFunction("clEnqueueBarrierWithWaitList");
|
||||
return (*clEnqueueBarrierWithWaitList_ptr)(command_queue, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static void * (*clGetExtensionFunctionAddressForPlatform_ptr)(cl_platform_id, const char *) = NULL;
|
||||
void * CL_API_CALL clGetExtensionFunctionAddressForPlatform (cl_platform_id platform,const char * func_name) {
|
||||
if(!clGetExtensionFunctionAddressForPlatform_ptr) clGetExtensionFunctionAddressForPlatform_ptr = getFunction("clGetExtensionFunctionAddressForPlatform");
|
||||
return (*clGetExtensionFunctionAddressForPlatform_ptr)(platform, func_name);
|
||||
}
|
||||
|
||||
static CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem (*clCreateImage2D_ptr)(cl_context, cl_mem_flags, const cl_image_format *, size_t, size_t, size_t, void *, cl_int *) = NULL;
|
||||
CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL clCreateImage2D (cl_context context,cl_mem_flags flags,const cl_image_format * image_format,size_t image_width,size_t image_height,size_t image_row_pitch,void * host_ptr,cl_int * errcode_ret) {
|
||||
if(!clCreateImage2D_ptr) clCreateImage2D_ptr = getFunction("clCreateImage2D");
|
||||
return (*clCreateImage2D_ptr)(context, flags, image_format, image_width, image_height, image_row_pitch, host_ptr, errcode_ret);
|
||||
}
|
||||
|
||||
static CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem (*clCreateImage3D_ptr)(cl_context, cl_mem_flags, const cl_image_format *, size_t, size_t, size_t, size_t, size_t, void *, cl_int *) = NULL;
|
||||
CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL clCreateImage3D (cl_context context,cl_mem_flags flags,const cl_image_format * image_format,size_t image_width,size_t image_height,size_t image_depth,size_t image_row_pitch,size_t image_slice_pitch,void * host_ptr,cl_int * errcode_ret) {
|
||||
if(!clCreateImage3D_ptr) clCreateImage3D_ptr = getFunction("clCreateImage3D");
|
||||
return (*clCreateImage3D_ptr)(context, flags, image_format, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, host_ptr, errcode_ret);
|
||||
}
|
||||
|
||||
static CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int (*clEnqueueMarker_ptr)(cl_command_queue, cl_event *) = NULL;
|
||||
CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL clEnqueueMarker (cl_command_queue command_queue,cl_event * event) {
|
||||
if(!clEnqueueMarker_ptr) clEnqueueMarker_ptr = getFunction("clEnqueueMarker");
|
||||
return (*clEnqueueMarker_ptr)(command_queue, event);
|
||||
}
|
||||
|
||||
static CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int (*clEnqueueWaitForEvents_ptr)(cl_command_queue, cl_uint, const cl_event *) = NULL;
|
||||
CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL clEnqueueWaitForEvents (cl_command_queue command_queue,cl_uint num_events,const cl_event * event_list) {
|
||||
if(!clEnqueueWaitForEvents_ptr) clEnqueueWaitForEvents_ptr = getFunction("clEnqueueWaitForEvents");
|
||||
return (*clEnqueueWaitForEvents_ptr)(command_queue, num_events, event_list);
|
||||
}
|
||||
|
||||
static CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int (*clEnqueueBarrier_ptr)(cl_command_queue) = NULL;
|
||||
CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL clEnqueueBarrier (cl_command_queue command_queue) {
|
||||
if(!clEnqueueBarrier_ptr) clEnqueueBarrier_ptr = getFunction("clEnqueueBarrier");
|
||||
return (*clEnqueueBarrier_ptr)(command_queue);
|
||||
}
|
||||
|
||||
static CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int (*clUnloadCompiler_ptr)(void) = NULL;
|
||||
CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL clUnloadCompiler (void) {
|
||||
if(!clUnloadCompiler_ptr) clUnloadCompiler_ptr = getFunction("clUnloadCompiler");
|
||||
return (*clUnloadCompiler_ptr)();
|
||||
}
|
||||
|
||||
static CL_EXT_PREFIX__VERSION_1_1_DEPRECATED void * (*clGetExtensionFunctionAddress_ptr)(const char *) = NULL;
|
||||
CL_EXT_PREFIX__VERSION_1_1_DEPRECATED void * CL_API_CALL clGetExtensionFunctionAddress (const char * func_name) {
|
||||
if(!clGetExtensionFunctionAddress_ptr) clGetExtensionFunctionAddress_ptr = getFunction("clGetExtensionFunctionAddress");
|
||||
return (*clGetExtensionFunctionAddress_ptr)(func_name);
|
||||
}
|
||||
|
28
Externals/CLRun/clrun/genclext.c
vendored
28
Externals/CLRun/clrun/genclext.c
vendored
@ -1,28 +0,0 @@
|
||||
// Automatically generated by generateClRun.pl
|
||||
#include "dynamiclib.h"
|
||||
#include "../include/CL/cl_ext.h"
|
||||
|
||||
|
||||
static cl_int (*clIcdGetPlatformIDsKHR_ptr)(cl_uint, cl_platform_id *, cl_uint *) = NULL;
|
||||
cl_int CL_API_CALL clIcdGetPlatformIDsKHR (cl_uint num_entries,cl_platform_id * platforms,cl_uint * num_platforms) {
|
||||
if(!clIcdGetPlatformIDsKHR_ptr) clIcdGetPlatformIDsKHR_ptr = getFunction("clIcdGetPlatformIDsKHR");
|
||||
return (*clIcdGetPlatformIDsKHR_ptr)(num_entries, platforms, num_platforms);
|
||||
}
|
||||
static cl_int (* clReleaseDeviceEXT_ptr)(cl_device_id) = NULL;
|
||||
cl_int CL_API_CALL clReleaseDeviceEXT (cl_device_id device) {
|
||||
if(! clReleaseDeviceEXT_ptr) clReleaseDeviceEXT_ptr = getFunction(" clReleaseDeviceEXT");
|
||||
return (* clReleaseDeviceEXT_ptr)(device);
|
||||
}
|
||||
|
||||
static cl_int (* clRetainDeviceEXT_ptr)(cl_device_id) = NULL;
|
||||
cl_int CL_API_CALL clRetainDeviceEXT (cl_device_id device) {
|
||||
if(! clRetainDeviceEXT_ptr) clRetainDeviceEXT_ptr = getFunction(" clRetainDeviceEXT");
|
||||
return (* clRetainDeviceEXT_ptr)(device);
|
||||
}
|
||||
|
||||
static cl_int (* clCreateSubDevicesEXT_ptr)(cl_device_id, const cl_device_partition_property_ext *, cl_uint, cl_device_id *, cl_uint *) = NULL;
|
||||
cl_int CL_API_CALL clCreateSubDevicesEXT (cl_device_id in_device,const cl_device_partition_property_ext * properties,cl_uint num_entries,cl_device_id * out_devices,cl_uint * num_devices) {
|
||||
if(! clCreateSubDevicesEXT_ptr) clCreateSubDevicesEXT_ptr = getFunction(" clCreateSubDevicesEXT");
|
||||
return (* clCreateSubDevicesEXT_ptr)(in_device, properties, num_entries, out_devices, num_devices);
|
||||
}
|
||||
|
64
Externals/CLRun/clrun/genclgl.c
vendored
64
Externals/CLRun/clrun/genclgl.c
vendored
@ -1,64 +0,0 @@
|
||||
// Automatically generated by generateClRun.pl
|
||||
#include "dynamiclib.h"
|
||||
#include "../include/CL/cl_gl.h"
|
||||
|
||||
|
||||
static cl_mem (*clCreateFromGLBuffer_ptr)(cl_context, cl_mem_flags, cl_GLuint, int *) = NULL;
|
||||
cl_mem CL_API_CALL clCreateFromGLBuffer (cl_context context,cl_mem_flags flags,cl_GLuint bufobj,int * errcode_ret) {
|
||||
if(!clCreateFromGLBuffer_ptr) clCreateFromGLBuffer_ptr = getFunction("clCreateFromGLBuffer");
|
||||
return (*clCreateFromGLBuffer_ptr)(context, flags, bufobj, errcode_ret);
|
||||
}
|
||||
|
||||
static cl_mem (*clCreateFromGLTexture_ptr)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int *) = NULL;
|
||||
cl_mem CL_API_CALL clCreateFromGLTexture (cl_context context,cl_mem_flags flags,cl_GLenum target,cl_GLint miplevel,cl_GLuint texture,cl_int * errcode_ret) {
|
||||
if(!clCreateFromGLTexture_ptr) clCreateFromGLTexture_ptr = getFunction("clCreateFromGLTexture");
|
||||
return (*clCreateFromGLTexture_ptr)(context, flags, target, miplevel, texture, errcode_ret);
|
||||
}
|
||||
|
||||
static cl_mem (*clCreateFromGLRenderbuffer_ptr)(cl_context, cl_mem_flags, cl_GLuint, cl_int *) = NULL;
|
||||
cl_mem CL_API_CALL clCreateFromGLRenderbuffer (cl_context context,cl_mem_flags flags,cl_GLuint renderbuffer,cl_int * errcode_ret) {
|
||||
if(!clCreateFromGLRenderbuffer_ptr) clCreateFromGLRenderbuffer_ptr = getFunction("clCreateFromGLRenderbuffer");
|
||||
return (*clCreateFromGLRenderbuffer_ptr)(context, flags, renderbuffer, errcode_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clGetGLObjectInfo_ptr)(cl_mem, cl_gl_object_type *, cl_GLuint *) = NULL;
|
||||
cl_int CL_API_CALL clGetGLObjectInfo (cl_mem memobj,cl_gl_object_type * gl_object_type,cl_GLuint * gl_object_name) {
|
||||
if(!clGetGLObjectInfo_ptr) clGetGLObjectInfo_ptr = getFunction("clGetGLObjectInfo");
|
||||
return (*clGetGLObjectInfo_ptr)(memobj, gl_object_type, gl_object_name);
|
||||
}
|
||||
|
||||
static cl_int (*clGetGLTextureInfo_ptr)(cl_mem, cl_gl_texture_info, size_t, void *, size_t *) = NULL;
|
||||
cl_int CL_API_CALL clGetGLTextureInfo (cl_mem memobj,cl_gl_texture_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) {
|
||||
if(!clGetGLTextureInfo_ptr) clGetGLTextureInfo_ptr = getFunction("clGetGLTextureInfo");
|
||||
return (*clGetGLTextureInfo_ptr)(memobj, param_name, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueAcquireGLObjects_ptr)(cl_command_queue, cl_uint, const cl_mem *, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueAcquireGLObjects (cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueAcquireGLObjects_ptr) clEnqueueAcquireGLObjects_ptr = getFunction("clEnqueueAcquireGLObjects");
|
||||
return (*clEnqueueAcquireGLObjects_ptr)(command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static cl_int (*clEnqueueReleaseGLObjects_ptr)(cl_command_queue, cl_uint, const cl_mem *, cl_uint, const cl_event *, cl_event *) = NULL;
|
||||
cl_int CL_API_CALL clEnqueueReleaseGLObjects (cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) {
|
||||
if(!clEnqueueReleaseGLObjects_ptr) clEnqueueReleaseGLObjects_ptr = getFunction("clEnqueueReleaseGLObjects");
|
||||
return (*clEnqueueReleaseGLObjects_ptr)(command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event);
|
||||
}
|
||||
|
||||
static CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem (*clCreateFromGLTexture2D_ptr)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int *) = NULL;
|
||||
CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL clCreateFromGLTexture2D (cl_context context,cl_mem_flags flags,cl_GLenum target,cl_GLint miplevel,cl_GLuint texture,cl_int * errcode_ret) {
|
||||
if(!clCreateFromGLTexture2D_ptr) clCreateFromGLTexture2D_ptr = getFunction("clCreateFromGLTexture2D");
|
||||
return (*clCreateFromGLTexture2D_ptr)(context, flags, target, miplevel, texture, errcode_ret);
|
||||
}
|
||||
|
||||
static CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem (*clCreateFromGLTexture3D_ptr)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int *) = NULL;
|
||||
CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL clCreateFromGLTexture3D (cl_context context,cl_mem_flags flags,cl_GLenum target,cl_GLint miplevel,cl_GLuint texture,cl_int * errcode_ret) {
|
||||
if(!clCreateFromGLTexture3D_ptr) clCreateFromGLTexture3D_ptr = getFunction("clCreateFromGLTexture3D");
|
||||
return (*clCreateFromGLTexture3D_ptr)(context, flags, target, miplevel, texture, errcode_ret);
|
||||
}
|
||||
|
||||
static cl_int (*clGetGLContextInfoKHR_ptr)(const cl_context_properties *, cl_gl_context_info, size_t, void *, size_t *) = NULL;
|
||||
cl_int CL_API_CALL clGetGLContextInfoKHR (const cl_context_properties * properties,cl_gl_context_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) {
|
||||
if(!clGetGLContextInfoKHR_ptr) clGetGLContextInfoKHR_ptr = getFunction("clGetGLContextInfoKHR");
|
||||
return (*clGetGLContextInfoKHR_ptr)(properties, param_name, param_value_size, param_value, param_value_size_ret);
|
||||
}
|
11
Externals/CLRun/clrun/genclglext.c
vendored
11
Externals/CLRun/clrun/genclglext.c
vendored
@ -1,11 +0,0 @@
|
||||
// Automatically generated by generateClRun.pl
|
||||
#include "dynamiclib.h"
|
||||
#include "../include/CL/cl_gl_ext.h"
|
||||
|
||||
|
||||
static cl_event (*clCreateEventFromGLsyncKHR_ptr)(cl_context, cl_GLsync, cl_int *) = NULL;
|
||||
cl_event CL_API_CALL clCreateEventFromGLsyncKHR (cl_context context,cl_GLsync cl_GLsync,cl_int * errcode_ret) {
|
||||
if(!clCreateEventFromGLsyncKHR_ptr) clCreateEventFromGLsyncKHR_ptr = getFunction("clCreateEventFromGLsyncKHR");
|
||||
return (*clCreateEventFromGLsyncKHR_ptr)(context, cl_GLsync, errcode_ret);
|
||||
}
|
||||
|
96
Externals/CLRun/clrun/generateClRun.pl
vendored
96
Externals/CLRun/clrun/generateClRun.pl
vendored
@ -1,96 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
|
||||
sub trim($)
|
||||
{
|
||||
my $string = shift;
|
||||
$string =~ s/^\s+//;
|
||||
$string =~ s/\s+$//;
|
||||
return $string;
|
||||
}
|
||||
|
||||
my $filename = shift;
|
||||
|
||||
open(CL, "<$filename") or die "Can't open cl.h";
|
||||
|
||||
my ($funcRet, $funcName, $args);
|
||||
|
||||
print "// Automatically generated by generateClRun.pl\n";
|
||||
print "#include \"dynamiclib.h\"\n";
|
||||
print "#include \"$filename\"\n\n\n";
|
||||
|
||||
while(<CL>) {
|
||||
chomp;
|
||||
next unless $_ =~ /CL_API_ENTRY\s*(.*)\s*CL_API_CALL/;
|
||||
$funcRet = $1;
|
||||
my $fa = "";
|
||||
my $noArgs = 0;
|
||||
while(<CL>) {
|
||||
$fa .= $_;
|
||||
last if $_ =~ /;$/;
|
||||
}
|
||||
|
||||
chomp $fa;
|
||||
$fa =~ s/\s*\).*;\s*$/\)/g; # remove api
|
||||
$fa =~ /([^(]*)\((.*)\)/s;
|
||||
$funcName = $1;
|
||||
$args = $2;
|
||||
|
||||
# split params by , (ignoring function pointers)
|
||||
(my @args) = $args =~ m/([^(,]*(?:\([^)]+\)[^(),]*)*[^),]*),?/g;
|
||||
|
||||
my (@argsTypes, @argsNames);
|
||||
|
||||
my $funcArgSig = "";
|
||||
my $tmp;
|
||||
foreach my $arg (@args) {
|
||||
|
||||
next if ($arg eq "");
|
||||
my ($type, $name) = $arg =~ m|\s*(.*)\s*/\*\s*(.*)\s*\*/|s;
|
||||
|
||||
# Strip []
|
||||
if(defined $name) {
|
||||
$name =~ s/\[.*\]//g;
|
||||
}
|
||||
|
||||
if ($arg =~ /\(.*\)/) {
|
||||
$tmp = $type;
|
||||
$type =~ s/\(\*.*?\)/\(\*\)/g
|
||||
}
|
||||
|
||||
push @argsTypes, trim($type);
|
||||
push @argsNames, trim($name);
|
||||
|
||||
if ($arg =~ /\(.*\)/) {
|
||||
$funcArgSig .= "$tmp,";
|
||||
} elsif(defined $type) {
|
||||
$funcArgSig .= trim($type)." ".trim($name).",";
|
||||
} else { # Functions with no arguments (i.e. "void" only)
|
||||
$funcArgSig = "void,";
|
||||
$noArgs = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
chop($funcArgSig); #last ,
|
||||
|
||||
my ($funcArgsNames, $funcArgsTypes);
|
||||
|
||||
if($noArgs eq 0) {
|
||||
$funcArgsNames = ($#argsNames != -1)? join ', ',@argsNames : "";
|
||||
$funcArgsTypes = ($#argsTypes != -1)? join ', ',@argsTypes : "";
|
||||
} else {
|
||||
$funcArgsNames = "";
|
||||
$funcArgsTypes = "void";
|
||||
}
|
||||
|
||||
my $func = "${funcName}_ptr";
|
||||
$args =~ s$(/\*|\*/)$$g; # uncomment names
|
||||
print "static ".trim($funcRet)." (*$func)($funcArgsTypes) = NULL;\n";
|
||||
print trim($funcRet)." CL_API_CALL $funcName ($funcArgSig) {\n";
|
||||
print "\tif(!$func) $func = getFunction(\"$funcName\");\n";
|
||||
print "\treturn (*$func)($funcArgsNames);\n";
|
||||
print "}\n\n";
|
||||
}
|
||||
|
||||
close(CL);
|
1214
Externals/CLRun/include/CL/cl.h
vendored
1214
Externals/CLRun/include/CL/cl.h
vendored
File diff suppressed because it is too large
Load Diff
126
Externals/CLRun/include/CL/cl_d3d10.h
vendored
126
Externals/CLRun/include/CL/cl_d3d10.h
vendored
@ -1,126 +0,0 @@
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2012 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
#ifndef __OPENCL_CL_D3D10_H
|
||||
#define __OPENCL_CL_D3D10_H
|
||||
|
||||
#include <d3d10.h>
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_platform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* cl_khr_d3d10_sharing */
|
||||
#define cl_khr_d3d10_sharing 1
|
||||
|
||||
typedef cl_uint cl_d3d10_device_source_khr;
|
||||
typedef cl_uint cl_d3d10_device_set_khr;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
// Error Codes
|
||||
#define CL_INVALID_D3D10_DEVICE_KHR -1002
|
||||
#define CL_INVALID_D3D10_RESOURCE_KHR -1003
|
||||
#define CL_D3D10_RESOURCE_ALREADY_ACQUIRED_KHR -1004
|
||||
#define CL_D3D10_RESOURCE_NOT_ACQUIRED_KHR -1005
|
||||
|
||||
// cl_d3d10_device_source_nv
|
||||
#define CL_D3D10_DEVICE_KHR 0x4010
|
||||
#define CL_D3D10_DXGI_ADAPTER_KHR 0x4011
|
||||
|
||||
// cl_d3d10_device_set_nv
|
||||
#define CL_PREFERRED_DEVICES_FOR_D3D10_KHR 0x4012
|
||||
#define CL_ALL_DEVICES_FOR_D3D10_KHR 0x4013
|
||||
|
||||
// cl_context_info
|
||||
#define CL_CONTEXT_D3D10_DEVICE_KHR 0x4014
|
||||
#define CL_CONTEXT_D3D10_PREFER_SHARED_RESOURCES_KHR 0x402C
|
||||
|
||||
// cl_mem_info
|
||||
#define CL_MEM_D3D10_RESOURCE_KHR 0x4015
|
||||
|
||||
// cl_image_info
|
||||
#define CL_IMAGE_D3D10_SUBRESOURCE_KHR 0x4016
|
||||
|
||||
// cl_command_type
|
||||
#define CL_COMMAND_ACQUIRE_D3D10_OBJECTS_KHR 0x4017
|
||||
#define CL_COMMAND_RELEASE_D3D10_OBJECTS_KHR 0x4018
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromD3D10KHR_fn)(
|
||||
cl_platform_id platform,
|
||||
cl_d3d10_device_source_khr d3d_device_source,
|
||||
void * d3d_object,
|
||||
cl_d3d10_device_set_khr d3d_device_set,
|
||||
cl_uint num_entries,
|
||||
cl_device_id * devices,
|
||||
cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10BufferKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D10Buffer * resource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10Texture2DKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D10Texture2D * resource,
|
||||
UINT subresource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10Texture3DKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D10Texture3D * resource,
|
||||
UINT subresource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireD3D10ObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseD3D10ObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __OPENCL_CL_D3D10_H
|
||||
|
126
Externals/CLRun/include/CL/cl_d3d11.h
vendored
126
Externals/CLRun/include/CL/cl_d3d11.h
vendored
@ -1,126 +0,0 @@
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2012 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
#ifndef __OPENCL_CL_D3D11_H
|
||||
#define __OPENCL_CL_D3D11_H
|
||||
|
||||
#include <d3d11.h>
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_platform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* cl_khr_d3d11_sharing */
|
||||
#define cl_khr_d3d11_sharing 1
|
||||
|
||||
typedef cl_uint cl_d3d11_device_source_khr;
|
||||
typedef cl_uint cl_d3d11_device_set_khr;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
// Error Codes
|
||||
#define CL_INVALID_D3D11_DEVICE_KHR -1006
|
||||
#define CL_INVALID_D3D11_RESOURCE_KHR -1007
|
||||
#define CL_D3D11_RESOURCE_ALREADY_ACQUIRED_KHR -1008
|
||||
#define CL_D3D11_RESOURCE_NOT_ACQUIRED_KHR -1009
|
||||
|
||||
// cl_d3d11_device_source
|
||||
#define CL_D3D11_DEVICE_KHR 0x4019
|
||||
#define CL_D3D11_DXGI_ADAPTER_KHR 0x401A
|
||||
|
||||
// cl_d3d11_device_set
|
||||
#define CL_PREFERRED_DEVICES_FOR_D3D11_KHR 0x401B
|
||||
#define CL_ALL_DEVICES_FOR_D3D11_KHR 0x401C
|
||||
|
||||
// cl_context_info
|
||||
#define CL_CONTEXT_D3D11_DEVICE_KHR 0x401D
|
||||
#define CL_CONTEXT_D3D11_PREFER_SHARED_RESOURCES_KHR 0x402D
|
||||
|
||||
// cl_mem_info
|
||||
#define CL_MEM_D3D11_RESOURCE_KHR 0x401E
|
||||
|
||||
// cl_image_info
|
||||
#define CL_IMAGE_D3D11_SUBRESOURCE_KHR 0x401F
|
||||
|
||||
// cl_command_type
|
||||
#define CL_COMMAND_ACQUIRE_D3D11_OBJECTS_KHR 0x4020
|
||||
#define CL_COMMAND_RELEASE_D3D11_OBJECTS_KHR 0x4021
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromD3D11KHR_fn)(
|
||||
cl_platform_id platform,
|
||||
cl_d3d11_device_source_khr d3d_device_source,
|
||||
void * d3d_object,
|
||||
cl_d3d11_device_set_khr d3d_device_set,
|
||||
cl_uint num_entries,
|
||||
cl_device_id * devices,
|
||||
cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11BufferKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D11Buffer * resource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11Texture2DKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D11Texture2D * resource,
|
||||
UINT subresource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11Texture3DKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D11Texture3D * resource,
|
||||
UINT subresource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireD3D11ObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseD3D11ObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __OPENCL_CL_D3D11_H
|
||||
|
127
Externals/CLRun/include/CL/cl_dx9_media_sharing.h
vendored
127
Externals/CLRun/include/CL/cl_dx9_media_sharing.h
vendored
@ -1,127 +0,0 @@
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2012 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
#ifndef __OPENCL_CL_DX9_MEDIA_SHARING_H
|
||||
#define __OPENCL_CL_DX9_MEDIA_SHARING_H
|
||||
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_platform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
/* cl_khr_dx9_media_sharing */
|
||||
#define cl_khr_dx9_media_sharing 1
|
||||
|
||||
typedef cl_uint cl_dx9_media_adapter_type_khr;
|
||||
typedef cl_uint cl_dx9_media_adapter_set_khr;
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <d3d9.h>
|
||||
typedef struct _cl_dx9_surface_info_khr
|
||||
{
|
||||
IDirect3DSurface9 *resource;
|
||||
HANDLE shared_handle;
|
||||
} cl_dx9_surface_info_khr;
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
// Error Codes
|
||||
#define CL_INVALID_DX9_MEDIA_ADAPTER_KHR -1010
|
||||
#define CL_INVALID_DX9_MEDIA_SURFACE_KHR -1011
|
||||
#define CL_DX9_MEDIA_SURFACE_ALREADY_ACQUIRED_KHR -1012
|
||||
#define CL_DX9_MEDIA_SURFACE_NOT_ACQUIRED_KHR -1013
|
||||
|
||||
// cl_media_adapter_type_khr
|
||||
#define CL_ADAPTER_D3D9_KHR 0x2020
|
||||
#define CL_ADAPTER_D3D9EX_KHR 0x2021
|
||||
#define CL_ADAPTER_DXVA_KHR 0x2022
|
||||
|
||||
// cl_media_adapter_set_khr
|
||||
#define CL_PREFERRED_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2023
|
||||
#define CL_ALL_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2024
|
||||
|
||||
// cl_context_info
|
||||
#define CL_CONTEXT_ADAPTER_D3D9_KHR 0x2025
|
||||
#define CL_CONTEXT_ADAPTER_D3D9EX_KHR 0x2026
|
||||
#define CL_CONTEXT_ADAPTER_DXVA_KHR 0x2027
|
||||
|
||||
// cl_mem_info
|
||||
#define CL_MEM_DX9_MEDIA_ADAPTER_TYPE_KHR 0x2028
|
||||
#define CL_MEM_DX9_MEDIA_SURFACE_INFO_KHR 0x2029
|
||||
|
||||
// cl_image_info
|
||||
#define CL_IMAGE_DX9_MEDIA_PLANE_KHR 0x202A
|
||||
|
||||
// cl_command_type
|
||||
#define CL_COMMAND_ACQUIRE_DX9_MEDIA_SURFACES_KHR 0x202B
|
||||
#define CL_COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR 0x202C
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromDX9MediaAdapterKHR_fn)(
|
||||
cl_platform_id platform,
|
||||
cl_uint num_media_adapters,
|
||||
cl_dx9_media_adapter_type_khr * media_adapter_type,
|
||||
void * media_adapters,
|
||||
cl_dx9_media_adapter_set_khr media_adapter_set,
|
||||
cl_uint num_entries,
|
||||
cl_device_id * devices,
|
||||
cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromDX9MediaSurfaceKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
cl_dx9_media_adapter_type_khr adapter_type,
|
||||
void * surface_info,
|
||||
cl_uint plane,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireDX9MediaSurfacesKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseDX9MediaSurfacesKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __OPENCL_CL_DX9_MEDIA_SHARING_H
|
||||
|
251
Externals/CLRun/include/CL/cl_ext.h
vendored
251
Externals/CLRun/include/CL/cl_ext.h
vendored
@ -1,251 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2008 - 2012 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
******************************************************************************/
|
||||
|
||||
/* $Revision: 11928 $ on $Date: 2010-07-13 09:04:56 -0700 (Tue, 13 Jul 2010) $ */
|
||||
|
||||
/* cl_ext.h contains OpenCL extensions which don't have external */
|
||||
/* (OpenGL, D3D) dependencies. */
|
||||
|
||||
#ifndef __CL_EXT_H
|
||||
#define __CL_EXT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl.h>
|
||||
#include <AvailabilityMacros.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
/* cl_khr_fp16 extension - no extension #define since it has no functions */
|
||||
#define CL_DEVICE_HALF_FP_CONFIG 0x1033
|
||||
|
||||
/* Memory object destruction
|
||||
*
|
||||
* Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR
|
||||
*
|
||||
* Registers a user callback function that will be called when the memory object is deleted and its resources
|
||||
* freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback
|
||||
* stack associated with memobj. The registered user callback functions are called in the reverse order in
|
||||
* which they were registered. The user callback functions are called and then the memory object is deleted
|
||||
* and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be
|
||||
* notified when the memory referenced by host_ptr, specified when the memory object is created and used as
|
||||
* the storage bits for the memory object, can be reused or freed.
|
||||
*
|
||||
* The application may not call CL api's with the cl_mem object passed to the pfn_notify.
|
||||
*
|
||||
* Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
|
||||
* before using.
|
||||
*/
|
||||
#define cl_APPLE_SetMemObjectDestructor 1
|
||||
cl_int CL_API_ENTRY clSetMemObjectDestructorAPPLE( cl_mem /* memobj */,
|
||||
void (* /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/),
|
||||
void * /*user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
|
||||
/* Context Logging Functions
|
||||
*
|
||||
* The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext().
|
||||
* Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
|
||||
* before using.
|
||||
*
|
||||
* clLogMessagesToSystemLog fowards on all log messages to the Apple System Logger
|
||||
*/
|
||||
#define cl_APPLE_ContextLoggingFunctions 1
|
||||
extern void CL_API_ENTRY clLogMessagesToSystemLogAPPLE( const char * /* errstr */,
|
||||
const void * /* private_info */,
|
||||
size_t /* cb */,
|
||||
void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* clLogMessagesToStdout sends all log messages to the file descriptor stdout */
|
||||
extern void CL_API_ENTRY clLogMessagesToStdoutAPPLE( const char * /* errstr */,
|
||||
const void * /* private_info */,
|
||||
size_t /* cb */,
|
||||
void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* clLogMessagesToStderr sends all log messages to the file descriptor stderr */
|
||||
extern void CL_API_ENTRY clLogMessagesToStderrAPPLE( const char * /* errstr */,
|
||||
const void * /* private_info */,
|
||||
size_t /* cb */,
|
||||
void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
|
||||
/************************
|
||||
* cl_khr_icd extension *
|
||||
************************/
|
||||
#define cl_khr_icd 1
|
||||
|
||||
/* cl_platform_info */
|
||||
#define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920
|
||||
|
||||
/* Additional Error Codes */
|
||||
#define CL_PLATFORM_NOT_FOUND_KHR -1001
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clIcdGetPlatformIDsKHR(cl_uint /* num_entries */,
|
||||
cl_platform_id * /* platforms */,
|
||||
cl_uint * /* num_platforms */);
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clIcdGetPlatformIDsKHR_fn)(
|
||||
cl_uint /* num_entries */,
|
||||
cl_platform_id * /* platforms */,
|
||||
cl_uint * /* num_platforms */);
|
||||
|
||||
|
||||
/* Extension: cl_khr_image2D_buffer
|
||||
*
|
||||
* This extension allows a 2D image to be created from a cl_mem buffer without a copy.
|
||||
* The type associated with a 2D image created from a buffer in an OpenCL program is image2d_t.
|
||||
* Both the sampler and sampler-less read_image built-in functions are supported for 2D images
|
||||
* and 2D images created from a buffer. Similarly, the write_image built-ins are also supported
|
||||
* for 2D images created from a buffer.
|
||||
*
|
||||
* When the 2D image from buffer is created, the client must specify the width,
|
||||
* height, image format (i.e. channel order and channel data type) and optionally the row pitch
|
||||
*
|
||||
* The pitch specified must be a multiple of CL_DEVICE_IMAGE_PITCH_ALIGNMENT pixels.
|
||||
* The base address of the buffer must be aligned to CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT pixels.
|
||||
*/
|
||||
|
||||
/*************************************
|
||||
* cl_khr_initalize_memory extension *
|
||||
*************************************/
|
||||
|
||||
#define CL_CONTEXT_MEMORY_INITIALIZE_KHR 0x200E
|
||||
|
||||
|
||||
/**************************************
|
||||
* cl_khr_terminate_context extension *
|
||||
**************************************/
|
||||
|
||||
#define CL_DEVICE_TERMINATE_CAPABILITY_KHR 0x200F
|
||||
#define CL_CONTEXT_TERMINATE_KHR 0x2010
|
||||
|
||||
#define cl_khr_terminate_context 1
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL clTerminateContextKHR(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clTerminateContextKHR_fn)(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2;
|
||||
|
||||
|
||||
/*
|
||||
* Extension: cl_khr_spir
|
||||
*
|
||||
* This extension adds support to create an OpenCL program object from a
|
||||
* Standard Portable Intermediate Representation (SPIR) instance
|
||||
*/
|
||||
|
||||
/******************************************
|
||||
* cl_nv_device_attribute_query extension *
|
||||
******************************************/
|
||||
/* cl_nv_device_attribute_query extension - no extension #define since it has no functions */
|
||||
#define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
|
||||
#define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
|
||||
#define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002
|
||||
#define CL_DEVICE_WARP_SIZE_NV 0x4003
|
||||
#define CL_DEVICE_GPU_OVERLAP_NV 0x4004
|
||||
#define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
|
||||
#define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006
|
||||
|
||||
|
||||
/*********************************
|
||||
* cl_amd_device_attribute_query *
|
||||
*********************************/
|
||||
#define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036
|
||||
|
||||
#ifdef CL_VERSION_1_1
|
||||
/***********************************
|
||||
* cl_ext_device_fission extension *
|
||||
***********************************/
|
||||
#define cl_ext_device_fission 1
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clReleaseDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clRetainDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef cl_ulong cl_device_partition_property_ext;
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clCreateSubDevicesEXT( cl_device_id /*in_device*/,
|
||||
const cl_device_partition_property_ext * /* properties */,
|
||||
cl_uint /*num_entries*/,
|
||||
cl_device_id * /*out_devices*/,
|
||||
cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
( CL_API_CALL * clCreateSubDevicesEXT_fn)( cl_device_id /*in_device*/,
|
||||
const cl_device_partition_property_ext * /* properties */,
|
||||
cl_uint /*num_entries*/,
|
||||
cl_device_id * /*out_devices*/,
|
||||
cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
/* cl_device_partition_property_ext */
|
||||
#define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050
|
||||
#define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051
|
||||
#define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052
|
||||
#define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053
|
||||
|
||||
/* clDeviceGetInfo selectors */
|
||||
#define CL_DEVICE_PARENT_DEVICE_EXT 0x4054
|
||||
#define CL_DEVICE_PARTITION_TYPES_EXT 0x4055
|
||||
#define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056
|
||||
#define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057
|
||||
#define CL_DEVICE_PARTITION_STYLE_EXT 0x4058
|
||||
|
||||
/* error codes */
|
||||
#define CL_DEVICE_PARTITION_FAILED_EXT -1057
|
||||
#define CL_INVALID_PARTITION_COUNT_EXT -1058
|
||||
#define CL_INVALID_PARTITION_NAME_EXT -1059
|
||||
|
||||
/* CL_AFFINITY_DOMAINs */
|
||||
#define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1
|
||||
#define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2
|
||||
#define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3
|
||||
#define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4
|
||||
#define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10
|
||||
#define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100
|
||||
|
||||
/* cl_device_partition_property_ext list terminators */
|
||||
#define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext) 0)
|
||||
#define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext) 0)
|
||||
#define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext) 0 - 1)
|
||||
|
||||
|
||||
|
||||
#endif /* CL_VERSION_1_1 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __CL_EXT_H */
|
162
Externals/CLRun/include/CL/cl_gl.h
vendored
162
Externals/CLRun/include/CL/cl_gl.h
vendored
@ -1,162 +0,0 @@
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008 - 2012 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
#ifndef __OPENCL_CL_GL_H
|
||||
#define __OPENCL_CL_GL_H
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef cl_uint cl_gl_object_type;
|
||||
typedef cl_uint cl_gl_texture_info;
|
||||
typedef cl_uint cl_gl_platform_info;
|
||||
typedef struct __GLsync *cl_GLsync;
|
||||
|
||||
/* cl_gl_object_type = 0x2000 - 0x200F enum values are currently taken */
|
||||
#define CL_GL_OBJECT_BUFFER 0x2000
|
||||
#define CL_GL_OBJECT_TEXTURE2D 0x2001
|
||||
#define CL_GL_OBJECT_TEXTURE3D 0x2002
|
||||
#define CL_GL_OBJECT_RENDERBUFFER 0x2003
|
||||
#define CL_GL_OBJECT_TEXTURE2D_ARRAY 0x200E
|
||||
#define CL_GL_OBJECT_TEXTURE1D 0x200F
|
||||
#define CL_GL_OBJECT_TEXTURE1D_ARRAY 0x2010
|
||||
#define CL_GL_OBJECT_TEXTURE_BUFFER 0x2011
|
||||
|
||||
/* cl_gl_texture_info */
|
||||
#define CL_GL_TEXTURE_TARGET 0x2004
|
||||
#define CL_GL_MIPMAP_LEVEL 0x2005
|
||||
#define CL_GL_NUM_SAMPLES 0x2012
|
||||
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateFromGLBuffer(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLuint /* bufobj */,
|
||||
int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateFromGLTexture(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLenum /* target */,
|
||||
cl_GLint /* miplevel */,
|
||||
cl_GLuint /* texture */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateFromGLRenderbuffer(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLuint /* renderbuffer */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetGLObjectInfo(cl_mem /* memobj */,
|
||||
cl_gl_object_type * /* gl_object_type */,
|
||||
cl_GLuint * /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetGLTextureInfo(cl_mem /* memobj */,
|
||||
cl_gl_texture_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueAcquireGLObjects(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_objects */,
|
||||
const cl_mem * /* mem_objects */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueReleaseGLObjects(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_objects */,
|
||||
const cl_mem * /* mem_objects */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
|
||||
// Deprecated OpenCL 1.1 APIs
|
||||
extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL
|
||||
clCreateFromGLTexture2D(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLenum /* target */,
|
||||
cl_GLint /* miplevel */,
|
||||
cl_GLuint /* texture */,
|
||||
cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
|
||||
|
||||
extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL
|
||||
clCreateFromGLTexture3D(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLenum /* target */,
|
||||
cl_GLint /* miplevel */,
|
||||
cl_GLuint /* texture */,
|
||||
cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
|
||||
|
||||
/* cl_khr_gl_sharing extension */
|
||||
|
||||
#define cl_khr_gl_sharing 1
|
||||
|
||||
typedef cl_uint cl_gl_context_info;
|
||||
|
||||
/* Additional Error Codes */
|
||||
#define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000
|
||||
|
||||
/* cl_gl_context_info */
|
||||
#define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006
|
||||
#define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007
|
||||
|
||||
/* Additional cl_context_properties */
|
||||
#define CL_GL_CONTEXT_KHR 0x2008
|
||||
#define CL_EGL_DISPLAY_KHR 0x2009
|
||||
#define CL_GLX_DISPLAY_KHR 0x200A
|
||||
#define CL_WGL_HDC_KHR 0x200B
|
||||
#define CL_CGL_SHAREGROUP_KHR 0x200C
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetGLContextInfoKHR(const cl_context_properties * /* properties */,
|
||||
cl_gl_context_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)(
|
||||
const cl_context_properties * properties,
|
||||
cl_gl_context_info param_name,
|
||||
size_t param_value_size,
|
||||
void * param_value,
|
||||
size_t * param_value_size_ret);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_GL_H */
|
69
Externals/CLRun/include/CL/cl_gl_ext.h
vendored
69
Externals/CLRun/include/CL/cl_gl_ext.h
vendored
@ -1,69 +0,0 @@
|
||||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2012 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
/* cl_gl_ext.h contains vendor (non-KHR) OpenCL extensions which have */
|
||||
/* OpenGL dependencies. */
|
||||
|
||||
#ifndef __OPENCL_CL_GL_EXT_H
|
||||
#define __OPENCL_CL_GL_EXT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl_gl.h>
|
||||
#else
|
||||
#include <CL/cl_gl.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* For each extension, follow this template
|
||||
* cl_VEN_extname extension */
|
||||
/* #define cl_VEN_extname 1
|
||||
* ... define new types, if any
|
||||
* ... define new tokens, if any
|
||||
* ... define new APIs, if any
|
||||
*
|
||||
* If you need GLtypes here, mirror them with a cl_GLtype, rather than including a GL header
|
||||
* This allows us to avoid having to decide whether to include GL headers or GLES here.
|
||||
*/
|
||||
|
||||
/*
|
||||
* cl_khr_gl_event extension
|
||||
* See section 9.9 in the OpenCL 1.1 spec for more information
|
||||
*/
|
||||
#define CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR 0x200D
|
||||
|
||||
extern CL_API_ENTRY cl_event CL_API_CALL
|
||||
clCreateEventFromGLsyncKHR(cl_context /* context */,
|
||||
cl_GLsync /* cl_GLsync */,
|
||||
cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_GL_EXT_H */
|
1254
Externals/CLRun/include/CL/cl_platform.h
vendored
1254
Externals/CLRun/include/CL/cl_platform.h
vendored
File diff suppressed because it is too large
Load Diff
25
Externals/CLRun/include/clrun.h
vendored
25
Externals/CLRun/include/clrun.h
vendored
@ -1,25 +0,0 @@
|
||||
#ifndef __CLRUN_H
|
||||
#define __CLRUN_H
|
||||
|
||||
/*#ifdef _WIN32
|
||||
#ifdef CLRUN_COMPILE
|
||||
#define EXPORTED __declspec(dllexport)
|
||||
#else
|
||||
#define EXPORTED __declspec(dllimport)
|
||||
#endif
|
||||
#else*/
|
||||
#define EXPORTED
|
||||
//#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern EXPORTED int clrInit();
|
||||
extern EXPORTED int clrHasOpenCL();
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
@ -65,7 +65,6 @@
|
||||
#define SHADERCACHE_DIR "ShaderCache"
|
||||
#define STATESAVES_DIR "StateSaves"
|
||||
#define SCREENSHOTS_DIR "ScreenShots"
|
||||
#define OPENCL_DIR "OpenCL"
|
||||
#define LOAD_DIR "Load"
|
||||
#define HIRES_TEXTURES_DIR LOAD_DIR DIR_SEP "Textures"
|
||||
#define DUMP_DIR "Dump"
|
||||
|
@ -814,7 +814,6 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new
|
||||
paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP;
|
||||
paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP;
|
||||
paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP;
|
||||
paths[D_OPENCL_IDX] = paths[D_USER_IDX] + OPENCL_DIR DIR_SEP;
|
||||
paths[D_HIRESTEXTURES_IDX] = paths[D_USER_IDX] + HIRES_TEXTURES_DIR DIR_SEP;
|
||||
paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP;
|
||||
paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP;
|
||||
@ -869,7 +868,6 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new
|
||||
paths[D_SHADERS_IDX] = paths[D_USER_IDX] + SHADERS_DIR DIR_SEP;
|
||||
paths[D_STATESAVES_IDX] = paths[D_USER_IDX] + STATESAVES_DIR DIR_SEP;
|
||||
paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP;
|
||||
paths[D_OPENCL_IDX] = paths[D_USER_IDX] + OPENCL_DIR DIR_SEP;
|
||||
paths[D_HIRESTEXTURES_IDX] = paths[D_USER_IDX] + HIRES_TEXTURES_DIR DIR_SEP;
|
||||
paths[D_DUMP_IDX] = paths[D_USER_IDX] + DUMP_DIR DIR_SEP;
|
||||
paths[D_DUMPFRAMES_IDX] = paths[D_DUMP_IDX] + DUMP_FRAMES_DIR DIR_SEP;
|
||||
|
@ -29,7 +29,6 @@ enum {
|
||||
D_SHADERS_IDX,
|
||||
D_STATESAVES_IDX,
|
||||
D_SCREENSHOTS_IDX,
|
||||
D_OPENCL_IDX,
|
||||
D_HIRESTEXTURES_IDX,
|
||||
D_DUMP_IDX,
|
||||
D_DUMPFRAMES_IDX,
|
||||
|
@ -171,9 +171,6 @@
|
||||
<ProjectReference Include="..\..\..\Externals\Bochs_disasm\Bochs_disasm.vcxproj">
|
||||
<Project>{8ada04d7-6db1-4da4-ab55-64fb12a0997b}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Externals\CLRun\clrun\CLRun.vcxproj">
|
||||
<Project>{aa862e5e-a993-497a-b6a0-0e8e94b10050}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Externals\libpng\png\png.vcxproj">
|
||||
<Project>{4c9f135b-a85e-430c-bad4-4c67ef5fc12c}</Project>
|
||||
</ProjectReference>
|
||||
@ -241,4 +238,4 @@
|
||||
<Message Text="Copy: @(BinaryFiles) -> $(BinaryOutputDir)" Importance="High" />
|
||||
<Copy SourceFiles="@(BinaryFiles)" DestinationFolder="$(BinaryOutputDir)" />
|
||||
</Target>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -126,7 +126,6 @@ private:
|
||||
wxCheckBox* UseFPSForLimiting;
|
||||
|
||||
// Advanced
|
||||
wxCheckBox* EnableOpenCL;
|
||||
wxRadioBox* CPUEngine;
|
||||
wxCheckBox* DSPThread;
|
||||
wxCheckBox* _NTSCJ;
|
||||
|
@ -266,7 +266,6 @@ bool DolphinApp::OnInit()
|
||||
File::CreateFullPath(File::GetUserPath(D_HIRESTEXTURES_IDX));
|
||||
File::CreateFullPath(File::GetUserPath(D_MAILLOGS_IDX));
|
||||
File::CreateFullPath(File::GetUserPath(D_MAPS_IDX));
|
||||
File::CreateFullPath(File::GetUserPath(D_OPENCL_IDX));
|
||||
File::CreateFullPath(File::GetUserPath(D_SCREENSHOTS_IDX));
|
||||
File::CreateFullPath(File::GetUserPath(D_SHADERS_IDX));
|
||||
File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX));
|
||||
|
@ -118,7 +118,6 @@ wxString use_ffv1_desc = wxTRANSLATE("Encode frame dumps using the FFV1 codec.\n
|
||||
#endif
|
||||
wxString free_look_desc = wxTRANSLATE("This feature allows you to change the game's camera.\nMove the mouse while holding the right mouse button to pan and while holding the middle button to move.\nHold SHIFT and press one of the WASD keys to move the camera by a certain step distance (SHIFT+0 to move faster and SHIFT+9 to move slower). Press SHIFT+R to reset the camera.\n\nIf unsure, leave this unchecked.");
|
||||
wxString crop_desc = wxTRANSLATE("Crop the picture from 4:3 to 5:4 or from 16:9 to 16:10.\n\nIf unsure, leave this unchecked.");
|
||||
wxString opencl_desc = wxTRANSLATE("[EXPERIMENTAL]\nAims to speed up emulation by offloading texture decoding to the GPU using the OpenCL framework.\nHowever, right now it's known to cause texture defects in various games. Also it's slower than regular CPU texture decoding in most cases.\n\nIf unsure, leave this unchecked.");
|
||||
wxString dlc_desc = wxTRANSLATE("[EXPERIMENTAL]\nSpeeds up emulation a bit by caching display lists.\nPossibly causes issues though.\n\nIf unsure, leave this unchecked.");
|
||||
wxString omp_desc = wxTRANSLATE("Use multiple threads to decode textures.\nMight result in a speedup (especially on CPUs with more than two cores).\n\nIf unsure, leave this unchecked.");
|
||||
wxString ppshader_desc = wxTRANSLATE("Apply a post-processing effect after finishing a frame.\n\nIf unsure, select (off).");
|
||||
@ -499,7 +498,6 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
|
||||
wxGridSizer* const szr_other = new wxGridSizer(2, 5, 5);
|
||||
szr_other->Add(CreateCheckBox(page_hacks, _("Cache Display Lists"), wxGetTranslation(dlc_desc), vconfig.bDlistCachingEnable));
|
||||
szr_other->Add(CreateCheckBox(page_hacks, _("Disable Destination Alpha"), wxGetTranslation(disable_dstalpha_desc), vconfig.bDstAlphaPass));
|
||||
szr_other->Add(CreateCheckBox(page_hacks, _("OpenCL Texture Decoder"), wxGetTranslation(opencl_desc), vconfig.bEnableOpenCL));
|
||||
szr_other->Add(CreateCheckBox(page_hacks, _("OpenMP Texture Decoder"), wxGetTranslation(omp_desc), vconfig.bOMPDecoder));
|
||||
szr_other->Add(CreateCheckBox(page_hacks, _("Fast Depth Calculation"), wxGetTranslation(fast_depth_calc_desc), vconfig.bFastDepthCalc));
|
||||
szr_other->Add(hacked_buffer_upload = CreateCheckBox(page_hacks, _("Vertex Streaming Hack"), wxGetTranslation(hacked_buffer_upload_desc), vconfig.bHackedBufferUpload));
|
||||
|
@ -36,10 +36,6 @@ if(wxWidgets_FOUND)
|
||||
set(LIBS ${LIBS} ${wxWidgets_LIBRARIES})
|
||||
endif(wxWidgets_FOUND)
|
||||
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(LIBS ${LIBS} clrun)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR
|
||||
${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
|
||||
set(LIBS ${LIBS} usbhid)
|
||||
|
@ -3,7 +3,6 @@
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
// Fast image conversion using OpenGL shaders.
|
||||
// This kind of stuff would be a LOT nicer with OpenCL.
|
||||
|
||||
#include "TextureConverter.h"
|
||||
#include "TextureConversionShader.h"
|
||||
|
@ -45,8 +45,5 @@ else()
|
||||
GLEW
|
||||
${OPENGL_LIBRARIES})
|
||||
endif()
|
||||
if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
|
||||
set(LIBS ${LIBS} clrun)
|
||||
endif()
|
||||
|
||||
add_dolphin_library(videosoftware "${SRCS}" "${LIBS}")
|
||||
|
@ -14,8 +14,6 @@ set(SRCS Src/BPFunctions.cpp
|
||||
Src/MainBase.cpp
|
||||
Src/OnScreenDisplay.cpp
|
||||
Src/OpcodeDecoding.cpp
|
||||
Src/OpenCL.cpp
|
||||
Src/OpenCL/TextureDecoder_OpenCL.cpp
|
||||
Src/PerfQueryBase.cpp
|
||||
Src/PixelEngine.cpp
|
||||
Src/PixelShaderGen.cpp
|
||||
|
@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<VisualStudioToolFile
|
||||
Name="OpenCL"
|
||||
Version="8,00"
|
||||
>
|
||||
<Rules>
|
||||
<CustomBuildRule
|
||||
Name="OpenCL source"
|
||||
DisplayName="OpenCL"
|
||||
CommandLine='xcopy /I /Y "$(InputPath)" "$(SolutionDir)\..\Binary\$(PlatformName)\User\OpenCL\"'
|
||||
Outputs='"$(SolutionDir)\..\Binary\$(PlatformName)\User\OpenCL\$(InputFileName)"'
|
||||
FileExtensions="*.cl"
|
||||
>
|
||||
<Properties>
|
||||
</Properties>
|
||||
</CustomBuildRule>
|
||||
</Rules>
|
||||
</VisualStudioToolFile>
|
@ -33,8 +33,6 @@
|
||||
#include "Fifo.h"
|
||||
#include "DataReader.h"
|
||||
|
||||
#include "OpenCL.h"
|
||||
#include "OpenCL/TextureDecoder_OpenCL.h"
|
||||
#include "VideoConfig.h"
|
||||
|
||||
u8* g_pVideoData = 0;
|
||||
@ -478,22 +476,11 @@ void OpcodeDecoder_Init()
|
||||
DataReadU32xFuncs[i] = DataReadU32xFuncs_SSSE3[i];
|
||||
}
|
||||
#endif
|
||||
|
||||
if (g_Config.bEnableOpenCL)
|
||||
{
|
||||
OpenCL::Initialize();
|
||||
TexDecoder_OpenCL_Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OpcodeDecoder_Shutdown()
|
||||
{
|
||||
if (g_Config.bEnableOpenCL)
|
||||
{
|
||||
TexDecoder_OpenCL_Shutdown();
|
||||
OpenCL::Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
u32 OpcodeDecoder_Run(bool skipped_frame)
|
||||
|
@ -1,259 +0,0 @@
|
||||
// Copyright 2013 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
// TODO: Make a more centralized version of this (for now every backend that will use it will create its own context, which is weird). An object maybe?
|
||||
|
||||
#include "OpenCL.h"
|
||||
#include "Common.h"
|
||||
#include "Timer.h"
|
||||
|
||||
namespace OpenCL
|
||||
{
|
||||
|
||||
cl_device_id device_id = NULL;
|
||||
cl_context g_context = NULL;
|
||||
cl_command_queue g_cmdq = NULL;
|
||||
|
||||
bool g_bInitialized = false;
|
||||
|
||||
bool Initialize()
|
||||
{
|
||||
if(g_bInitialized)
|
||||
return true;
|
||||
|
||||
if(g_context)
|
||||
return false;
|
||||
int err; // error code returned from api calls
|
||||
|
||||
#ifdef __APPLE__
|
||||
// If OpenCL is weakly linked and not found, its symbols will be NULL
|
||||
if (clGetPlatformIDs == NULL)
|
||||
return false;
|
||||
#else
|
||||
clrInit();
|
||||
if(!clrHasOpenCL())
|
||||
return false;
|
||||
#endif
|
||||
|
||||
// Connect to a compute device
|
||||
cl_uint numPlatforms;
|
||||
cl_platform_id platform = NULL;
|
||||
err = clGetPlatformIDs(0, NULL, &numPlatforms);
|
||||
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
HandleCLError(err, "clGetPlatformIDs failed.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (0 < numPlatforms)
|
||||
{
|
||||
cl_platform_id* platforms = new cl_platform_id[numPlatforms];
|
||||
err = clGetPlatformIDs(numPlatforms, platforms, NULL);
|
||||
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
HandleCLError(err, "clGetPlatformIDs failed.");
|
||||
return false;
|
||||
}
|
||||
|
||||
char pbuf[100];
|
||||
err = clGetPlatformInfo(platforms[0], CL_PLATFORM_VENDOR, sizeof(pbuf),
|
||||
pbuf, NULL);
|
||||
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
HandleCLError(err, "clGetPlatformInfo failed.");
|
||||
return false;
|
||||
}
|
||||
|
||||
platform = platforms[0];
|
||||
delete[] platforms;
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlert("No OpenCL platform found.");
|
||||
return false;
|
||||
}
|
||||
|
||||
cl_context_properties cps[3] = {CL_CONTEXT_PLATFORM,
|
||||
(cl_context_properties)platform, 0};
|
||||
|
||||
cl_context_properties* cprops = (NULL == platform) ? NULL : cps;
|
||||
|
||||
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_DEFAULT, 1, &device_id, NULL);
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
HandleCLError(err, "Failed to create a device group!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create a compute context
|
||||
g_context = clCreateContext(cprops, 1, &device_id, NULL, NULL, &err);
|
||||
if (!g_context)
|
||||
{
|
||||
HandleCLError(err, "Failed to create a compute context!");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create a command commands
|
||||
g_cmdq = clCreateCommandQueue(g_context, device_id, 0, &err);
|
||||
if (!g_cmdq)
|
||||
{
|
||||
HandleCLError(err, "Failed to create a command commands!");
|
||||
return false;
|
||||
}
|
||||
|
||||
g_bInitialized = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
cl_context GetContext()
|
||||
{
|
||||
return g_context;
|
||||
}
|
||||
|
||||
cl_command_queue GetCommandQueue()
|
||||
{
|
||||
return g_cmdq;
|
||||
}
|
||||
|
||||
cl_program CompileProgram(const char *Kernel)
|
||||
{
|
||||
u32 compileStart = Common::Timer::GetTimeMs();
|
||||
cl_int err;
|
||||
cl_program program;
|
||||
program = clCreateProgramWithSource(OpenCL::g_context, 1,
|
||||
(const char **) & Kernel, NULL, &err);
|
||||
|
||||
if (!program)
|
||||
{
|
||||
HandleCLError(err, "Error: Failed to create compute program!");
|
||||
}
|
||||
|
||||
// Build the program executable
|
||||
err = clBuildProgram(program , 0, NULL, NULL, NULL, NULL);
|
||||
if(err != CL_SUCCESS) {
|
||||
HandleCLError(err, "Error: failed to build program");
|
||||
|
||||
char *buildlog = NULL;
|
||||
size_t buildlog_size = 0;
|
||||
|
||||
clGetProgramBuildInfo(program, OpenCL::device_id, CL_PROGRAM_BUILD_LOG, 0, NULL, &buildlog_size);
|
||||
buildlog = new char[buildlog_size + 1];
|
||||
err = clGetProgramBuildInfo(program, OpenCL::device_id, CL_PROGRAM_BUILD_LOG, buildlog_size, buildlog, NULL);
|
||||
buildlog[buildlog_size] = 0;
|
||||
|
||||
if(err != CL_SUCCESS)
|
||||
{
|
||||
HandleCLError(err, "Error: can't get build log");
|
||||
} else
|
||||
{
|
||||
ERROR_LOG(COMMON, "Error log:\n%s\n", buildlog);
|
||||
}
|
||||
|
||||
delete[] buildlog;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
INFO_LOG(COMMON, "OpenCL CompileProgram took %.3f seconds",
|
||||
(float)(Common::Timer::GetTimeMs() - compileStart) / 1000.0);
|
||||
return program;
|
||||
}
|
||||
|
||||
cl_kernel CompileKernel(cl_program program, const char *Function)
|
||||
{
|
||||
u32 compileStart = Common::Timer::GetTimeMs();
|
||||
int err;
|
||||
|
||||
// Create the compute kernel in the program we wish to run
|
||||
cl_kernel kernel = clCreateKernel(program, Function, &err);
|
||||
if (!kernel || err != CL_SUCCESS)
|
||||
{
|
||||
char buffer[1024];
|
||||
sprintf(buffer, "Failed to create compute kernel '%s' !", Function);
|
||||
HandleCLError(err, buffer);
|
||||
return NULL;
|
||||
}
|
||||
INFO_LOG(COMMON, "OpenCL CompileKernel took %.3f seconds",
|
||||
(float)(Common::Timer::GetTimeMs() - compileStart) / 1000.0);
|
||||
return kernel;
|
||||
}
|
||||
|
||||
void Destroy()
|
||||
{
|
||||
if (g_cmdq)
|
||||
{
|
||||
clReleaseCommandQueue(g_cmdq);
|
||||
g_cmdq = NULL;
|
||||
}
|
||||
if (g_context)
|
||||
{
|
||||
clReleaseContext(g_context);
|
||||
g_context = NULL;
|
||||
}
|
||||
g_bInitialized = false;
|
||||
}
|
||||
|
||||
void HandleCLError(cl_int error, const char* str)
|
||||
{
|
||||
const char* name;
|
||||
switch(error)
|
||||
{
|
||||
#define CL_ERROR(x) case (x): name = #x; break
|
||||
CL_ERROR(CL_SUCCESS);
|
||||
CL_ERROR(CL_DEVICE_NOT_FOUND);
|
||||
CL_ERROR(CL_DEVICE_NOT_AVAILABLE);
|
||||
CL_ERROR(CL_COMPILER_NOT_AVAILABLE);
|
||||
CL_ERROR(CL_MEM_OBJECT_ALLOCATION_FAILURE);
|
||||
CL_ERROR(CL_OUT_OF_RESOURCES);
|
||||
CL_ERROR(CL_OUT_OF_HOST_MEMORY);
|
||||
CL_ERROR(CL_PROFILING_INFO_NOT_AVAILABLE);
|
||||
CL_ERROR(CL_MEM_COPY_OVERLAP);
|
||||
CL_ERROR(CL_IMAGE_FORMAT_MISMATCH);
|
||||
CL_ERROR(CL_IMAGE_FORMAT_NOT_SUPPORTED);
|
||||
CL_ERROR(CL_BUILD_PROGRAM_FAILURE);
|
||||
CL_ERROR(CL_MAP_FAILURE);
|
||||
CL_ERROR(CL_INVALID_VALUE);
|
||||
CL_ERROR(CL_INVALID_DEVICE_TYPE);
|
||||
CL_ERROR(CL_INVALID_PLATFORM);
|
||||
CL_ERROR(CL_INVALID_DEVICE);
|
||||
CL_ERROR(CL_INVALID_CONTEXT);
|
||||
CL_ERROR(CL_INVALID_QUEUE_PROPERTIES);
|
||||
CL_ERROR(CL_INVALID_COMMAND_QUEUE);
|
||||
CL_ERROR(CL_INVALID_HOST_PTR);
|
||||
CL_ERROR(CL_INVALID_MEM_OBJECT);
|
||||
CL_ERROR(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR);
|
||||
CL_ERROR(CL_INVALID_IMAGE_SIZE);
|
||||
CL_ERROR(CL_INVALID_SAMPLER);
|
||||
CL_ERROR(CL_INVALID_BINARY);
|
||||
CL_ERROR(CL_INVALID_BUILD_OPTIONS);
|
||||
CL_ERROR(CL_INVALID_PROGRAM);
|
||||
CL_ERROR(CL_INVALID_PROGRAM_EXECUTABLE);
|
||||
CL_ERROR(CL_INVALID_KERNEL_NAME);
|
||||
CL_ERROR(CL_INVALID_KERNEL_DEFINITION);
|
||||
CL_ERROR(CL_INVALID_KERNEL);
|
||||
CL_ERROR(CL_INVALID_ARG_INDEX);
|
||||
CL_ERROR(CL_INVALID_ARG_VALUE);
|
||||
CL_ERROR(CL_INVALID_ARG_SIZE);
|
||||
CL_ERROR(CL_INVALID_KERNEL_ARGS);
|
||||
CL_ERROR(CL_INVALID_WORK_DIMENSION);
|
||||
CL_ERROR(CL_INVALID_WORK_GROUP_SIZE);
|
||||
CL_ERROR(CL_INVALID_WORK_ITEM_SIZE);
|
||||
CL_ERROR(CL_INVALID_GLOBAL_OFFSET);
|
||||
CL_ERROR(CL_INVALID_EVENT_WAIT_LIST);
|
||||
CL_ERROR(CL_INVALID_EVENT);
|
||||
CL_ERROR(CL_INVALID_OPERATION);
|
||||
CL_ERROR(CL_INVALID_GL_OBJECT);
|
||||
CL_ERROR(CL_INVALID_BUFFER_SIZE);
|
||||
CL_ERROR(CL_INVALID_MIP_LEVEL);
|
||||
#undef CL_ERROR
|
||||
default:
|
||||
name = "Unknown error code";
|
||||
}
|
||||
if(!str)
|
||||
str = "";
|
||||
ERROR_LOG(COMMON, "OpenCL error: %s %s (%d)", str, name, error);
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
// Copyright 2013 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#ifndef __OPENCL_H__
|
||||
#define __OPENCL_H__
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
#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>
|
||||
#include <clrun.h>
|
||||
#endif
|
||||
|
||||
namespace OpenCL
|
||||
{
|
||||
|
||||
extern cl_device_id device_id;
|
||||
extern cl_context g_context;
|
||||
extern cl_command_queue g_cmdq;
|
||||
|
||||
bool Initialize();
|
||||
|
||||
cl_context GetContext();
|
||||
|
||||
cl_command_queue GetCommandQueue();
|
||||
|
||||
void Destroy();
|
||||
|
||||
cl_program CompileProgram(const char *Kernel);
|
||||
cl_kernel CompileKernel(cl_program program, const char *Function);
|
||||
|
||||
void HandleCLError(cl_int error, const char* str = 0);
|
||||
}
|
||||
|
||||
#endif
|
@ -1,307 +0,0 @@
|
||||
// Copyright 2013 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "TextureDecoder_OpenCL.h"
|
||||
|
||||
#include "../OpenCL.h"
|
||||
#include "CommonPaths.h"
|
||||
#include "FileUtil.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <sys/types.h>
|
||||
#include <string>
|
||||
|
||||
//#define DEBUG_OPENCL
|
||||
|
||||
cl_program g_program;
|
||||
|
||||
struct sDecoderParameter
|
||||
{
|
||||
const char *name;
|
||||
cl_kernel kernel;
|
||||
float sizeOfSrc;
|
||||
float sizeOfDst;
|
||||
int xSkip;
|
||||
int ySkip;
|
||||
PC_TexFormat format;
|
||||
};
|
||||
|
||||
sDecoderParameter g_DecodeParametersNative[] = {
|
||||
/* GX_TF_I4 */ { "DecodeI4", NULL, 0.5f, 1, 8, 8, PC_TEX_FMT_I4_AS_I8 },
|
||||
/* GX_TF_I8 */ { "DecodeI8", NULL, 1, 1, 8, 4, PC_TEX_FMT_I8 },
|
||||
/* GX_TF_IA4 */ { "DecodeIA4", NULL, 1, 2, 8, 4, PC_TEX_FMT_IA4_AS_IA8 },
|
||||
/* GX_TF_IA8 */ { "DecodeIA8", NULL, 2, 2, 4, 4, PC_TEX_FMT_IA8 },
|
||||
/* GX_TF_RGB565 */ { "DecodeRGB565", NULL, 2, 2, 4, 4, PC_TEX_FMT_RGB565 },
|
||||
/* GX_TF_RGB5A3 */ { "DecodeRGB5A3", NULL, 2, 4, 4, 4, PC_TEX_FMT_BGRA32 },
|
||||
/* GX_TF_RGBA8 */ { "DecodeRGBA8", NULL, 4, 4, 4, 4, PC_TEX_FMT_BGRA32 },
|
||||
/* 7 */ { NULL, NULL, 0, 0, 0, 0, PC_TEX_FMT_NONE },
|
||||
/* GX_TF_C4 */ { NULL, NULL, 0, 0, 0, 0, PC_TEX_FMT_NONE },
|
||||
/* GX_TF_C8 */ { NULL, NULL, 0, 0, 0, 0, PC_TEX_FMT_NONE },
|
||||
/* GX_TF_C14X2 */ { NULL, NULL, 0, 0, 0, 0, PC_TEX_FMT_NONE },
|
||||
/* B */ { NULL, NULL, 0, 0, 0, 0, PC_TEX_FMT_NONE },
|
||||
/* C */ { NULL, NULL, 0, 0, 0, 0, PC_TEX_FMT_NONE },
|
||||
/* D */ { NULL, NULL, 0, 0, 0, 0, PC_TEX_FMT_NONE },
|
||||
/* GX_TF_CMPR */ { "DecodeCMPR", NULL, 0.5f, 4, 8, 8, PC_TEX_FMT_BGRA32 },
|
||||
};
|
||||
|
||||
sDecoderParameter g_DecodeParametersRGBA[] = {
|
||||
/* GX_TF_I4 */ { "DecodeI4_RGBA", NULL, 0.5f, 4, 8, 8, PC_TEX_FMT_RGBA32 },
|
||||
/* GX_TF_I8 */ { "DecodeI8_RGBA", NULL, 1, 4, 8, 4, PC_TEX_FMT_RGBA32 },
|
||||
/* GX_TF_IA4 */ { "DecodeIA4_RGBA", NULL, 1, 4, 8, 4, PC_TEX_FMT_RGBA32 },
|
||||
/* GX_TF_IA8 */ { "DecodeIA8_RGBA", NULL, 2, 4, 4, 4, PC_TEX_FMT_RGBA32 },
|
||||
/* GX_TF_RGB565 */ { "DecodeRGB565_RGBA", NULL, 2, 4, 4, 4, PC_TEX_FMT_RGBA32 },
|
||||
/* GX_TF_RGB5A3 */ { "DecodeRGB5A3_RGBA", NULL, 2, 4, 4, 4, PC_TEX_FMT_RGBA32 },
|
||||
/* GX_TF_RGBA8 */ { "DecodeRGBA8_RGBA", NULL, 4, 4, 4, 4, PC_TEX_FMT_RGBA32 },
|
||||
/* 7 */ { NULL, NULL, 0, 0, 0, 0, PC_TEX_FMT_NONE },
|
||||
/* GX_TF_C4 */ { NULL, NULL, 0, 0, 0, 0, PC_TEX_FMT_NONE },
|
||||
/* GX_TF_C8 */ { NULL, NULL, 0, 0, 0, 0, PC_TEX_FMT_NONE },
|
||||
/* GX_TF_C14X2 */ { NULL, NULL, 0, 0, 0, 0, PC_TEX_FMT_NONE },
|
||||
/* B */ { NULL, NULL, 0, 0, 0, 0, PC_TEX_FMT_NONE },
|
||||
/* C */ { NULL, NULL, 0, 0, 0, 0, PC_TEX_FMT_NONE },
|
||||
/* D */ { NULL, NULL, 0, 0, 0, 0, PC_TEX_FMT_NONE },
|
||||
/* GX_TF_CMPR */ { "DecodeCMPR_RGBA", NULL, 0.5f, 4, 8, 8, PC_TEX_FMT_RGBA32 },
|
||||
};
|
||||
|
||||
bool g_Inited = false;
|
||||
cl_mem g_clsrc, g_cldst; // texture buffer memory objects
|
||||
|
||||
#define HEADER_SIZE 32
|
||||
|
||||
void TexDecoder_OpenCL_Initialize()
|
||||
{
|
||||
if(!g_Inited)
|
||||
{
|
||||
if(!OpenCL::Initialize())
|
||||
return;
|
||||
|
||||
cl_int err = 1;
|
||||
size_t binary_size = 0;
|
||||
char *binary = NULL;
|
||||
char *header = NULL;
|
||||
size_t nDevices = 0;
|
||||
cl_device_id *devices = NULL;
|
||||
size_t *binary_sizes = NULL;
|
||||
char **binaries = NULL;
|
||||
std::string filename;
|
||||
char dolphin_rev[HEADER_SIZE];
|
||||
|
||||
filename = File::GetUserPath(D_OPENCL_IDX) + "kernel.bin";
|
||||
snprintf(dolphin_rev, HEADER_SIZE, "%-31s", scm_rev_str);
|
||||
|
||||
{
|
||||
File::IOFile input(filename, "rb");
|
||||
if (!input)
|
||||
{
|
||||
binary_size = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
binary_size = input.GetSize();
|
||||
header = new char[HEADER_SIZE];
|
||||
binary = new char[binary_size];
|
||||
input.ReadBytes(header, HEADER_SIZE);
|
||||
input.ReadBytes(binary, binary_size);
|
||||
}
|
||||
}
|
||||
|
||||
if (binary_size > 0)
|
||||
{
|
||||
if (binary_size > HEADER_SIZE)
|
||||
{
|
||||
if (strncmp(header, dolphin_rev, HEADER_SIZE) == 0)
|
||||
{
|
||||
g_program = clCreateProgramWithBinary(OpenCL::GetContext(), 1, &OpenCL::device_id, &binary_size, (const unsigned char**)&binary, NULL, &err);
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
OpenCL::HandleCLError(err, "clCreateProgramWithBinary");
|
||||
}
|
||||
|
||||
if (!err)
|
||||
{
|
||||
err = clBuildProgram(g_program, 1, &OpenCL::device_id, NULL, NULL, NULL);
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
OpenCL::HandleCLError(err, "clBuildProgram");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
delete [] header;
|
||||
delete [] binary;
|
||||
}
|
||||
|
||||
// If an error occurred using the kernel binary, recompile the kernels
|
||||
if (err)
|
||||
{
|
||||
std::string code;
|
||||
filename = File::GetSysDirectory() + OPENCL_DIR DIR_SEP "TextureDecoder.cl";
|
||||
if (!File::ReadFileToString(filename.c_str(), code))
|
||||
{
|
||||
ERROR_LOG(VIDEO, "Failed to load OpenCL code %s - file is missing?", filename.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
g_program = OpenCL::CompileProgram(code.c_str());
|
||||
|
||||
err = clGetProgramInfo(g_program, CL_PROGRAM_NUM_DEVICES, sizeof(nDevices), &nDevices, NULL);
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
OpenCL::HandleCLError(err, "clGetProgramInfo");
|
||||
}
|
||||
devices = (cl_device_id *)malloc( sizeof(cl_device_id) *nDevices);
|
||||
|
||||
err = clGetProgramInfo(g_program, CL_PROGRAM_DEVICES, sizeof(cl_device_id)*nDevices, devices, NULL);
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
OpenCL::HandleCLError(err, "clGetProgramInfo");
|
||||
}
|
||||
|
||||
binary_sizes = (size_t *)malloc(sizeof(size_t)*nDevices);
|
||||
err = clGetProgramInfo(g_program, CL_PROGRAM_BINARY_SIZES, sizeof(size_t)*nDevices, binary_sizes, NULL);
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
OpenCL::HandleCLError(err, "clGetProgramInfo");
|
||||
}
|
||||
|
||||
binaries = (char **)malloc(sizeof(char *)*nDevices);
|
||||
for (u32 i = 0; i < nDevices; ++i)
|
||||
{
|
||||
if (binary_sizes[i] != 0)
|
||||
{
|
||||
binaries[i] = (char *)malloc(HEADER_SIZE + binary_sizes[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
binaries[i] = NULL;
|
||||
}
|
||||
}
|
||||
err = clGetProgramInfo( g_program, CL_PROGRAM_BINARIES, sizeof(char *)*nDevices, binaries, NULL );
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
OpenCL::HandleCLError(err, "clGetProgramInfo");
|
||||
}
|
||||
|
||||
if (!err)
|
||||
{
|
||||
filename = File::GetUserPath(D_OPENCL_IDX) + "kernel.bin";
|
||||
|
||||
File::IOFile output(filename, "wb");
|
||||
if (!output)
|
||||
{
|
||||
binary_size = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Supporting one OpenCL device for now
|
||||
output.WriteBytes(dolphin_rev, HEADER_SIZE);
|
||||
output.WriteBytes(binaries[0], binary_sizes[0]);
|
||||
}
|
||||
}
|
||||
for (u32 i = 0; i < nDevices; ++i)
|
||||
{
|
||||
if (binary_sizes[i] != 0)
|
||||
{
|
||||
free(binaries[i]);
|
||||
}
|
||||
}
|
||||
if (binaries != NULL)
|
||||
free(binaries);
|
||||
if (binary_sizes != NULL)
|
||||
free(binary_sizes);
|
||||
if (devices != NULL)
|
||||
free(devices);
|
||||
}
|
||||
|
||||
for (int i = 0; i <= GX_TF_CMPR; ++i)
|
||||
{
|
||||
if (g_DecodeParametersNative[i].name)
|
||||
g_DecodeParametersNative[i].kernel =
|
||||
OpenCL::CompileKernel(g_program,
|
||||
g_DecodeParametersNative[i].name);
|
||||
|
||||
if (g_DecodeParametersRGBA[i].name)
|
||||
g_DecodeParametersRGBA[i].kernel =
|
||||
OpenCL::CompileKernel(g_program,
|
||||
g_DecodeParametersRGBA[i].name);
|
||||
}
|
||||
|
||||
// Allocating maximal Wii texture size in advance, so that we don't have to allocate/deallocate per texture
|
||||
#ifndef DEBUG_OPENCL
|
||||
g_clsrc = clCreateBuffer(OpenCL::GetContext(), CL_MEM_READ_ONLY , 1024 * 1024 * sizeof(u32), NULL, NULL);
|
||||
g_cldst = clCreateBuffer(OpenCL::GetContext(), CL_MEM_WRITE_ONLY, 1024 * 1024 * sizeof(u32), NULL, NULL);
|
||||
#endif
|
||||
|
||||
g_Inited = true;
|
||||
}
|
||||
}
|
||||
|
||||
void TexDecoder_OpenCL_Shutdown()
|
||||
{
|
||||
if (g_program)
|
||||
clReleaseProgram(g_program);
|
||||
|
||||
for (int i = 0; i < GX_TF_CMPR; ++i) {
|
||||
if (g_DecodeParametersNative[i].kernel)
|
||||
clReleaseKernel(g_DecodeParametersNative[i].kernel);
|
||||
|
||||
if(g_DecodeParametersRGBA[i].kernel)
|
||||
clReleaseKernel(g_DecodeParametersRGBA[i].kernel);
|
||||
}
|
||||
|
||||
if(g_clsrc)
|
||||
clReleaseMemObject(g_clsrc);
|
||||
|
||||
if(g_cldst)
|
||||
clReleaseMemObject(g_cldst);
|
||||
|
||||
g_Inited = false;
|
||||
}
|
||||
|
||||
PC_TexFormat TexDecoder_Decode_OpenCL(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt, bool rgba)
|
||||
{
|
||||
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)
|
||||
return PC_TEX_FMT_NONE;
|
||||
|
||||
#ifdef DEBUG_OPENCL
|
||||
g_clsrc = clCreateBuffer(OpenCL::GetContext(), CL_MEM_READ_ONLY , 1024 * 1024 * sizeof(u32), NULL, NULL);
|
||||
g_cldst = clCreateBuffer(OpenCL::GetContext(), CL_MEM_WRITE_ONLY, 1024 * 1024 * sizeof(u32), NULL, NULL);
|
||||
#endif
|
||||
|
||||
clEnqueueWriteBuffer(OpenCL::GetCommandQueue(), g_clsrc, CL_TRUE, 0, (size_t)(width * height * decoder.sizeOfSrc), src, 0, NULL, NULL);
|
||||
|
||||
clSetKernelArg(decoder.kernel, 0, sizeof(cl_mem), &g_cldst);
|
||||
clSetKernelArg(decoder.kernel, 1, sizeof(cl_mem), &g_clsrc);
|
||||
clSetKernelArg(decoder.kernel, 2, sizeof(cl_int), &width);
|
||||
|
||||
size_t global[] = { (size_t)(width / decoder.xSkip), (size_t)(height / decoder.ySkip) };
|
||||
|
||||
// No work-groups for now
|
||||
/*
|
||||
size_t local;
|
||||
err = clGetKernelWorkGroupInfo(kernelToRun, OpenCL::device_id, CL_KERNEL_WORK_GROUP_SIZE, sizeof(local), &local, NULL);
|
||||
if(err)
|
||||
PanicAlert("Error obtaining work-group information");
|
||||
*/
|
||||
|
||||
err = clEnqueueNDRangeKernel(OpenCL::GetCommandQueue(), decoder.kernel, 2, NULL, global, NULL, 0, NULL, NULL);
|
||||
if(err)
|
||||
OpenCL::HandleCLError(err, "Failed to enqueue kernel");
|
||||
|
||||
clFinish(OpenCL::GetCommandQueue());
|
||||
|
||||
clEnqueueReadBuffer(OpenCL::GetCommandQueue(), g_cldst, CL_TRUE, 0, (size_t)(width * height * decoder.sizeOfDst), dst, 0, NULL, NULL);
|
||||
|
||||
#ifdef DEBUG_OPENCL
|
||||
clReleaseMemObject(g_clsrc);
|
||||
clReleaseMemObject(g_cldst);
|
||||
#endif
|
||||
|
||||
return decoder.format;
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
// Copyright 2013 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#ifndef OPENCL_TEXTURE_DECODER
|
||||
#define OPENCL_TEXTURE_DECODER
|
||||
#include "Common.h"
|
||||
#include "../TextureDecoder.h"
|
||||
|
||||
void TexDecoder_OpenCL_Initialize();
|
||||
void TexDecoder_OpenCL_Shutdown();
|
||||
|
||||
PC_TexFormat TexDecoder_Decode_OpenCL(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt, bool rgba);
|
||||
|
||||
#endif
|
@ -20,8 +20,6 @@
|
||||
|
||||
#include "CPUDetect.h"
|
||||
#include "TextureDecoder.h"
|
||||
#include "OpenCL.h"
|
||||
#include "OpenCL/TextureDecoder_OpenCL.h"
|
||||
#include "VideoConfig.h"
|
||||
|
||||
#include "LookUpTables.h"
|
||||
@ -1060,15 +1058,12 @@ 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,bool rgbaOnly)
|
||||
{
|
||||
PC_TexFormat retval = TexDecoder_Decode_OpenCL(dst, src,
|
||||
width, height, texformat, tlutaddr, tlutfmt, rgbaOnly);
|
||||
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);
|
||||
PC_TexFormat retval = rgbaOnly ? TexDecoder_Decode_RGBA((u32*)dst, src,
|
||||
width, height, texformat, tlutaddr, tlutfmt)
|
||||
: TexDecoder_Decode_real(dst, src,
|
||||
width, height, texformat, tlutaddr, tlutfmt);
|
||||
|
||||
if ((!TexFmt_Overlay_Enable)|| (retval == PC_TEX_FMT_NONE))
|
||||
if ((!TexFmt_Overlay_Enable) || (retval == PC_TEX_FMT_NONE))
|
||||
return retval;
|
||||
|
||||
int w = min(width, 40);
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
#include "CPUDetect.h"
|
||||
#include "TextureDecoder.h"
|
||||
#include "OpenCL.h"
|
||||
#include "OpenCL/TextureDecoder_OpenCL.h"
|
||||
#include "VideoConfig.h"
|
||||
|
||||
#include "LookUpTables.h"
|
||||
@ -2039,15 +2037,12 @@ 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,bool rgbaOnly)
|
||||
{
|
||||
PC_TexFormat retval = TexDecoder_Decode_OpenCL(dst, src,
|
||||
width, height, texformat, tlutaddr, tlutfmt, rgbaOnly);
|
||||
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);
|
||||
PC_TexFormat retval = rgbaOnly ? TexDecoder_Decode_RGBA((u32*)dst, src,
|
||||
width, height, texformat, tlutaddr, tlutfmt)
|
||||
: TexDecoder_Decode_real(dst, src,
|
||||
width, height, texformat, tlutaddr, tlutfmt);
|
||||
|
||||
if ((!TexFmt_Overlay_Enable)|| (retval == PC_TEX_FMT_NONE))
|
||||
if ((!TexFmt_Overlay_Enable) || (retval == PC_TEX_FMT_NONE))
|
||||
return retval;
|
||||
|
||||
int w = min(width, 40);
|
||||
|
@ -81,7 +81,6 @@ void VideoConfig::Load(const char *ini_file)
|
||||
iniFile.Get("Settings", "WireFrame", &bWireFrame, 0);
|
||||
iniFile.Get("Settings", "DisableFog", &bDisableFog, 0);
|
||||
|
||||
iniFile.Get("Settings", "EnableOpenCL", &bEnableOpenCL, false);
|
||||
iniFile.Get("Settings", "OMPDecoder", &bOMPDecoder, false);
|
||||
|
||||
iniFile.Get("Settings", "EnableShaderDebugging", &bEnableShaderDebugging, false);
|
||||
@ -184,7 +183,6 @@ void VideoConfig::GameIniLoad()
|
||||
|
||||
CHECK_SETTING("Video_Settings", "DstAlphaPass", bDstAlphaPass);
|
||||
CHECK_SETTING("Video_Settings", "DisableFog", bDisableFog);
|
||||
CHECK_SETTING("Video_Settings", "EnableOpenCL", bEnableOpenCL);
|
||||
CHECK_SETTING("Video_Settings", "OMPDecoder", bOMPDecoder);
|
||||
|
||||
CHECK_SETTING("Video_Enhancements", "ForceFiltering", bForceFiltering);
|
||||
@ -265,7 +263,6 @@ void VideoConfig::Save(const char *ini_file)
|
||||
iniFile.Set("Settings", "DstAlphaPass", bDstAlphaPass);
|
||||
iniFile.Set("Settings", "DisableFog", bDisableFog);
|
||||
|
||||
iniFile.Set("Settings", "EnableOpenCL", bEnableOpenCL);
|
||||
iniFile.Set("Settings", "OMPDecoder", bOMPDecoder);
|
||||
|
||||
iniFile.Set("Settings", "EnableShaderDebugging", bEnableShaderDebugging);
|
||||
|
@ -66,8 +66,7 @@ struct VideoConfig
|
||||
bool bUseXFB;
|
||||
bool bUseRealXFB;
|
||||
|
||||
// OpenCL/OpenMP
|
||||
bool bEnableOpenCL;
|
||||
// OpenMP
|
||||
bool bOMPDecoder;
|
||||
|
||||
// Enhancements
|
||||
|
@ -63,8 +63,6 @@
|
||||
<ClCompile Include="Src\memcpy_amd.cpp" />
|
||||
<ClCompile Include="Src\OnScreenDisplay.cpp" />
|
||||
<ClCompile Include="Src\OpcodeDecoding.cpp" />
|
||||
<ClCompile Include="Src\OpenCL.cpp" />
|
||||
<ClCompile Include="Src\OpenCL\TextureDecoder_OpenCL.cpp" />
|
||||
<ClCompile Include="Src\PerfQueryBase.cpp" />
|
||||
<ClCompile Include="Src\PixelEngine.cpp" />
|
||||
<ClCompile Include="Src\PixelShaderGen.cpp" />
|
||||
@ -116,8 +114,6 @@
|
||||
<ClInclude Include="Src\NativeVertexFormat.h" />
|
||||
<ClInclude Include="Src\OnScreenDisplay.h" />
|
||||
<ClInclude Include="Src\OpcodeDecoding.h" />
|
||||
<ClInclude Include="Src\OpenCL.h" />
|
||||
<ClInclude Include="Src\OpenCL\TextureDecoder_OpenCL.h" />
|
||||
<ClInclude Include="Src\PerfQueryBase.h" />
|
||||
<ClInclude Include="Src\PixelEngine.h" />
|
||||
<ClInclude Include="Src\PixelShaderGen.h" />
|
||||
@ -149,9 +145,6 @@
|
||||
<Text Include="CMakeLists.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Externals\CLRun\clrun\CLRun.vcxproj">
|
||||
<Project>{aa862e5e-a993-497a-b6a0-0e8e94b10050}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Externals\libpng\png\png.vcxproj">
|
||||
<Project>{4c9f135b-a85e-430c-bad4-4c67ef5fc12c}</Project>
|
||||
</ProjectReference>
|
||||
|
@ -7,9 +7,6 @@
|
||||
<Filter Include="Decoding">
|
||||
<UniqueIdentifier>{2baa29c2-a528-4981-abcb-e0842c311f63}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Decoding\OpenCL">
|
||||
<UniqueIdentifier>{f32547ad-f1c1-4e47-9ded-c07f66de2100}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Register Sections">
|
||||
<UniqueIdentifier>{6a88e4a0-754c-43df-98e6-405c99cd2ca7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
@ -57,12 +54,6 @@
|
||||
<ClCompile Include="Src\VertexManagerBase.cpp">
|
||||
<Filter>Base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Src\OpenCL.cpp">
|
||||
<Filter>Decoding\OpenCL</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Src\OpenCL\TextureDecoder_OpenCL.cpp">
|
||||
<Filter>Decoding\OpenCL</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Src\Fifo.cpp">
|
||||
<Filter>Decoding</Filter>
|
||||
</ClCompile>
|
||||
@ -184,12 +175,6 @@
|
||||
<ClInclude Include="Src\VertexManagerBase.h">
|
||||
<Filter>Base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Src\OpenCL\TextureDecoder_OpenCL.h">
|
||||
<Filter>Decoding\OpenCL</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Src\OpenCL.h">
|
||||
<Filter>Decoding\OpenCL</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Src\Fifo.h">
|
||||
<Filter>Decoding</Filter>
|
||||
</ClInclude>
|
||||
|
@ -43,7 +43,6 @@
|
||||
<AdditionalIncludeDirectories>$(CoreDir)VideoCommon\Src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ExternalsDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ExternalsDir)Bochs_disasm;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ExternalsDir)CLRun\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ExternalsDir)GLew\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ExternalsDir)libpng;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ExternalsDir)libusbx\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
@ -120,4 +119,4 @@
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup />
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -45,8 +45,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SCMRevGen", "Core\Common\SC
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SFML_Network", "..\Externals\SFML\build\vc2010\SFML_Network.vcxproj", "{93D73454-2512-424E-9CDA-4BB357FE13DD}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CLRun", "..\Externals\CLRun\clrun\CLRun.vcxproj", "{AA862E5E-A993-497A-B6A0-0E8E94B10050}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libusb-1.0", "..\Externals\libusbx\msvc\libusb_static_2013.vcxproj", "{349EE8F9-7D25-4909-AAF5-FF3FADE72187}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glew", "..\Externals\GLew\glew.vcxproj", "{2A3F751D-69E9-45F2-9199-9A00BFB6CC72}"
|
||||
|
Loading…
Reference in New Issue
Block a user