This splits out the GL version parser code from
cogl-driver-gl.c:_cogl_get_gl_version() so it can also be used for
parsing other gl version strings.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 66c2e74b9d61669fb5b93cf9a31cc8659a601fdd)
The function pointer for texture_2d_get_data in the driver vtable was
expecting an unsigned int for the rowstride but the definition in
cogl-texture-2d-gl.c took a size_t so it was giving an annoying
warning. This normalizes them both to just take an int. This seems to
better match the pattern used for cogl_bitmap_new_from_data and
cogl_texture_2d_new_from_data.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 003f080531d5368835081568779b031ef4f09a77)
This adds a new "fixed-arbfp" progend so we now have 3 distinct ways of
setting up the state of a pipeline:
» fixed; where the vertex and fragment processing are implemented
using fixed function opengl apis.
» fixed-arbfp; where vertex processing is implemented using fixed
function opengl apis but fragment processing is implemented
using the ARB Fragment Processing language.
» glsl; there vertex and fragment processing are both implemented
using glsl.
This means we avoid unusual, combinations such as glsl for vertex
processing and arbfp for fragment processing, and also avoid pairing
fixed-function vertex processing with glsl fragment processing which we
happen to know hits some awkward code paths in Mesa that lead to poor
performance.
As part of this change, the progend now implies specific vertend and
fragend choices so instead of associating a vertend and fragend with a
pipeline we now just associate a progend choice.
When flushing a pipeline and choosing what progend to use, we now call a
progend->start() method that is able to determine if the vertend and
fragend together will be able to handle the given pipeline so the
vertend and fragend ->start() methods no longer need to return a boolean
status.
Since we now don't need to support glsl used in conjunction with fixed
function this will allow us to avoid ever using OpenGL builtin attribute
names, though this patch doesn't change that yet.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit cec381f50c7a2f2186bd4a8c5f38fecd5f099075)
There is some fairly awkward #ifdefing to determine which vertends,
fragends and progends are available at build time. This patch
consolidates the #ifdefing of vertend, fragend and progend defines to
make for slightly easier reading.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 098d6244bf7c8f2a4ca24206c6e8271d589ed4c9)
There was a spurious duplication of the COGL_PIPELINE_VERTEND_DEFAULT
and COGL_PIPELINE_VERTEND_UNDEFINED defines which this patch removes.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 1bcf34bd3eb0134b7ef1b30cba91d3e70a23e5ed)
The COGL_PIPELINE_FRAGEND_XYZ_MASK and COGL_PIPELINE_VERTEND_XYZ_MASK
defines aren't used any more so this patch simply removes them.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 119b0d771a4be2550ce1ca1e789db5b22776b066)
This removes an optimization that I added at some point, which I'm
pretty certain I only added on a hunch. Reading the description I'm not
really convinced it makes sense to do this given that the fixed vertend
and fragend are currently listed before the glsl vertend and fragend in
the order that we look for a suitable backend. This means unless the
pipeline depends on glsl (e.g. due to an associated snippet) we would
reselect the fixed backend anyway, and if it really did depend on glsl
then we'd notice when we come to flush and switch backends there any way.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 071698d2c017af33e41b838429d514f5df5e02a1)
As part of an on-going effort to be able to support non-opengl drivers
for Cogl this splits out the opengl specific code from cogl-buffer.c
into driver/gl/cogl-buffer-gl.c
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 4d7094a979ff2cbbe4054f4a44ca05fc41a9e447)
The buffer and bitmap _bind() functions are GL specific so to clarify
that, this patch adds a _gl infix to these functions, though it doesn't
yet move the implementations out into gl specific files.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 6371fbb9637d88ff187dfb6c4bcd18468ba44d19)
This moves the decision about whether a buffer should be allocated using
malloc or not into cogl-buffer.c closer to the driver since it seem
there could be other driver specific factors that might also influence
this choice that we don't currently consider.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 06d46f10bf755d3009c28904e616a0adb4586cf5)
As part of an on-going effort to enable non-opengl drivers for Cogl this
splits out the opengl specific code in cogl-clip-stack.c into
cogl/driver/cogl-clip-stack-gl.c
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit acf989f1bb628282c53d1249b2e3fc6f6579f1e9)
This adds a new "nop" driver that does nothing. This can be selected at
runtime either with the COGL_DRIVER=nop environment variable or by
passing COGL_DRIVER_NOP to cogl_renderer_set_driver()
Adding the nop driver gives us a way to test workloads without any
driver and hardware overheads which can help us understand how Cogl's
state tracking performs in isolation.
Having a nop driver can also serve as an shell/outline for creating
other drivers later.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 90587418233b6438290741d80aedf193ae660cad)
As part of an on-going effort to enable non-opengl drivers for Cogl this
splits out the GL specific code in cogl-attribute.c into
cogl/driver/gl/cogl-attribute-gl.c
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 7e20c39c47fa176aa5062867ff273bc2c41a2f22)
As part of an on-going effort to avoid depending on a global Cogl
context cogl-blit.c now finds the context by looking at
data->src_text->context instead of using the _COGL_GET_CONTEXT macro.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 3f2c99150494efc04487d0dbd17980bac20e4485)
This factors out all of the OpenGL specific code in cogl-texture-2d.c
into cogl-texture-2d-gl.c and where necessary adds indirection through
the CoglDriver vtable so that we can eventually start to experiment with
non-OpenGL backends for Cogl.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit ec57588671696bbe7ce714bdfe7324236146c9c0)
This renames the set_filters and set_wrap_mode_parameters texture
virtual functions to gl_flush_legacy_texobj_filters and
gl_flush_legacy_texobj_wrap_modes respectively to clarify that they are
opengl driver specific and that they are only used to support the legacy
opengl apis for setting filters and wrap modes where the state is
associated with texture objects instead of being associated with sampler
objects.
This part of an effort to clearly delimit our abstraction over opengl so
that we can start to consider non-opengl backends for Cogl.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 6f78b8a613340d7c6b736e51a16c625f52154430)
If we're using the system glib library then we need to make sure not to
include headers under deps/glib otherwise we end up with with
incompatible typedefs that break the build.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5d5fc97b59951ec56a4193b7ee7909ebd3cfbb94)
glib's configure.ac uses libtool to determine the extension of shared
libraries. So let's generate the libtool file early in configure.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit ae457e0e2463bcec4f5891778e8ada9924f91be7)
This SDL example were unnecessarily including <glib.h> but they don't
actually depend on glib so now they are built even if Cogl is being
built with --disable-glib.
(cherry picked from commit 1d3bce7f68b0a6885c10a29cd9836a3541a1b653)
This option will generate a libcogl2 DSO that depends on the least
possible external libraries.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 6357960e1b91081546adf1bb110067d7db4d7400)
This commit pushes --disable-glib to the extreme of embedding the par of
glib cogl depends on in tree to be able to generate a DSO that does not
depend on an external glib.
To do so, it:
- keeps a lot of glib's configure.ac in as-glibconfig.m4
- pulls the code cogl depends on and the necessary dependencies
Reviewed-by: Robert Bragg <robert@linux.intel.com>
Although we use GLib internally in Cogl we would rather not leak GLib
api through Cogl's own api, except through explicitly namespaced
cogl_glib_ / cogl_gtype_ feature apis.
One of the benefits we see to not leaking GLib through Cogl's public API
is that documentation for Cogl won't need to first introduce the Glib
API to newcomers, thus hopefully lowering the barrier to learning Cogl.
This patch provides a Cogl specific typedef for reporting runtime errors
which by no coincidence matches the typedef for GError exactly. If Cogl
is built with --enable-glib (default) then developers can even safely
assume that a CoglError is a GError under the hood.
This patch also enforces a consistent policy for when NULL is passed as
an error argument and an error is thrown. In this case we log the error
and abort the application, instead of silently ignoring it. In common
cases where nothing has been implemented to handle a particular error
and/or where applications are just printing the error and aborting
themselves then this saves some typing. This also seems more consistent
with language based exceptions which usually cause a program to abort if
they are not explicitly caught (which passing a non-NULL error signifies
in this case)
Since this policy for NULL error pointers is stricter than the standard
GError convention, there is a clear note in the documentation to warn
developers that are used to using the GError api.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit b068d5ea09ab32c37e8c965fc8582c85d1b2db46)
Note: Since we can't change the Cogl 1.x api the patch was changed to
not rename _error_quark() functions to be _error_domain() functions and
although it's a bit ugly, instead of providing our own CoglError type
that's compatible with GError we simply #define CoglError to GError
unless Cogl is built with glib disabled.
Note: this patch does technically introduce an API break since it drops
the cogl_error_get_type() symbol generated by glib-mkenum (Since the
CoglError enum was replaced by a CoglSystemError enum) but for now we
are assuming that this will not affect anyone currently using the Cogl
API. If this does turn out to be a problem in practice then we would be
able to fix this my manually copying an implementation of
cogl_error_get_type() generated by glib-mkenum into a compatibility
source file and we could also define the original COGL_ERROR_ enums for
compatibility too.
Note: another minor concern with cherry-picking this patch to the 1.14
branch is that an api scanner would be lead to believe that some APIs
have changed, and for example the gobject-introspection parser which
understands the semantics of GError will not understand the semantics of
CoglError. We expect most people that have tried to use
gobject-introspection with Cogl already understand though that it is not
well suited to generating bindings of the Cogl api anyway and we aren't
aware or anyone depending on such bindings for apis involving GErrors.
(GnomeShell only makes very-very minimal use of Cogl via the gjs
bindings for the cogl_rectangle and cogl_color apis.)
The main reason we have cherry-picked this patch to the 1.14 branch
even given the above concerns is that without it it would become very
awkward for us to cherry-pick other beneficial patches from master.
Instead of using the variable to use in Makefile.ams.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 016f2276823a8a8cde33d3e7062c61469921a9f1)
--disable-nls can be used to compile cogl without i18n support. Let's
indicate the i18n enabling status so curious people can deduce it can be
compiled out.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 1ccaafa31dbc0c9b9184d61079b2deff913d8e25)
But use cogl_test_verbose() instead.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 77efc7428d9ad18c2db1e3fdb544efa091249eaf)
GKeyFile is a bit too much to import in a standalone build for my taste
as it depends on the encoding part of glib.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 9af04f0d8813b7f6f7117e1cc2a38ae2b8d04cdd)
It seems logical to first look for the compiler and then run the rest of
configure script (which will use the compiler with small snippets).
Same goes for the libtool initializaton, you might as well do it not too
far from the automake one.
This also happens to be preparatory work to compile cogl with an in-tree
copy of some glib files as the glib's configure script needs those
checks early.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit ba452ea4a48e48324ee7382b7ccb9065c255f55a)
--disable-glib also defines COGL_HAS_GTYPE_SUPPORT to #ifdef out GType
support in cogl. This also means we don't want to initialize glib's type
system in that case.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 67ad777099d62bdbc8515f6ee58ed80429cc6496)
test-journal needs cogl_glib_source_new() which is not available when
compiling cogl with --disable-glib.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 71fadbbfacad6a7c0ed7b06252d1e5e5dadf66f5)
As part of an effort towards being able to write non-opengl based
backends for Cogl this moves most of the opengl specific code under
drivers/gl. drivers/gl and drivers/gles have been moved to
drivers/gl/gl and drivers/gl/es respectively.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 7dc482facb0a265c7f48660079e7e12dd7a2813e)
As far as I can tell the --symbol-prefix option wasn't there before
glib 2.32's glib-mkenums. So cogl effectively depends on glib 2.32.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 4e952532a29b2566caf658705f815b7aec732265)
Clean compiler output is a must! that also means imported source code
from other projects. I can't be bothered to submit a patch upstream,
because last time it was totally ignored by the stb_image guy.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit b43b1eac77e2f13d126e2211e12dc0c6d152716e)
As Cogl is not thread safe, we don't really need a thread safe
cogl_init() function.
This also reduces the amount of dependency cogl has on glib, handy when
we want to create a standalone version of cogl, some day.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 429e49e3028a425eb198d8969dfbf57790e2e72a)
We should be able to modify/add README files else where in the tree and
see them with git status, eg build/mingw/README.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit e97a1bb33a10dc4ea8a23a30cd5e78391439c84f)
This type is not documented and is experimental. We don't use
COGL_RENDERER_ERROR_NOT_FOUND and it's pretty vague anyway, just remove
it.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit ffa78534616547b9bd4cd5c0ade8fdc039a2b977)
These days cogl/ has a non-recursive Makefile.am and an old one was
still present in cogl/driver.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit e1db8e38be72f5372e9d7571a3faec5039e0e6d0)
As a convenience for debugging this adds a cogl_debug_matrix_print
function that prints out the components of a matrix and any internal
flags associated with the given matrix.
(cherry picked from commit 3b33889ff1204f19347a9548320ba95baa54c18c)
This adds a new public cogl_texture_rectangle_new_from_foreign()
function so that we can look at removing the generic
cogl_texture_new_from_foreign().
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit af02792b336bb492c5bd11afc34a5dcd417503f6)
To delimit which symbols were considered experimental we used to use
some preprocessor defines to gives experimental symbols an _EXP suffix
so that anyone monitoring the ABI for changes would easily be able to
discount changes made to clearly experimental functions.
These days we simply rely on the gtk-doc "Stability: unstable"
annotation to serve this purpose because changing the actual symbol name
made it slightly more awkward to debug Cogl using GDB and was an extra
mechanical step we decided we could do without.
This patch removes the last remaining _EXP suffix defines in Cogl
(cherry picked from commit 5a1c4a979e00accd492097cfb8f6a8d0fd8331bc)
This splits out most of the OpenGL specific code from cogl-framebuffer.c
into cogl-framebuffer-gl.c and extends the CoglDriverVtable interface
for cogl-framebuffer.c to use.
There are hopes to support several different backends for Cogl
eventually to hopefully get us closer to the metal so this makes some
progress in organizing which parts of Cogl are OpenGL specific so these
parts can potentially be switched out later.
The only remaining use of OpenGL still in cogl-framebuffer.c is to
handle cogl_framebuffer_read_pixels.
This commit introduces some new framebuffer api to be able to
enable texture based depth buffers for a framebuffer (currently
only supported for offscreen framebuffers) and once allocated
to be able to retrieve the depth buffer as a texture for further
usage, say, to implement shadow mapping.
The API works as follow:
* Before the framebuffer is allocated, you can request that a depth
texture is created with
cogl_framebuffer_set_depth_texture_enabled()
* cogl_framebuffer_get_depth_texture() can then be used to grab a
CoglTexture once the framebuffer has been allocated.
glBlitFramebuffer is affected by the scissor so we need to ensure
there is an empty clip flushed before using it. This is similar to
what is done in _cogl_blit_framebuffer().
https://bugzilla.gnome.org/show_bug.cgi?id=690451
Reviewed-by: Robert Bragg <robert@linux.intel.com>
Tested-by: Aaron Plattner <aplattner@nvidia.com>
(cherry picked from commit 65da3f88af9c7b8d72758d116c2652aff68195c1)
The automagic paragraph support of gtk-doc is way too simple to support
things like multi-paragraphs <note>s. Let's trick gtk-doc and make it
generate a valid docbook snippet for cogl-context.
Without this, cogl-context remains absent of the reference
documentation, how sad is this?!
(cherry picked from commit 606b472d91450e3221da6631020f534892e866a9)