1
0
Fork 0
Commit graph

3105 commits

Author SHA1 Message Date
Bilal Elmoussaoui
2955b4b855 cogl/pango: Remove unused functions & declarations
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4004>
2024-10-08 16:00:57 +00:00
Sebastian Wick
077eb80a8d gir: Correct usage of the closure annotation
Quoting Ebassi https://www.bassi.io/articles/2023/02/20/bindable-api-2023/:

    Whenever you’re describing a function that takes a callback, you
    should always annotate the callback argument with the argument that
    contains the user data using the (closure argument) annotation

    You should not annotate the data argument with a unary (closure).

    The unary (closure) is meant to be used when annotating the callback
    type

Recently gobject-introspection became a bit more strict with this and
that generated some warnings:

    Warning: Cogl: invalid "closure" annotation: only valid on callback
    parameters

This commit fix all the closure annotations.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4058>
2024-10-01 15:39:18 +02:00
Robert Mader
8e912a09d1 build: Disable asserts and cast checks in Mutter
For non-debug and non-plain cases - i.e. mainly release builds.

This ensures we use the same options in all places and draws a cleaner
distinction between g_assert() and g_return_if_fail() - the later will
still be done in release build while the former are meant for debug
only.

One advantage of doing this is that it allows us to use non-trivial
asserts more generously, such as calling `g_list_length()`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3424>
2024-09-24 14:07:23 +00:00
Joan Torres
be39717639 cogl/pipeline/glsl: Display uniform updates on debug "show-uniforms"
When running with COGL_DEBUG=show-uniforms, display the values of the
uploaded uniforms.

This helps because it's not possible to know the uniform values only from
the shader source.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3965>
2024-09-23 20:50:31 +00:00
Joan Torres
9c0200570a cogl/boxed-value: Add function _cogl_boxed_value_to_string
This function returns a string of the boxed value considering type, size
and count; and adds a name.
e.g:

  vec2 scale = vec2(1.0000, 1.0000)

Also handle NULL cases on _cogl_boxed_value_equal.

This will be used by the next commit.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3965>
2024-09-23 20:50:31 +00:00
Joan Torres
1eba07f64f cogl/boxed-value: On _cogl_boxed_value_set_x, simplify mem alloc
Use _cogl_boxed_value_destroy to free the correspondent array instead of
free, which was only freeing float_array.

Add a new func _cogl_boxed_value_array_alloc to allocate the
corresponding array considering the type.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3965>
2024-09-23 20:50:31 +00:00
Joan Torres
3e629256ce cogl/boxed-value: On _cogl_boxed_value_set_x, update copying values
_cogl_boxed_value_transpose is only used for the matrix type.
Now is named _cogl_boxed_value_copy_transposed_value.
Gets the transposed value considering count (to store in array type or not).
The caller doesn't have to worry about count anymore.

Instead of calling memcpy, add function _cogl_boxed_value_copy_value
which copies the value to the corresponding boxed value property
considering type and count.
The caller doesn't have to worry about type and count anymore.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3965>
2024-09-23 20:50:31 +00:00
Joan Torres
afdd0be161 cogl/boxed-value: Use array types properly
There are three array properties, considering type:
1. float *float_array
2. int *int_array
3. void *array

Drop using array. This was inteded to be used when type is matrix and
count > 1, however some functions use it and others use
float_array. Fix this using always float_array, this starts to make all funcs
consistent handling the properties.

There's a mem leak when destroying the boxed value, only freeing the array
prop. Free the corresponding array considering the boxed value type to fix it.

_cogl_boxed_value_set_x func is still inconsistent, the next commits
will solve it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3965>
2024-09-23 20:50:31 +00:00
Daniel van Vugt
338bd62708 cogl/gles: Don't initialize glGetStringi
We never use it for ES, and for good reason: It only exists in ES 3.0
while our ES path only supports 2.0.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4019>
2024-09-20 15:29:06 +00:00
Daniel van Vugt
010d68ed5a cogl/gl: Don't initialize potentially unused/unsupported functions
`_cogl_context_get_gl_extensions` is their only user and it only uses
them for GL 3.0 so do the GL version check first.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4019>
2024-09-20 15:29:06 +00:00
Daniel van Vugt
390dd63341 cogl: Don't _cogl_context_get_gl_extensions before check_gl_version
Because for `COGL_DRIVER_GL3`, `_cogl_context_get_gl_extensions` needs to
know that the GL version *really* is >= 3.0 before it calls `glGetStringi`
which didn't exist prior to GL 3.0 or ES 3.0.

This was causing crashes on Xilinx Mali implementations that only support
ES 2.0 (hence `glGetStringi` == NULL), but were being forced to call
that function before the GL version check which should tell you the
function isn't supported.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4019>
2024-09-20 15:29:05 +00:00
Daniel van Vugt
656b836c62 cogl/egl: Restore support for EGL 1.4
It was dropped in 46.0 (683e917854) but we've now found that Xilinx Mali
only implements a strict interpretation of 1.4 [1] which doesn't support
looking up core functions [2] such as `glGetString`.

[1] https://github.com/Xilinx/mali-userspace-binaries/blob/master/Standards.txt
[2] https://registry.khronos.org/EGL/specs/eglspec.1.4.pdf § 3.10

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4019>
2024-09-20 15:29:05 +00:00
Sebastian Wick
2ce64ac0c3 cogl/gles: Use unsized internal formats for RGB8, RGBA8 in GLES 2.0
GLES 2.0 does not have RGB8 and RGBA8 as sized internal formats. There
is OES_rgb8_rgba8 which adds RGB8 and RGBA8 but only for
RenderbufferStorageOES and not for TexImage2D which I wrongly assumed.
It seems like there is currently no GLES2 extension which adds RGB8 and
RGBA8 to TexImage2D so we have no choice but to fall back to unsized
internal formats in those cases as long as we don't want to drop GLES2
support.

This should be fine in practice and we should get our 8bpc textures.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3680
Fixes: 7f943613a8 ("cogl: Use sized internal renderable formats")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4036>
2024-09-19 04:48:03 +00:00
Sebastian Keller
2eddf35625 cogl/trace: Fix build without profiler
When !3952 introduced the new tracing macros, they were only defined in
the HAVE_PROFILER case, causing builds without profiler support to fail.

Also it introduced an unconditional call to cogl_is_tracing_enabled()
which is not available without HAVE_PROFILER.

Fixes: 777c63507 ("cogl/trace: Allow defining and setting sysprof trace counters")
Fixes: 322ac42a6 ("stage-impl: Trace the damage region")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3991>
2024-08-31 18:47:32 +02:00
Sebastian Wick
777c635076 cogl/trace: Allow defining and setting sysprof trace counters
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3952>
2024-08-30 22:09:55 +00:00
Bilal Elmoussaoui
5f5448b180 cogl/texture: Expose Texture.get_context
Would be useful for next commit

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
2024-08-29 15:26:40 +02:00
Bilal Elmoussaoui
60edafe3eb cogl/pango: Drop mipmapping API/env variables
As GNOME Shell always sets that to FALSE anyways
This does not drop the separate caching whether the mipmapping is
disabled or not, in case shell wants to make use of that in the future

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3962>
2024-08-22 16:45:01 +00:00
Sebastian Wick
45dcfeb0cc cogl/gles: Revert to unsized GL_BGRA as internalformat for BGRA_8888
Using GL_BGRA8_EXT as internalformat for TexSubImage2D was not allowed
in the EXT_texture_format_BGRA8888 extension. This changed recently:

https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_format_BGRA8888.txt

  1.4, 23/06/2024 Erik Faye-Lund: Add GL_BGRA8_EXT for ES 2.0 and later.

Mesa already supports this which is why 7f943613a8 ("cogl: Use sized
internal renderable formats") worked as intended. Technically spec
compliant and our CI had an up-to-date driver.

So while this is no bug, it's still not great because older drivers will
generate GL errors. This commit changes this specific format back to an
unsized internal format which means we could, in theory, get less than
8bpc framebuffers.

We can try to revert this commit when newer driver versions have
propagated far enough.

Fixes: 7f943613a8 ("cogl: Use sized internal renderable formats")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3954>
2024-08-16 14:24:38 +00:00
Sebastian Wick
ce5f97fde1 cogl/gles: Explain GLES2 requirement of matching internalformat & format
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3914>
2024-08-14 12:17:18 +00:00
Sebastian Wick
c3eb01e547 cogl/gles: Use the GL_BGRA8_EXT internalformat instead of the format
There is one define for the format (GL_BGRA_EXT) and one for the
internal format (GL_BGRA8_EXT). Use them appropriately.

This also adds defines to consistenly not use the _EXT postfix.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3914>
2024-08-14 12:17:18 +00:00
Sebastian Wick
d820fe030a cogl/gles: Use a premul required format for opaque fp16 Cogl formats
The opaque fp16 Cogl format variants need a required format that is
already premultiplied whereas the fp16 formats with an alpha channel can
be either straight or premult.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3914>
2024-08-14 12:17:18 +00:00
Sebastian Wick
41700d3cc7 cogl/gl: Use internal formats without alpha for non-alpha Cogl formats
The formats COGL_PIXEL_FORMAT_RGB_888 and COGL_PIXEL_FORMAT_BGR_888 for
the gl driver were using internal formats with an alpha channel.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3914>
2024-08-14 12:17:18 +00:00
Bilal Elmoussaoui
4ea693bc20 surface-actor: Pass damage area as MtkRectangle
All the corresponding calls ends up creating a rectangle anyways

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3945>
2024-08-13 14:08:48 +02:00
Michel Dänzer
61ae9eedb6 cogl: Update latest sync fd also from cogl_gl_framebuffer_flush/finish
This ensures that any drawing for screen casting is reflected in the
sync fd.

Fixes: 99209958b9 ("cogl: Store latest GPU work completed sync fd")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3946>
2024-08-13 09:52:34 +00:00
Marco Trevisan (Treviño)
07023b65bc cogl/color: Do not make cogl_color_free introspectable
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3925>
2024-08-06 01:27:12 -06:00
Marco Trevisan (Treviño)
d422cddc2e cogl/color: Ensure Cogl.Color.equal() is introspectable
We need to explicitly define the type, being a generic const pointer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3925>
2024-08-06 01:23:55 -06:00
Jonas Ådahl
de76e007b5 cogl: Fix some whitespace issues
The removal of the onscreen template left some function definitions and
declarations incorrectly indented.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3923>
2024-08-05 21:31:43 +02:00
Sebastian Wick
c5e9f028b2 cogl: Provide backwards compat for GLSL version 140 shaders
We still use GLSL 100 syntax which means `varying`, `attribute` and
`gl_FragColor` but GLSL 140 wants us to use `in` and `out`. This
provides some simple `#define`s to make it still look like the GLSL 100
syntax is supported.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3907>
2024-08-05 17:57:11 +00:00
Sebastian Wick
ea696ae4b1 cogl: Repace codegen_boilerplate_buffer with a local variable
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3907>
2024-08-05 17:57:11 +00:00
Sebastian Wick
94806c98bf cogl: Derive GLSL version from major, minor and GL vs GLES
The GLSL version can be derived from the major and the minor, with the
exception that GLSL ES versions require the "es" suffix.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3907>
2024-08-05 17:57:11 +00:00
Sebastian Wick
e122943bcd cogl/gl: Check GLSL version and unify GL context version checks
This adds a check which makes sure that the required GLSL/GLSL ES
versions are supported.

It also splits out the GLES version check into its own function, just
like GL does.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3907>
2024-08-05 17:57:11 +00:00
Sebastian Wick
74917e1b07 cogl/gl: Use g_auto (GStrv) and g_autofree in more cases
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3907>
2024-08-05 17:57:11 +00:00
Bilal Elmoussaoui
5277e33d37 cogl: Remove no longer used OnscreenTemplate
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3915>
2024-08-05 15:47:29 +00:00
Bilal Elmoussaoui
3b386ba5d7 cogl: Remove no longer used FramebufferConfig
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3915>
2024-08-05 15:47:29 +00:00
Bilal Elmoussaoui
833070ab79 cogl: Remove need_stencil config
As it is always set to TRUE

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3915>
2024-08-05 15:47:29 +00:00
Bilal Elmoussaoui
41ec1aa0ca cogl: Remove use_stereo_stage config
Nothing sets it from the X11 backend API, so just get rid of it

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3915>
2024-08-05 15:47:29 +00:00
Bilal Elmoussaoui
a1828e7212 cogl: Remove samples_per_pixel config
It is only set through an undocumented env variable

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3915>
2024-08-05 15:47:29 +00:00
Bilal Elmoussaoui
b9269abaf5 cogl: Remove unused Error types
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3910>
2024-08-01 11:06:33 +00:00
Bilal Elmoussaoui
e43d9d7e75 cogl/indices: Add a IndicesType.get_size
To de-duplicate that code

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3910>
2024-08-01 11:06:33 +00:00
Bilal Elmoussaoui
609f7e3fe1 cogl: Remove unused OnScreenTemplate.set_samples_per_pixel
Not sure if we want to keep that env variable around

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3910>
2024-08-01 11:06:33 +00:00
Bilal Elmoussaoui
a71ad8e861 cogl/list: Remove unused API
Ideally, I think we might have to replace CoglList usage
as the over-complicated macros makes it hard to parse

But that is a task for another day

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3910>
2024-08-01 11:06:33 +00:00
Bilal Elmoussaoui
2d25b114e6 cogl/buffer: Use set_data helper
That ignores the error param, which is the behaviour
we always had. Changing that to propagate the error
would make the API ugly, so it is fine to remove?

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3910>
2024-08-01 11:06:33 +00:00
Bilal Elmoussaoui
beb9ecdbc4 cogl: Remove no longer useful Since annotation
Spotted in previous commit

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3910>
2024-08-01 11:06:33 +00:00
Bilal Elmoussaoui
a05caa6338 cogl/texture2d: Rename from_egl_image constructor
Similar to the from_egl_image_external one, to give it the correct
namespace

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3910>
2024-08-01 11:06:33 +00:00
Bilal Elmoussaoui
a9ec604eba cogl/renderer: Expose handle_event
As it was originally the function to be used before
making it private and providing safer wrappers around it for x11/win32.

Nowadays, it is only used in x11 and only internally in mutter, exposing
a 'safer' variant costs us exposing more of x11 renderer APIs without
much benefits.

With this change, the only internal xlib renderer we need from meta is
set_foreign_display which can't be easily worked around

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3910>
2024-08-01 11:06:33 +00:00
Bilal Elmoussaoui
b07c772fc8 cogl: Rename Shader/Program constructors
Otherwise they end up as global functions instead of constructors
of their corresponding types. Helps with better docs

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3910>
2024-08-01 11:06:33 +00:00
Bilal Elmoussaoui
716f23c7c1 cogl/pixel-format: Make CAN_HAVE_PREMULT an inlined function
To avoid exposing the function macro in the gir file & so the docs

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3910>
2024-08-01 11:06:33 +00:00
Bilal Elmoussaoui
162b8e1a15 cogl: Remove no longer useful UNAVAILABLE macro
It is no longer a separate library

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3910>
2024-08-01 11:06:33 +00:00
Bilal Elmoussaoui
5d7c4bccd8 cogl: Make BlendStringError private
It is a private API

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3910>
2024-08-01 11:06:33 +00:00
Bilal Elmoussaoui
4bd974222e cogl: Make RendererConstraint private
It is only used internally

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3910>
2024-08-01 11:06:33 +00:00