1. 14 Jan, 2014 1 commit
  2. 02 Jan, 2013 1 commit
    • Robert Bragg's avatar
      Remove cogl-internal.h · 01cc82ec
      Robert Bragg authored
      This remove cogl-internal.h in favour of using cogl-private.h. Some
      things in cogl-internal.h were moved to driver/gl/cogl-util-gl-private.h
      and the _cogl_gl_error_to_string function whose prototype was moved from
      cogl-internal.h to cogl-util-gl-private.h has had its implementation
      moved from cogl.c to cogl-util-gl.c
      Reviewed-by: default avatarNeil Roberts <neil@linux.intel.com>
  3. 27 Nov, 2012 1 commit
    • Robert Bragg's avatar
      replace public cogl_flush with _cogl_framebuffer_flush · 1206a053
      Robert Bragg authored
      This removes the cogl_flush() api which depends on a global Cogl context
      and provides a more specific _cogl_framebuffer_flush() instead. This
      new function isn't public since we don't currently see a use for this
      api for applications. (The previously documented use for cogl_flush() to
      allow applications to intermix direct GL and cogl usage was missleading
      and wouldn't have worked for intermixing drawing commands. Intermixing
      GL to create objects such as textures doesn't require any flush api)
      Since there are a few places internally where we do actually need to
      flush *all* framebuffer journals we keep an equivalent to cogl_flush()
      renamed to _cogl_flush() which now takes a CoglContext pointer.
      cogl1-context.h has now been removed since there was nothing left in it.
      Reviewed-by: default avatarNeil Roberts <neil@linux.intel.com>
  4. 21 Nov, 2012 1 commit
    • Neil Roberts's avatar
      Remove the pipeline layer user matrix · 94b13b1a
      Neil Roberts authored
      The pipeline layer user matrix is not used very often and the way it
      is currently implemented comes at a non-trivial cost. Any pipeline
      layer that requires the big state needs to have a CoglMatrix added to
      its state. The generated vertex shader will always multiply the
      coordinates by the matrix even if it is just the identity matrix.
      The same functionality can be achieved on programmable hardware using
      a shader snippet. The snippet hook for the texture coordinate
      transform is still available to make this convenient.
      If we later decide that this is a really useful feature for fixed
      function hardware then we can add it back in and try to make it work
      more efficiently. In the meantime however it seems like a good idea to
      get rid of the API now before Cogl 2.0 is released and the API becomes
      Reviewed-by: default avatarRobert Bragg <robert@linux.intel.com>
  5. 14 Sep, 2012 1 commit
    • Neil Roberts's avatar
      Remove cogl-primitives.h and CoglTextureVertex · 6b081a55
      Neil Roberts authored
      This removes the cogl-primitives.h header. The implementations for all
      of the functions that it declared have already been removed in
      The CoglTextureVertex type has also been removed because it was only
      used for cogl_polygon which has already been removed.
      This patch also fixes some mentions of cogl_rectangle() in the
      documentation and replaces them with
      Reviewed-by: default avatarRobert Bragg <robert@linux.intel.com>
  6. 17 May, 2012 1 commit
  7. 18 Apr, 2012 2 commits
    • Neil Roberts's avatar
      Remove legacy state · 818b3493
      Neil Roberts authored
      This removes the global legacy state for setting the depth state,
      backface culling and global program.
      The internal _cogl_push_source wrapper which takes a boolean to set
      whether legacy state should be applied has been removed. The normal
      cogl_push_source can always be used instead.
      The CoglDrawFlag for disable legacy state has been removed. Similarly
      the boolean argument to disable legacy state when drawing rectangles
      has also been removed.
      The legacy state testing in test-backface-culling had already been
      partially removed in f951d099
       but the masks were not correctly
      updated so it was not testing all of the combinations correctly.
      The legacy state testing from test-depth-state has been removed.
      Reviewed-by: default avatarRobert Bragg <robert@linux.intel.com>
    • Robert Bragg's avatar
      Switch use of primitive glib types to c99 equivalents · 5967dad2
      Robert Bragg authored
      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: default avatarNeil Roberts <neil@linux.intel.com>
  8. 16 Apr, 2012 1 commit
  9. 20 Mar, 2012 1 commit
    • Robert Bragg's avatar
      Adds cogl_framebuffer_draw_[*_]rectangle functions · 3881fd32
      Robert Bragg authored
      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
      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.
  10. 06 Mar, 2012 1 commit
    • Neil Roberts's avatar
      Add -Wmissing-declarations to maintainer flags and fix problems · 18563008
      Neil Roberts authored
      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_*
      • 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: default avatarRobert Bragg <robert@linux.intel.com>
  11. 21 Feb, 2012 1 commit
  12. 20 Feb, 2012 2 commits
    • Robert Bragg's avatar
      Remove all internal includes of cogl.h · 680f63a4
      Robert Bragg authored
      The cogl.h header is meant to be the public header for including the 1.x
      api used by Clutter so we should stop using that as a convenient way to
      include all likely prototypes and typedefs. Actually we already do a
      good job of listing the specific headers we depend on in each of the .c
      files we have so mostly this patch just strip out the redundant
      includes for cogl.h with a few fixups where that broke the build.
      Reviewed-by: default avatarNeil Roberts <neil@linux.intel.com>
    • Robert Bragg's avatar
      Move all types/prototypes from cogl.h -> cogl[1]-context.h · ee940a3d
      Robert Bragg authored
      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: default avatarNeil Roberts <neil@linux.intel.com>
  13. 09 Feb, 2012 2 commits
    • Robert Bragg's avatar
      buffer: explicitly relate buffers to a context · 3ea6acc0
      Robert Bragg authored
      All CoglBuffer constructors now take an explicit CoglContext
      constructor. This is part of the on going effort to adapt to Cogl API so
      it no longer depends on a global, default context.
      Reviewed-by: default avatarNeil Roberts <neil@linux.intel.com>
    • Robert Bragg's avatar
      framebuffer: Add cogl_framebuffer draw methods · 92c30630
      Robert Bragg authored
      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: default avatarNeil Roberts <neil@linux.intel.com>
  14. 08 Feb, 2012 1 commit
    • Neil Roberts's avatar
      cogl-primitives: Copy across the texture coordinates if no texture · 88f87803
      Neil Roberts authored
      Previously when using the cogl_rectangle_* family of functions with a
      pipeline that doesn't have a texture for a particular layer then
      validate_tex_coords_cb would bail out immediately leaving the texture
      coords for that layer uninitialised. This patch changes it so that it
      bails out after copying in the texture coordinates instead. This was
      causing problems for pipelines that were trying to completely generate
      the texture values in a CoglSnippet because they wouldn't get any
      texture coordinates.
      Reviewed-by: default avatarRobert Bragg <robert@linux.intel.com>
  15. 07 Feb, 2012 1 commit
  16. 01 Nov, 2011 4 commits
    • Robert Bragg's avatar
      rectangles: rely on meta-texture api for clamping · e9075931
      Robert Bragg authored
      Instead of emulating _CLAMP_TO_EDGE in cogl-primitives.c we now defer to
      cogl_meta_texture_foreach_in_region() to support _CLAMP_TO_EDGE for us.
      Reviewed-by: default avatarNeil Roberts <neil@linux.intel.com>
    • Robert Bragg's avatar
      Adds support for a mirrored repeat wrap mode · 1a30f4fb
      Robert Bragg authored
      This adds COGL_PIPELINE_WRAP_MODE_MIRRORED_REPEAT enum so that mirrored
      texture repeating can be used. This also adds support for emulating the
      MIRRORED_REPEAT mode via the cogl-spans API so it can also be used with
      meta textures such as sliced and atlas textures.
      Reviewed-by: default avatarNeil Roberts <neil@linux.intel.com>
    • Robert Bragg's avatar
      meta-texture: This publicly exposes CoglMetaTexture · 1d8fd64e
      Robert Bragg authored
      CoglMetaTexture is an interface for dealing with high level textures
      that may be comprised of one or more low-level textures internally. The
      interface allows the development of primitive drawing APIs that can draw
      with high-level textures (such as atlas textures) even though the
      GPU doesn't natively understand these texture types.
      There is currently just one function that's part of this interface:
      cogl_meta_texture_foreach_in_region() which allows an application to
      resolve the internal, low-level textures of a high-level texture.
      cogl_rectangle() uses this API for example so that it can easily emulate
      the _REPEAT wrap mode for textures that the hardware can't natively
      handle repeating of.
      Reviewed-by: default avatarNeil Roberts <neil@linux.intel.com>
    • Robert Bragg's avatar
      primitives: make validate_first_layer_cb update override pipeline · eef50137
      Robert Bragg authored
      This fixes validate_first_layer_cb so that it update the override
      pipeline not the user's original pipeline. It also makes the check
      for when to override the wrap mode more robust by considering that
      we might add more wrap modes in the future.
      Reviewed-by: default avatarNeil Roberts <neil@linux.intel.com>
  17. 21 Sep, 2011 1 commit
    • Robert Bragg's avatar
      Add a strong CoglTexture type to replace CoglHandle · 4c3dadd3
      Robert Bragg authored
      As part of the on going, incremental effort to purge the non type safe
      CoglHandle type from the Cogl API this patch tackles most of the
      CoglHandle uses relating to textures.
      We'd postponed making this change for quite a while because we wanted to
      have a clearer understanding of how we wanted to evolve the texture APIs
      towards Cogl 2.0 before exposing type safety here which would be
      difficult to change later since it would imply breaking APIs.
      The basic idea that we are steering towards now is that CoglTexture
      can be considered to be the most primitive interface we have for any
      object representing a texture. The texture interface would provide
      roughly these methods:
      Besides the texture interface we will then start to expose types
      corresponding to specific texture types: CoglTexture2D,
      CoglTexture3D, CoglTexture2DSliced, CoglSubTexture, CoglAtlasTexture and
      We will then also expose an interface for the high-level texture types
      we have (such as CoglTexture2DSlice, CoglSubTexture and
      CoglAtlasTexture) called CoglMetaTexture. CoglMetaTexture is an
      additional interface that lets you iterate a virtual region of a meta
      texture and get mappings of primitive textures to sub-regions of that
      virtual region. Internally we already have this kind of abstraction for
      dealing with sliced texture, sub-textures and atlas textures in a
      consistent way, so this will just make that abstraction public. The aim
      here is to clarify that there is a difference between primitive textures
      (CoglTexture2D/3D) and some of the other high-level textures, and also
      enable developers to implement primitives that can support meta textures
      since they can only be used with the cogl_rectangle API currently.
      The thing that's not so clean-cut with this are the texture constructors
      we have currently; such as cogl_texture_new_from_file which no longer
      make sense when CoglTexture is considered to be an interface.  These
      will basically just become convenient factory functions and it's just a
      bit unusual that they are within the cogl_texture namespace.  It's worth
      noting here that all the texture type APIs will also have their own type
      specific constructors so these functions will only be used for the
      convenience of being able to create a texture without really wanting to
      know the details of what type of texture you need.  Longer term for 2.0
      we may come up with replacement names for these factory functions or the
      other thing we are considering is designing some asynchronous factory
      functions instead since it's so often detrimental to application
      performance to be blocked waiting for a texture to be uploaded to the
      Reviewed-by: default avatarNeil Roberts <neil@linux.intel.com>
  18. 19 Sep, 2011 2 commits
    • Neil Roberts's avatar
      cogl-primitives: Don't warn if using sliced textures without multi-tex · 1984fea4
      Neil Roberts authored
      cogl_rectangle has some validation code to check whether the first
      layer has a sliced texture. If so it will abandon the rest of the
      layers and print a warning. However it was even doing this pruning and
      displaying the warning if there is only one layer. This patch just
      makes it check whether the pipeline actually has more than one layer
      before pruning or displaying the warning but it will still fallback to
      the multiple quads path.
      Reviewed-by: default avatarRobert Bragg <robert@linux.intel.com>
    • Neil Roberts's avatar
      Add internal _cogl_push_source to optionally disable legacy state · 2059ae3a
      Neil Roberts authored
      Some code in Cogl such as when flushing a stencil clip assumes that it
      can push a temporary simple pipeline to reset to a known state for
      internal drawing operations. However this breaks down if the
      application has set any legacy state because that is set globally so
      it will also get applied to the internal pipeline.
      _cogl_draw_attributes already had an internal flag to disable applying
      the legacy state but I think this is quite awkward to use because not
      all places that push a pipeline draw the attribute buffers directly so
      it is difficult to pass the flag down through the layers.
      Conceptually the legacy state is meant to be like a layer on top of
      the purely pipeline-based state API so I think ideally we should have
      an internal function to push the source without the applying the
      legacy state. The legacy state can't be applied as the pipeline is
      pushed because the global state can be modified even after it is
      pushed. This patch adds a _cogl_push_source() function which takes an
      extra boolean flag to mark whether to enable the legacy state. The
      value of this flag is stored alongside the pipeline in the pipeline
      stack. Another new internal function called
      _cogl_get_enable_legacy_state queries whether the top entry in the
      pipeline stack has legacy state enabled. cogl-primitives and the
      vertex array drawing code now use this to determine whether to apply
      the legacy state when drawing. The COGL_DRAW_SKIP_LEGACY_STATE flag is
      now removed.
      Reviewed-by: default avatarRobert Bragg <robert@linux.intel.com>
  19. 01 Aug, 2011 1 commit
  20. 08 Jul, 2011 1 commit
    • Neil Roberts's avatar
      Use all core GL functions through indirect pointers · 2b119b07
      Neil Roberts authored
      cogl-ext-functions.h now contains definitions for all of the core GL
      and GLES functions that we would normally link to directly. All of the
      code has changed to access them through the cogl context pointer. The
      GE macro now takes an extra parameter to specify the context because
      the macro itself needs to make GL calls but various points in the Cogl
      source use different names for the context variable.
  21. 16 May, 2011 2 commits
    • Robert Bragg's avatar
      Don't pass around NULL terminated CoglAttribute arrays · 3c1e83c7
      Robert Bragg authored
      For the first iteration of the CoglAttribute API several of the new
      functions accepted a pointer to a NULL terminated list of CoglAttribute
      pointers - probably as a way to reduce the number of arguments required.
      This style isn't consistent with existing Cogl APIs though and so we now
      explicitly pass n_attributes arguments and don't require the NULL
    • Robert Bragg's avatar
      Rename CoglVertexArray to CoglAttributeBuffer · ce7c06dc
      Robert Bragg authored
      This is part of a broader cleanup of some of the experimental Cogl API.
      One of the reasons for this particular rename is to switch away from
      using the term "Array" which implies a regular, indexable layout which
      isn't the case. We also want to have a strongly implied relationship
      between CoglAttributes and CoglAttributeBuffers.
  22. 11 Apr, 2011 2 commits
  23. 15 Feb, 2011 1 commit
    • Neil Roberts's avatar
      cogl-framebuffer: Separate the draw and read buffer · a067e7a1
      Neil Roberts authored
      The current framebuffer is now internally separated so that there can
      be a different draw and read buffer. This is required to use the
      GL_EXT_framebuffer_blit extension. The current draw and read buffers
      are stored as a pair in a single stack so that pushing the draw and
      read buffer is done simultaneously with the new
      _cogl_push_framebuffers internal function. Calling
      cogl_pop_framebuffer will restore both the draw and read buffer to the
      previous state. The public cogl_push_framebuffer function is layered
      on top of the new function so that it just pushes the same buffer for
      both drawing and reading.
      When flushing the framebuffer state, the cogl_framebuffer_flush_state
      function now tackes a pointer to both the draw and the read
      buffer. Anywhere that was just flushing the state for the current
      framebuffer with _cogl_get_framebuffer now needs to call both
      _cogl_get_draw_buffer and _cogl_get_read_buffer.
  24. 21 Jan, 2011 2 commits
    • Robert Bragg's avatar
      cogl: rename CoglVertexAttribute CoglAttribute · 9b0fd925
      Robert Bragg authored
      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.
    • Robert Bragg's avatar
      journal: Support per-framebuffer journals · 1a5a4df3
      Robert Bragg authored
      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
      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.
  25. 10 Jan, 2011 1 commit
    • Neil Roberts's avatar
      cogl-vertex-attribute: Add flags to _cogl_draw_vertex_attributes_array · a8472898
      Neil Roberts authored
      There is an internal version of cogl_draw_vertex_attributes_array
      which previously just bypassed the framebuffer flushing, journal
      flushing and pipeline validation so that it could be used to draw the
      journal. This patch generalises the function so that it takes a set of
      flags to specify which parts to flush. The public version of the
      function now just calls the internal version with the flags set to
      0. The '_real' version of the function has now been merged into the
      internal version of the function because it was only called in one
      place. This simplifies the code somewhat. The common code which
      flushed the various state has been moved to a separate function. The
      indexed versions of the functions have had a similar treatment.
  26. 26 Nov, 2010 1 commit
  27. 23 Nov, 2010 3 commits
    • Robert Bragg's avatar
      journal: remove possability of fallback layers · 649aaffb
      Robert Bragg authored
      When logging quads in the journal it used to be possible to specify a
      mask of fallback layers (layers where a default white texture should be
      used in-place of the corresponding texture in the current source
      pipeline). Since we now handle fallbacks for cogl_rectangle* primitives
      when validating the pipeline up-front before logging in the journal we
      no longer need the ability for the journal to apply fallbacks too.
    • Robert Bragg's avatar
      primitives: validate with _cogl_pipeline_foreach_layer · 56f36cf9
      Robert Bragg authored
      Switch _cogl_rectangles_with_multitexture_coords to using
      _cogl_pipeline_foreach_layer to iterate the layers of a pipeline when
      validating instead of iterating the pipelines internal list, which is
      risky since any modifications to pipelines (even to an override pipeline
      derived from the original), could potentially corrupt the list as it is
      being iterated.
    • Robert Bragg's avatar
      cogl: remove WrapModeOverrides from FlushOptions · 1a3f946c
      Robert Bragg authored
      This removes the possibility to specify wrap mode overrides within a
      CoglPipelineFlushOptions struct since the right way to handle these
      overrides is by copying the user's material and making the changes to
      that copy before flushing. All primitives code has already switched away
      from using these wrap mode overrides so this patch just removes unused
      code and types. It also remove the wrap_mode_overrides argument for
  28. 19 Nov, 2010 1 commit
    • Robert Bragg's avatar
      vertex-array: Adds data arg for _vertex_array_new() · 982f1b4b
      Robert Bragg authored
      This adds an optional data argument for cogl_vertex_array_new() since it
      seems that mostly every case where we use this API we follow up with a
      cogl_buffer_set_data() matching the size of the new array. This
      simplifies all those cases and whenever we want to delay uploading of
      data then NULL can simply be passed.