1
0
Fork 0

cogl: Remove builtin/texcoord attribute tracking bitmasks from CoglContext

These were only being set from the fixed-function pipeline.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/995
This commit is contained in:
Adam Jackson 2019-12-19 15:22:48 -05:00 committed by Georges Basile Stavracas Neto
parent abd094d135
commit 3f2ad5a50a
3 changed files with 1 additions and 93 deletions

View file

@ -104,15 +104,11 @@ struct _CoglContext
GArray *attribute_name_index_map;
int n_attribute_names;
CoglBitmask enabled_builtin_attributes;
CoglBitmask enabled_texcoord_attributes;
CoglBitmask enabled_custom_attributes;
/* These are temporary bitmasks that are used when disabling
* builtin,texcoord and custom attribute arrays. They are here just
* builtin and custom attribute arrays. They are here just
* to avoid allocating new ones each time */
CoglBitmask enable_builtin_attributes_tmp;
CoglBitmask enable_texcoord_attributes_tmp;
CoglBitmask enable_custom_attributes_tmp;
CoglBitmask changed_bits_tmp;

View file

@ -282,10 +282,6 @@ cogl_context_new (CoglDisplay *display,
context->current_pipeline_changes_since_flush = 0;
context->current_pipeline_with_color_attrib = FALSE;
_cogl_bitmask_init (&context->enabled_builtin_attributes);
_cogl_bitmask_init (&context->enable_builtin_attributes_tmp);
_cogl_bitmask_init (&context->enabled_texcoord_attributes);
_cogl_bitmask_init (&context->enable_texcoord_attributes_tmp);
_cogl_bitmask_init (&context->enabled_custom_attributes);
_cogl_bitmask_init (&context->enable_custom_attributes_tmp);
_cogl_bitmask_init (&context->changed_bits_tmp);
@ -409,10 +405,6 @@ _cogl_context_free (CoglContext *context)
g_slist_free (context->atlases);
g_hook_list_clear (&context->atlas_reorganize_callbacks);
_cogl_bitmask_destroy (&context->enabled_builtin_attributes);
_cogl_bitmask_destroy (&context->enable_builtin_attributes_tmp);
_cogl_bitmask_destroy (&context->enabled_texcoord_attributes);
_cogl_bitmask_destroy (&context->enable_texcoord_attributes_tmp);
_cogl_bitmask_destroy (&context->enabled_custom_attributes);
_cogl_bitmask_destroy (&context->enable_custom_attributes_tmp);
_cogl_bitmask_destroy (&context->changed_bits_tmp);

View file

@ -53,69 +53,6 @@ typedef struct _ForeachChangedBitState
CoglPipeline *pipeline;
} ForeachChangedBitState;
static gboolean
toggle_builtin_attribute_enabled_cb (int bit_num, void *user_data)
{
ForeachChangedBitState *state = user_data;
CoglContext *context = state->context;
g_return_val_if_fail (context->driver == COGL_DRIVER_GL,
FALSE);
#ifdef HAVE_COGL_GL
{
gboolean enabled = _cogl_bitmask_get (state->new_bits, bit_num);
GLenum cap;
switch (bit_num)
{
case COGL_ATTRIBUTE_NAME_ID_COLOR_ARRAY:
cap = GL_COLOR_ARRAY;
break;
case COGL_ATTRIBUTE_NAME_ID_POSITION_ARRAY:
cap = GL_VERTEX_ARRAY;
break;
case COGL_ATTRIBUTE_NAME_ID_NORMAL_ARRAY:
cap = GL_NORMAL_ARRAY;
break;
default:
g_assert_not_reached ();
}
if (enabled)
GE (context, glEnableClientState (cap));
else
GE (context, glDisableClientState (cap));
}
#endif
return TRUE;
}
static gboolean
toggle_texcood_attribute_enabled_cb (int bit_num, void *user_data)
{
ForeachChangedBitState *state = user_data;
CoglContext *context = state->context;
g_return_val_if_fail (context->driver == COGL_DRIVER_GL,
FALSE);
#ifdef HAVE_COGL_GL
{
gboolean enabled = _cogl_bitmask_get (state->new_bits, bit_num);
GE( context, glClientActiveTexture (GL_TEXTURE0 + bit_num) );
if (enabled)
GE( context, glEnableClientState (GL_TEXTURE_COORD_ARRAY) );
else
GE( context, glDisableClientState (GL_TEXTURE_COORD_ARRAY) );
}
#endif
return TRUE;
}
static gboolean
toggle_custom_attribute_enabled_cb (int bit_num, void *user_data)
{
@ -232,22 +169,7 @@ apply_attribute_enable_updates (CoglContext *context,
ForeachChangedBitState changed_bits_state;
changed_bits_state.context = context;
changed_bits_state.new_bits = &context->enable_builtin_attributes_tmp;
changed_bits_state.pipeline = pipeline;
foreach_changed_bit_and_save (context,
&context->enabled_builtin_attributes,
&context->enable_builtin_attributes_tmp,
toggle_builtin_attribute_enabled_cb,
&changed_bits_state);
changed_bits_state.new_bits = &context->enable_texcoord_attributes_tmp;
foreach_changed_bit_and_save (context,
&context->enabled_texcoord_attributes,
&context->enable_texcoord_attributes_tmp,
toggle_texcood_attribute_enabled_cb,
&changed_bits_state);
changed_bits_state.new_bits = &context->enable_custom_attributes_tmp;
foreach_changed_bit_and_save (context,
&context->enabled_custom_attributes,
@ -337,8 +259,6 @@ _cogl_gl_flush_attributes_state (CoglFramebuffer *framebuffer,
with_color_attrib,
unknown_color_alpha);
_cogl_bitmask_clear_all (&ctx->enable_builtin_attributes_tmp);
_cogl_bitmask_clear_all (&ctx->enable_texcoord_attributes_tmp);
_cogl_bitmask_clear_all (&ctx->enable_custom_attributes_tmp);
/* Bind the attribute pointers. We need to do this after the