cogl: Remove unused immutable_ref
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3810>
This commit is contained in:
parent
4ae305f19e
commit
0064bf240e
8 changed files with 0 additions and 208 deletions
|
@ -78,8 +78,6 @@ struct _CoglAttribute
|
||||||
CoglBoxedValue boxed;
|
CoglBoxedValue boxed;
|
||||||
} constant;
|
} constant;
|
||||||
} d;
|
} d;
|
||||||
|
|
||||||
int immutable_ref;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -109,12 +107,6 @@ CoglAttributeNameState *
|
||||||
_cogl_attribute_register_attribute_name (CoglContext *context,
|
_cogl_attribute_register_attribute_name (CoglContext *context,
|
||||||
const char *name);
|
const char *name);
|
||||||
|
|
||||||
CoglAttribute *
|
|
||||||
_cogl_attribute_immutable_ref (CoglAttribute *attribute);
|
|
||||||
|
|
||||||
void
|
|
||||||
_cogl_attribute_immutable_unref (CoglAttribute *attribute);
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int unit;
|
int unit;
|
||||||
|
|
|
@ -235,8 +235,6 @@ cogl_attribute_new (CoglAttributeBuffer *attribute_buffer,
|
||||||
attribute->d.buffered.n_components = n_components;
|
attribute->d.buffered.n_components = n_components;
|
||||||
attribute->d.buffered.type = type;
|
attribute->d.buffered.type = type;
|
||||||
|
|
||||||
attribute->immutable_ref = 0;
|
|
||||||
|
|
||||||
if (attribute->name_state->name_id != COGL_ATTRIBUTE_NAME_ID_CUSTOM_ARRAY)
|
if (attribute->name_state->name_id != COGL_ATTRIBUTE_NAME_ID_CUSTOM_ARRAY)
|
||||||
{
|
{
|
||||||
if (!validate_n_components (attribute->name_state, n_components))
|
if (!validate_n_components (attribute->name_state, n_components))
|
||||||
|
@ -254,27 +252,12 @@ error:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
warn_about_midscene_changes (void)
|
|
||||||
{
|
|
||||||
static gboolean seen = FALSE;
|
|
||||||
if (!seen)
|
|
||||||
{
|
|
||||||
g_warning ("Mid-scene modification of attributes has "
|
|
||||||
"undefined results\n");
|
|
||||||
seen = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_attribute_set_normalized (CoglAttribute *attribute,
|
cogl_attribute_set_normalized (CoglAttribute *attribute,
|
||||||
gboolean normalized)
|
gboolean normalized)
|
||||||
{
|
{
|
||||||
g_return_if_fail (COGL_IS_ATTRIBUTE (attribute));
|
g_return_if_fail (COGL_IS_ATTRIBUTE (attribute));
|
||||||
|
|
||||||
if (G_UNLIKELY (attribute->immutable_ref))
|
|
||||||
warn_about_midscene_changes ();
|
|
||||||
|
|
||||||
attribute->normalized = normalized;
|
attribute->normalized = normalized;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,30 +270,6 @@ cogl_attribute_get_buffer (CoglAttribute *attribute)
|
||||||
return attribute->d.buffered.attribute_buffer;
|
return attribute->d.buffered.attribute_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglAttribute *
|
|
||||||
_cogl_attribute_immutable_ref (CoglAttribute *attribute)
|
|
||||||
{
|
|
||||||
CoglBuffer *buffer = COGL_BUFFER (attribute->d.buffered.attribute_buffer);
|
|
||||||
|
|
||||||
g_return_val_if_fail (COGL_IS_ATTRIBUTE (attribute), NULL);
|
|
||||||
|
|
||||||
attribute->immutable_ref++;
|
|
||||||
_cogl_buffer_immutable_ref (buffer);
|
|
||||||
return attribute;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_cogl_attribute_immutable_unref (CoglAttribute *attribute)
|
|
||||||
{
|
|
||||||
CoglBuffer *buffer = COGL_BUFFER (attribute->d.buffered.attribute_buffer);
|
|
||||||
|
|
||||||
g_return_if_fail (COGL_IS_ATTRIBUTE (attribute));
|
|
||||||
g_return_if_fail (attribute->immutable_ref > 0);
|
|
||||||
|
|
||||||
attribute->immutable_ref--;
|
|
||||||
_cogl_buffer_immutable_unref (buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_layer_cb (CoglPipeline *pipeline,
|
validate_layer_cb (CoglPipeline *pipeline,
|
||||||
int layer_index,
|
int layer_index,
|
||||||
|
|
|
@ -68,8 +68,6 @@ struct _CoglBuffer
|
||||||
* ... or points to allocated memory in the fallback paths */
|
* ... or points to allocated memory in the fallback paths */
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
|
|
||||||
int immutable_ref;
|
|
||||||
|
|
||||||
unsigned int store_created : 1;
|
unsigned int store_created : 1;
|
||||||
|
|
||||||
void * (* map_range) (CoglBuffer *buffer,
|
void * (* map_range) (CoglBuffer *buffer,
|
||||||
|
@ -92,12 +90,6 @@ struct _CoglBufferClass
|
||||||
GObjectClass parent_class;
|
GObjectClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
CoglBuffer *
|
|
||||||
_cogl_buffer_immutable_ref (CoglBuffer *buffer);
|
|
||||||
|
|
||||||
void
|
|
||||||
_cogl_buffer_immutable_unref (CoglBuffer *buffer);
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_cogl_buffer_set_data (CoglBuffer *buffer,
|
_cogl_buffer_set_data (CoglBuffer *buffer,
|
||||||
size_t offset,
|
size_t offset,
|
||||||
|
|
|
@ -104,7 +104,6 @@ cogl_buffer_dispose (GObject *object)
|
||||||
CoglBuffer *buffer = COGL_BUFFER (object);
|
CoglBuffer *buffer = COGL_BUFFER (object);
|
||||||
|
|
||||||
g_return_if_fail (!(buffer->flags & COGL_BUFFER_FLAG_MAPPED));
|
g_return_if_fail (!(buffer->flags & COGL_BUFFER_FLAG_MAPPED));
|
||||||
g_return_if_fail (buffer->immutable_ref == 0);
|
|
||||||
|
|
||||||
if (buffer->flags & COGL_BUFFER_FLAG_BUFFER_OBJECT)
|
if (buffer->flags & COGL_BUFFER_FLAG_BUFFER_OBJECT)
|
||||||
buffer->context->driver_vtable->buffer_destroy (buffer);
|
buffer->context->driver_vtable->buffer_destroy (buffer);
|
||||||
|
@ -217,7 +216,6 @@ cogl_buffer_init (CoglBuffer *buffer)
|
||||||
buffer->flags = COGL_BUFFER_FLAG_NONE;
|
buffer->flags = COGL_BUFFER_FLAG_NONE;
|
||||||
buffer->store_created = FALSE;
|
buffer->store_created = FALSE;
|
||||||
buffer->data = NULL;
|
buffer->data = NULL;
|
||||||
buffer->immutable_ref = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
|
@ -249,18 +247,6 @@ cogl_buffer_get_update_hint (CoglBuffer *buffer)
|
||||||
return buffer->update_hint;
|
return buffer->update_hint;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
warn_about_midscene_changes (void)
|
|
||||||
{
|
|
||||||
static gboolean seen = FALSE;
|
|
||||||
if (!seen)
|
|
||||||
{
|
|
||||||
g_warning ("Mid-scene modification of buffers has "
|
|
||||||
"undefined results\n");
|
|
||||||
seen = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void *
|
void *
|
||||||
_cogl_buffer_map (CoglBuffer *buffer,
|
_cogl_buffer_map (CoglBuffer *buffer,
|
||||||
CoglBufferAccess access,
|
CoglBufferAccess access,
|
||||||
|
@ -296,9 +282,6 @@ cogl_buffer_map_range (CoglBuffer *buffer,
|
||||||
g_return_val_if_fail (COGL_IS_BUFFER (buffer), NULL);
|
g_return_val_if_fail (COGL_IS_BUFFER (buffer), NULL);
|
||||||
g_return_val_if_fail (!(buffer->flags & COGL_BUFFER_FLAG_MAPPED), NULL);
|
g_return_val_if_fail (!(buffer->flags & COGL_BUFFER_FLAG_MAPPED), NULL);
|
||||||
|
|
||||||
if (G_UNLIKELY (buffer->immutable_ref))
|
|
||||||
warn_about_midscene_changes ();
|
|
||||||
|
|
||||||
buffer->data = buffer->map_range (buffer,
|
buffer->data = buffer->map_range (buffer,
|
||||||
offset,
|
offset,
|
||||||
size,
|
size,
|
||||||
|
@ -403,9 +386,6 @@ _cogl_buffer_set_data (CoglBuffer *buffer,
|
||||||
g_return_val_if_fail (COGL_IS_BUFFER (buffer), FALSE);
|
g_return_val_if_fail (COGL_IS_BUFFER (buffer), FALSE);
|
||||||
g_return_val_if_fail ((offset + size) <= buffer->size, FALSE);
|
g_return_val_if_fail ((offset + size) <= buffer->size, FALSE);
|
||||||
|
|
||||||
if (G_UNLIKELY (buffer->immutable_ref))
|
|
||||||
warn_about_midscene_changes ();
|
|
||||||
|
|
||||||
return buffer->set_data (buffer, offset, data, size, error);
|
return buffer->set_data (buffer, offset, data, size, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,22 +401,3 @@ cogl_buffer_set_data (CoglBuffer *buffer,
|
||||||
g_clear_error (&ignore_error);
|
g_clear_error (&ignore_error);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglBuffer *
|
|
||||||
_cogl_buffer_immutable_ref (CoglBuffer *buffer)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (COGL_IS_BUFFER (buffer), NULL);
|
|
||||||
|
|
||||||
buffer->immutable_ref++;
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_cogl_buffer_immutable_unref (CoglBuffer *buffer)
|
|
||||||
{
|
|
||||||
g_return_if_fail (COGL_IS_BUFFER (buffer));
|
|
||||||
g_return_if_fail (buffer->immutable_ref > 0);
|
|
||||||
|
|
||||||
buffer->immutable_ref--;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -45,11 +45,4 @@ struct _CoglIndices
|
||||||
|
|
||||||
CoglIndicesType type;
|
CoglIndicesType type;
|
||||||
|
|
||||||
int immutable_ref;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CoglIndices *
|
|
||||||
_cogl_indices_immutable_ref (CoglIndices *indices);
|
|
||||||
|
|
||||||
void
|
|
||||||
_cogl_indices_immutable_unref (CoglIndices *indices);
|
|
||||||
|
|
|
@ -94,8 +94,6 @@ cogl_indices_new_for_buffer (CoglIndicesType type,
|
||||||
|
|
||||||
indices->type = type;
|
indices->type = type;
|
||||||
|
|
||||||
indices->immutable_ref = 0;
|
|
||||||
|
|
||||||
return indices;
|
return indices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,50 +149,15 @@ cogl_indices_get_offset (CoglIndices *indices)
|
||||||
return indices->offset;
|
return indices->offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
warn_about_midscene_changes (void)
|
|
||||||
{
|
|
||||||
static gboolean seen = FALSE;
|
|
||||||
if (!seen)
|
|
||||||
{
|
|
||||||
g_warning ("Mid-scene modification of indices has "
|
|
||||||
"undefined results\n");
|
|
||||||
seen = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_indices_set_offset (CoglIndices *indices,
|
cogl_indices_set_offset (CoglIndices *indices,
|
||||||
size_t offset)
|
size_t offset)
|
||||||
{
|
{
|
||||||
g_return_if_fail (COGL_IS_INDICES (indices));
|
g_return_if_fail (COGL_IS_INDICES (indices));
|
||||||
|
|
||||||
if (G_UNLIKELY (indices->immutable_ref))
|
|
||||||
warn_about_midscene_changes ();
|
|
||||||
|
|
||||||
indices->offset = offset;
|
indices->offset = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglIndices *
|
|
||||||
_cogl_indices_immutable_ref (CoglIndices *indices)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (COGL_IS_INDICES (indices), NULL);
|
|
||||||
|
|
||||||
indices->immutable_ref++;
|
|
||||||
_cogl_buffer_immutable_ref (COGL_BUFFER (indices->buffer));
|
|
||||||
return indices;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_cogl_indices_immutable_unref (CoglIndices *indices)
|
|
||||||
{
|
|
||||||
g_return_if_fail (COGL_IS_INDICES (indices));
|
|
||||||
g_return_if_fail (indices->immutable_ref > 0);
|
|
||||||
|
|
||||||
indices->immutable_ref--;
|
|
||||||
_cogl_buffer_immutable_unref (COGL_BUFFER (indices->buffer));
|
|
||||||
}
|
|
||||||
|
|
||||||
CoglIndices *
|
CoglIndices *
|
||||||
cogl_get_rectangle_indices (CoglContext *ctx, int n_rectangles)
|
cogl_get_rectangle_indices (CoglContext *ctx, int n_rectangles)
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,18 +46,10 @@ struct _CoglPrimitive
|
||||||
int first_vertex;
|
int first_vertex;
|
||||||
int n_vertices;
|
int n_vertices;
|
||||||
|
|
||||||
int immutable_ref;
|
|
||||||
|
|
||||||
GPtrArray *attributes;
|
GPtrArray *attributes;
|
||||||
int n_attributes;
|
int n_attributes;
|
||||||
};
|
};
|
||||||
|
|
||||||
CoglPrimitive *
|
|
||||||
_cogl_primitive_immutable_ref (CoglPrimitive *primitive);
|
|
||||||
|
|
||||||
void
|
|
||||||
_cogl_primitive_immutable_unref (CoglPrimitive *primitive);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_primitive_draw (CoglPrimitive *primitive,
|
_cogl_primitive_draw (CoglPrimitive *primitive,
|
||||||
CoglFramebuffer *framebuffer,
|
CoglFramebuffer *framebuffer,
|
||||||
|
|
|
@ -69,7 +69,6 @@ static void
|
||||||
cogl_primitive_init (CoglPrimitive *primitive)
|
cogl_primitive_init (CoglPrimitive *primitive)
|
||||||
{
|
{
|
||||||
primitive->first_vertex = 0;
|
primitive->first_vertex = 0;
|
||||||
primitive->immutable_ref = 0;
|
|
||||||
primitive->indices = NULL;
|
primitive->indices = NULL;
|
||||||
primitive->attributes = g_ptr_array_new_with_free_func (g_object_unref);
|
primitive->attributes = g_ptr_array_new_with_free_func (g_object_unref);
|
||||||
}
|
}
|
||||||
|
@ -394,18 +393,6 @@ cogl_primitive_new_p3t2c4 (CoglContext *ctx,
|
||||||
3);
|
3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
warn_about_midscene_changes (void)
|
|
||||||
{
|
|
||||||
static gboolean seen = FALSE;
|
|
||||||
if (!seen)
|
|
||||||
{
|
|
||||||
g_warning ("Mid-scene modification of primitives has "
|
|
||||||
"undefined results\n");
|
|
||||||
seen = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
cogl_primitive_get_first_vertex (CoglPrimitive *primitive)
|
cogl_primitive_get_first_vertex (CoglPrimitive *primitive)
|
||||||
{
|
{
|
||||||
|
@ -420,12 +407,6 @@ cogl_primitive_set_first_vertex (CoglPrimitive *primitive,
|
||||||
{
|
{
|
||||||
g_return_if_fail (COGL_IS_PRIMITIVE (primitive));
|
g_return_if_fail (COGL_IS_PRIMITIVE (primitive));
|
||||||
|
|
||||||
if (G_UNLIKELY (primitive->immutable_ref))
|
|
||||||
{
|
|
||||||
warn_about_midscene_changes ();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
primitive->first_vertex = first_vertex;
|
primitive->first_vertex = first_vertex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,12 +441,6 @@ cogl_primitive_set_mode (CoglPrimitive *primitive,
|
||||||
{
|
{
|
||||||
g_return_if_fail (COGL_IS_PRIMITIVE (primitive));
|
g_return_if_fail (COGL_IS_PRIMITIVE (primitive));
|
||||||
|
|
||||||
if (G_UNLIKELY (primitive->immutable_ref))
|
|
||||||
{
|
|
||||||
warn_about_midscene_changes ();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
primitive->mode = mode;
|
primitive->mode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,12 +451,6 @@ cogl_primitive_set_indices (CoglPrimitive *primitive,
|
||||||
{
|
{
|
||||||
g_return_if_fail (COGL_IS_PRIMITIVE (primitive));
|
g_return_if_fail (COGL_IS_PRIMITIVE (primitive));
|
||||||
|
|
||||||
if (G_UNLIKELY (primitive->immutable_ref))
|
|
||||||
{
|
|
||||||
warn_about_midscene_changes ();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (indices)
|
if (indices)
|
||||||
g_object_ref (indices);
|
g_object_ref (indices);
|
||||||
if (primitive->indices)
|
if (primitive->indices)
|
||||||
|
@ -512,35 +481,6 @@ cogl_primitive_copy (CoglPrimitive *primitive)
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglPrimitive *
|
|
||||||
_cogl_primitive_immutable_ref (CoglPrimitive *primitive)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
g_return_val_if_fail (COGL_IS_PRIMITIVE (primitive), NULL);
|
|
||||||
|
|
||||||
primitive->immutable_ref++;
|
|
||||||
|
|
||||||
for (i = 0; i < primitive->n_attributes; i++)
|
|
||||||
_cogl_attribute_immutable_ref (primitive->attributes->pdata[i]);
|
|
||||||
|
|
||||||
return primitive;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_cogl_primitive_immutable_unref (CoglPrimitive *primitive)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
g_return_if_fail (COGL_IS_PRIMITIVE (primitive));
|
|
||||||
g_return_if_fail (primitive->immutable_ref > 0);
|
|
||||||
|
|
||||||
primitive->immutable_ref--;
|
|
||||||
|
|
||||||
for (i = 0; i < primitive->n_attributes; i++)
|
|
||||||
_cogl_attribute_immutable_unref (primitive->attributes->pdata[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_primitive_foreach_attribute (CoglPrimitive *primitive,
|
cogl_primitive_foreach_attribute (CoglPrimitive *primitive,
|
||||||
CoglPrimitiveAttributeCallback callback,
|
CoglPrimitiveAttributeCallback callback,
|
||||||
|
|
Loading…
Reference in a new issue