3
3
// found in the LICENSE file.
4
4
5
5
#include " tizen_surface_gl.h"
6
-
6
+ #include < GLES2/gl2.h>
7
+ #include < GLES2/gl2ext.h>
7
8
#include " flutter/shell/platform/tizen/logger.h"
8
9
9
10
TizenSurfaceGL::TizenSurfaceGL (int32_t x, int32_t y, int32_t width,
@@ -33,9 +34,9 @@ bool TizenSurfaceGL::OnMakeResourceCurrent() {
33
34
LoggerE (" Invalid Display" );
34
35
return false ;
35
36
}
36
- if (eglMakeCurrent (egl_display_, EGL_NO_SURFACE, EGL_NO_SURFACE ,
37
+ if (eglMakeCurrent (egl_display_, egl_resource_surface_, egl_resource_surface_ ,
37
38
egl_resource_context_) != EGL_TRUE) {
38
- LoggerE (" Could not make the onscreen context current" );
39
+ LoggerE (" Could not make the offscreen context current" );
39
40
return false ;
40
41
}
41
42
return true ;
@@ -77,14 +78,127 @@ uint32_t TizenSurfaceGL::OnGetFBO() {
77
78
return 0 ; // FBO0
78
79
}
79
80
81
+ #define GL_FUNC (FunctionName ) \
82
+ else if (strcmp(name, #FunctionName) == 0 ) { \
83
+ return reinterpret_cast <void *>(FunctionName); \
84
+ }
80
85
void * TizenSurfaceGL::OnProcResolver (const char * name) {
81
86
auto address = eglGetProcAddress (name);
82
87
if (address != nullptr ) {
83
88
return reinterpret_cast <void *>(address);
84
89
}
90
+ GL_FUNC (eglGetCurrentDisplay)
91
+ GL_FUNC (eglQueryString)
92
+ GL_FUNC (glActiveTexture)
93
+ GL_FUNC (glAttachShader)
94
+ GL_FUNC (glBindAttribLocation)
95
+ GL_FUNC (glBindBuffer)
96
+ GL_FUNC (glBindFramebuffer)
97
+ GL_FUNC (glBindRenderbuffer)
98
+ GL_FUNC (glBindTexture)
99
+ GL_FUNC (glBlendColor)
100
+ GL_FUNC (glBlendEquation)
101
+ GL_FUNC (glBlendFunc)
102
+ GL_FUNC (glBufferData)
103
+ GL_FUNC (glBufferSubData)
104
+ GL_FUNC (glCheckFramebufferStatus)
105
+ GL_FUNC (glClear)
106
+ GL_FUNC (glClearColor)
107
+ GL_FUNC (glClearStencil)
108
+ GL_FUNC (glColorMask)
109
+ GL_FUNC (glCompileShader)
110
+ GL_FUNC (glCompressedTexImage2D)
111
+ GL_FUNC (glCompressedTexSubImage2D)
112
+ GL_FUNC (glCopyTexSubImage2D)
113
+ GL_FUNC (glCreateProgram)
114
+ GL_FUNC (glCreateShader)
115
+ GL_FUNC (glCullFace)
116
+ GL_FUNC (glDeleteBuffers)
117
+ GL_FUNC (glDeleteFramebuffers)
118
+ GL_FUNC (glDeleteProgram)
119
+ GL_FUNC (glDeleteRenderbuffers)
120
+ GL_FUNC (glDeleteShader)
121
+ GL_FUNC (glDeleteTextures)
122
+ GL_FUNC (glDepthMask)
123
+ GL_FUNC (glDisable)
124
+ GL_FUNC (glDisableVertexAttribArray)
125
+ GL_FUNC (glDrawArrays)
126
+ GL_FUNC (glDrawElements)
127
+ GL_FUNC (glEnable)
128
+ GL_FUNC (glEnableVertexAttribArray)
129
+ GL_FUNC (glFinish)
130
+ GL_FUNC (glFlush)
131
+ GL_FUNC (glFramebufferRenderbuffer)
132
+ GL_FUNC (glFramebufferTexture2D)
133
+ GL_FUNC (glFrontFace)
134
+ GL_FUNC (glGenBuffers)
135
+ GL_FUNC (glGenerateMipmap)
136
+ GL_FUNC (glGenFramebuffers)
137
+ GL_FUNC (glGenRenderbuffers)
138
+ GL_FUNC (glGenTextures)
139
+ GL_FUNC (glGetBufferParameteriv)
140
+ GL_FUNC (glGetError)
141
+ GL_FUNC (glGetFramebufferAttachmentParameteriv)
142
+ GL_FUNC (glGetIntegerv)
143
+ GL_FUNC (glGetProgramInfoLog)
144
+ GL_FUNC (glGetProgramiv)
145
+ GL_FUNC (glGetRenderbufferParameteriv)
146
+ GL_FUNC (glGetShaderInfoLog)
147
+ GL_FUNC (glGetShaderiv)
148
+ GL_FUNC (glGetShaderPrecisionFormat)
149
+ GL_FUNC (glGetString)
150
+ GL_FUNC (glGetUniformLocation)
151
+ GL_FUNC (glIsTexture)
152
+ GL_FUNC (glLineWidth)
153
+ GL_FUNC (glLinkProgram)
154
+ GL_FUNC (glPixelStorei)
155
+ GL_FUNC (glReadPixels)
156
+ GL_FUNC (glRenderbufferStorage)
157
+ GL_FUNC (glScissor)
158
+ GL_FUNC (glShaderSource)
159
+ GL_FUNC (glStencilFunc)
160
+ GL_FUNC (glStencilFuncSeparate)
161
+ GL_FUNC (glStencilMask)
162
+ GL_FUNC (glStencilMaskSeparate)
163
+ GL_FUNC (glStencilOp)
164
+ GL_FUNC (glStencilOpSeparate)
165
+ GL_FUNC (glTexImage2D)
166
+ GL_FUNC (glTexParameterf)
167
+ GL_FUNC (glTexParameterfv)
168
+ GL_FUNC (glTexParameteri)
169
+ GL_FUNC (glTexParameteriv)
170
+ GL_FUNC (glTexSubImage2D)
171
+ GL_FUNC (glUniform1f)
172
+ GL_FUNC (glUniform1fv)
173
+ GL_FUNC (glUniform1i)
174
+ GL_FUNC (glUniform1iv)
175
+ GL_FUNC (glUniform2f)
176
+ GL_FUNC (glUniform2fv)
177
+ GL_FUNC (glUniform2i)
178
+ GL_FUNC (glUniform2iv)
179
+ GL_FUNC (glUniform3f)
180
+ GL_FUNC (glUniform3fv)
181
+ GL_FUNC (glUniform3i)
182
+ GL_FUNC (glUniform3iv)
183
+ GL_FUNC (glUniform4f)
184
+ GL_FUNC (glUniform4fv)
185
+ GL_FUNC (glUniform4i)
186
+ GL_FUNC (glUniform4iv)
187
+ GL_FUNC (glUniformMatrix2fv)
188
+ GL_FUNC (glUniformMatrix3fv)
189
+ GL_FUNC (glUniformMatrix4fv)
190
+ GL_FUNC (glUseProgram)
191
+ GL_FUNC (glVertexAttrib1f)
192
+ GL_FUNC (glVertexAttrib2fv)
193
+ GL_FUNC (glVertexAttrib3fv)
194
+ GL_FUNC (glVertexAttrib4fv)
195
+ GL_FUNC (glVertexAttribPointer)
196
+ GL_FUNC (glViewport)
197
+
85
198
LoggerW (" Could not resolve: %s" , name);
86
199
return nullptr ;
87
200
}
201
+ #undef GL_FUNC
88
202
89
203
TizenSurfaceGL::~TizenSurfaceGL () {
90
204
if (IsValid ()) {
@@ -209,7 +323,7 @@ bool TizenSurfaceGL::InitalizeDisplay() {
209
323
}
210
324
211
325
egl_resource_context_ =
212
- eglCreateContext (egl_display_, egl_config, egl_context_ , attribs);
326
+ eglCreateContext (egl_display_, egl_config, EGL_NO_CONTEXT , attribs);
213
327
if (egl_resource_context_ == EGL_NO_CONTEXT) {
214
328
LoggerE (" Could not create an resource context" );
215
329
return false ;
@@ -224,6 +338,13 @@ bool TizenSurfaceGL::InitalizeDisplay() {
224
338
if (egl_surface_ == EGL_NO_SURFACE) {
225
339
return false ;
226
340
}
341
+
342
+ const EGLint attribs[] = {EGL_WIDTH, 1 , EGL_HEIGHT, 1 , EGL_NONE};
343
+ egl_resource_surface_ =
344
+ eglCreatePbufferSurface (egl_display_, egl_config, attribs);
345
+ if (egl_resource_surface_ == EGL_NO_SURFACE) {
346
+ return false ;
347
+ }
227
348
}
228
349
LoggerD (" egl_surface_: %p" , egl_surface_);
229
350
display_valid_ = true ;
0 commit comments