After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 663636 - Use newer Cogl API in ClutterDeformEffect
Use newer Cogl API in ClutterDeformEffect
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: ClutterEffect
unspecified
Other All
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
Depends on: 663628
Blocks:
 
 
Reported: 2011-11-08 15:58 UTC by Neil Roberts
Modified: 2011-11-15 11:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
deform-effect: Use CoglPrimitives instead of CoglVertexBuffers (19.56 KB, patch)
2011-11-08 15:58 UTC, Neil Roberts
committed Details | Review
deform-effect: Use CoglPipeline instead of setting legacy state (11.10 KB, patch)
2011-11-08 15:58 UTC, Neil Roberts
committed Details | Review

Description Neil Roberts 2011-11-08 15:58:00 UTC
Here's some patches to make ClutterDeformEffect use the Cogl 2.0 API.

The second patch depends on bug 663628.
Comment 1 Neil Roberts 2011-11-08 15:58:02 UTC
Created attachment 201012 [details] [review]
deform-effect: Use CoglPrimitives instead of CoglVertexBuffers

This changes ClutterDeformEffect to use a CoglAttributeBuffer with a
CoglPrimitive instead of the old CoglVertexBuffer. The old vertex
buffer code is now implemented in terms of the attribute buffer code
and it will eventually be deprecated. Using CoglPrimitives should be
slightly more efficient.

This also changes the struct we store the vertices to be
CoglVertexP3T2C4 instead of CoglTextureVertex. The latter is
technically not compatible with neither vertex buffers nor attribute
buffers because it contains a CoglColor and the internal members of
that are private so it is not valid to assume it contains 4 bytes and
use that as an attribute. Also it contains padding so it ends up
redundantly creating a larger buffer. CoglTextureVertex is in the
public API for the deform_vertex virtual so we still have to maintain
that. Instead of directly manipulating the array to upload, the
application is now passed a stack allocated temporary struct which
gets converted to a CoglVertexP3T2C4. This also means that we can map
the buffer as write only and still let the application read-write the
vertex.

The paint debug code to draw line strips for the deform mesh was
previously trying to set a red source material. However this wasn't
working because the material color was being overwritten by the color
attribute in the vertex buffer. This patch fixes that by creating a
seperate primitive for the lines and not adding the color
attribute. The lines code was also drawing both the front and back
indices. I don't think that entirely makes sense so I've just changed
it to draw only the front indices. Maybe painting both would make more
sense if backface culling was still enabled.
Comment 2 Neil Roberts 2011-11-08 15:58:05 UTC
Created attachment 201013 [details] [review]
deform-effect: Use CoglPipeline instead of setting legacy state

Instead of calling cogl_set_depth_test_enabled and
cogl_set_backface_culling_enabled ClutterDeformEffect now uses the
experimental CoglPipeline API. Those global state functions will soon
be deprecated in Cogl and they are implemented by flushing a temporary
override pipline which isn't ideal.

Using the new culling API we can also avoid having a separate buffer
of indices for the back of the texture by just changing the culling
mode to cull front baces instead of the back.
Comment 3 Emmanuele Bassi (:ebassi) 2011-11-10 10:03:26 UTC
Review of attachment 201012 [details] [review]:

looks good to me.
Comment 4 Emmanuele Bassi (:ebassi) 2011-11-10 10:04:06 UTC
Review of attachment 201013 [details] [review]:

looks good to me. feel free to commit it when the API lands in Cogl.
Comment 5 Emmanuele Bassi (:ebassi) 2011-11-15 11:55:04 UTC
Attachment 201012 [details] pushed as 8a752d6 - deform-effect: Use CoglPrimitives instead of CoglVertexBuffers
Attachment 201013 [details] pushed as 58b6ad7 - deform-effect: Use CoglPipeline instead of setting legacy state