Commit Graph

220 Commits

Author SHA1 Message Date
Damien Lespiau
f5ca6733c4 doc: Remove the inclusion of non-existent cogl-clipping.xml
The API is now gone, so cogl-clipping.xml is not generated.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit ff3956c25676c898948c5c7239c85154564c0e16)
2012-08-06 14:27:41 +01:00
Damien Lespiau
86a5259578 doc: Include the documentation for CoglEuler
Several little changes were needed to make the CoglEuler documentation
appear:

  • Fix the embeded docbook snippet in the CoglEuler section header
  • Add the xinclude directive to the main document
  • Add the missing <SECTION> in -sections.txt

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit c7f6e07f7b8ba0d7dc9604e888c8a46165ec3ed4)
2012-08-06 14:27:41 +01:00
Damien Lespiau
e172cac480 quaternion: Document init_from_quaternion()
Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 91c2a3580a6055fcb6902524d3e8354f27932e89)
2012-08-06 14:27:41 +01:00
Damien Lespiau
28655fd608 quaternion: Document init_from_euler()
Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 018703a8e83835e7ab522f5e011fdd4a039523a2)
2012-08-06 14:27:41 +01:00
Damien Lespiau
7ff0b52d78 matrix: Add a init_translation() constructor
This allows people to initialize a matrix with a translation
transformation. The options to do it at the moment were:

* init_from_array() but it give cogl no information about the type of
  matrix.
* init_indentity() and then translate() but it means doing a lot of
  computations for no reason.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 068b3b59221e405dc288d434b0008464684a7c12)
2012-08-06 14:27:41 +01:00
Neil Roberts
b6b9ac0b85 Add a cogl-version header
This adds a version header which contains macros to define which
version of Cogl the application is being compiled against. This helps
applications that want to support multiple incompatible versions of
Cogl at compile time.

The macros are called COGL_VERSION_{MAJOR,MINOR,MICRO}. This does not
match Clutter which names them CLUTTER_{MAJOR,MINOR,MICRO}_VERSION but
I think the former is nicer and it at least matches Cairo and Pango.

The values of the macro are defined to COGL_VERSION_*_INTERNAL which
is generated by the configure script into cogl-defines.h.

There is also a macro for the entire version as a string called
COGL_VERSION_STRING.

The internal utility macros for encoding a 3 part version number into
a single integer have been moved into the new header so they can be
used publicly as a convenient way to check if the version is within a
particular range. There is also a COGL_VERSION_CHECK macro for the
very common case that a feature will be used since a particular
version of Cogl. There is a macro called COGL_VERSION which contains
the pre-encoded version of Cogl being compiled against for
convenience.

Unlike in Clutter this patch does not add any runtime version
identification mechanism.

A test case is also added which just contains static asserts to sanity
check the macros.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 3480cf140dc355fa87ab3fbcf0aeeb0124798a8f)
2012-08-06 14:27:40 +01:00
Neil Roberts
8dd77de009 Replace cogl_path_{stroke,fill} with framebuffer API
The existing functions for stroking and filling a path depend on the
global framebuffer and source stacks. These are now replaced with
cogl_framebuffer_{stroke,fill}_path which get explicitly passed the
framebuffer and pipeline.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 713a8f8160bc5884b091c69eb7a84b069e0950e6)
2012-08-06 14:27:39 +01:00
Robert Bragg
54735dec84 Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.

Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.

Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.

So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.

Instead of gsize we now use size_t

For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-08-06 14:27:39 +01:00
Robert Bragg
09642a83b5 Removes all remaining use of CoglHandle
Removing CoglHandle has been an on going goal for quite a long time now
and finally this patch removes the last remaining uses of the CoglHandle
type and the cogl_handle_ apis.

Since the big remaining users of CoglHandle were the cogl_program_ and
cogl_shader_ apis which have replaced with the CoglSnippets api this
patch removes both of these apis.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 6ed3aaf4be21d605a1ed3176b3ea825933f85cf0)

  Since the original patch was done after removing deprecated API
  this back ported patch doesn't affect deprecated API and so
  actually this cherry-pick doesn't remove all remaining use of
  CoglHandle as it did for the master branch of Cogl.
2012-08-06 14:27:39 +01:00
Robert Bragg
9a1f1df83f Rework sdl integration api
This re-works the SDL integration api to simplify the integration for
application developers and also allow Cogl to know when the application
is about to go idle waiting for events so it can perform idle
book-keeping work.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-04-12 12:31:46 +01:00
Neil Roberts
6197e3abf3 Add constructors which take a CoglBitmap to all primitive textures
This adds public constructors which take a CoglBitmap to all primitive
texture types. This constructor should be considered the canonical
constructor for initializing the texture with data because it should
be possible to wrap any type of data in a CoglBitmap. Having at least
this single constructor avoids the need to have an explosion of
constructors such as new_from_data, new_from_pixel_buffer and
new_from_file etc.

The already available internal bitmap constructor for CoglTexture2D
has had its flags parameter removed under the assumption that flags do
not make sense for primitive textures. The meta constructor
cogl_texture_new_from_bitmap now just explicitly calls set_auto_mipmap
after constructing the texture depending on the value of the
COGL_TEXTURE_NO_AUTO_MIPMAP flag.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-04-05 13:47:32 +01:00
Neil Roberts
e7f1582630 Add a CoglPrimitiveTexture interface
This interface represents any textures that are backed by a single
texture in GL and that can be used directly with the
cogl_framebuffer_draw_attributes family of functions. This currently
equates to CoglTexture2D, CoglTexture3D and CoglTextureRectangle.

The interface currently has only one method called
cogl_primitive_set_auto_mipmap. This replaces the
COGL_TEXTURE_NO_AUTO_MIPMAP flag from the CoglTextureFlags parameter
in the constructors. None of the other flags in CoglTextureFlags make
sense for primitive textures so it doesn't seem like a good idea to
need them for primitive constructors.

There is a boolean in the vtable to mark whether a texture type is
primitive which the new cogl_is_primitive function uses. There is also
a new texture virtual called set_auto_mipmap which is only required to
be implemented for primitive textures.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-04-04 17:02:23 +01:00
Neil Roberts
59cc2b7071 Fix some documentation problems
• The documentation for the framebuffer and texture interfaces had a
  mis-matching open and close <note> tag so DocBook got upset and the
  whole documentation disappeared.

• A lot of symbols from the cogl_framebuffer_* interface were missing
  from the cogl-2.0-experimental-sections.txt file.

• cogl_framebuffer_frustum had the wrong version in its Since tag:

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-03-20 13:17:07 +00:00
Robert Bragg
3881fd3259 Adds cogl_framebuffer_draw_[*_]rectangle functions
This adds experimental 2.0 api replacements for the cogl_rectangle[_*]
functions that don't depend on having a current pipeline set on the
context via cogl_{set,push}_source() or having a current framebuffer set
on the context via cogl_push_framebuffer(). The aim for 2.0 is to switch
away from having a statefull context that affects drawing to having
framebuffer drawing apis that are explicitly passed a framebuffer and
pipeline.

To test this change several of the conformance tests were updated to use
this api instead of cogl_rectangle and
cogl_rectangle_with_texture_coords. Since it's quite laborious going
through all of the conformance tests the opportunity was taken to make
other clean ups in the conformance tests to replace other uses of
1.x api with experimental 2.0 api so long as that didn't affect what was
being tested.
2012-03-20 12:33:40 +00:00
Neil Roberts
5cf2c5762f Add cogl_framebuffer_read_pixels()
This adds a public convenience wrapper around
cogl_framebuffer_read_pixels_into_bitmap which allocates a temporary
CoglBitmap to read into the application's own buffer. This can only be
used for the 99% common case where the rowstride is exactly the
bpp*width and the source is the color buffer.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-03-19 14:47:49 +00:00
Neil Roberts
185630085c Add -Wmissing-declarations to maintainer flags and fix problems
This option to GCC makes it give a warning whenever a global function
is defined without a declaration. This should catch cases were we've
defined a function but forgot to put it in a header. In that case it
is either only used within one file so we should make it static or we
should declare it in a header.

The following changes where made to fix problems:

• Some functions were made static

• cogl-path.h (the one containing the 1.0 API) was split into two
  files, one defining the functions and one defining the enums so that
  cogl-path.c can include the enum and function declarations from the
  2.0 API as well as the function declarations from the 1.0 API.

• cogl2-clip-state has been removed. This only had one experimental
  function called cogl_clip_push_from_path but as this is unstable we
  might as well remove it favour of the equivalent cogl_framebuffer_*
  API.

• The GLX, SDL and WGL winsys's now have a private header to define
  their get_vtable function instead of directly declaring in the C
  file where it is called.

• All places that were calling COGL_OBJECT_DEFINE need to have the
  cogl_is_whatever function declared so these have been added either
  as a public function or in a private header.

• Some files that were not including the header containing their
  function declarations have been fixed to do so.

• Any unused error quark functions have been removed. If we later want
  them we should add them back one by one and add a declaration for
  them in a header.

• _cogl_is_framebuffer has been renamed to cogl_is_framebuffer and
  made a public function with a declaration in cogl-framebuffer.h

• Similarly for CoglOnscreen.

• cogl_vdraw_indexed_attributes is called
  cogl_framebuffer_vdraw_indexed_attributes in the header. The
  definition has been changed to match the header.

• cogl_index_buffer_allocate has been removed. This had no declaration
  and I'm not sure what it's supposed to do.

• CoglJournal has been changed to use the internal CoglObject macro so
  that it won't define an exported cogl_is_journal symbol.

• The _cogl_blah_pointer_from_handle functions have been removed.
  CoglHandle isn't used much anymore anyway and in the few places
  where it is used I think it's safe to just use the implicit cast
  from void* to the right type.

• The test-utils.h header for the conformance tests explicitly
  disables the -Wmissing-declaration option using a pragma because all
  of the tests declare their main function without a header. Any
  mistakes relating to missing declarations aren't really important
  for the tests.

• cogl_quaternion_init_from_quaternion and init_from_matrix have been
  given declarations in cogl-quaternion.h

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-03-06 18:45:44 +00:00
Robert Bragg
6a2bd78374 docs: Make sure we check wayland support for releases
This updates the RELEASING notes to state that we should enable wayland
support when preparing and testing for a release.
2012-03-05 23:32:36 +00:00
Robert Bragg
bd8f0a5673 docs: remove redundancies from doc/RELEASING
This removes the notes about explicitly testing a release on GLES2 and
with the different pipeline backends since the test suite now does this
for us.
2012-03-05 22:58:42 +00:00
Neil Roberts
3700cc26a5 Change API so that CoglPixelBuffer no longer knows its w/h/format
The idea is that CoglPixelBuffer should just be a buffer that can be
used for pixel data and it has no idea about the details of any images
that are stored in it. This is analogous to CoglAttributeBuffer which
itself does not have any information about the attributes. When you
want to use a pixel buffer you should create a CoglBitmap which points
to a region of the attribute buffer and provides the extra needed
information such as the width, height and format. That way it is also
possible to use a single CoglPixelBuffer with multiple bitmaps.

The changes that are made are:

• cogl_pixel_buffer_new_with_size has been removed and in its place is
  cogl_bitmap_new_with_size. This will create a pixel buffer at the
  right size and rowstride for the given width/height/format and
  immediately create a single CoglBitmap to point into it. The old
  function had an out-parameter for the stride of the image but with
  the new API this should be queriable from the bitmap (although there
  is no function for this yet).

• There is now a public cogl_pixel_buffer_new constructor. This takes
  a size in bytes and data pointer similarly to
  cogl_attribute_buffer_new.

• cogl_texture_new_from_buffer has been removed. If you want to create
  a texture from a pixel buffer you should wrap it up in a bitmap
  first. There is already API to create a texture from a bitmap.

This patch also does a bit of header juggling because cogl-context.h
was including cogl-texture.h and cogl-framebuffer.h which were causing
some circular dependencies when cogl-bitmap.h includes cogl-context.h.
These weren't actually needed in cogl-context.h itself but a few other
headers were relying on them being included so this adds the #includes
where necessary.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-03-05 18:47:45 +00:00
Neil Roberts
10a38bb14f Add a public cogl_framebuffer_read_pixels_into_bitmap
This adds a public function to read pixels from a framebuffer into a
CoglBitmap. This replaces the internal function
_cogl_read_pixels_with_rowstride because a CoglBitmap contains a
rowstride so it can be used for the same purpose. A CoglBitmap already
has public API to make one that points to a CoglPixelBuffer so this
function can be used to read pixels into a PBO. It also avoids the
need to push the framebuffer on to the context's stack so it provides
a function which can be used in the 2.0 API after the stack is
removed.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-03-05 18:16:10 +00:00
Neil Roberts
addf48f62f doc/RELEASING: Add a note to test with all pipeline backends and GLES2
This adds a test step to test all of the pipeline backends and GLES2.
GLES2 is currently known to fail for a few tests so it is recommended
to test it with a for loop and make a note of the list of failed
tests.
2012-02-21 18:23:23 +00:00
Robert Bragg
5cdc9af18a Removes the COGL_PIXEL_FORMAT_{24,32} defines
Although these are in the public headers we should assume that no one is
using them since they were never documented so no could know what they
are useful for.

If you were to guess you'd be forgiven for thinking they were bitmasks
for checking some flags to see if a format is 24 or 32 bits. If you
looked further you might instead be forgiven for thinking that if you
masked of the least significant nibble of a pixel-format then you could
check the value against these defines. Neither of the previous
operations are reliable ways to check if a format is 24 or 32bit and
instead code must use then internal
_cogl_pixel_format_get_bytes_per_pixel() api if they want to know the
pixel size for a given format which relies on a 16 entry lookup table
using the least significant nibble of a pixel-format.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-20 23:12:45 +00:00
Robert Bragg
e43246fe1c Remove COGL_UNORDERED_MASK define
Although it's in a public header nothing should be using this define
since it's not documented what it could be used for. The cases where we
were using it internally were quite fragile because they were trying to
mask information from the least significant nibble of CoglPixelFormat
but really that nibble just has to be dealt with using lookup tables.
The least significant nibble of a pixel format gives information about
the bytes per pixel and whether the components are byte aligned but the
information needs to be accessed using
_cogl_pixel_format_get_byes_per_pixel() and
_cogl_pixel_format_is_endian_dependant().

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-20 23:12:44 +00:00
Robert Bragg
a203a5e396 Remove COGL_UNPREMULT_MASK define
Since (A & ~COGL_PREMULT_BIT) is basically as readable as (A &
COGL_UNPREMULT_MASK) this patch removes the mask define. Without the
mask the code is slightly more explicit and there's less risk in error
caused by us forgetting to update the COGL_UNPREMULT_MASK if the way
CoglPixelFormat is defined evolves.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-20 23:12:44 +00:00
Robert Bragg
ee940a3d0d Move all types/prototypes from cogl.h -> cogl[1]-context.h
So we can get to the point where cogl.h is merely an aggregation of
header includes for the 1.x api this moves all the function prototypes
and type definitions into a cogl-context.h and a new cogl1-context.h.

Ideally no code internally should ever need to include cogl.h as it just
represents the public facing header for accessing the 1.x api which
should only be used by Clutter.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-20 23:12:44 +00:00
Neil Roberts
fdc07c865f Add cogl_pipeline_set_layer_null_texture()
This adds a public function to replace the texture for a layer with
the default white texture. It is equivalent to calling
cogl_pipeline_set_layer_texture with NULL for the texture object
except that it also lets you choose a type for the texture. The idea
is that applications using a base pipeline to make multiple copies
that can share the generated shaders can use this function to make the
layer come into existence with the right texture type. Previously the
idiom would be to create a 1x1 dummy texture of the right type but
this ends up creating lots of redundant little textures.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-02-13 17:15:08 +00:00
Neil Roberts
8012eee31f Add _cogl_texture_get_type()
This adds an internal function to get the type of the underlying
hardware texture for any CoglTexture. It can return one of three
values to represent 2D textures, 3D textures or rectangle textures.
The idea is that this can be used as a replacement for
cogl_texture_get_gl_texture when only the target is required to make
it a bit less GL-centric. The implementation adds a new virtual
function which all of the texture backends now implement.

The enum is in a public header because a later patch will want to use
it from the CoglPipeline API. We may want to consider making the
function public too later.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-02-13 17:02:46 +00:00
Robert Bragg
92c3063014 framebuffer: Add cogl_framebuffer draw methods
This adds cogl_framebuffer_ apis for drawing attributes and primitives
that replace corresponding apis that depend on the default CoglContext.
This is part of the on going effort to adapt the Cogl api so it no
longer depends on a global context variable.

All the new drawing functions also take an explicit pipeline argument
since we are also aiming to avoid being a stateful api like Cairo and
OpenGL. Being stateless makes it easier for orthogonal components to
share access to the GPU. Being stateless should also minimize any
impedance miss-match for those wanting to build higher level stateless
apis on top of Cogl.

Note: none of the legacy, global state options such as
cogl_set_depth_test_enabled(), cogl_set_backface_culling_enabled() or
cogl_program_use() are supported by these new drawing apis and if set
will simply be silently ignored.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-02-09 13:09:15 +00:00
Neil Roberts
77c3b1b905 Add cogl_primitive_get_indices()
This adds a public getter for the indices property of CoglPrimitive.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-02-07 15:25:36 +00:00
Neil Roberts
354e923cbf Add cogl_primitive_foreach_attribute()
This adds a public function to iterate the attributes of a
CoglPrimitive. Previously there was no way to query back the
attributes but there was methods to query back all of the other
properties.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-02-07 15:25:36 +00:00
Neil Roberts
146803c191 Add cogl_primitive_copy()
This adds a public function to make a copy of a primitive. The copy is
shallow which means it will share the same attributes and attribute
buffers. This could be useful for code that wants to have multiple
similar primitives with slightly modified properties.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-02-07 15:25:35 +00:00
Robert Bragg
f7f730ee84 docs: Updates cogl_primitive_new_xyz symbols listing
Previously we had functions named like
cogl_primitive_new_with_xyz_attributes() but at some point we renamed
them all to functions named like cogl_primitive_new_xyz() instead. This
updates the -sections.txt symbol listing to list the new names.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2012-01-16 23:27:36 +00:00
Javier Jardón
f3ea514afc docs: Add list of api introduced in 1.8 version 2012-01-13 15:51:34 +00:00
Neil Roberts
85d79ab4fa Add a utility to make a GSource out of a CoglContext
The GSource is created using cogl_glib_source_new which takes a
pointer to a CoglContext. The source calls cogl_poll_get_info() in its
prepare function and cogl_poll_dispatch() in its dispatch
function. The poll FDs on the source are updated according to what
Cogl reports.

The header is only included and the source only compiled if Cogl is
configured with GLib support.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-01-05 13:40:59 +00:00
Neil Roberts
7497475295 Add support for main loop integration
This adds two new functions:

void
cogl_poll_get_info (CoglContext *context,
                    CoglPollFD **poll_fds,
                    int *n_poll_fds,
                    gint64 *timeout);

void
cogl_poll_dispatch (CoglContext *context,
                    const CoglPollFD *poll_fds,
                    int n_poll_fds);

The application is expected to call the first function whenever it is
about to block to go idle, and the second function whenever it comes
out of idle. This gives Cogl winsys's the ability poll file
descriptors for events. For example when handing swap complete
notifications, it can report that it needs to block on a file
descriptor.

The two functions are backed by winsys virtual functions. There are
currently no implementations. The default handler for get_info just
reports no file descriptors and an infinite timeout.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-01-05 13:40:10 +00:00
Neil Roberts
55344ff2c4 Add the missing cogl_is_context() function
This was missing from the CoglContext header.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-01-05 12:58:41 +00:00
Neil Roberts
5f0a57ffdb snippet: Add some more documentation
This adds a documentation section for CoglSnippet which gives an
overview of how to use them. It also fixes some syntax errors in the
existing documentation and adds the missing pipeline functions for
adding snippets to the documentation sections file.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-12-07 14:52:48 +00:00
Neil Roberts
3f28168f1e attribute: Add the buffer and normalized property APIs to the header
The header was missing declarations for
cogl_attribute_{get,set}_{buffer,normalized}.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-12-06 19:02:06 +00:00
Robert Bragg
a4f3d0d18b matrix: Add cogl_matrix_orthographic
This adds an experimental cogl_matrix_orthographic() function that is
more consistent with other Cogl api by taking x_1, y_1, x_2, y_2
arguments to define the top-left and bottom-right coordinates of the
orthographic coordinates instead of OpenGL style left, right, bottom and
top values.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-12-06 18:51:56 +00:00
Robert Bragg
607151c717 reference: don't look for $(top_srcdir)/cogl/winsys/*.h
There are no headers built under the winsys directory so avoid looking
for them since that breaks dist rules.
2011-11-22 17:12:43 +00:00
Neil Roberts
4553ca0695 cogl-pipeline: Add support for setting uniform values
This adds the following new public experimental functions to set
uniform values on a CoglPipeline:

void
cogl_pipeline_set_uniform_1f (CoglPipeline *pipeline,
                              int uniform_location,
                              float value);
void
cogl_pipeline_set_uniform_1i (CoglPipeline *pipeline,
                              int uniform_location,
                              int value);
void
cogl_pipeline_set_uniform_float (CoglPipeline *pipeline,
                                 int uniform_location,
                                 int n_components,
                                 int count,
                                 const float *value);
void
cogl_pipeline_set_uniform_int (CoglPipeline *pipeline,
                               int uniform_location,
                               int n_components,
                               int count,
                               const int *value);
void
cogl_pipeline_set_uniform_matrix (CoglPipeline *pipeline,
                                  int uniform_location,
                                  int dimensions,
                                  int count,
                                  gboolean transpose,
                                  const float *value);

These are similar to the old functions used to set uniforms on a
CoglProgram. To get a value to pass in as the uniform_location there
is also:

int
cogl_pipeline_get_uniform_location (CoglPipeline *pipeline,
                                    const char *uniform_name);

Conceptually the uniform locations are tied to the pipeline so that
whenever setting a value for a new pipeline the application is
expected to call this function. However in practice the uniform
locations are global to the CoglContext. The names are stored in a
linked list where the position in the list is the uniform location.

The global indices are used so that each pipeline can store a mask of
which uniforms it overrides. That way it is quicker to detect which
uniforms are different from the last pipeline that used the same
CoglProgramState so it can avoid flushing uniforms that haven't
changed. Currently the values are not actually compared which means
that it will only avoid flushing a uniform if there is a common
ancestor that sets the value (or if the same pipeline is being flushed
again - in which case the pipeline and its common ancestor are the
same thing).

The uniform values are stored in the big state of the pipeline as a
sparse linked list. A bitmask stores which values have been overridden
and only overridden values are stored in the linked list.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-11-16 16:32:11 +00:00
Neil Roberts
d2fd168351 cogl-matrix: Add a public cogl_matrix_transpose()
This function takes a single matrix argument and replaces the matrix
with its transpose.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-11-16 16:32:11 +00:00
Neil Roberts
5369b3c601 pipeline: Make the backface culling experimental public
This adds two new experimental public functions to replace the old
internal _cogl_pipeline_set_cull_face_state function:

void
cogl_pipeline_set_cull_face_mode (CoglPipeline *pipeline,
                                  CoglPipelineCullFaceMode cull_face_mode);

void
cogl_pipeline_set_front_face_winding (CoglPipeline *pipeline,
                                      CoglWinding front_winding);

There are also the corresponding getters.

https://bugzilla.gnome.org/show_bug.cgi?id=663628

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-11-14 18:40:27 +00:00
Robert Bragg
e0344468d8 docs: Adds various missing 2.0 sections and symbols
This adds a number of missing sections and symbols to the experimental
2.0 reference manual.
2011-11-01 12:03:04 +00:00
Robert Bragg
18fb1ffab5 texture: Make CoglSubTexture experimental public api
This exposes cogl_sub_texture_new() and cogl_is_sub_texture() as
experimental public API. Previously sub-textures were only exposed via
cogl_texture_new_from_sub_texture() so there wasn't a corresponding
CoglSubTexture type. A CoglSubTexture is a high-level texture defined as
a sub-region of some other parent texture. CoglSubTextures are high
level textures that implement the CoglMetaTexture interface which can
be used to manually handle texture repeating.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-11-01 12:03:03 +00:00
Robert Bragg
1ee861a82c framebuffer: adds cogl_framebuffer_get_samples_per_pixel
It's useful to be able to query back the number of
point_samples_per_pixel that may have previously be chosen using
cogl_framebuffer_set_samples_per_pixel().

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-11-01 12:03:03 +00:00
Robert Bragg
648bec9523 doc: Adds a cogl-texture-2d to the 2.0 reference manual
When we make CoglTexture2D public as experimental api we forgot to add a
corresponding section the experimental 2.0 reference manual.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-11-01 12:03:03 +00:00
Robert Bragg
90f106117f texture: Make CoglTextureRectangle experimentally public
This exposes CoglTextureRectangle in the experimental cogl 2.0 api. For
now we just expose a single constructor;
cogl_texture_rectangle_new_with_size() but we can add more later.

This is part of going work to improve our texture apis with more
emphasis on providing low-level access to the varying semantics of
different texture types understood by the gpu instead of only trying to
present a lowest common denominator api.

CoglTextureRectangle is notably useful for never being restricted to
power of two sizes and for being sampled with non-normalized texture
coordinates which can be convenient for use a lookup tables in glsl due
to not needing separate uniforms for mapping normalized coordinates to
texels. Unlike CoglTexture2D though rectangle textures can't have a
mipmap and they only support the _CLAMP_TO_EDGE wrap mode.

Applications wanting to use CoglTextureRectangle should first check
cogl_has_feature (COGL_FEATURE_ID_TEXTURE_RECTANGLE).

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-11-01 12:03:02 +00:00
Robert Bragg
79719347c8 framebuffer: split out CoglOnscreen code
This factors out the CoglOnscreen code from cogl-framebuffer.c so we now
have cogl-onscreen.c, cogl-onscreen.h and cogl-onscreen-private.h.
Notably some of the functions pulled out are currently namespaced as
cogl_framebuffer but we know we are planning on renaming them to be in
the cogl_onscreen namespace; such as cogl_framebuffer_swap_buffers().

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-11-01 12:03:02 +00:00
Robert Bragg
426c8b8f41 features: Support more than 32 features!
Currently features are represented as bits in a 32bit mask so we
obviously can't have more than 32 features with that approach. The new
approach is to use the COGL_FLAGS_ macros which lets us handle bitmasks
without a size limit and we change the public api to accept individual
feature enums instead of a mask. This way there is no limit on the
number of features we can add to Cogl.

Instead of using cogl_features_available() there is a new
cogl_has_feature() function and for checking multiple features there is
cogl_has_features() which takes a zero terminated vararg list of
features.

In addition to being able to check for individual features this also
adds a way to query all the features currently available via
cogl_foreach_feature() which will call a callback for each feature.

Since the new functions take an explicit context pointer there is also
no longer any ambiguity over when users can first start to query
features.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-11-01 12:03:01 +00:00