Dali 3D User Interface Engine
gl-proxy-implementation.h
Go to the documentation of this file.
1 #ifndef __DALI_INTERNAL_GL_PROXY_IMPLEMENTATION_H__
2 #define __DALI_INTERNAL_GL_PROXY_IMPLEMENTATION_H__
3 
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20 
21 // INTERNAL INCLUDES
22 #include <gl/gl-implementation.h>
23 
24 namespace Dali
25 {
26 namespace Internal
27 {
28 namespace Adaptor
29 {
30 class EnvironmentOptions;
31 
35 class Sampler
36 {
37 public:
38 
43  Sampler( const char* description );
44 
48  void Increment();
49 
53  void Reset();
54 
58  void Accumulate();
59 
63  const char* GetDescription() const;
64 
68  float GetMeanValue() const;
69 
73  float GetStandardDeviation() const;
74 
78  float GetMin() const;
79 
83  float GetMax() const;
84 
85 private: // Data
86 
87  const char* mDescription;
88  float mAccumulated;
90  float mMin;
91  float mMax;
92  unsigned int mNumSamples;
93  unsigned int mCurrentFrameCount;
94 };
95 
100 {
101 public:
102  ObjectCounter( const char* description );
103 
107  void Increment();
108 
112  void Decrement();
113 
117  unsigned int GetCount() const;
118 
122  unsigned int GetPeak() const;
123 
127  const char* GetDescription() const;
128 
129 private:
130  const char* mDescription;
131  unsigned int mCount;
132  unsigned int mPeak;
133 };
134 
140 {
141 public:
142 
147  GlProxyImplementation(EnvironmentOptions& environmentOptions);
148 
152  virtual ~GlProxyImplementation();
153 
157  virtual void PreRender();
158 
162  virtual void PostRender();
163 
164  /* OpenGL ES 2.0 API */
165  virtual void Clear( GLbitfield mask );
166 
167  virtual void GenBuffers (GLsizei n, GLuint* buffers);
168  virtual void DeleteBuffers (GLsizei n, const GLuint* buffers);
169  virtual void BindBuffer( GLenum target, GLuint buffer );
170 
171  virtual void GenTextures (GLsizei n, GLuint* textures);
172  virtual void DeleteTextures (GLsizei n, const GLuint* textures);
173  virtual void ActiveTexture(GLenum texture);
174  virtual void BindTexture( GLenum target, GLuint texture );
175 
176  virtual void DrawArrays( GLenum mode, GLint first, GLsizei count );
177  virtual void DrawElements( GLenum mode, GLsizei count, GLenum type, const void* indices );
178 
179  virtual void Uniform1f ( GLint location, GLfloat x );
180  virtual void Uniform1fv( GLint location, GLsizei count, const GLfloat* v );
181  virtual void Uniform1i ( GLint location, GLint x );
182  virtual void Uniform1iv( GLint location, GLsizei count, const GLint* v );
183  virtual void Uniform2f ( GLint location, GLfloat x, GLfloat y );
184  virtual void Uniform2fv( GLint location, GLsizei count, const GLfloat* v );
185  virtual void Uniform2i ( GLint location, GLint x, GLint y );
186  virtual void Uniform2iv( GLint location, GLsizei count, const GLint* v );
187  virtual void Uniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z );
188  virtual void Uniform3fv( GLint location, GLsizei count, const GLfloat* v );
189  virtual void Uniform3i ( GLint location, GLint x, GLint y, GLint z );
190  virtual void Uniform3iv( GLint location, GLsizei count, const GLint* v );
191  virtual void Uniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
192  virtual void Uniform4fv( GLint location, GLsizei count, const GLfloat* v );
193  virtual void Uniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w );
194  virtual void Uniform4iv( GLint location, GLsizei count, const GLint* v );
195  virtual void UniformMatrix2fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value );
196  virtual void UniformMatrix3fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value );
197  virtual void UniformMatrix4fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value );
198 
199  virtual GLuint CreateProgram (void);
200  virtual void DeleteProgram (GLuint program);
201  virtual void UseProgram( GLuint program );
202 
203 private: // Helpers
204 
205  void AccumulateSamples();
206  void LogResults();
207  void LogCalls( const Sampler& sampler );
208  void LogObjectCounter( const ObjectCounter& sampler );
209  void ResetSamplers();
210 
211 private: // Data
212 
224 
226 
227 };
228 
229 } // namespace Adaptor
230 
231 } // namespace Internal
232 
233 } // namespace Dali
234 
235 #endif // __DALI_INTERNAL_GL_PROXY_IMPLEMENTATION_H__
Dali Docs Home
Read more about Dali