summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/gl_common/evas_gl_texture.c
diff options
context:
space:
mode:
authorSubhransu Mohanty <sub.mohanty@samsung.com>2016-11-16 13:14:48 -0800
committerCedric BAIL <cedric@osg.samsung.com>2016-11-16 13:46:40 -0800
commit16cb5f7af90ea8a47261d0ae48fbbaa4ad2a847f (patch)
treec779c34adbfa51cd888208a9ad09410a32a0aac7 /src/modules/evas/engines/gl_common/evas_gl_texture.c
parent168a127c8ccb209a60481ff95e44f9b5464fa890 (diff)
evas/gl: Added support for stencil buffer creation while creating gl Surface.
Reviewers: jpeg, cedric Reviewed By: jpeg, cedric Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4404 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to '')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_texture.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_texture.c b/src/modules/evas/engines/gl_common/evas_gl_texture.c
index 273adc1f0f..ff2737f3d5 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_texture.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_texture.c
@@ -590,7 +590,7 @@ evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im, Eina_Bool
590} 590}
591 591
592static Evas_GL_Texture_Pool * 592static Evas_GL_Texture_Pool *
593_pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, int format) 593_pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, int format, int stencil)
594{ 594{
595 Evas_GL_Texture_Pool *pt; 595 Evas_GL_Texture_Pool *pt;
596 int fnum; 596 int fnum;
@@ -646,6 +646,15 @@ _pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in
646 // note: should check fbo completeness 646 // note: should check fbo completeness
647 } 647 }
648 648
649 if (stencil)
650 {
651 glGenRenderbuffers(1, &(pt->stencil));
652 glBindRenderbuffer(GL_RENDERBUFFER, pt->stencil);
653 glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, pt->w, pt->h);
654 glBindRenderbuffer(GL_RENDERBUFFER, 0);
655 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, pt->stencil);
656 }
657
649 glsym_glBindFramebuffer(GL_FRAMEBUFFER, fnum); 658 glsym_glBindFramebuffer(GL_FRAMEBUFFER, fnum);
650 glBindTexture(gc->state.current.tex_target, gc->state.current.cur_tex); 659 glBindTexture(gc->state.current.tex_target, gc->state.current.cur_tex);
651 660
@@ -949,6 +958,11 @@ evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt)
949 glDeleteTextures(1, &(pt->texture)); 958 glDeleteTextures(1, &(pt->texture));
950 if (pt->gc->state.current.cur_tex == pt->texture) 959 if (pt->gc->state.current.cur_tex == pt->texture)
951 pt->gc->state.current.cur_tex = 0; 960 pt->gc->state.current.cur_tex = 0;
961 if (pt->stencil)
962 {
963 glDeleteRenderbuffers(1, &(pt->stencil));
964 pt->stencil = 0;
965 }
952 if (pt->fb) 966 if (pt->fb)
953 { 967 {
954 glsym_glDeleteFramebuffers(1, &(pt->fb)); 968 glsym_glDeleteFramebuffers(1, &(pt->fb));
@@ -1018,7 +1032,7 @@ evas_gl_common_texture_native_new(Evas_Engine_GL_Context *gc, unsigned int w, un
1018} 1032}
1019 1033
1020Evas_GL_Texture * 1034Evas_GL_Texture *
1021evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha) 1035evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, int stencil)
1022{ 1036{
1023 Evas_GL_Texture *tex; 1037 Evas_GL_Texture *tex;
1024 int lformat; 1038 int lformat;
@@ -1030,7 +1044,7 @@ evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, un
1030 if (!tex) return NULL; 1044 if (!tex) return NULL;
1031 tex->pt = _pool_tex_render_new(gc, w, h, 1045 tex->pt = _pool_tex_render_new(gc, w, h,
1032 *matching_format[lformat].intformat, 1046 *matching_format[lformat].intformat,
1033 *matching_format[lformat].format); 1047 *matching_format[lformat].format, stencil);
1034 if (!tex->pt) 1048 if (!tex->pt)
1035 { 1049 {
1036 evas_gl_common_texture_light_free(tex); 1050 evas_gl_common_texture_light_free(tex);
@@ -1205,7 +1219,7 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
1205 // FIXME: why a 'render' new here ??? Should already have been allocated, quite a weird path. 1219 // FIXME: why a 'render' new here ??? Should already have been allocated, quite a weird path.
1206 tex->pt = _pool_tex_render_new(tex->gc, tex->w, tex->h, 1220 tex->pt = _pool_tex_render_new(tex->gc, tex->w, tex->h,
1207 *matching_format[lformat].intformat, 1221 *matching_format[lformat].intformat,
1208 *matching_format[lformat].format); 1222 *matching_format[lformat].format, EINA_FALSE);
1209 } 1223 }
1210 // If image was preloaded then we need a ptt 1224 // If image was preloaded then we need a ptt
1211 if (!tex->pt) return; 1225 if (!tex->pt) return;