1 // 2 // Copyright 2021 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 // CLExtensions.cpp: Implements the struct methods for CLExtension. 7 8 #include "libANGLE/renderer/CLExtensions.h" 9 10 #include "common/string_utils.h" 11 12 namespace rx 13 { 14 15 CLExtensions::CLExtensions() = default; 16 17 CLExtensions::~CLExtensions() = default; 18 19 CLExtensions::CLExtensions(CLExtensions &&) = default; 20 21 CLExtensions &CLExtensions::operator=(CLExtensions &&) = default; 22 initializeExtensions(std::string && extensionStr)23void CLExtensions::initializeExtensions(std::string &&extensionStr) 24 { 25 extensions.assign(std::move(extensionStr)); 26 if (extensions.empty()) 27 { 28 return; 29 } 30 31 auto hasExtension = [&](const std::string &extension) { 32 return angle::ContainsToken(extensions, ' ', extension); 33 }; 34 35 khrByteAddressableStore = hasExtension("cl_khr_byte_addressable_store"); 36 khrGlobalInt32BaseAtomics = hasExtension("cl_khr_global_int32_base_atomics"); 37 khrGlobalInt32ExtendedAtomics = hasExtension("cl_khr_global_int32_extended_atomics"); 38 khrLocalInt32BaseAtomics = hasExtension("cl_khr_local_int32_base_atomics"); 39 khrLocalInt32ExtendedAtomics = hasExtension("cl_khr_local_int32_extended_atomics"); 40 41 khr3D_ImageWrites = hasExtension("cl_khr_3d_image_writes"); 42 khrDepthImages = hasExtension("cl_khr_depth_images"); 43 khrImage2D_FromBuffer = hasExtension("cl_khr_image2d_from_buffer"); 44 45 khrExtendedVersioning = hasExtension("cl_khr_extended_versioning"); 46 khrFP64 = hasExtension("cl_khr_fp64"); 47 khrICD = hasExtension("cl_khr_icd"); 48 khrInt64BaseAtomics = hasExtension("cl_khr_int64_base_atomics"); 49 khrInt64ExtendedAtomics = hasExtension("cl_khr_int64_extended_atomics"); 50 } 51 52 } // namespace rx 53