summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongyeon Kim <dy5.kim@samsung.com>2015-05-11 19:57:22 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-06-03 11:30:22 +0900
commitae91db021bc9817afd28968660e8a9067b358f41 (patch)
treec43a0acc00f35e6f065e68c70ddcfe206a625392
parente4e67732c26d581ff0cf3ae3ef4d5f460b574e60 (diff)
Evas GL: Pass correct attachment enum for glDiscardFramebufferEXT
Summary: When default framebuffer(0) is bound, attachment should contain COLOR, DEPTH or STENCIL for glDiscardFramebufferEXT. When a framebuffer object is bound, attachment should contain COLOR_ATTACHMENT0, DEPTH_ATTACHMENT or STENCIL_ATTACHMENT. This should be correctly taken into account for indirect rendering, where internal FBO is used. @fix
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_api_ext.c64
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h7
2 files changed, 69 insertions, 2 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_api_ext.c b/src/modules/evas/engines/gl_common/evas_gl_api_ext.c
index 639f60cf5b..5506ae1488 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api_ext.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_api_ext.c
@@ -311,10 +311,72 @@ evgl_evasglQueryWaylandBuffer(Evas_GL *evas_gl EINA_UNUSED,
311 return EXT_FUNC_EGL(eglQueryWaylandBufferWL)(dpy, buffer, attribute, value); 311 return EXT_FUNC_EGL(eglQueryWaylandBufferWL)(dpy, buffer, attribute, value);
312} 312}
313 313
314
315#else 314#else
316#endif 315#endif
317 316
317static void
318evgl_glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum* attachments)
319{
320 EVGL_Resource *rsc;
321 EVGL_Context *ctx;
322 Eina_Bool target_is_fbo = EINA_FALSE;
323
324 if (!(rsc=_evgl_tls_resource_get()))
325 {
326 ERR("Unable to execute GL command. Error retrieving tls");
327 return;
328 }
329
330 if (!rsc->current_eng)
331 {
332 ERR("Unable to retrive Current Engine");
333 return;
334 }
335
336 ctx = rsc->current_ctx;
337 if (!ctx)
338 {
339 ERR("Unable to retrive Current Context");
340 return;
341 }
342
343 if (!_evgl_direct_enabled())
344 {
345 if (ctx->current_fbo == 0)
346 target_is_fbo = EINA_TRUE;
347 }
348
349 if (target_is_fbo && numAttachments)
350 {
351 GLenum *att;
352 int i = 0;
353 att = (GLenum *)calloc(1, numAttachments * sizeof(GLenum));
354 if (!att)
355 return;
356
357 memcpy(att, attachments, numAttachments * sizeof(GLenum));
358 while (i < numAttachments)
359 {
360 if (att[i] == GL_COLOR_EXT)
361 att[i] = GL_COLOR_ATTACHMENT0;
362 else if (att[i] == GL_DEPTH_EXT)
363 att[i] = GL_DEPTH_ATTACHMENT;
364 else if (att[i] == GL_STENCIL_EXT)
365 att[i] = GL_STENCIL_ATTACHMENT;
366 i++;
367 }
368 EXT_FUNC(glDiscardFramebuffer)(target, numAttachments, att);
369 free(att);
370 }
371 else
372 {
373 EXT_FUNC(glDiscardFramebuffer)(target, numAttachments, attachments);
374 }
375}
376
377
378
379
318// 0: not initialized, 380// 0: not initialized,
319// 1: GLESv2 initialized, 381// 1: GLESv2 initialized,
320// 3: GLESv1 and GLESv2 initialized, 382// 3: GLESv1 and GLESv2 initialized,
diff --git a/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h b/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h
index f20c3a7893..79d5f19906 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h
@@ -183,13 +183,18 @@ _EVASGL_EXT_END()
183_EVASGL_EXT_BEGIN(discard_framebuffer) 183_EVASGL_EXT_BEGIN(discard_framebuffer)
184 _EVASGL_EXT_DRVNAME(GL_EXT_discard_framebuffer) 184 _EVASGL_EXT_DRVNAME(GL_EXT_discard_framebuffer)
185 185
186 _EVASGL_EXT_FUNCTION_BEGIN(void, glDiscardFramebufferEXT, (GLenum target, GLsizei numAttachments, const GLenum* attachments)) 186 _EVASGL_EXT_FUNCTION_PRIVATE_BEGIN(void, glDiscardFramebuffer, (GLenum target, GLsizei numAttachments, const GLenum* attachments))
187 _EVASGL_EXT_FUNCTION_DRVFUNC_PROCADDR("glDiscardFramebuffer") 187 _EVASGL_EXT_FUNCTION_DRVFUNC_PROCADDR("glDiscardFramebuffer")
188 _EVASGL_EXT_FUNCTION_DRVFUNC_PROCADDR("glDiscardFramebufferEXT") 188 _EVASGL_EXT_FUNCTION_DRVFUNC_PROCADDR("glDiscardFramebufferEXT")
189 _EVASGL_EXT_FUNCTION_PRIVATE_END()
190
191 _EVASGL_EXT_FUNCTION_BEGIN(void, glDiscardFramebufferEXT, (GLenum target, GLsizei numAttachments, const GLenum* attachments))
192 _EVASGL_EXT_FUNCTION_DRVFUNC(evgl_glDiscardFramebufferEXT)
189 _EVASGL_EXT_FUNCTION_END() 193 _EVASGL_EXT_FUNCTION_END()
190_EVASGL_EXT_END() 194_EVASGL_EXT_END()
191 195
192 196
197
193_EVASGL_EXT_BEGIN(multi_draw_arrays) 198_EVASGL_EXT_BEGIN(multi_draw_arrays)
194 _EVASGL_EXT_DRVNAME(GL_EXT_multi_draw_arrays) 199 _EVASGL_EXT_DRVNAME(GL_EXT_multi_draw_arrays)
195 200