mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 10:00:45 -05:00
Fix depth testing, write enable bug
This fixes a bug in _cogl_pipeline_flush_color_blend_alpha_depth_state whereby we were only calling flush_depth_state if we knew that at least depth testing was enabled. This didn't take into account that enabling and disabling depth writing is a useful change to make even if depth testing is disabled. It also seemed a bit messy to flush the depth-testing enable separately from the other depth state. _cogl_pipeline_flush_color_blend_alpha_depth_state now simply calls flush_depth_state() if there is a _DEPTH_STATE difference and flush_depth_state() also handles flushing the depth-testing enable in along with all the other depth state. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit 6a9dfc55b8f55d7023cb592e5bef2118d0f3d50c)
This commit is contained in:
parent
fb636008ad
commit
3f2cb89a76
@ -401,11 +401,20 @@ blend_factor_uses_constant (GLenum blend_factor)
|
||||
#endif
|
||||
|
||||
static void
|
||||
flush_depth_state (CoglDepthState *depth_state)
|
||||
flush_depth_state (CoglContext *ctx,
|
||||
CoglDepthState *depth_state)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
if (ctx->depth_test_enabled_cache != depth_state->test_enabled)
|
||||
{
|
||||
if (depth_state->test_enabled == TRUE)
|
||||
GE (ctx, glEnable (GL_DEPTH_TEST));
|
||||
else
|
||||
GE (ctx, glDisable (GL_DEPTH_TEST));
|
||||
ctx->depth_test_enabled_cache = depth_state->test_enabled;
|
||||
}
|
||||
|
||||
if (ctx->depth_test_function_cache != depth_state->test_function)
|
||||
if (ctx->depth_test_function_cache != depth_state->test_function &&
|
||||
depth_state->test_enabled == TRUE)
|
||||
{
|
||||
GE (ctx, glDepthFunc (depth_state->test_function));
|
||||
ctx->depth_test_function_cache = depth_state->test_function;
|
||||
@ -571,20 +580,7 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
|
||||
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_DEPTH);
|
||||
CoglDepthState *depth_state = &authority->big_state->depth_state;
|
||||
|
||||
if (depth_state->test_enabled)
|
||||
{
|
||||
if (ctx->depth_test_enabled_cache != TRUE)
|
||||
{
|
||||
GE (ctx, glEnable (GL_DEPTH_TEST));
|
||||
ctx->depth_test_enabled_cache = depth_state->test_enabled;
|
||||
}
|
||||
flush_depth_state (depth_state);
|
||||
}
|
||||
else if (ctx->depth_test_enabled_cache != FALSE)
|
||||
{
|
||||
GE (ctx, glDisable (GL_DEPTH_TEST));
|
||||
ctx->depth_test_enabled_cache = depth_state->test_enabled;
|
||||
}
|
||||
flush_depth_state (ctx, depth_state);
|
||||
}
|
||||
|
||||
if (pipelines_difference & COGL_PIPELINE_STATE_LOGIC_OPS)
|
||||
|
Loading…
Reference in New Issue
Block a user