summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMinkyoung Kim <sleepigmk@gmail.com>2017-02-13 15:11:56 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-02-13 19:54:29 +0900
commitc2e1eb7c54fbf2bc6848d727e78b85dafe2bbbeb (patch)
treea16097b33a7c154eadae847479090d143eee7d90 /src
parentd28ba7df86bc9b8d07186087114185134c8b4557 (diff)
EvasGL: For depth&stencil&msaa, use renderbuffer instead of texture
Summary: glFramebufferTexture2DMultisampleEXT() supports color attachment only. so depth&stencil attachment should be bound via renderbuffer not texture. According to http://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_multisampled_render_to_texture.txt In order to allow the use of multisampled depth and stencil buffers when performing multisampled rendering to a texture, the extension also adds the command RenderbufferStorageMultisampleEXT. target, textarget, texture, and level correspond to the same parameters for FramebufferTexture2D and have the same restrictions. attachment must be COLOR_ATTACHMENT0. Test Plan: Evas GL on GLES 3 Reviewers: jpeg, raster, dkdk, wonsik Tags: #efl Differential Revision: https://phab.enlightenment.org/D4648
Diffstat (limited to 'src')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_core.c75
1 files changed, 48 insertions, 27 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.c b/src/modules/evas/engines/gl_common/evas_gl_core.c
index 8292b5ce42..c81d8ec3a7 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.c
@@ -500,26 +500,32 @@ _fbo_surface_cap_test(GLint color_ifmt, GLenum color_fmt,
500 _texture_attach_2d(color_buf, GL_COLOR_ATTACHMENT0, 0, mult_samples, EVAS_GL_GLES_2_X); 500 _texture_attach_2d(color_buf, GL_COLOR_ATTACHMENT0, 0, mult_samples, EVAS_GL_GLES_2_X);
501 } 501 }
502 502
503 // Check Depth_Stencil Format First 503 // Check Depth_Stencil Format First
504#ifdef GL_GLES 504#ifdef GL_GLES
505 if (depth_fmt == GL_DEPTH_STENCIL_OES) 505 if ((depth_fmt == GL_DEPTH_STENCIL_OES) && (!mult_samples))
506 { 506 {
507 _texture_create(&depth_stencil_buf); 507 _texture_create(&depth_stencil_buf);
508 _texture_allocate_2d(depth_stencil_buf, depth_fmt, 508 _texture_allocate_2d(depth_stencil_buf, depth_fmt,
509 depth_fmt, GL_UNSIGNED_INT_24_8_OES, w, h); 509 depth_fmt, GL_UNSIGNED_INT_24_8_OES, w, h);
510 _texture_attach_2d(depth_stencil_buf, GL_DEPTH_ATTACHMENT, 510 _texture_attach_2d(depth_stencil_buf, GL_DEPTH_ATTACHMENT,
511 GL_STENCIL_ATTACHMENT, mult_samples, EVAS_GL_GLES_2_X); 511 GL_STENCIL_ATTACHMENT, mult_samples, EINA_FALSE);
512 depth_stencil = 1; 512 depth_stencil = 1;
513 } 513 }
514 else if ((depth_fmt == GL_DEPTH24_STENCIL8_OES) && (mult_samples))
514#else 515#else
515 if (depth_fmt == GL_DEPTH24_STENCIL8) 516 if (depth_fmt == GL_DEPTH24_STENCIL8)
517#endif
516 { 518 {
517 _renderbuffer_create(&depth_stencil_buf); 519 _renderbuffer_create(&depth_stencil_buf);
518 _renderbuffer_allocate(depth_stencil_buf, depth_fmt, w, h, mult_samples); 520 _renderbuffer_allocate(depth_stencil_buf, depth_fmt, w, h, mult_samples);
521#ifdef GL_GLES
522 _renderbuffer_attach(depth_stencil_buf, GL_DEPTH_ATTACHMENT, EINA_FALSE);
523 _renderbuffer_attach(depth_stencil_buf, GL_STENCIL_ATTACHMENT, EINA_FALSE);
524#else
519 _renderbuffer_attach(depth_stencil_buf, GL_DEPTH_STENCIL_ATTACHMENT, EINA_FALSE); 525 _renderbuffer_attach(depth_stencil_buf, GL_DEPTH_STENCIL_ATTACHMENT, EINA_FALSE);
526#endif
520 depth_stencil = 1; 527 depth_stencil = 1;
521 } 528 }
522#endif
523 529
524 // Depth Attachment 530 // Depth Attachment
525 if ((!depth_stencil) && (depth_fmt)) 531 if ((!depth_stencil) && (depth_fmt))
@@ -627,6 +633,7 @@ _surface_cap_check()
627 GL_Format depth[] = { 633 GL_Format depth[] = {
628 { DEPTH_NONE, 0 }, 634 { DEPTH_NONE, 0 },
629 { DEPTH_STENCIL, GL_DEPTH_STENCIL_OES }, 635 { DEPTH_STENCIL, GL_DEPTH_STENCIL_OES },
636 { DEPTH_STENCIL, GL_DEPTH24_STENCIL8_OES },
630 { DEPTH_BIT_8, GL_DEPTH_COMPONENT }, 637 { DEPTH_BIT_8, GL_DEPTH_COMPONENT },
631 { DEPTH_BIT_16, GL_DEPTH_COMPONENT16 }, 638 { DEPTH_BIT_16, GL_DEPTH_COMPONENT16 },
632 { DEPTH_BIT_24, GL_DEPTH_COMPONENT24_OES }, 639 { DEPTH_BIT_24, GL_DEPTH_COMPONENT24_OES },
@@ -1010,6 +1017,8 @@ _glenum_string_get(GLenum e)
1010 return "GL_DEPTH_COMPONENT16"; 1017 return "GL_DEPTH_COMPONENT16";
1011 case GL_DEPTH_COMPONENT24_OES: 1018 case GL_DEPTH_COMPONENT24_OES:
1012 return "GL_DEPTH_COMPONENT24_OES"; 1019 return "GL_DEPTH_COMPONENT24_OES";
1020 case GL_DEPTH_COMPONENT32_OES:
1021 return "GL_DEPTH_COMPONENT32_OES";
1013 1022
1014 // Stencil 1023 // Stencil
1015 case GL_STENCIL_INDEX1_OES: 1024 case GL_STENCIL_INDEX1_OES:
@@ -1022,6 +1031,8 @@ _glenum_string_get(GLenum e)
1022 // Depth_Stencil 1031 // Depth_Stencil
1023 case GL_DEPTH_STENCIL_OES: 1032 case GL_DEPTH_STENCIL_OES:
1024 return "GL_DEPTH_STENCIL_OES"; 1033 return "GL_DEPTH_STENCIL_OES";
1034 case GL_DEPTH24_STENCIL8_OES:
1035 return "GL_DEPTH24_STENCIL8_OES";
1025#else 1036#else
1026 // Depth 1037 // Depth
1027 case GL_DEPTH_COMPONENT: 1038 case GL_DEPTH_COMPONENT:
@@ -1193,10 +1204,16 @@ _surface_buffers_fbo_set(EVGL_Surface *sfc, GLuint fbo, Evas_GL_Context_Version
1193 if (sfc->depth_stencil_buf) 1204 if (sfc->depth_stencil_buf)
1194 { 1205 {
1195#ifdef GL_GLES 1206#ifdef GL_GLES
1196 _texture_attach_2d(sfc->depth_stencil_buf, GL_DEPTH_ATTACHMENT, 1207 if (sfc->depth_stencil_fmt == GL_DEPTH_STENCIL_OES)
1197 GL_STENCIL_ATTACHMENT, sfc->msaa_samples, version); 1208 _texture_attach_2d(sfc->depth_stencil_buf, GL_DEPTH_ATTACHMENT,
1209 GL_STENCIL_ATTACHMENT, sfc->msaa_samples, version);
1210 else
1211 {
1212 _renderbuffer_attach(sfc->depth_stencil_buf, GL_DEPTH_ATTACHMENT, version);
1213 _renderbuffer_attach(sfc->depth_stencil_buf, GL_STENCIL_ATTACHMENT, version);
1214 }
1198#else 1215#else
1199 _renderbuffer_attach(sfc->depth_stencil_buf, GL_DEPTH_STENCIL_ATTACHMENT, version); 1216 _renderbuffer_attach(sfc->depth_stencil_buf, GL_DEPTH_STENCIL_ATTACHMENT, version);
1200#endif 1217#endif
1201 } 1218 }
1202 1219
@@ -1233,10 +1250,11 @@ _surface_buffers_create(EVGL_Surface *sfc)
1233 if (sfc->depth_stencil_fmt) 1250 if (sfc->depth_stencil_fmt)
1234 { 1251 {
1235#ifdef GL_GLES 1252#ifdef GL_GLES
1236 _texture_create(&sfc->depth_stencil_buf); 1253 if (sfc->depth_stencil_fmt == GL_DEPTH_STENCIL_OES)
1237#else 1254 _texture_create(&sfc->depth_stencil_buf);
1238 _renderbuffer_create(&sfc->depth_stencil_buf); 1255 else
1239#endif 1256#endif
1257 _renderbuffer_create(&sfc->depth_stencil_buf);
1240 } 1258 }
1241 else 1259 else
1242 { 1260 {
@@ -1277,24 +1295,26 @@ _surface_buffers_allocate(void *eng_data EINA_UNUSED, EVGL_Surface *sfc, int w,
1277 if (sfc->depth_stencil_fmt) 1295 if (sfc->depth_stencil_fmt)
1278 { 1296 {
1279#ifdef GL_GLES 1297#ifdef GL_GLES
1280 if (version == EVAS_GL_GLES_3_X) 1298 if (sfc->depth_stencil_fmt == GL_DEPTH_STENCIL_OES)
1281 { 1299 {
1282 _texture_allocate_2d(sfc->depth_stencil_buf, GL_DEPTH24_STENCIL8_OES, 1300 if (version == EVAS_GL_GLES_3_X)
1283 sfc->depth_stencil_fmt, GL_UNSIGNED_INT_24_8_OES, 1301 {
1284 w, h); 1302 _texture_allocate_2d(sfc->depth_stencil_buf, GL_DEPTH24_STENCIL8_OES,
1303 sfc->depth_stencil_fmt, GL_UNSIGNED_INT_24_8_OES,
1304 w, h);
1305 }
1306 else
1307 {
1308 _texture_allocate_2d(sfc->depth_stencil_buf, sfc->depth_stencil_fmt,
1309 sfc->depth_stencil_fmt, GL_UNSIGNED_INT_24_8_OES,
1310 w, h);
1311 }
1285 } 1312 }
1286 else 1313 else
1287 {
1288 _texture_allocate_2d(sfc->depth_stencil_buf, sfc->depth_stencil_fmt,
1289 sfc->depth_stencil_fmt, GL_UNSIGNED_INT_24_8_OES,
1290 w, h);
1291 }
1292#else
1293 (void) version;
1294 _renderbuffer_allocate(sfc->depth_stencil_buf, sfc->depth_stencil_fmt,
1295 w, h, sfc->msaa_samples);
1296#endif 1314#endif
1297 sfc->buffer_mem[3] = w * h * 4; 1315 _renderbuffer_allocate(sfc->depth_stencil_buf, sfc->depth_stencil_fmt,
1316 w, h, sfc->msaa_samples);
1317 sfc->buffer_mem[3] = w * h * 4;
1298 } 1318 }
1299 else 1319 else
1300 { 1320 {
@@ -1332,10 +1352,11 @@ _surface_buffers_destroy(EVGL_Surface *sfc)
1332 if (sfc->depth_stencil_buf) 1352 if (sfc->depth_stencil_buf)
1333 { 1353 {
1334#ifdef GL_GLES 1354#ifdef GL_GLES
1335 _texture_destroy(&sfc->depth_stencil_buf); 1355 if (sfc->depth_stencil_fmt == GL_DEPTH_STENCIL_OES)
1336#else 1356 _texture_destroy(&sfc->depth_stencil_buf);
1337 _renderbuffer_destroy(&sfc->depth_stencil_buf); 1357 else
1338#endif 1358#endif
1359 _renderbuffer_destroy(&sfc->depth_stencil_buf);
1339 } 1360 }
1340 1361
1341 return 1; 1362 return 1;