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)
downloadelementary-08f7073a98d41361c0b3d9ad88314500a6a10bb3.tar.gz
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)
if (mode & ELM_GLVIEW_ALPHA) sd->config->color_format = EVAS_GL_RGBA_8888;
else sd->config->color_format = EVAS_GL_RGB_888;
- if (mode & ELM_GLVIEW_DEPTH) sd->config->depth_bits = EVAS_GL_DEPTH_BIT_24;
- else sd->config->depth_bits = EVAS_GL_DEPTH_NONE;
+ if (mode & ELM_GLVIEW_DEPTH)
+ {
+ const int mask = 7 << 6;
+ if ((mode & mask) == (ELM_GLVIEW_DEPTH_8 & mask))
+ sd->config->depth_bits = EVAS_GL_DEPTH_BIT_8;
+ else if ((mode & mask) == (ELM_GLVIEW_DEPTH_16 & mask))
+ sd->config->depth_bits = EVAS_GL_DEPTH_BIT_16;
+ else if ((mode & mask) == (ELM_GLVIEW_DEPTH_24 & mask))
+ sd->config->depth_bits = EVAS_GL_DEPTH_BIT_24;
+ else if ((mode & mask) == (ELM_GLVIEW_DEPTH_32 & mask))
+ sd->config->depth_bits = EVAS_GL_DEPTH_BIT_32;
+ else
+ sd->config->depth_bits = EVAS_GL_DEPTH_BIT_24;
+ }
+ else
+ sd->config->depth_bits = EVAS_GL_DEPTH_NONE;
if (mode & ELM_GLVIEW_STENCIL)
- sd->config->stencil_bits = EVAS_GL_STENCIL_BIT_8;
- else sd->config->stencil_bits = EVAS_GL_STENCIL_NONE;
+ {
+ const int mask = 7 << 9;
+ if ((mode & mask) == (ELM_GLVIEW_STENCIL_1 & mask))
+ sd->config->stencil_bits = EVAS_GL_STENCIL_BIT_1;
+ else if ((mode & mask) == (ELM_GLVIEW_STENCIL_1 & mask))
+ sd->config->stencil_bits = EVAS_GL_STENCIL_BIT_2;
+ else if ((mode & mask) == (ELM_GLVIEW_STENCIL_4 & mask))
+ sd->config->stencil_bits = EVAS_GL_STENCIL_BIT_4;
+ else if ((mode & mask) == (ELM_GLVIEW_STENCIL_8 & mask))
+ sd->config->stencil_bits = EVAS_GL_STENCIL_BIT_8;
+ else if ((mode & mask) == (ELM_GLVIEW_STENCIL_16 & mask))
+ sd->config->stencil_bits = EVAS_GL_STENCIL_BIT_16;
+ else
+ sd->config->stencil_bits = EVAS_GL_STENCIL_BIT_8;
+ }
+ else
+ sd->config->stencil_bits = EVAS_GL_STENCIL_NONE;
+ if (mode & ELM_GLVIEW_MULTISAMPLE_HIGH)
+ {
+ if ((mode & ELM_GLVIEW_MULTISAMPLE_HIGH) == ELM_GLVIEW_MULTISAMPLE_LOW)
+ sd->config->multisample_bits = EVAS_GL_MULTISAMPLE_LOW;
+ else if ((mode & ELM_GLVIEW_MULTISAMPLE_HIGH) == ELM_GLVIEW_MULTISAMPLE_MED)
+ sd->config->multisample_bits = EVAS_GL_MULTISAMPLE_MED;
+ else
+ sd->config->multisample_bits = EVAS_GL_MULTISAMPLE_HIGH;
+ }
+ else
+ sd->config->multisample_bits = EVAS_GL_MULTISAMPLE_NONE;
+
+ sd->config->options_bits = EVAS_GL_OPTIONS_NONE;
if (mode & ELM_GLVIEW_DIRECT)
sd->config->options_bits = EVAS_GL_OPTIONS_DIRECT;
- else sd->config->options_bits = EVAS_GL_OPTIONS_NONE;
-
- // Check for Alpha Channel and enable it
- if (mode & ELM_GLVIEW_ALPHA)
- evas_object_image_alpha_set(wd->resize_obj, EINA_TRUE);
- else
- evas_object_image_alpha_set(wd->resize_obj, EINA_FALSE);
+ if (mode & ELM_GLVIEW_CLIENT_SIDE_ROTATION)
+ sd->config->options_bits |= EVAS_GL_OPTIONS_CLIENT_SIDE_ROTATION;
sd->mode = mode;
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);
typedef enum _Elm_GLView_Mode
{
ELM_GLVIEW_NONE = 0,
+ // 0x1 is reserved for future use
ELM_GLVIEW_ALPHA = (1<<1), /**< Alpha channel enabled rendering mode */
- ELM_GLVIEW_DEPTH = (1<<2), /**< Depth buffer enabled rendering mode */
- ELM_GLVIEW_STENCIL = (1<<3), /**< Stencil buffer enabled rendering mode */
- ELM_GLVIEW_DIRECT = (1<<4) /**< Direct rendering optimization hint */
+ ELM_GLVIEW_DEPTH = (1<<2), /**< Depth buffer enabled rendering mode (24 bits by default) */
+ ELM_GLVIEW_STENCIL = (1<<3), /**< Stencil buffer enabled rendering mode (8 bits by default) */
+ ELM_GLVIEW_DIRECT = (1<<4), /**< Request direct rendering, unless there must be a fallback */
+ ELM_GLVIEW_CLIENT_SIDE_ROTATION = (1<<5), /**< Client will handle GL view rotation if direct rendering is enabled */
+ // Depth buffer sizes (3 bits)
+ ELM_GLVIEW_DEPTH_8 = ELM_GLVIEW_DEPTH | (1 << 6), /**< Request min. 8 bits for the depth buffer */
+ ELM_GLVIEW_DEPTH_16 = ELM_GLVIEW_DEPTH | (2 << 6), /**< Request min. 16 bits for the depth buffer */
+ ELM_GLVIEW_DEPTH_24 = ELM_GLVIEW_DEPTH | (3 << 6), /**< Request min. 24 bits for the depth buffer (default) */
+ ELM_GLVIEW_DEPTH_32 = ELM_GLVIEW_DEPTH | (4 << 6), /**< Request min. 32 bits for the depth buffer */
+ // Stencil buffer sizes (3 bits)
+ ELM_GLVIEW_STENCIL_1 = ELM_GLVIEW_STENCIL | (1 << 9), /**< Request min. 1 bits for the stencil buffer */
+ ELM_GLVIEW_STENCIL_2 = ELM_GLVIEW_STENCIL | (2 << 9), /**< Request min. 2 bits for the stencil buffer */
+ ELM_GLVIEW_STENCIL_4 = ELM_GLVIEW_STENCIL | (3 << 9), /**< Request min. 4 bits for the stencil buffer */
+ ELM_GLVIEW_STENCIL_8 = ELM_GLVIEW_STENCIL | (4 << 9), /**< Request min. 8 bits for the stencil buffer (default) */
+ ELM_GLVIEW_STENCIL_16 = ELM_GLVIEW_STENCIL | (5 << 9), /**< Request min. 16 bits for the stencil buffer */
+ // MSAA params (2 bits)
+ ELM_GLVIEW_MULTISAMPLE_LOW = (1 << 12), /**< MSAA with minimum number of samples */
+ ELM_GLVIEW_MULTISAMPLE_MED = (2 << 12), /**< MSAA with half the number of maximum samples */
+ ELM_GLVIEW_MULTISAMPLE_HIGH = (3 << 12) /**< MSAA with maximum number of samples */
} Elm_GLView_Mode;
/**