diff options
-rw-r--r-- | scripts/code_generation_hashes/proc_table.json | 6 | ||||
-rw-r--r-- | scripts/gen_proc_table.py | 31 | ||||
-rw-r--r-- | src/libOpenCL/BUILD.gn | 6 | ||||
-rw-r--r-- | src/libOpenCL/libOpenCL_autogen.map | 153 |
4 files changed, 193 insertions, 3 deletions
diff --git a/scripts/code_generation_hashes/proc_table.json b/scripts/code_generation_hashes/proc_table.json index aaef24822f..d57c24007c 100644 --- a/scripts/code_generation_hashes/proc_table.json +++ b/scripts/code_generation_hashes/proc_table.json @@ -6,7 +6,7 @@ "scripts/egl_angle_ext.xml": "5bcc01462b355d933cf3ada15198fb68", "scripts/gen_proc_table.py": - "1d92e72e9b98865366d1e56f5e31954c", + "7717a320f69631bd70ef8a8e994d47ee", "scripts/gl.xml": "2a73a58a7e26d8676a2c0af6d528cae6", "scripts/gl_angle_ext.xml": @@ -20,5 +20,7 @@ "src/libGLESv2/proc_table_cl_autogen.cpp": "ed003b0f041aaaa35b67d3fe07e61f91", "src/libGLESv2/proc_table_egl_autogen.cpp": - "53d085f3f46ea5d841d93e7063925ae4" + "53d085f3f46ea5d841d93e7063925ae4", + "src/libOpenCL/libOpenCL_autogen.map": + "bc5f5cf48227149ed321258a16eff1d7" }
\ No newline at end of file diff --git a/scripts/gen_proc_table.py b/scripts/gen_proc_table.py index 6cb9e11cff..6d45bd05ce 100644 --- a/scripts/gen_proc_table.py +++ b/scripts/gen_proc_table.py @@ -13,6 +13,7 @@ import registry_xml out_file_name_gles = "../src/libGLESv2/proc_table_egl_autogen.cpp" out_file_name_gl = "../src/libGL/proc_table_wgl_autogen.cpp" out_file_name_cl = "../src/libGLESv2/proc_table_cl_autogen.cpp" +out_file_name_cl_map = "../src/libOpenCL/libOpenCL_autogen.map" # The EGL_ANGLE_explicit_context extension is generated differently from other extensions. # Toggle generation here. @@ -72,6 +73,18 @@ const ProcTable &GetProcTable() }} // namespace {namespace} """ +template_map = """/* 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. + * + * symbol version map: Maps versions to entry point names for a shared library. + */ +{symbol_maps} +""" + includes_gles = """#include "libGLESv2/proc_table_egl.h" #include "libGLESv2/entry_points_egl_autogen.h" @@ -118,7 +131,7 @@ def main(): # auto_script parameters. if len(sys.argv) > 1: inputs = [source for source in registry_xml.xml_inputs] - outputs = [out_file_name_gles, out_file_name_gl, out_file_name_cl] + outputs = [out_file_name_gles, out_file_name_gl, out_file_name_cl, out_file_name_cl_map] if sys.argv[1] == 'inputs': print(','.join(inputs)) elif sys.argv[1] == 'outputs': @@ -238,12 +251,22 @@ def main(): # libCL proc table clxml = registry_xml.RegistryXML('cl.xml') + symbol_maps = [] + symbol_map_dependency = "" 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) clxml.AddCommands(feature_name, annotation) + symbol_version = "OPENCL_%d.%d" % (major_version, minor_version) + symbol_maps += ["\n%s {\n global:" % symbol_version] + symbol_maps += [' %s;' % cmd for cmd in clxml.commands[annotation]] + if not symbol_map_dependency: + symbol_maps += [" local:\n *;\n};"] + else: + symbol_maps += ["} %s;" % symbol_map_dependency] + symbol_map_dependency = symbol_version clxml.AddExtensionCommands(registry_xml.supported_cl_extensions, ['cl']) cl_commands = clxml.all_cmd_names.get_all_commands() @@ -260,6 +283,12 @@ def main(): out_file.write(output_cpp) out_file.close() + with open(out_file_name_cl_map, 'w') as out_file: + output_map = template_map.format( + script_name=sys.argv[0], data_source_name="cl.xml", symbol_maps="\n".join(symbol_maps)) + out_file.write(output_map) + out_file.close() + return 0 diff --git a/src/libOpenCL/BUILD.gn b/src/libOpenCL/BUILD.gn index f49e3ae772..e2c21d5f94 100644 --- a/src/libOpenCL/BUILD.gn +++ b/src/libOpenCL/BUILD.gn @@ -36,6 +36,12 @@ angle_shared_library(cl_library_name) { "$angle_root:angle_common", "$angle_root:cl_includes", ] + + if (is_linux) { + inputs = [ "libOpenCL_autogen.map" ] + ldflags = [ "-Wl,--version-script=" + + rebase_path("libOpenCL_autogen.map", root_build_dir) ] + } } group("angle_cl") { diff --git a/src/libOpenCL/libOpenCL_autogen.map b/src/libOpenCL/libOpenCL_autogen.map new file mode 100644 index 0000000000..55d7cc2d9a --- /dev/null +++ b/src/libOpenCL/libOpenCL_autogen.map @@ -0,0 +1,153 @@ +/* GENERATED FILE - DO NOT EDIT. + * Generated by gen_proc_table.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. + * + * symbol version map: Maps versions to entry point names for a shared library. + */ + +OPENCL_1.0 { + global: + clGetPlatformIDs; + clGetPlatformInfo; + clGetDeviceIDs; + clGetDeviceInfo; + clCreateContext; + clCreateContextFromType; + clRetainContext; + clReleaseContext; + clGetContextInfo; + clRetainCommandQueue; + clReleaseCommandQueue; + clGetCommandQueueInfo; + clCreateBuffer; + clRetainMemObject; + clReleaseMemObject; + clGetSupportedImageFormats; + clGetMemObjectInfo; + clGetImageInfo; + clRetainSampler; + clReleaseSampler; + clGetSamplerInfo; + clCreateProgramWithSource; + clCreateProgramWithBinary; + clRetainProgram; + clReleaseProgram; + clBuildProgram; + clGetProgramInfo; + clGetProgramBuildInfo; + clCreateKernel; + clCreateKernelsInProgram; + clRetainKernel; + clReleaseKernel; + clSetKernelArg; + clGetKernelInfo; + clGetKernelWorkGroupInfo; + clWaitForEvents; + clGetEventInfo; + clRetainEvent; + clReleaseEvent; + clGetEventProfilingInfo; + clFlush; + clFinish; + clEnqueueReadBuffer; + clEnqueueWriteBuffer; + clEnqueueCopyBuffer; + clEnqueueReadImage; + clEnqueueWriteImage; + clEnqueueCopyImage; + clEnqueueCopyImageToBuffer; + clEnqueueCopyBufferToImage; + clEnqueueMapBuffer; + clEnqueueMapImage; + clEnqueueUnmapMemObject; + clEnqueueNDRangeKernel; + clEnqueueNativeKernel; + clSetCommandQueueProperty; + clCreateImage2D; + clCreateImage3D; + clEnqueueMarker; + clEnqueueWaitForEvents; + clEnqueueBarrier; + clUnloadCompiler; + clGetExtensionFunctionAddress; + clCreateCommandQueue; + clCreateSampler; + clEnqueueTask; + local: + *; +}; + +OPENCL_1.1 { + global: + clCreateSubBuffer; + clSetMemObjectDestructorCallback; + clCreateUserEvent; + clSetUserEventStatus; + clSetEventCallback; + clEnqueueReadBufferRect; + clEnqueueWriteBufferRect; + clEnqueueCopyBufferRect; +} OPENCL_1.0; + +OPENCL_1.2 { + global: + clCreateSubDevices; + clRetainDevice; + clReleaseDevice; + clCreateImage; + clCreateProgramWithBuiltInKernels; + clCompileProgram; + clLinkProgram; + clUnloadPlatformCompiler; + clGetKernelArgInfo; + clEnqueueFillBuffer; + clEnqueueFillImage; + clEnqueueMigrateMemObjects; + clEnqueueMarkerWithWaitList; + clEnqueueBarrierWithWaitList; + clGetExtensionFunctionAddressForPlatform; +} OPENCL_1.1; + +OPENCL_2.0 { + global: + clCreateCommandQueueWithProperties; + clCreatePipe; + clGetPipeInfo; + clSVMAlloc; + clSVMFree; + clCreateSamplerWithProperties; + clSetKernelArgSVMPointer; + clSetKernelExecInfo; + clEnqueueSVMFree; + clEnqueueSVMMemcpy; + clEnqueueSVMMemFill; + clEnqueueSVMMap; + clEnqueueSVMUnmap; +} OPENCL_1.2; + +OPENCL_2.1 { + global: + clSetDefaultDeviceCommandQueue; + clGetDeviceAndHostTimer; + clGetHostTimer; + clCreateProgramWithIL; + clCloneKernel; + clGetKernelSubGroupInfo; + clEnqueueSVMMigrateMem; +} OPENCL_2.0; + +OPENCL_2.2 { + global: + clSetProgramSpecializationConstant; + clSetProgramReleaseCallback; +} OPENCL_2.1; + +OPENCL_3.0 { + global: + clSetContextDestructorCallback; + clCreateBufferWithProperties; + clCreateImageWithProperties; +} OPENCL_2.2; |