diff options
author | John Plate <jplate@google.com> | 2021-04-27 19:31:31 +0100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-05-03 17:27:16 +0000 |
commit | 05fb22724f2ec7173c32d8a01f6313579fc9219a (patch) | |
tree | 87707acd1fe13bf534fa956b10735ce3e3a85d95 | |
parent | bcae4fe18271c1b7a85ec4cc2155546485eccf31 (diff) | |
download | angle-05fb22724f2ec7173c32d8a01f6313579fc9219a.tar.gz |
Add support for OpenCL ICD Loader
Bug: angleproject:5908
Change-Id: Idafc0d15b69f9a21f2ab5e48c4c34f0dc0e0ee96
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2854598
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Cody Northrop <cnorthrop@google.com>
Commit-Queue: John Plate <jplate@google.com>
40 files changed, 2184 insertions, 2212 deletions
@@ -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", diff --git a/gni/angle.gni b/gni/angle.gni index 4aa8fb9262..95302cb11b 100644 --- a/gni/angle.gni +++ b/gni/angle.gni @@ -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 } diff --git a/include/angle_cl.h b/include/angle_cl.h index a850dc7aa0..955f8f9126 100644 --- a/include/angle_cl.h +++ b/include/angle_cl.h @@ -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_ diff --git a/scripts/code_generation_hashes/GL_EGL_WGL_loader.json b/scripts/code_generation_hashes/GL_EGL_WGL_loader.json index 1bb9d60886..38b81c538e 100644 --- a/scripts/code_generation_hashes/GL_EGL_WGL_loader.json +++ b/scripts/code_generation_hashes/GL_EGL_WGL_loader.json @@ -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": diff --git a/scripts/code_generation_hashes/GL_EGL_entry_points.json b/scripts/code_generation_hashes/GL_EGL_entry_points.json index 06097ac949..ae80c21f75 100644 --- a/scripts/code_generation_hashes/GL_EGL_entry_points.json +++ b/scripts/code_generation_hashes/GL_EGL_entry_points.json @@ -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 diff --git a/scripts/generate_entry_points.py b/scripts/generate_entry_points.py index a5d92140a4..b931ed09df 100755 --- a/scripts/generate_entry_points.py +++ b/scripts/generate_entry_points.py @@ -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() diff --git a/scripts/generate_loader.py b/scripts/generate_loader.py index 24a7f5a34e..ef3a8a5bd3 100755 --- a/scripts/generate_loader.py +++ b/scripts/generate_loader.py @@ -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()) diff --git a/src/libANGLE/CLCommandQueue.cpp b/src/libANGLE/CLCommandQueue.cpp index f9e7e87a6e..a0ef9dd82f 100644 --- a/src/libANGLE/CLCommandQueue.cpp +++ b/src/libANGLE/CLCommandQueue.cpp @@ -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 diff --git a/src/libANGLE/CLCommandQueue.h b/src/libANGLE/CLCommandQueue.h index 35cd2973f5..74e86d6fee 100644 --- a/src/libANGLE/CLCommandQueue.h +++ b/src/libANGLE/CLCommandQueue.h @@ -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 diff --git a/src/libANGLE/CLContext.cpp b/src/libANGLE/CLContext.cpp index 521bf889b8..3ce0cdf21e 100644 --- a/src/libANGLE/CLContext.cpp +++ b/src/libANGLE/CLContext.cpp @@ -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 diff --git a/src/libANGLE/CLContext.h b/src/libANGLE/CLContext.h index e22818836a..a797a5fa09 100644 --- a/src/libANGLE/CLContext.h +++ b/src/libANGLE/CLContext.h @@ -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 diff --git a/src/libANGLE/CLDevice.cpp b/src/libANGLE/CLDevice.cpp index c95574bc59..cfdbc767f2 100644 --- a/src/libANGLE/CLDevice.cpp +++ b/src/libANGLE/CLDevice.cpp @@ -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 diff --git a/src/libANGLE/CLDevice.h b/src/libANGLE/CLDevice.h index 2ac89f6f4f..60c2d75a11 100644 --- a/src/libANGLE/CLDevice.h +++ b/src/libANGLE/CLDevice.h @@ -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 diff --git a/src/libANGLE/CLEvent.cpp b/src/libANGLE/CLEvent.cpp index 65e68f6866..9989b6e822 100644 --- a/src/libANGLE/CLEvent.cpp +++ b/src/libANGLE/CLEvent.cpp @@ -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 diff --git a/src/libANGLE/CLEvent.h b/src/libANGLE/CLEvent.h index 57f78a30c1..e0320c74e0 100644 --- a/src/libANGLE/CLEvent.h +++ b/src/libANGLE/CLEvent.h @@ -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 diff --git a/src/libANGLE/CLKernel.cpp b/src/libANGLE/CLKernel.cpp index 4269f5cf15..cbeeec3fd3 100644 --- a/src/libANGLE/CLKernel.cpp +++ b/src/libANGLE/CLKernel.cpp @@ -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 diff --git a/src/libANGLE/CLKernel.h b/src/libANGLE/CLKernel.h index 554768fd34..b93a419007 100644 --- a/src/libANGLE/CLKernel.h +++ b/src/libANGLE/CLKernel.h @@ -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 diff --git a/src/libANGLE/CLMemory.cpp b/src/libANGLE/CLMemory.cpp index 8fde098f44..fd33948f79 100644 --- a/src/libANGLE/CLMemory.cpp +++ b/src/libANGLE/CLMemory.cpp @@ -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 diff --git a/src/libANGLE/CLMemory.h b/src/libANGLE/CLMemory.h index 3d7932c709..7477dc299b 100644 --- a/src/libANGLE/CLMemory.h +++ b/src/libANGLE/CLMemory.h @@ -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 diff --git a/src/libANGLE/CLObject.h b/src/libANGLE/CLObject.h new file mode 100644 index 0000000000..747004c91e --- /dev/null +++ b/src/libANGLE/CLObject.h @@ -0,0 +1,25 @@ +// +// 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_ diff --git a/src/libANGLE/CLPlatform.cpp b/src/libANGLE/CLPlatform.cpp index 080b658a76..94bbc5291f 100644 --- a/src/libANGLE/CLPlatform.cpp +++ b/src/libANGLE/CLPlatform.cpp @@ -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 diff --git a/src/libANGLE/CLPlatform.h b/src/libANGLE/CLPlatform.h index bf79c15f17..1188d1797b 100644 --- a/src/libANGLE/CLPlatform.h +++ b/src/libANGLE/CLPlatform.h @@ -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 diff --git a/src/libANGLE/CLProgram.cpp b/src/libANGLE/CLProgram.cpp index 93ca982285..2fa5398c0d 100644 --- a/src/libANGLE/CLProgram.cpp +++ b/src/libANGLE/CLProgram.cpp @@ -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 diff --git a/src/libANGLE/CLProgram.h b/src/libANGLE/CLProgram.h index b46ac11e26..9487021b7c 100644 --- a/src/libANGLE/CLProgram.h +++ b/src/libANGLE/CLProgram.h @@ -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 diff --git a/src/libANGLE/CLSampler.cpp b/src/libANGLE/CLSampler.cpp index b6fb3b0ff5..12bfdb300b 100644 --- a/src/libANGLE/CLSampler.cpp +++ b/src/libANGLE/CLSampler.cpp @@ -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 diff --git a/src/libANGLE/CLSampler.h b/src/libANGLE/CLSampler.h index 00e409f884..d59642c465 100644 --- a/src/libANGLE/CLSampler.h +++ b/src/libANGLE/CLSampler.h @@ -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 diff --git a/src/libANGLE/CLtypes.h b/src/libANGLE/CLtypes.h index 3a10f584a9..a172badb48 100644 --- a/src/libANGLE/CLtypes.h +++ b/src/libANGLE/CLtypes.h @@ -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; diff --git a/src/libGLESv2.gni b/src/libGLESv2.gni index e811783fe0..2b03657243 100644 --- a/src/libGLESv2.gni +++ b/src/libGLESv2.gni @@ -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", diff --git a/src/libGLESv2/cl_dispatch_table.cpp b/src/libGLESv2/cl_dispatch_table.cpp new file mode 100644 index 0000000000..5476aa3003 --- /dev/null +++ b/src/libGLESv2/cl_dispatch_table.cpp @@ -0,0 +1,197 @@ +// +// 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 diff --git a/src/libGLESv2/cl_dispatch_table.h b/src/libGLESv2/cl_dispatch_table.h new file mode 100644 index 0000000000..225e1cdbd7 --- /dev/null +++ b/src/libGLESv2/cl_dispatch_table.h @@ -0,0 +1,20 @@ +// +// 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_ diff --git a/src/libGLESv2/entry_points_cl_autogen.cpp b/src/libGLESv2/entry_points_cl_autogen.cpp index 1b92311a1c..4502dc6c9c 100644 --- a/src/libGLESv2/entry_points_cl_autogen.cpp +++ b/src/libGLESv2/entry_points_cl_autogen.cpp @@ -8,21 +8,19 @@ // entry_points_cl_autogen.cpp: // Defines the CL entry points. -#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" +#include "libGLESv2/cl_stubs_autogen.h" +#include "libGLESv2/entry_points_cl_utils.h" -using namespace cl; - -extern "C" { +namespace cl +{ // CL 1.0 -cl_int CL_API_CALL CL_GetPlatformIDs(cl_uint num_entries, - cl_platform_id *platforms, - cl_uint *num_platforms) +cl_int CL_API_CALL clGetPlatformIDs(cl_uint num_entries, + cl_platform_id *platforms, + cl_uint *num_platforms) { CL_EVENT(GetPlatformIDs, "num_entries = %u, platforms = 0x%016" PRIxPTR ", num_platforms = 0x%016" PRIxPTR "", @@ -32,14 +30,14 @@ cl_int CL_API_CALL CL_GetPlatformIDs(cl_uint num_entries, ANGLE_CL_VALIDATE_ERROR(GetPlatformIDs, num_entries, platformsPacked, num_platforms); - return (GetPlatformIDs(num_entries, platformsPacked, num_platforms)); + return GetPlatformIDs(num_entries, platformsPacked, num_platforms); } -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) +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_EVENT(GetPlatformInfo, "platform = 0x%016" PRIxPTR @@ -54,15 +52,15 @@ cl_int CL_API_CALL CL_GetPlatformInfo(cl_platform_id platform, ANGLE_CL_VALIDATE_ERROR(GetPlatformInfo, platformPacked, param_namePacked, param_value_size, param_value, param_value_size_ret); - return (GetPlatformInfo(platformPacked, param_namePacked, param_value_size, param_value, - param_value_size_ret)); + return GetPlatformInfo(platformPacked, param_namePacked, param_value_size, param_value, + param_value_size_ret); } -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) +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_EVENT(GetDeviceIDs, "platform = 0x%016" PRIxPTR @@ -77,14 +75,14 @@ cl_int CL_API_CALL CL_GetDeviceIDs(cl_platform_id platform, ANGLE_CL_VALIDATE_ERROR(GetDeviceIDs, platformPacked, device_type, num_entries, devicesPacked, num_devices); - return (GetDeviceIDs(platformPacked, device_type, num_entries, devicesPacked, num_devices)); + return GetDeviceIDs(platformPacked, device_type, num_entries, devicesPacked, num_devices); } -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) +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_EVENT(GetDeviceInfo, "device = 0x%016" PRIxPTR @@ -99,19 +97,19 @@ cl_int CL_API_CALL CL_GetDeviceInfo(cl_device_id device, ANGLE_CL_VALIDATE_ERROR(GetDeviceInfo, devicePacked, param_namePacked, param_value_size, param_value, param_value_size_ret); - return (GetDeviceInfo(devicePacked, param_namePacked, param_value_size, param_value, - param_value_size_ret)); + return GetDeviceInfo(devicePacked, param_namePacked, param_value_size, param_value, + param_value_size_ret); } -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) +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_EVENT(CreateContext, "properties = 0x%016" PRIxPTR ", num_devices = %u, devices = 0x%016" PRIxPTR @@ -125,19 +123,19 @@ cl_context CL_API_CALL CL_CreateContext(const cl_context_properties *properties, ANGLE_CL_VALIDATE_POINTER(CreateContext, properties, num_devices, devicesPacked, pfn_notify, user_data, errcode_ret); - return UnpackParam<cl_context>( - CreateContext(properties, num_devices, devicesPacked, pfn_notify, user_data, errcode_ret)); + return CreateContext(properties, num_devices, devicesPacked, pfn_notify, user_data, + errcode_ret); } 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) +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_EVENT(CreateContextFromType, "properties = 0x%016" PRIxPTR ", device_type = %lu, pfn_notify = 0x%016" PRIxPTR @@ -148,11 +146,10 @@ CL_CreateContextFromType(const cl_context_properties *properties, ANGLE_CL_VALIDATE_POINTER(CreateContextFromType, properties, device_type, pfn_notify, user_data, errcode_ret); - return UnpackParam<cl_context>( - CreateContextFromType(properties, device_type, pfn_notify, user_data, errcode_ret)); + return CreateContextFromType(properties, device_type, pfn_notify, user_data, errcode_ret); } -cl_int CL_API_CALL CL_RetainContext(cl_context context) +cl_int CL_API_CALL clRetainContext(cl_context context) { CL_EVENT(RetainContext, "context = 0x%016" PRIxPTR "", (uintptr_t)context); @@ -160,10 +157,10 @@ cl_int CL_API_CALL CL_RetainContext(cl_context context) ANGLE_CL_VALIDATE_ERROR(RetainContext, contextPacked); - return (RetainContext(contextPacked)); + return RetainContext(contextPacked); } -cl_int CL_API_CALL CL_ReleaseContext(cl_context context) +cl_int CL_API_CALL clReleaseContext(cl_context context) { CL_EVENT(ReleaseContext, "context = 0x%016" PRIxPTR "", (uintptr_t)context); @@ -171,14 +168,14 @@ cl_int CL_API_CALL CL_ReleaseContext(cl_context context) ANGLE_CL_VALIDATE_ERROR(ReleaseContext, contextPacked); - return (ReleaseContext(contextPacked)); + return ReleaseContext(contextPacked); } -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) +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_EVENT(GetContextInfo, "context = 0x%016" PRIxPTR @@ -193,11 +190,11 @@ cl_int CL_API_CALL CL_GetContextInfo(cl_context context, ANGLE_CL_VALIDATE_ERROR(GetContextInfo, contextPacked, param_namePacked, param_value_size, param_value, param_value_size_ret); - return (GetContextInfo(contextPacked, param_namePacked, param_value_size, param_value, - param_value_size_ret)); + return GetContextInfo(contextPacked, param_namePacked, param_value_size, param_value, + param_value_size_ret); } -cl_int CL_API_CALL CL_RetainCommandQueue(cl_command_queue command_queue) +cl_int CL_API_CALL clRetainCommandQueue(cl_command_queue command_queue) { CL_EVENT(RetainCommandQueue, "command_queue = 0x%016" PRIxPTR "", (uintptr_t)command_queue); @@ -205,10 +202,10 @@ cl_int CL_API_CALL CL_RetainCommandQueue(cl_command_queue command_queue) ANGLE_CL_VALIDATE_ERROR(RetainCommandQueue, command_queuePacked); - return (RetainCommandQueue(command_queuePacked)); + return RetainCommandQueue(command_queuePacked); } -cl_int CL_API_CALL CL_ReleaseCommandQueue(cl_command_queue command_queue) +cl_int CL_API_CALL clReleaseCommandQueue(cl_command_queue command_queue) { CL_EVENT(ReleaseCommandQueue, "command_queue = 0x%016" PRIxPTR "", (uintptr_t)command_queue); @@ -216,14 +213,14 @@ cl_int CL_API_CALL CL_ReleaseCommandQueue(cl_command_queue command_queue) ANGLE_CL_VALIDATE_ERROR(ReleaseCommandQueue, command_queuePacked); - return (ReleaseCommandQueue(command_queuePacked)); + return ReleaseCommandQueue(command_queuePacked); } -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) +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_EVENT(GetCommandQueueInfo, "command_queue = 0x%016" PRIxPTR @@ -238,15 +235,15 @@ cl_int CL_API_CALL CL_GetCommandQueueInfo(cl_command_queue command_queue, ANGLE_CL_VALIDATE_ERROR(GetCommandQueueInfo, command_queuePacked, param_namePacked, param_value_size, param_value, param_value_size_ret); - return (GetCommandQueueInfo(command_queuePacked, param_namePacked, param_value_size, - param_value, param_value_size_ret)); + return GetCommandQueueInfo(command_queuePacked, param_namePacked, param_value_size, param_value, + param_value_size_ret); } -cl_mem CL_API_CALL CL_CreateBuffer(cl_context context, - cl_mem_flags flags, - size_t size, - void *host_ptr, - cl_int *errcode_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_EVENT(CreateBuffer, "context = 0x%016" PRIxPTR ", flags = %lu, size = %zu, host_ptr = 0x%016" PRIxPTR @@ -257,10 +254,10 @@ cl_mem CL_API_CALL CL_CreateBuffer(cl_context context, ANGLE_CL_VALIDATE_POINTER(CreateBuffer, contextPacked, flags, size, host_ptr, errcode_ret); - return UnpackParam<cl_mem>(CreateBuffer(contextPacked, flags, size, host_ptr, errcode_ret)); + return CreateBuffer(contextPacked, flags, size, host_ptr, errcode_ret); } -cl_int CL_API_CALL CL_RetainMemObject(cl_mem memobj) +cl_int CL_API_CALL clRetainMemObject(cl_mem memobj) { CL_EVENT(RetainMemObject, "memobj = 0x%016" PRIxPTR "", (uintptr_t)memobj); @@ -268,10 +265,10 @@ cl_int CL_API_CALL CL_RetainMemObject(cl_mem memobj) ANGLE_CL_VALIDATE_ERROR(RetainMemObject, memobjPacked); - return (RetainMemObject(memobjPacked)); + return RetainMemObject(memobjPacked); } -cl_int CL_API_CALL CL_ReleaseMemObject(cl_mem memobj) +cl_int CL_API_CALL clReleaseMemObject(cl_mem memobj) { CL_EVENT(ReleaseMemObject, "memobj = 0x%016" PRIxPTR "", (uintptr_t)memobj); @@ -279,15 +276,15 @@ cl_int CL_API_CALL CL_ReleaseMemObject(cl_mem memobj) ANGLE_CL_VALIDATE_ERROR(ReleaseMemObject, memobjPacked); - return (ReleaseMemObject(memobjPacked)); + return ReleaseMemObject(memobjPacked); } -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) +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_EVENT(GetSupportedImageFormats, "context = 0x%016" PRIxPTR @@ -302,15 +299,15 @@ cl_int CL_API_CALL CL_GetSupportedImageFormats(cl_context context, ANGLE_CL_VALIDATE_ERROR(GetSupportedImageFormats, contextPacked, flags, image_typePacked, num_entries, image_formats, num_image_formats); - return (GetSupportedImageFormats(contextPacked, flags, image_typePacked, num_entries, - image_formats, num_image_formats)); + return GetSupportedImageFormats(contextPacked, flags, image_typePacked, num_entries, + image_formats, num_image_formats); } -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) +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_EVENT(GetMemObjectInfo, "memobj = 0x%016" PRIxPTR @@ -325,15 +322,15 @@ cl_int CL_API_CALL CL_GetMemObjectInfo(cl_mem memobj, ANGLE_CL_VALIDATE_ERROR(GetMemObjectInfo, memobjPacked, param_namePacked, param_value_size, param_value, param_value_size_ret); - return (GetMemObjectInfo(memobjPacked, param_namePacked, param_value_size, param_value, - param_value_size_ret)); + return GetMemObjectInfo(memobjPacked, param_namePacked, param_value_size, param_value, + param_value_size_ret); } -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) +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_EVENT(GetImageInfo, "image = 0x%016" PRIxPTR @@ -348,11 +345,11 @@ cl_int CL_API_CALL CL_GetImageInfo(cl_mem image, ANGLE_CL_VALIDATE_ERROR(GetImageInfo, imagePacked, param_namePacked, param_value_size, param_value, param_value_size_ret); - return (GetImageInfo(imagePacked, param_namePacked, param_value_size, param_value, - param_value_size_ret)); + return GetImageInfo(imagePacked, param_namePacked, param_value_size, param_value, + param_value_size_ret); } -cl_int CL_API_CALL CL_RetainSampler(cl_sampler sampler) +cl_int CL_API_CALL clRetainSampler(cl_sampler sampler) { CL_EVENT(RetainSampler, "sampler = 0x%016" PRIxPTR "", (uintptr_t)sampler); @@ -360,10 +357,10 @@ cl_int CL_API_CALL CL_RetainSampler(cl_sampler sampler) ANGLE_CL_VALIDATE_ERROR(RetainSampler, samplerPacked); - return (RetainSampler(samplerPacked)); + return RetainSampler(samplerPacked); } -cl_int CL_API_CALL CL_ReleaseSampler(cl_sampler sampler) +cl_int CL_API_CALL clReleaseSampler(cl_sampler sampler) { CL_EVENT(ReleaseSampler, "sampler = 0x%016" PRIxPTR "", (uintptr_t)sampler); @@ -371,14 +368,14 @@ cl_int CL_API_CALL CL_ReleaseSampler(cl_sampler sampler) ANGLE_CL_VALIDATE_ERROR(ReleaseSampler, samplerPacked); - return (ReleaseSampler(samplerPacked)); + return ReleaseSampler(samplerPacked); } -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) +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_EVENT(GetSamplerInfo, "sampler = 0x%016" PRIxPTR @@ -393,15 +390,15 @@ cl_int CL_API_CALL CL_GetSamplerInfo(cl_sampler sampler, ANGLE_CL_VALIDATE_ERROR(GetSamplerInfo, samplerPacked, param_namePacked, param_value_size, param_value, param_value_size_ret); - return (GetSamplerInfo(samplerPacked, param_namePacked, param_value_size, param_value, - param_value_size_ret)); + return GetSamplerInfo(samplerPacked, param_namePacked, param_value_size, param_value, + param_value_size_ret); } -cl_program CL_API_CALL CL_CreateProgramWithSource(cl_context context, - cl_uint count, - const char **strings, - const size_t *lengths, - cl_int *errcode_ret) +cl_program CL_API_CALL clCreateProgramWithSource(cl_context context, + cl_uint count, + const char **strings, + const size_t *lengths, + cl_int *errcode_ret) { CL_EVENT(CreateProgramWithSource, "context = 0x%016" PRIxPTR ", count = %u, strings = 0x%016" PRIxPTR @@ -414,17 +411,16 @@ cl_program CL_API_CALL CL_CreateProgramWithSource(cl_context context, ANGLE_CL_VALIDATE_POINTER(CreateProgramWithSource, contextPacked, count, strings, lengths, errcode_ret); - return UnpackParam<cl_program>( - CreateProgramWithSource(contextPacked, count, strings, lengths, errcode_ret)); + return CreateProgramWithSource(contextPacked, count, strings, lengths, errcode_ret); } -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) +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) { CL_EVENT(CreateProgramWithBinary, "context = 0x%016" PRIxPTR ", num_devices = %u, device_list = 0x%016" PRIxPTR @@ -439,12 +435,11 @@ cl_program CL_API_CALL CL_CreateProgramWithBinary(cl_context context, ANGLE_CL_VALIDATE_POINTER(CreateProgramWithBinary, contextPacked, num_devices, device_listPacked, lengths, binaries, binary_status, errcode_ret); - return UnpackParam<cl_program>(CreateProgramWithBinary(contextPacked, num_devices, - device_listPacked, lengths, binaries, - binary_status, errcode_ret)); + return CreateProgramWithBinary(contextPacked, num_devices, device_listPacked, lengths, binaries, + binary_status, errcode_ret); } -cl_int CL_API_CALL CL_RetainProgram(cl_program program) +cl_int CL_API_CALL clRetainProgram(cl_program program) { CL_EVENT(RetainProgram, "program = 0x%016" PRIxPTR "", (uintptr_t)program); @@ -452,10 +447,10 @@ cl_int CL_API_CALL CL_RetainProgram(cl_program program) ANGLE_CL_VALIDATE_ERROR(RetainProgram, programPacked); - return (RetainProgram(programPacked)); + return RetainProgram(programPacked); } -cl_int CL_API_CALL CL_ReleaseProgram(cl_program program) +cl_int CL_API_CALL clReleaseProgram(cl_program program) { CL_EVENT(ReleaseProgram, "program = 0x%016" PRIxPTR "", (uintptr_t)program); @@ -463,16 +458,16 @@ cl_int CL_API_CALL CL_ReleaseProgram(cl_program program) ANGLE_CL_VALIDATE_ERROR(ReleaseProgram, programPacked); - return (ReleaseProgram(programPacked)); + return ReleaseProgram(programPacked); } -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) +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_EVENT(BuildProgram, "program = 0x%016" PRIxPTR ", num_devices = %u, device_list = 0x%016" PRIxPTR @@ -487,15 +482,15 @@ cl_int CL_API_CALL CL_BuildProgram(cl_program program, ANGLE_CL_VALIDATE_ERROR(BuildProgram, programPacked, num_devices, device_listPacked, options, pfn_notify, user_data); - return (BuildProgram(programPacked, num_devices, device_listPacked, options, pfn_notify, - user_data)); + return BuildProgram(programPacked, num_devices, device_listPacked, options, pfn_notify, + user_data); } -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) +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_EVENT(GetProgramInfo, "program = 0x%016" PRIxPTR @@ -510,16 +505,16 @@ cl_int CL_API_CALL CL_GetProgramInfo(cl_program program, ANGLE_CL_VALIDATE_ERROR(GetProgramInfo, programPacked, param_namePacked, param_value_size, param_value, param_value_size_ret); - return (GetProgramInfo(programPacked, param_namePacked, param_value_size, param_value, - param_value_size_ret)); + return GetProgramInfo(programPacked, param_namePacked, param_value_size, param_value, + param_value_size_ret); } -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) +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_EVENT(GetProgramBuildInfo, "program = 0x%016" PRIxPTR ", device = 0x%016" PRIxPTR @@ -535,13 +530,13 @@ cl_int CL_API_CALL CL_GetProgramBuildInfo(cl_program program, ANGLE_CL_VALIDATE_ERROR(GetProgramBuildInfo, programPacked, devicePacked, param_namePacked, param_value_size, param_value, param_value_size_ret); - return (GetProgramBuildInfo(programPacked, devicePacked, param_namePacked, param_value_size, - param_value, param_value_size_ret)); + return GetProgramBuildInfo(programPacked, devicePacked, param_namePacked, param_value_size, + param_value, param_value_size_ret); } -cl_kernel CL_API_CALL CL_CreateKernel(cl_program program, - const char *kernel_name, - cl_int *errcode_ret) +cl_kernel CL_API_CALL clCreateKernel(cl_program program, + const char *kernel_name, + cl_int *errcode_ret) { CL_EVENT(CreateKernel, "program = 0x%016" PRIxPTR ", kernel_name = 0x%016" PRIxPTR @@ -552,13 +547,13 @@ cl_kernel CL_API_CALL CL_CreateKernel(cl_program program, ANGLE_CL_VALIDATE_POINTER(CreateKernel, programPacked, kernel_name, errcode_ret); - return UnpackParam<cl_kernel>(CreateKernel(programPacked, kernel_name, errcode_ret)); + return CreateKernel(programPacked, kernel_name, errcode_ret); } -cl_int CL_API_CALL CL_CreateKernelsInProgram(cl_program program, - cl_uint num_kernels, - cl_kernel *kernels, - cl_uint *num_kernels_ret) +cl_int CL_API_CALL clCreateKernelsInProgram(cl_program program, + cl_uint num_kernels, + cl_kernel *kernels, + cl_uint *num_kernels_ret) { CL_EVENT(CreateKernelsInProgram, "program = 0x%016" PRIxPTR ", num_kernels = %u, kernels = 0x%016" PRIxPTR @@ -571,10 +566,10 @@ cl_int CL_API_CALL CL_CreateKernelsInProgram(cl_program program, ANGLE_CL_VALIDATE_ERROR(CreateKernelsInProgram, programPacked, num_kernels, kernelsPacked, num_kernels_ret); - return (CreateKernelsInProgram(programPacked, num_kernels, kernelsPacked, num_kernels_ret)); + return CreateKernelsInProgram(programPacked, num_kernels, kernelsPacked, num_kernels_ret); } -cl_int CL_API_CALL CL_RetainKernel(cl_kernel kernel) +cl_int CL_API_CALL clRetainKernel(cl_kernel kernel) { CL_EVENT(RetainKernel, "kernel = 0x%016" PRIxPTR "", (uintptr_t)kernel); @@ -582,10 +577,10 @@ cl_int CL_API_CALL CL_RetainKernel(cl_kernel kernel) ANGLE_CL_VALIDATE_ERROR(RetainKernel, kernelPacked); - return (RetainKernel(kernelPacked)); + return RetainKernel(kernelPacked); } -cl_int CL_API_CALL CL_ReleaseKernel(cl_kernel kernel) +cl_int CL_API_CALL clReleaseKernel(cl_kernel kernel) { CL_EVENT(ReleaseKernel, "kernel = 0x%016" PRIxPTR "", (uintptr_t)kernel); @@ -593,13 +588,13 @@ cl_int CL_API_CALL CL_ReleaseKernel(cl_kernel kernel) ANGLE_CL_VALIDATE_ERROR(ReleaseKernel, kernelPacked); - return (ReleaseKernel(kernelPacked)); + return ReleaseKernel(kernelPacked); } -cl_int CL_API_CALL CL_SetKernelArg(cl_kernel kernel, - cl_uint arg_index, - size_t arg_size, - const void *arg_value) +cl_int CL_API_CALL clSetKernelArg(cl_kernel kernel, + cl_uint arg_index, + size_t arg_size, + const void *arg_value) { CL_EVENT(SetKernelArg, "kernel = 0x%016" PRIxPTR @@ -610,14 +605,14 @@ cl_int CL_API_CALL CL_SetKernelArg(cl_kernel kernel, ANGLE_CL_VALIDATE_ERROR(SetKernelArg, kernelPacked, arg_index, arg_size, arg_value); - return (SetKernelArg(kernelPacked, arg_index, arg_size, arg_value)); + return SetKernelArg(kernelPacked, arg_index, arg_size, arg_value); } -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) +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_EVENT(GetKernelInfo, "kernel = 0x%016" PRIxPTR @@ -632,16 +627,16 @@ cl_int CL_API_CALL CL_GetKernelInfo(cl_kernel kernel, ANGLE_CL_VALIDATE_ERROR(GetKernelInfo, kernelPacked, param_namePacked, param_value_size, param_value, param_value_size_ret); - return (GetKernelInfo(kernelPacked, param_namePacked, param_value_size, param_value, - param_value_size_ret)); + return GetKernelInfo(kernelPacked, param_namePacked, param_value_size, param_value, + param_value_size_ret); } -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) +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_EVENT(GetKernelWorkGroupInfo, "kernel = 0x%016" PRIxPTR ", device = 0x%016" PRIxPTR @@ -657,11 +652,11 @@ cl_int CL_API_CALL CL_GetKernelWorkGroupInfo(cl_kernel kernel, ANGLE_CL_VALIDATE_ERROR(GetKernelWorkGroupInfo, kernelPacked, devicePacked, param_namePacked, param_value_size, param_value, param_value_size_ret); - return (GetKernelWorkGroupInfo(kernelPacked, devicePacked, param_namePacked, param_value_size, - param_value, param_value_size_ret)); + return GetKernelWorkGroupInfo(kernelPacked, devicePacked, param_namePacked, param_value_size, + param_value, param_value_size_ret); } -cl_int CL_API_CALL CL_WaitForEvents(cl_uint num_events, const cl_event *event_list) +cl_int CL_API_CALL clWaitForEvents(cl_uint num_events, const cl_event *event_list) { CL_EVENT(WaitForEvents, "num_events = %u, event_list = 0x%016" PRIxPTR "", num_events, (uintptr_t)event_list); @@ -670,14 +665,14 @@ cl_int CL_API_CALL CL_WaitForEvents(cl_uint num_events, const cl_event *event_li ANGLE_CL_VALIDATE_ERROR(WaitForEvents, num_events, event_listPacked); - return (WaitForEvents(num_events, event_listPacked)); + return WaitForEvents(num_events, event_listPacked); } -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) +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_EVENT(GetEventInfo, "event = 0x%016" PRIxPTR @@ -692,11 +687,11 @@ cl_int CL_API_CALL CL_GetEventInfo(cl_event event, ANGLE_CL_VALIDATE_ERROR(GetEventInfo, eventPacked, param_namePacked, param_value_size, param_value, param_value_size_ret); - return (GetEventInfo(eventPacked, param_namePacked, param_value_size, param_value, - param_value_size_ret)); + return GetEventInfo(eventPacked, param_namePacked, param_value_size, param_value, + param_value_size_ret); } -cl_int CL_API_CALL CL_RetainEvent(cl_event event) +cl_int CL_API_CALL clRetainEvent(cl_event event) { CL_EVENT(RetainEvent, "event = 0x%016" PRIxPTR "", (uintptr_t)event); @@ -704,10 +699,10 @@ cl_int CL_API_CALL CL_RetainEvent(cl_event event) ANGLE_CL_VALIDATE_ERROR(RetainEvent, eventPacked); - return (RetainEvent(eventPacked)); + return RetainEvent(eventPacked); } -cl_int CL_API_CALL CL_ReleaseEvent(cl_event event) +cl_int CL_API_CALL clReleaseEvent(cl_event event) { CL_EVENT(ReleaseEvent, "event = 0x%016" PRIxPTR "", (uintptr_t)event); @@ -715,14 +710,14 @@ cl_int CL_API_CALL CL_ReleaseEvent(cl_event event) ANGLE_CL_VALIDATE_ERROR(ReleaseEvent, eventPacked); - return (ReleaseEvent(eventPacked)); + return ReleaseEvent(eventPacked); } -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) +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_EVENT(GetEventProfilingInfo, "event = 0x%016" PRIxPTR @@ -737,11 +732,11 @@ cl_int CL_API_CALL CL_GetEventProfilingInfo(cl_event event, ANGLE_CL_VALIDATE_ERROR(GetEventProfilingInfo, eventPacked, param_namePacked, param_value_size, param_value, param_value_size_ret); - return (GetEventProfilingInfo(eventPacked, param_namePacked, param_value_size, param_value, - param_value_size_ret)); + return GetEventProfilingInfo(eventPacked, param_namePacked, param_value_size, param_value, + param_value_size_ret); } -cl_int CL_API_CALL CL_Flush(cl_command_queue command_queue) +cl_int CL_API_CALL clFlush(cl_command_queue command_queue) { CL_EVENT(Flush, "command_queue = 0x%016" PRIxPTR "", (uintptr_t)command_queue); @@ -749,10 +744,10 @@ cl_int CL_API_CALL CL_Flush(cl_command_queue command_queue) ANGLE_CL_VALIDATE_ERROR(Flush, command_queuePacked); - return (Flush(command_queuePacked)); + return Flush(command_queuePacked); } -cl_int CL_API_CALL CL_Finish(cl_command_queue command_queue) +cl_int CL_API_CALL clFinish(cl_command_queue command_queue) { CL_EVENT(Finish, "command_queue = 0x%016" PRIxPTR "", (uintptr_t)command_queue); @@ -760,18 +755,18 @@ cl_int CL_API_CALL CL_Finish(cl_command_queue command_queue) ANGLE_CL_VALIDATE_ERROR(Finish, command_queuePacked); - return (Finish(command_queuePacked)); + return Finish(command_queuePacked); } -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) +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_EVENT(EnqueueReadBuffer, "command_queue = 0x%016" PRIxPTR ", buffer = 0x%016" PRIxPTR @@ -790,19 +785,19 @@ cl_int CL_API_CALL CL_EnqueueReadBuffer(cl_command_queue command_queue, offset, size, ptr, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueReadBuffer(command_queuePacked, bufferPacked, blocking_read, offset, size, ptr, - num_events_in_wait_list, event_wait_listPacked, eventPacked)); + return EnqueueReadBuffer(command_queuePacked, bufferPacked, blocking_read, offset, size, ptr, + num_events_in_wait_list, event_wait_listPacked, eventPacked); } -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) +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_EVENT(EnqueueWriteBuffer, "command_queue = 0x%016" PRIxPTR ", buffer = 0x%016" PRIxPTR @@ -821,19 +816,19 @@ cl_int CL_API_CALL CL_EnqueueWriteBuffer(cl_command_queue command_queue, offset, size, ptr, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueWriteBuffer(command_queuePacked, bufferPacked, blocking_write, offset, size, ptr, - num_events_in_wait_list, event_wait_listPacked, eventPacked)); + return EnqueueWriteBuffer(command_queuePacked, bufferPacked, blocking_write, offset, size, ptr, + num_events_in_wait_list, event_wait_listPacked, eventPacked); } -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) +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_EVENT(EnqueueCopyBuffer, "command_queue = 0x%016" PRIxPTR ", src_buffer = 0x%016" PRIxPTR @@ -854,22 +849,22 @@ cl_int CL_API_CALL CL_EnqueueCopyBuffer(cl_command_queue command_queue, dst_bufferPacked, src_offset, dst_offset, size, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueCopyBuffer(command_queuePacked, src_bufferPacked, dst_bufferPacked, src_offset, - dst_offset, size, num_events_in_wait_list, event_wait_listPacked, - eventPacked)); + return EnqueueCopyBuffer(command_queuePacked, src_bufferPacked, dst_bufferPacked, src_offset, + dst_offset, size, num_events_in_wait_list, event_wait_listPacked, + eventPacked); } -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) +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_EVENT(EnqueueReadImage, "command_queue = 0x%016" PRIxPTR ", image = 0x%016" PRIxPTR @@ -890,22 +885,22 @@ cl_int CL_API_CALL CL_EnqueueReadImage(cl_command_queue command_queue, origin, region, row_pitch, slice_pitch, ptr, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueReadImage(command_queuePacked, imagePacked, blocking_read, origin, region, - row_pitch, slice_pitch, ptr, num_events_in_wait_list, - event_wait_listPacked, eventPacked)); + return EnqueueReadImage(command_queuePacked, imagePacked, blocking_read, origin, region, + row_pitch, slice_pitch, ptr, num_events_in_wait_list, + event_wait_listPacked, eventPacked); } -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) +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_EVENT(EnqueueWriteImage, "command_queue = 0x%016" PRIxPTR ", image = 0x%016" PRIxPTR @@ -926,20 +921,20 @@ cl_int CL_API_CALL CL_EnqueueWriteImage(cl_command_queue command_queue, origin, region, input_row_pitch, input_slice_pitch, ptr, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueWriteImage(command_queuePacked, imagePacked, blocking_write, origin, region, - input_row_pitch, input_slice_pitch, ptr, num_events_in_wait_list, - event_wait_listPacked, eventPacked)); + return EnqueueWriteImage(command_queuePacked, imagePacked, blocking_write, origin, region, + input_row_pitch, input_slice_pitch, ptr, num_events_in_wait_list, + event_wait_listPacked, eventPacked); } -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) +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_EVENT(EnqueueCopyImage, "command_queue = 0x%016" PRIxPTR ", src_image = 0x%016" PRIxPTR @@ -961,20 +956,20 @@ cl_int CL_API_CALL CL_EnqueueCopyImage(cl_command_queue command_queue, src_origin, dst_origin, region, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueCopyImage(command_queuePacked, src_imagePacked, dst_imagePacked, src_origin, - dst_origin, region, num_events_in_wait_list, event_wait_listPacked, - eventPacked)); + return EnqueueCopyImage(command_queuePacked, src_imagePacked, dst_imagePacked, src_origin, + dst_origin, region, num_events_in_wait_list, event_wait_listPacked, + eventPacked); } -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) +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_EVENT(EnqueueCopyImageToBuffer, "command_queue = 0x%016" PRIxPTR ", src_image = 0x%016" PRIxPTR @@ -996,20 +991,20 @@ cl_int CL_API_CALL CL_EnqueueCopyImageToBuffer(cl_command_queue command_queue, dst_bufferPacked, src_origin, region, dst_offset, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueCopyImageToBuffer(command_queuePacked, src_imagePacked, dst_bufferPacked, - src_origin, region, dst_offset, num_events_in_wait_list, - event_wait_listPacked, eventPacked)); + return EnqueueCopyImageToBuffer(command_queuePacked, src_imagePacked, dst_bufferPacked, + src_origin, region, dst_offset, num_events_in_wait_list, + event_wait_listPacked, eventPacked); } -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) +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) { CL_EVENT(EnqueueCopyBufferToImage, "command_queue = 0x%016" PRIxPTR ", src_buffer = 0x%016" PRIxPTR @@ -1031,21 +1026,21 @@ cl_int CL_API_CALL CL_EnqueueCopyBufferToImage(cl_command_queue command_queue, dst_imagePacked, src_offset, dst_origin, region, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueCopyBufferToImage(command_queuePacked, src_bufferPacked, dst_imagePacked, - src_offset, dst_origin, region, num_events_in_wait_list, - event_wait_listPacked, eventPacked)); + return EnqueueCopyBufferToImage(command_queuePacked, src_bufferPacked, dst_imagePacked, + src_offset, dst_origin, region, num_events_in_wait_list, + event_wait_listPacked, eventPacked); } -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) +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) { CL_EVENT(EnqueueMapBuffer, "command_queue = 0x%016" PRIxPTR ", buffer = 0x%016" PRIxPTR @@ -1065,23 +1060,23 @@ void *CL_API_CALL CL_EnqueueMapBuffer(cl_command_queue command_queue, map_flags, offset, size, num_events_in_wait_list, event_wait_listPacked, eventPacked, errcode_ret); - return (EnqueueMapBuffer(command_queuePacked, bufferPacked, blocking_map, map_flags, offset, - size, num_events_in_wait_list, event_wait_listPacked, eventPacked, - errcode_ret)); + return EnqueueMapBuffer(command_queuePacked, bufferPacked, blocking_map, map_flags, offset, + size, num_events_in_wait_list, event_wait_listPacked, eventPacked, + errcode_ret); } -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) +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_EVENT(EnqueueMapImage, "command_queue = 0x%016" PRIxPTR ", image = 0x%016" PRIxPTR @@ -1105,17 +1100,17 @@ void *CL_API_CALL CL_EnqueueMapImage(cl_command_queue command_queue, num_events_in_wait_list, event_wait_listPacked, eventPacked, errcode_ret); - return (EnqueueMapImage(command_queuePacked, imagePacked, blocking_map, map_flags, origin, - region, image_row_pitch, image_slice_pitch, num_events_in_wait_list, - event_wait_listPacked, eventPacked, errcode_ret)); + return EnqueueMapImage(command_queuePacked, imagePacked, blocking_map, map_flags, origin, + region, image_row_pitch, image_slice_pitch, num_events_in_wait_list, + event_wait_listPacked, eventPacked, errcode_ret); } -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) +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_EVENT(EnqueueUnmapMemObject, "command_queue = 0x%016" PRIxPTR ", memobj = 0x%016" PRIxPTR @@ -1133,19 +1128,19 @@ cl_int CL_API_CALL CL_EnqueueUnmapMemObject(cl_command_queue command_queue, ANGLE_CL_VALIDATE_ERROR(EnqueueUnmapMemObject, command_queuePacked, memobjPacked, mapped_ptr, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueUnmapMemObject(command_queuePacked, memobjPacked, mapped_ptr, - num_events_in_wait_list, event_wait_listPacked, eventPacked)); + return EnqueueUnmapMemObject(command_queuePacked, memobjPacked, mapped_ptr, + num_events_in_wait_list, event_wait_listPacked, eventPacked); } -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) +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_EVENT(EnqueueNDRangeKernel, "command_queue = 0x%016" PRIxPTR ", kernel = 0x%016" PRIxPTR @@ -1166,21 +1161,21 @@ cl_int CL_API_CALL CL_EnqueueNDRangeKernel(cl_command_queue command_queue, global_work_offset, global_work_size, local_work_size, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueNDRangeKernel(command_queuePacked, kernelPacked, work_dim, global_work_offset, - global_work_size, local_work_size, num_events_in_wait_list, - event_wait_listPacked, eventPacked)); + return EnqueueNDRangeKernel(command_queuePacked, kernelPacked, work_dim, global_work_offset, + global_work_size, local_work_size, num_events_in_wait_list, + event_wait_listPacked, eventPacked); } -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) +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_EVENT(EnqueueNativeKernel, "command_queue = 0x%016" PRIxPTR ", user_func = 0x%016" PRIxPTR @@ -1202,15 +1197,15 @@ cl_int CL_API_CALL CL_EnqueueNativeKernel(cl_command_queue command_queue, num_mem_objects, mem_listPacked, args_mem_loc, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueNativeKernel(command_queuePacked, user_func, args, cb_args, num_mem_objects, - mem_listPacked, args_mem_loc, num_events_in_wait_list, - event_wait_listPacked, eventPacked)); + return EnqueueNativeKernel(command_queuePacked, user_func, args, cb_args, num_mem_objects, + mem_listPacked, args_mem_loc, num_events_in_wait_list, + event_wait_listPacked, eventPacked); } -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) +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_EVENT(SetCommandQueueProperty, "command_queue = 0x%016" PRIxPTR @@ -1222,17 +1217,17 @@ cl_int CL_API_CALL CL_SetCommandQueueProperty(cl_command_queue command_queue, ANGLE_CL_VALIDATE_ERROR(SetCommandQueueProperty, command_queuePacked, properties, enable, old_properties); - return (SetCommandQueueProperty(command_queuePacked, properties, enable, old_properties)); + return SetCommandQueueProperty(command_queuePacked, properties, enable, old_properties); } -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 *errcode_ret) +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_EVENT( CreateImage2D, @@ -1247,20 +1242,20 @@ cl_mem CL_API_CALL CL_CreateImage2D(cl_context context, ANGLE_CL_VALIDATE_POINTER(CreateImage2D, contextPacked, flags, image_format, image_width, image_height, image_row_pitch, host_ptr, errcode_ret); - return UnpackParam<cl_mem>(CreateImage2D(contextPacked, flags, image_format, image_width, - image_height, image_row_pitch, host_ptr, errcode_ret)); + return CreateImage2D(contextPacked, flags, image_format, image_width, image_height, + image_row_pitch, host_ptr, errcode_ret); } -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_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_EVENT( CreateImage3D, @@ -1276,12 +1271,11 @@ cl_mem CL_API_CALL CL_CreateImage3D(cl_context context, image_height, image_depth, image_row_pitch, image_slice_pitch, host_ptr, errcode_ret); - return UnpackParam<cl_mem>(CreateImage3D(contextPacked, flags, image_format, image_width, - image_height, image_depth, image_row_pitch, - image_slice_pitch, host_ptr, errcode_ret)); + return CreateImage3D(contextPacked, flags, image_format, image_width, image_height, image_depth, + image_row_pitch, image_slice_pitch, host_ptr, errcode_ret); } -cl_int CL_API_CALL CL_EnqueueMarker(cl_command_queue command_queue, cl_event *event) +cl_int CL_API_CALL clEnqueueMarker(cl_command_queue command_queue, cl_event *event) { CL_EVENT(EnqueueMarker, "command_queue = 0x%016" PRIxPTR ", event = 0x%016" PRIxPTR "", (uintptr_t)command_queue, (uintptr_t)event); @@ -1291,12 +1285,12 @@ cl_int CL_API_CALL CL_EnqueueMarker(cl_command_queue command_queue, cl_event *ev ANGLE_CL_VALIDATE_ERROR(EnqueueMarker, command_queuePacked, eventPacked); - return (EnqueueMarker(command_queuePacked, eventPacked)); + return EnqueueMarker(command_queuePacked, eventPacked); } -cl_int CL_API_CALL CL_EnqueueWaitForEvents(cl_command_queue command_queue, - cl_uint num_events, - const cl_event *event_list) +cl_int CL_API_CALL clEnqueueWaitForEvents(cl_command_queue command_queue, + cl_uint num_events, + const cl_event *event_list) { CL_EVENT(EnqueueWaitForEvents, "command_queue = 0x%016" PRIxPTR ", num_events = %u, event_list = 0x%016" PRIxPTR "", @@ -1308,10 +1302,10 @@ cl_int CL_API_CALL CL_EnqueueWaitForEvents(cl_command_queue command_queue, ANGLE_CL_VALIDATE_ERROR(EnqueueWaitForEvents, command_queuePacked, num_events, event_listPacked); - return (EnqueueWaitForEvents(command_queuePacked, num_events, event_listPacked)); + return EnqueueWaitForEvents(command_queuePacked, num_events, event_listPacked); } -cl_int CL_API_CALL CL_EnqueueBarrier(cl_command_queue command_queue) +cl_int CL_API_CALL clEnqueueBarrier(cl_command_queue command_queue) { CL_EVENT(EnqueueBarrier, "command_queue = 0x%016" PRIxPTR "", (uintptr_t)command_queue); @@ -1319,31 +1313,31 @@ cl_int CL_API_CALL CL_EnqueueBarrier(cl_command_queue command_queue) ANGLE_CL_VALIDATE_ERROR(EnqueueBarrier, command_queuePacked); - return (EnqueueBarrier(command_queuePacked)); + return EnqueueBarrier(command_queuePacked); } -cl_int CL_API_CALL CL_UnloadCompiler() +cl_int CL_API_CALL clUnloadCompiler() { CL_EVENT(UnloadCompiler, ""); ANGLE_CL_VALIDATE_ERROR(UnloadCompiler); - return (UnloadCompiler()); + return UnloadCompiler(); } -void *CL_API_CALL CL_GetExtensionFunctionAddress(const char *func_name) +void *CL_API_CALL clGetExtensionFunctionAddress(const char *func_name) { CL_EVENT(GetExtensionFunctionAddress, "func_name = 0x%016" PRIxPTR "", (uintptr_t)func_name); ANGLE_CL_VALIDATE_POINTER(GetExtensionFunctionAddress, func_name); - return (GetExtensionFunctionAddress(func_name)); + return GetExtensionFunctionAddress(func_name); } -cl_command_queue CL_API_CALL CL_CreateCommandQueue(cl_context context, - cl_device_id device, - cl_command_queue_properties properties, - cl_int *errcode_ret) +cl_command_queue CL_API_CALL clCreateCommandQueue(cl_context context, + cl_device_id device, + cl_command_queue_properties properties, + cl_int *errcode_ret) { CL_EVENT(CreateCommandQueue, "context = 0x%016" PRIxPTR ", device = 0x%016" PRIxPTR @@ -1356,15 +1350,14 @@ cl_command_queue CL_API_CALL CL_CreateCommandQueue(cl_context context, ANGLE_CL_VALIDATE_POINTER(CreateCommandQueue, contextPacked, devicePacked, properties, errcode_ret); - return UnpackParam<cl_command_queue>( - CreateCommandQueue(contextPacked, devicePacked, properties, errcode_ret)); + return CreateCommandQueue(contextPacked, devicePacked, properties, errcode_ret); } -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) +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_EVENT(CreateSampler, "context = 0x%016" PRIxPTR @@ -1380,15 +1373,15 @@ cl_sampler CL_API_CALL CL_CreateSampler(cl_context context, ANGLE_CL_VALIDATE_POINTER(CreateSampler, contextPacked, normalized_coords, addressing_modePacked, filter_modePacked, errcode_ret); - return UnpackParam<cl_sampler>(CreateSampler( - contextPacked, normalized_coords, addressing_modePacked, filter_modePacked, errcode_ret)); + return CreateSampler(contextPacked, normalized_coords, addressing_modePacked, filter_modePacked, + errcode_ret); } -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 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_EVENT(EnqueueTask, "command_queue = 0x%016" PRIxPTR ", kernel = 0x%016" PRIxPTR @@ -1405,16 +1398,16 @@ cl_int CL_API_CALL CL_EnqueueTask(cl_command_queue command_queue, ANGLE_CL_VALIDATE_ERROR(EnqueueTask, command_queuePacked, kernelPacked, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueTask(command_queuePacked, kernelPacked, num_events_in_wait_list, - event_wait_listPacked, eventPacked)); + return EnqueueTask(command_queuePacked, kernelPacked, num_events_in_wait_list, + event_wait_listPacked, eventPacked); } // CL 1.1 -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) +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_EVENT(CreateSubBuffer, "buffer = 0x%016" PRIxPTR @@ -1428,14 +1421,14 @@ cl_mem CL_API_CALL CL_CreateSubBuffer(cl_mem buffer, ANGLE_CL_VALIDATE_POINTER(CreateSubBuffer, bufferPacked, flags, buffer_create_type, buffer_create_info, errcode_ret); - return UnpackParam<cl_mem>( - CreateSubBuffer(bufferPacked, flags, buffer_create_type, buffer_create_info, errcode_ret)); + return CreateSubBuffer(bufferPacked, flags, buffer_create_type, buffer_create_info, + errcode_ret); } -cl_int CL_API_CALL CL_SetMemObjectDestructorCallback(cl_mem memobj, - void(CL_CALLBACK *pfn_notify)(cl_mem memobj, - void *user_data), - void *user_data) +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(SetMemObjectDestructorCallback, "memobj = 0x%016" PRIxPTR ", pfn_notify = 0x%016" PRIxPTR @@ -1446,10 +1439,10 @@ cl_int CL_API_CALL CL_SetMemObjectDestructorCallback(cl_mem memobj, ANGLE_CL_VALIDATE_ERROR(SetMemObjectDestructorCallback, memobjPacked, pfn_notify, user_data); - return (SetMemObjectDestructorCallback(memobjPacked, pfn_notify, user_data)); + return SetMemObjectDestructorCallback(memobjPacked, pfn_notify, user_data); } -cl_event CL_API_CALL CL_CreateUserEvent(cl_context context, cl_int *errcode_ret) +cl_event CL_API_CALL clCreateUserEvent(cl_context context, cl_int *errcode_ret) { CL_EVENT(CreateUserEvent, "context = 0x%016" PRIxPTR ", errcode_ret = 0x%016" PRIxPTR "", (uintptr_t)context, (uintptr_t)errcode_ret); @@ -1458,10 +1451,10 @@ cl_event CL_API_CALL CL_CreateUserEvent(cl_context context, cl_int *errcode_ret) ANGLE_CL_VALIDATE_POINTER(CreateUserEvent, contextPacked, errcode_ret); - return UnpackParam<cl_event>(CreateUserEvent(contextPacked, errcode_ret)); + return CreateUserEvent(contextPacked, errcode_ret); } -cl_int CL_API_CALL CL_SetUserEventStatus(cl_event event, cl_int execution_status) +cl_int CL_API_CALL clSetUserEventStatus(cl_event event, cl_int execution_status) { CL_EVENT(SetUserEventStatus, "event = 0x%016" PRIxPTR ", execution_status = %d", (uintptr_t)event, execution_status); @@ -1470,15 +1463,15 @@ cl_int CL_API_CALL CL_SetUserEventStatus(cl_event event, cl_int execution_status ANGLE_CL_VALIDATE_ERROR(SetUserEventStatus, eventPacked, execution_status); - return (SetUserEventStatus(eventPacked, execution_status)); + return SetUserEventStatus(eventPacked, execution_status); } -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) +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_EVENT( SetEventCallback, @@ -1491,23 +1484,23 @@ cl_int CL_API_CALL CL_SetEventCallback(cl_event event, ANGLE_CL_VALIDATE_ERROR(SetEventCallback, eventPacked, command_exec_callback_type, pfn_notify, user_data); - return (SetEventCallback(eventPacked, command_exec_callback_type, pfn_notify, user_data)); + return SetEventCallback(eventPacked, command_exec_callback_type, pfn_notify, user_data); } -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) +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_EVENT(EnqueueReadBufferRect, "command_queue = 0x%016" PRIxPTR ", buffer = 0x%016" PRIxPTR @@ -1532,26 +1525,26 @@ cl_int CL_API_CALL CL_EnqueueReadBufferRect(cl_command_queue command_queue, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueReadBufferRect(command_queuePacked, bufferPacked, 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_listPacked, eventPacked)); -} - -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) + return EnqueueReadBufferRect(command_queuePacked, bufferPacked, 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_listPacked, eventPacked); +} + +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_EVENT(EnqueueWriteBufferRect, "command_queue = 0x%016" PRIxPTR ", buffer = 0x%016" PRIxPTR @@ -1576,25 +1569,25 @@ cl_int CL_API_CALL CL_EnqueueWriteBufferRect(cl_command_queue command_queue, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueWriteBufferRect(command_queuePacked, bufferPacked, 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_listPacked, eventPacked)); -} - -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) + return EnqueueWriteBufferRect(command_queuePacked, bufferPacked, 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_listPacked, eventPacked); +} + +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_EVENT(EnqueueCopyBufferRect, "command_queue = 0x%016" PRIxPTR ", src_buffer = 0x%016" PRIxPTR @@ -1619,18 +1612,18 @@ cl_int CL_API_CALL CL_EnqueueCopyBufferRect(cl_command_queue command_queue, src_slice_pitch, dst_row_pitch, dst_slice_pitch, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueCopyBufferRect(command_queuePacked, src_bufferPacked, dst_bufferPacked, - src_origin, dst_origin, region, src_row_pitch, src_slice_pitch, - dst_row_pitch, dst_slice_pitch, num_events_in_wait_list, - event_wait_listPacked, eventPacked)); + return EnqueueCopyBufferRect(command_queuePacked, src_bufferPacked, dst_bufferPacked, + src_origin, dst_origin, region, src_row_pitch, src_slice_pitch, + dst_row_pitch, dst_slice_pitch, num_events_in_wait_list, + event_wait_listPacked, eventPacked); } // CL 1.2 -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) +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_EVENT(CreateSubDevices, "in_device = 0x%016" PRIxPTR ", properties = 0x%016" PRIxPTR @@ -1645,11 +1638,11 @@ cl_int CL_API_CALL CL_CreateSubDevices(cl_device_id in_device, ANGLE_CL_VALIDATE_ERROR(CreateSubDevices, in_devicePacked, properties, num_devices, out_devicesPacked, num_devices_ret); - return (CreateSubDevices(in_devicePacked, properties, num_devices, out_devicesPacked, - num_devices_ret)); + return CreateSubDevices(in_devicePacked, properties, num_devices, out_devicesPacked, + num_devices_ret); } -cl_int CL_API_CALL CL_RetainDevice(cl_device_id device) +cl_int CL_API_CALL clRetainDevice(cl_device_id device) { CL_EVENT(RetainDevice, "device = 0x%016" PRIxPTR "", (uintptr_t)device); @@ -1657,10 +1650,10 @@ cl_int CL_API_CALL CL_RetainDevice(cl_device_id device) ANGLE_CL_VALIDATE_ERROR(RetainDevice, devicePacked); - return (RetainDevice(devicePacked)); + return RetainDevice(devicePacked); } -cl_int CL_API_CALL CL_ReleaseDevice(cl_device_id device) +cl_int CL_API_CALL clReleaseDevice(cl_device_id device) { CL_EVENT(ReleaseDevice, "device = 0x%016" PRIxPTR "", (uintptr_t)device); @@ -1668,15 +1661,15 @@ cl_int CL_API_CALL CL_ReleaseDevice(cl_device_id device) ANGLE_CL_VALIDATE_ERROR(ReleaseDevice, devicePacked); - return (ReleaseDevice(devicePacked)); + return ReleaseDevice(devicePacked); } -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) +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_EVENT(CreateImage, "context = 0x%016" PRIxPTR ", flags = %lu, image_format = 0x%016" PRIxPTR @@ -1690,15 +1683,14 @@ cl_mem CL_API_CALL CL_CreateImage(cl_context context, ANGLE_CL_VALIDATE_POINTER(CreateImage, contextPacked, flags, image_format, image_desc, host_ptr, errcode_ret); - return UnpackParam<cl_mem>( - CreateImage(contextPacked, flags, image_format, image_desc, host_ptr, errcode_ret)); + return CreateImage(contextPacked, flags, image_format, image_desc, host_ptr, errcode_ret); } -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) +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_EVENT(CreateProgramWithBuiltInKernels, "context = 0x%016" PRIxPTR ", num_devices = %u, device_list = 0x%016" PRIxPTR @@ -1712,20 +1704,20 @@ cl_program CL_API_CALL CL_CreateProgramWithBuiltInKernels(cl_context context, ANGLE_CL_VALIDATE_POINTER(CreateProgramWithBuiltInKernels, contextPacked, num_devices, device_listPacked, kernel_names, errcode_ret); - return UnpackParam<cl_program>(CreateProgramWithBuiltInKernels( - contextPacked, num_devices, device_listPacked, kernel_names, errcode_ret)); + return CreateProgramWithBuiltInKernels(contextPacked, num_devices, device_listPacked, + kernel_names, errcode_ret); } -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) +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_EVENT(CompileProgram, "program = 0x%016" PRIxPTR ", num_devices = %u, device_list = 0x%016" PRIxPTR @@ -1744,21 +1736,20 @@ cl_int CL_API_CALL CL_CompileProgram(cl_program program, num_input_headers, input_headersPacked, header_include_names, pfn_notify, user_data); - return (CompileProgram(programPacked, num_devices, device_listPacked, options, - num_input_headers, input_headersPacked, header_include_names, pfn_notify, - user_data)); + return CompileProgram(programPacked, num_devices, device_listPacked, options, num_input_headers, + input_headersPacked, header_include_names, pfn_notify, user_data); } -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) +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_EVENT(LinkProgram, "context = 0x%016" PRIxPTR ", num_devices = %u, device_list = 0x%016" PRIxPTR @@ -1778,12 +1769,11 @@ cl_program CL_API_CALL CL_LinkProgram(cl_context context, num_input_programs, input_programsPacked, pfn_notify, user_data, errcode_ret); - return UnpackParam<cl_program>(LinkProgram(contextPacked, num_devices, device_listPacked, - options, num_input_programs, input_programsPacked, - pfn_notify, user_data, errcode_ret)); + return LinkProgram(contextPacked, num_devices, device_listPacked, options, num_input_programs, + input_programsPacked, pfn_notify, user_data, errcode_ret); } -cl_int CL_API_CALL CL_UnloadPlatformCompiler(cl_platform_id platform) +cl_int CL_API_CALL clUnloadPlatformCompiler(cl_platform_id platform) { CL_EVENT(UnloadPlatformCompiler, "platform = 0x%016" PRIxPTR "", (uintptr_t)platform); @@ -1791,15 +1781,15 @@ cl_int CL_API_CALL CL_UnloadPlatformCompiler(cl_platform_id platform) ANGLE_CL_VALIDATE_ERROR(UnloadPlatformCompiler, platformPacked); - return (UnloadPlatformCompiler(platformPacked)); + return UnloadPlatformCompiler(platformPacked); } -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) +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_EVENT( GetKernelArgInfo, @@ -1815,19 +1805,19 @@ cl_int CL_API_CALL CL_GetKernelArgInfo(cl_kernel kernel, ANGLE_CL_VALIDATE_ERROR(GetKernelArgInfo, kernelPacked, arg_index, param_namePacked, param_value_size, param_value, param_value_size_ret); - return (GetKernelArgInfo(kernelPacked, arg_index, param_namePacked, param_value_size, - param_value, param_value_size_ret)); + return GetKernelArgInfo(kernelPacked, arg_index, param_namePacked, param_value_size, + param_value, param_value_size_ret); } -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) +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_EVENT(EnqueueFillBuffer, "command_queue = 0x%016" PRIxPTR ", buffer = 0x%016" PRIxPTR @@ -1846,18 +1836,18 @@ cl_int CL_API_CALL CL_EnqueueFillBuffer(cl_command_queue command_queue, pattern_size, offset, size, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueFillBuffer(command_queuePacked, bufferPacked, pattern, pattern_size, offset, - size, num_events_in_wait_list, event_wait_listPacked, eventPacked)); + return EnqueueFillBuffer(command_queuePacked, bufferPacked, pattern, pattern_size, offset, size, + num_events_in_wait_list, event_wait_listPacked, eventPacked); } -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) +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_EVENT(EnqueueFillImage, "command_queue = 0x%016" PRIxPTR ", image = 0x%016" PRIxPTR @@ -1876,17 +1866,17 @@ cl_int CL_API_CALL CL_EnqueueFillImage(cl_command_queue command_queue, ANGLE_CL_VALIDATE_ERROR(EnqueueFillImage, command_queuePacked, imagePacked, fill_color, origin, region, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueFillImage(command_queuePacked, imagePacked, fill_color, origin, region, - num_events_in_wait_list, event_wait_listPacked, eventPacked)); + return EnqueueFillImage(command_queuePacked, imagePacked, fill_color, origin, region, + num_events_in_wait_list, event_wait_listPacked, eventPacked); } -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) +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_EVENT(EnqueueMigrateMemObjects, "command_queue = 0x%016" PRIxPTR ", num_mem_objects = %u, mem_objects = 0x%016" PRIxPTR @@ -1904,14 +1894,14 @@ cl_int CL_API_CALL CL_EnqueueMigrateMemObjects(cl_command_queue command_queue, mem_objectsPacked, flags, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueMigrateMemObjects(command_queuePacked, num_mem_objects, mem_objectsPacked, flags, - num_events_in_wait_list, event_wait_listPacked, eventPacked)); + return EnqueueMigrateMemObjects(command_queuePacked, num_mem_objects, mem_objectsPacked, flags, + num_events_in_wait_list, event_wait_listPacked, eventPacked); } -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) +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_EVENT(EnqueueMarkerWithWaitList, "command_queue = 0x%016" PRIxPTR @@ -1927,14 +1917,14 @@ cl_int CL_API_CALL CL_EnqueueMarkerWithWaitList(cl_command_queue command_queue, ANGLE_CL_VALIDATE_ERROR(EnqueueMarkerWithWaitList, command_queuePacked, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueMarkerWithWaitList(command_queuePacked, num_events_in_wait_list, - event_wait_listPacked, eventPacked)); + return EnqueueMarkerWithWaitList(command_queuePacked, num_events_in_wait_list, + event_wait_listPacked, eventPacked); } -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) +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) { CL_EVENT(EnqueueBarrierWithWaitList, "command_queue = 0x%016" PRIxPTR @@ -1950,12 +1940,12 @@ cl_int CL_API_CALL CL_EnqueueBarrierWithWaitList(cl_command_queue command_queue, ANGLE_CL_VALIDATE_ERROR(EnqueueBarrierWithWaitList, command_queuePacked, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueBarrierWithWaitList(command_queuePacked, num_events_in_wait_list, - event_wait_listPacked, eventPacked)); + return EnqueueBarrierWithWaitList(command_queuePacked, num_events_in_wait_list, + event_wait_listPacked, eventPacked); } -void *CL_API_CALL CL_GetExtensionFunctionAddressForPlatform(cl_platform_id platform, - const char *func_name) +void *CL_API_CALL clGetExtensionFunctionAddressForPlatform(cl_platform_id platform, + const char *func_name) { CL_EVENT(GetExtensionFunctionAddressForPlatform, "platform = 0x%016" PRIxPTR ", func_name = 0x%016" PRIxPTR "", (uintptr_t)platform, @@ -1965,15 +1955,15 @@ void *CL_API_CALL CL_GetExtensionFunctionAddressForPlatform(cl_platform_id platf ANGLE_CL_VALIDATE_POINTER(GetExtensionFunctionAddressForPlatform, platformPacked, func_name); - return (GetExtensionFunctionAddressForPlatform(platformPacked, func_name)); + return GetExtensionFunctionAddressForPlatform(platformPacked, func_name); } // CL 2.0 cl_command_queue CL_API_CALL -CL_CreateCommandQueueWithProperties(cl_context context, - cl_device_id device, - const cl_queue_properties *properties, - cl_int *errcode_ret) +clCreateCommandQueueWithProperties(cl_context context, + cl_device_id device, + const cl_queue_properties *properties, + cl_int *errcode_ret) { CL_EVENT(CreateCommandQueueWithProperties, "context = 0x%016" PRIxPTR ", device = 0x%016" PRIxPTR ", properties = 0x%016" PRIxPTR @@ -1986,16 +1976,15 @@ CL_CreateCommandQueueWithProperties(cl_context context, ANGLE_CL_VALIDATE_POINTER(CreateCommandQueueWithProperties, contextPacked, devicePacked, properties, errcode_ret); - return UnpackParam<cl_command_queue>( - CreateCommandQueueWithProperties(contextPacked, devicePacked, properties, errcode_ret)); + return CreateCommandQueueWithProperties(contextPacked, devicePacked, properties, errcode_ret); } -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) +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_EVENT( CreatePipe, @@ -2010,15 +1999,15 @@ cl_mem CL_API_CALL CL_CreatePipe(cl_context context, ANGLE_CL_VALIDATE_POINTER(CreatePipe, contextPacked, flags, pipe_packet_size, pipe_max_packets, properties, errcode_ret); - return UnpackParam<cl_mem>(CreatePipe(contextPacked, flags, pipe_packet_size, pipe_max_packets, - properties, errcode_ret)); + return CreatePipe(contextPacked, flags, pipe_packet_size, pipe_max_packets, properties, + errcode_ret); } -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) +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) { CL_EVENT(GetPipeInfo, "pipe = 0x%016" PRIxPTR @@ -2033,14 +2022,14 @@ cl_int CL_API_CALL CL_GetPipeInfo(cl_mem pipe, ANGLE_CL_VALIDATE_ERROR(GetPipeInfo, pipePacked, param_namePacked, param_value_size, param_value, param_value_size_ret); - return (GetPipeInfo(pipePacked, param_namePacked, param_value_size, param_value, - param_value_size_ret)); + return GetPipeInfo(pipePacked, param_namePacked, param_value_size, param_value, + param_value_size_ret); } -void *CL_API_CALL CL_SVMAlloc(cl_context context, - cl_svm_mem_flags flags, - size_t size, - cl_uint alignment) +void *CL_API_CALL clSVMAlloc(cl_context context, + cl_svm_mem_flags flags, + size_t size, + cl_uint alignment) { CL_EVENT(SVMAlloc, "context = 0x%016" PRIxPTR ", flags = %lu, size = %zu, alignment = %u", (uintptr_t)context, flags, size, alignment); @@ -2049,10 +2038,10 @@ void *CL_API_CALL CL_SVMAlloc(cl_context context, ANGLE_CL_VALIDATE_POINTER(SVMAlloc, contextPacked, flags, size, alignment); - return (SVMAlloc(contextPacked, flags, size, alignment)); + return SVMAlloc(contextPacked, flags, size, alignment); } -void CL_API_CALL CL_SVMFree(cl_context context, void *svm_pointer) +void CL_API_CALL clSVMFree(cl_context context, void *svm_pointer) { CL_EVENT(SVMFree, "context = 0x%016" PRIxPTR ", svm_pointer = 0x%016" PRIxPTR "", (uintptr_t)context, (uintptr_t)svm_pointer); @@ -2065,9 +2054,9 @@ void CL_API_CALL CL_SVMFree(cl_context context, void *svm_pointer) } cl_sampler CL_API_CALL -CL_CreateSamplerWithProperties(cl_context context, - const cl_sampler_properties *sampler_properties, - cl_int *errcode_ret) +clCreateSamplerWithProperties(cl_context context, + const cl_sampler_properties *sampler_properties, + cl_int *errcode_ret) { CL_EVENT(CreateSamplerWithProperties, "context = 0x%016" PRIxPTR ", sampler_properties = 0x%016" PRIxPTR @@ -2079,13 +2068,12 @@ CL_CreateSamplerWithProperties(cl_context context, ANGLE_CL_VALIDATE_POINTER(CreateSamplerWithProperties, contextPacked, sampler_properties, errcode_ret); - return UnpackParam<cl_sampler>( - CreateSamplerWithProperties(contextPacked, sampler_properties, errcode_ret)); + return CreateSamplerWithProperties(contextPacked, sampler_properties, errcode_ret); } -cl_int CL_API_CALL CL_SetKernelArgSVMPointer(cl_kernel kernel, - cl_uint arg_index, - const void *arg_value) +cl_int CL_API_CALL clSetKernelArgSVMPointer(cl_kernel kernel, + cl_uint arg_index, + const void *arg_value) { CL_EVENT(SetKernelArgSVMPointer, "kernel = 0x%016" PRIxPTR ", arg_index = %u, arg_value = 0x%016" PRIxPTR "", @@ -2095,13 +2083,13 @@ cl_int CL_API_CALL CL_SetKernelArgSVMPointer(cl_kernel kernel, ANGLE_CL_VALIDATE_ERROR(SetKernelArgSVMPointer, kernelPacked, arg_index, arg_value); - return (SetKernelArgSVMPointer(kernelPacked, arg_index, arg_value)); + return SetKernelArgSVMPointer(kernelPacked, arg_index, arg_value); } -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) +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_EVENT(SetKernelExecInfo, "kernel = 0x%016" PRIxPTR @@ -2114,20 +2102,20 @@ cl_int CL_API_CALL CL_SetKernelExecInfo(cl_kernel kernel, ANGLE_CL_VALIDATE_ERROR(SetKernelExecInfo, kernelPacked, param_namePacked, param_value_size, param_value); - return (SetKernelExecInfo(kernelPacked, param_namePacked, param_value_size, param_value)); + return SetKernelExecInfo(kernelPacked, param_namePacked, param_value_size, param_value); } -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) +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_EVENT(EnqueueSVMFree, "command_queue = 0x%016" PRIxPTR @@ -2147,18 +2135,18 @@ cl_int CL_API_CALL CL_EnqueueSVMFree(cl_command_queue command_queue, pfn_free_func, user_data, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueSVMFree(command_queuePacked, num_svm_pointers, svm_pointers, pfn_free_func, - user_data, num_events_in_wait_list, event_wait_listPacked, eventPacked)); + return EnqueueSVMFree(command_queuePacked, num_svm_pointers, svm_pointers, pfn_free_func, + user_data, num_events_in_wait_list, event_wait_listPacked, eventPacked); } -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) +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_EVENT(EnqueueSVMMemcpy, "command_queue = 0x%016" PRIxPTR ", blocking_copy = %u, dst_ptr = 0x%016" PRIxPTR @@ -2175,18 +2163,18 @@ cl_int CL_API_CALL CL_EnqueueSVMMemcpy(cl_command_queue command_queue, ANGLE_CL_VALIDATE_ERROR(EnqueueSVMMemcpy, command_queuePacked, blocking_copy, dst_ptr, src_ptr, size, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueSVMMemcpy(command_queuePacked, blocking_copy, dst_ptr, src_ptr, size, - num_events_in_wait_list, event_wait_listPacked, eventPacked)); + return EnqueueSVMMemcpy(command_queuePacked, blocking_copy, dst_ptr, src_ptr, size, + num_events_in_wait_list, event_wait_listPacked, eventPacked); } -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) +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_EVENT(EnqueueSVMMemFill, "command_queue = 0x%016" PRIxPTR ", svm_ptr = 0x%016" PRIxPTR @@ -2203,18 +2191,18 @@ cl_int CL_API_CALL CL_EnqueueSVMMemFill(cl_command_queue command_queue, ANGLE_CL_VALIDATE_ERROR(EnqueueSVMMemFill, command_queuePacked, svm_ptr, pattern, pattern_size, size, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueSVMMemFill(command_queuePacked, svm_ptr, pattern, pattern_size, size, - num_events_in_wait_list, event_wait_listPacked, eventPacked)); + return EnqueueSVMMemFill(command_queuePacked, svm_ptr, pattern, pattern_size, size, + num_events_in_wait_list, event_wait_listPacked, eventPacked); } -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) +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_EVENT(EnqueueSVMMap, "command_queue = 0x%016" PRIxPTR @@ -2231,15 +2219,15 @@ cl_int CL_API_CALL CL_EnqueueSVMMap(cl_command_queue command_queue, ANGLE_CL_VALIDATE_ERROR(EnqueueSVMMap, command_queuePacked, blocking_map, flags, svm_ptr, size, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueSVMMap(command_queuePacked, blocking_map, flags, svm_ptr, size, - num_events_in_wait_list, event_wait_listPacked, eventPacked)); + return EnqueueSVMMap(command_queuePacked, blocking_map, flags, svm_ptr, size, + num_events_in_wait_list, event_wait_listPacked, eventPacked); } -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_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_EVENT(EnqueueSVMUnmap, "command_queue = 0x%016" PRIxPTR ", svm_ptr = 0x%016" PRIxPTR @@ -2255,14 +2243,14 @@ cl_int CL_API_CALL CL_EnqueueSVMUnmap(cl_command_queue command_queue, ANGLE_CL_VALIDATE_ERROR(EnqueueSVMUnmap, command_queuePacked, svm_ptr, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueSVMUnmap(command_queuePacked, svm_ptr, num_events_in_wait_list, - event_wait_listPacked, eventPacked)); + return EnqueueSVMUnmap(command_queuePacked, svm_ptr, num_events_in_wait_list, + event_wait_listPacked, eventPacked); } // CL 2.1 -cl_int CL_API_CALL CL_SetDefaultDeviceCommandQueue(cl_context context, - cl_device_id device, - cl_command_queue command_queue) +cl_int CL_API_CALL clSetDefaultDeviceCommandQueue(cl_context context, + cl_device_id device, + cl_command_queue command_queue) { CL_EVENT(SetDefaultDeviceCommandQueue, "context = 0x%016" PRIxPTR ", device = 0x%016" PRIxPTR @@ -2276,12 +2264,12 @@ cl_int CL_API_CALL CL_SetDefaultDeviceCommandQueue(cl_context context, ANGLE_CL_VALIDATE_ERROR(SetDefaultDeviceCommandQueue, contextPacked, devicePacked, command_queuePacked); - return (SetDefaultDeviceCommandQueue(contextPacked, devicePacked, command_queuePacked)); + return SetDefaultDeviceCommandQueue(contextPacked, devicePacked, command_queuePacked); } -cl_int CL_API_CALL CL_GetDeviceAndHostTimer(cl_device_id device, - cl_ulong *device_timestamp, - cl_ulong *host_timestamp) +cl_int CL_API_CALL clGetDeviceAndHostTimer(cl_device_id device, + cl_ulong *device_timestamp, + cl_ulong *host_timestamp) { CL_EVENT(GetDeviceAndHostTimer, "device = 0x%016" PRIxPTR ", device_timestamp = 0x%016" PRIxPTR @@ -2292,10 +2280,10 @@ cl_int CL_API_CALL CL_GetDeviceAndHostTimer(cl_device_id device, ANGLE_CL_VALIDATE_ERROR(GetDeviceAndHostTimer, devicePacked, device_timestamp, host_timestamp); - return (GetDeviceAndHostTimer(devicePacked, device_timestamp, host_timestamp)); + return GetDeviceAndHostTimer(devicePacked, device_timestamp, host_timestamp); } -cl_int CL_API_CALL CL_GetHostTimer(cl_device_id device, cl_ulong *host_timestamp) +cl_int CL_API_CALL clGetHostTimer(cl_device_id device, cl_ulong *host_timestamp) { CL_EVENT(GetHostTimer, "device = 0x%016" PRIxPTR ", host_timestamp = 0x%016" PRIxPTR "", (uintptr_t)device, (uintptr_t)host_timestamp); @@ -2304,13 +2292,13 @@ cl_int CL_API_CALL CL_GetHostTimer(cl_device_id device, cl_ulong *host_timestamp ANGLE_CL_VALIDATE_ERROR(GetHostTimer, devicePacked, host_timestamp); - return (GetHostTimer(devicePacked, host_timestamp)); + return GetHostTimer(devicePacked, host_timestamp); } -cl_program CL_API_CALL CL_CreateProgramWithIL(cl_context context, - const void *il, - size_t length, - cl_int *errcode_ret) +cl_program CL_API_CALL clCreateProgramWithIL(cl_context context, + const void *il, + size_t length, + cl_int *errcode_ret) { CL_EVENT(CreateProgramWithIL, "context = 0x%016" PRIxPTR ", il = 0x%016" PRIxPTR @@ -2321,10 +2309,10 @@ cl_program CL_API_CALL CL_CreateProgramWithIL(cl_context context, ANGLE_CL_VALIDATE_POINTER(CreateProgramWithIL, contextPacked, il, length, errcode_ret); - return UnpackParam<cl_program>(CreateProgramWithIL(contextPacked, il, length, errcode_ret)); + return CreateProgramWithIL(contextPacked, il, length, errcode_ret); } -cl_kernel CL_API_CALL CL_CloneKernel(cl_kernel source_kernel, cl_int *errcode_ret) +cl_kernel CL_API_CALL clCloneKernel(cl_kernel source_kernel, cl_int *errcode_ret) { CL_EVENT(CloneKernel, "source_kernel = 0x%016" PRIxPTR ", errcode_ret = 0x%016" PRIxPTR "", (uintptr_t)source_kernel, (uintptr_t)errcode_ret); @@ -2333,17 +2321,17 @@ cl_kernel CL_API_CALL CL_CloneKernel(cl_kernel source_kernel, cl_int *errcode_re ANGLE_CL_VALIDATE_POINTER(CloneKernel, source_kernelPacked, errcode_ret); - return UnpackParam<cl_kernel>(CloneKernel(source_kernelPacked, errcode_ret)); + return CloneKernel(source_kernelPacked, errcode_ret); } -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) +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_EVENT(GetKernelSubGroupInfo, "kernel = 0x%016" PRIxPTR ", device = 0x%016" PRIxPTR @@ -2362,19 +2350,18 @@ cl_int CL_API_CALL CL_GetKernelSubGroupInfo(cl_kernel kernel, input_value_size, input_value, param_value_size, param_value, param_value_size_ret); - return (GetKernelSubGroupInfo(kernelPacked, devicePacked, param_namePacked, input_value_size, - input_value, param_value_size, param_value, - param_value_size_ret)); + return GetKernelSubGroupInfo(kernelPacked, devicePacked, param_namePacked, input_value_size, + input_value, param_value_size, param_value, param_value_size_ret); } -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 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_EVENT(EnqueueSVMMigrateMem, "command_queue = 0x%016" PRIxPTR @@ -2392,15 +2379,15 @@ cl_int CL_API_CALL CL_EnqueueSVMMigrateMem(cl_command_queue command_queue, svm_pointers, sizes, flags, num_events_in_wait_list, event_wait_listPacked, eventPacked); - return (EnqueueSVMMigrateMem(command_queuePacked, num_svm_pointers, svm_pointers, sizes, flags, - num_events_in_wait_list, event_wait_listPacked, eventPacked)); + return EnqueueSVMMigrateMem(command_queuePacked, num_svm_pointers, svm_pointers, sizes, flags, + num_events_in_wait_list, event_wait_listPacked, eventPacked); } // CL 2.2 -cl_int CL_API_CALL CL_SetProgramReleaseCallback(cl_program program, - void(CL_CALLBACK *pfn_notify)(cl_program program, - void *user_data), - void *user_data) +cl_int CL_API_CALL clSetProgramReleaseCallback(cl_program program, + void(CL_CALLBACK *pfn_notify)(cl_program program, + void *user_data), + void *user_data) { CL_EVENT(SetProgramReleaseCallback, "program = 0x%016" PRIxPTR ", pfn_notify = 0x%016" PRIxPTR @@ -2411,13 +2398,13 @@ cl_int CL_API_CALL CL_SetProgramReleaseCallback(cl_program program, ANGLE_CL_VALIDATE_ERROR(SetProgramReleaseCallback, programPacked, pfn_notify, user_data); - return (SetProgramReleaseCallback(programPacked, pfn_notify, user_data)); + return SetProgramReleaseCallback(programPacked, pfn_notify, user_data); } -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 clSetProgramSpecializationConstant(cl_program program, + cl_uint spec_id, + size_t spec_size, + const void *spec_value) { CL_EVENT(SetProgramSpecializationConstant, "program = 0x%016" PRIxPTR @@ -2429,14 +2416,14 @@ cl_int CL_API_CALL CL_SetProgramSpecializationConstant(cl_program program, ANGLE_CL_VALIDATE_ERROR(SetProgramSpecializationConstant, programPacked, spec_id, spec_size, spec_value); - return (SetProgramSpecializationConstant(programPacked, spec_id, spec_size, spec_value)); + return SetProgramSpecializationConstant(programPacked, spec_id, spec_size, spec_value); } // CL 3.0 -cl_int CL_API_CALL CL_SetContextDestructorCallback(cl_context context, - void(CL_CALLBACK *pfn_notify)(cl_context context, - void *user_data), - void *user_data) +cl_int CL_API_CALL clSetContextDestructorCallback(cl_context context, + void(CL_CALLBACK *pfn_notify)(cl_context context, + void *user_data), + void *user_data) { CL_EVENT(SetContextDestructorCallback, "context = 0x%016" PRIxPTR ", pfn_notify = 0x%016" PRIxPTR @@ -2447,15 +2434,15 @@ cl_int CL_API_CALL CL_SetContextDestructorCallback(cl_context context, ANGLE_CL_VALIDATE_ERROR(SetContextDestructorCallback, contextPacked, pfn_notify, user_data); - return (SetContextDestructorCallback(contextPacked, pfn_notify, user_data)); + return SetContextDestructorCallback(contextPacked, pfn_notify, user_data); } -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) +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_EVENT(CreateBufferWithProperties, "context = 0x%016" PRIxPTR ", properties = 0x%016" PRIxPTR @@ -2469,17 +2456,17 @@ cl_mem CL_API_CALL CL_CreateBufferWithProperties(cl_context context, ANGLE_CL_VALIDATE_POINTER(CreateBufferWithProperties, contextPacked, properties, flags, size, host_ptr, errcode_ret); - return UnpackParam<cl_mem>( - CreateBufferWithProperties(contextPacked, properties, flags, size, host_ptr, errcode_ret)); + return CreateBufferWithProperties(contextPacked, properties, flags, size, host_ptr, + errcode_ret); } -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) +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) { CL_EVENT(CreateImageWithProperties, "context = 0x%016" PRIxPTR ", properties = 0x%016" PRIxPTR @@ -2493,8 +2480,8 @@ cl_mem CL_API_CALL CL_CreateImageWithProperties(cl_context context, ANGLE_CL_VALIDATE_POINTER(CreateImageWithProperties, contextPacked, properties, flags, image_format, image_desc, host_ptr, errcode_ret); - return UnpackParam<cl_mem>(CreateImageWithProperties( - contextPacked, properties, flags, image_format, image_desc, host_ptr, errcode_ret)); + return CreateImageWithProperties(contextPacked, properties, flags, image_format, image_desc, + host_ptr, errcode_ret); } -} // extern "C" +} // namespace cl diff --git a/src/libGLESv2/entry_points_cl_autogen.h b/src/libGLESv2/entry_points_cl_autogen.h index 4c5eb71f4a..4ad5b9ca54 100644 --- a/src/libGLESv2/entry_points_cl_autogen.h +++ b/src/libGLESv2/entry_points_cl_autogen.h @@ -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_ diff --git a/src/libGLESv2/entry_points_cl_utils.h b/src/libGLESv2/entry_points_cl_utils.h index edf5cdd587..e09d350ca1 100644 --- a/src/libGLESv2/entry_points_cl_utils.h +++ b/src/libGLESv2/entry_points_cl_utils.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_ diff --git a/src/libOpenCL/BUILD.gn b/src/libOpenCL/BUILD.gn index d68f69aeef..d76d7336b2 100644 --- a/src/libOpenCL/BUILD.gn +++ b/src/libOpenCL/BUILD.gn @@ -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", + ] } diff --git a/src/libOpenCL/cl_loader.h b/src/libOpenCL/cl_loader.h deleted file mode 100644 index 8776390a98..0000000000 --- a/src/libOpenCL/cl_loader.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// 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.h: -// Simple CL function loader. - -#ifndef LIBCL_CL_LOADER_H_ -#define LIBCL_CL_LOADER_H_ - -#include "export.h" - -#ifndef CL_API_ENTRY -# define CL_API_ENTRY ANGLE_EXPORT -#endif -#include "angle_cl.h" - -// 'angle_cl.h' has to be included before this to enable CL defines -#include "CL/cl_icd.h" - -ANGLE_NO_EXPORT extern cl_icd_dispatch cl_loader; - -namespace angle -{ -using GenericProc = void (*)(); -using LoadProc = GenericProc(CL_API_CALL *)(const char *); -ANGLE_NO_EXPORT void LoadCL(LoadProc loadProc); -} // namespace angle - -#endif // LIBCL_CL_LOADER_H_ diff --git a/src/libOpenCL/cl_loader_autogen.cpp b/src/libOpenCL/cl_loader_autogen.cpp deleted file mode 100644 index beeced9b83..0000000000 --- a/src/libOpenCL/cl_loader_autogen.cpp +++ /dev/null @@ -1,235 +0,0 @@ -// 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 diff --git a/src/libOpenCL/dispatch.cpp b/src/libOpenCL/dispatch.cpp new file mode 100644 index 0000000000..facb625243 --- /dev/null +++ b/src/libOpenCL/dispatch.cpp @@ -0,0 +1,54 @@ +// +// 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 diff --git a/src/libOpenCL/dispatch.h b/src/libOpenCL/dispatch.h new file mode 100644 index 0000000000..0b9eb2f352 --- /dev/null +++ b/src/libOpenCL/dispatch.h @@ -0,0 +1,25 @@ +// +// 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.h: Declares a function to fetch the ANGLE OpenCL dispatch table. + +#ifndef LIBOPENCL_DISPATCH_H_ +#define LIBOPENCL_DISPATCH_H_ + +#include "export.h" + +#ifndef CL_API_ENTRY +# define CL_API_ENTRY ANGLE_EXPORT +#endif +#include "angle_cl.h" + +namespace cl +{ + +cl_icd_dispatch &GetDispatch(); + +} // namespace cl + +#endif // LIBOPENCL_DISPATCH_H_ diff --git a/src/libOpenCL/libOpenCL_ICD.cpp b/src/libOpenCL/libOpenCL_ICD.cpp new file mode 100644 index 0000000000..bbba92a070 --- /dev/null +++ b/src/libOpenCL/libOpenCL_ICD.cpp @@ -0,0 +1,34 @@ +// +// 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" diff --git a/src/libOpenCL/libOpenCL_autogen.cpp b/src/libOpenCL/libOpenCL_autogen.cpp index acdea410f2..6f9b1a5158 100644 --- a/src/libOpenCL/libOpenCL_autogen.cpp +++ b/src/libOpenCL/libOpenCL_autogen.cpp @@ -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" |