Commit Graph

14 Commits

Author SHA1 Message Date
Robert Bragg
f80cb197a9 cogl: rename CoglMaterial -> CoglPipeline
This applies an API naming change that's been deliberated over for a
while now which is to rename CoglMaterial to CoglPipeline.

For now the new pipeline API is marked as experimental and public
headers continue to talk about materials not pipelines. The CoglMaterial
API is now maintained in terms of the cogl_pipeline API internally.
Currently this API is targeting Cogl 2.0 so we will have time to
integrate it properly with other upcoming Cogl 2.0 work.

The basic reasons for the rename are:
- That the term "material" implies to many people that they are
  constrained to fragment processing; perhaps as some kind of high-level
  texture abstraction.
    - In Clutter they get exposed by ClutterTexture actors which may be
      re-inforcing this misconception.
- When comparing how other frameworks use the term material, a material
  sometimes describes a multi-pass fragment processing technique which
  isn't the case in Cogl.
- In code, "CoglPipeline" will hopefully be a much more self documenting
  summary of what these objects represent; a full GPU pipeline
  configuration including, for example, vertex processing, fragment
  processing and blending.
- When considering the API documentation story, at some point we need a
  document introducing developers to how the "GPU pipeline" works so it
  should become intuitive that CoglPipeline maps back to that
  description of the GPU pipeline.
- This is consistent in terminology and concept to OpenGL 4's new
  pipeline object which is a container for program objects.

Note: The cogl-material.[ch] files have been renamed to
cogl-material-compat.[ch] because otherwise git doesn't seem to treat
the change as a moving the old cogl-material.c->cogl-pipeline.c and so
we loose all our git-blame history.
2010-11-03 18:09:23 +00:00
Neil Roberts
717cb2c47f cogl-atlas: Verify that the chosen initial size is supported
CoglAtlas chooses a fairly large default initial size of either
512x512 or 1024x1024 depending on the texture format. There is a
chance that this size will not be supported on some platforms which
would be catastrophic for the glyph cache because it would mean that
it would always fail to put any glyphs in the cache so text wouldn't
work. To fix this the atlas code now checks whether the chosen initial
size is supported by the texture driver and if not it will get halved
until it is supported.
2010-08-12 11:57:00 +01:00
Neil Roberts
b4240cba29 cogl-atlas: Use _cogl_texture_driver_size_supported
Previously when creating a new rectangle map it would try increasingly
larger texture sizes until GL_MAX_TEXTURE_SIZE is reached. This is bad
because it queries state which should really be owned by the texture
driver. Also GL_MAX_TEXTURE_SIZE is often a conservative estimate so
larger texture sizes can be used if the proxy texture is queried
instead.
2010-08-12 11:57:00 +01:00
Neil Roberts
0aaea4a93a cogl-atlas: Try the next size when there would be less than 6% waste
Previously when the atlas needs to be migrated it would start by
trying with the same size as the existing atlas if there is enough
space for the new texture. However even if the atlas is completely
sorted there will always be some amount of waste so when the atlas
needs to grow it would usually end up redundantly trying the same size
when it is very unlikely to fit. This patch changes it so that there
must be at least 6% waste available after the new texture is added
otherwise it will start with the next atlas size.
2010-08-12 11:57:00 +01:00
Neil Roberts
c6b6f619a9 cogl-atlas: Add some more debugging notes
This adds some debugging notes which report when the atlas is trying
various sizes.
2010-08-12 11:57:00 +01:00
Neil Roberts
92b712f6e4 cogl-atlas: Increase the default minimum texture size
When initially creating a texture it would start with a minimum size
of 256x256. This increases the size so that it would try to match 1MB
of memory.
2010-08-12 11:56:59 +01:00
Neil Roberts
bbac324356 cogl-atlas: Support multiple formats and clearing the texture
_cogl_atlas_new now has two extra parameters to specify the format of
the textures it creates as well as a set of flags to modify the
behavious of the atlas. One of the flags causes the new textures to be
cleared and the other causes migration to avoid actually copying the
textures. This is needed to use CoglAtlas from the pango glyph cache
because it needs to use COGL_PIXEL_A_8 and to clear the textures as it
does not fill in the gaps between glyphs. It needs to avoid copying
the textures so that it can work on GL implementations without FBO
support.
2010-08-12 11:56:59 +01:00
Neil Roberts
b2f2e69264 cogl-atlas-texture: Split out the atlas data structure
Instead of storing a pointer to the CoglRectangleMap and a handle to
the atlas texture in the context, there is a now a separate data
structure called a CoglAtlas to manage these two. The context just
contains a pointer to this. The code to reorganise the atlas has been
moved from cogl-atlas-texture.c to cogl-atlas.c
2010-08-12 11:56:59 +01:00
Neil Roberts
bc20010582 cogl-atlas: Rename to CoglRectangleMap
This simply renames CoglAtlas to CoglRectangleMap without making any
functional changes. The old 'CoglAtlas' is just a data structure for
managing unused areas of a rectangle and it doesn't neccessarily have
to be used for an atlas so it wasn't a very good name.
2010-08-12 11:54:42 +01:00
Emmanuele Bassi
72f4ddf532 Remove mentions of the FSF address
Since using addresses that might change is something that finally
the FSF acknowledge as a plausible scenario (after changing address
twice), the license blurb in the source files should use the URI
for getting the license in case the library did not come with it.

Not that URIs cannot possibly change, but at least it's easier to
set up a redirection at the same place.

As a side note: this commit closes the oldes bug in Clutter's bug
report tool.

http://bugzilla.openedhand.com/show_bug.cgi?id=521
2010-03-01 12:56:10 +00:00
Robert Bragg
0f5f4e8645 cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.

There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.

The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:

 return_type
 cogl_function_name (CoglType arg0,
                     CoglType arg1);

Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.

The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.

The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.

The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-12 14:05:00 +00:00
Neil Roberts
ef9781d7da cogl-atlas: Make the cogl_atlas_* API internal
This just adds an underscore to every entry point for the CoglAtlas
API so that it's not exported.
2010-02-03 23:09:26 +00:00
Neil Roberts
636cef1bd6 cogl-atlas: Add a debug option to visualize the atlas
This adds a 'dump-atlas-image' debug category. When enabled, CoglAtlas
will use Cairo to create a png which visualizes the leaf rectangles of
the atlas.
2009-12-04 20:29:12 +00:00
Neil Roberts
bec2600087 cogl: Add an atlased texture backend
This adds a CoglAtlas type which is a data structure that keeps track
of unused sub rectangles of a larger rectangle. There is a new atlased
texture backend which uses this to put multiple textures into a single
larger texture.

Currently the atlas is always sized 256x256 and the textures are never
moved once they are put in. Eventually it needs to be able to
reorganise the atlas and grow it if necessary. It also needs to
migrate the textures out of the atlas if mipmaps are required.
2009-12-04 20:26:39 +00:00