1
0
Fork 0
mutter-performance-source/cogl
Thomas Hindoe Paaboel Andersen d992722c24 cogl: correct check for COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL
In _cogl_offscreen_gl_allocate we only want to perform certain actions if
COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL is not set in create_flags.

We perfrom this check with:

if (!offscreen->create_flags & COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL)

which is not correct as we negate the create_flags before the bitwise &.

It happens to work as intended though, as CoglOffscreenFlags only has one
element, and that element has the value 1. If the flag is not set then the
nagation of create_flags is true and the bitwise and with the element value
is true as well.
If any flag is set then the negation will give 0 and the bitwise & will be
false.

So while it works correctly it is fragile as either additional flags or a
change in the enum element value will break this check. This patch makes
things a bit more safe by adding parentheses to let the bitwise & happen
before the negation.

Definition of the enum:

typedef enum
{
  COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL = 1
} CoglOffscreenFlags;

https://gitlab.gnome.org/GNOME/mutter/merge_requests/938
2019-11-16 00:13:59 +01:00
..
cogl cogl: correct check for COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL 2019-11-16 00:13:59 +01:00
cogl-pango cogl: Remove COGL_PRIVATE_FEATURE_QUADS 2019-10-21 21:43:07 +00:00
cogl-path cogl: Drop _COGL_RETURN_VAL_IF_FAIL macro 2019-06-19 21:46:22 +02:00
test-fixtures cogl: Remove always-set COGL_FEATURE_ID_OFFSCREEN 2019-10-21 21:43:08 +00:00
tests test: Remove unreferenced test-texture-rectangle 2019-11-07 12:47:23 +00:00
.gitignore cogl-framebuffer: Remove swap_throttled config 2018-12-06 14:29:34 +00:00
cogl-config.h.meson cogl: Add libsysprof capture based tracing 2019-05-31 11:55:56 -03:00
cogl-mutter-config.h.in cogl: Make cogl-config.h include check explicit 2018-11-06 17:17:36 +01:00
config-custom.h move everything into a cogl/ directory 2016-04-22 16:44:31 +02:00
meson.build Add Graphene dependency 2019-10-16 11:38:13 +00:00