Evas GL: Match FBO config with window surface config

Summary:
When direct rendering is enabled, FBO configuration should match
window surface configuration as FBO will be used in fallback cases.
So create FBO with configuration from window surface.
@fix
This commit is contained in:
Dongyeon Kim 2015-05-12 12:03:29 +09:00 committed by Jean-Philippe Andre
parent ae91db021b
commit 517109858e
6 changed files with 46 additions and 22 deletions

View File

@ -1262,6 +1262,7 @@ _internal_config_set(void *eng_data, EVGL_Surface *sfc, Evas_GL_Config *cfg)
int i = 0, cfg_index = -1;
int color_bit = 0, depth_bit = 0, stencil_bit = 0, msaa_samples = 0;
int depth_size = 0;
int native_win_depth = 0, native_win_stencil = 0, native_win_msaa = 0;
Eina_Bool support_win_cfg = 1;
// Check if engine is valid
@ -1316,11 +1317,20 @@ try_again:
sfc->msaa_samples = evgl_engine->caps.fbo_fmts[i].samples;
// Direct Rendering Option
if (((depth_bit > 0) || (stencil_bit > 0) || (msaa_samples > 0))
&& (evgl_engine->funcs->native_win_surface_config_check))
if (evgl_engine->funcs->native_win_surface_config_get)
evgl_engine->funcs->native_win_surface_config_get(eng_data, &native_win_depth, &native_win_stencil, &native_win_msaa);
if ((native_win_depth >= depth_size)
&& (native_win_stencil >= stencil_bit)
&& (native_win_msaa >= msaa_samples))
{
DBG("request to check win cfg with depth %d, stencil %d, msaa %d", depth_size, stencil_bit, msaa_samples);
support_win_cfg = evgl_engine->funcs->native_win_surface_config_check(eng_data, depth_size, stencil_bit, msaa_samples);
DBG("Win cfg can support the Req Evas GL's config successfully");
support_win_cfg = EINA_TRUE;
}
else
{
ERR("Win cfg can't support Evas GL DR win (depth %d, stencil %d, msaa %d)",
native_win_depth, native_win_stencil, native_win_msaa);
support_win_cfg = EINA_FALSE;
}
if ((sfc->direct_override) || support_win_cfg)
@ -1337,6 +1347,21 @@ try_again:
s1[cfg->depth_bits], s2[cfg->stencil_bits], s3[cfg->multisample_bits]);
}
// When direct rendering is enabled, FBO configuration should match
// window surface configuration as FBO will be used in fallback cases.
// So we search again for the formats that match window surface's.
if (sfc->direct_fb_opt &&
((native_win_depth != depth_size) ||
(native_win_stencil != stencil_bit) ||
(native_win_msaa != msaa_samples)))
{
depth_bit = (1 << ((native_win_depth / 8) - 1));
depth_size = native_win_depth;
stencil_bit = native_win_stencil;
msaa_samples = native_win_msaa;
goto try_again;
}
// Extra flags for direct rendering
sfc->client_side_rotation = !!(cfg->options_bits & EVAS_GL_OPTIONS_CLIENT_SIDE_ROTATION);
sfc->alpha = (cfg->color_format == EVAS_GL_RGBA_8888);

View File

@ -79,7 +79,7 @@ struct _EVGL_Interface
void *(*gles_context_create)(void *data, EVGL_Context *share_ctx, EVGL_Surface *evgl_sfc);
// Check native window surface config for Evas GL Direct Rendering
Eina_Bool (*native_win_surface_config_check)(void *data, int evgl_depth, int evgl_stencil, int evgl_msaa);
void (*native_win_surface_config_get)(void *data, int *win_depth, int *win_stencil, int *win_msaa);
};
struct _EVGL_Surface

View File

@ -133,7 +133,7 @@ static const EVGL_Interface evgl_funcs =
NULL, // OpenGL-ES 1
NULL, // OpenGL-ES 1
NULL, // OpenGL-ES 1
NULL, // native_win_surface_config_check
NULL, // native_win_surface_config_get
};
/* local functions */

View File

@ -260,7 +260,7 @@ static const EVGL_Interface evgl_funcs =
NULL, // OpenGL-ES 1
NULL, // OpenGL-ES 1
NULL, // OpenGL-ES 1
NULL, // native_win_surface_config_check
NULL, // native_win_surface_config_get
};

View File

@ -1201,25 +1201,24 @@ evgl_eng_gles_context_create(void *data,
#endif
}
static Eina_Bool
evgl_eng_native_win_surface_config_check(void *data, int evgl_depth,
int evgl_stencil, int evgl_msaa)
static void
evgl_eng_native_win_surface_config_get(void *data, int *win_depth,
int *win_stencil, int *win_msaa)
{
Render_Engine *re = data;
if (!re) return EINA_FALSE;
if (!re) return;
if ((eng_get_ob(re)->detected.depth_buffer_size >= evgl_depth)
&& (eng_get_ob(re)->detected.stencil_buffer_size >= evgl_stencil)
&& (eng_get_ob(re)->detected.msaa >= evgl_msaa))
{
DBG("Win cfg can support the Req Evas GL's config successfully");
return EINA_TRUE;
}
DBG("Win cfg can't support Evas GL DR win (depth %d, stencil %d, msaa %d)",
if (win_depth)
*win_depth = eng_get_ob(re)->detected.depth_buffer_size;
if (win_stencil)
*win_stencil = eng_get_ob(re)->detected.stencil_buffer_size;
if (win_msaa)
*win_msaa = eng_get_ob(re)->detected.msaa;
DBG("Window config(depth %d, stencil %d, msaa %d)",
eng_get_ob(re)->detected.depth_buffer_size,
eng_get_ob(re)->detected.stencil_buffer_size,
eng_get_ob(re)->detected.msaa);
return EINA_FALSE;
}
static const EVGL_Interface evgl_funcs =
@ -1241,7 +1240,7 @@ static const EVGL_Interface evgl_funcs =
evgl_eng_indirect_surface_create,
evgl_eng_indirect_surface_destroy,
evgl_eng_gles_context_create,
evgl_eng_native_win_surface_config_check,
evgl_eng_native_win_surface_config_get,
};
//----------------------------------------------------------//

View File

@ -484,7 +484,7 @@ static const EVGL_Interface evgl_funcs =
NULL, // OpenGL-ES 1
NULL, // OpenGL-ES 1
NULL, // OpenGL-ES 1
NULL, // native_win_surface_config_check
NULL, // native_win_surface_config_get
};
/* engine functions */