Commit Graph

5600 Commits

Author SHA1 Message Date
Robert Bragg
1973168bba journal: start uprof flush timer after flushing fb deps
This avoids us recursively starting the _cogl_journal_flush uprof timer
by only starting it after flushing the journals of dependency
framebuffers.
2011-01-21 17:38:14 +00:00
Robert Bragg
f9d4846d6a cogl: make sure to init ctx->framebuffers
This makes sure to initialize ctx->framebuffers to NULL otherwise we can
get apps crashing when they create their first framebuffer.
2011-01-21 17:28:34 +00:00
Robert Bragg
326c516304 cogl: rename CoglVertexAttribute CoglAttribute
This is part of a broader cleanup of some of the experimental Cogl API.
One of the reasons for this particular rename is to reduce the verbosity
of using the API. Another reason is that CoglVertexArray is going to be
renamed CoglAttributeBuffer and we want to help emphasize the
relationship between CoglAttributes and CoglAttributeBuffers.
2011-01-21 16:24:14 +00:00
Robert Bragg
c4bafb48b6 docs: Adds bitmap section to cogl reference manual
This adds an include for the cogl-bitmap section to cogl-docs.xml.in
2011-01-21 16:22:40 +00:00
Robert Bragg
b3775a7564 cogl: s/Cogl*Vertex/CoglVertex*/
We have a bunch of experimental convenience functions like
cogl_primitive_p2/p2t2 that have corresponding vertex structures but it
seemed a bit odd to have the vertex annotation e.g. "P2T2" be an infix
of the type like CoglP2T2Vertex instead of be a postfix like
CoglVertexP2T2. This switches them all to follow the postfix naming
style.
2011-01-21 16:22:40 +00:00
Robert Bragg
3f9e859167 test-picking: Don't manually paint the stage
Instead of using an idle handler that synchonously paints the stage
by manually calling clutter_actor_paint (stage) the test now uses an
idle handler that repeatedly queues a redraw on the stage.

do_events is now called from a "paint" signal handler for the stage, and
instead of manually determining the fps the test now uses
CLUTTER_SHOW_FPS=1 instead.
2011-01-21 16:18:11 +00:00
Robert Bragg
9a663d8e41 debug: Adds a COGL_DEBUG=disable-fast-read-pixel option
COGL_DEBUG=disable-fast-read-pixel can be used to disable the
optimization for reading a single pixel colour back by looking at the
geometry in the journal and not involving the GPU. With this disabled we
will always flush the journal, rendering to the framebuffer and then use
glReadPixels to get the result.
2011-01-21 16:18:11 +00:00
Robert Bragg
1bdb0e6e98 cogl: Implements a software only read-pixel fast-path
This adds a transparent optimization to cogl_read_pixels for when a
single pixel is being read back and it happens that all the geometry of
the current frame is still available in the framebuffer's associated
journal.

The intention is to indirectly optimize Clutter's render based picking
mechanism in such a way that the 99% of cases where scenes are comprised
of trivial quad primitives that can easily be intersected we can avoid
the latency of kicking a GPU render and blocking for the result when we
know we can calculate the result manually on the CPU probably faster
than we could even kick a render.

A nice property of this solution is that it maintains all the
flexibility of the render based picking provided by Clutter and it can
gracefully fall back to GPU rendering if actors are drawn using anything
more complex than a quad for their geometry.

It seems worth noting that there is a limitation to the extensibility of
this approach in that it can only optimize picking a against geometry
that passes through Cogl's journal which isn't something Clutter
directly controls.  For now though this really doesn't matter since
basically all apps should end up hitting this fast-path. The current
idea to address this longer term would be a pick2 vfunc for ClutterActor
that can support geometry and render based input regions of actors and
move this optimization up into Clutter instead.

Note: currently we don't have a primitive count threshold to consider
that there could be scenes with enough geometry for us to compensate for
the cost of kicking a render and determine a result more efficiently by
utilizing the GPU. We don't currently expect this to be common though.

Note: in the future it could still be interesting to revive something
like the wip/async-pbo-picking branch to provide an asynchronous
read-pixels based optimization for Clutter picking in cases where more
complex input regions that necessitate rendering are in use or if we do
add a threshold for rendering as mentioned above.
2011-01-21 16:18:11 +00:00
Robert Bragg
e289e85397 matrix: fix transform/project_points() APIs
Both cogl_matrix_transform_points and _project_points take points_in and
points_out arguments and explicitly allow pointing to the same array
(i.e. to transform in-place) The implementation of the various internal
transform functions though were not handling this possability and so it
was possible the reference partially transformed vertex values as if
they were original input values leading to incorrect results. This patch
ensures we take a temporary copy of the current input point when
transforming.
2011-01-21 16:18:11 +00:00
Robert Bragg
23ed01d4e9 cogl: Adds _cogl_util_point_in_polygon API
This adds a utility function that can determine if a given point
intersects an arbitrary polygon, by counting how many edges a
"semi-infinite" horizontal ray crosses from that point. The plan is to
use this for a software based read-pixel fast path that avoids using the
GPU to rasterize journaled primitives and can instead intersect a point
being read with quads in the journal to determine the correct color.
2011-01-21 16:18:11 +00:00
Robert Bragg
142b229c5c cogl: Adds _cogl_swap_buffers_notify for clutter backends
This adds a stop-gap mechanism for Cogl to know when the window system
is requested to present the current backbuffer to the frontbuffer by
adding a _cogl_swap_buffers_notify function that backends are now
expected to call right after issuing the equivalent request to OpenGL
vie the platforms OpenGL binding layer. This (blindly) updates all the
backends to call this new function.

For now Cogl doesn't do anything with the notification but the intention
is to use it as part of a planned read-pixel optimization which will
need to reset some state at the start of each new frame.
2011-01-21 16:18:10 +00:00
Robert Bragg
e150f474b3 clip: rename get_clip_stack + add framebuffer_get_stack
Instead of having _cogl_get/set_clip stack which reference the global
CoglContext this instead makes those into CoglClipState method functions
named _cogl_clip_state_get/set_stack that take an explicit pointer to a
CoglClipState.

This also adds _cogl_framebuffer_get/set_clip_stack convenience
functions that avoid having to first get the ClipState from a
framebuffer then the stack from that - so we can maintain the
convenience of _cogl_get_clip_stack.
2011-01-21 16:18:10 +00:00
Robert Bragg
179dc9b7d1 clip-stack: Adds _cogl_clip_stack_get_bounds API
This adds an internal function to be able to query the screen space
bounding box of the current clip entries contained in a given
CoglClipStack.

This bounding box which is cheap to determine can be useful to know the
largest extents that might be updated while drawing with this clip
stack.

For example the plan is to use this as part of an optimized read-pixel
path handled on the CPU which will need to track the currently valid
extents of the last call to cogl_clear()
2011-01-21 16:18:10 +00:00
Robert Bragg
f834596fd4 journal: Support per-framebuffer journals
Instead of having a single journal per context, we now have a
CoglJournal object for each CoglFramebuffer. This means we now don't
have to flush the journal when switching/pushing/popping between
different framebuffers so for example a Clutter scene that involves some
ClutterEffect actors that transiently redirect to an FBO can still be
batched.

This also allows us to track state in the journal that relates to the
current frame of its associated framebuffer which we'll need for our
optimization for using the CPU to handle reading a single pixel back
from a framebuffer when we know the whole scene is currently comprised
of simple rectangles in a journal.
2011-01-21 16:18:10 +00:00
Robert Bragg
385e0f84c6 cogl-object: Adds an internal _cogl_object_set_user_data
This adds an internal alternative to cogl_object_set_user_data that also
passes an instance pointer to destroy notify callbacks.

When setting private data on a CoglObject it's often desirable to know
the instance being destroyed when we are being notified to free the
private data due to the object being freed. The typical solution to this
is to track a pointer to the instance in the private data itself so it
can be identified but that usually requires an extra micro allocation
for the private data that could have been avoided if only the callback
were given an instance pointer.

The new internal _cogl_object_set_user_data passes the instance pointer
as a second argument which means it is ABI compatible for us to layer
the public version on top of this internal function.
2011-01-21 16:18:10 +00:00
Robert Bragg
131578c13a framebuffer: Move clear code to cogl-framebuffer.c
This moves the implementation of cogl_clear into cogl-framebuffer.c as
two new internal functions _cogl_framebuffer_clear and
_cogl_framebuffer_clear4f. It's not clear if this is what the API will
look like as we make more of the CoglFramebuffer API public due to the
limitations of using flags to identify buffers when framebuffers may
contain any number of ancillary buffers but conceptually it makes some
sense to tie the operation of clearing a color buffer to a framebuffer.

The short term intention is to enable tracking the current clear color
as a property of the framebuffer as part of an optimization for reading
back single pixels when the geometry is simple enough that we can
compute the result quickly on the CPU. (If the point doesn't intersect
any geometry we'll need to return the last clear color.)
2011-01-21 16:18:09 +00:00
Emmanuele Bassi
4ab8a3f0c1 stage: Do not create the default stage on stage.is_default()
Use the stage manager to see if a default stage was effectively set,
otherwise we end up creating a default stage when destroying a
non-default one.
2011-01-21 11:43:00 +00:00
Emmanuele Bassi
ca092477c2 Appease the gods in introspection
Reduce the amount of bogus warnings g-ir-scanner prints out.
2011-01-20 16:35:26 +00:00
Emmanuele Bassi
439553a1b7 Update the NEWS file 2011-01-20 13:47:06 +00:00
Emmanuele Bassi
ef78104227 Expose deprecated symbols whilst building Clutter
Don't use ugly "#undef CLUTTER_DISABLE_DEPRECATED" inside source code
using deprecated symbols; we have the handy CLUTTER_COMPILATION define
that we can use as part of the "disable deprecated" conditional.
2011-01-20 13:29:37 +00:00
Emmanuele Bassi
cd96e631f1 glx: Deprecate ClutterGLXTexturePixmap
Since 1.4 the ClutterGLXTexturePixmap is just a wrapper around
ClutterX11TexturePixmap, so we can safely deprecate it. All the
functionality it provided is now effectively available from the
superclass or directly from Cogl.
2011-01-20 13:21:50 +00:00
Emmanuele Bassi
770bcd5b40 test-pixmap: Remove the GLX code
The ClutterGLXTexturePixmap actor is just a wrapper around
ClutterX11TexturePixmap, since the relevant texture-from-pixmap code has
been moved down to Cogl.
2011-01-20 12:59:56 +00:00
Emmanuele Bassi
a2d6edd422 test-pixmap: Fix up compilation on EGLX
We need to check for the GLX windowing system if we are to include
clutter-glx.h.
2011-01-19 18:51:01 +00:00
Emmanuele Bassi
62a0584f11 docs: Ignore clutter-config.h when scanning headers 2011-01-19 17:54:28 +00:00
Emmanuele Bassi
a43c5f10bb tests: Try to drop including config.h
The config.h header should be considered a Clutter internal header, and
the test cases (especially the interactive test cases) should strive to
never rely on internal headers.
2011-01-19 14:36:30 +00:00
Emmanuele Bassi
94b905b9e1 build: Generate an instealled config header
Clutter has some platform-specific API that is accessible only if the
right backend has been compiled in. Third party applications that wish
to be portable across backends might want to use defines and other
pre-processor tricks to determine header inclusion and API usage.

While Clutter has an internal set of symbols it can use, third party
applications don't have the luxury of being able to access the config.h
generated by Clutter's configure script.

For this reason, Clutter should install a configuration header with a
series of namespaced defines that can be picked up by applications and
other third party code.
2011-01-19 14:33:27 +00:00
Emmanuele Bassi
90a01b479c Update the NEWS file 2011-01-19 13:07:26 +00:00
Chris Lord
bb41cb54cb timeline: Check if the timeline is playing in do_tick
Check that the timeline is still playing before executing in
_clutter_timeline_do_tick. This fixes the possibility of receiving a
new-frame signal when stopping a timeline in response to a different
timeline's signal emission.
2011-01-18 16:23:50 +00:00
Lucas Rocha
c61e22d067 drag-action: fix case where motion events are indefinitely disabled
When drag threshold is not reached, emit_drag_begin() is not called
causing default value of priv->motion_events_enabled (false) to used to
restore motion events enabled state in Clutter. This causes drag action
to indefinitely disable motion events. The current value of motion
events enabled state is now queried on button press which guarantees
that the state will be restored with the correct value in
emit_drag_end()

http://bugzilla.clutter-project.org/show_bug.cgi?id=2522
2011-01-18 14:48:14 +00:00
Emmanuele Bassi
cecc7a4bfb stage: Fix gtk-doc annotation for set_accept_focus() 2011-01-18 14:46:02 +00:00
Bastian Winkler
5d8b6aa6fa introspection: Add missing (out) annotations for get_color()
Some actors are missing the (out) annotations for the get_color()
methods.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2518
2011-01-17 17:31:59 +00:00
Emmanuele Bassi
54d00ebaf0 docs: Add ClutterClickAction.get_state() 2011-01-17 17:31:46 +00:00
Lucas Rocha
6af7b76cb5 click-action: add API to get modifier type
This is to allow implementing modified click such as ctrl+click,
shift+click, and so on.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2520
2011-01-17 17:31:46 +00:00
Damien Lespiau
6100aee5bd color: Mark the new static color API as being new from 1.6
The patch was written a while ago but only merged in the 1.5.x cycle.
2011-01-17 15:22:48 +00:00
Neil Roberts
ae9781e526 cogl-program: Don't use separate definitions on GLES 1.1
Previously most of the code for cogl-program and cogl-shader was
ifdef'd out for GLES 1.1 and alternate stub definitions were
defined. This patch removes those and instead puts #ifdef's directly
in the functions that need it. This should make it a little bit easier
to maintain.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2516
2011-01-17 12:56:58 +00:00
Neil Roberts
b7677d047d cogl-pipeline-opengl: #ifdef out set_glsl_program for GLES 1.1
glUseProgram is not available under GLES 1.1 so it was breaking the
build.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2516
2011-01-17 12:38:46 +00:00
Neil Roberts
568d32acf3 cogl-pipeline: Fix the enum names for the constant combine source
When determining whether to hash the combine constant Cogl checks the
arguments to the combine funcs to determine whether the combine
constant is used. However is was using the GLenums GL_CONSTANT_COLOR
and GL_CONSTANT_ALPHA but these are not valid values for the
CoglPipelineCombineSource enum so presumably the constant would never
get hashed. This patch makes it use Cogl's enum of
COGL_PIPELINE_COMBINE_SOURCE_CONSTANT instead.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2516
2011-01-17 12:38:46 +00:00
Adel Gadllah
0c070cdf91 ClutterX11TexturePixmap: Fix doc comment
The wrong signal name was used probably a copy & paste
mistake, fix that.
2011-01-17 12:21:22 +00:00
Neil Roberts
88fe56d175 cogl-buffer: Support mapping buffers for write on GLES
GLES has an extension called GL_OES_mapbuffer to support mapping
buffer objects but only for writing. Cogl now has two new feature
flags to advertise whether mapping for reading and writing is
supported. Under OpenGL, these features are always set if the VBO
extension is advertised and under GLES only the write flag is set if
the GL_OES_mapbuffer extension is advertised.
2011-01-13 16:36:45 +00:00
Neil Roberts
7e73f0d423 cogl: Enable the VBOs feature for GLES2
The GLES2 wrapper code has been removed so there are no longer any
problems with enabling VBOs.
2011-01-13 16:36:45 +00:00
Neil Roberts
9bb74988d5 cogl: Fallback to set_data when mapping a buffer to fill it
In the journal code and when generating the stroke path the vertices
are generated on the fly and stored in a CoglBuffer using
cogl_buffer_map. However cogl_buffer_map is allowed to fail but it
wasn't checking for a NULL return value. In particular on GLES it will
always fail because glMapBuffer is only provided by an extension. This
adds a new pair of internal functions called
_cogl_buffer_{un,}map_for_fill_or_fallback which wrap
cogl_buffer_map. If the map fails then it will instead return a
pointer into a GByteArray attached to the context. When the buffer is
unmapped the array is copied into the buffer using
cogl_buffer_set_data.
2011-01-13 16:36:32 +00:00
Neil Roberts
77a486caf2 cogl-context: Don't enable point sprites on GLES2
On GLES2 there's no builtin mechanism to replace texture coordinates
with point sprite coordinates so calling glEnable(GL_POINT_SPRITE)
isn't valid. Instead the point sprite coords are implemented by using
a special builtin varying variable in GLSL.
2011-01-13 14:26:03 +00:00
Robert Bragg
88a085fdd8 pipeline: differentiate texture target and data state
There are several places where we need to compare the texture state of a
pipeline and sometimes we need to take into consideration if the
underlying texture has changed but other times we may only care to know
if the texture target has changed.

For example the fragends typically generate programs that they want to
share with all pipelines with equivalent fragment processing state, and
in this case when comparing pipelines we only care about the texture
targets since changes to the underlying texture won't affect the
programs generated.

Prior to this we had tried to handle this by passing around some special
flags to various functions that evaluate pipeline state to say when we
do/don't care about the texture data, but this wasn't working in all
cases and was more awkward to manage than the new approach.

Now we simply have two state bits:
COGL_PIPELINE_LAYER_STATE_TEXTURE_TARGET and
COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA and CoglPipelineLayer has an
additional target member. Since all the appropriate code takes masks of
these state bits to determine what to evaluate we don't need any extra
magic flags.
2011-01-13 12:23:33 +00:00
Robert Bragg
8ab68d26a5 pipeline: optimize state init if changing property
When notifying that a pipeline property is going to change, then at
times a pipeline will take over being the authority of the corresponding
state group. Some state groups can contain multiple properties and so to
maintain the integrity of all of the properties we have to initialize
all the property values in the new authority. For state groups with only
one property we don't have to initialize anything during the
pre_change_notify() because we can assume the value will be initialized
as part of the change being notified.

This patch optimizes how we handle this initialization of state groups
in a couple of ways; firstly we no longer do anything to initialize
state-groups with only one property, secondly we no longer use
_cogl_pipeline_copy_differences - (we have a new
_cogl_pipeline_init_multi_property_sparse_state() func) so we can avoid
lots calls to handle_automatic_blend_enable() which is sometimes seen
high in sysprof profiles.
2011-01-13 12:23:33 +00:00
Neil Roberts
5fc3122dad test-cogl-shader-glsl: Disable the atlas for the hand texture
Atlasing needs to be disabled for the hand texture so that it can work
out the step value needed to fetch a neighbouring pixel in the blur
shader. If the texture ends up in the atlas then the test can't know
the actual size of the texture so it looks wrong.
2011-01-13 11:50:09 +00:00
Neil Roberts
3c9f72abbf cogl-atlas-texture: Don't disable atlas if can't read texture data
Previously atlasing would be disabled if the GL driver does not
support reading back texture data. This meant that atlasing would not
happen on GLES. However we also require that the driver support FBOs
and the texture data is only read back as a fallback if the FBO
fails. Therefore the atlas should be ok on GLES 2 which has FBO
support in core.
2011-01-13 11:50:09 +00:00
Emmanuele Bassi
12ceae548d Post-release version bump to 1.5.13 2011-01-11 21:34:37 +00:00
Emmanuele Bassi
09d5c309ca Release 1.5.12 2011-01-11 20:29:47 +00:00
Robert Bragg
676df42c6f pipeline: don't skip flush if skip_gl_color flag differs
We try and bail out of flushing pipeline state asap if we can see the
pipeline has already been flushed and hasn't changed but we weren't
checking to see if the skip_gl_color flag is the same as when it was
last flush too and so we'd sometimes bail out without updating the
glColor correctly.
2011-01-11 14:30:02 +00:00
Damien Lespiau
b922ac6059 test-shader: Fix the edge-detect shader
cogl_text_coord_in in a array to access the texture units. In this case
we want to sample texture unit 0, where the texture is.
2011-01-11 14:21:21 +00:00