summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2014-09-04 17:44:21 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2014-10-20 12:16:43 +0900
commit08f7073a98d41361c0b3d9ad88314500a6a10bb3 (patch)
treeb292e0144bf7ecb24c3db79fcc940ab4875a78a9
parentc51ea956cd37fd8258490a849389c43a4d01e427 (diff)
GLView: Add more configuration flags for the surface
This adds precise DEPTH, STENCIL and MSAA configurations. @feature
-rw-r--r--src/lib/elm_glview.c59
-rw-r--r--src/lib/elm_glview_common.h23
2 files changed, 68 insertions, 14 deletions
diff --git a/src/lib/elm_glview.c b/src/lib/elm_glview.c
index 20216c869..7d2a236f9 100644
--- a/src/lib/elm_glview.c
+++ b/src/lib/elm_glview.c
@@ -301,22 +301,59 @@ _elm_glview_mode_set(Eo *obj, Elm_Glview_Data *sd, Elm_GLView_Mode mode)
301 if (mode & ELM_GLVIEW_ALPHA) sd->config->color_format = EVAS_GL_RGBA_8888; 301 if (mode & ELM_GLVIEW_ALPHA) sd->config->color_format = EVAS_GL_RGBA_8888;
302 else sd->config->color_format = EVAS_GL_RGB_888; 302 else sd->config->color_format = EVAS_GL_RGB_888;
303 303
304 if (mode & ELM_GLVIEW_DEPTH) sd->config->depth_bits = EVAS_GL_DEPTH_BIT_24; 304 if (mode & ELM_GLVIEW_DEPTH)
305 else sd->config->depth_bits = EVAS_GL_DEPTH_NONE; 305 {
306 const int mask = 7 << 6;
307 if ((mode & mask) == (ELM_GLVIEW_DEPTH_8 & mask))
308 sd->config->depth_bits = EVAS_GL_DEPTH_BIT_8;
309 else if ((mode & mask) == (ELM_GLVIEW_DEPTH_16 & mask))
310 sd->config->depth_bits = EVAS_GL_DEPTH_BIT_16;
311 else if ((mode & mask) == (ELM_GLVIEW_DEPTH_24 & mask))
312 sd->config->depth_bits = EVAS_GL_DEPTH_BIT_24;
313 else if ((mode & mask) == (ELM_GLVIEW_DEPTH_32 & mask))
314 sd->config->depth_bits = EVAS_GL_DEPTH_BIT_32;
315 else
316 sd->config->depth_bits = EVAS_GL_DEPTH_BIT_24;
317 }
318 else
319 sd->config->depth_bits = EVAS_GL_DEPTH_NONE;
306 320
307 if (mode & ELM_GLVIEW_STENCIL) 321 if (mode & ELM_GLVIEW_STENCIL)
308 sd->config->stencil_bits = EVAS_GL_STENCIL_BIT_8; 322 {
309 else sd->config->stencil_bits = EVAS_GL_STENCIL_NONE; 323 const int mask = 7 << 9;
324 if ((mode & mask) == (ELM_GLVIEW_STENCIL_1 & mask))
325 sd->config->stencil_bits = EVAS_GL_STENCIL_BIT_1;
326 else if ((mode & mask) == (ELM_GLVIEW_STENCIL_1 & mask))
327 sd->config->stencil_bits = EVAS_GL_STENCIL_BIT_2;
328 else if ((mode & mask) == (ELM_GLVIEW_STENCIL_4 & mask))
329 sd->config->stencil_bits = EVAS_GL_STENCIL_BIT_4;
330 else if ((mode & mask) == (ELM_GLVIEW_STENCIL_8 & mask))
331 sd->config->stencil_bits = EVAS_GL_STENCIL_BIT_8;
332 else if ((mode & mask) == (ELM_GLVIEW_STENCIL_16 & mask))
333 sd->config->stencil_bits = EVAS_GL_STENCIL_BIT_16;
334 else
335 sd->config->stencil_bits = EVAS_GL_STENCIL_BIT_8;
336 }
337 else
338 sd->config->stencil_bits = EVAS_GL_STENCIL_NONE;
310 339
340 if (mode & ELM_GLVIEW_MULTISAMPLE_HIGH)
341 {
342 if ((mode & ELM_GLVIEW_MULTISAMPLE_HIGH) == ELM_GLVIEW_MULTISAMPLE_LOW)
343 sd->config->multisample_bits = EVAS_GL_MULTISAMPLE_LOW;
344 else if ((mode & ELM_GLVIEW_MULTISAMPLE_HIGH) == ELM_GLVIEW_MULTISAMPLE_MED)
345 sd->config->multisample_bits = EVAS_GL_MULTISAMPLE_MED;
346 else
347 sd->config->multisample_bits = EVAS_GL_MULTISAMPLE_HIGH;
348 }
349 else
350 sd->config->multisample_bits = EVAS_GL_MULTISAMPLE_NONE;
351
352 sd->config->options_bits = EVAS_GL_OPTIONS_NONE;
311 if (mode & ELM_GLVIEW_DIRECT) 353 if (mode & ELM_GLVIEW_DIRECT)
312 sd->config->options_bits = EVAS_GL_OPTIONS_DIRECT; 354 sd->config->options_bits = EVAS_GL_OPTIONS_DIRECT;
313 else sd->config->options_bits = EVAS_GL_OPTIONS_NONE; 355 if (mode & ELM_GLVIEW_CLIENT_SIDE_ROTATION)
314 356 sd->config->options_bits |= EVAS_GL_OPTIONS_CLIENT_SIDE_ROTATION;
315 // Check for Alpha Channel and enable it
316 if (mode & ELM_GLVIEW_ALPHA)
317 evas_object_image_alpha_set(wd->resize_obj, EINA_TRUE);
318 else
319 evas_object_image_alpha_set(wd->resize_obj, EINA_FALSE);
320 357
321 sd->mode = mode; 358 sd->mode = mode;
322 359
diff --git a/src/lib/elm_glview_common.h b/src/lib/elm_glview_common.h
index 0417b9e5b..7e6dc9663 100644
--- a/src/lib/elm_glview_common.h
+++ b/src/lib/elm_glview_common.h
@@ -8,10 +8,27 @@ typedef void (*Elm_GLView_Func_Cb)(Evas_Object *obj);
8typedef enum _Elm_GLView_Mode 8typedef enum _Elm_GLView_Mode
9{ 9{
10 ELM_GLVIEW_NONE = 0, 10 ELM_GLVIEW_NONE = 0,
11 // 0x1 is reserved for future use
11 ELM_GLVIEW_ALPHA = (1<<1), /**< Alpha channel enabled rendering mode */ 12 ELM_GLVIEW_ALPHA = (1<<1), /**< Alpha channel enabled rendering mode */
12 ELM_GLVIEW_DEPTH = (1<<2), /**< Depth buffer enabled rendering mode */ 13 ELM_GLVIEW_DEPTH = (1<<2), /**< Depth buffer enabled rendering mode (24 bits by default) */
13 ELM_GLVIEW_STENCIL = (1<<3), /**< Stencil buffer enabled rendering mode */ 14 ELM_GLVIEW_STENCIL = (1<<3), /**< Stencil buffer enabled rendering mode (8 bits by default) */
14 ELM_GLVIEW_DIRECT = (1<<4) /**< Direct rendering optimization hint */ 15 ELM_GLVIEW_DIRECT = (1<<4), /**< Request direct rendering, unless there must be a fallback */
16 ELM_GLVIEW_CLIENT_SIDE_ROTATION = (1<<5), /**< Client will handle GL view rotation if direct rendering is enabled */
17 // Depth buffer sizes (3 bits)
18 ELM_GLVIEW_DEPTH_8 = ELM_GLVIEW_DEPTH | (1 << 6), /**< Request min. 8 bits for the depth buffer */
19 ELM_GLVIEW_DEPTH_16 = ELM_GLVIEW_DEPTH | (2 << 6), /**< Request min. 16 bits for the depth buffer */
20 ELM_GLVIEW_DEPTH_24 = ELM_GLVIEW_DEPTH | (3 << 6), /**< Request min. 24 bits for the depth buffer (default) */
21 ELM_GLVIEW_DEPTH_32 = ELM_GLVIEW_DEPTH | (4 << 6), /**< Request min. 32 bits for the depth buffer */
22 // Stencil buffer sizes (3 bits)
23 ELM_GLVIEW_STENCIL_1 = ELM_GLVIEW_STENCIL | (1 << 9), /**< Request min. 1 bits for the stencil buffer */
24 ELM_GLVIEW_STENCIL_2 = ELM_GLVIEW_STENCIL | (2 << 9), /**< Request min. 2 bits for the stencil buffer */
25 ELM_GLVIEW_STENCIL_4 = ELM_GLVIEW_STENCIL | (3 << 9), /**< Request min. 4 bits for the stencil buffer */
26 ELM_GLVIEW_STENCIL_8 = ELM_GLVIEW_STENCIL | (4 << 9), /**< Request min. 8 bits for the stencil buffer (default) */
27 ELM_GLVIEW_STENCIL_16 = ELM_GLVIEW_STENCIL | (5 << 9), /**< Request min. 16 bits for the stencil buffer */
28 // MSAA params (2 bits)
29 ELM_GLVIEW_MULTISAMPLE_LOW = (1 << 12), /**< MSAA with minimum number of samples */
30 ELM_GLVIEW_MULTISAMPLE_MED = (2 << 12), /**< MSAA with half the number of maximum samples */
31 ELM_GLVIEW_MULTISAMPLE_HIGH = (3 << 12) /**< MSAA with maximum number of samples */
15} Elm_GLView_Mode; 32} Elm_GLView_Mode;
16 33
17/** 34/**