mirror of
https://github.com/brl/mutter.git
synced 2024-12-27 05:12:15 +00:00
cogl: Clean up HAVE_COGL_GL(ES2) checks
These were leftovers from times when GL(ES) 1.x was still supported. As we require HAVE_COGL_GL and/or HAVE_COGL_GLES2 to be defined, all cases for checking both are now redundant. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3338>
This commit is contained in:
parent
81c6269ca7
commit
de8f69c787
@ -181,13 +181,11 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
/* Determines how this pipeline is blended with other primitives */
|
||||
#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL)
|
||||
GLenum blend_equation_rgb;
|
||||
GLenum blend_equation_alpha;
|
||||
GLint blend_src_factor_alpha;
|
||||
GLint blend_dst_factor_alpha;
|
||||
CoglColor blend_constant;
|
||||
#endif
|
||||
GLint blend_src_factor_rgb;
|
||||
GLint blend_dst_factor_rgb;
|
||||
} CoglPipelineBlendState;
|
||||
|
@ -547,7 +547,6 @@ arg_to_gl_blend_factor (CoglBlendStringArgument *arg)
|
||||
return GL_DST_ALPHA;
|
||||
}
|
||||
}
|
||||
#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL)
|
||||
else if (arg->factor.source.info->type ==
|
||||
COGL_BLEND_STRING_COLOR_SOURCE_CONSTANT)
|
||||
{
|
||||
@ -566,7 +565,6 @@ arg_to_gl_blend_factor (CoglBlendStringArgument *arg)
|
||||
return GL_CONSTANT_ALPHA;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
g_warning ("Unable to determine valid blend factor from blend string\n");
|
||||
return GL_ONE;
|
||||
@ -679,38 +677,34 @@ void
|
||||
cogl_pipeline_set_blend_constant (CoglPipeline *pipeline,
|
||||
const CoglColor *constant_color)
|
||||
{
|
||||
CoglPipelineState state = COGL_PIPELINE_STATE_BLEND;
|
||||
CoglPipeline *authority;
|
||||
CoglPipelineBlendState *blend_state;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
g_return_if_fail (cogl_is_pipeline (pipeline));
|
||||
|
||||
#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL)
|
||||
{
|
||||
CoglPipelineState state = COGL_PIPELINE_STATE_BLEND;
|
||||
CoglPipeline *authority;
|
||||
CoglPipelineBlendState *blend_state;
|
||||
authority = _cogl_pipeline_get_authority (pipeline, state);
|
||||
|
||||
authority = _cogl_pipeline_get_authority (pipeline, state);
|
||||
blend_state = &authority->big_state->blend_state;
|
||||
if (cogl_color_equal (constant_color, &blend_state->blend_constant))
|
||||
return;
|
||||
|
||||
blend_state = &authority->big_state->blend_state;
|
||||
if (cogl_color_equal (constant_color, &blend_state->blend_constant))
|
||||
return;
|
||||
/* - Flush journal primitives referencing the current state.
|
||||
* - Make sure the pipeline has no dependants so it may be modified.
|
||||
* - If the pipeline isn't currently an authority for the state being
|
||||
* changed, then initialize that state from the current authority.
|
||||
*/
|
||||
_cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE);
|
||||
|
||||
/* - Flush journal primitives referencing the current state.
|
||||
* - Make sure the pipeline has no dependants so it may be modified.
|
||||
* - If the pipeline isn't currently an authority for the state being
|
||||
* changed, then initialize that state from the current authority.
|
||||
*/
|
||||
_cogl_pipeline_pre_change_notify (pipeline, state, NULL, FALSE);
|
||||
blend_state = &pipeline->big_state->blend_state;
|
||||
blend_state->blend_constant = *constant_color;
|
||||
|
||||
blend_state = &pipeline->big_state->blend_state;
|
||||
blend_state->blend_constant = *constant_color;
|
||||
_cogl_pipeline_update_authority (pipeline, authority, state,
|
||||
_cogl_pipeline_blend_state_equal);
|
||||
|
||||
_cogl_pipeline_update_authority (pipeline, authority, state,
|
||||
_cogl_pipeline_blend_state_equal);
|
||||
|
||||
pipeline->dirty_real_blend_enable = TRUE;
|
||||
}
|
||||
#endif
|
||||
pipeline->dirty_real_blend_enable = TRUE;
|
||||
}
|
||||
|
||||
CoglHandle
|
||||
|
@ -123,14 +123,12 @@ _cogl_pipeline_init_default_pipeline (void)
|
||||
alpha_state->alpha_func_reference = 0.0;
|
||||
|
||||
/* Not the same as the GL default, but seems saner... */
|
||||
#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL)
|
||||
blend_state->blend_equation_rgb = GL_FUNC_ADD;
|
||||
blend_state->blend_equation_alpha = GL_FUNC_ADD;
|
||||
blend_state->blend_src_factor_alpha = GL_ONE;
|
||||
blend_state->blend_dst_factor_alpha = GL_ONE_MINUS_SRC_ALPHA;
|
||||
cogl_color_init_from_4ub (&blend_state->blend_constant,
|
||||
0x00, 0x00, 0x00, 0x00);
|
||||
#endif
|
||||
blend_state->blend_src_factor_rgb = GL_ONE;
|
||||
blend_state->blend_dst_factor_rgb = GL_ONE_MINUS_SRC_ALPHA;
|
||||
|
||||
|
@ -63,7 +63,7 @@
|
||||
extern const CoglTextureDriver _cogl_texture_driver_gl;
|
||||
extern const CoglDriverVtable _cogl_driver_gl;
|
||||
#endif
|
||||
#if defined (HAVE_COGL_GLES2)
|
||||
#ifdef HAVE_COGL_GLES2
|
||||
extern const CoglTextureDriver _cogl_texture_driver_gles;
|
||||
extern const CoglDriverVtable _cogl_driver_gles;
|
||||
#endif
|
||||
|
@ -100,14 +100,8 @@ update_hints_to_gl_enum (CoglBuffer *buffer)
|
||||
return GL_STATIC_DRAW;
|
||||
case COGL_BUFFER_UPDATE_HINT_DYNAMIC:
|
||||
return GL_DYNAMIC_DRAW;
|
||||
|
||||
case COGL_BUFFER_UPDATE_HINT_STREAM:
|
||||
/* OpenGL ES 1.1 only knows about STATIC_DRAW and DYNAMIC_DRAW */
|
||||
#if defined(HAVE_COGL_GL) || defined(HAVE_COGL_GLES2)
|
||||
return GL_STREAM_DRAW;
|
||||
#else
|
||||
return GL_DYNAMIC_DRAW;
|
||||
#endif
|
||||
}
|
||||
|
||||
g_assert_not_reached ();
|
||||
|
@ -903,11 +903,6 @@ _cogl_pipeline_fragend_glsl_add_layer (CoglPipeline *pipeline,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* GLES2 and GL3 don't have alpha testing so we need to implement it
|
||||
in the shader */
|
||||
|
||||
#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL)
|
||||
|
||||
static void
|
||||
add_alpha_test_snippet (CoglPipeline *pipeline,
|
||||
CoglPipelineFragendShaderState *shader_state)
|
||||
@ -968,8 +963,6 @@ add_alpha_test_snippet (CoglPipeline *pipeline,
|
||||
" _cogl_alpha_test_ref)\n discard;\n");
|
||||
}
|
||||
|
||||
#endif /* HAVE_COGL_GLES2 */
|
||||
|
||||
static gboolean
|
||||
_cogl_pipeline_fragend_glsl_end (CoglPipeline *pipeline,
|
||||
unsigned long pipelines_difference)
|
||||
|
@ -237,8 +237,6 @@ _cogl_pipeline_texture_storage_change_notify (CoglTexture *texture)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL)
|
||||
|
||||
static gboolean
|
||||
blend_factor_uses_constant (GLenum blend_factor)
|
||||
{
|
||||
@ -248,8 +246,6 @@ blend_factor_uses_constant (GLenum blend_factor)
|
||||
blend_factor == GL_ONE_MINUS_CONSTANT_ALPHA);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
flush_depth_state (CoglContext *ctx,
|
||||
CoglDepthState *depth_state)
|
||||
@ -319,7 +315,6 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
|
||||
CoglPipelineBlendState *blend_state =
|
||||
&authority->big_state->blend_state;
|
||||
|
||||
#if defined(HAVE_COGL_GLES2) || defined(HAVE_COGL_GL)
|
||||
if (blend_factor_uses_constant (blend_state->blend_src_factor_rgb) ||
|
||||
blend_factor_uses_constant (blend_state
|
||||
->blend_src_factor_alpha) ||
|
||||
@ -347,7 +342,6 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
|
||||
blend_state->blend_src_factor_alpha,
|
||||
blend_state->blend_dst_factor_alpha));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pipelines_difference & COGL_PIPELINE_STATE_DEPTH)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user