1 // 2 // Copyright (c) 2022 The Khronos Group Inc. 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 // 16 #ifndef _extensionHelpers_h 17 #define _extensionHelpers_h 18 19 // Load a specific function that is part of an OpenCL extension 20 #define GET_PFN(device, fn_name) \ 21 fn_name##_fn fn_name = reinterpret_cast<fn_name##_fn>( \ 22 clGetExtensionFunctionAddressForPlatform( \ 23 getPlatformFromDevice(device), #fn_name)); \ 24 do \ 25 { \ 26 if (!fn_name) \ 27 { \ 28 log_error( \ 29 "ERROR: Failed to get function pointer for %s at %s:%d\n", \ 30 #fn_name, __FILE__, __LINE__); \ 31 return TEST_FAIL; \ 32 } \ 33 } while (false) 34 35 36 #endif // _extensionHelpers_h 37