1 // 2 // Copyright 2020 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 // SamplerMtl.h: 7 // Defines the class interface for SamplerMtl, implementing SamplerImpl. 8 // 9 10 #ifndef LIBANGLE_RENDERER_METAL_SAMPLERMTL_H_ 11 #define LIBANGLE_RENDERER_METAL_SAMPLERMTL_H_ 12 13 #include "libANGLE/renderer/SamplerImpl.h" 14 #include "libANGLE/renderer/metal/mtl_common.h" 15 16 namespace rx 17 { 18 19 class ContextMtl; 20 21 class SamplerMtl : public SamplerImpl 22 { 23 public: 24 SamplerMtl(const gl::SamplerState &state); 25 ~SamplerMtl() override; 26 27 void onDestroy(const gl::Context *context) override; 28 angle::Result syncState(const gl::Context *context, const bool dirty) override; 29 const mtl::AutoObjCPtr<id<MTLSamplerState>> &getSampler(ContextMtl *contextMtl); 30 31 private: 32 mtl::AutoObjCPtr<id<MTLSamplerState>> mSamplerState; 33 34 // Cache compare mode & func to detect their changes and let ProgramMtl verify that 35 // GL_TEXTURE_COMPARE_MODE is not GL_NONE on a shadow sampler. 36 // TODO(http://anglebug.com/5231): Once the validation code is implemented on front-end, it 37 // is possible to remove these caching. 38 GLenum mCompareMode = 0; 39 GLenum mCompareFunc = 0; 40 }; 41 42 } // namespace rx 43 44 #endif 45