summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* remove internal_format and redundant error argumentswip/lazy-texture-allocateRobert Bragg2013-12-0260-543/+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.
* introduce texture loaders to make allocations lazyRobert Bragg2013-12-0228-838/+1521
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* get_texture_bits_via_offscreen(): use meta texture formatRobert Bragg2013-12-023-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.
* texture: return ints from _get_width/heightRobert Bragg2013-12-022-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.
* texture: make cogl_texture_get_format api privateRobert Bragg2013-12-0218-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.
* atlas: defer checks until allocationRobert Bragg2013-12-021-24/+24
| | | | | This defers checking the internal format and whether accelerated migration is supported until allocating the texture.
* atlas: make zero size a programmer errorRobert Bragg2013-12-021-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.
* texture: allocate on slicing/hw repeat queriesRobert Bragg2013-12-021-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.
* ensure texture allocated in _get_gl_texture() in preparationRobert Bragg2013-12-021-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.
* framebuffer: defer calculating level size until allocationRobert Bragg2013-12-024-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().
* framebuffer: if size unknown; allocate for size/vp queriesRobert Bragg2013-12-021-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.
* offscreen: allocate texture before querying slicingRobert Bragg2013-11-291-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.
* framebuffer: make format internalRobert Bragg2013-11-295-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.
* 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)
* matrix: add missing transfer annotationLionel Landwerlin2013-10-141-2/+2
| | | | | | Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 28e37775c02a8518ebbaa4846a5aef3b82080dfb)
* index-buffer: add missing transfer annotationLionel Landwerlin2013-10-141-0/+2
| | | | | | Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 59fa8b22bd6effd82cb837c597040b576b31b01c)
* attribute-buffer: add missing annotationLionel Landwerlin2013-10-141-1/+2
| | | | | | Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 8dc74800023b63af4be1aa45cd8ff77af5fc7f2e)
* attribute-buffer: add missing transfer annotationsLionel Landwerlin2013-10-141-2/+2
| | | | | | Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit de0cb3aba26e483765257e304aee7c2245a27a93)
* attribute: add constructor annotationLionel Landwerlin2013-10-141-1/+1
| | | | | | Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 7583f5fc3f457210f000953d1d17826326714421)
* attribute: add missing transfer annotationsLionel Landwerlin2013-10-141-24/+25
| | | | | | | | | | Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 7b25c8f5caad6f09543f001da3630e1bc595b4ab) Note: Commit 7b25c8f5caad mistakenly added a reference to a COGL_GTYPE_DEFINE_CLASS() macro that does not yet exist so this cherry-picked patch removes it.
* primitive: add missing descriptionLionel Landwerlin2013-09-241-0/+21
| | | | | | Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit db513174f0e1a11b8dbe9689183b20183d384f9d)
* primitive: add scope annotationLionel Landwerlin2013-09-241-2/+4
| | | | | | Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 34838553c0f590c03a501f63a0f8a614fd7871ca)
* primitive: add missing transfer annotationsLionel Landwerlin2013-09-241-27/+36
| | | | | | Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit dc5b440f0733c00be2f22ac25c4d2b03c954f664)
* display: add missing transfer annotationLionel Landwerlin2013-09-241-2/+4
| | | | | | Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 55162359213b4916a343b55ee3ceb7ffc5507070)
* renderer: add missing scope annotationLionel Landwerlin2013-09-241-1/+2
| | | | | | Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 2008493a46a045eabc3b2db330ac980a08ed710e)
* renderer: add missing transfer annotationLionel Landwerlin2013-09-241-0/+2
| | | | | | Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit c042051c012ff6074d83cab6f1567e2db7b344f9)
* context: add scope annotationLionel Landwerlin2013-09-241-2/+3
| | | | | | Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 3ad8307ab39d0a8b47e37b3a7a8c99f8e902441d)