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.
This commit is contained in:
Brice Videau 2021-02-11 17:16:32 -06:00 committed by GitHub
parent 2378fb98e7
commit 18eaa39c9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 94 additions and 1 deletions

61
CL/cl_layer.h Normal file
View File

@ -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 <CL/cl_icd.h>
#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 */

View File

@ -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)

31
tests/test_cl_layer.h.c Normal file
View File

@ -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 <stdio.h>
#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;
}