Commit 05fb2272 by John Plate Committed by Commit Bot

Add support for OpenCL ICD Loader

Bug: angleproject:5908 Change-Id: Idafc0d15b69f9a21f2ab5e48c4c34f0dc0e0ee96 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2854598Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Commit-Queue: John Plate <jplate@google.com>
parent bcae4fe1
......@@ -345,6 +345,9 @@ if (angle_has_build) {
angle_static_library("angle_common") {
sources = libangle_common_sources
if (angle_enable_cl) {
sources += libangle_common_cl_sources
}
configs += [
":angle_common_config",
......
......@@ -140,6 +140,11 @@ declare_args() {
angle_enable_cl_passthrough = angle_enable_cl
}
# OpenCL is not supported on Windows UWP, because the CL headers include DXD9, which is not
# supported by UWP. A workaround might be possible if CL support on UWP is required.
assert(!angle_is_winuwp || !angle_enable_cl,
"OpenCL is not supported on Windows UWP")
if (!angle_enable_cl) {
angle_enable_cl_passthrough = false
}
......
......@@ -3,9 +3,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// angle_cl.h:
// Includes all necessary CL headers and definitions for ANGLE.
//
// angle_cl.h: Includes all necessary CL headers and definitions for ANGLE.
#ifndef ANGLECL_H_
#define ANGLECL_H_
......@@ -18,6 +16,91 @@
#define CL_USE_DEPRECATED_OPENCL_2_1_APIS
#define CL_USE_DEPRECATED_OPENCL_2_2_APIS
#include "CL/opencl.h"
#include "CL/cl_icd.h"
#include <cstddef>
#include <type_traits>
namespace cl
{
template <typename CLObjectType>
struct Dispatch
{
constexpr Dispatch(const cl_icd_dispatch &dispatch) : mDispatch(&dispatch)
{
static_assert(
std::is_standard_layout<CLObjectType>::value && offsetof(CLObjectType, mDispatch) == 0u,
"Not ICD compatible");
}
~Dispatch() = default;
constexpr const cl_icd_dispatch &getDispatch() { return *mDispatch; }
private:
// This has to be the first member to be OpenCL ICD compatible
const cl_icd_dispatch *const mDispatch;
};
} // namespace cl
struct _cl_platform_id : public cl::Dispatch<_cl_platform_id>
{
constexpr _cl_platform_id(const cl_icd_dispatch &dispatch)
: cl::Dispatch<_cl_platform_id>(dispatch)
{}
~_cl_platform_id() = default;
};
struct _cl_device_id : public cl::Dispatch<_cl_device_id>
{
constexpr _cl_device_id(const cl_icd_dispatch &dispatch) : cl::Dispatch<_cl_device_id>(dispatch)
{}
~_cl_device_id() = default;
};
struct _cl_context : public cl::Dispatch<_cl_context>
{
constexpr _cl_context(const cl_icd_dispatch &dispatch) : cl::Dispatch<_cl_context>(dispatch) {}
~_cl_context() = default;
};
struct _cl_command_queue : public cl::Dispatch<_cl_command_queue>
{
constexpr _cl_command_queue(const cl_icd_dispatch &dispatch)
: cl::Dispatch<_cl_command_queue>(dispatch)
{}
~_cl_command_queue() = default;
};
struct _cl_mem : public cl::Dispatch<_cl_mem>
{
constexpr _cl_mem(const cl_icd_dispatch &dispatch) : cl::Dispatch<_cl_mem>(dispatch) {}
~_cl_mem() = default;
};
struct _cl_program : public cl::Dispatch<_cl_program>
{
constexpr _cl_program(const cl_icd_dispatch &dispatch) : cl::Dispatch<_cl_program>(dispatch) {}
~_cl_program() = default;
};
struct _cl_kernel : public cl::Dispatch<_cl_kernel>
{
constexpr _cl_kernel(const cl_icd_dispatch &dispatch) : cl::Dispatch<_cl_kernel>(dispatch) {}
~_cl_kernel() = default;
};
struct _cl_event : public cl::Dispatch<_cl_event>
{
constexpr _cl_event(const cl_icd_dispatch &dispatch) : cl::Dispatch<_cl_event>(dispatch) {}
~_cl_event() = default;
};
struct _cl_sampler : public cl::Dispatch<_cl_sampler>
{
constexpr _cl_sampler(const cl_icd_dispatch &dispatch) : cl::Dispatch<_cl_sampler>(dispatch) {}
~_cl_sampler() = default;
};
#endif // ANGLECL_H_
......@@ -6,7 +6,7 @@
"scripts/egl_angle_ext.xml":
"5bcc01462b355d933cf3ada15198fb68",
"scripts/generate_loader.py":
"e24af68efd9f8149b53225e4b07a20aa",
"5592f86f5841d24afa660c67330426d6",
"scripts/gl.xml":
"2a73a58a7e26d8676a2c0af6d528cae6",
"scripts/gl_angle_ext.xml":
......@@ -19,8 +19,6 @@
"3740eb7bd4928f17c4239ab294930469",
"src/libEGL/egl_loader_autogen.h":
"9cbf4d491497058a32642865eb032276",
"src/libOpenCL/cl_loader_autogen.cpp":
"1251dfd7f095459ff076abb02a5bbf79",
"src/tests/restricted_traces/trace_egl_loader_autogen.cpp":
"ab1ce9e72e1e248b13302349f2228a89",
"src/tests/restricted_traces/trace_egl_loader_autogen.h":
......
......@@ -10,7 +10,7 @@
"scripts/entry_point_packed_gl_enums.json":
"4f7b43863a5e61991bba4010db463679",
"scripts/generate_entry_points.py":
"ce49f151aac3d4a163686d7e45bcb03e",
"ef46ad67466c14b792ca7e9ac1cea8d7",
"scripts/gl.xml":
"2a73a58a7e26d8676a2c0af6d528cae6",
"scripts/gl_angle_ext.xml":
......@@ -130,9 +130,9 @@
"src/libGLESv2/egl_stubs_autogen.h":
"6439daa350c1663e71dd0af37dcc91df",
"src/libGLESv2/entry_points_cl_autogen.cpp":
"2c43ce51701c4499003638fa30de340e",
"2de1fb4947c632a11803a459b3fc2b25",
"src/libGLESv2/entry_points_cl_autogen.h":
"129fa7936c8bc6a20de9269da0c3c7d3",
"c53bd6b7025be98440ae9ca90161d550",
"src/libGLESv2/entry_points_egl_autogen.cpp":
"e7b708af1c8de435532058eb165d421e",
"src/libGLESv2/entry_points_egl_autogen.h":
......@@ -174,5 +174,5 @@
"src/libGLESv2/libGLESv2_with_capture_autogen.def":
"6b895f17f1a745f626a7534f14971fcd",
"src/libOpenCL/libOpenCL_autogen.cpp":
"be80b03e4d121921f4a27aba9ad16aa1"
"06d55739c92ece6b669074451634b106"
}
\ No newline at end of file
......@@ -58,9 +58,7 @@ TEMPLATE_ENTRY_POINT_HEADER = """\
{includes}
extern "C" {{
{entry_points}
}} // extern "C"
#endif // {lib}_ENTRY_POINTS_{annotation_upper}_AUTOGEN_H_
"""
......@@ -78,9 +76,7 @@ TEMPLATE_ENTRY_POINT_SOURCE = """\
{includes}
extern "C" {{
{entry_points}
}} // extern "C"
"""
TEMPLATE_ENTRY_POINTS_ENUM_HEADER = """\
......@@ -159,7 +155,7 @@ extern "C" {{
}} // extern "C"
"""
TEMPLATE_ENTRY_POINT_DECL = """ANGLE_EXPORT {return_type} {export_def} {name}{explicit_context_suffix}({explicit_context_param}{explicit_context_comma}{params});"""
TEMPLATE_ENTRY_POINT_DECL = """{angle_export}{return_type} {export_def} {name}{explicit_context_suffix}({explicit_context_param}{explicit_context_comma}{params});"""
TEMPLATE_GLES_ENTRY_POINT_NO_RETURN = """\
void GL_APIENTRY GL_{name}{explicit_context_suffix}({explicit_context_param}{explicit_context_comma}{params})
......@@ -247,7 +243,7 @@ TEMPLATE_EGL_ENTRY_POINT_WITH_RETURN = """\
"""
TEMPLATE_CL_ENTRY_POINT_NO_RETURN = """\
void CL_API_CALL CL_{name}({params})
void CL_API_CALL cl{name}({params})
{{
CL_EVENT({name}, "{format_params}"{comma_if_needed}{pass_params});
......@@ -260,7 +256,7 @@ void CL_API_CALL CL_{name}({params})
"""
TEMPLATE_CL_ENTRY_POINT_WITH_RETURN_ERROR = """\
cl_int CL_API_CALL CL_{name}({params})
cl_int CL_API_CALL cl{name}({params})
{{
CL_EVENT({name}, "{format_params}"{comma_if_needed}{pass_params});
......@@ -268,12 +264,12 @@ cl_int CL_API_CALL CL_{name}({params})
ANGLE_CL_VALIDATE_ERROR({name}{comma_if_needed}{internal_params});
return {return_cast}({name}({internal_params}));
return {name}({internal_params});
}}
"""
TEMPLATE_CL_ENTRY_POINT_WITH_RETURN_POINTER = """\
{return_type} CL_API_CALL CL_{name}({params})
{return_type} CL_API_CALL cl{name}({params})
{{
CL_EVENT({name}, "{format_params}"{comma_if_needed}{pass_params});
......@@ -281,7 +277,7 @@ TEMPLATE_CL_ENTRY_POINT_WITH_RETURN_POINTER = """\
ANGLE_CL_VALIDATE_POINTER({name}{comma_if_needed}{internal_params});
return {return_cast}({name}({internal_params}));
return {name}({internal_params});
}}
"""
......@@ -373,8 +369,7 @@ CONTEXT_DECL_FORMAT = """ {return_type} {name_lower_no_suffix}({internal_para
TEMPLATE_CL_ENTRY_POINT_EXPORT = """\
{return_type} CL_API_CALL cl{name}({params})
{{
EnsureCLLoaded();
return cl_loader.cl{name}({internal_params});
return cl::GetDispatch().cl{name}({internal_params});
}}
"""
......@@ -875,50 +870,8 @@ EGL_EXT_SOURCE_INCLUDES = """\
using namespace egl;
"""
LIBCL_EXPORT_INCLUDES_AND_PREAMBLE = """
#include "cl_loader.h"
#include "anglebase/no_destructor.h"
#include "common/system_utils.h"
#include <iostream>
#include <memory>
namespace
{
bool gLoaded = false;
std::unique_ptr<angle::Library> &EntryPointsLib()
{
static angle::base::NoDestructor<std::unique_ptr<angle::Library>> sEntryPointsLib;
return *sEntryPointsLib;
}
angle::GenericProc CL_API_CALL GlobalLoad(const char *symbol)
{
return reinterpret_cast<angle::GenericProc>(EntryPointsLib()->getSymbol(symbol));
}
void EnsureCLLoaded()
{
if (gLoaded)
{
return;
}
EntryPointsLib().reset(
angle::OpenSharedLibrary(ANGLE_GLESV2_LIBRARY_NAME, angle::SearchType::ApplicationDir));
angle::LoadCL(GlobalLoad);
if (!cl_loader.clGetDeviceIDs)
{
std::cerr << "Error loading CL entry points." << std::endl;
}
else
{
gLoaded = true;
}
}
} // anonymous namespace
LIBCL_EXPORT_INCLUDES = """
#include "libOpenCL/dispatch.h"
"""
LIBGLESV2_EXPORT_INCLUDES = """
......@@ -1000,23 +953,15 @@ void EnsureEGLLoaded() {}
"""
LIBCL_HEADER_INCLUDES = """\
#include "export.h"
#ifndef CL_API_ENTRY
# define CL_API_ENTRY ANGLE_EXPORT
#endif
#include "angle_cl.h"
"""
LIBCL_SOURCE_INCLUDES = """\
#include "entry_points_cl_autogen.h"
#include "cl_stubs_autogen.h"
#include "entry_points_cl_utils.h"
#include "libGLESv2/entry_points_cl_autogen.h"
#include "libANGLE/validationCL_autogen.h"
using namespace cl;
#include "libGLESv2/cl_stubs_autogen.h"
#include "libGLESv2/entry_points_cl_utils.h"
"""
TEMPLATE_EVENT_COMMENT = """\
......@@ -1292,10 +1237,18 @@ def is_aliasing_excepted(api, cmd_name):
return api == apis.GLES and cmd_name in ALIASING_EXCEPTIONS
def entry_point_export(api):
if api == apis.CL:
return ""
return "ANGLE_EXPORT "
def entry_point_prefix(api):
if api == apis.CL:
return "cl"
if api == apis.GLES:
return "GL"
return api
return "GL_"
return api + "_"
def get_api_entry_def(api):
......@@ -1320,8 +1273,9 @@ def format_entry_point_decl(api, cmd_name, proto, params, is_explicit_context):
comma_if_needed = ", " if len(params) > 0 else ""
stripped = strip_api_prefix(cmd_name)
return TEMPLATE_ENTRY_POINT_DECL.format(
angle_export=entry_point_export(api),
export_def=get_api_entry_def(api),
name="%s_%s" % (entry_point_prefix(api), stripped),
name="%s%s" % (entry_point_prefix(api), stripped),
return_type=proto[:-len(cmd_name)].strip(),
params=", ".join(params),
comma_if_needed=comma_if_needed,
......@@ -1571,7 +1525,6 @@ def format_entry_point_def(api, command_node, cmd_name, proto, params, is_explic
pass_params = [param_print_argument(command_node, param) for param in params]
format_params = [param_format_string(param) for param in params]
return_type = proto[:-len(cmd_name)].strip()
return_cast = "UnpackParam<" + return_type + ">" if return_type in packed_param_types else ""
default_return = default_return_value(cmd_name, return_type)
event_comment = TEMPLATE_EVENT_COMMENT if cmd_name in NO_EVENT_MARKER_EXCEPTIONS_LIST else ""
name_lower_no_suffix = strip_suffix(api, cmd_name[2:3].lower() + cmd_name[3:])
......@@ -1583,8 +1536,6 @@ def format_entry_point_def(api, command_node, cmd_name, proto, params, is_explic
name_lower_no_suffix,
"return_type":
return_type,
"return_cast":
return_cast,
"params":
", ".join(params),
"internal_params":
......@@ -2696,6 +2647,10 @@ def main():
all_commands_with_suffix.extend(xml.commands[version])
eps = GLEntryPoints(apis.GLES, xml, version_commands)
eps.decls.insert(0, "extern \"C\" {")
eps.decls.append("} // extern \"C\"")
eps.defs.insert(0, "extern \"C\" {")
eps.defs.append("} // extern \"C\"")
# Write the version as a comment before the first EP.
libgles_ep_exports.append("\n ; OpenGL ES %s" % comment)
......@@ -2735,8 +2690,8 @@ def main():
write_capture_source(version, validation_annotation, comment, eps.capture_methods)
# After we finish with the main entry points, we process the extensions.
extension_defs = []
extension_decls = []
extension_decls = ["extern \"C\" {"]
extension_defs = ["extern \"C\" {"]
extension_commands = []
# Accumulated validation prototypes.
......@@ -2862,8 +2817,8 @@ def main():
set([major for (major, minor) in registry_xml.DESKTOP_GL_VERSIONS])):
is_major = lambda ver: ver[0] == major_version
ver_decls = []
ver_defs = []
ver_decls = ["extern \"C\" {"]
ver_defs = ["extern \"C\" {"]
validation_protos = []
for _, minor_version in filter(is_major, registry_xml.DESKTOP_GL_VERSIONS):
......@@ -2905,6 +2860,8 @@ def main():
ver_decls += [cpp_comment] + eps.decls
ver_defs += [cpp_comment] + eps.defs
ver_decls.append("} // extern \"C\"")
ver_defs.append("} // extern \"C\"")
annotation = "GL_%d" % major_version
name = "Desktop GL %s.x" % major_version
......@@ -2924,8 +2881,8 @@ def main():
clxml = registry_xml.RegistryXML('cl.xml')
cl_validation_protos = []
cl_decls = []
cl_defs = []
cl_decls = ["namespace cl\n{"]
cl_defs = ["namespace cl\n{"]
libcl_ep_defs = []
libcl_windows_def_exports = []
cl_commands = []
......@@ -2958,6 +2915,9 @@ def main():
cl_validation_protos += [comment] + eps.validation_protos
libcl_windows_def_exports += [win_def_comment] + get_exports(clxml.commands[version])
cl_decls.append("} // namespace cl")
cl_defs.append("} // namespace cl")
write_file("cl", "CL", TEMPLATE_ENTRY_POINT_HEADER, "\n".join(cl_decls), "h",
LIBCL_HEADER_INCLUDES, "libGLESv2", "cl.xml")
write_file("cl", "CL", TEMPLATE_ENTRY_POINT_SOURCE, "\n".join(cl_defs), "cpp",
......@@ -2971,8 +2931,8 @@ def main():
eglxml = registry_xml.RegistryXML('egl.xml', 'egl_angle_ext.xml')
egl_validation_protos = []
egl_decls = []
egl_defs = []
egl_decls = ["extern \"C\" {"]
egl_defs = ["extern \"C\" {"]
libegl_ep_defs = []
libegl_windows_def_exports = []
egl_commands = []
......@@ -3005,6 +2965,9 @@ def main():
egl_validation_protos += [comment] + eps.validation_protos
libegl_windows_def_exports += [win_def_comment] + get_exports(eglxml.commands[version])
egl_decls.append("} // extern \"C\"")
egl_defs.append("} // extern \"C\"")
write_file("egl", "EGL", TEMPLATE_ENTRY_POINT_HEADER, "\n".join(egl_decls), "h",
EGL_HEADER_INCLUDES, "libGLESv2", "egl.xml")
write_file("egl", "EGL", TEMPLATE_ENTRY_POINT_SOURCE, "\n".join(egl_defs), "cpp",
......@@ -3013,8 +2976,8 @@ def main():
egl_commands, EGLEntryPoints.get_packed_enums(), EGL_PACKED_TYPES)
eglxml.AddExtensionCommands(registry_xml.supported_egl_extensions, ['egl'])
egl_ext_decls = []
egl_ext_defs = []
egl_ext_decls = ["extern \"C\" {"]
egl_ext_defs = ["extern \"C\" {"]
egl_ext_commands = []
for extension_name, ext_cmd_names in sorted(eglxml.ext_data.items()):
......@@ -3042,6 +3005,9 @@ def main():
msg = "// %s is already defined.\n" % strip_api_prefix(dupe)
egl_ext_defs.append(msg)
egl_ext_decls.append("} // extern \"C\"")
egl_ext_defs.append("} // extern \"C\"")
write_file("egl_ext", "EGL Extension", TEMPLATE_ENTRY_POINT_HEADER, "\n".join(egl_ext_decls),
"h", EGL_EXT_HEADER_INCLUDES, "libGLESv2", "egl.xml and egl_angle_ext.xml")
write_file("egl_ext", "EGL Extension", TEMPLATE_ENTRY_POINT_SOURCE, "\n".join(egl_ext_defs),
......@@ -3072,6 +3038,8 @@ def main():
wgl_commands.remove("wglUseFontOutlines")
libgl_ep_exports += get_exports(wgl_commands)
extension_decls.append("} // extern \"C\"")
extension_defs.append("} // extern \"C\"")
write_file("gles_ext", "GLES extension", TEMPLATE_ENTRY_POINT_HEADER,
"\n".join([item for item in extension_decls]), "h", GLES_EXT_HEADER_INCLUDES,
......@@ -3133,8 +3101,8 @@ def main():
write_export_files("\n".join([item for item in libegl_ep_defs]),
LIBEGL_EXPORT_INCLUDES_AND_PREAMBLE, "egl.xml and egl_angle_ext.xml",
"libEGL", "EGL")
write_export_files("\n".join([item for item in libcl_ep_defs]),
LIBCL_EXPORT_INCLUDES_AND_PREAMBLE, "cl.xml", "libOpenCL", "CL")
write_export_files("\n".join([item for item in libcl_ep_defs]), LIBCL_EXPORT_INCLUDES,
"cl.xml", "libOpenCL", "CL")
libgles_ep_exports += get_egl_exports()
......
......@@ -102,32 +102,6 @@ def write_source(data_source_name,
out.close()
def gen_libcl_loader():
xml = registry_xml.RegistryXML("cl.xml")
for major_version, minor_version in registry_xml.CL_VERSIONS:
name_prefix = "CL_VERSION_"
annotation = "%d_%d" % (major_version, minor_version)
feature_name = "%s%s" % (name_prefix, annotation)
xml.AddCommands(feature_name, annotation)
all_cmds = xml.all_cmd_names.get_all_commands()
path = os.path.join("..", "src", "libOpenCL")
source_path = registry_xml.path_to(path, "cl_loader_autogen.cpp")
with open(source_path, "w") as out:
setter = " cl_loader.%s = reinterpret_cast<cl_api_%s>(loadProc(\"CL_%s\"));"
setters = [setter % (cmd, cmd, cmd[2:]) for cmd in all_cmds]
loader_source = template_cl_loader_cpp.format(
script_name=os.path.basename(sys.argv[0]),
data_source_name="cl.xml",
set_pointers="\n".join(setters))
out.write(loader_source)
out.close()
def gen_libegl_loader():
data_source_name = "egl.xml and egl_angle_ext.xml"
......@@ -294,7 +268,6 @@ def main():
if len(sys.argv) > 1:
inputs = registry_xml.xml_inputs
outputs = [
'../src/libOpenCL/cl_loader_autogen.cpp',
'../src/libEGL/egl_loader_autogen.cpp',
'../src/libEGL/egl_loader_autogen.h',
'../util/egl_loader_autogen.cpp',
......@@ -318,7 +291,6 @@ def main():
return 1
return 0
gen_libcl_loader()
gen_libegl_loader()
gen_util_gles_and_egl_loaders()
gen_util_wgl_loader()
......@@ -418,28 +390,5 @@ void {load_fn_name}(LoadProc loadProc)
}} // namespace angle
"""
template_cl_loader_cpp = """// GENERATED FILE - DO NOT EDIT.
// Generated by {script_name} using data from {data_source_name}.
//
// Copyright 2021 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// cl_loader_autogen.cpp:
// Simple CL function loader.
#include "cl_loader.h"
cl_icd_dispatch cl_loader;
namespace angle
{{
void LoadCL(LoadProc loadProc)
{{
{set_pointers}
}}
}} // namespace angle
"""
if __name__ == '__main__':
sys.exit(main())
......@@ -3,12 +3,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CLCommandQueue.cpp: Implements the cl::CommandQueue class.
#include "libANGLE/CLCommandQueue.h"
namespace cl
{
// TODO
CommandQueue::CommandQueue(const cl_icd_dispatch &dispatch) : _cl_command_queue(dispatch) {}
} // namespace cl
......@@ -3,21 +3,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CLCommandQueue.h: Defines the cl::CommandQueue class, which can be used to queue a set of OpenCL
// operations.
#ifndef LIBANGLE_CLCOMMANDQUEUE_H_
#define LIBANGLE_CLCOMMANDQUEUE_H_
#include "libANGLE/CLtypes.h"
#include "libANGLE/CLObject.h"
namespace cl
{
class CommandQueue final
class CommandQueue final : public _cl_command_queue, public Object
{
public:
using IsCLObjectType = std::true_type;
CommandQueue(const cl_icd_dispatch &dispatch);
~CommandQueue() = default;
};
} // namespace cl
......
......@@ -3,12 +3,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CLContext.cpp: Implements the cl::Context class.
#include "libANGLE/CLContext.h"
namespace cl
{
// TODO
Context::Context(const cl_icd_dispatch &dispatch) : _cl_context(dispatch) {}
} // namespace cl
......@@ -3,21 +3,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CLContext.h: Defines the cl::Context class, which manages OpenCL objects such as command-queues,
// memory, program and kernel objects and for executing kernels on one or more devices.
#ifndef LIBANGLE_CLCONTEXT_H_
#define LIBANGLE_CLCONTEXT_H_
#include "libANGLE/CLtypes.h"
#include "libANGLE/CLObject.h"
namespace cl
{
class Context final
class Context final : public _cl_context, public Object
{
public:
using IsCLObjectType = std::true_type;
Context(const cl_icd_dispatch &dispatch);
~Context() = default;
};
} // namespace cl
......
......@@ -3,12 +3,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CLDevice.cpp: Implements the cl::Device class.
#include "libANGLE/CLDevice.h"
namespace cl
{
// TODO
Device::Device(const cl_icd_dispatch &dispatch) : _cl_device_id(dispatch) {}
} // namespace cl
......@@ -3,21 +3,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CLDevice.h: Defines the cl::Device class, which provides information about OpenCL device
// configurations.
#ifndef LIBANGLE_CLDEVICE_H_
#define LIBANGLE_CLDEVICE_H_
#include "libANGLE/CLtypes.h"
#include "libANGLE/CLObject.h"
namespace cl
{
class Device final
class Device final : public _cl_device_id, public Object
{
public:
using IsCLObjectType = std::true_type;
Device(const cl_icd_dispatch &dispatch);
~Device() = default;
};
} // namespace cl
......
......@@ -3,12 +3,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CLEvent.cpp: Implements the cl::Event class.
#include "libANGLE/CLEvent.h"
namespace cl
{
// TODO
Event::Event(const cl_icd_dispatch &dispatch) : _cl_event(dispatch) {}
} // namespace cl
......@@ -3,21 +3,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CLEvent.h: Defines the cl::Event class, which can be used to track the execution status of an
// OpenCL command.
#ifndef LIBANGLE_CLEVENT_H_
#define LIBANGLE_CLEVENT_H_
#include "libANGLE/CLtypes.h"
#include "libANGLE/CLObject.h"
namespace cl
{
class Event final
class Event final : public _cl_event, public Object
{
public:
using IsCLObjectType = std::true_type;
Event(const cl_icd_dispatch &dispatch);
~Event() = default;
};
} // namespace cl
......
......@@ -3,12 +3,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CLKernel.cpp: Implements the cl::Kernel class.
#include "libANGLE/CLKernel.h"
namespace cl
{
// TODO
Kernel::Kernel(const cl_icd_dispatch &dispatch) : _cl_kernel(dispatch) {}
} // namespace cl
......@@ -3,20 +3,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CLKernel.h: Defines the cl::Kernel class, which is a function declared in an OpenCL program.
#ifndef LIBANGLE_CLKERNEL_H_
#define LIBANGLE_CLKERNEL_H_
#include "libANGLE/CLtypes.h"
#include "libANGLE/CLObject.h"
namespace cl
{
class Kernel final
class Kernel final : public _cl_kernel, public Object
{
public:
using IsCLObjectType = std::true_type;
Kernel(const cl_icd_dispatch &dispatch);
~Kernel() = default;
};
} // namespace cl
......
......@@ -3,12 +3,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CLMemory.cpp: Implements the cl::Memory class.
#include "libANGLE/CLMemory.h"
namespace cl
{
// TODO
Memory::Memory(const cl_icd_dispatch &dispatch) : _cl_mem(dispatch) {}
} // namespace cl
......@@ -3,21 +3,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CLMemory.h: Defines the cl::Memory class, which is a memory object and represents OpenCL objects
// such as buffers, images and pipes.
#ifndef LIBANGLE_CLMEMORY_H_
#define LIBANGLE_CLMEMORY_H_
#include "libANGLE/CLtypes.h"
#include "libANGLE/CLObject.h"
namespace cl
{
class Memory final
class Memory final : public _cl_mem, public Object
{
public:
using IsCLObjectType = std::true_type;
Memory(const cl_icd_dispatch &dispatch);
~Memory() = default;
};
} // namespace cl
......
//
// Copyright 2021 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CLObject.h: Defines the cl::Object class, which is the base class of all ANGLE CL objects.
#ifndef LIBANGLE_CLOBJECT_H_
#define LIBANGLE_CLOBJECT_H_
#include "libANGLE/CLtypes.h"
namespace cl
{
class Object
{
public:
constexpr Object() {}
~Object() = default;
};
} // namespace cl
#endif // LIBANGLE_CLCONTEXT_H_
......@@ -3,12 +3,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CLPlatform.cpp: Implements the cl::Platform class.
#include "libANGLE/CLPlatform.h"
namespace cl
{
// TODO
Platform::Platform(const cl_icd_dispatch &dispatch) : _cl_platform_id(dispatch) {}
} // namespace cl
......@@ -3,21 +3,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CLPlatform.h: Defines the cl::Platform class, which provides information about platform-specific
// OpenCL features.
#ifndef LIBANGLE_CLPLATFORM_H_
#define LIBANGLE_CLPLATFORM_H_
#include "libANGLE/CLtypes.h"
#include "libANGLE/CLObject.h"
namespace cl
{
class Platform final
class Platform final : public _cl_platform_id, public Object
{
public:
using IsCLObjectType = std::true_type;
Platform(const cl_icd_dispatch &dispatch);
~Platform() = default;
};
} // namespace cl
......
......@@ -3,12 +3,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CLProgram.cpp: Implements the cl::Program class.
#include "libANGLE/CLProgram.h"
namespace cl
{
// TODO
Program::Program(const cl_icd_dispatch &dispatch) : _cl_program(dispatch) {}
} // namespace cl
......@@ -3,20 +3,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CLProgram.h: Defines the cl::Program class, which consists of a set of OpenCL kernels.
#ifndef LIBANGLE_CLPROGRAM_H_
#define LIBANGLE_CLPROGRAM_H_
#include "libANGLE/CLtypes.h"
#include "libANGLE/CLObject.h"
namespace cl
{
class Program final
class Program final : public _cl_program, public Object
{
public:
using IsCLObjectType = std::true_type;
Program(const cl_icd_dispatch &dispatch);
~Program() = default;
};
} // namespace cl
......
......@@ -3,12 +3,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CLSampler.cpp: Implements the cl::Sampler class.
#include "libANGLE/CLSampler.h"
namespace cl
{
// TODO
Sampler::Sampler(const cl_icd_dispatch &dispatch) : _cl_sampler(dispatch) {}
} // namespace cl
......@@ -3,20 +3,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CLSampler.h: Defines the cl::Sampler class, which describes how to sample an OpenCL Image.
#ifndef LIBANGLE_CLSAMPLER_H_
#define LIBANGLE_CLSAMPLER_H_
#include "libANGLE/CLtypes.h"
#include "libANGLE/CLObject.h"
namespace cl
{
class Sampler final
class Sampler final : public _cl_sampler, public Object
{
public:
using IsCLObjectType = std::true_type;
Sampler(const cl_icd_dispatch &dispatch);
~Sampler() = default;
};
} // namespace cl
......
......@@ -3,7 +3,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CLtypes.h: Defines common types for the OpenCL support in ANGLE.
#ifndef LIBANGLE_CLTYPES_H_
......@@ -11,7 +10,7 @@
#include "angle_cl.h"
#include <type_traits>
#include <memory>
namespace cl
{
......@@ -21,6 +20,7 @@ class Device;
class Event;
class Kernel;
class Memory;
class Object;
class Platform;
class Program;
class Sampler;
......
......@@ -11,8 +11,6 @@ libangle_common_sources = [
"src/common/MemoryBuffer.cpp",
"src/common/MemoryBuffer.h",
"src/common/Optional.h",
"src/common/PackedCLEnums_autogen.cpp",
"src/common/PackedCLEnums_autogen.h",
"src/common/PackedEGLEnums_autogen.cpp",
"src/common/PackedEGLEnums_autogen.h",
"src/common/PackedEnums.cpp",
......@@ -67,6 +65,11 @@ libangle_common_sources = [
"src/common/vector_utils.h",
]
libangle_common_cl_sources = [
"src/common/PackedCLEnums_autogen.cpp",
"src/common/PackedCLEnums_autogen.h",
]
xxhash_sources = [
"src/common/third_party/xxhash/xxhash.c",
"src/common/third_party/xxhash/xxhash.h",
......@@ -456,6 +459,7 @@ libangle_cl_headers = [
"src/libANGLE/CLEvent.h",
"src/libANGLE/CLKernel.h",
"src/libANGLE/CLMemory.h",
"src/libANGLE/CLObject.h",
"src/libANGLE/CLPlatform.h",
"src/libANGLE/CLProgram.h",
"src/libANGLE/CLSampler.h",
......@@ -577,6 +581,8 @@ libglesv2_sources = [
]
libglesv2_cl_sources = [
"src/libGLESv2/cl_dispatch_table.cpp",
"src/libGLESv2/cl_dispatch_table.h",
"src/libGLESv2/cl_stubs.cpp",
"src/libGLESv2/cl_stubs_autogen.h",
"src/libGLESv2/entry_points_cl_autogen.cpp",
......
//
// Copyright 2021 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// cl_dispatch_table_autogen.cpp: Dispatch table for CL ICD Loader.
#include "libGLESv2/cl_dispatch_table.h"
#include "libGLESv2/entry_points_cl_autogen.h"
// clang-format off
// The correct order is required as defined in 'include/CL/cl_icd.h'.
cl_icd_dispatch gCLIcdDispatchTable = {
// OpenCL 1.0
cl::clGetPlatformIDs,
cl::clGetPlatformInfo,
cl::clGetDeviceIDs,
cl::clGetDeviceInfo,
cl::clCreateContext,
cl::clCreateContextFromType,
cl::clRetainContext,
cl::clReleaseContext,
cl::clGetContextInfo,
cl::clCreateCommandQueue,
cl::clRetainCommandQueue,
cl::clReleaseCommandQueue,
cl::clGetCommandQueueInfo,
cl::clSetCommandQueueProperty,
cl::clCreateBuffer,
cl::clCreateImage2D,
cl::clCreateImage3D,
cl::clRetainMemObject,
cl::clReleaseMemObject,
cl::clGetSupportedImageFormats,
cl::clGetMemObjectInfo,
cl::clGetImageInfo,
cl::clCreateSampler,
cl::clRetainSampler,
cl::clReleaseSampler,
cl::clGetSamplerInfo,
cl::clCreateProgramWithSource,
cl::clCreateProgramWithBinary,
cl::clRetainProgram,
cl::clReleaseProgram,
cl::clBuildProgram,
cl::clUnloadCompiler,
cl::clGetProgramInfo,
cl::clGetProgramBuildInfo,
cl::clCreateKernel,
cl::clCreateKernelsInProgram,
cl::clRetainKernel,
cl::clReleaseKernel,
cl::clSetKernelArg,
cl::clGetKernelInfo,
cl::clGetKernelWorkGroupInfo,
cl::clWaitForEvents,
cl::clGetEventInfo,
cl::clRetainEvent,
cl::clReleaseEvent,
cl::clGetEventProfilingInfo,
cl::clFlush,
cl::clFinish,
cl::clEnqueueReadBuffer,
cl::clEnqueueWriteBuffer,
cl::clEnqueueCopyBuffer,
cl::clEnqueueReadImage,
cl::clEnqueueWriteImage,
cl::clEnqueueCopyImage,
cl::clEnqueueCopyImageToBuffer,
cl::clEnqueueCopyBufferToImage,
cl::clEnqueueMapBuffer,
cl::clEnqueueMapImage,
cl::clEnqueueUnmapMemObject,
cl::clEnqueueNDRangeKernel,
cl::clEnqueueTask,
cl::clEnqueueNativeKernel,
cl::clEnqueueMarker,
cl::clEnqueueWaitForEvents,
cl::clEnqueueBarrier,
cl::clGetExtensionFunctionAddress,
nullptr, // clCreateFromGLBuffer,
nullptr, // clCreateFromGLTexture2D,
nullptr, // clCreateFromGLTexture3D,
nullptr, // clCreateFromGLRenderbuffer,
nullptr, // clGetGLObjectInfo,
nullptr, // clGetGLTextureInfo,
nullptr, // clEnqueueAcquireGLObjects,
nullptr, // clEnqueueReleaseGLObjects,
nullptr, // clGetGLContextInfoKHR,
// cl_khr_d3d10_sharing
nullptr, // clGetDeviceIDsFromD3D10KHR,
nullptr, // clCreateFromD3D10BufferKHR,
nullptr, // clCreateFromD3D10Texture2DKHR,
nullptr, // clCreateFromD3D10Texture3DKHR,
nullptr, // clEnqueueAcquireD3D10ObjectsKHR,
nullptr, // clEnqueueReleaseD3D10ObjectsKHR,
// OpenCL 1.1
cl::clSetEventCallback,
cl::clCreateSubBuffer,
cl::clSetMemObjectDestructorCallback,
cl::clCreateUserEvent,
cl::clSetUserEventStatus,
cl::clEnqueueReadBufferRect,
cl::clEnqueueWriteBufferRect,
cl::clEnqueueCopyBufferRect,
// cl_ext_device_fission
nullptr, // clCreateSubDevicesEXT,
nullptr, // clRetainDeviceEXT,
nullptr, // clReleaseDeviceEXT,
// cl_khr_gl_event
nullptr, // clCreateEventFromGLsyncKHR,
// OpenCL 1.2
cl::clCreateSubDevices,
cl::clRetainDevice,
cl::clReleaseDevice,
cl::clCreateImage,
cl::clCreateProgramWithBuiltInKernels,
cl::clCompileProgram,
cl::clLinkProgram,
cl::clUnloadPlatformCompiler,
cl::clGetKernelArgInfo,
cl::clEnqueueFillBuffer,
cl::clEnqueueFillImage,
cl::clEnqueueMigrateMemObjects,
cl::clEnqueueMarkerWithWaitList,
cl::clEnqueueBarrierWithWaitList,
cl::clGetExtensionFunctionAddressForPlatform,
nullptr, // clCreateFromGLTexture,
// cl_khr_d3d11_sharing
nullptr, // clGetDeviceIDsFromD3D11KHR,
nullptr, // clCreateFromD3D11BufferKHR,
nullptr, // clCreateFromD3D11Texture2DKHR,
nullptr, // clCreateFromD3D11Texture3DKHR,
nullptr, // clCreateFromDX9MediaSurfaceKHR,
nullptr, // clEnqueueAcquireD3D11ObjectsKHR,
nullptr, // clEnqueueReleaseD3D11ObjectsKHR,
// cl_khr_dx9_media_sharing
nullptr, // clGetDeviceIDsFromDX9MediaAdapterKHR,
nullptr, // clEnqueueAcquireDX9MediaSurfacesKHR,
nullptr, // clEnqueueReleaseDX9MediaSurfacesKHR,
// cl_khr_egl_image
nullptr, // clCreateFromEGLImageKHR,
nullptr, // clEnqueueAcquireEGLObjectsKHR,
nullptr, // clEnqueueReleaseEGLObjectsKHR,
// cl_khr_egl_event
nullptr, // clCreateEventFromEGLSyncKHR,
// OpenCL 2.0
cl::clCreateCommandQueueWithProperties,
cl::clCreatePipe,
cl::clGetPipeInfo,
cl::clSVMAlloc,
cl::clSVMFree,
cl::clEnqueueSVMFree,
cl::clEnqueueSVMMemcpy,
cl::clEnqueueSVMMemFill,
cl::clEnqueueSVMMap,
cl::clEnqueueSVMUnmap,
cl::clCreateSamplerWithProperties,
cl::clSetKernelArgSVMPointer,
cl::clSetKernelExecInfo,
// cl_khr_sub_groups
nullptr, // clGetKernelSubGroupInfoKHR,
// OpenCL 2.1
cl::clCloneKernel,
cl::clCreateProgramWithIL,
cl::clEnqueueSVMMigrateMem,
cl::clGetDeviceAndHostTimer,
cl::clGetHostTimer,
cl::clGetKernelSubGroupInfo,
cl::clSetDefaultDeviceCommandQueue,
// OpenCL 2.2
cl::clSetProgramReleaseCallback,
cl::clSetProgramSpecializationConstant,
// OpenCL 3.0
cl::clCreateBufferWithProperties,
cl::clCreateImageWithProperties,
cl::clSetContextDestructorCallback
};
// clang-format on
//
// Copyright 2021 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// cl_dispatch_table.h: Declares dispatch table for CL ICD Loader.
#ifndef LIBGLESV2_CL_DISPATCH_TABLE_H_
#define LIBGLESV2_CL_DISPATCH_TABLE_H_
#include "angle_cl.h"
#include "export.h"
extern "C" {
ANGLE_EXPORT extern cl_icd_dispatch gCLIcdDispatchTable;
} // extern "C"
#endif // LIBGLESV2_CL_DISPATCH_TABLE_H_
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -11,611 +11,603 @@
#ifndef LIBGLESV2_ENTRY_POINTS_CL_AUTOGEN_H_
#define LIBGLESV2_ENTRY_POINTS_CL_AUTOGEN_H_
#include "export.h"
#ifndef CL_API_ENTRY
# define CL_API_ENTRY ANGLE_EXPORT
#endif
#include "angle_cl.h"
extern "C" {
namespace cl
{
// CL 1.0
ANGLE_EXPORT cl_int CL_API_CALL CL_GetPlatformIDs(cl_uint num_entries,
cl_platform_id *platforms,
cl_uint *num_platforms);
ANGLE_EXPORT cl_int CL_API_CALL CL_GetPlatformInfo(cl_platform_id platform,
cl_platform_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret);
ANGLE_EXPORT cl_int CL_API_CALL CL_GetDeviceIDs(cl_platform_id platform,
cl_device_type device_type,
cl_uint num_entries,
cl_device_id *devices,
cl_uint *num_devices);
ANGLE_EXPORT cl_int CL_API_CALL CL_GetDeviceInfo(cl_device_id device,
cl_device_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret);
ANGLE_EXPORT cl_context CL_API_CALL
CL_CreateContext(const cl_context_properties *properties,
cl_uint num_devices,
const cl_device_id *devices,
void(CL_CALLBACK *pfn_notify)(const char *errinfo,
const void *private_info,
size_t cb,
void *user_data),
void *user_data,
cl_int *errcode_ret);
ANGLE_EXPORT cl_context CL_API_CALL
CL_CreateContextFromType(const cl_context_properties *properties,
cl_device_type device_type,
void(CL_CALLBACK *pfn_notify)(const char *errinfo,
const void *private_info,
size_t cb,
void *user_data),
void *user_data,
cl_int *errcode_ret);
ANGLE_EXPORT cl_int CL_API_CALL CL_RetainContext(cl_context context);
ANGLE_EXPORT cl_int CL_API_CALL CL_ReleaseContext(cl_context context);
ANGLE_EXPORT cl_int CL_API_CALL CL_GetContextInfo(cl_context context,
cl_context_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret);
ANGLE_EXPORT cl_int CL_API_CALL CL_RetainCommandQueue(cl_command_queue command_queue);
ANGLE_EXPORT cl_int CL_API_CALL CL_ReleaseCommandQueue(cl_command_queue command_queue);
ANGLE_EXPORT cl_int CL_API_CALL CL_GetCommandQueueInfo(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);
ANGLE_EXPORT cl_mem CL_API_CALL CL_CreateBuffer(cl_context context,
cl_mem_flags flags,
size_t size,
void *host_ptr,
cl_int *errcode_ret);
ANGLE_EXPORT cl_int CL_API_CALL CL_RetainMemObject(cl_mem memobj);
ANGLE_EXPORT cl_int CL_API_CALL CL_ReleaseMemObject(cl_mem memobj);
ANGLE_EXPORT cl_int CL_API_CALL CL_GetSupportedImageFormats(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);
ANGLE_EXPORT cl_int CL_API_CALL CL_GetMemObjectInfo(cl_mem memobj,
cl_mem_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret);
ANGLE_EXPORT cl_int CL_API_CALL CL_GetImageInfo(cl_mem image,
cl_image_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret);
ANGLE_EXPORT cl_int CL_API_CALL CL_RetainSampler(cl_sampler sampler);
ANGLE_EXPORT cl_int CL_API_CALL CL_ReleaseSampler(cl_sampler sampler);
ANGLE_EXPORT cl_int CL_API_CALL CL_GetSamplerInfo(cl_sampler sampler,
cl_sampler_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret);
ANGLE_EXPORT cl_program CL_API_CALL CL_CreateProgramWithSource(cl_context context,
cl_uint count,
const char **strings,
const size_t *lengths,
cl_int *errcode_ret);
ANGLE_EXPORT cl_program CL_API_CALL CL_CreateProgramWithBinary(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);
ANGLE_EXPORT cl_int CL_API_CALL CL_RetainProgram(cl_program program);
ANGLE_EXPORT cl_int CL_API_CALL CL_ReleaseProgram(cl_program program);
ANGLE_EXPORT cl_int CL_API_CALL CL_BuildProgram(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);
ANGLE_EXPORT cl_int CL_API_CALL CL_GetProgramInfo(cl_program program,
cl_program_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret);
ANGLE_EXPORT cl_int CL_API_CALL CL_GetProgramBuildInfo(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);
ANGLE_EXPORT cl_kernel CL_API_CALL CL_CreateKernel(cl_program program,
const char *kernel_name,
cl_int *errcode_ret);
ANGLE_EXPORT cl_int CL_API_CALL CL_CreateKernelsInProgram(cl_program program,
cl_uint num_kernels,
cl_kernel *kernels,
cl_uint *num_kernels_ret);
ANGLE_EXPORT cl_int CL_API_CALL CL_RetainKernel(cl_kernel kernel);
ANGLE_EXPORT cl_int CL_API_CALL CL_ReleaseKernel(cl_kernel kernel);
ANGLE_EXPORT cl_int CL_API_CALL CL_SetKernelArg(cl_kernel kernel,
cl_uint arg_index,
size_t arg_size,
const void *arg_value);
ANGLE_EXPORT cl_int CL_API_CALL CL_GetKernelInfo(cl_kernel kernel,
cl_kernel_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret);
ANGLE_EXPORT cl_int CL_API_CALL CL_GetKernelWorkGroupInfo(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);
ANGLE_EXPORT cl_int CL_API_CALL CL_WaitForEvents(cl_uint num_events, const cl_event *event_list);
ANGLE_EXPORT cl_int CL_API_CALL CL_GetEventInfo(cl_event event,
cl_event_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret);
ANGLE_EXPORT cl_int CL_API_CALL CL_RetainEvent(cl_event event);
ANGLE_EXPORT cl_int CL_API_CALL CL_ReleaseEvent(cl_event event);
ANGLE_EXPORT cl_int CL_API_CALL CL_GetEventProfilingInfo(cl_event event,
cl_profiling_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret);
ANGLE_EXPORT cl_int CL_API_CALL CL_Flush(cl_command_queue command_queue);
ANGLE_EXPORT cl_int CL_API_CALL CL_Finish(cl_command_queue command_queue);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueReadBuffer(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);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueWriteBuffer(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);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueCopyBuffer(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);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueReadImage(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);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueWriteImage(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);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueCopyImage(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);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueCopyImageToBuffer(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);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueCopyBufferToImage(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);
ANGLE_EXPORT void *CL_API_CALL CL_EnqueueMapBuffer(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);
ANGLE_EXPORT void *CL_API_CALL CL_EnqueueMapImage(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);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueUnmapMemObject(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);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueNDRangeKernel(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);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueNativeKernel(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);
ANGLE_EXPORT cl_int CL_API_CALL
CL_SetCommandQueueProperty(cl_command_queue command_queue,
cl_command_queue_properties properties,
cl_bool enable,
cl_command_queue_properties *old_properties);
ANGLE_EXPORT cl_mem CL_API_CALL CL_CreateImage2D(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 CL_API_CALL clGetPlatformIDs(cl_uint num_entries,
cl_platform_id *platforms,
cl_uint *num_platforms);
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);
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);
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);
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 *errinfo,
const void *private_info,
size_t cb,
void *user_data),
void *user_data,
cl_int *errcode_ret);
cl_context CL_API_CALL
clCreateContextFromType(const cl_context_properties *properties,
cl_device_type device_type,
void(CL_CALLBACK *pfn_notify)(const char *errinfo,
const void *private_info,
size_t cb,
void *user_data),
void *user_data,
cl_int *errcode_ret);
cl_int CL_API_CALL clRetainContext(cl_context context);
cl_int CL_API_CALL clReleaseContext(cl_context context);
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);
cl_int CL_API_CALL clRetainCommandQueue(cl_command_queue command_queue);
cl_int CL_API_CALL clReleaseCommandQueue(cl_command_queue command_queue);
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);
cl_mem CL_API_CALL clCreateBuffer(cl_context context,
cl_mem_flags flags,
size_t size,
void *host_ptr,
cl_int *errcode_ret);
cl_int CL_API_CALL clRetainMemObject(cl_mem memobj);
cl_int CL_API_CALL clReleaseMemObject(cl_mem memobj);
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);
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);
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);
cl_int CL_API_CALL clRetainSampler(cl_sampler sampler);
cl_int CL_API_CALL clReleaseSampler(cl_sampler sampler);
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);
cl_program CL_API_CALL clCreateProgramWithSource(cl_context context,
cl_uint count,
const char **strings,
const size_t *lengths,
cl_int *errcode_ret);
ANGLE_EXPORT cl_mem CL_API_CALL CL_CreateImage3D(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_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);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueMarker(cl_command_queue command_queue, cl_event *event);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueWaitForEvents(cl_command_queue command_queue,
cl_uint num_events,
const cl_event *event_list);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueBarrier(cl_command_queue command_queue);
ANGLE_EXPORT cl_int CL_API_CALL CL_UnloadCompiler();
ANGLE_EXPORT void *CL_API_CALL CL_GetExtensionFunctionAddress(const char *func_name);
ANGLE_EXPORT cl_command_queue CL_API_CALL
CL_CreateCommandQueue(cl_context context,
cl_device_id device,
cl_command_queue_properties properties,
cl_int *errcode_ret);
ANGLE_EXPORT cl_sampler CL_API_CALL CL_CreateSampler(cl_context context,
cl_bool normalized_coords,
cl_addressing_mode addressing_mode,
cl_filter_mode filter_mode,
cl_int *errcode_ret);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueTask(cl_command_queue command_queue,
cl_kernel kernel,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event);
cl_int CL_API_CALL clRetainProgram(cl_program program);
cl_int CL_API_CALL clReleaseProgram(cl_program program);
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);
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);
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);
cl_kernel CL_API_CALL clCreateKernel(cl_program program,
const char *kernel_name,
cl_int *errcode_ret);
cl_int CL_API_CALL clCreateKernelsInProgram(cl_program program,
cl_uint num_kernels,
cl_kernel *kernels,
cl_uint *num_kernels_ret);
cl_int CL_API_CALL clRetainKernel(cl_kernel kernel);
cl_int CL_API_CALL clReleaseKernel(cl_kernel kernel);
cl_int CL_API_CALL clSetKernelArg(cl_kernel kernel,
cl_uint arg_index,
size_t arg_size,
const void *arg_value);
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);
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);
cl_int CL_API_CALL clWaitForEvents(cl_uint num_events, const cl_event *event_list);
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);
cl_int CL_API_CALL clRetainEvent(cl_event event);
cl_int CL_API_CALL clReleaseEvent(cl_event event);
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);
cl_int CL_API_CALL clFlush(cl_command_queue command_queue);
cl_int CL_API_CALL clFinish(cl_command_queue command_queue);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
cl_int CL_API_CALL clSetCommandQueueProperty(cl_command_queue command_queue,
cl_command_queue_properties properties,
cl_bool enable,
cl_command_queue_properties *old_properties);
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);
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);
cl_int CL_API_CALL clEnqueueMarker(cl_command_queue command_queue, cl_event *event);
cl_int CL_API_CALL clEnqueueWaitForEvents(cl_command_queue command_queue,
cl_uint num_events,
const cl_event *event_list);
cl_int CL_API_CALL clEnqueueBarrier(cl_command_queue command_queue);
cl_int CL_API_CALL clUnloadCompiler();
void *CL_API_CALL clGetExtensionFunctionAddress(const char *func_name);
cl_command_queue CL_API_CALL clCreateCommandQueue(cl_context context,
cl_device_id device,
cl_command_queue_properties properties,
cl_int *errcode_ret);
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);
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);
// CL 1.1
ANGLE_EXPORT cl_mem CL_API_CALL CL_CreateSubBuffer(cl_mem buffer,
cl_mem_flags flags,
cl_buffer_create_type buffer_create_type,
const void *buffer_create_info,
cl_int *errcode_ret);
ANGLE_EXPORT cl_int CL_API_CALL
CL_SetMemObjectDestructorCallback(cl_mem memobj,
void(CL_CALLBACK *pfn_notify)(cl_mem memobj, void *user_data),
void *user_data);
ANGLE_EXPORT cl_event CL_API_CALL CL_CreateUserEvent(cl_context context, cl_int *errcode_ret);
ANGLE_EXPORT cl_int CL_API_CALL CL_SetUserEventStatus(cl_event event, cl_int execution_status);
ANGLE_EXPORT cl_int CL_API_CALL CL_SetEventCallback(
cl_event event,
cl_int command_exec_callback_type,
void(CL_CALLBACK *pfn_notify)(cl_event event, cl_int event_command_status, void *user_data),
void *user_data);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueReadBufferRect(cl_command_queue command_queue,
cl_mem buffer,
cl_bool blocking_read,
const size_t *buffer_origin,
const size_t *host_origin,
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);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueWriteBufferRect(cl_command_queue command_queue,
cl_mem buffer,
cl_bool blocking_write,
const size_t *buffer_origin,
const size_t *host_origin,
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);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueCopyBufferRect(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);
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);
cl_int CL_API_CALL clSetMemObjectDestructorCallback(cl_mem memobj,
void(CL_CALLBACK *pfn_notify)(cl_mem memobj,
void *user_data),
void *user_data);
cl_event CL_API_CALL clCreateUserEvent(cl_context context, cl_int *errcode_ret);
cl_int CL_API_CALL clSetUserEventStatus(cl_event event, cl_int execution_status);
cl_int CL_API_CALL clSetEventCallback(cl_event event,
cl_int command_exec_callback_type,
void(CL_CALLBACK *pfn_notify)(cl_event event,
cl_int event_command_status,
void *user_data),
void *user_data);
cl_int CL_API_CALL clEnqueueReadBufferRect(cl_command_queue command_queue,
cl_mem buffer,
cl_bool blocking_read,
const size_t *buffer_origin,
const size_t *host_origin,
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);
cl_int CL_API_CALL clEnqueueWriteBufferRect(cl_command_queue command_queue,
cl_mem buffer,
cl_bool blocking_write,
const size_t *buffer_origin,
const size_t *host_origin,
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);
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);
// CL 1.2
ANGLE_EXPORT cl_int CL_API_CALL CL_CreateSubDevices(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);
ANGLE_EXPORT cl_int CL_API_CALL CL_RetainDevice(cl_device_id device);
ANGLE_EXPORT cl_int CL_API_CALL CL_ReleaseDevice(cl_device_id device);
ANGLE_EXPORT cl_mem CL_API_CALL CL_CreateImage(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);
ANGLE_EXPORT cl_program CL_API_CALL
CL_CreateProgramWithBuiltInKernels(cl_context context,
cl_uint num_devices,
const cl_device_id *device_list,
const char *kernel_names,
cl_int *errcode_ret);
ANGLE_EXPORT cl_int CL_API_CALL CL_CompileProgram(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);
ANGLE_EXPORT cl_program CL_API_CALL CL_LinkProgram(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);
ANGLE_EXPORT cl_int CL_API_CALL CL_UnloadPlatformCompiler(cl_platform_id platform);
ANGLE_EXPORT cl_int CL_API_CALL CL_GetKernelArgInfo(cl_kernel kernel,
cl_uint arg_index,
cl_kernel_arg_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueFillBuffer(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);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueFillImage(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);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueMigrateMemObjects(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);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueMarkerWithWaitList(cl_command_queue command_queue,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueBarrierWithWaitList(cl_command_queue command_queue,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event);
ANGLE_EXPORT void *CL_API_CALL CL_GetExtensionFunctionAddressForPlatform(cl_platform_id platform,
const char *func_name);
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);
cl_int CL_API_CALL clRetainDevice(cl_device_id device);
cl_int CL_API_CALL clReleaseDevice(cl_device_id device);
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);
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);
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);
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);
cl_int CL_API_CALL clUnloadPlatformCompiler(cl_platform_id platform);
cl_int CL_API_CALL clGetKernelArgInfo(cl_kernel kernel,
cl_uint arg_index,
cl_kernel_arg_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret);
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);
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);
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);
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);
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);
void *CL_API_CALL clGetExtensionFunctionAddressForPlatform(cl_platform_id platform,
const char *func_name);
// CL 2.0
ANGLE_EXPORT cl_command_queue CL_API_CALL
CL_CreateCommandQueueWithProperties(cl_context context,
cl_device_id device,
const cl_queue_properties *properties,
cl_int *errcode_ret);
ANGLE_EXPORT cl_mem CL_API_CALL CL_CreatePipe(cl_context context,
cl_mem_flags flags,
cl_uint pipe_packet_size,
cl_uint pipe_max_packets,
const cl_pipe_properties *properties,
cl_int *errcode_ret);
ANGLE_EXPORT cl_int CL_API_CALL CL_GetPipeInfo(cl_mem pipe,
cl_pipe_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret);
ANGLE_EXPORT void *CL_API_CALL CL_SVMAlloc(cl_context context,
cl_svm_mem_flags flags,
size_t size,
cl_uint alignment);
ANGLE_EXPORT void CL_API_CALL CL_SVMFree(cl_context context, void *svm_pointer);
ANGLE_EXPORT cl_sampler CL_API_CALL
CL_CreateSamplerWithProperties(cl_context context,
const cl_sampler_properties *sampler_properties,
cl_int *errcode_ret);
ANGLE_EXPORT cl_int CL_API_CALL CL_SetKernelArgSVMPointer(cl_kernel kernel,
cl_uint arg_index,
const void *arg_value);
ANGLE_EXPORT cl_int CL_API_CALL CL_SetKernelExecInfo(cl_kernel kernel,
cl_kernel_exec_info param_name,
size_t param_value_size,
const void *param_value);
ANGLE_EXPORT cl_int CL_API_CALL
CL_EnqueueSVMFree(cl_command_queue command_queue,
cl_uint num_svm_pointers,
void *svm_pointers[],
void(CL_CALLBACK *pfn_free_func)(cl_command_queue queue,
cl_uint num_svm_pointers,
void *svm_pointers[],
void *user_data),
void *user_data,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueSVMMemcpy(cl_command_queue command_queue,
cl_bool blocking_copy,
void *dst_ptr,
const void *src_ptr,
size_t size,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueSVMMemFill(cl_command_queue command_queue,
void *svm_ptr,
const void *pattern,
size_t pattern_size,
size_t size,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueSVMMap(cl_command_queue command_queue,
cl_bool blocking_map,
cl_map_flags flags,
void *svm_ptr,
size_t size,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueSVMUnmap(cl_command_queue command_queue,
void *svm_ptr,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event);
cl_command_queue CL_API_CALL
clCreateCommandQueueWithProperties(cl_context context,
cl_device_id device,
const cl_queue_properties *properties,
cl_int *errcode_ret);
cl_mem CL_API_CALL clCreatePipe(cl_context context,
cl_mem_flags flags,
cl_uint pipe_packet_size,
cl_uint pipe_max_packets,
const cl_pipe_properties *properties,
cl_int *errcode_ret);
cl_int CL_API_CALL clGetPipeInfo(cl_mem pipe,
cl_pipe_info param_name,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret);
void *CL_API_CALL clSVMAlloc(cl_context context,
cl_svm_mem_flags flags,
size_t size,
cl_uint alignment);
void CL_API_CALL clSVMFree(cl_context context, void *svm_pointer);
cl_sampler CL_API_CALL
clCreateSamplerWithProperties(cl_context context,
const cl_sampler_properties *sampler_properties,
cl_int *errcode_ret);
cl_int CL_API_CALL clSetKernelArgSVMPointer(cl_kernel kernel,
cl_uint arg_index,
const void *arg_value);
cl_int CL_API_CALL clSetKernelExecInfo(cl_kernel kernel,
cl_kernel_exec_info param_name,
size_t param_value_size,
const void *param_value);
cl_int CL_API_CALL clEnqueueSVMFree(cl_command_queue command_queue,
cl_uint num_svm_pointers,
void *svm_pointers[],
void(CL_CALLBACK *pfn_free_func)(cl_command_queue queue,
cl_uint num_svm_pointers,
void *svm_pointers[],
void *user_data),
void *user_data,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event);
cl_int CL_API_CALL clEnqueueSVMMemcpy(cl_command_queue command_queue,
cl_bool blocking_copy,
void *dst_ptr,
const void *src_ptr,
size_t size,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event);
cl_int CL_API_CALL clEnqueueSVMMemFill(cl_command_queue command_queue,
void *svm_ptr,
const void *pattern,
size_t pattern_size,
size_t size,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event);
cl_int CL_API_CALL clEnqueueSVMMap(cl_command_queue command_queue,
cl_bool blocking_map,
cl_map_flags flags,
void *svm_ptr,
size_t size,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event);
cl_int CL_API_CALL clEnqueueSVMUnmap(cl_command_queue command_queue,
void *svm_ptr,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event);
// CL 2.1
ANGLE_EXPORT cl_int CL_API_CALL CL_SetDefaultDeviceCommandQueue(cl_context context,
cl_device_id device,
cl_command_queue command_queue);
ANGLE_EXPORT cl_int CL_API_CALL CL_GetDeviceAndHostTimer(cl_device_id device,
cl_ulong *device_timestamp,
cl_ulong *host_timestamp);
ANGLE_EXPORT cl_int CL_API_CALL CL_GetHostTimer(cl_device_id device, cl_ulong *host_timestamp);
ANGLE_EXPORT cl_program CL_API_CALL CL_CreateProgramWithIL(cl_context context,
const void *il,
size_t length,
cl_int *errcode_ret);
ANGLE_EXPORT cl_kernel CL_API_CALL CL_CloneKernel(cl_kernel source_kernel, cl_int *errcode_ret);
ANGLE_EXPORT cl_int CL_API_CALL CL_GetKernelSubGroupInfo(cl_kernel kernel,
cl_device_id device,
cl_kernel_sub_group_info param_name,
size_t input_value_size,
const void *input_value,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret);
ANGLE_EXPORT cl_int CL_API_CALL CL_EnqueueSVMMigrateMem(cl_command_queue command_queue,
cl_uint num_svm_pointers,
const void **svm_pointers,
const size_t *sizes,
cl_mem_migration_flags flags,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event);
cl_int CL_API_CALL clSetDefaultDeviceCommandQueue(cl_context context,
cl_device_id device,
cl_command_queue command_queue);
cl_int CL_API_CALL clGetDeviceAndHostTimer(cl_device_id device,
cl_ulong *device_timestamp,
cl_ulong *host_timestamp);
cl_int CL_API_CALL clGetHostTimer(cl_device_id device, cl_ulong *host_timestamp);
cl_program CL_API_CALL clCreateProgramWithIL(cl_context context,
const void *il,
size_t length,
cl_int *errcode_ret);
cl_kernel CL_API_CALL clCloneKernel(cl_kernel source_kernel, cl_int *errcode_ret);
cl_int CL_API_CALL clGetKernelSubGroupInfo(cl_kernel kernel,
cl_device_id device,
cl_kernel_sub_group_info param_name,
size_t input_value_size,
const void *input_value,
size_t param_value_size,
void *param_value,
size_t *param_value_size_ret);
cl_int CL_API_CALL clEnqueueSVMMigrateMem(cl_command_queue command_queue,
cl_uint num_svm_pointers,
const void **svm_pointers,
const size_t *sizes,
cl_mem_migration_flags flags,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event);
// CL 2.2
ANGLE_EXPORT cl_int CL_API_CALL
CL_SetProgramReleaseCallback(cl_program program,
void(CL_CALLBACK *pfn_notify)(cl_program program, void *user_data),
void *user_data);
ANGLE_EXPORT cl_int CL_API_CALL CL_SetProgramSpecializationConstant(cl_program program,
cl_uint spec_id,
size_t spec_size,
const void *spec_value);
cl_int CL_API_CALL clSetProgramReleaseCallback(cl_program program,
void(CL_CALLBACK *pfn_notify)(cl_program program,
void *user_data),
void *user_data);
cl_int CL_API_CALL clSetProgramSpecializationConstant(cl_program program,
cl_uint spec_id,
size_t spec_size,
const void *spec_value);
// CL 3.0
ANGLE_EXPORT cl_int CL_API_CALL
CL_SetContextDestructorCallback(cl_context context,
void(CL_CALLBACK *pfn_notify)(cl_context context, void *user_data),
void *user_data);
ANGLE_EXPORT cl_mem CL_API_CALL CL_CreateBufferWithProperties(cl_context context,
const cl_mem_properties *properties,
cl_mem_flags flags,
size_t size,
void *host_ptr,
cl_int *errcode_ret);
ANGLE_EXPORT cl_mem CL_API_CALL CL_CreateImageWithProperties(cl_context context,
const cl_mem_properties *properties,
cl_mem_flags flags,
const cl_image_format *image_format,
const cl_image_desc *image_desc,
void *host_ptr,
cl_int *errcode_ret);
} // extern "C"
cl_int CL_API_CALL clSetContextDestructorCallback(cl_context context,
void(CL_CALLBACK *pfn_notify)(cl_context context,
void *user_data),
void *user_data);
cl_mem CL_API_CALL clCreateBufferWithProperties(cl_context context,
const cl_mem_properties *properties,
cl_mem_flags flags,
size_t size,
void *host_ptr,
cl_int *errcode_ret);
cl_mem CL_API_CALL clCreateImageWithProperties(cl_context context,
const cl_mem_properties *properties,
cl_mem_flags flags,
const cl_image_format *image_format,
const cl_image_desc *image_desc,
void *host_ptr,
cl_int *errcode_ret);
} // namespace cl
#endif // LIBGLESV2_ENTRY_POINTS_CL_AUTOGEN_H_
......@@ -23,6 +23,7 @@
namespace cl
{
// First case: handling packed enums.
template <typename PackedT, typename FromT>
typename std::enable_if_t<std::is_enum<PackedT>::value, PackedT> PackParam(FromT from)
......@@ -30,30 +31,16 @@ typename std::enable_if_t<std::is_enum<PackedT>::value, PackedT> PackParam(FromT
return FromCLenum<PackedT>(from);
}
// Cast CL object types to ANGLE types marked with 'using IsCLObjectType = std::true_type;'
// Cast CL object types to ANGLE CL object types
template <typename PackedT, typename FromT>
inline std::enable_if_t<
std::remove_pointer_t<std::remove_pointer_t<PackedT>>::IsCLObjectType::value,
std::is_base_of<cl::Object, std::remove_pointer_t<std::remove_pointer_t<PackedT>>>::value,
PackedT>
PackParam(FromT from)
{
return reinterpret_cast<PackedT>(from);
}
// First case: handling packed enums.
template <typename UnpackedT, typename FromT>
typename std::enable_if_t<std::is_enum<FromT>::value, UnpackedT> UnpackParam(FromT from)
{
return ToCLenum(from);
}
// Cast ANGLE types marked with 'using IsCLObjectType = std::true_type;' to CL object types
template <typename UnpackedT, typename FromT>
inline typename std::enable_if_t<std::remove_pointer_t<FromT>::IsCLObjectType::value, UnpackedT>
UnpackParam(FromT from)
{
return reinterpret_cast<UnpackedT>(from);
}
} // namespace cl
#endif // LIBGLESV2_ENTRY_POINTS_CL_UTILS_H_
......@@ -8,12 +8,12 @@ import("../../gni/angle.gni")
assert(angle_enable_cl)
angle_shared_library("OpenCL") {
angle_shared_library("OpenCL_ANGLE") {
defines = [ "LIBCL_IMPLEMENTATION" ]
sources = [
"cl_loader.h",
"cl_loader_autogen.cpp",
"dispatch.cpp",
"dispatch.h",
"libOpenCL_autogen.cpp",
]
......@@ -28,6 +28,29 @@ angle_shared_library("OpenCL") {
]
}
angle_shared_library("OpenCL_ICD_ANGLE") {
defines = [ "LIBCL_IMPLEMENTATION" ]
sources = [
"dispatch.cpp",
"dispatch.h",
"libOpenCL_ICD.cpp",
]
configs += [
"$angle_root:debug_annotations_config",
"$angle_root:library_name_config",
]
deps = [
"$angle_root:angle_common",
"$angle_root:cl_includes",
]
}
group("angle_cl") {
data_deps = [ ":OpenCL" ]
data_deps = [
":OpenCL_ANGLE",
":OpenCL_ICD_ANGLE",
]
}
// GENERATED FILE - DO NOT EDIT.
// Generated by generate_loader.py using data from cl.xml.
//
// Copyright 2021 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// cl_loader_autogen.cpp:
// Simple CL function loader.
#include "cl_loader.h"
cl_icd_dispatch cl_loader;
namespace angle
{
void LoadCL(LoadProc loadProc)
{
cl_loader.clGetPlatformIDs =
reinterpret_cast<cl_api_clGetPlatformIDs>(loadProc("CL_GetPlatformIDs"));
cl_loader.clGetPlatformInfo =
reinterpret_cast<cl_api_clGetPlatformInfo>(loadProc("CL_GetPlatformInfo"));
cl_loader.clGetDeviceIDs = reinterpret_cast<cl_api_clGetDeviceIDs>(loadProc("CL_GetDeviceIDs"));
cl_loader.clGetDeviceInfo =
reinterpret_cast<cl_api_clGetDeviceInfo>(loadProc("CL_GetDeviceInfo"));
cl_loader.clCreateContext =
reinterpret_cast<cl_api_clCreateContext>(loadProc("CL_CreateContext"));
cl_loader.clCreateContextFromType =
reinterpret_cast<cl_api_clCreateContextFromType>(loadProc("CL_CreateContextFromType"));
cl_loader.clRetainContext =
reinterpret_cast<cl_api_clRetainContext>(loadProc("CL_RetainContext"));
cl_loader.clReleaseContext =
reinterpret_cast<cl_api_clReleaseContext>(loadProc("CL_ReleaseContext"));
cl_loader.clGetContextInfo =
reinterpret_cast<cl_api_clGetContextInfo>(loadProc("CL_GetContextInfo"));
cl_loader.clRetainCommandQueue =
reinterpret_cast<cl_api_clRetainCommandQueue>(loadProc("CL_RetainCommandQueue"));
cl_loader.clReleaseCommandQueue =
reinterpret_cast<cl_api_clReleaseCommandQueue>(loadProc("CL_ReleaseCommandQueue"));
cl_loader.clGetCommandQueueInfo =
reinterpret_cast<cl_api_clGetCommandQueueInfo>(loadProc("CL_GetCommandQueueInfo"));
cl_loader.clCreateBuffer = reinterpret_cast<cl_api_clCreateBuffer>(loadProc("CL_CreateBuffer"));
cl_loader.clRetainMemObject =
reinterpret_cast<cl_api_clRetainMemObject>(loadProc("CL_RetainMemObject"));
cl_loader.clReleaseMemObject =
reinterpret_cast<cl_api_clReleaseMemObject>(loadProc("CL_ReleaseMemObject"));
cl_loader.clGetSupportedImageFormats = reinterpret_cast<cl_api_clGetSupportedImageFormats>(
loadProc("CL_GetSupportedImageFormats"));
cl_loader.clGetMemObjectInfo =
reinterpret_cast<cl_api_clGetMemObjectInfo>(loadProc("CL_GetMemObjectInfo"));
cl_loader.clGetImageInfo = reinterpret_cast<cl_api_clGetImageInfo>(loadProc("CL_GetImageInfo"));
cl_loader.clRetainSampler =
reinterpret_cast<cl_api_clRetainSampler>(loadProc("CL_RetainSampler"));
cl_loader.clReleaseSampler =
reinterpret_cast<cl_api_clReleaseSampler>(loadProc("CL_ReleaseSampler"));
cl_loader.clGetSamplerInfo =
reinterpret_cast<cl_api_clGetSamplerInfo>(loadProc("CL_GetSamplerInfo"));
cl_loader.clCreateProgramWithSource =
reinterpret_cast<cl_api_clCreateProgramWithSource>(loadProc("CL_CreateProgramWithSource"));
cl_loader.clCreateProgramWithBinary =
reinterpret_cast<cl_api_clCreateProgramWithBinary>(loadProc("CL_CreateProgramWithBinary"));
cl_loader.clRetainProgram =
reinterpret_cast<cl_api_clRetainProgram>(loadProc("CL_RetainProgram"));
cl_loader.clReleaseProgram =
reinterpret_cast<cl_api_clReleaseProgram>(loadProc("CL_ReleaseProgram"));
cl_loader.clBuildProgram = reinterpret_cast<cl_api_clBuildProgram>(loadProc("CL_BuildProgram"));
cl_loader.clGetProgramInfo =
reinterpret_cast<cl_api_clGetProgramInfo>(loadProc("CL_GetProgramInfo"));
cl_loader.clGetProgramBuildInfo =
reinterpret_cast<cl_api_clGetProgramBuildInfo>(loadProc("CL_GetProgramBuildInfo"));
cl_loader.clCreateKernel = reinterpret_cast<cl_api_clCreateKernel>(loadProc("CL_CreateKernel"));
cl_loader.clCreateKernelsInProgram =
reinterpret_cast<cl_api_clCreateKernelsInProgram>(loadProc("CL_CreateKernelsInProgram"));
cl_loader.clRetainKernel = reinterpret_cast<cl_api_clRetainKernel>(loadProc("CL_RetainKernel"));
cl_loader.clReleaseKernel =
reinterpret_cast<cl_api_clReleaseKernel>(loadProc("CL_ReleaseKernel"));
cl_loader.clSetKernelArg = reinterpret_cast<cl_api_clSetKernelArg>(loadProc("CL_SetKernelArg"));
cl_loader.clGetKernelInfo =
reinterpret_cast<cl_api_clGetKernelInfo>(loadProc("CL_GetKernelInfo"));
cl_loader.clGetKernelWorkGroupInfo =
reinterpret_cast<cl_api_clGetKernelWorkGroupInfo>(loadProc("CL_GetKernelWorkGroupInfo"));
cl_loader.clWaitForEvents =
reinterpret_cast<cl_api_clWaitForEvents>(loadProc("CL_WaitForEvents"));
cl_loader.clGetEventInfo = reinterpret_cast<cl_api_clGetEventInfo>(loadProc("CL_GetEventInfo"));
cl_loader.clRetainEvent = reinterpret_cast<cl_api_clRetainEvent>(loadProc("CL_RetainEvent"));
cl_loader.clReleaseEvent = reinterpret_cast<cl_api_clReleaseEvent>(loadProc("CL_ReleaseEvent"));
cl_loader.clGetEventProfilingInfo =
reinterpret_cast<cl_api_clGetEventProfilingInfo>(loadProc("CL_GetEventProfilingInfo"));
cl_loader.clFlush = reinterpret_cast<cl_api_clFlush>(loadProc("CL_Flush"));
cl_loader.clFinish = reinterpret_cast<cl_api_clFinish>(loadProc("CL_Finish"));
cl_loader.clEnqueueReadBuffer =
reinterpret_cast<cl_api_clEnqueueReadBuffer>(loadProc("CL_EnqueueReadBuffer"));
cl_loader.clEnqueueWriteBuffer =
reinterpret_cast<cl_api_clEnqueueWriteBuffer>(loadProc("CL_EnqueueWriteBuffer"));
cl_loader.clEnqueueCopyBuffer =
reinterpret_cast<cl_api_clEnqueueCopyBuffer>(loadProc("CL_EnqueueCopyBuffer"));
cl_loader.clEnqueueReadImage =
reinterpret_cast<cl_api_clEnqueueReadImage>(loadProc("CL_EnqueueReadImage"));
cl_loader.clEnqueueWriteImage =
reinterpret_cast<cl_api_clEnqueueWriteImage>(loadProc("CL_EnqueueWriteImage"));
cl_loader.clEnqueueCopyImage =
reinterpret_cast<cl_api_clEnqueueCopyImage>(loadProc("CL_EnqueueCopyImage"));
cl_loader.clEnqueueCopyImageToBuffer = reinterpret_cast<cl_api_clEnqueueCopyImageToBuffer>(
loadProc("CL_EnqueueCopyImageToBuffer"));
cl_loader.clEnqueueCopyBufferToImage = reinterpret_cast<cl_api_clEnqueueCopyBufferToImage>(
loadProc("CL_EnqueueCopyBufferToImage"));
cl_loader.clEnqueueMapBuffer =
reinterpret_cast<cl_api_clEnqueueMapBuffer>(loadProc("CL_EnqueueMapBuffer"));
cl_loader.clEnqueueMapImage =
reinterpret_cast<cl_api_clEnqueueMapImage>(loadProc("CL_EnqueueMapImage"));
cl_loader.clEnqueueUnmapMemObject =
reinterpret_cast<cl_api_clEnqueueUnmapMemObject>(loadProc("CL_EnqueueUnmapMemObject"));
cl_loader.clEnqueueNDRangeKernel =
reinterpret_cast<cl_api_clEnqueueNDRangeKernel>(loadProc("CL_EnqueueNDRangeKernel"));
cl_loader.clEnqueueNativeKernel =
reinterpret_cast<cl_api_clEnqueueNativeKernel>(loadProc("CL_EnqueueNativeKernel"));
cl_loader.clSetCommandQueueProperty =
reinterpret_cast<cl_api_clSetCommandQueueProperty>(loadProc("CL_SetCommandQueueProperty"));
cl_loader.clCreateImage2D =
reinterpret_cast<cl_api_clCreateImage2D>(loadProc("CL_CreateImage2D"));
cl_loader.clCreateImage3D =
reinterpret_cast<cl_api_clCreateImage3D>(loadProc("CL_CreateImage3D"));
cl_loader.clEnqueueMarker =
reinterpret_cast<cl_api_clEnqueueMarker>(loadProc("CL_EnqueueMarker"));
cl_loader.clEnqueueWaitForEvents =
reinterpret_cast<cl_api_clEnqueueWaitForEvents>(loadProc("CL_EnqueueWaitForEvents"));
cl_loader.clEnqueueBarrier =
reinterpret_cast<cl_api_clEnqueueBarrier>(loadProc("CL_EnqueueBarrier"));
cl_loader.clUnloadCompiler =
reinterpret_cast<cl_api_clUnloadCompiler>(loadProc("CL_UnloadCompiler"));
cl_loader.clGetExtensionFunctionAddress =
reinterpret_cast<cl_api_clGetExtensionFunctionAddress>(
loadProc("CL_GetExtensionFunctionAddress"));
cl_loader.clCreateCommandQueue =
reinterpret_cast<cl_api_clCreateCommandQueue>(loadProc("CL_CreateCommandQueue"));
cl_loader.clCreateSampler =
reinterpret_cast<cl_api_clCreateSampler>(loadProc("CL_CreateSampler"));
cl_loader.clEnqueueTask = reinterpret_cast<cl_api_clEnqueueTask>(loadProc("CL_EnqueueTask"));
cl_loader.clCreateSubBuffer =
reinterpret_cast<cl_api_clCreateSubBuffer>(loadProc("CL_CreateSubBuffer"));
cl_loader.clSetMemObjectDestructorCallback =
reinterpret_cast<cl_api_clSetMemObjectDestructorCallback>(
loadProc("CL_SetMemObjectDestructorCallback"));
cl_loader.clCreateUserEvent =
reinterpret_cast<cl_api_clCreateUserEvent>(loadProc("CL_CreateUserEvent"));
cl_loader.clSetUserEventStatus =
reinterpret_cast<cl_api_clSetUserEventStatus>(loadProc("CL_SetUserEventStatus"));
cl_loader.clSetEventCallback =
reinterpret_cast<cl_api_clSetEventCallback>(loadProc("CL_SetEventCallback"));
cl_loader.clEnqueueReadBufferRect =
reinterpret_cast<cl_api_clEnqueueReadBufferRect>(loadProc("CL_EnqueueReadBufferRect"));
cl_loader.clEnqueueWriteBufferRect =
reinterpret_cast<cl_api_clEnqueueWriteBufferRect>(loadProc("CL_EnqueueWriteBufferRect"));
cl_loader.clEnqueueCopyBufferRect =
reinterpret_cast<cl_api_clEnqueueCopyBufferRect>(loadProc("CL_EnqueueCopyBufferRect"));
cl_loader.clCreateSubDevices =
reinterpret_cast<cl_api_clCreateSubDevices>(loadProc("CL_CreateSubDevices"));
cl_loader.clRetainDevice = reinterpret_cast<cl_api_clRetainDevice>(loadProc("CL_RetainDevice"));
cl_loader.clReleaseDevice =
reinterpret_cast<cl_api_clReleaseDevice>(loadProc("CL_ReleaseDevice"));
cl_loader.clCreateImage = reinterpret_cast<cl_api_clCreateImage>(loadProc("CL_CreateImage"));
cl_loader.clCreateProgramWithBuiltInKernels =
reinterpret_cast<cl_api_clCreateProgramWithBuiltInKernels>(
loadProc("CL_CreateProgramWithBuiltInKernels"));
cl_loader.clCompileProgram =
reinterpret_cast<cl_api_clCompileProgram>(loadProc("CL_CompileProgram"));
cl_loader.clLinkProgram = reinterpret_cast<cl_api_clLinkProgram>(loadProc("CL_LinkProgram"));
cl_loader.clUnloadPlatformCompiler =
reinterpret_cast<cl_api_clUnloadPlatformCompiler>(loadProc("CL_UnloadPlatformCompiler"));
cl_loader.clGetKernelArgInfo =
reinterpret_cast<cl_api_clGetKernelArgInfo>(loadProc("CL_GetKernelArgInfo"));
cl_loader.clEnqueueFillBuffer =
reinterpret_cast<cl_api_clEnqueueFillBuffer>(loadProc("CL_EnqueueFillBuffer"));
cl_loader.clEnqueueFillImage =
reinterpret_cast<cl_api_clEnqueueFillImage>(loadProc("CL_EnqueueFillImage"));
cl_loader.clEnqueueMigrateMemObjects = reinterpret_cast<cl_api_clEnqueueMigrateMemObjects>(
loadProc("CL_EnqueueMigrateMemObjects"));
cl_loader.clEnqueueMarkerWithWaitList = reinterpret_cast<cl_api_clEnqueueMarkerWithWaitList>(
loadProc("CL_EnqueueMarkerWithWaitList"));
cl_loader.clEnqueueBarrierWithWaitList = reinterpret_cast<cl_api_clEnqueueBarrierWithWaitList>(
loadProc("CL_EnqueueBarrierWithWaitList"));
cl_loader.clGetExtensionFunctionAddressForPlatform =
reinterpret_cast<cl_api_clGetExtensionFunctionAddressForPlatform>(
loadProc("CL_GetExtensionFunctionAddressForPlatform"));
cl_loader.clCreateCommandQueueWithProperties =
reinterpret_cast<cl_api_clCreateCommandQueueWithProperties>(
loadProc("CL_CreateCommandQueueWithProperties"));
cl_loader.clCreatePipe = reinterpret_cast<cl_api_clCreatePipe>(loadProc("CL_CreatePipe"));
cl_loader.clGetPipeInfo = reinterpret_cast<cl_api_clGetPipeInfo>(loadProc("CL_GetPipeInfo"));
cl_loader.clSVMAlloc = reinterpret_cast<cl_api_clSVMAlloc>(loadProc("CL_SVMAlloc"));
cl_loader.clSVMFree = reinterpret_cast<cl_api_clSVMFree>(loadProc("CL_SVMFree"));
cl_loader.clCreateSamplerWithProperties =
reinterpret_cast<cl_api_clCreateSamplerWithProperties>(
loadProc("CL_CreateSamplerWithProperties"));
cl_loader.clSetKernelArgSVMPointer =
reinterpret_cast<cl_api_clSetKernelArgSVMPointer>(loadProc("CL_SetKernelArgSVMPointer"));
cl_loader.clSetKernelExecInfo =
reinterpret_cast<cl_api_clSetKernelExecInfo>(loadProc("CL_SetKernelExecInfo"));
cl_loader.clEnqueueSVMFree =
reinterpret_cast<cl_api_clEnqueueSVMFree>(loadProc("CL_EnqueueSVMFree"));
cl_loader.clEnqueueSVMMemcpy =
reinterpret_cast<cl_api_clEnqueueSVMMemcpy>(loadProc("CL_EnqueueSVMMemcpy"));
cl_loader.clEnqueueSVMMemFill =
reinterpret_cast<cl_api_clEnqueueSVMMemFill>(loadProc("CL_EnqueueSVMMemFill"));
cl_loader.clEnqueueSVMMap =
reinterpret_cast<cl_api_clEnqueueSVMMap>(loadProc("CL_EnqueueSVMMap"));
cl_loader.clEnqueueSVMUnmap =
reinterpret_cast<cl_api_clEnqueueSVMUnmap>(loadProc("CL_EnqueueSVMUnmap"));
cl_loader.clSetDefaultDeviceCommandQueue =
reinterpret_cast<cl_api_clSetDefaultDeviceCommandQueue>(
loadProc("CL_SetDefaultDeviceCommandQueue"));
cl_loader.clGetDeviceAndHostTimer =
reinterpret_cast<cl_api_clGetDeviceAndHostTimer>(loadProc("CL_GetDeviceAndHostTimer"));
cl_loader.clGetHostTimer = reinterpret_cast<cl_api_clGetHostTimer>(loadProc("CL_GetHostTimer"));
cl_loader.clCreateProgramWithIL =
reinterpret_cast<cl_api_clCreateProgramWithIL>(loadProc("CL_CreateProgramWithIL"));
cl_loader.clCloneKernel = reinterpret_cast<cl_api_clCloneKernel>(loadProc("CL_CloneKernel"));
cl_loader.clGetKernelSubGroupInfo =
reinterpret_cast<cl_api_clGetKernelSubGroupInfo>(loadProc("CL_GetKernelSubGroupInfo"));
cl_loader.clEnqueueSVMMigrateMem =
reinterpret_cast<cl_api_clEnqueueSVMMigrateMem>(loadProc("CL_EnqueueSVMMigrateMem"));
cl_loader.clSetProgramSpecializationConstant =
reinterpret_cast<cl_api_clSetProgramSpecializationConstant>(
loadProc("CL_SetProgramSpecializationConstant"));
cl_loader.clSetProgramReleaseCallback = reinterpret_cast<cl_api_clSetProgramReleaseCallback>(
loadProc("CL_SetProgramReleaseCallback"));
cl_loader.clSetContextDestructorCallback =
reinterpret_cast<cl_api_clSetContextDestructorCallback>(
loadProc("CL_SetContextDestructorCallback"));
cl_loader.clCreateBufferWithProperties = reinterpret_cast<cl_api_clCreateBufferWithProperties>(
loadProc("CL_CreateBufferWithProperties"));
cl_loader.clCreateImageWithProperties = reinterpret_cast<cl_api_clCreateImageWithProperties>(
loadProc("CL_CreateImageWithProperties"));
}
} // namespace angle
//
// Copyright 2021 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// dispatch.cpp: Implements a function to fetch the ANGLE OpenCL dispatch table.
#include "libOpenCL/dispatch.h"
#include "anglebase/no_destructor.h"
#include "common/system_utils.h"
#include <iostream>
#include <memory>
namespace cl
{
namespace
{
std::unique_ptr<angle::Library> &EntryPointsLib()
{
static angle::base::NoDestructor<std::unique_ptr<angle::Library>> sEntryPointsLib;
return *sEntryPointsLib;
}
} // anonymous namespace
cl_icd_dispatch &GetDispatch()
{
static cl_icd_dispatch *sDispatch = nullptr;
if (sDispatch == nullptr)
{
EntryPointsLib().reset(
angle::OpenSharedLibrary(ANGLE_GLESV2_LIBRARY_NAME, angle::SearchType::ApplicationDir));
if (EntryPointsLib())
{
sDispatch = reinterpret_cast<cl_icd_dispatch *>(
EntryPointsLib()->getSymbol("gCLIcdDispatchTable"));
if (sDispatch == nullptr)
{
std::cerr << "Error loading CL dispatch table." << std::endl;
}
}
else
{
std::cerr << "Error opening GLESv2 library." << std::endl;
}
}
return *sDispatch;
}
} // namespace cl
......@@ -3,11 +3,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// cl_loader.h:
// Simple CL function loader.
// dispatch.h: Declares a function to fetch the ANGLE OpenCL dispatch table.
#ifndef LIBCL_CL_LOADER_H_
#define LIBCL_CL_LOADER_H_
#ifndef LIBOPENCL_DISPATCH_H_
#define LIBOPENCL_DISPATCH_H_
#include "export.h"
......@@ -16,16 +15,11 @@
#endif
#include "angle_cl.h"
// 'angle_cl.h' has to be included before this to enable CL defines
#include "CL/cl_icd.h"
namespace cl
{
ANGLE_NO_EXPORT extern cl_icd_dispatch cl_loader;
cl_icd_dispatch &GetDispatch();
namespace angle
{
using GenericProc = void (*)();
using LoadProc = GenericProc(CL_API_CALL *)(const char *);
ANGLE_NO_EXPORT void LoadCL(LoadProc loadProc);
} // namespace angle
} // namespace cl
#endif // LIBCL_CL_LOADER_H_
#endif // LIBOPENCL_DISPATCH_H_
//
// Copyright 2021 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// libOpenCL_ICD.cpp: Implements the CL entry points required for extension cl_khr_icd.
#include "libOpenCL/dispatch.h"
extern "C" {
cl_int CL_API_CALL clIcdGetPlatformIDsKHR(cl_uint num_entries,
cl_platform_id *platforms,
cl_uint *num_platforms)
{
return cl::GetDispatch().clGetPlatformIDs(num_entries, platforms, num_platforms);
}
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)
{
return cl::GetDispatch().clGetPlatformInfo(platform, param_name, param_value_size, param_value,
param_value_size_ret);
}
void *CL_API_CALL clGetExtensionFunctionAddress(const char *func_name)
{
return cl::GetDispatch().clGetExtensionFunctionAddress(func_name);
}
} // extern "C"
......@@ -7,49 +7,7 @@
//
// libOpenCL_autogen.cpp: Implements the exported CL functions.
#include "cl_loader.h"
#include "anglebase/no_destructor.h"
#include "common/system_utils.h"
#include <iostream>
#include <memory>
namespace
{
bool gLoaded = false;
std::unique_ptr<angle::Library> &EntryPointsLib()
{
static angle::base::NoDestructor<std::unique_ptr<angle::Library>> sEntryPointsLib;
return *sEntryPointsLib;
}
angle::GenericProc CL_API_CALL GlobalLoad(const char *symbol)
{
return reinterpret_cast<angle::GenericProc>(EntryPointsLib()->getSymbol(symbol));
}
void EnsureCLLoaded()
{
if (gLoaded)
{
return;
}
EntryPointsLib().reset(
angle::OpenSharedLibrary(ANGLE_GLESV2_LIBRARY_NAME, angle::SearchType::ApplicationDir));
angle::LoadCL(GlobalLoad);
if (!cl_loader.clGetDeviceIDs)
{
std::cerr << "Error loading CL entry points." << std::endl;
}
else
{
gLoaded = true;
}
}
} // anonymous namespace
#include "libOpenCL/dispatch.h"
extern "C" {
......@@ -58,8 +16,7 @@ cl_int CL_API_CALL clGetPlatformIDs(cl_uint num_entries,
cl_platform_id *platforms,
cl_uint *num_platforms)
{
EnsureCLLoaded();
return cl_loader.clGetPlatformIDs(num_entries, platforms, num_platforms);
return cl::GetDispatch().clGetPlatformIDs(num_entries, platforms, num_platforms);
}
cl_int CL_API_CALL clGetPlatformInfo(cl_platform_id platform,
......@@ -68,9 +25,8 @@ cl_int CL_API_CALL clGetPlatformInfo(cl_platform_id platform,
void *param_value,
size_t *param_value_size_ret)
{
EnsureCLLoaded();
return cl_loader.clGetPlatformInfo(platform, param_name, param_value_size, param_value,
param_value_size_ret);
return cl::GetDispatch().clGetPlatformInfo(platform, param_name, param_value_size, param_value,
param_value_size_ret);
}
cl_int CL_API_CALL clGetDeviceIDs(cl_platform_id platform,
......@@ -79,8 +35,8 @@ cl_int CL_API_CALL clGetDeviceIDs(cl_platform_id platform,
cl_device_id *devices,
cl_uint *num_devices)
{
EnsureCLLoaded();
return cl_loader.clGetDeviceIDs(platform, device_type, num_entries, devices, num_devices);
return cl::GetDispatch().clGetDeviceIDs(platform, device_type, num_entries, devices,
num_devices);
}
cl_int CL_API_CALL clGetDeviceInfo(cl_device_id device,
......@@ -89,9 +45,8 @@ cl_int CL_API_CALL clGetDeviceInfo(cl_device_id device,
void *param_value,
size_t *param_value_size_ret)
{
EnsureCLLoaded();
return cl_loader.clGetDeviceInfo(device, param_name, param_value_size, param_value,
param_value_size_ret);
return cl::GetDispatch().clGetDeviceInfo(device, param_name, param_value_size, param_value,
param_value_size_ret);
}
cl_context CL_API_CALL clCreateContext(const cl_context_properties *properties,
......@@ -104,9 +59,8 @@ cl_context CL_API_CALL clCreateContext(const cl_context_properties *properties,
void *user_data,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clCreateContext(properties, num_devices, devices, pfn_notify, user_data,
errcode_ret);
return cl::GetDispatch().clCreateContext(properties, num_devices, devices, pfn_notify,
user_data, errcode_ret);
}
cl_context CL_API_CALL
......@@ -119,21 +73,18 @@ clCreateContextFromType(const cl_context_properties *properties,
void *user_data,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clCreateContextFromType(properties, device_type, pfn_notify, user_data,
errcode_ret);
return cl::GetDispatch().clCreateContextFromType(properties, device_type, pfn_notify, user_data,
errcode_ret);
}
cl_int CL_API_CALL clRetainContext(cl_context context)
{
EnsureCLLoaded();
return cl_loader.clRetainContext(context);
return cl::GetDispatch().clRetainContext(context);
}
cl_int CL_API_CALL clReleaseContext(cl_context context)
{
EnsureCLLoaded();
return cl_loader.clReleaseContext(context);
return cl::GetDispatch().clReleaseContext(context);
}
cl_int CL_API_CALL clGetContextInfo(cl_context context,
......@@ -142,21 +93,18 @@ cl_int CL_API_CALL clGetContextInfo(cl_context context,
void *param_value,
size_t *param_value_size_ret)
{
EnsureCLLoaded();
return cl_loader.clGetContextInfo(context, param_name, param_value_size, param_value,
param_value_size_ret);
return cl::GetDispatch().clGetContextInfo(context, param_name, param_value_size, param_value,
param_value_size_ret);
}
cl_int CL_API_CALL clRetainCommandQueue(cl_command_queue command_queue)
{
EnsureCLLoaded();
return cl_loader.clRetainCommandQueue(command_queue);
return cl::GetDispatch().clRetainCommandQueue(command_queue);
}
cl_int CL_API_CALL clReleaseCommandQueue(cl_command_queue command_queue)
{
EnsureCLLoaded();
return cl_loader.clReleaseCommandQueue(command_queue);
return cl::GetDispatch().clReleaseCommandQueue(command_queue);
}
cl_int CL_API_CALL clGetCommandQueueInfo(cl_command_queue command_queue,
......@@ -165,9 +113,8 @@ cl_int CL_API_CALL clGetCommandQueueInfo(cl_command_queue command_queue,
void *param_value,
size_t *param_value_size_ret)
{
EnsureCLLoaded();
return cl_loader.clGetCommandQueueInfo(command_queue, param_name, param_value_size, param_value,
param_value_size_ret);
return cl::GetDispatch().clGetCommandQueueInfo(command_queue, param_name, param_value_size,
param_value, param_value_size_ret);
}
cl_mem CL_API_CALL clCreateBuffer(cl_context context,
......@@ -176,20 +123,17 @@ cl_mem CL_API_CALL clCreateBuffer(cl_context context,
void *host_ptr,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clCreateBuffer(context, flags, size, host_ptr, errcode_ret);
return cl::GetDispatch().clCreateBuffer(context, flags, size, host_ptr, errcode_ret);
}
cl_int CL_API_CALL clRetainMemObject(cl_mem memobj)
{
EnsureCLLoaded();
return cl_loader.clRetainMemObject(memobj);
return cl::GetDispatch().clRetainMemObject(memobj);
}
cl_int CL_API_CALL clReleaseMemObject(cl_mem memobj)
{
EnsureCLLoaded();
return cl_loader.clReleaseMemObject(memobj);
return cl::GetDispatch().clReleaseMemObject(memobj);
}
cl_int CL_API_CALL clGetSupportedImageFormats(cl_context context,
......@@ -199,9 +143,8 @@ cl_int CL_API_CALL clGetSupportedImageFormats(cl_context context,
cl_image_format *image_formats,
cl_uint *num_image_formats)
{
EnsureCLLoaded();
return cl_loader.clGetSupportedImageFormats(context, flags, image_type, num_entries,
image_formats, num_image_formats);
return cl::GetDispatch().clGetSupportedImageFormats(context, flags, image_type, num_entries,
image_formats, num_image_formats);
}
cl_int CL_API_CALL clGetMemObjectInfo(cl_mem memobj,
......@@ -210,9 +153,8 @@ cl_int CL_API_CALL clGetMemObjectInfo(cl_mem memobj,
void *param_value,
size_t *param_value_size_ret)
{
EnsureCLLoaded();
return cl_loader.clGetMemObjectInfo(memobj, param_name, param_value_size, param_value,
param_value_size_ret);
return cl::GetDispatch().clGetMemObjectInfo(memobj, param_name, param_value_size, param_value,
param_value_size_ret);
}
cl_int CL_API_CALL clGetImageInfo(cl_mem image,
......@@ -221,21 +163,18 @@ cl_int CL_API_CALL clGetImageInfo(cl_mem image,
void *param_value,
size_t *param_value_size_ret)
{
EnsureCLLoaded();
return cl_loader.clGetImageInfo(image, param_name, param_value_size, param_value,
param_value_size_ret);
return cl::GetDispatch().clGetImageInfo(image, param_name, param_value_size, param_value,
param_value_size_ret);
}
cl_int CL_API_CALL clRetainSampler(cl_sampler sampler)
{
EnsureCLLoaded();
return cl_loader.clRetainSampler(sampler);
return cl::GetDispatch().clRetainSampler(sampler);
}
cl_int CL_API_CALL clReleaseSampler(cl_sampler sampler)
{
EnsureCLLoaded();
return cl_loader.clReleaseSampler(sampler);
return cl::GetDispatch().clReleaseSampler(sampler);
}
cl_int CL_API_CALL clGetSamplerInfo(cl_sampler sampler,
......@@ -244,9 +183,8 @@ cl_int CL_API_CALL clGetSamplerInfo(cl_sampler sampler,
void *param_value,
size_t *param_value_size_ret)
{
EnsureCLLoaded();
return cl_loader.clGetSamplerInfo(sampler, param_name, param_value_size, param_value,
param_value_size_ret);
return cl::GetDispatch().clGetSamplerInfo(sampler, param_name, param_value_size, param_value,
param_value_size_ret);
}
cl_program CL_API_CALL clCreateProgramWithSource(cl_context context,
......@@ -255,8 +193,8 @@ cl_program CL_API_CALL clCreateProgramWithSource(cl_context context,
const size_t *lengths,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clCreateProgramWithSource(context, count, strings, lengths, errcode_ret);
return cl::GetDispatch().clCreateProgramWithSource(context, count, strings, lengths,
errcode_ret);
}
cl_program CL_API_CALL clCreateProgramWithBinary(cl_context context,
......@@ -267,21 +205,18 @@ cl_program CL_API_CALL clCreateProgramWithBinary(cl_context context,
cl_int *binary_status,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clCreateProgramWithBinary(context, num_devices, device_list, lengths, binaries,
binary_status, errcode_ret);
return cl::GetDispatch().clCreateProgramWithBinary(context, num_devices, device_list, lengths,
binaries, binary_status, errcode_ret);
}
cl_int CL_API_CALL clRetainProgram(cl_program program)
{
EnsureCLLoaded();
return cl_loader.clRetainProgram(program);
return cl::GetDispatch().clRetainProgram(program);
}
cl_int CL_API_CALL clReleaseProgram(cl_program program)
{
EnsureCLLoaded();
return cl_loader.clReleaseProgram(program);
return cl::GetDispatch().clReleaseProgram(program);
}
cl_int CL_API_CALL clBuildProgram(cl_program program,
......@@ -292,9 +227,8 @@ cl_int CL_API_CALL clBuildProgram(cl_program program,
void *user_data),
void *user_data)
{
EnsureCLLoaded();
return cl_loader.clBuildProgram(program, num_devices, device_list, options, pfn_notify,
user_data);
return cl::GetDispatch().clBuildProgram(program, num_devices, device_list, options, pfn_notify,
user_data);
}
cl_int CL_API_CALL clGetProgramInfo(cl_program program,
......@@ -303,9 +237,8 @@ cl_int CL_API_CALL clGetProgramInfo(cl_program program,
void *param_value,
size_t *param_value_size_ret)
{
EnsureCLLoaded();
return cl_loader.clGetProgramInfo(program, param_name, param_value_size, param_value,
param_value_size_ret);
return cl::GetDispatch().clGetProgramInfo(program, param_name, param_value_size, param_value,
param_value_size_ret);
}
cl_int CL_API_CALL clGetProgramBuildInfo(cl_program program,
......@@ -315,17 +248,15 @@ cl_int CL_API_CALL clGetProgramBuildInfo(cl_program program,
void *param_value,
size_t *param_value_size_ret)
{
EnsureCLLoaded();
return cl_loader.clGetProgramBuildInfo(program, device, param_name, param_value_size,
param_value, param_value_size_ret);
return cl::GetDispatch().clGetProgramBuildInfo(program, device, param_name, param_value_size,
param_value, param_value_size_ret);
}
cl_kernel CL_API_CALL clCreateKernel(cl_program program,
const char *kernel_name,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clCreateKernel(program, kernel_name, errcode_ret);
return cl::GetDispatch().clCreateKernel(program, kernel_name, errcode_ret);
}
cl_int CL_API_CALL clCreateKernelsInProgram(cl_program program,
......@@ -333,20 +264,18 @@ cl_int CL_API_CALL clCreateKernelsInProgram(cl_program program,
cl_kernel *kernels,
cl_uint *num_kernels_ret)
{
EnsureCLLoaded();
return cl_loader.clCreateKernelsInProgram(program, num_kernels, kernels, num_kernels_ret);
return cl::GetDispatch().clCreateKernelsInProgram(program, num_kernels, kernels,
num_kernels_ret);
}
cl_int CL_API_CALL clRetainKernel(cl_kernel kernel)
{
EnsureCLLoaded();
return cl_loader.clRetainKernel(kernel);
return cl::GetDispatch().clRetainKernel(kernel);
}
cl_int CL_API_CALL clReleaseKernel(cl_kernel kernel)
{
EnsureCLLoaded();
return cl_loader.clReleaseKernel(kernel);
return cl::GetDispatch().clReleaseKernel(kernel);
}
cl_int CL_API_CALL clSetKernelArg(cl_kernel kernel,
......@@ -354,8 +283,7 @@ cl_int CL_API_CALL clSetKernelArg(cl_kernel kernel,
size_t arg_size,
const void *arg_value)
{
EnsureCLLoaded();
return cl_loader.clSetKernelArg(kernel, arg_index, arg_size, arg_value);
return cl::GetDispatch().clSetKernelArg(kernel, arg_index, arg_size, arg_value);
}
cl_int CL_API_CALL clGetKernelInfo(cl_kernel kernel,
......@@ -364,9 +292,8 @@ cl_int CL_API_CALL clGetKernelInfo(cl_kernel kernel,
void *param_value,
size_t *param_value_size_ret)
{
EnsureCLLoaded();
return cl_loader.clGetKernelInfo(kernel, param_name, param_value_size, param_value,
param_value_size_ret);
return cl::GetDispatch().clGetKernelInfo(kernel, param_name, param_value_size, param_value,
param_value_size_ret);
}
cl_int CL_API_CALL clGetKernelWorkGroupInfo(cl_kernel kernel,
......@@ -376,15 +303,13 @@ cl_int CL_API_CALL clGetKernelWorkGroupInfo(cl_kernel kernel,
void *param_value,
size_t *param_value_size_ret)
{
EnsureCLLoaded();
return cl_loader.clGetKernelWorkGroupInfo(kernel, device, param_name, param_value_size,
param_value, param_value_size_ret);
return cl::GetDispatch().clGetKernelWorkGroupInfo(kernel, device, param_name, param_value_size,
param_value, param_value_size_ret);
}
cl_int CL_API_CALL clWaitForEvents(cl_uint num_events, const cl_event *event_list)
{
EnsureCLLoaded();
return cl_loader.clWaitForEvents(num_events, event_list);
return cl::GetDispatch().clWaitForEvents(num_events, event_list);
}
cl_int CL_API_CALL clGetEventInfo(cl_event event,
......@@ -393,21 +318,18 @@ cl_int CL_API_CALL clGetEventInfo(cl_event event,
void *param_value,
size_t *param_value_size_ret)
{
EnsureCLLoaded();
return cl_loader.clGetEventInfo(event, param_name, param_value_size, param_value,
param_value_size_ret);
return cl::GetDispatch().clGetEventInfo(event, param_name, param_value_size, param_value,
param_value_size_ret);
}
cl_int CL_API_CALL clRetainEvent(cl_event event)
{
EnsureCLLoaded();
return cl_loader.clRetainEvent(event);
return cl::GetDispatch().clRetainEvent(event);
}
cl_int CL_API_CALL clReleaseEvent(cl_event event)
{
EnsureCLLoaded();
return cl_loader.clReleaseEvent(event);
return cl::GetDispatch().clReleaseEvent(event);
}
cl_int CL_API_CALL clGetEventProfilingInfo(cl_event event,
......@@ -416,21 +338,18 @@ cl_int CL_API_CALL clGetEventProfilingInfo(cl_event event,
void *param_value,
size_t *param_value_size_ret)
{
EnsureCLLoaded();
return cl_loader.clGetEventProfilingInfo(event, param_name, param_value_size, param_value,
param_value_size_ret);
return cl::GetDispatch().clGetEventProfilingInfo(event, param_name, param_value_size,
param_value, param_value_size_ret);
}
cl_int CL_API_CALL clFlush(cl_command_queue command_queue)
{
EnsureCLLoaded();
return cl_loader.clFlush(command_queue);
return cl::GetDispatch().clFlush(command_queue);
}
cl_int CL_API_CALL clFinish(cl_command_queue command_queue)
{
EnsureCLLoaded();
return cl_loader.clFinish(command_queue);
return cl::GetDispatch().clFinish(command_queue);
}
cl_int CL_API_CALL clEnqueueReadBuffer(cl_command_queue command_queue,
......@@ -443,9 +362,9 @@ cl_int CL_API_CALL clEnqueueReadBuffer(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueReadBuffer(command_queue, buffer, blocking_read, offset, size, ptr,
num_events_in_wait_list, event_wait_list, event);
return cl::GetDispatch().clEnqueueReadBuffer(command_queue, buffer, blocking_read, offset, size,
ptr, num_events_in_wait_list, event_wait_list,
event);
}
cl_int CL_API_CALL clEnqueueWriteBuffer(cl_command_queue command_queue,
......@@ -458,9 +377,9 @@ cl_int CL_API_CALL clEnqueueWriteBuffer(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueWriteBuffer(command_queue, buffer, blocking_write, offset, size, ptr,
num_events_in_wait_list, event_wait_list, event);
return cl::GetDispatch().clEnqueueWriteBuffer(command_queue, buffer, blocking_write, offset,
size, ptr, num_events_in_wait_list,
event_wait_list, event);
}
cl_int CL_API_CALL clEnqueueCopyBuffer(cl_command_queue command_queue,
......@@ -473,10 +392,9 @@ cl_int CL_API_CALL clEnqueueCopyBuffer(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueCopyBuffer(command_queue, src_buffer, dst_buffer, src_offset,
dst_offset, size, num_events_in_wait_list, event_wait_list,
event);
return cl::GetDispatch().clEnqueueCopyBuffer(command_queue, src_buffer, dst_buffer, src_offset,
dst_offset, size, num_events_in_wait_list,
event_wait_list, event);
}
cl_int CL_API_CALL clEnqueueReadImage(cl_command_queue command_queue,
......@@ -491,10 +409,9 @@ cl_int CL_API_CALL clEnqueueReadImage(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueReadImage(command_queue, image, blocking_read, origin, region,
row_pitch, slice_pitch, ptr, num_events_in_wait_list,
event_wait_list, event);
return cl::GetDispatch().clEnqueueReadImage(command_queue, image, blocking_read, origin, region,
row_pitch, slice_pitch, ptr,
num_events_in_wait_list, event_wait_list, event);
}
cl_int CL_API_CALL clEnqueueWriteImage(cl_command_queue command_queue,
......@@ -509,10 +426,9 @@ cl_int CL_API_CALL clEnqueueWriteImage(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueWriteImage(command_queue, image, blocking_write, origin, region,
input_row_pitch, input_slice_pitch, ptr,
num_events_in_wait_list, event_wait_list, event);
return cl::GetDispatch().clEnqueueWriteImage(command_queue, image, blocking_write, origin,
region, input_row_pitch, input_slice_pitch, ptr,
num_events_in_wait_list, event_wait_list, event);
}
cl_int CL_API_CALL clEnqueueCopyImage(cl_command_queue command_queue,
......@@ -525,9 +441,9 @@ cl_int CL_API_CALL clEnqueueCopyImage(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueCopyImage(command_queue, src_image, dst_image, src_origin, dst_origin,
region, num_events_in_wait_list, event_wait_list, event);
return cl::GetDispatch().clEnqueueCopyImage(command_queue, src_image, dst_image, src_origin,
dst_origin, region, num_events_in_wait_list,
event_wait_list, event);
}
cl_int CL_API_CALL clEnqueueCopyImageToBuffer(cl_command_queue command_queue,
......@@ -540,10 +456,9 @@ cl_int CL_API_CALL clEnqueueCopyImageToBuffer(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueCopyImageToBuffer(command_queue, src_image, dst_buffer, src_origin,
region, dst_offset, num_events_in_wait_list,
event_wait_list, event);
return cl::GetDispatch().clEnqueueCopyImageToBuffer(
command_queue, src_image, dst_buffer, src_origin, region, dst_offset,
num_events_in_wait_list, event_wait_list, event);
}
cl_int CL_API_CALL clEnqueueCopyBufferToImage(cl_command_queue command_queue,
......@@ -556,10 +471,9 @@ cl_int CL_API_CALL clEnqueueCopyBufferToImage(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueCopyBufferToImage(command_queue, src_buffer, dst_image, src_offset,
dst_origin, region, num_events_in_wait_list,
event_wait_list, event);
return cl::GetDispatch().clEnqueueCopyBufferToImage(
command_queue, src_buffer, dst_image, src_offset, dst_origin, region,
num_events_in_wait_list, event_wait_list, event);
}
void *CL_API_CALL clEnqueueMapBuffer(cl_command_queue command_queue,
......@@ -573,10 +487,9 @@ void *CL_API_CALL clEnqueueMapBuffer(cl_command_queue command_queue,
cl_event *event,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clEnqueueMapBuffer(command_queue, buffer, blocking_map, map_flags, offset,
size, num_events_in_wait_list, event_wait_list, event,
errcode_ret);
return cl::GetDispatch().clEnqueueMapBuffer(command_queue, buffer, blocking_map, map_flags,
offset, size, num_events_in_wait_list,
event_wait_list, event, errcode_ret);
}
void *CL_API_CALL clEnqueueMapImage(cl_command_queue command_queue,
......@@ -592,8 +505,7 @@ void *CL_API_CALL clEnqueueMapImage(cl_command_queue command_queue,
cl_event *event,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clEnqueueMapImage(
return cl::GetDispatch().clEnqueueMapImage(
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);
}
......@@ -605,9 +517,8 @@ cl_int CL_API_CALL clEnqueueUnmapMemObject(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueUnmapMemObject(command_queue, memobj, mapped_ptr,
num_events_in_wait_list, event_wait_list, event);
return cl::GetDispatch().clEnqueueUnmapMemObject(
command_queue, memobj, mapped_ptr, num_events_in_wait_list, event_wait_list, event);
}
cl_int CL_API_CALL clEnqueueNDRangeKernel(cl_command_queue command_queue,
......@@ -620,10 +531,9 @@ cl_int CL_API_CALL clEnqueueNDRangeKernel(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueNDRangeKernel(command_queue, kernel, work_dim, global_work_offset,
global_work_size, local_work_size,
num_events_in_wait_list, event_wait_list, event);
return cl::GetDispatch().clEnqueueNDRangeKernel(
command_queue, kernel, work_dim, global_work_offset, global_work_size, local_work_size,
num_events_in_wait_list, event_wait_list, event);
}
cl_int CL_API_CALL clEnqueueNativeKernel(cl_command_queue command_queue,
......@@ -637,10 +547,9 @@ cl_int CL_API_CALL clEnqueueNativeKernel(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueNativeKernel(command_queue, user_func, args, cb_args, num_mem_objects,
mem_list, args_mem_loc, num_events_in_wait_list,
event_wait_list, event);
return cl::GetDispatch().clEnqueueNativeKernel(command_queue, user_func, args, cb_args,
num_mem_objects, mem_list, args_mem_loc,
num_events_in_wait_list, event_wait_list, event);
}
cl_int CL_API_CALL clSetCommandQueueProperty(cl_command_queue command_queue,
......@@ -648,8 +557,8 @@ cl_int CL_API_CALL clSetCommandQueueProperty(cl_command_queue command_queue,
cl_bool enable,
cl_command_queue_properties *old_properties)
{
EnsureCLLoaded();
return cl_loader.clSetCommandQueueProperty(command_queue, properties, enable, old_properties);
return cl::GetDispatch().clSetCommandQueueProperty(command_queue, properties, enable,
old_properties);
}
cl_mem CL_API_CALL clCreateImage2D(cl_context context,
......@@ -661,9 +570,8 @@ cl_mem CL_API_CALL clCreateImage2D(cl_context context,
void *host_ptr,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clCreateImage2D(context, flags, image_format, image_width, image_height,
image_row_pitch, host_ptr, errcode_ret);
return cl::GetDispatch().clCreateImage2D(context, flags, image_format, image_width,
image_height, image_row_pitch, host_ptr, errcode_ret);
}
cl_mem CL_API_CALL clCreateImage3D(cl_context context,
......@@ -677,42 +585,36 @@ cl_mem CL_API_CALL clCreateImage3D(cl_context context,
void *host_ptr,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clCreateImage3D(context, flags, image_format, image_width, image_height,
image_depth, image_row_pitch, image_slice_pitch, host_ptr,
errcode_ret);
return cl::GetDispatch().clCreateImage3D(context, flags, image_format, image_width,
image_height, image_depth, image_row_pitch,
image_slice_pitch, host_ptr, errcode_ret);
}
cl_int CL_API_CALL clEnqueueMarker(cl_command_queue command_queue, cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueMarker(command_queue, event);
return cl::GetDispatch().clEnqueueMarker(command_queue, event);
}
cl_int CL_API_CALL clEnqueueWaitForEvents(cl_command_queue command_queue,
cl_uint num_events,
const cl_event *event_list)
{
EnsureCLLoaded();
return cl_loader.clEnqueueWaitForEvents(command_queue, num_events, event_list);
return cl::GetDispatch().clEnqueueWaitForEvents(command_queue, num_events, event_list);
}
cl_int CL_API_CALL clEnqueueBarrier(cl_command_queue command_queue)
{
EnsureCLLoaded();
return cl_loader.clEnqueueBarrier(command_queue);
return cl::GetDispatch().clEnqueueBarrier(command_queue);
}
cl_int CL_API_CALL clUnloadCompiler()
{
EnsureCLLoaded();
return cl_loader.clUnloadCompiler();
return cl::GetDispatch().clUnloadCompiler();
}
void *CL_API_CALL clGetExtensionFunctionAddress(const char *func_name)
{
EnsureCLLoaded();
return cl_loader.clGetExtensionFunctionAddress(func_name);
return cl::GetDispatch().clGetExtensionFunctionAddress(func_name);
}
cl_command_queue CL_API_CALL clCreateCommandQueue(cl_context context,
......@@ -720,8 +622,7 @@ cl_command_queue CL_API_CALL clCreateCommandQueue(cl_context context,
cl_command_queue_properties properties,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clCreateCommandQueue(context, device, properties, errcode_ret);
return cl::GetDispatch().clCreateCommandQueue(context, device, properties, errcode_ret);
}
cl_sampler CL_API_CALL clCreateSampler(cl_context context,
......@@ -730,9 +631,8 @@ cl_sampler CL_API_CALL clCreateSampler(cl_context context,
cl_filter_mode filter_mode,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clCreateSampler(context, normalized_coords, addressing_mode, filter_mode,
errcode_ret);
return cl::GetDispatch().clCreateSampler(context, normalized_coords, addressing_mode,
filter_mode, errcode_ret);
}
cl_int CL_API_CALL clEnqueueTask(cl_command_queue command_queue,
......@@ -741,9 +641,8 @@ cl_int CL_API_CALL clEnqueueTask(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueTask(command_queue, kernel, num_events_in_wait_list, event_wait_list,
event);
return cl::GetDispatch().clEnqueueTask(command_queue, kernel, num_events_in_wait_list,
event_wait_list, event);
}
// CL 1.1
......@@ -753,9 +652,8 @@ cl_mem CL_API_CALL clCreateSubBuffer(cl_mem buffer,
const void *buffer_create_info,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clCreateSubBuffer(buffer, flags, buffer_create_type, buffer_create_info,
errcode_ret);
return cl::GetDispatch().clCreateSubBuffer(buffer, flags, buffer_create_type,
buffer_create_info, errcode_ret);
}
cl_int CL_API_CALL clSetMemObjectDestructorCallback(cl_mem memobj,
......@@ -763,20 +661,17 @@ cl_int CL_API_CALL clSetMemObjectDestructorCallback(cl_mem memobj,
void *user_data),
void *user_data)
{
EnsureCLLoaded();
return cl_loader.clSetMemObjectDestructorCallback(memobj, pfn_notify, user_data);
return cl::GetDispatch().clSetMemObjectDestructorCallback(memobj, pfn_notify, user_data);
}
cl_event CL_API_CALL clCreateUserEvent(cl_context context, cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clCreateUserEvent(context, errcode_ret);
return cl::GetDispatch().clCreateUserEvent(context, errcode_ret);
}
cl_int CL_API_CALL clSetUserEventStatus(cl_event event, cl_int execution_status)
{
EnsureCLLoaded();
return cl_loader.clSetUserEventStatus(event, execution_status);
return cl::GetDispatch().clSetUserEventStatus(event, execution_status);
}
cl_int CL_API_CALL clSetEventCallback(cl_event event,
......@@ -786,8 +681,8 @@ cl_int CL_API_CALL clSetEventCallback(cl_event event,
void *user_data),
void *user_data)
{
EnsureCLLoaded();
return cl_loader.clSetEventCallback(event, command_exec_callback_type, pfn_notify, user_data);
return cl::GetDispatch().clSetEventCallback(event, command_exec_callback_type, pfn_notify,
user_data);
}
cl_int CL_API_CALL clEnqueueReadBufferRect(cl_command_queue command_queue,
......@@ -805,11 +700,10 @@ cl_int CL_API_CALL clEnqueueReadBufferRect(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueReadBufferRect(command_queue, buffer, blocking_read, buffer_origin,
host_origin, region, buffer_row_pitch,
buffer_slice_pitch, host_row_pitch, host_slice_pitch,
ptr, num_events_in_wait_list, event_wait_list, event);
return cl::GetDispatch().clEnqueueReadBufferRect(
command_queue, buffer, blocking_read, buffer_origin, host_origin, region, buffer_row_pitch,
buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr, num_events_in_wait_list,
event_wait_list, event);
}
cl_int CL_API_CALL clEnqueueWriteBufferRect(cl_command_queue command_queue,
......@@ -827,11 +721,10 @@ cl_int CL_API_CALL clEnqueueWriteBufferRect(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueWriteBufferRect(command_queue, buffer, blocking_write, buffer_origin,
host_origin, region, buffer_row_pitch,
buffer_slice_pitch, host_row_pitch, host_slice_pitch,
ptr, num_events_in_wait_list, event_wait_list, event);
return cl::GetDispatch().clEnqueueWriteBufferRect(
command_queue, buffer, blocking_write, buffer_origin, host_origin, region, buffer_row_pitch,
buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr, num_events_in_wait_list,
event_wait_list, event);
}
cl_int CL_API_CALL clEnqueueCopyBufferRect(cl_command_queue command_queue,
......@@ -848,11 +741,10 @@ cl_int CL_API_CALL clEnqueueCopyBufferRect(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueCopyBufferRect(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);
return cl::GetDispatch().clEnqueueCopyBufferRect(
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);
}
// CL 1.2
......@@ -862,21 +754,18 @@ cl_int CL_API_CALL clCreateSubDevices(cl_device_id in_device,
cl_device_id *out_devices,
cl_uint *num_devices_ret)
{
EnsureCLLoaded();
return cl_loader.clCreateSubDevices(in_device, properties, num_devices, out_devices,
num_devices_ret);
return cl::GetDispatch().clCreateSubDevices(in_device, properties, num_devices, out_devices,
num_devices_ret);
}
cl_int CL_API_CALL clRetainDevice(cl_device_id device)
{
EnsureCLLoaded();
return cl_loader.clRetainDevice(device);
return cl::GetDispatch().clRetainDevice(device);
}
cl_int CL_API_CALL clReleaseDevice(cl_device_id device)
{
EnsureCLLoaded();
return cl_loader.clReleaseDevice(device);
return cl::GetDispatch().clReleaseDevice(device);
}
cl_mem CL_API_CALL clCreateImage(cl_context context,
......@@ -886,8 +775,8 @@ cl_mem CL_API_CALL clCreateImage(cl_context context,
void *host_ptr,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clCreateImage(context, flags, image_format, image_desc, host_ptr, errcode_ret);
return cl::GetDispatch().clCreateImage(context, flags, image_format, image_desc, host_ptr,
errcode_ret);
}
cl_program CL_API_CALL clCreateProgramWithBuiltInKernels(cl_context context,
......@@ -896,9 +785,8 @@ cl_program CL_API_CALL clCreateProgramWithBuiltInKernels(cl_context context,
const char *kernel_names,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clCreateProgramWithBuiltInKernels(context, num_devices, device_list,
kernel_names, errcode_ret);
return cl::GetDispatch().clCreateProgramWithBuiltInKernels(context, num_devices, device_list,
kernel_names, errcode_ret);
}
cl_int CL_API_CALL clCompileProgram(cl_program program,
......@@ -912,9 +800,9 @@ cl_int CL_API_CALL clCompileProgram(cl_program program,
void *user_data),
void *user_data)
{
EnsureCLLoaded();
return cl_loader.clCompileProgram(program, num_devices, device_list, options, num_input_headers,
input_headers, header_include_names, pfn_notify, user_data);
return cl::GetDispatch().clCompileProgram(program, num_devices, device_list, options,
num_input_headers, input_headers,
header_include_names, pfn_notify, user_data);
}
cl_program CL_API_CALL clLinkProgram(cl_context context,
......@@ -928,15 +816,14 @@ cl_program CL_API_CALL clLinkProgram(cl_context context,
void *user_data,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clLinkProgram(context, num_devices, device_list, options, num_input_programs,
input_programs, pfn_notify, user_data, errcode_ret);
return cl::GetDispatch().clLinkProgram(context, num_devices, device_list, options,
num_input_programs, input_programs, pfn_notify,
user_data, errcode_ret);
}
cl_int CL_API_CALL clUnloadPlatformCompiler(cl_platform_id platform)
{
EnsureCLLoaded();
return cl_loader.clUnloadPlatformCompiler(platform);
return cl::GetDispatch().clUnloadPlatformCompiler(platform);
}
cl_int CL_API_CALL clGetKernelArgInfo(cl_kernel kernel,
......@@ -946,9 +833,8 @@ cl_int CL_API_CALL clGetKernelArgInfo(cl_kernel kernel,
void *param_value,
size_t *param_value_size_ret)
{
EnsureCLLoaded();
return cl_loader.clGetKernelArgInfo(kernel, arg_index, param_name, param_value_size,
param_value, param_value_size_ret);
return cl::GetDispatch().clGetKernelArgInfo(kernel, arg_index, param_name, param_value_size,
param_value, param_value_size_ret);
}
cl_int CL_API_CALL clEnqueueFillBuffer(cl_command_queue command_queue,
......@@ -961,9 +847,9 @@ cl_int CL_API_CALL clEnqueueFillBuffer(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueFillBuffer(command_queue, buffer, pattern, pattern_size, offset, size,
num_events_in_wait_list, event_wait_list, event);
return cl::GetDispatch().clEnqueueFillBuffer(command_queue, buffer, pattern, pattern_size,
offset, size, num_events_in_wait_list,
event_wait_list, event);
}
cl_int CL_API_CALL clEnqueueFillImage(cl_command_queue command_queue,
......@@ -975,9 +861,8 @@ cl_int CL_API_CALL clEnqueueFillImage(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueFillImage(command_queue, image, fill_color, origin, region,
num_events_in_wait_list, event_wait_list, event);
return cl::GetDispatch().clEnqueueFillImage(command_queue, image, fill_color, origin, region,
num_events_in_wait_list, event_wait_list, event);
}
cl_int CL_API_CALL clEnqueueMigrateMemObjects(cl_command_queue command_queue,
......@@ -988,9 +873,9 @@ cl_int CL_API_CALL clEnqueueMigrateMemObjects(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueMigrateMemObjects(command_queue, num_mem_objects, mem_objects, flags,
num_events_in_wait_list, event_wait_list, event);
return cl::GetDispatch().clEnqueueMigrateMemObjects(command_queue, num_mem_objects, mem_objects,
flags, num_events_in_wait_list,
event_wait_list, event);
}
cl_int CL_API_CALL clEnqueueMarkerWithWaitList(cl_command_queue command_queue,
......@@ -998,9 +883,8 @@ cl_int CL_API_CALL clEnqueueMarkerWithWaitList(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueMarkerWithWaitList(command_queue, num_events_in_wait_list,
event_wait_list, event);
return cl::GetDispatch().clEnqueueMarkerWithWaitList(command_queue, num_events_in_wait_list,
event_wait_list, event);
}
cl_int CL_API_CALL clEnqueueBarrierWithWaitList(cl_command_queue command_queue,
......@@ -1008,16 +892,14 @@ cl_int CL_API_CALL clEnqueueBarrierWithWaitList(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueBarrierWithWaitList(command_queue, num_events_in_wait_list,
event_wait_list, event);
return cl::GetDispatch().clEnqueueBarrierWithWaitList(command_queue, num_events_in_wait_list,
event_wait_list, event);
}
void *CL_API_CALL clGetExtensionFunctionAddressForPlatform(cl_platform_id platform,
const char *func_name)
{
EnsureCLLoaded();
return cl_loader.clGetExtensionFunctionAddressForPlatform(platform, func_name);
return cl::GetDispatch().clGetExtensionFunctionAddressForPlatform(platform, func_name);
}
// CL 2.0
......@@ -1027,8 +909,8 @@ clCreateCommandQueueWithProperties(cl_context context,
const cl_queue_properties *properties,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clCreateCommandQueueWithProperties(context, device, properties, errcode_ret);
return cl::GetDispatch().clCreateCommandQueueWithProperties(context, device, properties,
errcode_ret);
}
cl_mem CL_API_CALL clCreatePipe(cl_context context,
......@@ -1038,9 +920,8 @@ cl_mem CL_API_CALL clCreatePipe(cl_context context,
const cl_pipe_properties *properties,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clCreatePipe(context, flags, pipe_packet_size, pipe_max_packets, properties,
errcode_ret);
return cl::GetDispatch().clCreatePipe(context, flags, pipe_packet_size, pipe_max_packets,
properties, errcode_ret);
}
cl_int CL_API_CALL clGetPipeInfo(cl_mem pipe,
......@@ -1049,9 +930,8 @@ cl_int CL_API_CALL clGetPipeInfo(cl_mem pipe,
void *param_value,
size_t *param_value_size_ret)
{
EnsureCLLoaded();
return cl_loader.clGetPipeInfo(pipe, param_name, param_value_size, param_value,
param_value_size_ret);
return cl::GetDispatch().clGetPipeInfo(pipe, param_name, param_value_size, param_value,
param_value_size_ret);
}
void *CL_API_CALL clSVMAlloc(cl_context context,
......@@ -1059,14 +939,12 @@ void *CL_API_CALL clSVMAlloc(cl_context context,
size_t size,
cl_uint alignment)
{
EnsureCLLoaded();
return cl_loader.clSVMAlloc(context, flags, size, alignment);
return cl::GetDispatch().clSVMAlloc(context, flags, size, alignment);
}
void CL_API_CALL clSVMFree(cl_context context, void *svm_pointer)
{
EnsureCLLoaded();
return cl_loader.clSVMFree(context, svm_pointer);
return cl::GetDispatch().clSVMFree(context, svm_pointer);
}
cl_sampler CL_API_CALL
......@@ -1074,16 +952,15 @@ clCreateSamplerWithProperties(cl_context context,
const cl_sampler_properties *sampler_properties,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clCreateSamplerWithProperties(context, sampler_properties, errcode_ret);
return cl::GetDispatch().clCreateSamplerWithProperties(context, sampler_properties,
errcode_ret);
}
cl_int CL_API_CALL clSetKernelArgSVMPointer(cl_kernel kernel,
cl_uint arg_index,
const void *arg_value)
{
EnsureCLLoaded();
return cl_loader.clSetKernelArgSVMPointer(kernel, arg_index, arg_value);
return cl::GetDispatch().clSetKernelArgSVMPointer(kernel, arg_index, arg_value);
}
cl_int CL_API_CALL clSetKernelExecInfo(cl_kernel kernel,
......@@ -1091,8 +968,7 @@ cl_int CL_API_CALL clSetKernelExecInfo(cl_kernel kernel,
size_t param_value_size,
const void *param_value)
{
EnsureCLLoaded();
return cl_loader.clSetKernelExecInfo(kernel, param_name, param_value_size, param_value);
return cl::GetDispatch().clSetKernelExecInfo(kernel, param_name, param_value_size, param_value);
}
cl_int CL_API_CALL clEnqueueSVMFree(cl_command_queue command_queue,
......@@ -1107,9 +983,9 @@ cl_int CL_API_CALL clEnqueueSVMFree(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueSVMFree(command_queue, num_svm_pointers, svm_pointers, pfn_free_func,
user_data, num_events_in_wait_list, event_wait_list, event);
return cl::GetDispatch().clEnqueueSVMFree(command_queue, num_svm_pointers, svm_pointers,
pfn_free_func, user_data, num_events_in_wait_list,
event_wait_list, event);
}
cl_int CL_API_CALL clEnqueueSVMMemcpy(cl_command_queue command_queue,
......@@ -1121,9 +997,9 @@ cl_int CL_API_CALL clEnqueueSVMMemcpy(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueSVMMemcpy(command_queue, blocking_copy, dst_ptr, src_ptr, size,
num_events_in_wait_list, event_wait_list, event);
return cl::GetDispatch().clEnqueueSVMMemcpy(command_queue, blocking_copy, dst_ptr, src_ptr,
size, num_events_in_wait_list, event_wait_list,
event);
}
cl_int CL_API_CALL clEnqueueSVMMemFill(cl_command_queue command_queue,
......@@ -1135,9 +1011,9 @@ cl_int CL_API_CALL clEnqueueSVMMemFill(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueSVMMemFill(command_queue, svm_ptr, pattern, pattern_size, size,
num_events_in_wait_list, event_wait_list, event);
return cl::GetDispatch().clEnqueueSVMMemFill(command_queue, svm_ptr, pattern, pattern_size,
size, num_events_in_wait_list, event_wait_list,
event);
}
cl_int CL_API_CALL clEnqueueSVMMap(cl_command_queue command_queue,
......@@ -1149,9 +1025,8 @@ cl_int CL_API_CALL clEnqueueSVMMap(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueSVMMap(command_queue, blocking_map, flags, svm_ptr, size,
num_events_in_wait_list, event_wait_list, event);
return cl::GetDispatch().clEnqueueSVMMap(command_queue, blocking_map, flags, svm_ptr, size,
num_events_in_wait_list, event_wait_list, event);
}
cl_int CL_API_CALL clEnqueueSVMUnmap(cl_command_queue command_queue,
......@@ -1160,9 +1035,8 @@ cl_int CL_API_CALL clEnqueueSVMUnmap(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueSVMUnmap(command_queue, svm_ptr, num_events_in_wait_list,
event_wait_list, event);
return cl::GetDispatch().clEnqueueSVMUnmap(command_queue, svm_ptr, num_events_in_wait_list,
event_wait_list, event);
}
// CL 2.1
......@@ -1170,22 +1044,19 @@ cl_int CL_API_CALL clSetDefaultDeviceCommandQueue(cl_context context,
cl_device_id device,
cl_command_queue command_queue)
{
EnsureCLLoaded();
return cl_loader.clSetDefaultDeviceCommandQueue(context, device, command_queue);
return cl::GetDispatch().clSetDefaultDeviceCommandQueue(context, device, command_queue);
}
cl_int CL_API_CALL clGetDeviceAndHostTimer(cl_device_id device,
cl_ulong *device_timestamp,
cl_ulong *host_timestamp)
{
EnsureCLLoaded();
return cl_loader.clGetDeviceAndHostTimer(device, device_timestamp, host_timestamp);
return cl::GetDispatch().clGetDeviceAndHostTimer(device, device_timestamp, host_timestamp);
}
cl_int CL_API_CALL clGetHostTimer(cl_device_id device, cl_ulong *host_timestamp)
{
EnsureCLLoaded();
return cl_loader.clGetHostTimer(device, host_timestamp);
return cl::GetDispatch().clGetHostTimer(device, host_timestamp);
}
cl_program CL_API_CALL clCreateProgramWithIL(cl_context context,
......@@ -1193,14 +1064,12 @@ cl_program CL_API_CALL clCreateProgramWithIL(cl_context context,
size_t length,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clCreateProgramWithIL(context, il, length, errcode_ret);
return cl::GetDispatch().clCreateProgramWithIL(context, il, length, errcode_ret);
}
cl_kernel CL_API_CALL clCloneKernel(cl_kernel source_kernel, cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clCloneKernel(source_kernel, errcode_ret);
return cl::GetDispatch().clCloneKernel(source_kernel, errcode_ret);
}
cl_int CL_API_CALL clGetKernelSubGroupInfo(cl_kernel kernel,
......@@ -1212,10 +1081,9 @@ cl_int CL_API_CALL clGetKernelSubGroupInfo(cl_kernel kernel,
void *param_value,
size_t *param_value_size_ret)
{
EnsureCLLoaded();
return cl_loader.clGetKernelSubGroupInfo(kernel, device, param_name, input_value_size,
input_value, param_value_size, param_value,
param_value_size_ret);
return cl::GetDispatch().clGetKernelSubGroupInfo(kernel, device, param_name, input_value_size,
input_value, param_value_size, param_value,
param_value_size_ret);
}
cl_int CL_API_CALL clEnqueueSVMMigrateMem(cl_command_queue command_queue,
......@@ -1227,9 +1095,9 @@ cl_int CL_API_CALL clEnqueueSVMMigrateMem(cl_command_queue command_queue,
const cl_event *event_wait_list,
cl_event *event)
{
EnsureCLLoaded();
return cl_loader.clEnqueueSVMMigrateMem(command_queue, num_svm_pointers, svm_pointers, sizes,
flags, num_events_in_wait_list, event_wait_list, event);
return cl::GetDispatch().clEnqueueSVMMigrateMem(command_queue, num_svm_pointers, svm_pointers,
sizes, flags, num_events_in_wait_list,
event_wait_list, event);
}
// CL 2.2
......@@ -1238,8 +1106,7 @@ cl_int CL_API_CALL clSetProgramReleaseCallback(cl_program program,
void *user_data),
void *user_data)
{
EnsureCLLoaded();
return cl_loader.clSetProgramReleaseCallback(program, pfn_notify, user_data);
return cl::GetDispatch().clSetProgramReleaseCallback(program, pfn_notify, user_data);
}
cl_int CL_API_CALL clSetProgramSpecializationConstant(cl_program program,
......@@ -1247,8 +1114,8 @@ cl_int CL_API_CALL clSetProgramSpecializationConstant(cl_program program,
size_t spec_size,
const void *spec_value)
{
EnsureCLLoaded();
return cl_loader.clSetProgramSpecializationConstant(program, spec_id, spec_size, spec_value);
return cl::GetDispatch().clSetProgramSpecializationConstant(program, spec_id, spec_size,
spec_value);
}
// CL 3.0
......@@ -1257,8 +1124,7 @@ cl_int CL_API_CALL clSetContextDestructorCallback(cl_context context,
void *user_data),
void *user_data)
{
EnsureCLLoaded();
return cl_loader.clSetContextDestructorCallback(context, pfn_notify, user_data);
return cl::GetDispatch().clSetContextDestructorCallback(context, pfn_notify, user_data);
}
cl_mem CL_API_CALL clCreateBufferWithProperties(cl_context context,
......@@ -1268,9 +1134,8 @@ cl_mem CL_API_CALL clCreateBufferWithProperties(cl_context context,
void *host_ptr,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clCreateBufferWithProperties(context, properties, flags, size, host_ptr,
errcode_ret);
return cl::GetDispatch().clCreateBufferWithProperties(context, properties, flags, size,
host_ptr, errcode_ret);
}
cl_mem CL_API_CALL clCreateImageWithProperties(cl_context context,
......@@ -1281,9 +1146,8 @@ cl_mem CL_API_CALL clCreateImageWithProperties(cl_context context,
void *host_ptr,
cl_int *errcode_ret)
{
EnsureCLLoaded();
return cl_loader.clCreateImageWithProperties(context, properties, flags, image_format,
image_desc, host_ptr, errcode_ret);
return cl::GetDispatch().clCreateImageWithProperties(context, properties, flags, image_format,
image_desc, host_ptr, errcode_ret);
}
} // extern "C"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment