1 // 2 // Copyright 2013 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 7 // Sampler.h : Defines the Sampler class, which represents a GLES 3 8 // sampler object. Sampler objects store some state needed to sample textures. 9 10 #ifndef LIBANGLE_SAMPLER_H_ 11 #define LIBANGLE_SAMPLER_H_ 12 13 #include "libANGLE/Debug.h" 14 #include "libANGLE/Observer.h" 15 #include "libANGLE/RefCountObject.h" 16 #include "libANGLE/angletypes.h" 17 18 namespace rx 19 { 20 class GLImplFactory; 21 class SamplerImpl; 22 } // namespace rx 23 24 namespace gl 25 { 26 27 class Sampler final : public RefCountObject<SamplerID>, public LabeledObject, public angle::Subject 28 { 29 public: 30 Sampler(rx::GLImplFactory *factory, SamplerID id); 31 ~Sampler() override; 32 33 void onDestroy(const Context *context) override; 34 35 void setLabel(const Context *context, const std::string &label) override; 36 const std::string &getLabel() const override; 37 38 void setMinFilter(const Context *context, GLenum minFilter); 39 GLenum getMinFilter() const; 40 41 void setMagFilter(const Context *context, GLenum magFilter); 42 GLenum getMagFilter() const; 43 44 void setWrapS(const Context *context, GLenum wrapS); 45 GLenum getWrapS() const; 46 47 void setWrapT(const Context *context, GLenum wrapT); 48 GLenum getWrapT() const; 49 50 void setWrapR(const Context *context, GLenum wrapR); 51 GLenum getWrapR() const; 52 53 void setMaxAnisotropy(const Context *context, float maxAnisotropy); 54 float getMaxAnisotropy() const; 55 56 void setMinLod(const Context *context, GLfloat minLod); 57 GLfloat getMinLod() const; 58 59 void setMaxLod(const Context *context, GLfloat maxLod); 60 GLfloat getMaxLod() const; 61 62 void setCompareMode(const Context *context, GLenum compareMode); 63 GLenum getCompareMode() const; 64 65 void setCompareFunc(const Context *context, GLenum compareFunc); 66 GLenum getCompareFunc() const; 67 68 void setSRGBDecode(const Context *context, GLenum sRGBDecode); 69 GLenum getSRGBDecode() const; 70 71 void setBorderColor(const Context *context, const ColorGeneric &color); 72 const ColorGeneric &getBorderColor() const; 73 74 const SamplerState &getSamplerState() const; 75 76 rx::SamplerImpl *getImplementation() const; 77 78 angle::Result syncState(const Context *context); isDirty()79 bool isDirty() const { return mDirty; } 80 81 private: 82 void signalDirtyState(); 83 SamplerState mState; 84 bool mDirty; 85 rx::SamplerImpl *mSampler; 86 87 std::string mLabel; 88 }; 89 90 } // namespace gl 91 92 #endif // LIBANGLE_SAMPLER_H_ 93