Since 12b3d21aaa cogl is using the vertex attribute API to stroke a
path. However it was still manually appllying the legacy state to the
pipeline. cogl_vdraw_attributes also applies the legacy state so it
ends up getting applied twice. This patch just removes it from
_cogl_path_stroke_nodes.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
This patch basically restores the logic from 1.6. There we assumed that
glXCopySubBuffer won't tear and thus only needs to be throttled to the
framerate, while glBlitFramebuffer needs to always wait to avoid
tearing.
With Nvidia drivers specifically we have seen that glBlitFramebuffer is
not synchronized. Eventually the plan is that Cogl will actually take
into consideration the underlying driver/hw vendor and driver version
and we may want to only mark glBlitFramebuffer un-synchronized on
Nvidia.
https://bugzilla.gnome.org/show_bug.cgi?id=659360
Reviewed-by: Robert Bragg <robert@linux.intel.com>
All of the cogl_pipeline API is currently experimental so this makes
sure the API is surrounded by #ifdef COGL_ENABLE_EXPERIMENTAL_API
guards and all the symbols have a #define to give them an _EXP suffix as
we do for other experimental API.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
As part of an on-going effort to get cogl-pipeline.c into a more
maintainable state this splits out all the apis relating just to
layer state. This just leaves code relating to the core CoglPipeline
and CoglPipelineLayer design left in cogl-pipeline.c.
This splits out around 2k more lines from cogl-pipeline.c although we
are still left with nearly 4k lines so we still have some way to go!
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Since cogl-pipeline.c has become very unwieldy this make a start at
trying to shape this code back into a manageable state. This patche
moves all the API relating to core pipeline state into
cogl-pipeline-state.c. This doesn't move code relating to layer state
out nor does it move any of the code supporting the core design
of CoglPipeline itself.
This change alone factors out 2k lines of code from cogl-pipeline.c
which is obviously a good start. The next step will be to factor
out the layer state and then probably look at breaking all of this
state code down into state-groups.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
dgettext (which Cogl is using) doesn't work unless you first tell
gettext where the locale dir is for the library's domain. This just
adds the necessary calls into _cogl_init.
https://bugzilla.gnome.org/show_bug.cgi?id=658700
Reviewed-by: Robert Bragg <robert@linux.intel.com>
When the clip contains two rectangles which do not intersect it was
generating a clip bounds where the bottom-right corner was above or to
the left of the top-left corner. This would end up allowing the pixels
between the two rectangles instead of clipping everything like it
should. To fix this there is now an extra check which detects this
situation and just clears the clip bounds to all zeroes in a similar
way to what cogl-clip-stack does.
https://bugzilla.gnome.org/show_bug.cgi?id=659029
Reviewed-by: Robert Bragg <robert@linux.intel.com>
Commit 12b3d21a changed cogl-path so that it will use the vertex
attribute API to stroke the path in a similar way to how it was using
the API to fill the path. However it wasn't clearing the stroke buffer
when the path is modified so it would continue to use the unmodified
stroke.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
Instead of adding -DCOGL_ENABLE_EXPERIMENTAL_2_0_API to the
cogl-2.0-experimental.pc file we now install a cogl2-experimental.h
that #defines COGL_ENABLE_EXPERIMENTAL_2_0_API before including
cogl.h.
The problem with having the define in the .pc file is that you might
develop a library that depends on the experimental 2.0 api internally
and then you might want to use that library with Clutter which still
uses the 1.0 API but the .pc file for your library will indirectly,
automatically enable the 2.0 api which can cause conflicts.
When we are about to start arbfp codegen we call shader_state_new() to
allocate new state structures used to build up the code and that
function makes sure to zero the newly allocated structures.
Right after calling shader_state_new() we were then also explicitly
iterating though the newly allocated unit_state structures and zeroing
the .sampled and .dirty_combine_constant members as well as resetting
shader_state->next_constant_id = 0. This patch removes that redundant
re-initialization of state.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
We weren't actually tracking which layers have been allocated param
space for combine constants; all layers just had a default constant_id
of 0 that indexes into the program.local[] params array and a dirty flag
to say when the constant needs updating. There are times though when we
say to update everything by-passing the dirty flag and because we
weren't actually tracking which layers needed constants we would always
write a constant to program.local[0] for every layer. The upshot was
that we could end up clobbering a real constant that was actually
allocated the constant_id = 0 slot.
This patch adds a new UnitState bitfield to track if the layer has a
corresponding constant that may need flushing and we only ever write the
constant with glProgramLocalParameter4fv if that's set.
https://bugzilla.gnome.org/show_bug.cgi?id=658092
Reviewed-by: Neil Roberts <neil@linux.intel.com>
This makes a start on porting the Cogl conformance tests that currently
still live in the Clutter repository to be standalone Cogl tests that no
longer require a ClutterStage.
The main thing is that this commit brings in is the basic testing
infrastructure we need, so now we can port more and more tests
incrementally.
Since the test suite wants a way to synchronize X requests/replies and
we can't simply call XSynchronize in the test-utils code before we know
if we are really running on X this adds a check for an environment
variable named "COGL_X11_SYNC" in cogl-xlib-renderer.c and if it's set
it forces XSynchronize (dpy, TRUE) to be called.
By default the conformance tests are run off screen. This makes the
tests run much faster and they also don't interfere with other work you
may want to do by constantly stealing focus. CoglOnscreen framebuffers
obviously don't get tested this way so it's important that the tests
also get run on screen every once in a while, especially if changes are
being made to CoglFramebuffer related code. On screen testing can be
enabled by setting COGL_TEST_ONSCREEN=1 in your environment.
The line "#define cogl_display_get_rendrer cogl_display_get_rendrer_EXP"
should read
"#define cogl_display_get_renderer cogl_display_get_renderer_EXP"...
https://bugzilla.gnome.org/show_bug.cgi?id=658333
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Cogl requires gobject and gmodule API, so we need to check for these and
add them to the pkg-config files as dependencies, otherwise building
Cogl with --as-needed (like modern distributions now do) will cause
build errors.
https://bugzilla.gnome.org/show_bug.cgi?id=656809
Reviewed-by: Robert Bragg <robert@linux.intel.com>
This adds a new function, cogl_framebuffer_get_color_format() to be able
to query the common pixel format for any color buffers attached to a
given CoglFramebuffer. For example an offscreen framebuffer created
using cogl_offscreen_new_to_texture() would have a format matching the
texture.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
If the user doesn't explicitly pass an onscreen template then instead of
leaving display->onscreen_template as NULL we now instantiate a template
ourselves. This simplifies winsys code that might want to refer to the
template since it needn't first check for a NULL pointer.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
All our experimental Cogl symbols have a corresponding #define to add
"_EXP" to the end of the symbol name, but those defines are often
positioned right after the corresponding gtk-doc comment and before
the symbol definition which means the generated documentation ends up
refering to the define and not the real definition. This tidies up
cogl-texture-2d.h and moves all the defines to be be before the gtk-doc
comments.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Whenever a texture lookup is performed for a layer the result is now
stored in a variable and used repeatedly instead of generating the
code for the lookup every time it is accessed. This means for example
when using the INTERPOLATE function with a texture lookup for the
third parameter it will only generate one texture lookup instead of
two.
https://bugzilla.gnome.org/show_bug.cgi?id=656426
Reviewed-by: Robert Bragg <robert@linux.intel.com>
This patch changes it so that code for each layer is generated on
demand instead of directly in the add_layer implementation. The
pipeline only explicitly generates code for the last layer. If this
layer references the result from any other layers, these will also be
recursively generated. This means that if a layer is using 'REPLACE'
then it won't redundantly generate the code for the previous
layers.
The result for each layer is generated into a variable called layer%i
where %i is the layer index (not the unit index). Therefore to get the
result from layer n we just have to refer to the varible layern.
https://bugzilla.gnome.org/show_bug.cgi?id=656426
Reviewed-by: Robert Bragg <robert@linux.intel.com>
Instead of calling _cogl_texutre_prepare_for_upload in
cogl_texture_set_region_from_bitmap the call is now deferred to the
implementation of the virtual for set_region. This is needed if the
texture backend is using a different format for the actual GL texture
than what is reported by cogl_texture_get_format. This happens for
example with atlas textures which report the original internal format
specified when the texture was created but actually always store the
data in an RGBA texture.
Also when creating an atlas texture from a bitmap it was preparing the
bitmap to be uploaded to the original format instead of the format of
the actual texture used for the atlas. Then it was using
cogl_texture_set_region_from_bitmap to upload the 5 pieces to make the
copies of the edge pixels. This would end up converting the image to
the actual format 5 times. The atlas textures have now been changed to
prepare the bitmap for the right format.
https://bugzilla.gnome.org/show_bug.cgi?id=657840
Reviewed-by: Robert Bragg <robert@linux.intel.com>
The crate example uses the cogl_pango API and perviously we just
explicitly said to link with the libcogl-pango.la but that doesn't seem
to be enough (not really sure why since libtool should know the required
dependencies to brining in for linking) so we now pass
$(COGL_PANGO_DEP_LIBS) when linking the crate demo.
https://bugzilla.gnome.org/show_bug.cgi?id=656441