b63bbc1bc4cca2dcf7240de49841e5ceb61ae947
[platform/framework/web/crosswalk-tizen.git] /
1 // Copyright (c) 2015 Samsung Electronics. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_EFL_H_
6 #define GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_EFL_H_
7
8 #include <Evas_GL.h>
9
10 #include "gpu/command_buffer/client/context_support.h"
11 #include "gpu/command_buffer/client/gles2_impl_export.h"
12 #include "gpu/command_buffer/client/gles2_interface.h"
13
14 #include <map>
15 #include <set>
16
17 namespace gpu {
18 namespace gles2 {
19
20 class GLES2_IMPL_EXPORT GLES2ImplementationEfl : public GLES2Interface,
21                                                  public ContextSupport {
22  public:
23   GLES2ImplementationEfl(Evas_GL_API* evas_gl_api);
24   ~GLES2ImplementationEfl() override;
25
26 // Include the auto-generated part of this class. We split this because
27 // it means we can easily edit the non-auto generated parts right here in
28 // this file instead of having to edit some template or the code generator.
29 #include "gpu/command_buffer/client/gles2_implementation_efl_header_autogen.h"
30
31   // ContextSupport implementation.
32   void SignalSyncToken(const SyncToken& sync_token,
33                        const base::Closure& callback) override {}
34   void SignalQuery(uint32_t query, const base::Closure& callback) override {}
35   void SetAggressivelyFreeResources(bool aggressively_free_resources) override {
36   }
37   void Swap() override {}
38   void SwapWithDamage(const gfx::Rect& damage) override {}
39   void PartialSwapBuffers(const gfx::Rect& sub_buffer) override {}
40   void CommitOverlayPlanes() override {}
41   void ScheduleOverlayPlane(int plane_z_order,
42                             gfx::OverlayTransform plane_transform,
43                             unsigned overlay_texture_id,
44                             const gfx::Rect& display_bounds,
45                             const gfx::RectF& uv_rect) override {}
46   uint64_t ShareGroupTracingGUID() const override;
47   void SetErrorMessageCallback(
48       const base::Callback<void(const char*, int32_t)>& callback) override {}
49
50   GLuint DoCreateProgram();
51   void DoUseProgram(GLuint program);
52   void DoDeleteProgram(GLuint program);
53   void DoUniform1f(GLint location, GLfloat x);
54   void DoUniform1fv(GLint location, GLsizei count, const GLfloat* v);
55   void DoUniform1i(GLint location, GLint x);
56   void DoUniform1iv(GLint location, GLsizei count, const GLint* v);
57   void DoUniform2f(GLint location, GLfloat x, GLfloat y);
58   void DoUniform2fv(GLint location, GLsizei count, const GLfloat* v);
59   void DoUniform2i(GLint location, GLint x, GLint y);
60   void DoUniform2iv(GLint location, GLsizei count, const GLint* v);
61   void DoUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z);
62   void DoUniform3fv(GLint location, GLsizei count, const GLfloat* v);
63   void DoUniform3i(GLint location, GLint x, GLint y, GLint z);
64   void DoUniform3iv(GLint location, GLsizei count, const GLint* v);
65   void DoUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
66   void DoUniform4fv(GLint location, GLsizei count, const GLfloat* v);
67   void DoUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w);
68   void DoUniform4iv(GLint location, GLsizei count, const GLint* v);
69   void DoUniformMatrix2fv(GLint location,
70                           GLsizei count,
71                           GLboolean transpose,
72                           const GLfloat* value);
73   void DoUniformMatrix3fv(GLint location,
74                           GLsizei count,
75                           GLboolean transpose,
76                           const GLfloat* value);
77   void DoUniformMatrix4fv(GLint location,
78                           GLsizei count,
79                           GLboolean transpose,
80                           const GLfloat* value);
81   void DoBindUniformLocationCHROMIUM(GLuint program,
82                                      GLint location,
83                                      const char* name);
84
85   void DoGenTextures(GLsizei n, GLuint* textures);
86   void DoConsumeTextureCHROMIUM(GLenum target, const GLbyte* data);
87   GLuint DoCreateAndConsumeTextureCHROMIUM(GLenum target, const GLbyte* data);
88   void DoBindTexture(GLenum target, GLuint texture);
89   void DoDeleteTextures(GLsizei n, const GLuint* textures);
90
91   GLuint DoInsertFenceSyncCHROMIUM();
92   void DoWaitSyncTokenCHROMIUM(const GLbyte* sync_token);
93
94  private:
95   Evas_GL_API* evas_gl_api_;
96
97   typedef struct {
98     GLint service_id_;
99     typedef std::map<GLint, std::string> UniformLocationMap;
100     UniformLocationMap uniform_location_map_;
101   } ProgramData;
102
103   GLint current_program_;
104
105   typedef std::map<GLint, ProgramData> ProgramMap;
106   ProgramMap program_map_;
107
108   GLuint bound_texture_id_;
109
110   typedef std::map<GLuint, GLuint> TextureConsumedMap;
111   TextureConsumedMap texture_consumed_map_;
112
113   typedef std::map<GLenum, GLuint> TextureBoundMap;
114   TextureBoundMap texture_bound_map_;
115
116   std::set<GLuint> textures_;
117
118   GLint GetBoundUniformLocation(GLint location);
119   ProgramData& GetProgramData(GLint program = -1);
120 };
121
122 }  // namespace gles2
123 }  // namespace gpu
124
125 #endif  // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_EFL_H_