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 // CLSamplerCL.cpp: Implements the class methods for CLSamplerCL. 7 8 #include "libANGLE/renderer/cl/CLSamplerCL.h" 9 10 #include "libANGLE/renderer/cl/CLContextCL.h" 11 12 #include "libANGLE/CLContext.h" 13 #include "libANGLE/CLSampler.h" 14 15 namespace rx 16 { 17 CLSamplerCL(const cl::Sampler & sampler,cl_sampler native)18CLSamplerCL::CLSamplerCL(const cl::Sampler &sampler, cl_sampler native) 19 : CLSamplerImpl(sampler), mNative(native) 20 { 21 sampler.getContext().getImpl<CLContextCL>().mData->mSamplers.emplace(sampler.getNative()); 22 } 23 ~CLSamplerCL()24CLSamplerCL::~CLSamplerCL() 25 { 26 const size_t numRemoved = 27 mSampler.getContext().getImpl<CLContextCL>().mData->mSamplers.erase(mSampler.getNative()); 28 ASSERT(numRemoved == 1u); 29 30 if (mNative->getDispatch().clReleaseSampler(mNative) != CL_SUCCESS) 31 { 32 ERR() << "Error while releasing CL sampler"; 33 } 34 } 35 36 } // namespace rx 37