From 18eaa39c9cfe1811037cc38c4dd44031e4ba8f63 Mon Sep 17 00:00:00 2001 From: Brice Videau Date: Thu, 11 Feb 2021 17:16:32 -0600 Subject: [PATCH] Move cl_icd_layer.h from OpenCL-ICD-Loader to OpenCL-Headers. (#148) * Move cl_icd_layer.h from OpenCL-ICD-Loader to OpenCL-Headers. * Added test for cl_icd_layer.h single inclusion. * Added missing test_cl_icd_layer.h.c file. * Changed include guard to non reserved identifier. * Renamed cl_icd_layer.h to cl_layer.h. * Fix tests and guard. --- CL/cl_layer.h | 61 +++++++++++++++++++++++++++++++++++++++++ tests/CMakeLists.txt | 3 +- tests/test_cl_layer.h.c | 31 +++++++++++++++++++++ 3 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 CL/cl_layer.h create mode 100644 tests/test_cl_layer.h.c diff --git a/CL/cl_layer.h b/CL/cl_layer.h new file mode 100644 index 0000000..b75e6bc --- /dev/null +++ b/CL/cl_layer.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2020 The Khronos Group Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * OpenCL is a trademark of Apple Inc. used under license by Khronos. + */ + +#ifndef OPENCL_CL_LAYER_H +#define OPENCL_CL_LAYER_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef cl_uint cl_layer_info; +typedef cl_uint cl_layer_api_version; +#define CL_LAYER_API_VERSION 0x4240 +#define CL_LAYER_API_VERSION_100 100 + +extern CL_API_ENTRY cl_int CL_API_CALL +clGetLayerInfo(cl_layer_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret); + +CL_API_ENTRY typedef cl_int +(CL_API_CALL *pfn_clGetLayerInfo)(cl_layer_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret); + +extern CL_API_ENTRY cl_int CL_API_CALL +clInitLayer(cl_uint num_entries, + const cl_icd_dispatch *target_dispatch, + cl_uint *num_entries_ret, + const cl_icd_dispatch **layer_dispatch_ret); + +CL_API_ENTRY typedef cl_int +(CL_API_CALL *pfn_clInitLayer)(cl_uint num_entries, + const cl_icd_dispatch *target_dispatch, + cl_uint *num_entries_ret, + const cl_icd_dispatch **layer_dispatch_ret); + +#ifdef __cplusplus +} +#endif + +#endif /* OPENCL_CL_LAYER_H */ diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d8efb24..27e4946 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -4,7 +4,7 @@ function(add_header_test NAME SOURCE) set(TEST_EXE ${NAME}_${VERSION}) # ICD on Windows uses system headers, which aren't strictly ANSI conformant # and trigger warnings - if(NOT (NAME STREQUAL cl_icd_h AND MSVC AND CMAKE_C_FLAGS MATCHES "/Za")) + if(NOT (((NAME STREQUAL cl_icd_h) OR (NAME STREQUAL cl_layer_h)) AND MSVC AND CMAKE_C_FLAGS MATCHES "/Za")) add_executable(${TEST_EXE} ${SOURCE}) target_compile_definitions(${TEST_EXE} PUBLIC -DCL_TARGET_OPENCL_VERSION=${VERSION} @@ -26,6 +26,7 @@ add_header_test(cl_gl_h test_cl_gl.h.c) add_header_test(cl_gl_ext_h test_cl_gl_ext.h.c) add_header_test(cl_half_h test_cl_half.h.c) add_header_test(cl_icd_h test_cl_icd.h.c) +add_header_test(cl_layer_h test_cl_layer.h.c) add_header_test(cl_platform_h test_cl_platform.h.c) add_header_test(cl_opencl_h test_opencl.h.c) add_header_test(cl_version_h test_cl_version.h.c) diff --git a/tests/test_cl_layer.h.c b/tests/test_cl_layer.h.c new file mode 100644 index 0000000..cdbc46a --- /dev/null +++ b/tests/test_cl_layer.h.c @@ -0,0 +1,31 @@ +// +// Copyright (c) 2020 The Khronos Group Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#include + +#define CL_USE_DEPRECATED_OPENCL_1_0_APIS +#define CL_USE_DEPRECATED_OPENCL_1_1_APIS +#define CL_USE_DEPRECATED_OPENCL_1_2_APIS +#define CL_USE_DEPRECATED_OPENCL_2_0_APIS +#define CL_USE_DEPRECATED_OPENCL_2_1_APIS +#define CL_USE_DEPRECATED_OPENCL_2_2_APIS +#include "CL/cl_layer.h" + +int main( void ) +{ + printf("cl_icd_layer.h standalone test PASSED.\n"); + return 0; +}