diff --git a/clutter/clutter/clutter-backend.c b/clutter/clutter/clutter-backend.c index d97d9275dc7850044776d769046155df37eafd76..c38cffc096c0e70d4ee2b7de225cd5c51176ce29 100644 --- a/clutter/clutter/clutter-backend.c +++ b/clutter/clutter/clutter-backend.c @@ -255,7 +255,7 @@ clutter_backend_real_create_context (ClutterBackend *backend, return FALSE; } - backend->cogl_source = cogl_glib_source_new (backend->cogl_context, G_PRIORITY_DEFAULT); + backend->cogl_source = cogl_glib_source_new (backend->cogl_renderer, G_PRIORITY_DEFAULT); g_source_attach (backend->cogl_source, NULL); return TRUE; diff --git a/clutter/clutter/clutter-deform-effect.c b/clutter/clutter/clutter-deform-effect.c index 5326ec2428d9e7f4c5bfd2e316d00253d5abaf1c..a88b27cf42fec9723e16d74f20fda0cc9cdc1257 100644 --- a/clutter/clutter/clutter-deform-effect.c +++ b/clutter/clutter/clutter-deform-effect.c @@ -61,6 +61,24 @@ #define DEFAULT_N_TILES 32 +/** + * ClutterVertexP3T2C4: + * @x: The x component of a position attribute + * @y: The y component of a position attribute + * @z: The z component of a position attribute + * @s: The s component of a texture coordinate attribute + * @t: The t component of a texture coordinate attribute + * @r: The red component of a color attribute + * @b: The green component of a color attribute + * @g: The blue component of a color attribute + * @a: The alpha component of a color attribute + */ +typedef struct { + float x, y, z; + float s, t; + uint8_t r, g, b, a; +} ClutterVertexP3T2C4; + typedef struct _ClutterDeformEffectPrivate { CoglPipeline *back_pipeline; @@ -88,7 +106,7 @@ enum PROP_X_TILES, PROP_Y_TILES, - PROP_BACK_MATERIAL, + PROP_BACK_PIPELINE, PROP_LAST }; @@ -179,7 +197,7 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect, if (priv->is_dirty) { gboolean mapped_buffer; - CoglVertexP3T2C4 *verts; + ClutterVertexP3T2C4 *verts; ClutterActor *actor; gfloat width, height; guint opacity; @@ -217,7 +235,7 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect, { for (j = 0; j < priv->x_tiles + 1; j++) { - CoglVertexP3T2C4 *vertex_out; + ClutterVertexP3T2C4 *vertex_out; ClutterTextureVertex vertex; /* CoglTextureVertex isn't an ideal structure to use for @@ -280,7 +298,7 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect, cogl_depth_state_set_test_function (&depth_state, COGL_DEPTH_TEST_FUNCTION_LEQUAL); cogl_pipeline_set_depth_state (pipeline, &depth_state, NULL); - /* enable backface culling if we have a back material */ + /* enable backface culling if we have a back pipeline */ if (priv->back_pipeline != NULL) cogl_pipeline_set_cull_face_mode (pipeline, COGL_PIPELINE_CULL_FACE_MODE_BACK); @@ -304,7 +322,7 @@ clutter_deform_effect_paint_target (ClutterOffscreenEffect *effect, ClutterPaintNode *back_node; CoglPipeline *back_pipeline; - /* We probably shouldn't be modifying the user's material so + /* We probably shouldn't be modifying the user's pipeline so instead we make a temporary copy */ back_pipeline = cogl_pipeline_copy (priv->back_pipeline); cogl_pipeline_set_depth_state (back_pipeline, &depth_state, NULL); @@ -431,7 +449,7 @@ clutter_deform_effect_init_arrays (ClutterDeformEffect *self) priv->buffer = cogl_attribute_buffer_new (ctx, - sizeof (CoglVertexP3T2C4) * + sizeof (ClutterVertexP3T2C4) * priv->n_vertices, NULL); @@ -442,20 +460,20 @@ clutter_deform_effect_init_arrays (ClutterDeformEffect *self) attributes[0] = cogl_attribute_new (priv->buffer, "cogl_position_in", - sizeof (CoglVertexP3T2C4), - G_STRUCT_OFFSET (CoglVertexP3T2C4, x), + sizeof (ClutterVertexP3T2C4), + G_STRUCT_OFFSET (ClutterVertexP3T2C4, x), 3, /* n_components */ COGL_ATTRIBUTE_TYPE_FLOAT); attributes[1] = cogl_attribute_new (priv->buffer, "cogl_tex_coord0_in", - sizeof (CoglVertexP3T2C4), - G_STRUCT_OFFSET (CoglVertexP3T2C4, s), + sizeof (ClutterVertexP3T2C4), + G_STRUCT_OFFSET (ClutterVertexP3T2C4, s), 2, /* n_components */ COGL_ATTRIBUTE_TYPE_FLOAT); attributes[2] = cogl_attribute_new (priv->buffer, "cogl_color_in", - sizeof (CoglVertexP3T2C4), - G_STRUCT_OFFSET (CoglVertexP3T2C4, r), + sizeof (ClutterVertexP3T2C4), + G_STRUCT_OFFSET (ClutterVertexP3T2C4, r), 4, /* n_components */ COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE); @@ -530,8 +548,8 @@ clutter_deform_effect_set_property (GObject *gobject, g_value_get_uint (value)); break; - case PROP_BACK_MATERIAL: - clutter_deform_effect_set_back_material (self, g_value_get_object (value)); + case PROP_BACK_PIPELINE: + clutter_deform_effect_set_back_pipeline (self, g_value_get_object (value)); break; default: @@ -560,7 +578,7 @@ clutter_deform_effect_get_property (GObject *gobject, g_value_set_uint (value, priv->y_tiles); break; - case PROP_BACK_MATERIAL: + case PROP_BACK_PIPELINE: g_value_set_object (value, priv->back_pipeline); break; @@ -606,15 +624,15 @@ clutter_deform_effect_class_init (ClutterDeformEffectClass *klass) G_PARAM_STATIC_STRINGS); /** - * ClutterDeformEffect:back-material: + * ClutterDeformEffect:back-pipeline: * - * A material to be used when painting the back of the actor + * A pipeline to be used when painting the back of the actor * to which this effect has been applied * - * By default, no material will be used + * By default, no pipeline will be used */ - obj_props[PROP_BACK_MATERIAL] = - g_param_spec_object ("back-material", NULL, NULL, + obj_props[PROP_BACK_PIPELINE] = + g_param_spec_object ("back-pipeline", NULL, NULL, COGL_TYPE_PIPELINE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); @@ -644,18 +662,18 @@ clutter_deform_effect_init (ClutterDeformEffect *self) } /** - * clutter_deform_effect_set_back_material: + * clutter_deform_effect_set_back_pipeline: * @effect: a #ClutterDeformEffect - * @material: (allow-none): a handle to a Cogl material + * @pipeline: (allow-none): A #CoglPipeline * - * Sets the material that should be used when drawing the back face + * Sets the pipeline that should be used when drawing the back face * of the actor during a deformation * - * The #ClutterDeformEffect will take a reference on the material's + * The #ClutterDeformEffect will take a reference on the pipeline's * handle */ void -clutter_deform_effect_set_back_material (ClutterDeformEffect *effect, +clutter_deform_effect_set_back_pipeline (ClutterDeformEffect *effect, CoglPipeline *pipeline) { ClutterDeformEffectPrivate *priv; @@ -675,17 +693,15 @@ clutter_deform_effect_set_back_material (ClutterDeformEffect *effect, } /** - * clutter_deform_effect_get_back_material: + * clutter_deform_effect_get_back_pipeline: * @effect: a #ClutterDeformEffect * - * Retrieves the handle to the back face material used by @effect + * Retrieves the back pipeline used by @effect * - * Return value: (transfer none): a handle for the material, or %NULL. - * The returned material is owned by the #ClutterDeformEffect and it - * should not be freed directly + * Return value: (transfer none) (nullable): A #CoglPipeline. */ CoglPipeline* -clutter_deform_effect_get_back_material (ClutterDeformEffect *effect) +clutter_deform_effect_get_back_pipeline (ClutterDeformEffect *effect) { ClutterDeformEffectPrivate *priv; diff --git a/clutter/clutter/clutter-deform-effect.h b/clutter/clutter/clutter-deform-effect.h index 0de08e73a2392ea8a038f8cafc3e993fafd1cf67..2fc4c1e113e4aa4e49b005202cd7ab73ae3f5b64 100644 --- a/clutter/clutter/clutter-deform-effect.h +++ b/clutter/clutter/clutter-deform-effect.h @@ -88,10 +88,10 @@ struct _ClutterDeformEffectClass }; CLUTTER_EXPORT -void clutter_deform_effect_set_back_material (ClutterDeformEffect *effect, - CoglPipeline *material); +void clutter_deform_effect_set_back_pipeline (ClutterDeformEffect *effect, + CoglPipeline *pipeline); CLUTTER_EXPORT -CoglPipeline* clutter_deform_effect_get_back_material (ClutterDeformEffect *effect); +CoglPipeline* clutter_deform_effect_get_back_pipeline (ClutterDeformEffect *effect); CLUTTER_EXPORT void clutter_deform_effect_set_n_tiles (ClutterDeformEffect *effect, guint x_tiles, diff --git a/clutter/clutter/clutter-effect.c b/clutter/clutter/clutter-effect.c index 29c39a1dc6587e3af4bd9a99fc973ebedc836e00..e857b7bf8c6582c907e80e0af8c1ad496a95bef6 100644 --- a/clutter/clutter/clutter-effect.c +++ b/clutter/clutter/clutter-effect.c @@ -24,7 +24,7 @@ /** * ClutterEffect: - * + * * Base class for actor effects * * The #ClutterEffect class provides a default type and API for creating @@ -75,10 +75,10 @@ * The example below creates two rectangles: one will be painted "behind" the actor, * while another will be painted "on top" of the actor. * - * The #ClutterActorMetaClass.set_actor() implementation will create the two materials + * The #ClutterActorMetaClass.set_actor() implementation will create the two pipelines * used for the two different rectangles; the #ClutterEffectClass.paint() implementation - * will paint the first material using cogl_rectangle(), before continuing and then it - * will paint paint the second material after. + * will paint the first pipeline using cogl_rectangle(), before continuing and then it + * will paint paint the second pipeline after. * * ```c * typedef struct { @@ -119,12 +119,12 @@ * if (self->actor == NULL) * return; * - * // Create a red material + * // Create a red pipeline * self->rect_1 = cogl_pipeline_new (); * cogl_color_init_from_4f (&color, 1.0, 1.0, 1.0, 1.0); * cogl_pipeline_set_color (self->rect_1, &color); * - * // Create a green material + * // Create a green pipeline * self->rect_2 = cogl_pipeline_new (); * cogl_color_init_from_4f (&color, 0.0, 1.0, 0.0, 1.0); * cogl_pipeline_set_color (self->rect_2, &color); diff --git a/clutter/clutter/clutter-offscreen-effect.c b/clutter/clutter/clutter-offscreen-effect.c index e839632510595c55a4001ab3a1b0b0b50da79e80..b2f36297c83db7c2cc0ec03f8808f69683652ef8 100644 --- a/clutter/clutter/clutter-offscreen-effect.c +++ b/clutter/clutter/clutter-offscreen-effect.c @@ -52,7 +52,7 @@ * function, which encapsulates the effective painting of the texture that * contains the result of the offscreen redirection. * - * The size of the target material is defined to be as big as the + * The size of the target pipeline is defined to be as big as the * transformed size of the [class@Actor] using the offscreen effect. * Sub-classes of #ClutterOffscreenEffect can change the texture creation * code to provide bigger textures by overriding the @@ -486,7 +486,7 @@ clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect, node = transform_node; } - /* paint the target material; this is virtualized for + /* paint the target pipeline; this is virtualized for * sub-classes that require special hand-holding */ clutter_offscreen_effect_paint_target (effect, node, paint_context); @@ -640,7 +640,7 @@ clutter_offscreen_effect_init (ClutterOffscreenEffect *self) * implementation should update any references to the texture after * chaining-up to the parent's pre_paint implementation. This can be * used instead of [method@OffscreenEffect.get_texture] when the - * effect subclass wants to paint using its own material. + * effect subclass wants to paint using its own pipeline. * * Return value: (transfer none): a #CoglTexture or %NULL. The * returned texture is owned by Clutter and it should not be diff --git a/clutter/clutter/clutter-shader-effect.c b/clutter/clutter/clutter-shader-effect.c index 415ca7edac11e4facdd1ad62b23207657ba2b54f..8125af8cc887acefcee0b8d44691d61a6f2cd50d 100644 --- a/clutter/clutter/clutter-shader-effect.c +++ b/clutter/clutter/clutter-shader-effect.c @@ -24,9 +24,9 @@ /** * ClutterShaderEffect: - * + * * Base class for shader effects - * + * * #ClutterShaderEffect is a class that implements all the plumbing for * creating [class@Effect]s using GLSL shaders. * @@ -305,11 +305,11 @@ clutter_shader_effect_create_shader (ClutterShaderEffect *self) switch (priv->shader_type) { case CLUTTER_FRAGMENT_SHADER: - return cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT); + return cogl_shader_new (COGL_SHADER_TYPE_FRAGMENT); break; case CLUTTER_VERTEX_SHADER: - return cogl_create_shader (COGL_SHADER_TYPE_VERTEX); + return cogl_shader_new (COGL_SHADER_TYPE_VERTEX); break; default: @@ -349,7 +349,7 @@ clutter_shader_effect_try_static_source (ClutterShaderEffect *self) CLUTTER_NOTE (SHADER, "Compiling shader effect"); - class_priv->program = cogl_create_program (); + class_priv->program = cogl_program_new (); cogl_program_attach_shader (class_priv->program, class_priv->shader); @@ -873,7 +873,7 @@ clutter_shader_effect_set_shader_source (ClutterShaderEffect *effect, CLUTTER_NOTE (SHADER, "Compiling shader effect"); - priv->program = cogl_create_program (); + priv->program = cogl_program_new (); cogl_program_attach_shader (priv->program, priv->shader); diff --git a/cogl/cogl-pango/cogl-pango-pipeline-cache.c b/cogl/cogl-pango/cogl-pango-pipeline-cache.c index 6d587b9d29cb02710da0742b69014a5ded32f7fd..3d66ee997d2627e6e708b27fb1b9ee489327c16c 100644 --- a/cogl/cogl-pango/cogl-pango-pipeline-cache.c +++ b/cogl/cogl-pango/cogl-pango-pipeline-cache.c @@ -134,7 +134,7 @@ get_base_texture_alpha_pipeline (CoglPangoPipelineCache *cache) cogl_pipeline_set_static_name (pipeline, "CoglPango (texture alpha)"); cache->base_texture_alpha_pipeline = pipeline; - /* The default combine mode of materials is to modulate (A x B) + /* The default combine mode of pipelines is to modulate (A x B) * the texture RGBA channels with the RGBA channels of the * previous layer (which in our case is just the font color) * diff --git a/cogl/cogl/cogl-atlas-private.h b/cogl/cogl/cogl-atlas-private.h index dc3c4f940af3c4e73bcb3bc815147b5c1c4e850e..2804126a2fefede134c2ade3b675aefc3a704c4e 100644 --- a/cogl/cogl/cogl-atlas-private.h +++ b/cogl/cogl/cogl-atlas-private.h @@ -59,10 +59,3 @@ _cogl_atlas_copy_rectangle (CoglAtlas *atlas, int width, int height, CoglPixelFormat format); - - -void -_cogl_atlas_remove_reorganize_callback (CoglAtlas *atlas, - GHookFunc pre_callback, - GHookFunc post_callback, - void *user_data); diff --git a/cogl/cogl/cogl-atlas.c b/cogl/cogl/cogl-atlas.c index 8e5c8b13a35be14ce99f220a593cefa0244df054..1f0d4c44b3cbd083006f45bbcc27203bbb74a221 100644 --- a/cogl/cogl/cogl-atlas.c +++ b/cogl/cogl/cogl-atlas.c @@ -669,29 +669,3 @@ cogl_atlas_add_reorganize_callback (CoglAtlas *atlas, g_hook_prepend (&atlas->post_reorganize_callbacks, hook); } } - -void -_cogl_atlas_remove_reorganize_callback (CoglAtlas *atlas, - GHookFunc pre_callback, - GHookFunc post_callback, - void *user_data) -{ - if (pre_callback) - { - GHook *hook = g_hook_find_func_data (&atlas->pre_reorganize_callbacks, - FALSE, - pre_callback, - user_data); - if (hook) - g_hook_destroy_link (&atlas->pre_reorganize_callbacks, hook); - } - if (post_callback) - { - GHook *hook = g_hook_find_func_data (&atlas->post_reorganize_callbacks, - FALSE, - post_callback, - user_data); - if (hook) - g_hook_destroy_link (&atlas->post_reorganize_callbacks, hook); - } -} diff --git a/cogl/cogl/cogl-attribute-buffer.c b/cogl/cogl/cogl-attribute-buffer.c index ee89e500ab3e3dce92c0127e7bbfe2e638a1be8e..9b33a2a059b53d6423bc21362eee315c57d0cee7 100644 --- a/cogl/cogl/cogl-attribute-buffer.c +++ b/cogl/cogl/cogl-attribute-buffer.c @@ -86,11 +86,10 @@ cogl_attribute_buffer_new (CoglContext *context, /* XXX: NB: for Cogl 2.0 we don't allow NULL data here but we can't * break the api for 1.x and so we keep the check for now. */ if (data) - _cogl_buffer_set_data (COGL_BUFFER (buffer), - 0, - data, - bytes, - NULL); + cogl_buffer_set_data (COGL_BUFFER (buffer), + 0, + data, + bytes); return buffer; } diff --git a/cogl/cogl/cogl-attribute.c b/cogl/cogl/cogl-attribute.c index a62070350495daff2328bd0edd95c46e7eb5af4e..d886af578f3e26c185e9a71d0a85484a03c5aee1 100644 --- a/cogl/cogl/cogl-attribute.c +++ b/cogl/cogl/cogl-attribute.c @@ -301,7 +301,7 @@ validate_layer_cb (CoglPipeline *pipeline, if (!_cogl_texture_can_hardware_repeat (texture)) { - g_warning ("Disabling layer %d of the current source material, " + g_warning ("Disabling layer %d of the current source pipeline, " "because texturing with the vertex buffer API is not " "currently supported using sliced textures, or textures " "with waste\n", layer_index); diff --git a/cogl/cogl/cogl-bitmap.c b/cogl/cogl/cogl-bitmap.c index 7c8d274686547c8b69dac83d38038da5086cf25a..3025c416df9b975840fb2e0b07187f1a43cce9b2 100644 --- a/cogl/cogl/cogl-bitmap.c +++ b/cogl/cogl/cogl-bitmap.c @@ -82,12 +82,12 @@ _cogl_bitmap_convert_premult_status (CoglBitmap *bmp, /* Do we need to unpremultiply? */ if ((bmp->format & COGL_PREMULT_BIT) > 0 && (dst_format & COGL_PREMULT_BIT) == 0 && - COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT (dst_format)) + _cogl_pixel_format_can_have_premult (dst_format)) return _cogl_bitmap_unpremult (bmp, error); /* Do we need to premultiply? */ if ((bmp->format & COGL_PREMULT_BIT) == 0 && - COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT (bmp->format) && + _cogl_pixel_format_can_have_premult (bmp->format) && (dst_format & COGL_PREMULT_BIT) > 0) /* Try premultiplying using imaging library */ return _cogl_bitmap_premult (bmp, error); @@ -372,12 +372,6 @@ cogl_bitmap_get_buffer (CoglBitmap *bitmap) return COGL_PIXEL_BUFFER (bitmap->buffer); } -uint32_t -cogl_bitmap_error_quark (void) -{ - return g_quark_from_static_string ("cogl-bitmap-error-quark"); -} - uint8_t * _cogl_bitmap_map (CoglBitmap *bitmap, CoglBufferAccess access, diff --git a/cogl/cogl/cogl-bitmap.h b/cogl/cogl/cogl-bitmap.h index c9a35f69f13c77f56e5e6930844afe5700ea27fd..bca72f7fada952132ab940536618e441a382204f 100644 --- a/cogl/cogl/cogl-bitmap.h +++ b/cogl/cogl/cogl-bitmap.h @@ -197,31 +197,4 @@ cogl_bitmap_get_rowstride (CoglBitmap *bitmap); COGL_EXPORT CoglPixelBuffer * cogl_bitmap_get_buffer (CoglBitmap *bitmap); -/** - * COGL_BITMAP_ERROR: - * - * #GError domain for bitmap errors. - */ -#define COGL_BITMAP_ERROR (cogl_bitmap_error_quark ()) - -/** - * CoglBitmapError: - * @COGL_BITMAP_ERROR_FAILED: Generic failure code, something went - * wrong. - * @COGL_BITMAP_ERROR_UNKNOWN_TYPE: Unknown image type. - * @COGL_BITMAP_ERROR_CORRUPT_IMAGE: An image file was broken somehow. - * - * Error codes that can be thrown when performing bitmap - * operations. - */ -typedef enum -{ - COGL_BITMAP_ERROR_FAILED, - COGL_BITMAP_ERROR_UNKNOWN_TYPE, - COGL_BITMAP_ERROR_CORRUPT_IMAGE -} CoglBitmapError; - -COGL_EXPORT -uint32_t cogl_bitmap_error_quark (void); - G_END_DECLS diff --git a/cogl/cogl/cogl-bitmask.c b/cogl/cogl/cogl-bitmask.c index 0bb7d455570593df317232edf44c0034b5b28e71..e5cc0bfce3a71f65bbffad843363af2f8ff987d0 100644 --- a/cogl/cogl/cogl-bitmask.c +++ b/cogl/cogl/cogl-bitmask.c @@ -285,7 +285,7 @@ _cogl_bitmask_popcount_in_array (const CoglBitmask *bitmask) int i; for (i = 0; i < array->len; i++) - pop += _cogl_util_popcountl (g_array_index (array, unsigned long, i)); + pop += __builtin_popcountl (g_array_index (array, unsigned long, i)); return pop; } @@ -307,10 +307,10 @@ _cogl_bitmask_popcount_upto_in_array (const CoglBitmask *bitmask, int i; for (i = 0; i < array_index; i++) - pop += _cogl_util_popcountl (g_array_index (array, unsigned long, i)); + pop += __builtin_popcountl (g_array_index (array, unsigned long, i)); top_mask = g_array_index (array, unsigned long, array_index); - return pop + _cogl_util_popcountl (top_mask & ((1UL << bit_index) - 1)); + return pop + __builtin_popcountl (top_mask & ((1UL << bit_index) - 1)); } } diff --git a/cogl/cogl/cogl-bitmask.h b/cogl/cogl/cogl-bitmask.h index a73e68e4d05c4737934503df8b64f04db3b85dd7..1f18b8fbb244d34ce31392c60e26482cb2021657 100644 --- a/cogl/cogl/cogl-bitmask.h +++ b/cogl/cogl/cogl-bitmask.h @@ -281,7 +281,7 @@ _cogl_bitmask_popcount (const CoglBitmask *bitmask) { return (_cogl_bitmask_has_array (bitmask) ? _cogl_bitmask_popcount_in_array (bitmask) : - _cogl_util_popcountl (_cogl_bitmask_to_bits (bitmask))); + __builtin_popcountl (_cogl_bitmask_to_bits (bitmask))); } /* @@ -301,10 +301,10 @@ _cogl_bitmask_popcount_upto (const CoglBitmask *bitmask, if (_cogl_bitmask_has_array (bitmask)) return _cogl_bitmask_popcount_upto_in_array (bitmask, upto); else if (upto >= (int) COGL_BITMASK_MAX_DIRECT_BITS) - return _cogl_util_popcountl (_cogl_bitmask_to_bits (bitmask)); + return __builtin_popcountl (_cogl_bitmask_to_bits (bitmask)); else - return _cogl_util_popcountl (_cogl_bitmask_to_bits (bitmask) & - ((1UL << upto) - 1)); + return __builtin_popcountl (_cogl_bitmask_to_bits (bitmask) & + ((1UL << upto) - 1)); } G_END_DECLS diff --git a/cogl/cogl/cogl-blend-string.h b/cogl/cogl/cogl-blend-string.h index 08f6ab2b53d4e0b33f55bd83b158c061e23bb01d..e38b06b6a6a6dc881ef252343a7cd7ca928fc818 100644 --- a/cogl/cogl/cogl-blend-string.h +++ b/cogl/cogl/cogl-blend-string.h @@ -127,6 +127,33 @@ typedef struct _CoglBlendStringStatement CoglBlendStringArgument args[3]; } CoglBlendStringStatement; +/** + * COGL_BLEND_STRING_ERROR: + * + * #GError domain for blend string parser errors + */ +#define COGL_BLEND_STRING_ERROR (cogl_blend_string_error_quark ()) + +/** + * CoglBlendStringError: + * @COGL_BLEND_STRING_ERROR_PARSE_ERROR: Generic parse error + * @COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR: Argument parse error + * @COGL_BLEND_STRING_ERROR_INVALID_ERROR: Internal parser error + * @COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR: Blend string not + * supported by the GPU + * + * Error enumeration for the blend strings parser + */ +typedef enum /*< prefix=COGL_BLEND_STRING_ERROR >*/ +{ + COGL_BLEND_STRING_ERROR_PARSE_ERROR, + COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR, + COGL_BLEND_STRING_ERROR_INVALID_ERROR, + COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR +} CoglBlendStringError; + +uint32_t +cogl_blend_string_error_quark (void); gboolean _cogl_blend_string_compile (const char *string, diff --git a/cogl/cogl/cogl-buffer-private.h b/cogl/cogl/cogl-buffer-private.h index a08d62592b730ea1de6744af3fe2d8023d6a8e55..bebc18f4159e86a30a39689a2d4c3976d49e73b6 100644 --- a/cogl/cogl/cogl-buffer-private.h +++ b/cogl/cogl/cogl-buffer-private.h @@ -90,13 +90,6 @@ struct _CoglBufferClass GObjectClass parent_class; }; -gboolean -_cogl_buffer_set_data (CoglBuffer *buffer, - size_t offset, - const void *data, - size_t size, - GError **error); - void * _cogl_buffer_map (CoglBuffer *buffer, CoglBufferAccess access, diff --git a/cogl/cogl/cogl-buffer.c b/cogl/cogl/cogl-buffer.c index 166e51afb3d081638792273227916097cd175a76..8c258e024a4bdb8e8793673c5e7bb664d6ae8ae0 100644 --- a/cogl/cogl/cogl-buffer.c +++ b/cogl/cogl/cogl-buffer.c @@ -365,11 +365,10 @@ _cogl_buffer_unmap_for_fill_or_fallback (CoglBuffer *buffer) * smaller buffers, though that would probably not help for * deferred renderers. */ - _cogl_buffer_set_data (buffer, - ctx->buffer_map_fallback_offset, - ctx->buffer_map_fallback_array->data, - ctx->buffer_map_fallback_array->len, - NULL); + cogl_buffer_set_data (buffer, + ctx->buffer_map_fallback_offset, + ctx->buffer_map_fallback_array->data, + ctx->buffer_map_fallback_array->len); buffer->flags &= ~COGL_BUFFER_FLAG_MAPPED_FALLBACK; } else @@ -377,27 +376,19 @@ _cogl_buffer_unmap_for_fill_or_fallback (CoglBuffer *buffer) } gboolean -_cogl_buffer_set_data (CoglBuffer *buffer, - size_t offset, - const void *data, - size_t size, - GError **error) +cogl_buffer_set_data (CoglBuffer *buffer, + size_t offset, + const void *data, + size_t size) { + GError *ignore_error = NULL; + gboolean status; + g_return_val_if_fail (COGL_IS_BUFFER (buffer), FALSE); g_return_val_if_fail ((offset + size) <= buffer->size, FALSE); - return buffer->set_data (buffer, offset, data, size, error); -} + status = buffer->set_data (buffer, offset, data, size, &ignore_error); -gboolean -cogl_buffer_set_data (CoglBuffer *buffer, - size_t offset, - const void *data, - size_t size) -{ - GError *ignore_error = NULL; - gboolean status = - _cogl_buffer_set_data (buffer, offset, data, size, &ignore_error); g_clear_error (&ignore_error); return status; } diff --git a/cogl/cogl/cogl-buffer.h b/cogl/cogl/cogl-buffer.h index c73cfad064d32c09336646cb15c6499d5f73be6c..a0b37455de0b9aed6c534306641a1d8f1af1fc96 100644 --- a/cogl/cogl/cogl-buffer.h +++ b/cogl/cogl/cogl-buffer.h @@ -79,24 +79,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (CoglBuffer, g_object_unref) COGL_EXPORT GType cogl_buffer_get_type (void) G_GNUC_CONST; -#define COGL_BUFFER_ERROR (_cogl_buffer_error_domain ()) - -/** - * CoglBufferError: - * @COGL_BUFFER_ERROR_MAP: A buffer could not be mapped either - * because the feature isn't supported or because a system - * limitation was hit. - * - * Error enumeration for #CoglBuffer - */ -typedef enum /*< prefix=COGL_BUFFER_ERROR >*/ -{ - COGL_BUFFER_ERROR_MAP -} CoglBufferError; - -uint32_t -_cogl_buffer_error_domain (void); - /** * cogl_buffer_get_size: * @buffer: a buffer object diff --git a/cogl/cogl/cogl-clip-stack.c b/cogl/cogl/cogl-clip-stack.c index 96f7514de97fbed2b00ec263e1eb139127071450..7be177ee9c21864a8615b2deff082ec413242963 100644 --- a/cogl/cogl/cogl-clip-stack.c +++ b/cogl/cogl/cogl-clip-stack.c @@ -38,6 +38,7 @@ #include "cogl/cogl-clip-stack.h" #include "cogl/cogl-context-private.h" #include "cogl/cogl-framebuffer-private.h" +#include "cogl/cogl-graphene.h" #include "cogl/cogl-journal-private.h" #include "cogl/cogl-util.h" #include "cogl/cogl-primitives-private.h" @@ -97,6 +98,46 @@ _cogl_clip_stack_entry_set_bounds (CoglClipStack *entry, entry->bounds_y1 = (int) ceilf (max_y); } +/* Scale from OpenGL normalized device coordinates (ranging from -1 to 1) + * to Cogl window/framebuffer coordinates (ranging from 0 to buffer-size) with + * (0,0) being top left. */ +#define VIEWPORT_TRANSFORM_X(x, vp_origin_x, vp_width) \ + ( ( ((x) + 1.0f) * ((vp_width) / 2.0f) ) + (vp_origin_x) ) +/* Note: for Y we first flip all coordinates around the X axis while in + * normalized device coordinates */ +#define VIEWPORT_TRANSFORM_Y(y, vp_origin_y, vp_height) \ + ( ( ((-(y)) + 1.0f) * ((vp_height) / 2.0f) ) + (vp_origin_y) ) + +/* Transform a homogeneous vertex position from model space to Cogl + * window coordinates (with 0,0 being top left) */ +void +_cogl_transform_point (const graphene_matrix_t *matrix_mv, + const graphene_matrix_t *matrix_p, + const float *viewport, + float *x, + float *y) +{ + float z = 0; + float w = 1; + + /* Apply the modelview matrix transform */ + cogl_graphene_matrix_project_point (matrix_mv, x, y, &z, &w); + + /* Apply the projection matrix transform */ + cogl_graphene_matrix_project_point (matrix_p, x, y, &z, &w); + + /* Perform perspective division */ + *x /= w; + *y /= w; + + /* Apply viewport transform */ + *x = VIEWPORT_TRANSFORM_X (*x, viewport[0], viewport[2]); + *y = VIEWPORT_TRANSFORM_Y (*y, viewport[1], viewport[3]); +} + +#undef VIEWPORT_TRANSFORM_X +#undef VIEWPORT_TRANSFORM_Y + CoglClipStack * _cogl_clip_stack_push_rectangle (CoglClipStack *stack, float x_1, @@ -304,14 +345,10 @@ _cogl_clip_stack_get_bounds (CoglClipStack *stack, { /* Get the intersection of the current scissor and the bounding box of this clip */ - _cogl_util_scissor_intersect (entry->bounds_x0, - entry->bounds_y0, - entry->bounds_x1, - entry->bounds_y1, - scissor_x0, - scissor_y0, - scissor_x1, - scissor_y1); + *scissor_x0 = MAX (*scissor_x0, entry->bounds_x0); + *scissor_y0 = MAX (*scissor_y0, entry->bounds_y0); + *scissor_x1 = MIN (*scissor_x1, entry->bounds_x1); + *scissor_y1 = MIN (*scissor_y1, entry->bounds_y1); } } diff --git a/cogl/cogl/cogl-context.c b/cogl/cogl/cogl-context.c index 4f5f34a9177de521f9ea487ad3243e8b072c10c1..eb74b6d32631a18fba875501476f1c6293635971 100644 --- a/cogl/cogl/cogl-context.c +++ b/cogl/cogl/cogl-context.c @@ -443,7 +443,7 @@ cogl_context_get_latest_sync_fd (CoglContext *context) } CoglGraphicsResetStatus -cogl_get_graphics_reset_status (CoglContext *context) +cogl_context_get_graphics_reset_status (CoglContext *context) { return context->driver_vtable->get_graphics_reset_status (context); } diff --git a/cogl/cogl/cogl-context.h b/cogl/cogl/cogl-context.h index 3ad937df4be1caad2d37a96d2b67dd016c2c4ab1..21e913632bd57e09253a596136ef45820aeb9c09 100644 --- a/cogl/cogl/cogl-context.h +++ b/cogl/cogl/cogl-context.h @@ -46,6 +46,12 @@ typedef struct _CoglTimestampQuery CoglTimestampQuery; #include "cogl/cogl-pipeline.h" #include "cogl/cogl-primitive.h" +#ifdef HAVE_EGL +#include +#include +#include +#endif + #include G_BEGIN_DECLS @@ -229,7 +235,7 @@ cogl_context_has_feature (CoglContext *context, * @COGL_GRAPHICS_RESET_STATUS_PURGED_CONTEXT_RESET: * * All the error values that might be returned by - * cogl_get_graphics_reset_status(). Each value's meaning corresponds + * cogl_context_get_graphics_reset_status(). Each value's meaning corresponds * to the similarly named value defined in the ARB_robustness and * NV_robustness_video_memory_purge extensions. */ @@ -243,7 +249,7 @@ typedef enum _CoglGraphicsResetStatus } CoglGraphicsResetStatus; /** - * cogl_get_graphics_reset_status: + * cogl_context_get_graphics_reset_status: * @context: a #CoglContext pointer * * Returns the graphics reset status as reported by @@ -256,7 +262,7 @@ typedef enum _CoglGraphicsResetStatus * Return value: a #CoglGraphicsResetStatus */ COGL_EXPORT CoglGraphicsResetStatus -cogl_get_graphics_reset_status (CoglContext *context); +cogl_context_get_graphics_reset_status (CoglContext *context); /** * cogl_context_is_hardware_accelerated: @@ -365,9 +371,28 @@ cogl_context_has_winsys_feature (CoglContext *context, * primitives you are 100% on your own since you stand a good chance of * conflicting with Cogl internals. For example clutter-gst which currently * uses direct GL calls to bind ARBfp programs will very likely break when Cogl - * starts to use ARBfb programs itself for the material API. + * starts to use ARBfb programs itself for the pipeline API. */ COGL_EXPORT void cogl_context_flush (CoglContext *context); +#ifdef HAVE_EGL +/** + * cogl_context_get_egl_display: + * @context: A #CoglContext pointer + * + * If you have done a runtime check to determine that Cogl is using + * EGL internally then this API can be used to retrieve the EGLDisplay + * handle that was setup internally. The result is undefined if Cogl + * is not using EGL. + * + * Note: The current window system backend can be checked using + * cogl_renderer_get_winsys_id(). + * + * Return value: The internally setup EGLDisplay handle. + */ +COGL_EXPORT EGLDisplay +cogl_context_get_egl_display (CoglContext *context); +#endif /* HAVE_EGL */ + G_END_DECLS diff --git a/cogl/cogl/cogl-cpu-caps.h b/cogl/cogl/cogl-cpu-caps.h index 162e5b889df6ced16b914253528d1f65c07d3622..50de9cfaf902638ecf0c1927585a4bbcb7bdb168 100644 --- a/cogl/cogl/cogl-cpu-caps.h +++ b/cogl/cogl/cogl-cpu-caps.h @@ -28,8 +28,7 @@ * */ -#ifndef COGL_CPU_CAPS_H -#define COGL_CPU_CAPS_H +#pragma once #include "cogl/cogl-types.h" @@ -50,5 +49,3 @@ cogl_cpu_has_cap (CoglCpuCaps cap) { return !!(cogl_cpu_caps & cap); } - -#endif /* COGL_CPU_CAPS_H */ diff --git a/cogl/cogl/cogl-egl.h b/cogl/cogl/cogl-egl.h deleted file mode 100644 index deef1de2b4722f5039901f91f46f55d211020371..0000000000000000000000000000000000000000 --- a/cogl/cogl/cogl-egl.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2007,2008,2009,2010 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * - */ - -#pragma once - -#include -#include -#include - -#include "cogl/cogl-types.h" - -G_BEGIN_DECLS - -/** - * cogl_egl_context_get_egl_display: - * @context: A #CoglContext pointer - * - * If you have done a runtime check to determine that Cogl is using - * EGL internally then this API can be used to retrieve the EGLDisplay - * handle that was setup internally. The result is undefined if Cogl - * is not using EGL. - * - * Note: The current window system backend can be checked using - * cogl_renderer_get_winsys_id(). - * - * Return value: The internally setup EGLDisplay handle. - */ -COGL_EXPORT EGLDisplay -cogl_egl_context_get_egl_display (CoglContext *context); - -G_END_DECLS - -/* The gobject introspection scanner seems to parse public headers in - * isolation which means we need to be extra careful about how we - * define and undefine __COGL_H_INSIDE__ used to detect when internal - * headers are incorrectly included by developers. In the gobject - * introspection case we have to manually define __COGL_H_INSIDE__ as - * a commandline argument for the scanner which means we must be - * careful not to undefine it in a header... - */ -#ifdef __COGL_MUST_UNDEF_COGL_H_INSIDE_COGL_EGL__ -#undef __COGL_H_INSIDE__ -#undef __COGL_EGL_H_INSIDE__ -#undef __COGL_MUST_UNDEF_COGL_H_INSIDE_COGL_EGL__ -#endif diff --git a/cogl/cogl/cogl-flags.h b/cogl/cogl/cogl-flags.h index 6e91e4781dd862b46d19e169c45a007bbe48edb2..4020cb27a5766f1f1ae8617175a04277285e3617 100644 --- a/cogl/cogl/cogl-flags.h +++ b/cogl/cogl/cogl-flags.h @@ -111,7 +111,7 @@ G_BEGIN_DECLS \ while (_mask) \ { \ - int _next_bit = _cogl_util_ffsl (_mask); \ + int _next_bit = __builtin_ffsl (_mask); \ (bit) += _next_bit; \ /* This odd two-part shift is to avoid */ \ /* shifting by sizeof (long)*8 which has */ \ diff --git a/cogl/cogl/cogl-framebuffer-private.h b/cogl/cogl/cogl-framebuffer-private.h index 32fff4b6a4f06cf600fe512070b62375fe0fc0ea..9acc4b59f7f2d405d6573069b5ebc7c7e7fb176b 100644 --- a/cogl/cogl/cogl-framebuffer-private.h +++ b/cogl/cogl/cogl-framebuffer-private.h @@ -44,12 +44,12 @@ typedef enum COGL_FRAMEBUFFER_DRIVER_TYPE_BACK, } CoglFramebufferDriverType; -struct _CoglFramebufferDriverConfig +typedef struct _CoglFramebufferDriverConfig { CoglFramebufferDriverType type; gboolean disable_depth_and_stencil; -}; +} CoglFramebufferDriverConfig; typedef struct { diff --git a/cogl/cogl/cogl-framebuffer.h b/cogl/cogl/cogl-framebuffer.h index 64bf8f4dc03f7cf8b457ff8a44ddab9ad5d70a47..cb4fb17935d16506716e5d5c80bfde2a1325e323 100644 --- a/cogl/cogl/cogl-framebuffer.h +++ b/cogl/cogl/cogl-framebuffer.h @@ -85,8 +85,6 @@ G_BEGIN_DECLS * configuration. */ -typedef struct _CoglFramebufferDriverConfig CoglFramebufferDriverConfig; - #define COGL_TYPE_FRAMEBUFFER (cogl_framebuffer_get_type ()) COGL_EXPORT G_DECLARE_DERIVABLE_TYPE (CoglFramebuffer, cogl_framebuffer, @@ -794,7 +792,7 @@ cogl_framebuffer_draw_textured_rectangle (CoglFramebuffer *framebuffer, * * The first pair of coordinates are for the first layer (with the * smallest layer index) and if you supply less texture coordinates - * than there are layers in the current source material then default + * than there are layers in the current source pipeline then default * texture coordinates (0.0, 0.0, 1.0, 1.0) are generated. */ COGL_EXPORT void diff --git a/cogl/cogl/cogl-glib-source.c b/cogl/cogl/cogl-glib-source.c index f526cc663f0b75f557ffef2e24c8fc111e51fc60..90bf6afb6c3bfcb1739ab47f926ddd054c7b2404 100644 --- a/cogl/cogl/cogl-glib-source.c +++ b/cogl/cogl/cogl-glib-source.c @@ -96,8 +96,8 @@ cogl_glib_source_funcs = }; GSource * -cogl_glib_renderer_source_new (CoglRenderer *renderer, - int priority) +cogl_glib_source_new (CoglRenderer *renderer, + int priority) { GSource *source; CoglGLibSource *cogl_source; @@ -114,11 +114,3 @@ cogl_glib_renderer_source_new (CoglRenderer *renderer, return source; } - -GSource * -cogl_glib_source_new (CoglContext *context, - int priority) -{ - return cogl_glib_renderer_source_new (cogl_context_get_renderer (context), - priority); -} diff --git a/cogl/cogl/cogl-glib-source.h b/cogl/cogl/cogl-glib-source.h index 27b301f53829f25188f3e23e34177227341882e4..ad3bb670411340672503f13649d8374e963a8d3b 100644 --- a/cogl/cogl/cogl-glib-source.h +++ b/cogl/cogl/cogl-glib-source.h @@ -42,40 +42,16 @@ G_BEGIN_DECLS /** * cogl_glib_source_new: - * @context: A #CoglContext - * @priority: The priority of the #GSource - * - * Creates a #GSource which handles Cogl's internal system event - * processing. - * - * Applications that manually connect to a #CoglRenderer before they - * create a #CoglContext should instead use - * cogl_glib_renderer_source_new() so that events may be dispatched - * before a context has been created. In that case you don't need to - * use this api in addition later, it is simply enough to use - * cogl_glib_renderer_source_new() instead. - * - * This api is actually just a thin convenience wrapper around - * cogl_glib_renderer_source_new() - * - * Return value: a new #GSource - */ -COGL_EXPORT GSource * -cogl_glib_source_new (CoglContext *context, - int priority); - -/** - * cogl_glib_renderer_source_new: * @renderer: A #CoglRenderer * @priority: The priority of the #GSource * * Creates a #GSource which handles Cogl's internal system event - * processing + * processing. * * Return value: a new #GSource */ COGL_EXPORT GSource * -cogl_glib_renderer_source_new (CoglRenderer *renderer, - int priority); +cogl_glib_source_new (CoglRenderer *renderer, + int priority); G_END_DECLS diff --git a/cogl/cogl/cogl-half-float.h b/cogl/cogl/cogl-half-float.h index cee4374978911c391c9f369bfb803d144c7ecc45..da420c6ef0b438538da74d6f9b66fa7dadd44747 100644 --- a/cogl/cogl/cogl-half-float.h +++ b/cogl/cogl/cogl-half-float.h @@ -23,8 +23,7 @@ /* This source file is originally from Mesa (src/util/half_float.h). */ -#ifndef COGL_HALF_FLOAT_H -#define COGL_HALF_FLOAT_H +#pragma once #include "cogl/cogl-types.h" @@ -117,5 +116,3 @@ cogl_half_is_negative (uint16_t h) { return !!(h & 0x8000); } - -#endif /* COGL_HALF_FLOAT_H */ diff --git a/cogl/cogl/cogl-indices-private.h b/cogl/cogl/cogl-indices-private.h index b3d9239192f37586abd1614b3f9e787efbe2e916..b9760d58a34962b23f11f690fbcfec89caff1a9c 100644 --- a/cogl/cogl/cogl-indices-private.h +++ b/cogl/cogl/cogl-indices-private.h @@ -46,3 +46,6 @@ struct _CoglIndices CoglIndicesType type; }; + +size_t +cogl_indices_type_get_size (CoglIndicesType type); diff --git a/cogl/cogl/cogl-indices.c b/cogl/cogl/cogl-indices.c index 3697a075fc2208d701925e8c85d79cb8aabf16de..0bfd3a3b9a7ab4dc518e483bc6a8d648be2f84ed 100644 --- a/cogl/cogl/cogl-indices.c +++ b/cogl/cogl/cogl-indices.c @@ -67,8 +67,8 @@ cogl_indices_class_init (CoglIndicesClass *class) object_class->dispose = cogl_indices_dispose; } -static size_t -sizeof_indices_type (CoglIndicesType type) +size_t +cogl_indices_type_get_size (CoglIndicesType type) { switch (type) { @@ -103,20 +103,16 @@ cogl_indices_new (CoglContext *context, const void *indices_data, int n_indices) { - size_t buffer_bytes = sizeof_indices_type (type) * n_indices; + size_t buffer_bytes = cogl_indices_type_get_size (type) * n_indices; CoglIndexBuffer *index_buffer = cogl_index_buffer_new (context, buffer_bytes); CoglBuffer *buffer = COGL_BUFFER (index_buffer); CoglIndices *indices; - GError *ignore_error = NULL; - - _cogl_buffer_set_data (buffer, - 0, - indices_data, - buffer_bytes, - &ignore_error); - if (ignore_error) + + if (!cogl_buffer_set_data (buffer, + 0, + indices_data, + buffer_bytes)) { - g_error_free (ignore_error); g_object_unref (index_buffer); return NULL; } @@ -240,4 +236,3 @@ cogl_get_rectangle_indices (CoglContext *ctx, int n_rectangles) return ctx->rectangle_short_indices; } } - diff --git a/cogl/cogl/cogl-list.c b/cogl/cogl/cogl-list.c index 91f86b5cf1356503ae6071f69df8f6bab2282cd4..adb1d40b3c900ad5f5e2cb3917bbfa1ea679c9f7 100644 --- a/cogl/cogl/cogl-list.c +++ b/cogl/cogl/cogl-list.c @@ -55,23 +55,6 @@ _cogl_list_remove (CoglList *elm) elm->prev = NULL; } -int -_cogl_list_length (CoglList *list) -{ - CoglList *e; - int count; - - count = 0; - e = list->next; - while (e != list) - { - e = e->next; - count++; - } - - return count; -} - int _cogl_list_empty (CoglList *list) { diff --git a/cogl/cogl/cogl-list.h b/cogl/cogl/cogl-list.h index dff9f3946e245df822fd26dad3cfef0f34535aca..ffa221892bc10a17d45ef5e53f85d79c14ae9307 100644 --- a/cogl/cogl/cogl-list.h +++ b/cogl/cogl/cogl-list.h @@ -75,9 +75,6 @@ _cogl_list_insert (CoglList *list, void _cogl_list_remove (CoglList *elm); -int -_cogl_list_length (CoglList *list); - int _cogl_list_empty (CoglList *list); diff --git a/cogl/cogl/cogl-macros.h b/cogl/cogl/cogl-macros.h index 895a597c0568681056e582d4334a0509d4765734..7ce526fb23ac63e4fc9abdd206a1780795d8dbbc 100644 --- a/cogl/cogl/cogl-macros.h +++ b/cogl/cogl/cogl-macros.h @@ -42,7 +42,6 @@ #define COGL_DEPRECATED #define COGL_DEPRECATED_FOR(f) -#define COGL_UNAVAILABLE(maj,min) #else /* COGL_DISABLE_DEPRECATION_WARNINGS */ @@ -62,14 +61,6 @@ #define COGL_DEPRECATED_FOR(f) G_DEPRECATED #endif -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) -#define COGL_UNAVAILABLE(maj,min) __attribute__((deprecated("Not available before " #maj "." #min))) -#elif defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320) -#define COGL_UNAVAILABLE(maj,min) __declspec(deprecated("is not available before " #maj "." #min)) -#else -#define COGL_UNAVAILABLE(maj,min) -#endif - #endif /* COGL_DISABLE_DEPRECATION_WARNINGS */ #define COGL_EXPORT __attribute__((visibility("default"))) extern diff --git a/cogl/cogl/cogl-magazine-private.h b/cogl/cogl/cogl-magazine-private.h index b5cc95c1094967f5ca50b0ec708698eea0968252..507f751d9e2f4a1dc832abbca62ebfd0f2da3a08 100644 --- a/cogl/cogl/cogl-magazine-private.h +++ b/cogl/cogl/cogl-magazine-private.h @@ -73,6 +73,3 @@ _cogl_magazine_chunk_free (CoglMagazine *magazine, void *data) chunk->next = magazine->head; magazine->head = chunk; } - -void -_cogl_magazine_free (CoglMagazine *magazine); diff --git a/cogl/cogl/cogl-magazine.c b/cogl/cogl/cogl-magazine.c index c15583384aa2660c653baa74997b3b6f55850d6b..2e444598f1bfcfdfe8a108bfd832589e0e50afa2 100644 --- a/cogl/cogl/cogl-magazine.c +++ b/cogl/cogl/cogl-magazine.c @@ -73,10 +73,3 @@ _cogl_magazine_new (size_t chunk_size, int initial_chunk_count) return magazine; } - -void -_cogl_magazine_free (CoglMagazine *magazine) -{ - _cogl_memory_stack_free (magazine->stack); - g_free (magazine); -} diff --git a/cogl/cogl/cogl-memory-stack-private.h b/cogl/cogl/cogl-memory-stack-private.h index fd6375b38d958914c62130d12e460ce0e6849e6a..9f20ead96d1bab6b52112f3be69bb2607559aa68 100644 --- a/cogl/cogl/cogl-memory-stack-private.h +++ b/cogl/cogl/cogl-memory-stack-private.h @@ -39,6 +39,3 @@ _cogl_memory_stack_new (size_t initial_size_bytes); void * _cogl_memory_stack_alloc (CoglMemoryStack *stack, size_t bytes); - -void -_cogl_memory_stack_free (CoglMemoryStack *stack); diff --git a/cogl/cogl/cogl-memory-stack.c b/cogl/cogl/cogl-memory-stack.c index a7e29710b5c7e9269b20508cc6157948f8d01ac2..042e2d51946a7cc3748dde739bdcbcbc1907d3f7 100644 --- a/cogl/cogl/cogl-memory-stack.c +++ b/cogl/cogl/cogl-memory-stack.c @@ -161,25 +161,3 @@ _cogl_memory_stack_alloc (CoglMemoryStack *stack, size_t bytes) return sub_stack->data; } - -static void -_cogl_memory_sub_stack_free (CoglMemorySubStack *sub_stack) -{ - g_free (sub_stack->data); - g_free (sub_stack); -} - -void -_cogl_memory_stack_free (CoglMemoryStack *stack) -{ - - while (!_cogl_list_empty (&stack->sub_stacks)) - { - CoglMemorySubStack *sub_stack = - _cogl_container_of (stack->sub_stacks.next, CoglMemorySubStack, link); - _cogl_list_remove (&sub_stack->link); - _cogl_memory_sub_stack_free (sub_stack); - } - - g_free (stack); -} diff --git a/cogl/cogl/cogl-onscreen-private.h b/cogl/cogl/cogl-onscreen-private.h index 959a60533b3fac8fbe2bf791d3228f54e302fb98..e732d3fd0b360e5a85220c9af1a6a4bffcbc124c 100644 --- a/cogl/cogl/cogl-onscreen-private.h +++ b/cogl/cogl/cogl-onscreen-private.h @@ -34,6 +34,7 @@ #include "cogl/cogl-framebuffer-private.h" #include "cogl/cogl-closure-list-private.h" #include "cogl/cogl-list.h" +#include "mtk/mtk-rectangle.h" #include @@ -51,7 +52,7 @@ typedef struct _CoglOnscreenQueuedDirty CoglList link; CoglOnscreen *onscreen; - CoglOnscreenDirtyInfo info; + MtkRectangle info; } CoglOnscreenQueuedDirty; void @@ -65,8 +66,8 @@ COGL_EXPORT void _cogl_onscreen_notify_complete (CoglOnscreen *onscreen, CoglFrameInfo *info); void -_cogl_onscreen_queue_dirty (CoglOnscreen *onscreen, - const CoglOnscreenDirtyInfo *info); +_cogl_onscreen_queue_dirty (CoglOnscreen *onscreen, + const MtkRectangle *info); void cogl_onscreen_bind (CoglOnscreen *onscreen); diff --git a/cogl/cogl/cogl-onscreen-template.c b/cogl/cogl/cogl-onscreen-template.c index 0f25355273f00daf351cc0aabb6d7829068310a2..adb146421c8a4fb2b4c8c852f37d3dfafa42f3ad 100644 --- a/cogl/cogl/cogl-onscreen-template.c +++ b/cogl/cogl/cogl-onscreen-template.c @@ -69,14 +69,6 @@ cogl_onscreen_template_new (void) return onscreen_template; } -void -cogl_onscreen_template_set_samples_per_pixel ( - CoglOnscreenTemplate *onscreen_template, - int samples_per_pixel) -{ - onscreen_template->config.samples_per_pixel = samples_per_pixel; -} - void cogl_onscreen_template_set_stereo_enabled ( CoglOnscreenTemplate *onscreen_template, diff --git a/cogl/cogl/cogl-onscreen-template.h b/cogl/cogl/cogl-onscreen-template.h index baf110ab9839b1a69f88cb1f8a6f5e5a654ef4a0..4edfcb426c687ad5c6999badb1e8939dd61d4288 100644 --- a/cogl/cogl/cogl-onscreen-template.h +++ b/cogl/cogl/cogl-onscreen-template.h @@ -51,25 +51,6 @@ G_DECLARE_FINAL_TYPE (CoglOnscreenTemplate, cogl_onscreen_template, COGL_EXPORT CoglOnscreenTemplate * cogl_onscreen_template_new (void); -/** - * cogl_onscreen_template_set_samples_per_pixel: - * @onscreen_template: A #CoglOnscreenTemplate template framebuffer - * @n: The minimum number of samples per pixel - * - * Requires that any future CoglOnscreen framebuffers derived from - * this template must support making at least @n samples per pixel - * which will all contribute to the final resolved color for that - * pixel. - * - * By default this value is usually set to 0 and that is referred to - * as "single-sample" rendering. A value of 1 or greater is referred - * to as "multisample" rendering. - */ -COGL_EXPORT void -cogl_onscreen_template_set_samples_per_pixel ( - CoglOnscreenTemplate *onscreen_template, - int n); - /** * cogl_onscreen_template_set_stereo_enabled: * @onscreen_template: A #CoglOnscreenTemplate template framebuffer diff --git a/cogl/cogl/cogl-onscreen.c b/cogl/cogl/cogl-onscreen.c index 13bc54493b16fbeb360a9c1b61e36b4cd09b4e13..8786247117a41f29758495b8d2d43a2249833cd0 100644 --- a/cogl/cogl/cogl-onscreen.c +++ b/cogl/cogl/cogl-onscreen.c @@ -231,8 +231,8 @@ _cogl_onscreen_queue_dispatch_idle (CoglOnscreen *onscreen) } void -_cogl_onscreen_queue_dirty (CoglOnscreen *onscreen, - const CoglOnscreenDirtyInfo *info) +_cogl_onscreen_queue_dirty (CoglOnscreen *onscreen, + const MtkRectangle *info) { CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); CoglContext *ctx = cogl_framebuffer_get_context (framebuffer); @@ -249,7 +249,7 @@ void _cogl_onscreen_queue_full_dirty (CoglOnscreen *onscreen) { CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); - CoglOnscreenDirtyInfo info; + MtkRectangle info; info.x = 0; info.y = 0; diff --git a/cogl/cogl/cogl-onscreen.h b/cogl/cogl/cogl-onscreen.h index 5dd131d868fa364a8be02802d5dc57a92869c2d3..e7b71f1902005296dc606ce7debde68ee4a7d0de 100644 --- a/cogl/cogl/cogl-onscreen.h +++ b/cogl/cogl/cogl-onscreen.h @@ -403,25 +403,6 @@ COGL_EXPORT void cogl_onscreen_remove_frame_callback (CoglOnscreen *onscreen, CoglFrameClosure *closure); -/** - * CoglOnscreenDirtyInfo: - * @x: Left edge of the dirty rectangle - * @y: Top edge of the dirty rectangle, measured from the top of the window - * @width: Width of the dirty rectangle - * @height: Height of the dirty rectangle - * - * A structure passed to callbacks registered using - * cogl_onscreen_add_dirty_callback(). The members describe a - * rectangle within the onscreen buffer that should be redrawn. - */ -typedef struct _CoglOnscreenDirtyInfo CoglOnscreenDirtyInfo; - -struct _CoglOnscreenDirtyInfo -{ - int x, y; - int width, height; -}; - /** * cogl_onscreen_get_frame_counter: * diff --git a/cogl/cogl/cogl-pipeline-private.h b/cogl/cogl/cogl-pipeline-private.h index 75428b8f4100be67ba9059c2573b93f5744068de..4b5e94e9113860ab5677c9d4201c6372ead359de 100644 --- a/cogl/cogl/cogl-pipeline-private.h +++ b/cogl/cogl/cogl-pipeline-private.h @@ -618,7 +618,7 @@ _cogl_get_n_args_for_combine_func (CoglPipelineCombineFunc func); * * typedef struct { * CoglPipeline *validated_source; - * } MyValidatedMaterialCache; + * } MyValidatedPipelineCache; * * static void * destroy_cache_cb (CoglObject *object, void *user_data) @@ -629,7 +629,7 @@ _cogl_get_n_args_for_combine_func (CoglPipelineCombineFunc func); * static void * invalidate_cache_cb (CoglPipeline *destroyed, void *user_data) * { - * MyValidatedMaterialCache *cache = user_data; + * MyValidatedPipelineCache *cache = user_data; * g_object_unref (cache->validated_source); * cache->validated_source = NULL; * } @@ -638,12 +638,12 @@ _cogl_get_n_args_for_combine_func (CoglPipelineCombineFunc func); * get_validated_pipeline (CoglPipeline *source) * { * _cogl_my_cache_key = g_quark_from_static_string ("my-cache-key"); - * MyValidatedMaterialCache *cache = + * MyValidatedPipelineCache *cache = * g_object_get_qdata (G_OBJECT (source), * _cogl_my_cache_key); * if (G_UNLIKELY (cache == NULL)) * { - * cache = g_new0 (MyValidatedMaterialCache, 1); + * cache = g_new0 (MyValidatedPipelineCache, 1); * * g_object_set_qdata_full (G_OBJECT (source), * _cogl_my_cache_key, diff --git a/cogl/cogl/cogl-pipeline-state.h b/cogl/cogl/cogl-pipeline-state.h index 0650687f826aec0735a4da4c7e6f1a81ff552243..c6cbb5eba6f213351320b5b87508054190d96978 100644 --- a/cogl/cogl/cogl-pipeline-state.h +++ b/cogl/cogl/cogl-pipeline-state.h @@ -166,13 +166,13 @@ cogl_pipeline_get_alpha_test_reference (CoglPipeline *pipeline); * ``` * * This is the list of source-names usable as blend factors: - * + * * - `SRC_COLOR`: The color of the incoming fragment * - `DST_COLOR`: The color of the framebuffer * - `CONSTANT`: The constant set via cogl_pipeline_set_blend_constant() * * These can also be used as factors: - * + * * - `0`: (0, 0, 0, 0) * - `1`: (1, 1, 1, 1) * - `SRC_ALPHA_SATURATE_FACTOR`: (f,f,f,1) where `f = MIN(SRC_COLOR[A],1-DST_COLOR[A])` @@ -319,13 +319,13 @@ cogl_pipeline_get_user_program (CoglPipeline *pipeline); * CoglProgram *program; * CoglPipeline *pipeline; * - * shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT); + * shader = cogl_shader_new (COGL_SHADER_TYPE_FRAGMENT); * cogl_shader_source (shader, * "!!ARBfp1.0\n" * "MOV result.color,fragment.color;\n" * "END\n"); * - * program = cogl_create_program (); + * program = cogl_program_new (); * cogl_program_attach_shader (program, shader); * cogl_program_link (program); * diff --git a/cogl/cogl/cogl-pixel-buffer.c b/cogl/cogl/cogl-pixel-buffer.c index 39246093340a179b56b5df049fe2b1c00813e09d..660841919d8b5314dbaef6f3ffd7555ccda3fcef 100644 --- a/cogl/cogl/cogl-pixel-buffer.c +++ b/cogl/cogl/cogl-pixel-buffer.c @@ -61,11 +61,10 @@ cogl_pixel_buffer_init (CoglPixelBuffer *buffer) { } -static CoglPixelBuffer * -_cogl_pixel_buffer_new (CoglContext *context, - size_t size, - const void *data, - GError **error) +CoglPixelBuffer * +cogl_pixel_buffer_new (CoglContext *context, + size_t size, + const void *data) { CoglPixelBuffer *pixel_buffer; @@ -78,11 +77,10 @@ _cogl_pixel_buffer_new (CoglContext *context, if (data) { - if (!_cogl_buffer_set_data (COGL_BUFFER (pixel_buffer), - 0, - data, - size, - error)) + if (!cogl_buffer_set_data (COGL_BUFFER (pixel_buffer), + 0, + data, + size)) { g_object_unref (pixel_buffer); return NULL; @@ -91,16 +89,3 @@ _cogl_pixel_buffer_new (CoglContext *context, return pixel_buffer; } - -CoglPixelBuffer * -cogl_pixel_buffer_new (CoglContext *context, - size_t size, - const void *data) -{ - GError *ignore_error = NULL; - CoglPixelBuffer *buffer = - _cogl_pixel_buffer_new (context, size, data, &ignore_error); - - g_clear_error (&ignore_error); - return buffer; -} diff --git a/cogl/cogl/cogl-pixel-format.h b/cogl/cogl/cogl-pixel-format.h index 0f00d66c50893cf2ba4ced7ad922f10c60d50dfc..d9fe538738e067fe29fcf79b949934e32e4f1575 100644 --- a/cogl/cogl/cogl-pixel-format.h +++ b/cogl/cogl/cogl-pixel-format.h @@ -265,7 +265,7 @@ typedef enum /*< prefix=COGL_PIXEL_FORMAT >*/ /** * COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT: - * + * * Architecture dependant format, similar to CAIRO_ARGB32. */ #if G_BYTE_ORDER == G_LITTLE_ENDIAN @@ -324,7 +324,7 @@ gboolean _cogl_pixel_format_is_endian_dependant (CoglPixelFormat format); /* - * COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT(format): + * _cogl_pixel_format_can_have_premult: * @format: a #CoglPixelFormat * * Returns TRUE if the pixel format can take a premult bit. This is @@ -332,8 +332,11 @@ _cogl_pixel_format_is_endian_dependant (CoglPixelFormat format); * COGL_PIXEL_FORMAT_A_8 (because that doesn't have any other * components to multiply by the alpha). */ -#define COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT(format) \ - (((format) & COGL_A_BIT) && (format) != COGL_PIXEL_FORMAT_A_8) +static inline gboolean +_cogl_pixel_format_can_have_premult (CoglPixelFormat format) +{ + return (((format) & COGL_A_BIT) && (format) != COGL_PIXEL_FORMAT_A_8); +} /** * cogl_pixel_format_get_n_planes: diff --git a/cogl/cogl/cogl-point-in-poly.c b/cogl/cogl/cogl-point-in-poly.c index 25ffc2e42919b925248d170df2625f30f1e62d54..7ab8f4dc4bdc280e69624e9a7b88cbaebc738588 100644 --- a/cogl/cogl/cogl-point-in-poly.c +++ b/cogl/cogl/cogl-point-in-poly.c @@ -96,4 +96,3 @@ _cogl_util_point_in_screen_poly (float point_x, return c; } - diff --git a/cogl/cogl/cogl-primitive.c b/cogl/cogl/cogl-primitive.c index 0a35487340021f6163fa18c62d15362297eb1d83..edc266355448d1d359adab09e31b780de4979d53 100644 --- a/cogl/cogl/cogl-primitive.c +++ b/cogl/cogl/cogl-primitive.c @@ -229,36 +229,6 @@ cogl_primitive_new_p2c4 (CoglContext *ctx, 2); } -CoglPrimitive * -cogl_primitive_new_p3c4 (CoglContext *ctx, - CoglVerticesMode mode, - int n_vertices, - const CoglVertexP3C4 *data) -{ - CoglAttributeBuffer *attribute_buffer = - cogl_attribute_buffer_new (ctx, n_vertices * sizeof (CoglVertexP3C4), data); - CoglAttribute *attributes[2]; - - attributes[0] = cogl_attribute_new (attribute_buffer, - "cogl_position_in", - sizeof (CoglVertexP3C4), - offsetof (CoglVertexP3C4, x), - 3, - COGL_ATTRIBUTE_TYPE_FLOAT); - attributes[1] = cogl_attribute_new (attribute_buffer, - "cogl_color_in", - sizeof (CoglVertexP3C4), - offsetof (CoglVertexP3C4, r), - 4, - COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE); - - g_object_unref (attribute_buffer); - - return _cogl_primitive_new_with_attributes_unref (mode, n_vertices, - attributes, - 2); -} - CoglPrimitive * cogl_primitive_new_p2t2 (CoglContext *ctx, CoglVerticesMode mode, @@ -319,88 +289,6 @@ cogl_primitive_new_p3t2 (CoglContext *ctx, 2); } -CoglPrimitive * -cogl_primitive_new_p2t2c4 (CoglContext *ctx, - CoglVerticesMode mode, - int n_vertices, - const CoglVertexP2T2C4 *data) -{ - CoglAttributeBuffer *attribute_buffer = - cogl_attribute_buffer_new (ctx, - n_vertices * sizeof (CoglVertexP2T2C4), data); - CoglAttribute *attributes[3]; - - attributes[0] = cogl_attribute_new (attribute_buffer, - "cogl_position_in", - sizeof (CoglVertexP2T2C4), - offsetof (CoglVertexP2T2C4, x), - 2, - COGL_ATTRIBUTE_TYPE_FLOAT); - attributes[1] = cogl_attribute_new (attribute_buffer, - "cogl_tex_coord0_in", - sizeof (CoglVertexP2T2C4), - offsetof (CoglVertexP2T2C4, s), - 2, - COGL_ATTRIBUTE_TYPE_FLOAT); - attributes[2] = cogl_attribute_new (attribute_buffer, - "cogl_color_in", - sizeof (CoglVertexP2T2C4), - offsetof (CoglVertexP2T2C4, r), - 4, - COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE); - - g_object_unref (attribute_buffer); - - return _cogl_primitive_new_with_attributes_unref (mode, n_vertices, - attributes, - 3); -} - -CoglPrimitive * -cogl_primitive_new_p3t2c4 (CoglContext *ctx, - CoglVerticesMode mode, - int n_vertices, - const CoglVertexP3T2C4 *data) -{ - CoglAttributeBuffer *attribute_buffer = - cogl_attribute_buffer_new (ctx, - n_vertices * sizeof (CoglVertexP3T2C4), data); - CoglAttribute *attributes[3]; - - attributes[0] = cogl_attribute_new (attribute_buffer, - "cogl_position_in", - sizeof (CoglVertexP3T2C4), - offsetof (CoglVertexP3T2C4, x), - 3, - COGL_ATTRIBUTE_TYPE_FLOAT); - attributes[1] = cogl_attribute_new (attribute_buffer, - "cogl_tex_coord0_in", - sizeof (CoglVertexP3T2C4), - offsetof (CoglVertexP3T2C4, s), - 2, - COGL_ATTRIBUTE_TYPE_FLOAT); - attributes[2] = cogl_attribute_new (attribute_buffer, - "cogl_color_in", - sizeof (CoglVertexP3T2C4), - offsetof (CoglVertexP3T2C4, r), - 4, - COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE); - - g_object_unref (attribute_buffer); - - return _cogl_primitive_new_with_attributes_unref (mode, n_vertices, - attributes, - 3); -} - -int -cogl_primitive_get_first_vertex (CoglPrimitive *primitive) -{ - g_return_val_if_fail (COGL_IS_PRIMITIVE (primitive), 0); - - return primitive->first_vertex; -} - void cogl_primitive_set_first_vertex (CoglPrimitive *primitive, int first_vertex) @@ -410,14 +298,6 @@ cogl_primitive_set_first_vertex (CoglPrimitive *primitive, primitive->first_vertex = first_vertex; } -int -cogl_primitive_get_n_vertices (CoglPrimitive *primitive) -{ - g_return_val_if_fail (COGL_IS_PRIMITIVE (primitive), 0); - - return primitive->n_vertices; -} - void cogl_primitive_set_n_vertices (CoglPrimitive *primitive, int n_vertices) @@ -427,23 +307,6 @@ cogl_primitive_set_n_vertices (CoglPrimitive *primitive, primitive->n_vertices = n_vertices; } -CoglVerticesMode -cogl_primitive_get_mode (CoglPrimitive *primitive) -{ - g_return_val_if_fail (COGL_IS_PRIMITIVE (primitive), 0); - - return primitive->mode; -} - -void -cogl_primitive_set_mode (CoglPrimitive *primitive, - CoglVerticesMode mode) -{ - g_return_if_fail (COGL_IS_PRIMITIVE (primitive)); - - primitive->mode = mode; -} - void cogl_primitive_set_indices (CoglPrimitive *primitive, CoglIndices *indices, @@ -459,44 +322,10 @@ cogl_primitive_set_indices (CoglPrimitive *primitive, primitive->n_vertices = n_indices; } -CoglIndices * -cogl_primitive_get_indices (CoglPrimitive *primitive) -{ - return primitive->indices; -} - -CoglPrimitive * -cogl_primitive_copy (CoglPrimitive *primitive) -{ - CoglPrimitive *copy; - - copy = cogl_primitive_new_with_attributes (primitive->mode, - primitive->n_vertices, - (CoglAttribute **)primitive->attributes->pdata, - primitive->n_attributes); - - cogl_primitive_set_indices (copy, primitive->indices, primitive->n_vertices); - cogl_primitive_set_first_vertex (copy, primitive->first_vertex); - - return copy; -} - -void -cogl_primitive_foreach_attribute (CoglPrimitive *primitive, - CoglPrimitiveAttributeCallback callback, - void *user_data) -{ - int i; - for (i = 0; i < primitive->n_attributes; i++) - if (!callback (primitive, primitive->attributes->pdata[i], user_data)) - break; -} - void -_cogl_primitive_draw (CoglPrimitive *primitive, +cogl_primitive_draw (CoglPrimitive *primitive, CoglFramebuffer *framebuffer, - CoglPipeline *pipeline, - CoglDrawFlags flags) + CoglPipeline *pipeline) { if (primitive->indices) _cogl_framebuffer_draw_indexed_attributes (framebuffer, @@ -507,7 +336,7 @@ _cogl_primitive_draw (CoglPrimitive *primitive, primitive->indices, (CoglAttribute **) primitive->attributes->pdata, primitive->n_attributes, - flags); + 0); else _cogl_framebuffer_draw_attributes (framebuffer, pipeline, @@ -516,13 +345,5 @@ _cogl_primitive_draw (CoglPrimitive *primitive, primitive->n_vertices, (CoglAttribute **) primitive->attributes->pdata, primitive->n_attributes, - flags); -} - -void -cogl_primitive_draw (CoglPrimitive *primitive, - CoglFramebuffer *framebuffer, - CoglPipeline *pipeline) -{ - _cogl_primitive_draw (primitive, framebuffer, pipeline, 0 /* flags */); + 0); } diff --git a/cogl/cogl/cogl-primitive.h b/cogl/cogl/cogl-primitive.h index 0de14b28988b97ab32037c050f5266f8719e43fd..7d278d85322884953579c0aef1ac5514a4885c44 100644 --- a/cogl/cogl/cogl-primitive.h +++ b/cogl/cogl/cogl-primitive.h @@ -106,24 +106,6 @@ typedef struct { uint8_t r, g, b, a; } CoglVertexP2C4; -/** - * CoglVertexP3C4: - * @x: The x component of a position attribute - * @y: The y component of a position attribute - * @z: The z component of a position attribute - * @r: The red component of a color attribute - * @b: The green component of a color attribute - * @g: The blue component of a color attribute - * @a: The alpha component of a color attribute - * - * A convenience vertex definition that can be used with - * cogl_primitive_new_p3c4(). - */ -typedef struct { - float x, y, z; - uint8_t r, g, b, a; -} CoglVertexP3C4; - /** * CoglVertexP2T2: * @x: The x component of a position attribute @@ -155,48 +137,6 @@ typedef struct { float s, t; } CoglVertexP3T2; - -/** - * CoglVertexP2T2C4: - * @x: The x component of a position attribute - * @y: The y component of a position attribute - * @s: The s component of a texture coordinate attribute - * @t: The t component of a texture coordinate attribute - * @r: The red component of a color attribute - * @b: The green component of a color attribute - * @g: The blue component of a color attribute - * @a: The alpha component of a color attribute - * - * A convenience vertex definition that can be used with - * cogl_primitive_new_p3t2c4(). - */ -typedef struct { - float x, y; - float s, t; - uint8_t r, g, b, a; -} CoglVertexP2T2C4; - -/** - * CoglVertexP3T2C4: - * @x: The x component of a position attribute - * @y: The y component of a position attribute - * @z: The z component of a position attribute - * @s: The s component of a texture coordinate attribute - * @t: The t component of a texture coordinate attribute - * @r: The red component of a color attribute - * @b: The green component of a color attribute - * @g: The blue component of a color attribute - * @a: The alpha component of a color attribute - * - * A convenience vertex definition that can be used with - * cogl_primitive_new_p3t2c4(). - */ -typedef struct { - float x, y, z; - float s, t; - uint8_t r, g, b, a; -} CoglVertexP3T2C4; - /** * cogl_primitive_new: * @mode: A #CoglVerticesMode defining how to draw the vertices @@ -282,7 +222,7 @@ cogl_primitive_new_with_attributes (CoglVerticesMode mode, * hardware doesn't support non-power of two textures (For example you * are using GLES 1.1) then you will need to make sure your assets are * resized to a power-of-two size (though they don't have to be square) - * + * * * Return value: (transfer full): A newly allocated #CoglPrimitive * with a reference of 1. This can be freed using g_object_unref(). @@ -332,7 +272,7 @@ cogl_primitive_new_p2 (CoglContext *context, * hardware doesn't support non-power of two textures (For example you * are using GLES 1.1) then you will need to make sure your assets are * resized to a power-of-two size (though they don't have to be square) - * + * * * Return value: (transfer full): A newly allocated #CoglPrimitive * with a reference of 1. This can be freed using g_object_unref(). @@ -384,7 +324,7 @@ cogl_primitive_new_p3 (CoglContext *context, * hardware doesn't support non-power of two textures (For example you * are using GLES 1.1) then you will need to make sure your assets are * resized to a power-of-two size (though they don't have to be square) - * + * * * Return value: (transfer full): A newly allocated #CoglPrimitive * with a reference of 1. This can be freed using g_object_unref(). @@ -395,58 +335,6 @@ cogl_primitive_new_p2c4 (CoglContext *context, int n_vertices, const CoglVertexP2C4 *data); -/** - * cogl_primitive_new_p3c4: - * @context: A #CoglContext - * @mode: A #CoglVerticesMode defining how to draw the vertices - * @n_vertices: The number of vertices to read from @data and also - * the number of vertices to read when later drawing. - * @data: (array length=n_vertices) (element-type Cogl.VertexP3C4): An array - * of #CoglVertexP3C4 vertices - * - * Provides a convenient way to describe a primitive, such as a single - * triangle strip or a triangle fan, that will internally allocate the - * necessary #CoglAttributeBuffer storage, describe the position - * and color attributes with `CoglAttribute`s and upload - * your data. - * - * For example to draw a convex polygon with a linear gradient you - * can do: - * ```c - * CoglVertexP3C4 triangle[] = - * { - * { 0, 300, 0, 0xff, 0x00, 0x00, 0xff }, - * { 150, 0, 0, 0x00, 0xff, 0x00, 0xff }, - * { 300, 300, 0, 0xff, 0x00, 0x00, 0xff } - * }; - * prim = cogl_primitive_new_p3c4 (COGL_VERTICES_MODE_TRIANGLE_FAN, - * 3, triangle); - * cogl_primitive_draw (prim); - * ``` - * - * The value passed as @n_vertices is initially used to determine how - * much can be read from @data but it will also be used to update the - * #CoglPrimitive `n_vertices` property as if - * cogl_primitive_set_n_vertices() were called. This property defines - * the number of vertices to read when drawing. - - * The primitive API doesn't support drawing with sliced - * textures (since switching between slices implies changing state and - * so that implies multiple primitives need to be submitted). If your - * hardware doesn't support non-power of two textures (For example you - * are using GLES 1.1) then you will need to make sure your assets are - * resized to a power-of-two size (though they don't have to be square) - * - * - * Return value: (transfer full): A newly allocated #CoglPrimitive - * with a reference of 1. This can be freed using g_object_unref(). - */ -COGL_EXPORT CoglPrimitive * -cogl_primitive_new_p3c4 (CoglContext *context, - CoglVerticesMode mode, - int n_vertices, - const CoglVertexP3C4 *data); - /** * cogl_primitive_new_p2t2: * @context: A #CoglContext @@ -488,7 +376,7 @@ cogl_primitive_new_p3c4 (CoglContext *context, * hardware doesn't support non-power of two textures (For example you * are using GLES 1.1) then you will need to make sure your assets are * resized to a power-of-two size (though they don't have to be square) - * + * * * Return value: (transfer full): A newly allocated #CoglPrimitive * with a reference of 1. This can be freed using g_object_unref(). @@ -540,7 +428,7 @@ cogl_primitive_new_p2t2 (CoglContext *context, * hardware doesn't support non-power of two textures (For example you * are using GLES 1.1) then you will need to make sure your assets are * resized to a power-of-two size (though they don't have to be square) - * + * * * Return value: (transfer full): A newly allocated #CoglPrimitive * with a reference of 1. This can be freed using g_object_unref(). @@ -551,138 +439,10 @@ cogl_primitive_new_p3t2 (CoglContext *context, int n_vertices, const CoglVertexP3T2 *data); -/** - * cogl_primitive_new_p2t2c4: - * @context: A #CoglContext - * @mode: A #CoglVerticesMode defining how to draw the vertices - * @n_vertices: The number of vertices to read from @data and also - * the number of vertices to read when later drawing. - * @data: (array length=n_vertices) (element-type Cogl.VertexP2T2C4): An - * array of #CoglVertexP2T2C4 vertices - * - * Provides a convenient way to describe a primitive, such as a single - * triangle strip or a triangle fan, that will internally allocate the - * necessary #CoglAttributeBuffer storage, describe the position, texture - * coordinate and color attributes with `CoglAttribute`s and - * upload your data. - * - * For example to draw a convex polygon with texture mapping and a - * linear gradient you can do: - * ```c - * CoglVertexP2T2C4 triangle[] = - * { - * { 0, 300, 0.0, 1.0, 0xff, 0x00, 0x00, 0xff}, - * { 150, 0, 0.5, 0.0, 0x00, 0xff, 0x00, 0xff}, - * { 300, 300, 1.0, 1.0, 0xff, 0x00, 0x00, 0xff} - * }; - * prim = cogl_primitive_new_p2t2c4 (COGL_VERTICES_MODE_TRIANGLE_FAN, - * 3, triangle); - * cogl_primitive_draw (prim); - * ``` - * - * The value passed as @n_vertices is initially used to determine how - * much can be read from @data but it will also be used to update the - * #CoglPrimitive `n_vertices` property as if - * cogl_primitive_set_n_vertices() were called. This property defines - * the number of vertices to read when drawing. - - * The primitive API doesn't support drawing with sliced - * textures (since switching between slices implies changing state and - * so that implies multiple primitives need to be submitted). If your - * hardware doesn't support non-power of two textures (For example you - * are using GLES 1.1) then you will need to make sure your assets are - * resized to a power-of-two size (though they don't have to be square) - * - * - * Return value: (transfer full): A newly allocated #CoglPrimitive - * with a reference of 1. This can be freed using g_object_unref(). - */ -COGL_EXPORT CoglPrimitive * -cogl_primitive_new_p2t2c4 (CoglContext *context, - CoglVerticesMode mode, - int n_vertices, - const CoglVertexP2T2C4 *data); - -/** - * cogl_primitive_new_p3t2c4: - * @context: A #CoglContext - * @mode: A #CoglVerticesMode defining how to draw the vertices - * @n_vertices: The number of vertices to read from @data and also - * the number of vertices to read when later drawing. - * @data: (array length=n_vertices) (element-type Cogl.VertexP3T2C4): An - * array of #CoglVertexP3T2C4 vertices - * - * Provides a convenient way to describe a primitive, such as a single - * triangle strip or a triangle fan, that will internally allocate the - * necessary #CoglAttributeBuffer storage, describe the position, texture - * coordinate and color attributes with `CoglAttribute`s and - * upload your data. - * - * For example to draw a convex polygon with texture mapping and a - * linear gradient you can do: - * ```c - * CoglVertexP3T2C4 triangle[] = - * { - * { 0, 300, 0, 0.0, 1.0, 0xff, 0x00, 0x00, 0xff}, - * { 150, 0, 0, 0.5, 0.0, 0x00, 0xff, 0x00, 0xff}, - * { 300, 300, 0, 1.0, 1.0, 0xff, 0x00, 0x00, 0xff} - * }; - * prim = cogl_primitive_new_p3t2c4 (COGL_VERTICES_MODE_TRIANGLE_FAN, - * 3, triangle); - * cogl_primitive_draw (prim); - * ``` - * - * The value passed as @n_vertices is initially used to determine how - * much can be read from @data but it will also be used to update the - * #CoglPrimitive `n_vertices` property as if - * cogl_primitive_set_n_vertices() were called. This property defines - * the number of vertices to read when drawing. - - * The primitive API doesn't support drawing with sliced - * textures (since switching between slices implies changing state and - * so that implies multiple primitives need to be submitted). If your - * hardware doesn't support non-power of two textures (For example you - * are using GLES 1.1) then you will need to make sure your assets are - * resized to a power-of-two size (though they don't have to be square) - * - * - * Return value: (transfer full): A newly allocated #CoglPrimitive - * with a reference of 1. This can be freed using g_object_unref(). - */ -COGL_EXPORT CoglPrimitive * -cogl_primitive_new_p3t2c4 (CoglContext *context, - CoglVerticesMode mode, - int n_vertices, - const CoglVertexP3T2C4 *data); -COGL_EXPORT int -cogl_primitive_get_first_vertex (CoglPrimitive *primitive); - COGL_EXPORT void cogl_primitive_set_first_vertex (CoglPrimitive *primitive, int first_vertex); -/** - * cogl_primitive_get_n_vertices: - * @primitive: A #CoglPrimitive object - * - * Queries the number of vertices to read when drawing the given - * @primitive. Usually this value is implicitly set when associating - * vertex data or indices with a #CoglPrimitive. - * - * If cogl_primitive_set_indices() has been used to associate a - * sequence of #CoglIndices with the given @primitive then the - * number of vertices to read can also be phrased as the number - * of indices to read. - * - * To be clear; it doesn't refer to the number of vertices - in - * terms of data - associated with the primitive it's just the number - * of vertices to read and draw. - * - * Returns: The number of vertices to read when drawing. - */ -COGL_EXPORT int -cogl_primitive_get_n_vertices (CoglPrimitive *primitive); - /** * cogl_primitive_set_n_vertices: * @primitive: A #CoglPrimitive object @@ -702,12 +462,6 @@ COGL_EXPORT void cogl_primitive_set_n_vertices (CoglPrimitive *primitive, int n_vertices); -COGL_EXPORT CoglVerticesMode -cogl_primitive_get_mode (CoglPrimitive *primitive); - -COGL_EXPORT void -cogl_primitive_set_mode (CoglPrimitive *primitive, - CoglVerticesMode mode); /** * cogl_primitive_set_indices: @@ -739,60 +493,6 @@ cogl_primitive_set_indices (CoglPrimitive *primitive, CoglIndices *indices, int n_indices); -/** - * cogl_primitive_get_indices: - * @primitive: A #CoglPrimitive - * - * Return value: (transfer none) (nullable) (array): the indices that were set - * with cogl_primitive_set_indices() or %NULL if no indices were set. - */ -COGL_EXPORT CoglIndices * -cogl_primitive_get_indices (CoglPrimitive *primitive); - -/** - * cogl_primitive_copy: - * @primitive: A primitive copy - * - * Makes a copy of an existing #CoglPrimitive. Note that the primitive - * is a shallow copy which means it will use the same attributes and - * attribute buffers as the original primitive. - * - * Return value: (transfer full): the new primitive - */ -COGL_EXPORT CoglPrimitive * -cogl_primitive_copy (CoglPrimitive *primitive); - -/** - * CoglPrimitiveAttributeCallback: - * @primitive: The #CoglPrimitive whose attributes are being iterated - * @attribute: The #CoglAttribute - * @user_data: The private data passed to cogl_primitive_foreach_attribute() - * - * The callback prototype used with cogl_primitive_foreach_attribute() - * for iterating all the attributes of a #CoglPrimitive. - * - * The function should return TRUE to continue iteration or FALSE to - * stop. - */ -typedef gboolean (* CoglPrimitiveAttributeCallback) (CoglPrimitive *primitive, - CoglAttribute *attribute, - void *user_data); - -/** - * cogl_primitive_foreach_attribute: - * @primitive: A #CoglPrimitive object - * @callback: (scope call): A #CoglPrimitiveAttributeCallback to be - * called for each attribute - * @user_data: (closure): Private data that will be passed to the - * callback - * - * Iterates all the attributes of the given #CoglPrimitive. - */ -COGL_EXPORT void -cogl_primitive_foreach_attribute (CoglPrimitive *primitive, - CoglPrimitiveAttributeCallback callback, - void *user_data); - /** * cogl_primitive_draw: * @primitive: A #CoglPrimitive geometry object diff --git a/cogl/cogl/cogl-primitives.c b/cogl/cogl/cogl-primitives.c index 214d03416bba6ea1e06205e9f290541ecd762e8e..b72159bf7609d0ca1e6b192ae7f7133252b0817e 100644 --- a/cogl/cogl/cogl-primitives.c +++ b/cogl/cogl/cogl-primitives.c @@ -344,7 +344,7 @@ validate_tex_coords_cb (CoglPipeline *pipeline, { static gboolean warning_seen = FALSE; if (!warning_seen) - g_warning ("Skipping layers 1..n of your material since " + g_warning ("Skipping layers 1..n of your pipeline since " "the first layer doesn't support hardware " "repeat (e.g. because of waste or use of " "GL_TEXTURE_RECTANGLE_ARB) and you supplied " @@ -363,7 +363,7 @@ validate_tex_coords_cb (CoglPipeline *pipeline, { static gboolean warning_seen = FALSE; if (!warning_seen) - g_warning ("Skipping layer %d of your material " + g_warning ("Skipping layer %d of your pipeline " "since you have supplied texture coords " "outside the range [0,1] but the texture " "doesn't support hardware repeat (e.g. " diff --git a/cogl/cogl/cogl-renderer-private.h b/cogl/cogl/cogl-renderer-private.h index e64931f54199163ad94f6de99878bad56e46c664..8f8aa8ec14e546dfe384e14782a6f8ae6204de82 100644 --- a/cogl/cogl/cogl-renderer-private.h +++ b/cogl/cogl/cogl-renderer-private.h @@ -73,10 +73,6 @@ struct _CoglRenderer typedef CoglFilterReturn (* CoglNativeFilterFunc) (void *native_event, void *data); -CoglFilterReturn -_cogl_renderer_handle_native_event (CoglRenderer *renderer, - void *event); - void _cogl_renderer_add_native_filter (CoglRenderer *renderer, CoglNativeFilterFunc func, diff --git a/cogl/cogl/cogl-renderer.c b/cogl/cogl/cogl-renderer.c index af0f71223f2c6f3bd8350f5eb967e461adba23e1..7feab4b2052131fc076983688268d63dd50b551c 100644 --- a/cogl/cogl/cogl-renderer.c +++ b/cogl/cogl/cogl-renderer.c @@ -521,8 +521,8 @@ cogl_renderer_connect (CoglRenderer *renderer, GError **error) } CoglFilterReturn -_cogl_renderer_handle_native_event (CoglRenderer *renderer, - void *event) +cogl_renderer_handle_event (CoglRenderer *renderer, + void *event) { GSList *l, *next; diff --git a/cogl/cogl/cogl-renderer.h b/cogl/cogl/cogl-renderer.h index 657b73ec00adf6fc7fdb73a2d56f9421b2aa169f..369011abc59e52931a4fbe069320c4eb5e8cf136 100644 --- a/cogl/cogl/cogl-renderer.h +++ b/cogl/cogl/cogl-renderer.h @@ -191,32 +191,6 @@ cogl_renderer_check_onscreen_template (CoglRenderer *renderer, COGL_EXPORT gboolean cogl_renderer_connect (CoglRenderer *renderer, GError **error); -/** - * CoglRendererConstraint: - * @COGL_RENDERER_CONSTRAINT_USES_X11: Require the renderer to be X11 based - * @COGL_RENDERER_CONSTRAINT_USES_XLIB: Require the renderer to be X11 - * based and use Xlib - * @COGL_RENDERER_CONSTRAINT_USES_EGL: Require the renderer to be EGL based - * - * These constraint flags are hard-coded features of the different renderer - * backends. Sometimes a platform may support multiple rendering options which - * Cogl will usually choose from automatically. Some of these features are - * important to higher level applications and frameworks though, such as - * whether a renderer is X11 based because an application might only support - * X11 based input handling. An application might also need to ensure EGL is - * used internally too if they depend on access to an EGLDisplay for some - * purpose. - * - * Applications should ideally minimize how many of these constraints - * they depend on to ensure maximum portability. - */ -typedef enum -{ - COGL_RENDERER_CONSTRAINT_USES_X11 = (1 << 0), - COGL_RENDERER_CONSTRAINT_USES_XLIB = (1 << 1), - COGL_RENDERER_CONSTRAINT_USES_EGL = (1 << 2), -} CoglRendererConstraint; - /** * CoglDriver: * @COGL_DRIVER_ANY: Implies no preference for which driver is used @@ -331,4 +305,21 @@ COGL_EXPORT void * cogl_renderer_get_proc_address (CoglRenderer *renderer, const char *name); +/** + * cogl_renderer_handle_event: (skip) + * @renderer: a #CoglRenderer + * @event: pointer to an event structure + * + * Processes a single event. + * + * Return value: #CoglFilterReturn. %COGL_FILTER_REMOVE indicates that + * Cogl has internally handled the event and the caller should do no + * further processing. %COGL_FILTER_CONTINUE indicates that Cogl is + * either not interested in the event, or has used the event to update + * internal state without taking any exclusive action. + */ +COGL_EXPORT CoglFilterReturn +cogl_renderer_handle_event (CoglRenderer *renderer, + void *event); + G_END_DECLS diff --git a/cogl/cogl/cogl-soft-float.h b/cogl/cogl/cogl-soft-float.h index a222e09773ec17f62284d83ea2ebfcfe60c0b128..761d5fb207bdb5e695452aeac0263b978f316891 100644 --- a/cogl/cogl/cogl-soft-float.h +++ b/cogl/cogl/cogl-soft-float.h @@ -40,8 +40,7 @@ * from the Berkeley SoftFloat 3e Library. */ -#ifndef COGL_SOFT_FLOAT_H -#define COGL_SOFT_FLOAT_H + #pragma once #include #include @@ -67,5 +66,3 @@ float cogl_double_to_f32 (double x, gboolean rtz); uint16_t cogl_float_to_half_rtz_slow (float x); - -#endif /* COGL_SOFT_FLOAT_H */ diff --git a/cogl/cogl/cogl-texture-2d.c b/cogl/cogl/cogl-texture-2d.c index b58e9da39b715ff9230d99547219e7d1446c9fc1..d08e53a2dc2230a0f6eac37dfd097cfbb878dd35 100644 --- a/cogl/cogl/cogl-texture-2d.c +++ b/cogl/cogl/cogl-texture-2d.c @@ -455,7 +455,7 @@ cogl_texture_2d_new_from_data (CoglContext *ctx, * even though they may seem redundant is because GLES 1/2 don't * provide a way to query these properties. */ CoglTexture * -cogl_egl_texture_2d_new_from_image (CoglContext *ctx, +cogl_texture_2d_new_from_egl_image (CoglContext *ctx, int width, int height, CoglPixelFormat format, diff --git a/cogl/cogl/cogl-texture-2d.h b/cogl/cogl/cogl-texture-2d.h index 552df0982c5da89a51fa0590bf13aa7e91e619e8..a276037cb3d1761ceae50816f0b94175f9ede911 100644 --- a/cogl/cogl/cogl-texture-2d.h +++ b/cogl/cogl/cogl-texture-2d.h @@ -39,10 +39,6 @@ #include "cogl/cogl-context.h" #include "cogl/cogl-bitmap.h" -#ifdef HAVE_EGL -#include "cogl/cogl-egl.h" -#endif - G_BEGIN_DECLS /** @@ -101,8 +97,6 @@ typedef enum _CoglEglImageFlags * cogl_texture_set_premultiplied(). * * Returns: (transfer full): A new #CoglTexture2D object with no storage yet allocated. - * - * Since: 2.0 */ COGL_EXPORT CoglTexture * cogl_texture_2d_new_with_format (CoglContext *ctx, @@ -200,15 +194,21 @@ cogl_texture_2d_new_from_data (CoglContext *ctx, COGL_EXPORT CoglTexture * cogl_texture_2d_new_from_bitmap (CoglBitmap *bitmap); -/** - * cogl_egl_texture_2d_new_from_image: (skip) - */ +#ifdef HAVE_EGL +typedef gboolean (*CoglTexture2DEGLImageExternalAlloc) (CoglTexture2D *tex_2d, + gpointer user_data, + GError **error); +#endif + #if defined (HAVE_EGL) && defined (EGL_KHR_image_base) /* NB: The reason we require the width, height and format to be passed * even though they may seem redundant is because GLES 1/2 don't * provide a way to query these properties. */ +/** + * cogl_texture_2d_new_from_egl_image: (skip) + */ COGL_EXPORT CoglTexture * -cogl_egl_texture_2d_new_from_image (CoglContext *ctx, +cogl_texture_2d_new_from_egl_image (CoglContext *ctx, int width, int height, CoglPixelFormat format, @@ -216,10 +216,6 @@ cogl_egl_texture_2d_new_from_image (CoglContext *ctx, CoglEglImageFlags flags, GError **error); -typedef gboolean (*CoglTexture2DEGLImageExternalAlloc) (CoglTexture2D *tex_2d, - gpointer user_data, - GError **error); - /** * cogl_texture_2d_new_from_egl_image_external: (skip) */ diff --git a/cogl/cogl/cogl-texture-private.h b/cogl/cogl/cogl-texture-private.h index 432021c98c363518ffd733cdc4056aefb1dda9e9..410f692db6073a97173088c76e57b63fb6bdd730 100644 --- a/cogl/cogl/cogl-texture-private.h +++ b/cogl/cogl/cogl-texture-private.h @@ -37,9 +37,6 @@ #include "cogl/cogl-framebuffer.h" #include "cogl/cogl-texture-2d.h" -#ifdef HAVE_EGL -#include "cogl/cogl-egl.h" -#endif /* Encodes three possibiloities result of transforming a quad */ typedef enum diff --git a/cogl/cogl/cogl-texture.c b/cogl/cogl/cogl-texture.c index b03f90cd66b861b52c621901ec490ab85d773881..2bc7746560c3e39a7b4e59ce0aa86a5fe70f032e 100644 --- a/cogl/cogl/cogl-texture.c +++ b/cogl/cogl/cogl-texture.c @@ -264,6 +264,12 @@ cogl_texture_get_format (CoglTexture *texture) return COGL_TEXTURE_GET_CLASS (texture)->get_format (texture); } +static inline unsigned int +_cogl_util_fls (unsigned int n) +{ + return n == 0 ? 0 : sizeof (unsigned int) * 8 - __builtin_clz (n); +} + int _cogl_texture_get_n_levels (CoglTexture *texture) { @@ -802,7 +808,7 @@ cogl_texture_get_data (CoglTexture *texture, /* We can assume that whatever data GL gives us will have the premult status of the original texture */ - if (COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT (closest_format)) + if (_cogl_pixel_format_can_have_premult (closest_format)) closest_format = ((closest_format & ~COGL_PREMULT_BIT) | (texture_format & COGL_PREMULT_BIT)); @@ -1196,7 +1202,7 @@ _cogl_texture_determine_internal_format (CoglTexture *texture, if (cogl_texture_get_premultiplied (texture)) { - if (COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT (format)) + if (_cogl_pixel_format_can_have_premult (format)) return format |= COGL_PREMULT_BIT; else return COGL_PIXEL_FORMAT_RGBA_8888_PRE; diff --git a/cogl/cogl/cogl-types.h b/cogl/cogl/cogl-types.h index 9f090fe272d8ef380e98c3e83f67396bf0c2377d..7933862c5127a054ed64ae21e1130a36dfe9280d 100644 --- a/cogl/cogl/cogl-types.h +++ b/cogl/cogl/cogl-types.h @@ -67,34 +67,6 @@ typedef struct _CoglFramebuffer CoglFramebuffer; */ typedef struct _CoglDmaBufHandle CoglDmaBufHandle; -/** - * COGL_BLEND_STRING_ERROR: - * - * #GError domain for blend string parser errors - */ -#define COGL_BLEND_STRING_ERROR (cogl_blend_string_error_quark ()) - -/** - * CoglBlendStringError: - * @COGL_BLEND_STRING_ERROR_PARSE_ERROR: Generic parse error - * @COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR: Argument parse error - * @COGL_BLEND_STRING_ERROR_INVALID_ERROR: Internal parser error - * @COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR: Blend string not - * supported by the GPU - * - * Error enumeration for the blend strings parser - */ -typedef enum /*< prefix=COGL_BLEND_STRING_ERROR >*/ -{ - COGL_BLEND_STRING_ERROR_PARSE_ERROR, - COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR, - COGL_BLEND_STRING_ERROR_INVALID_ERROR, - COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR -} CoglBlendStringError; - -COGL_EXPORT uint32_t -cogl_blend_string_error_quark (void); - #define COGL_SYSTEM_ERROR (_cogl_system_error_quark ()) /** @@ -198,9 +170,9 @@ typedef enum /* NB: The above definitions are taken from gl.h equivalents */ -/* XXX: should this be CoglMaterialDepthTestFunction? +/* XXX: should this be CoglPipelineDepthTestFunction? * It makes it very verbose but would be consistent with - * CoglMaterialWrapMode */ + * CoglPipelineWrapMode */ /** * CoglDepthTestFunction: diff --git a/cogl/cogl/cogl-util.c b/cogl/cogl/cogl-util.c deleted file mode 100644 index 4dffa822d95aa20044faffaac9e002b6070ad1f4..0000000000000000000000000000000000000000 --- a/cogl/cogl/cogl-util.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2007,2008,2009,2010 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * - */ - -#include "config.h" - -#include - -#include "cogl/cogl-util.h" -#include "cogl/cogl-private.h" - -unsigned int -_cogl_util_one_at_a_time_mix (unsigned int hash) -{ - hash += ( hash << 3 ); - hash ^= ( hash >> 11 ); - hash += ( hash << 15 ); - - return hash; -} - -/* Given a set of red, green and blue component masks, a depth and - * bits per pixel this function tries to determine a corresponding - * CoglPixelFormat. - * - * The depth is measured in bits not including padding for un-used - * alpha. The bits per pixel (bpp) does include padding for un-used - * alpha. - * - * This function firstly aims to match formats with RGB ordered - * components and only considers alpha coming first, in the most - * significant bits. If the function fails to match then it recurses - * by either switching the r and b masks around to check for BGR - * ordered formats or it recurses with the masks shifted to check for - * formats where the alpha component is the least significant bits. - */ -static CoglPixelFormat -_cogl_util_pixel_format_from_masks_real (unsigned long r_mask, - unsigned long g_mask, - unsigned long b_mask, - int depth, int bpp, - gboolean check_bgr, - gboolean check_afirst, - int recursion_depth) -{ - CoglPixelFormat image_format; - - if (depth == 24 && bpp == 24 && - r_mask == 0xff0000 && g_mask == 0xff00 && b_mask == 0xff) - { - return COGL_PIXEL_FORMAT_RGB_888; - } - else if ((depth == 24 || depth == 32) && bpp == 32 && - r_mask == 0xff0000 && g_mask == 0xff00 && b_mask == 0xff) - { - return COGL_PIXEL_FORMAT_ARGB_8888_PRE; - } - else if ((depth == 30 || depth == 32) && - r_mask == 0x3ff00000 && g_mask == 0xffc00 && b_mask == 0x3ff) - { - return COGL_PIXEL_FORMAT_ARGB_2101010_PRE; - } - else if (depth == 16 && bpp == 16 && - r_mask == 0xf800 && g_mask == 0x7e0 && b_mask == 0x1f) - { - return COGL_PIXEL_FORMAT_RGB_565; - } - - if (recursion_depth == 2) - return 0; - - /* Check for BGR ordering if we didn't find a match */ - if (check_bgr) - { - image_format = - _cogl_util_pixel_format_from_masks_real (b_mask, g_mask, r_mask, - depth, bpp, - FALSE, - TRUE, - recursion_depth + 1); - if (image_format) - return image_format ^ COGL_BGR_BIT; - } - - /* Check for alpha in the least significant bits if we still - * haven't found a match... */ - if (check_afirst && depth != bpp) - { - int shift = bpp - depth; - - image_format = - _cogl_util_pixel_format_from_masks_real (r_mask >> shift, - g_mask >> shift, - b_mask >> shift, - depth, bpp, - TRUE, - FALSE, - recursion_depth + 1); - if (image_format) - return image_format ^ COGL_AFIRST_BIT; - } - - return 0; -} - -CoglPixelFormat -_cogl_util_pixel_format_from_masks (unsigned long r_mask, - unsigned long g_mask, - unsigned long b_mask, - int depth, int bpp, - gboolean byte_order_is_lsb_first) -{ - CoglPixelFormat image_format = - _cogl_util_pixel_format_from_masks_real (r_mask, g_mask, b_mask, - depth, bpp, - TRUE, - TRUE, - 0); - - if (!image_format) - { - const char *byte_order[] = { "MSB first", "LSB first" }; - g_warning ("Could not find a matching pixel format for red mask=0x%lx," - "green mask=0x%lx, blue mask=0x%lx at depth=%d, bpp=%d " - "and byte order=%s\n", r_mask, g_mask, b_mask, depth, bpp, - byte_order[!!byte_order_is_lsb_first]); - return 0; - } - - /* If the image is in little-endian then the order in memory is - reversed */ - if (byte_order_is_lsb_first && - _cogl_pixel_format_is_endian_dependant (image_format)) - { - image_format ^= COGL_BGR_BIT; - if (image_format & COGL_A_BIT) - image_format ^= COGL_AFIRST_BIT; - } - - return image_format; -} diff --git a/cogl/cogl/cogl-util.h b/cogl/cogl/cogl-util.h index a32ce311a17b98beb9d4e1c0038de664d20c254b..040c78afa011302d2549c584619255303b6b756a 100644 --- a/cogl/cogl/cogl-util.h +++ b/cogl/cogl/cogl-util.h @@ -71,46 +71,12 @@ _cogl_util_one_at_a_time_hash (unsigned int hash, return hash; } -unsigned int -_cogl_util_one_at_a_time_mix (unsigned int hash); - - -#define _cogl_util_ffsl __builtin_ffsl - static inline unsigned int -_cogl_util_fls (unsigned int n) +_cogl_util_one_at_a_time_mix (unsigned int hash) { - return n == 0 ? 0 : sizeof (unsigned int) * 8 - __builtin_clz (n); -} - -#define _cogl_util_popcountl __builtin_popcountl + hash += ( hash << 3 ); + hash ^= ( hash >> 11 ); + hash += ( hash << 15 ); -/* Match a CoglPixelFormat according to channel masks, color depth, - * bits per pixel and byte order. These information are provided by - * the Visual and XImage structures. - * - * If no specific pixel format could be found, COGL_PIXEL_FORMAT_ANY - * is returned. - */ -CoglPixelFormat -_cogl_util_pixel_format_from_masks (unsigned long r_mask, - unsigned long g_mask, - unsigned long b_mask, - int depth, int bpp, - int byte_order); - -static inline void -_cogl_util_scissor_intersect (int rect_x0, - int rect_y0, - int rect_x1, - int rect_y1, - int *scissor_x0, - int *scissor_y0, - int *scissor_x1, - int *scissor_y1) -{ - *scissor_x0 = MAX (*scissor_x0, rect_x0); - *scissor_y0 = MAX (*scissor_y0, rect_y0); - *scissor_x1 = MIN (*scissor_x1, rect_x1); - *scissor_y1 = MIN (*scissor_y1, rect_y1); + return hash; } diff --git a/cogl/cogl/cogl-x11-renderer-private.h b/cogl/cogl/cogl-x11-renderer-private.h deleted file mode 100644 index 5a0559580afea0922490b8b28f064bea3b1cd3a8..0000000000000000000000000000000000000000 --- a/cogl/cogl/cogl-x11-renderer-private.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2011 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * - */ - -#pragma once - -typedef struct _CoglX11Renderer -{ - int damage_base; - int randr_base; -} CoglX11Renderer; diff --git a/cogl/cogl/cogl-xlib-renderer-private.h b/cogl/cogl/cogl-xlib-renderer-private.h index b6c5a531573d714f716b2950cbb79aaf06f194fc..bc79b558ed030e2bacd5671c3f984e2ce0748e80 100644 --- a/cogl/cogl/cogl-xlib-renderer-private.h +++ b/cogl/cogl/cogl-xlib-renderer-private.h @@ -33,7 +33,6 @@ #include #include -#include "cogl/cogl-x11-renderer-private.h" #include "cogl/cogl-context.h" typedef struct _CoglXlibOutput @@ -49,6 +48,12 @@ typedef struct _CoglXlibOutput SubpixelOrder subpixel_order; } CoglXlibOutput; +typedef struct _CoglX11Renderer +{ + int damage_base; + int randr_base; +} CoglX11Renderer; + typedef struct _CoglXlibRenderer { CoglX11Renderer _parent; diff --git a/cogl/cogl/cogl-xlib-renderer.c b/cogl/cogl/cogl-xlib-renderer.c index d84f09ea49d97e67007694449df10cfea1da5bbc..ba76a79c4c532a4d27eaecb1a1ab3b57b71dd1fa 100644 --- a/cogl/cogl/cogl-xlib-renderer.c +++ b/cogl/cogl/cogl-xlib-renderer.c @@ -36,7 +36,6 @@ #include "cogl/cogl-renderer-private.h" #include "cogl/cogl-xlib-renderer-private.h" -#include "cogl/cogl-x11-renderer-private.h" #include "cogl/winsys/cogl-winsys-private.h" #include "mtk/mtk-x11.h" @@ -430,9 +429,9 @@ _cogl_xlib_renderer_connect (CoglRenderer *renderer, GError **error) register_xlib_renderer (renderer); - cogl_xlib_renderer_add_filter (renderer, - randr_filter, - renderer); + _cogl_renderer_add_native_filter (renderer, + (CoglNativeFilterFunc)randr_filter, + renderer); return TRUE; } @@ -466,31 +465,6 @@ cogl_xlib_renderer_get_display (CoglRenderer *renderer) return xlib_renderer->xdpy; } -CoglFilterReturn -cogl_xlib_renderer_handle_event (CoglRenderer *renderer, - XEvent *event) -{ - return _cogl_renderer_handle_native_event (renderer, event); -} - -void -cogl_xlib_renderer_add_filter (CoglRenderer *renderer, - CoglXlibFilterFunc func, - void *data) -{ - _cogl_renderer_add_native_filter (renderer, - (CoglNativeFilterFunc)func, data); -} - -void -cogl_xlib_renderer_remove_filter (CoglRenderer *renderer, - CoglXlibFilterFunc func, - void *data) -{ - _cogl_renderer_remove_native_filter (renderer, - (CoglNativeFilterFunc)func, data); -} - float _cogl_xlib_renderer_refresh_rate_for_rectangle (CoglRenderer *renderer, int x, diff --git a/cogl/cogl/cogl-xlib-renderer.h b/cogl/cogl/cogl-xlib-renderer.h index 5cbc0b36b85cf3998682420531d76237878e6917..7c5944c5d2196536e831915cc31af50f55690136 100644 --- a/cogl/cogl/cogl-xlib-renderer.h +++ b/cogl/cogl/cogl-xlib-renderer.h @@ -35,67 +35,6 @@ G_BEGIN_DECLS -/** - * cogl_xlib_renderer_handle_event: (skip) - * @renderer: a #CoglRenderer - * @event: pointer to an XEvent structure - * - * This function processes a single event; it can be used to hook into - * external event retrieval (for example that done by Clutter or - * GDK). - * - * Return value: #CoglFilterReturn. %COGL_FILTER_REMOVE indicates that - * Cogl has internally handled the event and the caller should do no - * further processing. %COGL_FILTER_CONTINUE indicates that Cogl is - * either not interested in the event, or has used the event to update - * internal state without taking any exclusive action. - */ -COGL_EXPORT CoglFilterReturn -cogl_xlib_renderer_handle_event (CoglRenderer *renderer, - XEvent *event); - -/* - * CoglXlibFilterFunc: - * @event: pointer to an XEvent structure - * @data: the data that was given when the filter was added - * - * A callback function that can be registered with - * cogl_xlib_renderer_add_filter(). The function should return - * %COGL_FILTER_REMOVE if it wants to prevent further processing or - * %COGL_FILTER_CONTINUE otherwise. - */ -typedef CoglFilterReturn (* CoglXlibFilterFunc) (XEvent *event, - void *data); - -/** - * cogl_xlib_renderer_add_filter: (skip) - * @renderer: a #CoglRenderer - * @func: the callback function - * @data: user data passed to @func when called - * - * Adds a callback function that will receive all native events. The - * function can stop further processing of the event by return - * %COGL_FILTER_REMOVE. - */ -COGL_EXPORT void -cogl_xlib_renderer_add_filter (CoglRenderer *renderer, - CoglXlibFilterFunc func, - void *data); - -/** - * cogl_xlib_renderer_remove_filter: (skip) - * @renderer: a #CoglRenderer - * @func: the callback function - * @data: user data given when the callback was installed - * - * Removes a callback that was previously added with - * cogl_xlib_renderer_add_filter(). - */ -COGL_EXPORT void -cogl_xlib_renderer_remove_filter (CoglRenderer *renderer, - CoglXlibFilterFunc func, - void *data); - /** * cogl_xlib_renderer_set_foreign_display: (skip) * @renderer: a #CoglRenderer @@ -105,7 +44,7 @@ cogl_xlib_renderer_remove_filter (CoglRenderer *renderer, * * Note that calling this function will automatically disable Cogl's * event retrieval. Cogl still needs to see all of the X events so the - * application should also use cogl_xlib_renderer_handle_event() if it + * application should also use cogl_renderer_handle_event() if it * uses this function. */ COGL_EXPORT void diff --git a/cogl/cogl/cogl.c b/cogl/cogl/cogl.c index ffe0251a271047c702ae79a9e7e63dba1e17798a..b6cfe0ec54245e83c586469b1810006a0ff4ecc0 100644 --- a/cogl/cogl/cogl.c +++ b/cogl/cogl/cogl.c @@ -36,7 +36,6 @@ #include "cogl/cogl-cpu-caps.h" #include "cogl/cogl-debug.h" -#include "cogl/cogl-graphene.h" #include "cogl/cogl-util.h" #include "cogl/cogl-context-private.h" #include "cogl/cogl-pipeline-private.h" @@ -71,46 +70,6 @@ _cogl_driver_error_quark (void) return g_quark_from_static_string ("cogl-driver-error-quark"); } -/* Scale from OpenGL normalized device coordinates (ranging from -1 to 1) - * to Cogl window/framebuffer coordinates (ranging from 0 to buffer-size) with - * (0,0) being top left. */ -#define VIEWPORT_TRANSFORM_X(x, vp_origin_x, vp_width) \ - ( ( ((x) + 1.0f) * ((vp_width) / 2.0f) ) + (vp_origin_x) ) -/* Note: for Y we first flip all coordinates around the X axis while in - * normalized device coordinates */ -#define VIEWPORT_TRANSFORM_Y(y, vp_origin_y, vp_height) \ - ( ( ((-(y)) + 1.0f) * ((vp_height) / 2.0f) ) + (vp_origin_y) ) - -/* Transform a homogeneous vertex position from model space to Cogl - * window coordinates (with 0,0 being top left) */ -void -_cogl_transform_point (const graphene_matrix_t *matrix_mv, - const graphene_matrix_t *matrix_p, - const float *viewport, - float *x, - float *y) -{ - float z = 0; - float w = 1; - - /* Apply the modelview matrix transform */ - cogl_graphene_matrix_project_point (matrix_mv, x, y, &z, &w); - - /* Apply the projection matrix transform */ - cogl_graphene_matrix_project_point (matrix_p, x, y, &z, &w); - - /* Perform perspective division */ - *x /= w; - *y /= w; - - /* Apply viewport transform */ - *x = VIEWPORT_TRANSFORM_X (*x, viewport[0], viewport[2]); - *y = VIEWPORT_TRANSFORM_Y (*y, viewport[1], viewport[3]); -} - -#undef VIEWPORT_TRANSFORM_X -#undef VIEWPORT_TRANSFORM_Y - uint32_t _cogl_system_error_quark (void) { diff --git a/cogl/cogl/deprecated/cogl-program.c b/cogl/cogl/deprecated/cogl-program.c index de824bb6d088ac84bbcfcd2938025ab4d59f6a86..93721abf5f6c2d100ffe6dd98a8c7419d9e5f2a6 100644 --- a/cogl/cogl/deprecated/cogl-program.c +++ b/cogl/cogl/deprecated/cogl-program.c @@ -81,12 +81,12 @@ cogl_program_class_init (CoglProgramClass *class) /* A CoglProgram is effectively just a list of shaders that will be used together and a set of values for the custom uniforms. No actual GL program is created - instead this is the responsibility - of the GLSL material backend. The uniform values are collected in - an array and then flushed whenever the material backend requests + of the GLSL pipeline backend. The uniform values are collected in + an array and then flushed whenever the pipeline backend requests it. */ CoglProgram* -cogl_create_program (void) +cogl_program_new (void) { CoglProgram *program; diff --git a/cogl/cogl/deprecated/cogl-shader.c b/cogl/cogl/deprecated/cogl-shader.c index 0cc43c623ea59311b4c644c6aed96b4e0808775e..4ea2220b509c8860451c7e744e0ac517c8344d7a 100644 --- a/cogl/cogl/deprecated/cogl-shader.c +++ b/cogl/cogl/deprecated/cogl-shader.c @@ -70,7 +70,7 @@ cogl_shader_class_init (CoglShaderClass *class) } CoglShader* -cogl_create_shader (CoglShaderType type) +cogl_shader_new (CoglShaderType type) { CoglShader *shader; @@ -81,7 +81,7 @@ cogl_create_shader (CoglShaderType type) break; default: g_warning ("Unexpected shader type (0x%08lX) given to " - "cogl_create_shader", (unsigned long) type); + "cogl_shader_new", (unsigned long) type); return NULL; } diff --git a/cogl/cogl/deprecated/cogl-shader.h b/cogl/cogl/deprecated/cogl-shader.h index 48754035200e12a4fd0529d55b5ced0092502ec2..118b1cc5d490f47509b15285dfdf531a8870f724 100644 --- a/cogl/cogl/deprecated/cogl-shader.h +++ b/cogl/cogl/deprecated/cogl-shader.h @@ -145,7 +145,7 @@ typedef enum } CoglShaderType; /** - * cogl_create_shader: + * cogl_shader_new: * @shader_type: COGL_SHADER_TYPE_VERTEX or COGL_SHADER_TYPE_FRAGMENT. * * Create a new shader handle, use cogl_shader_source() to set the @@ -156,7 +156,7 @@ typedef enum */ COGL_DEPRECATED_FOR (cogl_snippet_) COGL_EXPORT CoglShader* -cogl_create_shader (CoglShaderType shader_type); +cogl_shader_new (CoglShaderType shader_type); /** * cogl_shader_source: @@ -165,7 +165,7 @@ cogl_create_shader (CoglShaderType shader_type); * * Replaces the current source associated with a shader with a new * one. - * + * * Deprecated: 1.16: Use #CoglSnippet api */ COGL_DEPRECATED_FOR (cogl_snippet_) @@ -188,7 +188,7 @@ COGL_EXPORT CoglShaderType cogl_shader_get_shader_type (CoglShader *self); /** - * cogl_create_program: + * cogl_program_new: * * Create a new cogl program object that can be used to replace parts of the GL * rendering pipeline with custom code. @@ -198,7 +198,7 @@ cogl_shader_get_shader_type (CoglShader *self); */ COGL_DEPRECATED_FOR (cogl_snippet_) COGL_EXPORT CoglProgram* -cogl_create_program (void); +cogl_program_new (void); /** * cogl_program_attach_shader: diff --git a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c index 7197e7c5abd4afa52937d73ce0ff9b46aa8293c3..8c80d9a25e3fe36f6e4d7b4cccacc4c3c2cf20bb 100644 --- a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c +++ b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c @@ -34,6 +34,7 @@ #include "cogl/cogl-context-private.h" #include "cogl/cogl-framebuffer-private.h" #include "cogl/cogl-framebuffer.h" +#include "cogl/cogl-indices-private.h" #include "cogl/cogl-offscreen-private.h" #include "cogl/cogl-texture-private.h" #include "cogl/driver/gl/cogl-util-gl-private.h" @@ -324,21 +325,6 @@ cogl_gl_framebuffer_draw_attributes (CoglFramebufferDriver *driver, glDrawArrays ((GLenum)mode, first_vertex, n_vertices)); } -static size_t -sizeof_index_type (CoglIndicesType type) -{ - switch (type) - { - case COGL_INDICES_TYPE_UNSIGNED_BYTE: - return 1; - case COGL_INDICES_TYPE_UNSIGNED_SHORT: - return 2; - case COGL_INDICES_TYPE_UNSIGNED_INT: - return 4; - } - g_return_val_if_reached (0); -} - static void cogl_gl_framebuffer_draw_indexed_attributes (CoglFramebufferDriver *driver, CoglPipeline *pipeline, @@ -371,7 +357,7 @@ cogl_gl_framebuffer_draw_indexed_attributes (CoglFramebufferDriver *driver, base = _cogl_buffer_gl_bind (buffer, COGL_BUFFER_BIND_TARGET_INDEX_BUFFER, NULL); buffer_offset = cogl_indices_get_offset (indices); - index_size = sizeof_index_type (cogl_indices_get_indices_type (indices)); + index_size = cogl_indices_type_get_size (cogl_indices_get_indices_type (indices)); switch (cogl_indices_get_indices_type (indices)) { @@ -472,7 +458,7 @@ cogl_gl_framebuffer_read_pixels_into_bitmap (CoglFramebufferDriver *driver, uint8_t *tmp_data; gboolean succeeded; - if (COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT (read_format)) + if (_cogl_pixel_format_can_have_premult (read_format)) { read_format = ((read_format & ~COGL_PREMULT_BIT) | (internal_format & COGL_PREMULT_BIT)); @@ -536,7 +522,7 @@ cogl_gl_framebuffer_read_pixels_into_bitmap (CoglFramebufferDriver *driver, /* We match the premultiplied state of the target buffer to the * premultiplied state of the framebuffer so that it will get * converted to the right format below */ - if (COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT (format)) + if (_cogl_pixel_format_can_have_premult (format)) bmp_format = ((format & ~COGL_PREMULT_BIT) | (internal_format & COGL_PREMULT_BIT)); else diff --git a/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.h b/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.h index 293d3398a1ffb37fda552ca88bb2e7b03067e7bf..871cba81cfb72ebd085bce7f3e3feb7b27d13d6c 100644 --- a/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.h +++ b/cogl/cogl/driver/gl/cogl-gl-framebuffer-back.h @@ -26,6 +26,7 @@ #pragma once #include "cogl/driver/gl/cogl-framebuffer-gl-private.h" +#include "cogl/cogl-framebuffer-private.h" #define COGL_TYPE_GL_FRAMEBUFFER_BACK (cogl_gl_framebuffer_back_get_type ()) G_DECLARE_FINAL_TYPE (CoglGlFramebufferBack, cogl_gl_framebuffer_back, diff --git a/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.h b/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.h index cc159899834c97d70a2cbcd0ac2d7d8cdec83845..9f5ab3c777de321c92890b81f0c13f913ebf124f 100644 --- a/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.h +++ b/cogl/cogl/driver/gl/cogl-gl-framebuffer-fbo.h @@ -26,6 +26,7 @@ #pragma once #include "cogl/driver/gl/cogl-framebuffer-gl-private.h" +#include "cogl/cogl-framebuffer-private.h" #define COGL_TYPE_GL_FRAMEBUFFER_FBO (cogl_gl_framebuffer_fbo_get_type ()) G_DECLARE_FINAL_TYPE (CoglGlFramebufferFbo, cogl_gl_framebuffer_fbo, diff --git a/cogl/cogl/driver/gl/cogl-pipeline-opengl.c b/cogl/cogl/driver/gl/cogl-pipeline-opengl.c index 13180ca5cc11168be9314bb295f3b14b686cfb78..6e78a9a5de86213babd80292a4658aeacecea4e8 100644 --- a/cogl/cogl/driver/gl/cogl-pipeline-opengl.c +++ b/cogl/cogl/driver/gl/cogl-pipeline-opengl.c @@ -896,8 +896,8 @@ _cogl_pipeline_flush_gl_state (CoglContext *ctx, COGL_STATIC_TIMER (pipeline_flush_timer, "Mainloop", /* parent */ - "Material Flush", - "The time spent flushing material state", + "Pipeline Flush", + "The time spent flushing pipeline state", 0 /* no application private data */); COGL_TIMER_START (_cogl_uprof_context, pipeline_flush_timer); @@ -1123,7 +1123,7 @@ done: } /* Give the progend a chance to update any uniforms that might not - * depend on the material state. This is used on GLES2 to update the + * depend on the pipeline state. This is used on GLES2 to update the * matrices */ if (progend->pre_paint) progend->pre_paint (pipeline, framebuffer); diff --git a/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c b/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c index 9532b604ab37fb3ba6b995f37db50f39935da942..93d7c308d3288fa5c3fabc70385c4b0008c3abae 100644 --- a/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c +++ b/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c @@ -621,7 +621,7 @@ _cogl_pipeline_progend_glsl_flush_uniforms (CoglPipeline *pipeline, for (i = 0; i < n_uniform_longs; i++) data.n_differences += - _cogl_util_popcountl (data.uniform_differences[i]); + __builtin_popcountl (data.uniform_differences[i]); } while (pipeline && data.n_differences > 0) diff --git a/cogl/cogl/meson.build b/cogl/cogl/meson.build index 3d80d4f18ee68bcf6647bca0d68175f56474e4fc..7b51bbed41e3635e605f7b156981124cc3fcc546 100644 --- a/cogl/cogl/meson.build +++ b/cogl/cogl/meson.build @@ -273,7 +273,6 @@ cogl_sources = [ 'cogl-texture-private.h', 'cogl-texture.c', 'cogl-trace.c', - 'cogl-util.c', 'cogl-util.h', 'cogl.c', 'deprecated/cogl-program-private.h', @@ -293,7 +292,6 @@ if have_x11 cogl_sources += [ 'cogl-x11-onscreen.c', 'cogl-x11-onscreen.h', - 'cogl-x11-renderer-private.h', 'cogl-xlib-renderer-private.h', 'cogl-xlib-renderer.c', 'winsys/cogl-texture-pixmap-x11-private.h', @@ -317,9 +315,6 @@ if have_glx endif if have_egl - cogl_nonintrospected_headers += [ - 'cogl-egl.h', - ] cogl_sources += [ 'winsys/cogl-onscreen-egl.c', 'winsys/cogl-onscreen-egl.h', @@ -399,7 +394,6 @@ if have_introspection extra_args: introspection_args + [ '-UCOGL_COMPILATION', '-D__COGL_H_INSIDE__', - '-D__COGL_EGL_H_INSIDE__', '-DCOGL_GIR_SCANNING', ], header: 'cogl/cogl.h', diff --git a/cogl/cogl/winsys/cogl-onscreen-egl.h b/cogl/cogl/winsys/cogl-onscreen-egl.h index d4dda66361f9077e006799746548fc1d2ed78d57..d521bd0479a23271010631a620f6dcb6962d9327 100644 --- a/cogl/cogl/winsys/cogl-onscreen-egl.h +++ b/cogl/cogl/winsys/cogl-onscreen-egl.h @@ -25,6 +25,8 @@ #pragma once +#include + #include "cogl/cogl-onscreen.h" #include "cogl/winsys/cogl-winsys-egl-private.h" diff --git a/cogl/cogl/winsys/cogl-texture-pixmap-x11.c b/cogl/cogl/winsys/cogl-texture-pixmap-x11.c index 9be2778e4c0a4dc2520fcb76e789bdfc48cad4af..edb355462becc20ae360ef60c059d088f30f8aa3 100644 --- a/cogl/cogl/winsys/cogl-texture-pixmap-x11.c +++ b/cogl/cogl/winsys/cogl-texture-pixmap-x11.c @@ -49,7 +49,6 @@ #include "cogl/cogl-renderer-private.h" #include "cogl/cogl-xlib-renderer.h" #include "cogl/cogl-xlib-renderer-private.h" -#include "cogl/cogl-x11-renderer-private.h" #include "cogl/cogl-private.h" #include "cogl/driver/gl/cogl-texture-gl-private.h" #include "cogl/winsys/cogl-winsys-private.h" @@ -223,9 +222,9 @@ set_damage_object_internal (CoglContext *ctx, if (tex_pixmap->damage) { - cogl_xlib_renderer_remove_filter (ctx->display->renderer, - _cogl_texture_pixmap_x11_filter, - tex_pixmap); + _cogl_renderer_remove_native_filter (ctx->display->renderer, + (CoglNativeFilterFunc)_cogl_texture_pixmap_x11_filter, + tex_pixmap); if (tex_pixmap->damage_owned) { @@ -238,9 +237,9 @@ set_damage_object_internal (CoglContext *ctx, tex_pixmap->damage_report_level = report_level; if (damage) - cogl_xlib_renderer_add_filter (ctx->display->renderer, - _cogl_texture_pixmap_x11_filter, - tex_pixmap); + _cogl_renderer_add_native_filter (ctx->display->renderer, + (CoglNativeFilterFunc)_cogl_texture_pixmap_x11_filter, + tex_pixmap); } static void @@ -413,6 +412,135 @@ try_alloc_shm (CoglTexturePixmapX11 *tex_pixmap) tex_pixmap->shm_info.shmid = -1; } +/* Given a set of red, green and blue component masks, a depth and + * bits per pixel this function tries to determine a corresponding + * CoglPixelFormat. + * + * The depth is measured in bits not including padding for un-used + * alpha. The bits per pixel (bpp) does include padding for un-used + * alpha. + * + * This function firstly aims to match formats with RGB ordered + * components and only considers alpha coming first, in the most + * significant bits. If the function fails to match then it recurses + * by either switching the r and b masks around to check for BGR + * ordered formats or it recurses with the masks shifted to check for + * formats where the alpha component is the least significant bits. + */ +static CoglPixelFormat +_cogl_util_pixel_format_from_masks_real (unsigned long r_mask, + unsigned long g_mask, + unsigned long b_mask, + int depth, int bpp, + gboolean check_bgr, + gboolean check_afirst, + int recursion_depth) +{ + CoglPixelFormat image_format; + + if (depth == 24 && bpp == 24 && + r_mask == 0xff0000 && g_mask == 0xff00 && b_mask == 0xff) + { + return COGL_PIXEL_FORMAT_RGB_888; + } + else if ((depth == 24 || depth == 32) && bpp == 32 && + r_mask == 0xff0000 && g_mask == 0xff00 && b_mask == 0xff) + { + return COGL_PIXEL_FORMAT_ARGB_8888_PRE; + } + else if ((depth == 30 || depth == 32) && + r_mask == 0x3ff00000 && g_mask == 0xffc00 && b_mask == 0x3ff) + { + return COGL_PIXEL_FORMAT_ARGB_2101010_PRE; + } + else if (depth == 16 && bpp == 16 && + r_mask == 0xf800 && g_mask == 0x7e0 && b_mask == 0x1f) + { + return COGL_PIXEL_FORMAT_RGB_565; + } + + if (recursion_depth == 2) + return 0; + + /* Check for BGR ordering if we didn't find a match */ + if (check_bgr) + { + image_format = + _cogl_util_pixel_format_from_masks_real (b_mask, g_mask, r_mask, + depth, bpp, + FALSE, + TRUE, + recursion_depth + 1); + if (image_format) + return image_format ^ COGL_BGR_BIT; + } + + /* Check for alpha in the least significant bits if we still + * haven't found a match... */ + if (check_afirst && depth != bpp) + { + int shift = bpp - depth; + + image_format = + _cogl_util_pixel_format_from_masks_real (r_mask >> shift, + g_mask >> shift, + b_mask >> shift, + depth, bpp, + TRUE, + FALSE, + recursion_depth + 1); + if (image_format) + return image_format ^ COGL_AFIRST_BIT; + } + + return 0; +} + + +/* Match a CoglPixelFormat according to channel masks, color depth, + * bits per pixel and byte order. These information are provided by + * the Visual and XImage structures. + * + * If no specific pixel format could be found, COGL_PIXEL_FORMAT_ANY + * is returned. + */ +static CoglPixelFormat +_cogl_util_pixel_format_from_masks (unsigned long r_mask, + unsigned long g_mask, + unsigned long b_mask, + int depth, int bpp, + gboolean byte_order_is_lsb_first) +{ + CoglPixelFormat image_format = + _cogl_util_pixel_format_from_masks_real (r_mask, g_mask, b_mask, + depth, bpp, + TRUE, + TRUE, + 0); + + if (!image_format) + { + const char *byte_order[] = { "MSB first", "LSB first" }; + g_warning ("Could not find a matching pixel format for red mask=0x%lx," + "green mask=0x%lx, blue mask=0x%lx at depth=%d, bpp=%d " + "and byte order=%s\n", r_mask, g_mask, b_mask, depth, bpp, + byte_order[!!byte_order_is_lsb_first]); + return 0; + } + + /* If the image is in little-endian then the order in memory is + reversed */ + if (byte_order_is_lsb_first && + _cogl_pixel_format_is_endian_dependant (image_format)) + { + image_format ^= COGL_BGR_BIT; + if (image_format & COGL_A_BIT) + image_format ^= COGL_AFIRST_BIT; + } + + return image_format; +} + static void _cogl_texture_pixmap_x11_update_image_texture (CoglTexturePixmapX11 *tex_pixmap) { diff --git a/cogl/cogl/winsys/cogl-winsys-egl-private.h b/cogl/cogl/winsys/cogl-winsys-egl-private.h index 6a31d1ab2d07a89a7f52fba611c9d2ae88fa6679..8a5cf01a52eddfcd0d2c75960d4ca2c8ae608c8c 100644 --- a/cogl/cogl/winsys/cogl-winsys-egl-private.h +++ b/cogl/cogl/winsys/cogl-winsys-egl-private.h @@ -30,6 +30,8 @@ #pragma once +#include + #include "cogl/cogl-context.h" #include "cogl/cogl-context-private.h" #include "cogl/cogl-framebuffer-private.h" diff --git a/cogl/cogl/winsys/cogl-winsys-egl-x11.c b/cogl/cogl/winsys/cogl-winsys-egl-x11.c index aa44576ea402af7355d8d5f68060c17f1a6081ad..588d77b2b2b5f33496309581ebb3935632842c26 100644 --- a/cogl/cogl/winsys/cogl-winsys-egl-x11.c +++ b/cogl/cogl/winsys/cogl-winsys-egl-x11.c @@ -121,7 +121,7 @@ event_filter_cb (XEvent *xevent, void *data) if (onscreen) { - CoglOnscreenDirtyInfo info; + MtkRectangle info; info.x = xevent->xexpose.x; info.y = xevent->xexpose.y; @@ -323,9 +323,9 @@ static gboolean _cogl_winsys_egl_context_init (CoglContext *context, GError **error) { - cogl_xlib_renderer_add_filter (context->display->renderer, - event_filter_cb, - context); + _cogl_renderer_add_native_filter (context->display->renderer, + (CoglNativeFilterFunc)event_filter_cb, + context); /* We'll manually handle queueing dirty events in response to * Expose events from X */ @@ -339,9 +339,9 @@ _cogl_winsys_egl_context_init (CoglContext *context, static void _cogl_winsys_egl_context_deinit (CoglContext *context) { - cogl_xlib_renderer_remove_filter (context->display->renderer, - event_filter_cb, - context); + _cogl_renderer_remove_native_filter (context->display->renderer, + (CoglNativeFilterFunc)event_filter_cb, + context); } static gboolean @@ -490,7 +490,7 @@ _cogl_winsys_texture_pixmap_x11_create (CoglTexturePixmapX11 *tex_pixmap) COGL_PIXEL_FORMAT_RGB_888); egl_tex_pixmap->texture = - cogl_egl_texture_2d_new_from_image (ctx, + cogl_texture_2d_new_from_egl_image (ctx, cogl_texture_get_width (tex), cogl_texture_get_height (tex), texture_format, diff --git a/cogl/cogl/winsys/cogl-winsys-egl.c b/cogl/cogl/winsys/cogl-winsys-egl.c index 046220da183c288159c0341dfed71bdcab273fb3..3da668adf62db23e5881f0079d5fb0366d1032c5 100644 --- a/cogl/cogl/winsys/cogl-winsys-egl.c +++ b/cogl/cogl/winsys/cogl-winsys-egl.c @@ -34,12 +34,12 @@ #include "cogl/cogl-util.h" #include "cogl/cogl-feature-private.h" +#include "cogl/cogl-context.h" #include "cogl/cogl-context-private.h" #include "cogl/cogl-framebuffer.h" #include "cogl/cogl-onscreen-private.h" #include "cogl/cogl-renderer-private.h" #include "cogl/cogl-onscreen-template-private.h" -#include "cogl/cogl-egl.h" #include "cogl/cogl-private.h" #include "cogl/cogl-trace.h" #include "cogl/winsys/cogl-winsys-egl-private.h" @@ -678,7 +678,7 @@ _cogl_egl_query_wayland_buffer (CoglContext *ctx, #endif EGLDisplay -cogl_egl_context_get_egl_display (CoglContext *context) +cogl_context_get_egl_display (CoglContext *context) { CoglRendererEGL *egl_renderer = context->display->renderer->winsys; diff --git a/cogl/cogl/winsys/cogl-winsys-glx.c b/cogl/cogl/winsys/cogl-winsys-glx.c index 166a038080819438ff7eee5121049600cce7ea6f..76a13f1c2fa100898f82b174b877c0ef0a3eb547 100644 --- a/cogl/cogl/winsys/cogl-winsys-glx.c +++ b/cogl/cogl/winsys/cogl-winsys-glx.c @@ -226,7 +226,7 @@ glx_event_filter_cb (XEvent *xevent, void *data) if (onscreen) { - CoglOnscreenDirtyInfo info; + MtkRectangle info; info.x = xevent->xexpose.x; info.y = xevent->xexpose.y; @@ -853,18 +853,18 @@ _cogl_winsys_context_init (CoglContext *context, GError **error) { context->winsys = g_new0 (CoglContextGLX, 1); - cogl_xlib_renderer_add_filter (context->display->renderer, - glx_event_filter_cb, - context); + _cogl_renderer_add_native_filter (context->display->renderer, + (CoglNativeFilterFunc)glx_event_filter_cb, + context); return update_winsys_features (context, error); } static void _cogl_winsys_context_deinit (CoglContext *context) { - cogl_xlib_renderer_remove_filter (context->display->renderer, - glx_event_filter_cb, - context); + _cogl_renderer_remove_native_filter (context->display->renderer, + (CoglNativeFilterFunc)glx_event_filter_cb, + context); g_free (context->winsys); } @@ -1067,9 +1067,9 @@ try_create_glx_pixmap (CoglContext *context, * number of 1-bits in color masks against the color depth requested * by the client. */ - if (_cogl_util_popcountl (visual->red_mask | - visual->green_mask | - visual->blue_mask) == depth) + if (__builtin_popcountl (visual->red_mask | + visual->green_mask | + visual->blue_mask) == depth) attribs[i++] = GLX_TEXTURE_FORMAT_RGB_EXT; else attribs[i++] = GLX_TEXTURE_FORMAT_RGBA_EXT; diff --git a/cogl/cogl/winsys/cogl-winsys-private.h b/cogl/cogl/winsys/cogl-winsys-private.h index 00644e3f27746628671a56603542451842e892cf..0606243a77763f612c48f48387e28618b19ce5b7 100644 --- a/cogl/cogl/winsys/cogl-winsys-private.h +++ b/cogl/cogl/winsys/cogl-winsys-private.h @@ -51,6 +51,32 @@ typedef enum /*< prefix=COGL_WINSYS_ERROR >*/ COGL_WINSYS_ERROR_MAKE_CURRENT, } CoglWinsysError; +/** + * CoglRendererConstraint: + * @COGL_RENDERER_CONSTRAINT_USES_X11: Require the renderer to be X11 based + * @COGL_RENDERER_CONSTRAINT_USES_XLIB: Require the renderer to be X11 + * based and use Xlib + * @COGL_RENDERER_CONSTRAINT_USES_EGL: Require the renderer to be EGL based + * + * These constraint flags are hard-coded features of the different renderer + * backends. Sometimes a platform may support multiple rendering options which + * Cogl will usually choose from automatically. Some of these features are + * important to higher level applications and frameworks though, such as + * whether a renderer is X11 based because an application might only support + * X11 based input handling. An application might also need to ensure EGL is + * used internally too if they depend on access to an EGLDisplay for some + * purpose. + * + * Applications should ideally minimize how many of these constraints + * they depend on to ensure maximum portability. + */ +typedef enum +{ + COGL_RENDERER_CONSTRAINT_USES_X11 = (1 << 0), + COGL_RENDERER_CONSTRAINT_USES_XLIB = (1 << 1), + COGL_RENDERER_CONSTRAINT_USES_EGL = (1 << 2), +} CoglRendererConstraint; + typedef struct _CoglWinsysVtable { CoglWinsysID id; diff --git a/src/backends/meta-screen-cast.c b/src/backends/meta-screen-cast.c index 0089bc2d9fb7f373f01b7e0e06ce6f24d2f0c091..b9c52e9c18c78fe335bac7a465f8bdf98ea5c17c 100644 --- a/src/backends/meta-screen-cast.c +++ b/src/backends/meta-screen-cast.c @@ -33,8 +33,6 @@ #include "backends/native/meta-render-device.h" #include "backends/native/meta-renderer-native-private.h" -#include "cogl/cogl-egl.h" - #include "common/meta-cogl-drm-formats.h" #endif @@ -189,7 +187,7 @@ meta_screen_cast_query_modifiers (MetaScreenCast *screen_cast, CoglRenderer *cogl_renderer = cogl_context_get_renderer (cogl_context); EGLDisplay egl_display = - cogl_egl_context_get_egl_display (cogl_context); + cogl_context_get_egl_display (cogl_context); MetaEgl *egl = meta_backend_get_egl (backend); EGLint num_modifiers; diff --git a/src/backends/native/meta-drm-buffer-gbm.c b/src/backends/native/meta-drm-buffer-gbm.c index 4ca8fb0f46255ba06dee0fd714f71f387a620699..01963cd75466ec870ad71bcdd46dea164a928a52 100644 --- a/src/backends/native/meta-drm-buffer-gbm.c +++ b/src/backends/native/meta-drm-buffer-gbm.c @@ -318,7 +318,7 @@ meta_drm_buffer_gbm_blit_to_framebuffer (CoglScanout *scanout, } flags = COGL_EGL_IMAGE_FLAG_NO_GET_DATA; - cogl_tex = cogl_egl_texture_2d_new_from_image (cogl_context, + cogl_tex = cogl_texture_2d_new_from_egl_image (cogl_context, width, height, cogl_format, diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c index 8b23e4cc3329c4ac3b31dcce019211535c72d410..786f57a935b2c2cb21a2c4f93d854d8e7cdb454b 100644 --- a/src/backends/native/meta-renderer-native.c +++ b/src/backends/native/meta-renderer-native.c @@ -680,7 +680,7 @@ meta_renderer_native_create_dma_buf_framebuffer (MetaRendererNative *renderer_n return NULL; flags = COGL_EGL_IMAGE_FLAG_NO_GET_DATA; - cogl_tex = cogl_egl_texture_2d_new_from_image (cogl_context, + cogl_tex = cogl_texture_2d_new_from_egl_image (cogl_context, width, height, cogl_format, diff --git a/src/backends/x11/meta-event-x11.c b/src/backends/x11/meta-event-x11.c index 2231851874da5c5e196334b41d7ff6ec05e53a09..743bf6f2c36f2cde2b0d97ae51262ce5c484f292 100644 --- a/src/backends/x11/meta-event-x11.c +++ b/src/backends/x11/meta-event-x11.c @@ -59,8 +59,8 @@ meta_backend_x11_handle_event (MetaBackend *backend, allocated_event = XGetEventData (xdisplay, &xevent->xcookie); - if (cogl_xlib_renderer_handle_event (clutter_backend->cogl_renderer, - xevent) == COGL_FILTER_REMOVE) + if (cogl_renderer_handle_event (clutter_backend->cogl_renderer, + xevent) == COGL_FILTER_REMOVE) goto out; stage_x11 = diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c index c72276823e4331d3dca7bceb32d61c596d39ca51..a9ef7369116ef0eba9e1a3d998e761e2ae54844b 100644 --- a/src/compositor/compositor.c +++ b/src/compositor/compositor.c @@ -1000,7 +1000,7 @@ meta_compositor_real_after_paint (MetaCompositor *compositor, ClutterStageView *stage_view; GList *l; - status = cogl_get_graphics_reset_status (priv->context); + status = cogl_context_get_graphics_reset_status (priv->context); switch (status) { case COGL_GRAPHICS_RESET_STATUS_NO_ERROR: diff --git a/src/tests/clutter/interactive/meson.build b/src/tests/clutter/interactive/meson.build index b6138f711c5f12d05aca539fda47a3915d330948..6ceb474af9632af2a417fea7c290ccd90ba0195d 100644 --- a/src/tests/clutter/interactive/meson.build +++ b/src/tests/clutter/interactive/meson.build @@ -19,7 +19,6 @@ clutter_tests_interactive_test_sources = [ 'test-cogl-shader-glsl.c', 'test-cogl-tex-tile.c', 'test-cogl-offscreen.c', - 'test-cogl-tex-polygon.c', 'test-animation.c', 'test-binding-pool.c', 'test-text.c', diff --git a/src/tests/clutter/interactive/test-cogl-multitexture.c b/src/tests/clutter/interactive/test-cogl-multitexture.c index d326e8957c0bbb112351a8d67e13d9c760970298..8d03f0210210e47f20fc9d94c4c8f627f71451ad 100644 --- a/src/tests/clutter/interactive/test-cogl-multitexture.c +++ b/src/tests/clutter/interactive/test-cogl-multitexture.c @@ -58,7 +58,7 @@ frame_cb (ClutterTimeline *timeline, } static void -material_rectangle_paint (ClutterActor *actor, +pipeline_rectangle_paint (ClutterActor *actor, ClutterPaintContext *paint_context, gpointer data) { @@ -144,7 +144,7 @@ test_cogl_multitexture_main (int argc, char *argv[]) state->group = clutter_actor_new (); clutter_actor_set_position (state->group, stage_w / 2, stage_h / 2); g_signal_connect (state->group, "paint", - G_CALLBACK (material_rectangle_paint), state); + G_CALLBACK (pipeline_rectangle_paint), state); files = g_new (gchar*, 4); files[0] = g_build_filename (TESTS_DATADIR, "redhand_alpha.png", NULL); diff --git a/src/tests/clutter/interactive/test-cogl-shader-glsl.c b/src/tests/clutter/interactive/test-cogl-shader-glsl.c index eb95bbae6d53f8c64f54ad78b69ee856a9e1d4fc..28d68c7e5fbd9522b8246f08d2c3893dd5f1995b 100644 --- a/src/tests/clutter/interactive/test-cogl-shader-glsl.c +++ b/src/tests/clutter/interactive/test-cogl-shader-glsl.c @@ -204,10 +204,10 @@ set_shader_num (int new_no) shader_pipeline = cogl_pipeline_new (ctx); - shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT); + shader = cogl_shader_new (COGL_SHADER_TYPE_FRAGMENT); cogl_shader_source (shader, shaders[new_no].source); - program = cogl_create_program (); + program = cogl_program_new (); cogl_program_attach_shader (program, shader); g_object_unref (shader); cogl_program_link (program); @@ -358,4 +358,3 @@ test_cogl_shader_glsl_main (int argc, char *argv[]) return EXIT_SUCCESS; } - diff --git a/src/tests/clutter/interactive/test-cogl-tex-polygon.c b/src/tests/clutter/interactive/test-cogl-tex-polygon.c deleted file mode 100644 index 5249b6d4b0b2cc3b31343768c11af1f3102b8be8..0000000000000000000000000000000000000000 --- a/src/tests/clutter/interactive/test-cogl-tex-polygon.c +++ /dev/null @@ -1,396 +0,0 @@ -#include -#include -#include -#include -#include - -#include "clutter/test-utils.h" -#include "tests/clutter-test-utils.h" - -/* Coglbox declaration - *--------------------------------------------------*/ - -G_BEGIN_DECLS - -#define TEST_TYPE_COGLBOX test_coglbox_get_type() - -static -G_DECLARE_FINAL_TYPE (TestCoglbox, test_coglbox, TEST, COGLBOX, ClutterActor) - -struct _TestCoglbox -{ - ClutterActor parent; - - CoglTexture *sliced_tex; - CoglTexture *not_sliced_tex; - gint frame; - gboolean use_sliced; - gboolean use_linear_filtering; -}; - -G_DEFINE_TYPE (TestCoglbox, test_coglbox, CLUTTER_TYPE_ACTOR); - - -int -test_cogl_tex_polygon_main (int argc, char *argv[]); - -const char * -test_cogl_tex_polygon_describe (void); - -G_END_DECLS - -/* Coglbox implementation - *--------------------------------------------------*/ - -static void -test_coglbox_fade_texture (CoglFramebuffer *framebuffer, - CoglPipeline *pipeline, - float x1, - float y1, - float x2, - float y2, - float tx1, - float ty1, - float tx2, - float ty2) -{ - CoglVertexP3T2C4 vertices[4]; - CoglPrimitive *primitive; - int i; - - vertices[0].x = x1; - vertices[0].y = y1; - vertices[0].z = 0; - vertices[0].s = tx1; - vertices[0].t = ty1; - vertices[1].x = x1; - vertices[1].y = y2; - vertices[1].z = 0; - vertices[1].s = tx1; - vertices[1].t = ty2; - vertices[2].x = x2; - vertices[2].y = y2; - vertices[2].z = 0; - vertices[2].s = tx2; - vertices[2].t = ty2; - vertices[3].x = x2; - vertices[3].y = y1; - vertices[3].z = 0; - vertices[3].s = tx2; - vertices[3].t = ty1; - - for (i = 0; i < 4; i++) - { - CoglColor cogl_color; - - cogl_color_init_from_4f (&cogl_color, - 1.0f, - 1.0f, - 1.0f, - ((i ^ (i >> 1)) & 1) ? 0.0 : 128.0f / 255.0f); - cogl_color_premultiply (&cogl_color); - vertices[i].r = (uint8_t) (cogl_color_get_red (&cogl_color) * 255.0); - vertices[i].g = (uint8_t) (cogl_color_get_green (&cogl_color) * 255.0); - vertices[i].b = (uint8_t) (cogl_color_get_blue (&cogl_color) * 255.0); - vertices[i].a = (uint8_t) (cogl_color_get_alpha (&cogl_color) * 255.0); - } - - primitive = - cogl_primitive_new_p3t2c4 (cogl_framebuffer_get_context (framebuffer), - COGL_VERTICES_MODE_TRIANGLE_FAN, - 4, - vertices); - cogl_primitive_draw (primitive, framebuffer, pipeline); - g_object_unref (primitive); -} - -static void -test_coglbox_triangle_texture (CoglFramebuffer *framebuffer, - CoglPipeline *pipeline, - int tex_width, - int tex_height, - float x, - float y, - float tx1, - float ty1, - float tx2, - float ty2, - float tx3, - float ty3) -{ - CoglVertexP3T2 vertices[3]; - CoglPrimitive *primitive; - - vertices[0].x = x + tx1 * tex_width; - vertices[0].y = y + ty1 * tex_height; - vertices[0].z = 0; - vertices[0].s = tx1; - vertices[0].t = ty1; - - vertices[1].x = x + tx2 * tex_width; - vertices[1].y = y + ty2 * tex_height; - vertices[1].z = 0; - vertices[1].s = tx2; - vertices[1].t = ty2; - - vertices[2].x = x + tx3 * tex_width; - vertices[2].y = y + ty3 * tex_height; - vertices[2].z = 0; - vertices[2].s = tx3; - vertices[2].t = ty3; - - primitive = cogl_primitive_new_p3t2 (cogl_framebuffer_get_context (framebuffer), - COGL_VERTICES_MODE_TRIANGLE_FAN, - 3, - vertices); - cogl_primitive_draw (primitive, framebuffer, pipeline); - g_object_unref (primitive); -} - -static void -test_coglbox_paint (ClutterActor *self, - ClutterPaintContext *paint_context) -{ - TestCoglbox *coglbox = TEST_COGLBOX (self); - CoglTexture *tex_handle = coglbox->use_sliced ? coglbox->sliced_tex - : coglbox->not_sliced_tex; - int tex_width = cogl_texture_get_width (tex_handle); - int tex_height = cogl_texture_get_height (tex_handle); - CoglPipeline *pipeline; - CoglFramebuffer *framebuffer = - clutter_paint_context_get_framebuffer (paint_context); - CoglContext *ctx = - clutter_backend_get_cogl_context (clutter_get_default_backend ()); - - pipeline = cogl_pipeline_new (ctx); - cogl_pipeline_set_layer_texture (pipeline, 0, tex_handle); - - cogl_pipeline_set_layer_filters (pipeline, 0, - coglbox->use_linear_filtering - ? COGL_PIPELINE_FILTER_LINEAR : - COGL_PIPELINE_FILTER_NEAREST, - coglbox->use_linear_filtering - ? COGL_PIPELINE_FILTER_LINEAR : - COGL_PIPELINE_FILTER_NEAREST); - - cogl_framebuffer_push_matrix (framebuffer); - cogl_framebuffer_translate (framebuffer, tex_width / 2, 0, 0); - cogl_framebuffer_rotate (framebuffer, coglbox->frame, 0, 1, 0); - cogl_framebuffer_translate (framebuffer, -tex_width / 2, 0, 0); - - /* Draw a hand and reflect it */ - cogl_framebuffer_draw_textured_rectangle (framebuffer, pipeline, - 0, 0, tex_width, tex_height, - 0, 0, 1, 1); - test_coglbox_fade_texture (framebuffer, pipeline, - 0, tex_height, - tex_width, (tex_height * 3 / 2), - 0.0, 1.0, - 1.0, 0.5); - - cogl_framebuffer_pop_matrix (framebuffer); - - cogl_framebuffer_push_matrix (framebuffer); - cogl_framebuffer_translate (framebuffer, tex_width * 3 / 2 + 60, 0, 0); - cogl_framebuffer_rotate (framebuffer, coglbox->frame, 0, 1, 0); - cogl_framebuffer_translate (framebuffer, -tex_width / 2 - 10, 0, 0); - - /* Draw the texture split into two triangles */ - test_coglbox_triangle_texture (framebuffer, pipeline, - tex_width, tex_height, - 0, 0, - 0, 0, - 0, 1, - 1, 1); - test_coglbox_triangle_texture (framebuffer, pipeline, - tex_width, tex_height, - 20, 0, - 0, 0, - 1, 0, - 1, 1); - - cogl_framebuffer_pop_matrix (framebuffer); - - g_object_unref (pipeline); -} - -static void -test_coglbox_dispose (GObject *object) -{ - TestCoglbox *coglbox = TEST_COGLBOX (object); - - g_object_unref (coglbox->not_sliced_tex); - g_object_unref (coglbox->sliced_tex); - - G_OBJECT_CLASS (test_coglbox_parent_class)->dispose (object); -} - -static void -test_coglbox_init (TestCoglbox *self) -{ - CoglContext *ctx = - clutter_backend_get_cogl_context (clutter_get_default_backend ()); - GError *error = NULL; - gchar *file; - - self->use_linear_filtering = FALSE; - self->use_sliced = FALSE; - - file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL); - self->sliced_tex = - clutter_test_texture_2d_sliced_new_from_file (ctx, file, - &error); - if (self->sliced_tex == NULL) - { - if (error) - { - g_warning ("Texture loading failed: %s", error->message); - g_error_free (error); - error = NULL; - } - else - g_warning ("Texture loading failed: "); - } - - self->not_sliced_tex = clutter_test_texture_2d_new_from_file (ctx, file, &error); - if (self->not_sliced_tex == NULL) - { - if (error) - { - g_warning ("Texture loading failed: %s", error->message); - g_error_free (error); - } - else - g_warning ("Texture loading failed: "); - } - - g_free (file); -} - -static void -test_coglbox_class_init (TestCoglboxClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); - - gobject_class->dispose = test_coglbox_dispose; - actor_class->paint = test_coglbox_paint; -} - -static ClutterActor* -test_coglbox_new (void) -{ - return g_object_new (TEST_TYPE_COGLBOX, NULL); -} - -static void -frame_cb (ClutterTimeline *timeline, - int elapsed_msecs, - gpointer data) -{ - TestCoglbox *coglbox = TEST_COGLBOX (data); - gdouble progress = clutter_timeline_get_progress (timeline); - - coglbox->frame = (int) (360.0 * progress); - clutter_actor_queue_redraw (CLUTTER_ACTOR (data)); -} - -static void -update_toggle_text (ClutterText *button, gboolean val) -{ - clutter_text_set_text (button, val ? "Enabled" : "Disabled"); -} - -static gboolean -on_toggle_click (ClutterActor *button, ClutterEvent *event, - gboolean *toggle_val) -{ - update_toggle_text (CLUTTER_TEXT (button), *toggle_val = !*toggle_val); - - return TRUE; -} - -static ClutterActor * -make_toggle (const char *label_text, gboolean *toggle_val) -{ - ClutterActor *group = clutter_actor_new (); - ClutterActor *label = clutter_text_new_with_text ("Sans 14", label_text); - ClutterActor *button = clutter_text_new_with_text ("Sans 14", ""); - - clutter_actor_set_reactive (button, TRUE); - - update_toggle_text (CLUTTER_TEXT (button), *toggle_val); - - clutter_actor_set_position (button, clutter_actor_get_width (label) + 10, 0); - clutter_actor_add_child (group, label); - clutter_actor_add_child (group, button); - - g_signal_connect (button, "button-press-event", G_CALLBACK (on_toggle_click), - toggle_val); - - return group; -} - -G_MODULE_EXPORT int -test_cogl_tex_polygon_main (int argc, char *argv[]) -{ - ClutterActor *stage; - TestCoglbox *coglbox; - ClutterActor *filtering_toggle; - ClutterActor *slicing_toggle; - ClutterActor *note; - ClutterTimeline *timeline; - CoglColor blue = { 0x30, 0x30, 0xff, 0xff }; - - clutter_test_init (&argc, &argv); - - /* Stage */ - stage = clutter_test_get_stage (); - clutter_actor_set_background_color (CLUTTER_ACTOR (stage), &blue); - clutter_actor_set_size (stage, 640, 480); - clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Texture Polygon"); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_test_quit), NULL); - - /* Cogl Box */ - coglbox = TEST_COGLBOX (test_coglbox_new ()); - clutter_actor_add_child (stage, CLUTTER_ACTOR (coglbox)); - - /* Timeline for animation */ - timeline = clutter_timeline_new_for_actor (stage, 6000); - clutter_timeline_set_repeat_count (timeline, -1); - g_signal_connect (timeline, "new-frame", G_CALLBACK (frame_cb), coglbox); - clutter_timeline_start (timeline); - - /* Labels for toggling settings */ - slicing_toggle = make_toggle ("Texture slicing: ", &coglbox->use_sliced); - clutter_actor_set_position (slicing_toggle, 0, - clutter_actor_get_height (stage) - - clutter_actor_get_height (slicing_toggle)); - filtering_toggle = make_toggle ("Linear filtering: ", - &coglbox->use_linear_filtering); - clutter_actor_set_position (filtering_toggle, 0, - clutter_actor_get_y (slicing_toggle) - - clutter_actor_get_height (filtering_toggle)); - note = clutter_text_new_with_text ("Sans 10", "<- Click to change"); - clutter_actor_set_position (note, - clutter_actor_get_width (filtering_toggle) + 10, - (clutter_actor_get_height (stage) - + clutter_actor_get_y (filtering_toggle)) / 2 - - clutter_actor_get_height (note) / 2); - - clutter_actor_add_child (stage, slicing_toggle); - clutter_actor_add_child (stage, filtering_toggle); - clutter_actor_add_child (stage, note); - - clutter_actor_show (stage); - - clutter_test_main (); - - return 0; -} - -G_MODULE_EXPORT const char * -test_cogl_tex_polygon_describe (void) -{ - return "Texture polygon primitive."; -} diff --git a/src/tests/cogl/conform/test-just-vertex-shader.c b/src/tests/cogl/conform/test-just-vertex-shader.c index f149b025b365c38bdced5da670d9b2a146f2994d..cc5f5efbb8f6b256943143f70fa9fc82220a8baa 100644 --- a/src/tests/cogl/conform/test-just-vertex-shader.c +++ b/src/tests/cogl/conform/test-just-vertex-shader.c @@ -58,7 +58,7 @@ paint (TestState *state) /* Set up a dummy vertex shader that does nothing but the usual fixed function transform */ - shader = cogl_create_shader (COGL_SHADER_TYPE_VERTEX); + shader = cogl_shader_new (COGL_SHADER_TYPE_VERTEX); cogl_shader_source (shader, "void\n" "main ()\n" @@ -70,7 +70,7 @@ paint (TestState *state) " cogl_tex_coord_out[0] = cogl_tex_coord_in;\n" "}\n"); - program = cogl_create_program (); + program = cogl_program_new (); cogl_program_attach_shader (program, shader); cogl_program_link (program); diff --git a/src/tests/cogl/conform/test-pipeline-uniforms.c b/src/tests/cogl/conform/test-pipeline-uniforms.c index 75caf3585b14ec27a89a656580d1a52f2dd62da0..566d101d2d1c8abb041f1defd8a77c0d0d7b5c4c 100644 --- a/src/tests/cogl/conform/test-pipeline-uniforms.c +++ b/src/tests/cogl/conform/test-pipeline-uniforms.c @@ -94,10 +94,10 @@ create_pipeline_for_shader (TestState *state, const char *shader_source) pipeline = cogl_pipeline_new (test_ctx); - shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT); + shader = cogl_shader_new (COGL_SHADER_TYPE_FRAGMENT); cogl_shader_source (shader, shader_source); - program = cogl_create_program (); + program = cogl_program_new (); cogl_program_attach_shader (program, shader); cogl_pipeline_set_user_program (pipeline, program); diff --git a/src/tests/cogl/conform/test-primitive-and-journal.c b/src/tests/cogl/conform/test-primitive-and-journal.c index 767a8313e9af73d1d3a02184948b572aae940392..dc563a45ee74f0890c7195634ff2a08c356a3ea8 100644 --- a/src/tests/cogl/conform/test-primitive-and-journal.c +++ b/src/tests/cogl/conform/test-primitive-and-journal.c @@ -47,7 +47,10 @@ create_primitives (CoglPrimitive *primitives[2]) vertex_data); cogl_primitive_set_n_vertices (primitives[0], 4); - primitives[1] = cogl_primitive_copy (primitives[0]); + primitives[1] = cogl_primitive_new_p2c4 (test_ctx, + COGL_VERTICES_MODE_TRIANGLE_STRIP, + G_N_ELEMENTS (vertex_data), + vertex_data); cogl_primitive_set_first_vertex (primitives[1], 4); cogl_primitive_set_n_vertices (primitives[1], 4); } diff --git a/src/tests/cogl/conform/test-primitive.c b/src/tests/cogl/conform/test-primitive.c index 0a0c1beb5cb6cd12d2567174de56e32cd8f414fb..a034c82fff8b8532229a29ee2306ce18874cf106 100644 --- a/src/tests/cogl/conform/test-primitive.c +++ b/src/tests/cogl/conform/test-primitive.c @@ -57,22 +57,6 @@ test_prim_p2c4 (CoglContext *ctx, uint32_t *expected_color) verts); } -static CoglPrimitive * -test_prim_p3c4 (CoglContext *ctx, uint32_t *expected_color) -{ - static const CoglVertexP3C4 verts[] = - { { 0, 0, 0, 255, 255, 0, 255 }, - { 0, 10, 0, 255, 255, 0, 255 }, - { 10, 0, 0, 255, 255, 0, 255 } }; - - *expected_color = 0xffff00ff; - - return cogl_primitive_new_p3c4 (test_ctx, - COGL_VERTICES_MODE_TRIANGLES, - 3, /* n_vertices */ - verts); -} - static CoglPrimitive * test_prim_p2t2 (CoglContext *ctx, uint32_t *expected_color) { @@ -105,51 +89,14 @@ test_prim_p3t2 (CoglContext *ctx, uint32_t *expected_color) verts); } -static CoglPrimitive * -test_prim_p2t2c4 (CoglContext *ctx, uint32_t *expected_color) -{ - static const CoglVertexP2T2C4 verts[] = - { { 0, 0, 1, 0, 0xff, 0xff, 0xf0, 0xff }, - { 0, 10, 1, 0, 0xff, 0xff, 0xf0, 0xff }, - { 10, 0, 1, 0, 0xff, 0xff, 0xf0, 0xff } }; - - /* The blue component of the texture color should be replaced with 0xf0 */ - *expected_color = (TEX_COLOR & 0xffff00ff) | 0x0000f000; - - return cogl_primitive_new_p2t2c4 (test_ctx, - COGL_VERTICES_MODE_TRIANGLES, - 3, /* n_vertices */ - verts); -} - -static CoglPrimitive * -test_prim_p3t2c4 (CoglContext *ctx, uint32_t *expected_color) -{ - static const CoglVertexP3T2C4 verts[] = - { { 0, 0, 0, 1, 0, 0xff, 0xff, 0xf0, 0xff }, - { 0, 10, 0, 1, 0, 0xff, 0xff, 0xf0, 0xff }, - { 10, 0, 0, 1, 0, 0xff, 0xff, 0xf0, 0xff } }; - - /* The blue component of the texture color should be replaced with 0xf0 */ - *expected_color = (TEX_COLOR & 0xffff00ff) | 0x0000f000; - - return cogl_primitive_new_p3t2c4 (test_ctx, - COGL_VERTICES_MODE_TRIANGLES, - 3, /* n_vertices */ - verts); -} - static const TestPrimFunc test_prim_funcs[] = { test_prim_p2, test_prim_p3, test_prim_p2c4, - test_prim_p3c4, test_prim_p2t2, test_prim_p3t2, - test_prim_p2t2c4, - test_prim_p3t2c4 }; static void @@ -207,112 +154,6 @@ test_paint (TestState *state) g_object_unref (pipeline); } -static gboolean -get_attributes_cb (CoglPrimitive *prim, - CoglAttribute *attrib, - void *user_data) -{ - CoglAttribute ***p = user_data; - *((* p)++) = attrib; - return TRUE; -} - -static int -compare_pointers (const void *a, const void *b) -{ - CoglAttribute *pa = *(CoglAttribute **) a; - CoglAttribute *pb = *(CoglAttribute **) b; - - if (pa < pb) - return -1; - else if (pa > pb) - return 1; - else - return 0; -} - -static void -test_copy (TestState *state) -{ - static const uint16_t indices_data[2] = { 1, 2 }; - CoglAttributeBuffer *buffer = - cogl_attribute_buffer_new (test_ctx, 100, NULL); - CoglAttribute *attributes[N_ATTRIBS]; - CoglAttribute *attributes_a[N_ATTRIBS], *attributes_b[N_ATTRIBS]; - CoglAttribute **p; - CoglPrimitive *prim_a, *prim_b; - CoglIndices *indices; - int i; - - for (i = 0; i < N_ATTRIBS; i++) - { - char *name = g_strdup_printf ("foo_%i", i); - attributes[i] = cogl_attribute_new (buffer, - name, - 16, /* stride */ - 16, /* offset */ - 2, /* components */ - COGL_ATTRIBUTE_TYPE_FLOAT); - g_free (name); - } - - prim_a = cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLES, - 8, /* n_vertices */ - attributes, - N_ATTRIBS); - - indices = cogl_indices_new (test_ctx, - COGL_INDICES_TYPE_UNSIGNED_SHORT, - indices_data, - 2 /* n_indices */); - - cogl_primitive_set_first_vertex (prim_a, 12); - cogl_primitive_set_indices (prim_a, indices, 2); - - prim_b = cogl_primitive_copy (prim_a); - - p = attributes_a; - cogl_primitive_foreach_attribute (prim_a, - get_attributes_cb, - &p); - g_assert_cmpint (p - attributes_a, ==, N_ATTRIBS); - - p = attributes_b; - cogl_primitive_foreach_attribute (prim_b, - get_attributes_cb, - &p); - g_assert_cmpint (p - attributes_b, ==, N_ATTRIBS); - - qsort (attributes_a, N_ATTRIBS, sizeof (CoglAttribute *), compare_pointers); - qsort (attributes_b, N_ATTRIBS, sizeof (CoglAttribute *), compare_pointers); - - g_assert (memcmp (attributes_a, attributes_b, sizeof (attributes_a)) == 0); - - g_assert_cmpint (cogl_primitive_get_first_vertex (prim_a), - ==, - cogl_primitive_get_first_vertex (prim_b)); - - g_assert_cmpint (cogl_primitive_get_n_vertices (prim_a), - ==, - cogl_primitive_get_n_vertices (prim_b)); - - g_assert_cmpint (cogl_primitive_get_mode (prim_a), - ==, - cogl_primitive_get_mode (prim_b)); - - g_assert (cogl_primitive_get_indices (prim_a) == - cogl_primitive_get_indices (prim_b)); - - g_object_unref (prim_a); - g_object_unref (prim_b); - g_object_unref (indices); - - for (i = 0; i < N_ATTRIBS; i++) - g_object_unref (attributes[i]); - - g_object_unref (buffer); -} - static void test_primitive (void) { @@ -329,7 +170,6 @@ test_primitive (void) 100); test_paint (&state); - test_copy (&state); if (cogl_test_verbose ()) g_print ("OK\n"); diff --git a/src/wayland/meta-wayland-buffer.c b/src/wayland/meta-wayland-buffer.c index ee9d51feb6cf817a624e5ceb8234c7b354df39e6..d21d4bef2f08831bb4b559c33c94106c99892427 100644 --- a/src/wayland/meta-wayland-buffer.c +++ b/src/wayland/meta-wayland-buffer.c @@ -53,7 +53,6 @@ #include "backends/meta-backend-private.h" #include "clutter/clutter.h" -#include "cogl/cogl-egl.h" #include "meta/util.h" #include "wayland/meta-wayland-dma-buf.h" #include "wayland/meta-wayland-private.h" @@ -184,7 +183,7 @@ meta_wayland_buffer_realize (MetaWaylandBuffer *buffer) meta_backend_get_clutter_backend (backend); CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend); - EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context); + EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context); if (meta_egl_query_wayland_buffer (egl, egl_display, buffer->resource, EGL_TEXTURE_FORMAT, &format, @@ -481,7 +480,7 @@ egl_image_buffer_attach (MetaWaylandBuffer *buffer, MetaEgl *egl = meta_backend_get_egl (backend); ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend); CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend); - EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context); + EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context); int format, width, height, y_inverted; CoglPixelFormat cogl_format; EGLImageKHR egl_image; @@ -540,7 +539,7 @@ egl_image_buffer_attach (MetaWaylandBuffer *buffer, return FALSE; flags = COGL_EGL_IMAGE_FLAG_NONE; - texture_2d = cogl_egl_texture_2d_new_from_image (cogl_context, + texture_2d = cogl_texture_2d_new_from_egl_image (cogl_context, width, height, cogl_format, egl_image, diff --git a/src/wayland/meta-wayland-dma-buf.c b/src/wayland/meta-wayland-dma-buf.c index 499e086628502d1bc6548b42e4d793033e72135b..8a2b0ec6601e3d5ec31443ddcc63ead0502a1eb4 100644 --- a/src/wayland/meta-wayland-dma-buf.c +++ b/src/wayland/meta-wayland-dma-buf.c @@ -48,7 +48,6 @@ #include "backends/meta-backend-private.h" #include "backends/meta-egl-ext.h" #include "backends/meta-egl.h" -#include "cogl/cogl-egl.h" #include "cogl/cogl.h" #include "common/meta-cogl-drm-formats.h" #include "common/meta-drm-format-helpers.h" @@ -174,7 +173,7 @@ should_send_modifiers (MetaBackend *backend) ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend); CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend); - EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context); + EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context); #ifdef HAVE_NATIVE_BACKEND if (META_IS_BACKEND_NATIVE (backend)) @@ -366,7 +365,7 @@ meta_wayland_dma_buf_realize_texture (MetaWaylandBuffer *buffer, MetaEgl *egl = meta_backend_get_egl (backend); ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend); CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend); - EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context); + EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context); MetaWaylandDmaBufBuffer *dma_buf = buffer->dma_buf.dma_buf; MetaMultiTextureFormat multi_format; CoglPixelFormat cogl_format; @@ -427,7 +426,7 @@ meta_wayland_dma_buf_realize_texture (MetaWaylandBuffer *buffer, return FALSE; flags = COGL_EGL_IMAGE_FLAG_NO_GET_DATA; - cogl_texture = cogl_egl_texture_2d_new_from_image (cogl_context, + cogl_texture = cogl_texture_2d_new_from_egl_image (cogl_context, dma_buf->width, dma_buf->height, cogl_format, @@ -489,7 +488,7 @@ meta_wayland_dma_buf_realize_texture (MetaWaylandBuffer *buffer, return FALSE; flags = COGL_EGL_IMAGE_FLAG_NO_GET_DATA; - cogl_texture = cogl_egl_texture_2d_new_from_image (cogl_context, + cogl_texture = cogl_texture_2d_new_from_egl_image (cogl_context, dma_buf->width, dma_buf->height, subformat, @@ -1820,7 +1819,7 @@ meta_wayland_dma_buf_manager_new (MetaWaylandCompositor *compositor, MetaEgl *egl = meta_backend_get_egl (backend); ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend); CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend); - EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context); + EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context); dev_t device_id = 0; int protocol_version; EGLDeviceEXT egl_device; diff --git a/src/wayland/meta-wayland-egl-stream.c b/src/wayland/meta-wayland-egl-stream.c index 1a0fe62000a88bfea88085839fe25acec38dbd47..fff6df7845b19d861cae07aee974f2df79bd64da 100644 --- a/src/wayland/meta-wayland-egl-stream.c +++ b/src/wayland/meta-wayland-egl-stream.c @@ -29,7 +29,6 @@ #include "backends/meta-backend-private.h" #include "backends/meta-egl-ext.h" #include "backends/meta-egl.h" -#include "cogl/cogl-egl.h" #include "meta/meta-backend.h" #include "wayland/meta-wayland-buffer.h" #include "wayland/meta-wayland-private.h" @@ -153,7 +152,7 @@ meta_wayland_egl_stream_new (MetaWaylandBuffer *buffer, MetaEgl *egl = meta_backend_get_egl (backend); ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend); CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend); - EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context); + EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context); EGLAttrib stream_attribs[] = { EGL_WAYLAND_EGLSTREAM_WL, (EGLAttrib) buffer->resource, EGL_NONE @@ -200,7 +199,7 @@ alloc_egl_stream_texture (CoglTexture2D *texture, MetaEgl *egl = meta_backend_get_egl (backend); ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend); CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend); - EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context); + EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context); return meta_egl_stream_consumer_gl_texture_external (egl, egl_display, stream->egl_stream, @@ -217,7 +216,7 @@ meta_wayland_egl_stream_create_texture (MetaWaylandEglStream *stream, MetaEgl *egl = meta_backend_get_egl (backend); ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend); CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend); - EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context); + EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context); CoglTexture *texture; int width, height; int y_inverted; @@ -275,7 +274,7 @@ meta_wayland_egl_stream_attach (MetaWaylandEglStream *stream, MetaEgl *egl = meta_backend_get_egl (backend); ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend); CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend); - EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context); + EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context); EGLint stream_state; if (!meta_egl_query_stream (egl, egl_display, stream->egl_stream, @@ -328,7 +327,7 @@ meta_wayland_is_egl_stream_buffer (MetaWaylandBuffer *buffer) MetaEgl *egl = meta_backend_get_egl (backend); ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend); CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend); - EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context); + EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context); int stream_fd; if (!meta_egl_has_extensions (egl, egl_display, NULL, @@ -355,7 +354,7 @@ meta_wayland_egl_stream_finalize (GObject *object) MetaEgl *egl = meta_backend_get_egl (backend); ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend); CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend); - EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context); + EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context); g_assert (!stream->texture); diff --git a/src/wayland/meta-wayland-linux-drm-syncobj.c b/src/wayland/meta-wayland-linux-drm-syncobj.c index 710a019c3043e0c951b06b71ddecbe99c8bef876..3f2fed6bfa89b9f99a60ebe5b86cf4e9f94815eb 100644 --- a/src/wayland/meta-wayland-linux-drm-syncobj.c +++ b/src/wayland/meta-wayland-linux-drm-syncobj.c @@ -455,7 +455,7 @@ meta_wayland_drm_syncobj_manager_new (MetaWaylandCompositor *compositor, MetaEgl *egl = meta_backend_get_egl (backend); ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend); CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend); - EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context); + EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context); MetaWaylandDrmSyncobjManager *drm_syncobj_manager; EGLDeviceEXT egl_device; g_autofd int drm_fd = -1; diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c index fd58e33f14142a6f9b470d45052a8a1d82efc4d3..d42cbd16cb794dbf2c09259ca9cd7cf62668cb99 100644 --- a/src/wayland/meta-wayland.c +++ b/src/wayland/meta-wayland.c @@ -34,7 +34,6 @@ #endif #include "clutter/clutter.h" -#include "cogl/cogl-egl.h" #include "compositor/meta-surface-actor-wayland.h" #include "core/events.h" #include "core/meta-context-private.h" @@ -759,7 +758,7 @@ meta_wayland_init_egl (MetaWaylandCompositor *compositor) ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend); CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend); - EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context); + EGLDisplay egl_display = cogl_context_get_egl_display (cogl_context); g_autoptr (GError) error = NULL; if (!meta_egl_has_extensions (egl, egl_display, NULL,