1 /*
2  -----------------------------------------------------------------------------
3  This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5  For the latest info, see http://www.ogre3d.org/
6 
7  Copyright (c) 2000-2013 Torus Knot Software Ltd
8 
9  Permission is hereby granted, free of charge, to any person obtaining a copy
10  of this software and associated documentation files (the "Software"), to deal
11  in the Software without restriction, including without limitation the rights
12  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13  copies of the Software, and to permit persons to whom the Software is
14  furnished to do so, subject to the following conditions:
15 
16  The above copyright notice and this permission notice shall be included in
17  all copies or substantial portions of the Software.
18 
19  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25  THE SOFTWARE.
26  -----------------------------------------------------------------------------
27  */
28 
29 #include "OgreStableHeaders.h"
30 #include "OgreGLES2StateCacheManager.h"
31 #include "OgreGLES2RenderSystem.h"
32 #include "OgreLogManager.h"
33 #include "OgreRoot.h"
34 
35 #if OGRE_NO_GL_STATE_CACHE_SUPPORT == 0
36 #   include "OgreGLES2StateCacheManagerImp.h"
37 #else
38 #   include "OgreGLES2NullStateCacheManagerImp.h"
39 #endif
40 
41 namespace Ogre {
42 
GLES2StateCacheManager()43     GLES2StateCacheManager::GLES2StateCacheManager()
44     {
45         mImp = new GLES2StateCacheManagerImp();
46     }
47 
~GLES2StateCacheManager()48     GLES2StateCacheManager::~GLES2StateCacheManager()
49     {
50         delete mImp;
51         mImp = 0;
52     }
53 
initializeCache()54     void GLES2StateCacheManager::initializeCache()
55     {
56         mImp->initializeCache();
57     }
58 
clearCache()59     void GLES2StateCacheManager::clearCache()
60     {
61         mImp->clearCache();
62     }
63 
bindGLBuffer(GLenum target,GLuint buffer,bool force)64     void GLES2StateCacheManager::bindGLBuffer(GLenum target, GLuint buffer, bool force)
65     {
66         mImp->bindGLBuffer(target, buffer, force);
67     }
68 
deleteGLBuffer(GLenum target,GLuint buffer,bool force)69     void GLES2StateCacheManager::deleteGLBuffer(GLenum target, GLuint buffer, bool force)
70     {
71         mImp->deleteGLBuffer(target, buffer, force);
72     }
73 
invalidateStateForTexture(GLuint texture)74     void GLES2StateCacheManager::invalidateStateForTexture(GLuint texture)
75     {
76         mImp->invalidateStateForTexture(texture);
77     }
78 
setTexParameteri(GLenum target,GLenum pname,GLint param)79     void GLES2StateCacheManager::setTexParameteri(GLenum target, GLenum pname, GLint param)
80     {
81         mImp->setTexParameteri(target, pname, param);
82     }
83 
setTexParameterf(GLenum target,GLenum pname,GLfloat param)84     void GLES2StateCacheManager::setTexParameterf(GLenum target, GLenum pname, GLfloat param)
85     {
86         mImp->setTexParameterf(target, pname, param);
87     }
88 
getTexParameterfv(GLenum target,GLenum pname,GLfloat * param)89     void GLES2StateCacheManager::getTexParameterfv(GLenum target, GLenum pname, GLfloat *param)
90     {
91         mImp->getTexParameterfv(target, pname, param);
92     }
93 
bindGLTexture(GLenum target,GLuint texture)94     void GLES2StateCacheManager::bindGLTexture(GLenum target, GLuint texture)
95     {
96         mImp->bindGLTexture(target, texture);
97     }
98 
activateGLTextureUnit(unsigned char unit)99     bool GLES2StateCacheManager::activateGLTextureUnit(unsigned char unit)
100 	{
101         return mImp->activateGLTextureUnit(unit);
102 	}
103 
setBlendFunc(GLenum source,GLenum dest)104     void GLES2StateCacheManager::setBlendFunc(GLenum source, GLenum dest)
105     {
106         mImp->setBlendFunc(source, dest);
107     }
108 
setBlendEquation(GLenum eq)109     void GLES2StateCacheManager::setBlendEquation(GLenum eq)
110     {
111         mImp->setBlendEquation(eq);
112     }
113 
setDepthMask(GLboolean mask)114     void GLES2StateCacheManager::setDepthMask(GLboolean mask)
115     {
116         mImp->setDepthMask(mask);
117     }
118 
setDepthFunc(GLenum func)119     void GLES2StateCacheManager::setDepthFunc(GLenum func)
120     {
121         mImp->setDepthFunc(func);
122     }
123 
setClearDepth(GLclampf depth)124     void GLES2StateCacheManager::setClearDepth(GLclampf depth)
125     {
126         mImp->setClearDepth(depth);
127     }
128 
setClearColour(GLclampf red,GLclampf green,GLclampf blue,GLclampf alpha)129     void GLES2StateCacheManager::setClearColour(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
130     {
131         mImp->setClearColour(red, green, blue, alpha);
132     }
133 
setColourMask(GLboolean red,GLboolean green,GLboolean blue,GLboolean alpha)134     void GLES2StateCacheManager::setColourMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
135     {
136         mImp->setColourMask(red, green, blue, alpha);
137     }
138 
setStencilMask(GLuint mask)139     void GLES2StateCacheManager::setStencilMask(GLuint mask)
140     {
141         mImp->setStencilMask(mask);
142     }
143 
setEnabled(GLenum flag)144     void GLES2StateCacheManager::setEnabled(GLenum flag)
145     {
146         mImp->setEnabled(flag);
147     }
148 
setDisabled(GLenum flag)149     void GLES2StateCacheManager::setDisabled(GLenum flag)
150     {
151         mImp->setDisabled(flag);
152     }
153 
setVertexAttribEnabled(GLuint attrib)154     void GLES2StateCacheManager::setVertexAttribEnabled(GLuint attrib)
155     {
156         mImp->setVertexAttribEnabled(attrib);
157     }
158 
setVertexAttribDisabled(GLuint attrib)159     void GLES2StateCacheManager::setVertexAttribDisabled(GLuint attrib)
160     {
161         mImp->setVertexAttribDisabled(attrib);
162     }
163 
setCullFace(GLenum face)164     void GLES2StateCacheManager::setCullFace(GLenum face)
165     {
166         mImp->setCullFace(face);
167     }
168 
getBlendEquation() const169     GLenum GLES2StateCacheManager::getBlendEquation() const
170     {
171         return mImp->getBlendEquation();
172     }
173 
getDepthMask() const174     GLboolean GLES2StateCacheManager::getDepthMask() const
175     {
176         return mImp->getDepthMask();
177     }
178 
getDepthFunc() const179     GLenum GLES2StateCacheManager::getDepthFunc() const
180     {
181         return mImp->getDepthFunc();
182     }
183 
getClearDepth() const184     GLclampf GLES2StateCacheManager::getClearDepth() const
185     {
186         return mImp->getClearDepth();
187     }
188 
getColourMask() const189     vector<GLboolean>::type & GLES2StateCacheManager::getColourMask() const
190     {
191         return mImp->getColourMask();
192     }
193 
getStencilMask() const194     GLuint GLES2StateCacheManager::getStencilMask() const
195     {
196         return mImp->getStencilMask();
197     }
198 
getDiscardBuffers() const199     unsigned int GLES2StateCacheManager::getDiscardBuffers() const
200     {
201         return mImp->getDiscardBuffers();
202     }
203 
setDiscardBuffers(unsigned int flags)204     void GLES2StateCacheManager::setDiscardBuffers(unsigned int flags)
205     {
206         mImp->setDiscardBuffers(flags);
207     }
208 
getPolygonMode() const209     GLenum GLES2StateCacheManager::getPolygonMode() const
210     {
211         return mImp->getPolygonMode();
212     }
213 
setPolygonMode(GLenum mode)214     void GLES2StateCacheManager::setPolygonMode(GLenum mode)
215     {
216         mImp->setPolygonMode(mode);
217     }
218 
getCullFace() const219     GLenum GLES2StateCacheManager::getCullFace() const
220     {
221         return mImp->getCullFace();
222     }
223 }
224