summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Tweak documentation for the CoglTexture interfaceNeil Roberts2014-01-202-11/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following changes are made to the documentation for CoglTexture: • The description of the default value for the components property is changed to say that it is always RGBA for textures created by the ‘_with_size’ textures. Previously it said that the default is based on the pixel format used the first time data is set on the texture, but this is only true if the data is set using a constructor. • Added documentation for the CoglTextureComponents enum. • Changed it to say that it _specifies_ what components are required for sampling rather than determinging [sic] them. • Added ‘Since: 1.18’ to cogl_texture_{set,get}_{components,premultiplied} • Changed the since tag for CoglTextureError from 2.0 to 1.8. • Added documentation for COGL_TEXTURE_ERROR_{FORMAT,TYPE}. • Added the following to the cogl2-sections.txt file: COGL_TEXTURE_ERROR CoglTextureError cogl_texture_allocate cogl_texture_set_components cogl_texture_get_components cogl_texture_set_premultiplied cogl_texture_get_premultiplied Reviewed-by: Robert Bragg <robert@linux.intel.com>
* This re-licenses Cogl under the MIT licenseRobert Bragg2014-01-14327-4474/+6574
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This follows up on the proposal that was sent to the Cogl mailing list to re-license from the LGPL to the MIT license: http://lists.freedesktop.org/archives/cogl/2013-December/001465.html Note: there was a copyright assignment policy in place for Clutter (and therefore Cogl which was part of Clutter at the time) until the 11th of June 2010 and so we only checked the details after that point (commit 0bbf50f905) For each file, authors were identified via this Git command: $ git blame -p -C -C -C20 -M -M10 0bbf50f905..HEAD We received blanket approvals for re-licensing all Red Hat and Collabora contributions which reduced how many people needed to be contacted individually: - http://lists.freedesktop.org/archives/cogl/2013-December/001470.html - http://lists.freedesktop.org/archives/cogl/2014-January/001536.html Individual approval requests were sent to all the other identified authors who all confirmed the re-license on the Cogl mailinglist: http://lists.freedesktop.org/archives/cogl/2014-January As well as updating the copyright header in all sources files, the COPYING file has been updated to reflect the license change and also document the other licenses used in Cogl such as the SGI Free Software License B, version 2.0 and the 3-clause BSD license.
* pipeline-cache: Prune old unused pipelines when the cache gets too bigNeil Roberts2014-01-148-87/+334
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously when a pipeline is added to the cache it would never be removed. If the application is generating a lot of unique pipelines this can end up effectively leaking a large number of resources including the GL program objects. Arguably this isn't really a problem because if the application is generating that many unique pipelines then it is doing something wrong anyway. It also implies that it will be recompiling shaders very often so the cache leaking will likely be the least of the problems. This patch makes it keep track of which pipelines in the cache are in use. The cache now returns a struct representing the entry instead of directly returning the pipeline. This entry contains a usage counter which the pipeline backends can use to mark when there is a pipeline alive that is using the cache entry. When the hash table decides that it's a good time to prune some entries, it will make a list of all of the pipelines that are not in use and then remove the least recently used half of the pipelines. That way it is less likely to remove pipelines that the application is actually regenerating often even if they aren't in use all of the time. When the cache is pruned the hash table makes a note of how small the cache could be if it removed all of the unused pipelines. The hash table starts pruning when there are more entries than twice this minimum expected size. The idea is that if that case it hit then the hash table is more than half full of useless pipelines so the application is generating lots of redundant pipelines and it is a good time to remove them. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* winsys-glx: Fix swap region to remain disabled for old mesaAdel Gadllah2014-01-061-1/+1
| | | | | Commit a750f80c6aaa was supposed to enable it for newer mesa but was wrong, fix that.
* winsys-glx: Reenable swap_region for llvmpipe and swrastAdel Gadllah2014-01-061-10/+14
| | | | | | | | | | | | | The bug that prevented MESA_copy_sub_buffer to work for swrast / llvmpipe got fixed in mesa 10.1 git so enable it for mesa 10.1+. https://bugzilla.gnome.org/show_bug.cgi?id=721450 When landing the patch, it was tweaked to #include "cogl-version.h" to avoid a compiler warning about COGL_VERSION_ENCODE being implicitly defined. -- Robert Bragg Reviewed-by: Robert Bragg <robert@linux.intel.com>
* texture: fix cogl_texture_get_components prototypeRobert Bragg2014-01-022-2/+2
| | | | | | This fixes the cogl_texture_get_components() prototype to have a return type of CoglTextureComponents instead of CoglBool which was probably a copy and paste error.
* remove internal_format and redundant error argumentsRobert Bragg2014-01-0160-549/+308
| | | | | | | | | | | | | | | | Texture allocation is now consistently handled lazily such that the internal format can now be controlled using cogl_texture_set_components() and cogl_texture_set_premultiplied() before allocating the texture with cogl_texture_allocate(). This means that the internal_format arguments to texture constructors are now redundant and since most of the texture constructors now can't ever fail the error arguments are also redundant. This now means we no longer use CoglPixelFormat in the public api for describing the internal format of textures which had been bad solution originally due to how specific CoglPixelFormat is which is missleading when we don't support such explicit control over the internal format. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* introduce texture loaders to make allocations lazyRobert Bragg2014-01-0128-838/+1599
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces the internal idea of texture loaders that track the state for loading and allocating a texture. This defers a lot more work until the texture is allocated. There are several intentions to this change: - provides a means for extending how textures are allocated without requiring all the parameters to be supplied in a single _texture_new() function call. - allow us to remove the internal_format argument from all _texture_new() apis since using CoglPixelFormat is bad way of expressing the internal format constraints because it is too specific. For now the internal_format arguments haven't actually been removed but this patch does introduce replacement apis for controlling the internal format: cogl_texture_set_components() lets you specify what components your texture needs when it is allocated. cogl_texture_set_premultiplied() lets you specify whether a texture data should be interpreted as premultiplied or not. - Enable us to support asynchronous texture loading + allocation in the future. Of note, the _new_from_data() texture constructors all continue to allocate textures immediately so that existing code doesn't need to be adapted to manage the lifetime of the data being uploaded. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* get_texture_bits_via_offscreen(): use meta texture formatRobert Bragg2014-01-013-25/+69
| | | | | | | | | | | | When reading a texture back by first wrapping it as an offscreen framebuffer and using _read_pixels_into_bitmap() we now make sure the offscreen framebuffer has an internal format that matches the meta-texture being read not that of the current sub-texture being iterated. In the case of atlas textures the subtexture is a shared texture whose format doesn't reflect the premultipled alpha status of individual atlas-textures, nor whether the alpha component is valid. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* texture: return ints from _get_width/heightRobert Bragg2014-01-012-4/+4
| | | | | | | | This changes cogl_texture_get_width/height to return signed integers just because unsigned integers in C often cause un-obvious arithmetic issues due to implicit casting. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* texture: make cogl_texture_get_format api privateRobert Bragg2014-01-0118-33/+23
| | | | | | | | | | | CoglPixelFormat is not a good way of describing the internal format of a texture because it's too specific given that we don't actually have exact knowledge of the internal format used by the driver. This makes cogl_texture_get_format private and in the future we'll provide a better way of querying the channels and their precision. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* atlas: defer checks until allocationRobert Bragg2014-01-011-24/+24
| | | | | | | This defers checking the internal format and whether accelerated migration is supported until allocating the texture. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* atlas: make zero size a programmer errorRobert Bragg2014-01-011-9/+2
| | | | | | | | Instead of throwing a CoglError exception if an application tries to allocate a zero size atlas texture this make that a programmer error instead. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* texture: allocate on slicing/hw repeat queriesRobert Bragg2014-01-011-0/+6
| | | | | | | | | | The plan is to defer a lot more work in creating a texture until allocation time. This means that for some texture backends we might not know until after allocation whether the texture is sliced or can support hardware repeating. This makes sure we trigger an allocation if either of these are queried. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* ensure texture allocated in _get_gl_texture() in preparationRobert Bragg2014-01-011-0/+3
| | | | | | | | | | | | | | The plan is to defer a lot more work in creating a texture until allocation time. This means we wont be able to assume that all textures being used to render must have already been allocated when data was specified. The latest point at which we will generally require a texture to be allocated will be when we need to know the underlying GL handle for a texture and so this updates cogl_texture_get_gl_texture() to ensure the texture is allocated. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* framebuffer: defer calculating level size until allocationRobert Bragg2014-01-014-34/+53
| | | | | | | | | | | | | The plan is to defer more of the work for creating a texture until allocation time, but that means we won't be able to always assume we can query the size of a texture when creating an offscreen framebuffer from a texture (consider for example using _texture_new_from_file() where the size isn't known until the file has been loaded). This defers needing to know the size of the texture underlying an offscreen framebuffer until calling cogl_framebuffer_allocate(). Reviewed-by: Neil Roberts <neil@linux.intel.com>
* framebuffer: if size unknown; allocate for size/vp queriesRobert Bragg2014-01-011-0/+32
| | | | | | | | | | | | | | | | | | This ensures framebuffers are implicitly allocated when querying the width, height or viewport width/height if the framebuffer's size is currently unknown. The plan is to allow texture backends to defer calculating the size of textures until they are allocated which in turn means we won't know the size of offscreen framebuffers until the texture has been allocated. Potentially we could be more specific about this in the future and only ensure the texture is allocated, but for now it will be simplest to just ensure the framebuffer is allocated. Note: in the case of onscreen buffers which are always initialized with a requested size we are careful to avoid triggering an allocation when this is queried otherwise we will see recursion when the winsys code queries the requested size during allocation. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* offscreen: allocate texture before querying slicingRobert Bragg2014-01-011-3/+5
| | | | | | | | Since we are planning on deferring more texture allocation work this makes sure we don't query whether a texture is sliced until we know it has been allocated. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* framebuffer: make format internalRobert Bragg2014-01-015-17/+11
| | | | | | | | | | | | | | | | | This removes cogl_framebuffer_get_format() since the actual internal format isn't strictly controlled by us. CoglFramebuffer::format has been renamed to ::internal_format to make it clearer that it only really represents the premultiplication status. The plan is to make most of the work involved in creating a texture happen lazily when allocating so this patch also changes _cogl_framebuffer_init() to not take a format argument anymore since we won't know the format of offscreen framebuffers until the framebuffer is allocated, after the corresponding texture has been allocated. In the case of offscreen framebuffers we now update the framebuffer internal_format during allocation. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* cogl-gst: video-sink: fix YV12/I420 supportRobert Bragg2014-01-011-3/+3
| | | | | | | This fixes a mistake in commit 637728dd89d51bc28 that was meant to fix yv12/i420 support but when the patch was updated based on review to use COGL_PIXEL_FORMAT_A instead of COGL_PIXEL_FORMAT_G the corresponding glsl code wasn't also updated to sample the .a component.
* cogl-gst: video-sink: fix ayuv pipeline setupLionel Landwerlin2013-12-111-2/+2
|
* cogl-gst: video-sink: fix YV12/I420 supportLionel Landwerlin2013-12-111-4/+49
|
* cogl-framebuffer: Don't mark the clear clip dirty from the journalJasper St. Pierre2013-12-043-1/+11
| | | | | | | | | This means that we can't cache the journal read_pixels optimization. https://bugzilla.gnome.org/show_bug.cgi?id=719582 Reviewed-by: Neil Roberts <neil@linux.intel.com> Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Fix calculating the bounds when clipping from a primitiveNeil Roberts2013-12-032-2/+2
| | | | | | | | When projecting the bounding rectangle of a primitive it was using the modelview matrix twice instead of the modelview and projection matrices so it was coming out with garbage. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Add a test for cogl_framebuffer_push_path_clipNeil Roberts2013-12-033-1/+71
| | | | | | | | | | | The test makes an L-shaped path that fills the whole framebuffer except for the top right quadrant. It then clips to that and tries to fill the framebuffer with a rectangle. Then it verifies that all of the quadrants have the expected colour. This is currently failing due to a bug in the primitive clipping. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Remove the framebuffer's stack of clip stacksNeil Roberts2013-11-298-257/+20
| | | | | | | | | | | | | | | | | | | There used to be a function called cogl_clip_stack_save in the public API which was used when temporarily switching to an offscreen buffer to save the clip state. This is no longer necessary because each framebuffer has its own clip stack anyway so the function was removed in master. However the code to maintain the stack of stacks was retained. This patch removes it in an effort to simplify the code. On the 1.18 branch this function is deprecated and the documentation says that it does nothing. However that is incorrect because it does actually the push clip stack. I think it would be safe to backport this patch to the 1.18 branch and actually make it do nothing like it is documented to do. https://bugzilla.gnome.org/show_bug.cgi?id=719546 Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Update .gitignoreNeil Roberts2013-11-291-0/+3
|
* Make cogl-sdl.h a top-level headerRobert Bragg2013-11-284-7/+32
| | | | | | | | | This makes it so that cogl-sdl.h is a top-level header no longer automatically included by cogl.h. This avoids lots of warnings building the conformance tests and examples due to SDL.h warning when __STRICT_ANSI__ isn't defined. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* configure: improve the error message if gbm missingRobert Bragg2013-11-281-1/+1
| | | | | | | | | This improves the error message in the case where libgbm is missing when the KMS egl platform has been enabled. https://bugzilla.gnome.org/show_bug.cgi?id=706808 Reviewed-by: Neil Roberts <neil@linux.intel.com>
* build: fix building introspection dataRobert Bragg2013-11-288-1/+142
| | | | | | | | | | | This fixes the build with --enable-introspection. I'm not sure why g-ir-scanner seems to parse all public headers in isolation instead of being able take a more limited list of top-level public headers and automatically parse all necessary #include directives but this means we have to special case how we define and undefine __COGL_H_INSIDE__ to subvert the guards we have in place for detecting misuse of the headers. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* wayland: Add a convenience function to update a region from SHM bufferNeil Roberts2013-11-283-61/+123
| | | | | | | | | | | | | Adds cogl_wayland_texture_set_region_from_shm_buffer which is a convenience wrapper around cogl_texture_set_region but it uses the correct format to copy the data from a Wayland SHM buffer. This will typically be used by compositors to update the texture for a surface when an SHM buffer is attached. The ordering of the arguments is based on cogl_texture_set_region_from_bitmap. Based on a patch by Jasper St. Pierre. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Use COGL_FLAGS_* for the context's private feature flagsNeil Roberts2013-11-2845-226/+291
| | | | | | | | | | | | | | | | Previously the private feature flags were stored in an enum and we already had 31 flags. Adding the 32nd flag would presumably make it add -2³¹ as one of the values which might cause problems. To avoid this we'll just use an fixed-size array of longs and use indices for the enum values like we do for the public features. A slight complication with this is in the CoglDriverDescription where we were previously using a static intialised value to describe the set of features that the driver supports. We can't easily do this with the flags array so instead the features are stored in a fixed-size array of indices. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Declare interface types as void and remove cast macrosRobert Bragg2013-11-2758-142/+268
| | | | | | | | | | | | | | | | | | This declares the interface types CoglFramebuffer, CoglBuffer, CoglTexture, CoglMetaTexture and CoglPrimitiveTexture as void when including the public cogl.h header so that users don't have to use lots of C type casts between instance types and interface types. This also removes all of the COGL_XYZ() type cast macros since they do nothing more than compile time type casting but it's less readable if you haven't seen that coding pattern before. Unlike with gobject based apis that use per-type macros for casting and performing runtime type checking we instead prefer to do our runtime type checking internally within the front-end public apis when objects are passed into Cogl. This greatly reduces the verbosity for users of the api and may help reduce the chance of excessive runtime type checking that can sometimes be a problem.
* Add API to control per-framebuffer depth writingHans Petter Jansson2013-10-286-8/+109
| | | | | | | | | | | | | | | Add framebuffer methods cogl_framebuffer_[gs]et_depth_write_enabled() and backend bits to pass the state on to glDepthMask(). This allows us to enable or disable depth writing per-framebuffer, which if disabled saves us some work in glClear(). When rendering, the flag is combined with the pipeline's depth writing flag using a logical AND. Depth writing is enabled by default. https://bugzilla.gnome.org/show_bug.cgi?id=709827 Reviewed-by: Robert Bragg <robert@linux.intel.com>
* egl: forward declare wl_resource for compatibilityRobert Bragg2013-10-281-0/+21
| | | | | | | | | | | | | | | Depending on what version of Mesa you have then eglQueryWaylandBuffer may take a wl_buffer or wl_resource argument and the EGL header will only forward declare the corresponding type. The use of wl_buffer has been deprecated and so internally we assume that eglQueryWaylandBuffer takes a wl_resource but for compatibility we forward declare wl_resource in case we are building with EGL headers that still use wl_buffer. https://bugzilla.gnome.org/show_bug.cgi?id=710926 Reviewed-by: Neil Roberts <neil@linux.intel.com>
* wayland-server: Use wl_resource instead of wl_bufferNeil Roberts2013-10-154-6/+5
| | | | | | | | wl_buffer has been deprecated in the server API and instead compositors should be directly passing the wl_resource pointer to eglQueryWaylandBuffer. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Fix build on big-endianEmilio Pozuelo Monfort2013-10-151-1/+1
| | | | | | | | | Commit 50d1285b updated the wl_shm enum values but left one out. Update it to fix the build on big-endian. https://bugzilla.gnome.org/show_bug.cgi?id=710135 Reviewed-by: Neil Roberts <neil@linux.intel.com>
* cogl.symbols: Make Sure cogl_is_atlas_texture is ExportedChun-wei Fan2013-10-151-0/+1
| | | | | | | cogl_is_atlas_texture is supposed to be exported from the DLL/.so, so update the cogl.symbols file to ensure this. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* framebuffer: NOP _set_color_mask if mask isn't changingRobert Bragg2013-10-151-0/+3
| | | | | | | | | This makes cogl_framebuffer_set_color_mask immediately bail out if the given mask equals the framebuffer's current mask, since the cost of flushing the journal and flushing the gl state will hugely outweigh the cost of the check. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Remove padding from eulers and quaternionsRobert Bragg2013-10-142-16/+2
| | | | | | | | | | | One of the notable advantages of a Euler representation of a rotation is that it is compact but we negate that benefit if all CoglEulers have enough padding to potentially cache a quaternion in the future. Having padding for all CoglQuaternions is probably also unnecessary as higher level code can find its own ways of caching data relating to quaternions. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Avoid conflicting client/server wayland includesRobert Bragg2013-10-141-3/+0
| | | | | | | | | | | This avoids including wayland-server.h in cogl-display-private.h which avoid lots of compile time warnings that wl_buffer is deprecated. The problem is that wl_buffer is also exposed in the client side headers and isn't deprecated for clients. If we end up including the client and server headers in the same compilation unit we can get conflicting definitions. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* util: simplify _COGL_STATIC_ASSERT definitionRobert Bragg2013-10-141-20/+2
| | | | | | | | | | This updates the definition of _COGL_STATIC_ASSERT to just use _Static_assert if available or be NOP if not. We no longer worry about supporting static assertions with older compilers. This fixes some verbose warnings that newer compilers were giving with the old typedef based static assertion method. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* pipeline: notify all progends of changesRobert Bragg2013-10-141-15/+28
| | | | | | | | | | | | When a pipeline is notified of a change we now make sure to notify all progends of that change not just the progend directly associated with that pipeline. A pipeline can have private state associated with it from multiple progends because descendants will always try and cache state on ancestors to maximize the chance that the state can later be re-used. Descendants may be using different progends than the ancestors that they cache state with. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* conform: check we invalidate ancestor cached stateRobert Bragg2013-10-143-0/+96
| | | | | | | | | | | | | | | | | In the cases where we cache vertex state with an ancestor pipeline (whose vertex processing state is equivalent) we need to invalidate that state if that ancestor is later modified. This conformance test checks this case but currently fails because we only notify the progend directly associated with the pipeline being changed. In this case the pipeline can be using a different progend to the ancestor which it is caching state with so when the ancestor is changed it needs to notify all the progends that they may need to clear their private state. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* cogl-gst: add missing annotationsLionel Landwerlin2013-10-141-4/+5
| | | | | | Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 447488dd5bb0ebb6a505ef216186b3cc90ef0b79)
* fence: add scope annotationLionel Landwerlin2013-10-141-3/+3
| | | | | | Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit fbba3478a8be6b767fd13040bbfb1da19dadc842)
* buffer: add missing transfer annotationsLionel Landwerlin2013-10-141-2/+4
| | | | | | Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 84bdd679dfeda837cb080150f1d86daa4b0532ec)
* pixel-buffer: add missing transfer annotationLionel Landwerlin2013-10-141-0/+2
| | | | | | Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit c1597a3364996a17669b83dae40984840b26af04)
* frame-info: add missing annotationLionel Landwerlin2013-10-141-2/+2
| | | | | | Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit bd69f5963cb666aa929d510e915e90d8b0ea8f25)
* matrix-stack: add missing transfer annotationLionel Landwerlin2013-10-141-1/+1
| | | | | | Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 232842c1f78daccc09f0567a6a00900f930e6d13)