Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / angle / src / libGLESv2 / State.h
index d3b3edc..5f04331 100644 (file)
@@ -24,6 +24,7 @@ namespace gl
 class Query;
 class VertexArray;
 class Context;
+struct Caps;
 
 class State
 {
@@ -31,6 +32,9 @@ class State
     State();
     ~State();
 
+    void initialize(const Caps& caps, GLuint clientVersion);
+    void reset();
+
     void setContext(Context *context) { mContext = context; }
 
     // State chunk getters
@@ -126,9 +130,9 @@ class State
     // Texture binding & active texture unit manipulation
     void setActiveSampler(unsigned int active);
     unsigned int getActiveSampler() const;
-    void setSamplerTexture(TextureType type, Texture *texture);
-    Texture *getSamplerTexture(unsigned int sampler, TextureType type) const;
-    GLuint getSamplerTextureId(unsigned int sampler, TextureType type) const;
+    void setSamplerTexture(GLenum type, Texture *texture);
+    Texture *getSamplerTexture(unsigned int sampler, GLenum type) const;
+    GLuint getSamplerTextureId(unsigned int sampler, GLenum type) const;
     void detachTexture(GLuint texture);
 
     // Sampler object binding manipulation
@@ -272,7 +276,6 @@ class State
     float mNearZ;
     float mFarZ;
 
-    unsigned int mActiveSampler;   // Active texture unit selector - GL_TEXTURE0
     BindingPointer<Buffer> mArrayBuffer;
     Framebuffer *mReadFramebuffer;
     Framebuffer *mDrawFramebuffer;
@@ -283,8 +286,15 @@ class State
     VertexAttribCurrentValueData mVertexAttribCurrentValues[MAX_VERTEX_ATTRIBS]; // From glVertexAttrib
     VertexArray *mVertexArray;
 
-    BindingPointer<Texture> mSamplerTexture[TEXTURE_TYPE_COUNT][IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS];
-    BindingPointer<Sampler> mSamplers[IMPLEMENTATION_MAX_COMBINED_TEXTURE_IMAGE_UNITS];
+    // Texture and sampler bindings
+    size_t mActiveSampler;   // Active texture unit selector - GL_TEXTURE0
+
+    typedef std::vector< BindingPointer<Texture> > TextureBindingVector;
+    typedef std::map<GLenum, TextureBindingVector> TextureBindingMap;
+    TextureBindingMap mSamplerTextures;
+
+    typedef std::vector< BindingPointer<Sampler> > SamplerBindingVector;
+    SamplerBindingVector mSamplers;
 
     typedef std::map< GLenum, BindingPointer<Query> > ActiveQueryMap;
     ActiveQueryMap mActiveQueries;