summaryrefslogtreecommitdiff
path: root/cogl
Commit message (Collapse)AuthorAgeFilesLines
* Query the framebuffer stencil bits instead of assuming it's globalNeil Roberts2013-01-227-38/+55
| | | | | | | | | | | | | | | Previously when the context was initialised Cogl would query the number of stencil bits and set a private feature flag to mark that it can use the buffer for clipping if there was at least 3. The problem with this is that the number of stencil bits returned by GL_STENCIL_BITS depends on the currently bound framebuffer. This patch adds an internal function to query the number of stencil bits in a framebuffer and makes it use that instead when determining whether it can push the clip using the stencil buffer. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit e928d21516a6c07798655341f4f0f8e3c1d1686c)
* Add a public cogl_framebuffer_get_depth_bits() functionNeil Roberts2013-01-224-2/+32
| | | | | | | | | Cogl publicly exposes the depth buffer state so we might as well have a function to query the number of depth bits of a framebuffer. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 853143eb10387f50f8d32cf09af31b8829dc1e01)
* framebuffer: Bind the framebuffer before querying the bitsNeil Roberts2013-01-227-89/+70
| | | | | | | | | | | | | | | The GL framebuffer driver now makes sure to bind the framebuffer before counting the number of bits. Previously it would just query the number of bits for whatever framebuffer happened to be used last. In addition the virtual for querying the framebuffer bits has been modified to take a pointer to a structure instead of a separate pointer to each component. This should make it slightly more efficient and easier to maintain. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit e9c58b2ba23a7cebcd4e633ea7c3191f02056fb5)
* Query glX* functions before getting the context to fix GL3 driverNeil Roberts2013-01-223-172/+183
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The GL3 context is created using the glXCreateContextAttribs function which is part of the GLX_ARB_create_context extension. However previously the function pointers from GLX extensions were only retrieved once the GL context is created. That meant that the GL3 context creation function would always assume that the extension is not supported so it would always fail. This patch changes it to query the functions when the renderer is set up instead. The base winsys feature flags that are determined while querying the functions are stored in a member of CoglGLXRenderer. These are then copied to the CoglContext when it is initialised. The spec for glXGetProcAddress says that the functions returned are context-independent. That implies that it is safe to call it without binding a context although that is not explicitly stated as far as I can tell. A big of googling finds this DRI documentation which says it can be used without a context: http://dri.freedesktop.org/wiki/glXGetProcAddressNeverReturnsNULL And also this code sample: http://www.opengl.org/wiki/Tutorial:_OpenGL_3.0_Context_Creation_%28GLX%29 One point that makes me concerned that this might not always work in practice is that the code in SDL2 to create a GL3 context first creates a dummy GL2 context in order to have something bound before it calls glXGetProcAddress. I think this may just be a misunderstanding based on how wglGetProcAddress works however. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 04a7aca9a98e84e43ac5559305a1358112902e30)
* Also flip the virtual coordinates when iterating spansNeil Roberts2013-01-221-6/+9
| | | | | | | | | | | | | | | | _cogl_texture_spans_foreach_in_region first swaps over the texture coordinates if they are flipped so that it can always iterate in a positive direction. It sets a flag so that it will remember that the coordinates are flipped. Before invoking the callback it is meant to reflip the coordinates so that the callee doesn't need to be aware of the flipping. However it was only flipping the sub-texture coordinates and not the virtual coordinates. This was causing sliced textures to draw their slice rectangles with the wrong geometry. test-backface-culling was failing because of this. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit e7338a1e09cb22151374aefa6f0bb58485af9189)
* texture-2d-slice: Fix the foreach_sub_texture_in_region implementationNeil Roberts2013-01-221-11/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were a few problems with the sub texture iterating code of sliced textures which were causing some conformance tests to fail when NPOT textures are disabled: • The spans are stored in un-normalized coordinates and the coordinates passed to the foreach function are normalized. The function was trying to un-normalize them before passing them to the span iterator code but it was using the wrong factor which was causing it to actually doubley normalize them. • The shim function to renormalize the coordinates before passing them to the callback was renormalizing the sub-texture coordinates instead of the virtual coordinates. The sub-texture coordinates are already in the right scale for whatever is the underlying texture so we don't need to touch them. Instead we need to normalize the virtual coordinates because these are coming from the un-normalized coordinates that we passed to the span iterating code. • The normalize factors passed to the span iterating were always 1. The code uses this normalizing factor to round the incoming coordinates to the nearest multiple of a full texture. It divides the coordinates by the factor rather than multiplying so it looks like we should be passing the virtual texture size here. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit c9773566b0ec0a17b34c440090529de8cff9609e)
* texture: Adds cogl_texture_set_data convenience apiRobert Bragg2013-01-222-0/+88
| | | | | | | | | | | This adds a cogl_texture_set_data function that is basically just a convenience wrapper around cogl_texture_set_region. In the common case where you want to upload the full contents of a mipmap level though this api takes 4 less arguments (6 in total) so it's a bit simpler. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit e651dbdc4e4f03016a3dee513e3680270a4a9142)
* Allow lazy texture storage allocationRobert Bragg2013-01-2233-402/+699
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Consistent with how we lazily allocate framebuffers this patch allows us to instantiate textures but still specify constraints and requirements before allocating storage so that we can be sure to allocate the most appropriate/efficient storage. This adds a cogl_texture_allocate() function that is analogous to cogl_framebuffer_allocate() which can optionally be called to explicitly allocate storage and catch any errors. If this function isn't used explicitly then Cogl will implicitly ensure textures are allocated before the storage is needed. It is generally recommended to rely on lazy storage allocation or at least perform explicit allocation as late as possible so Cogl can be fully informed about the best way to allocate storage. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit 1fa7c0f10a8a03043e3c75cb079a49625df098b7) Note: This reverts the cogl_texture_rectangle_new_with_size API change that dropped the CoglError argument and keeps the semantics of allocating the texture immediately. This is because Mutter currently uses this API so we will probably look at updating this later once we have a corresponding Mutter patch prepared. The other API changes were kept since they only affected experimental api.
* texture: add width/height members to base CoglTextureRobert Bragg2013-01-2218-228/+104
| | | | | | | | | | | There was a lot of redundancy in how we tracked the width and height of different texture types which is greatly simplified by adding width and height members to CoglTexture directly and removing the get_width and get_height vfuncs from CoglTextureVtable Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit 3236e47723e4287d5e0023f29083521aeffc75dd)
* Move _cogl_texture_get_gl_format to -texture-gl.cRobert Bragg2013-01-2210-17/+17
| | | | | | | | | This moves the _cogl_texture_get_gl_format function from cogl-texture.c to cogl-texture-gl.c and renames it _cogl_texture_gl_get_format. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit f8deec01eff7d8d9900b509048cf1ff1c86ca879)
* framebuffer: split out GL read_pixels codeRobert Bragg2013-01-229-363/+414
| | | | | | | | | | | This moves the direct use of GL in cogl-framebuffer.c for handling cogl_framebuffer_read_pixels_into_bitmap() into driver/gl/cogl-framebuffer-gl.c and adds a ->framebuffer_read_pixels_into_bitmap vfunc to CoglDriverVtable. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit 2f893054d6754e6bc7983f061b27c7858f1a593c)
* Remove cogl-internal.hRobert Bragg2013-01-2256-217/+155
| | | | | | | | | | | | 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: Neil Roberts <neil@linux.intel.com> (cherry picked from commit 01cc82ece091aa3bec4c07fdd6bc9e5135fca573)
* build: Hide cogl_pipeline_cache_{new,free}()Damien Lespiau2013-01-224-8/+6
| | | | | | | Those symbols should not be public and were exported as they started with cogl_. (cherry picked from commit 68a55f1dc70ea60fcccbe226029e585886feddc2)
* enum-types: Fix the header guard #endif commentDamien Lespiau2013-01-221-1/+1
| | | | | | Something left from the Clutter split. (cherry picked from commit f148b7e2ff1fb86cab7f4b7be869bfdba4f91100)
* doc: Fix the remaining broken internal cross-referencesDamien Lespiau2013-01-2214-57/+57
| | | | | | | Symbols changed names, %1 makes gtk-doc sad and some referenced symbols were missing in the -sections.txt file. (cherry picked from commit c12919c321186ac7b223bc4f82c588ca2f199d67)
* doc: Use Docbook's <constant> for external constantsDamien Lespiau2013-01-222-11/+16
| | | | | | | For external (non gtk-doc even) constants, we can use <constant> to correctly tag those without gtk-doc trying to cross-reference them. (cherry picked from commit 78d22c6cd44a2279adcd2b94c3317292af861c70)
* doc: Add a missing '*' to the documentation of CoglFilterReturnDamien Lespiau2013-01-221-1/+1
| | | | (cherry picked from commit 0b9bdd5aaf2616993c4c20c7d7317daf178b19fd)
* doc: Put the opening '{' at the end of combined typedefsDamien Lespiau2013-01-222-6/+3
| | | | | | | | | | | | | gtk-doc is not smart enough to parse things like: typedef struct { ... } CoglFoo; but needs the '{' at the end of the first line. (cherry picked from commit d1187550ef547305fdeb8a22a7e39a95611a0e1d)
* doc: Fix FALSE documentationDamien Lespiau2013-01-221-1/+1
| | | | | | Typo with the copy & paste from TRUE. (cherry picked from commit c7d4a13889ee5681a237a0d2a0fbbdca79120f17)
* doc: Fixup type referencesDamien Lespiau2013-01-223-5/+5
| | | | | | | gtk-doc needs the types in -sections.txt to be able to do cross-references. Add all those currently generating warnings. (cherry picked from commit e57a21d2608f0885e6f2eb3a017feb7dffb7a63c)
* doc: Don't use '::' to denote an object propertyDamien Lespiau2013-01-221-13/+13
| | | | | | | | | That's actually for signals in gtk-doc and we're not dealing with GObjects so it's not really appropriate. Used <structfield> as it's the closest tag I could find to describe a 'property' of a CoglObject and gives a generic style in the produced HTML. (cherry picked from commit 8b485d57577cff227a0c7a2e6c06d8d277821374)
* doc: Populate cogl-types a bit more and move it to the general sectionDamien Lespiau2013-01-222-16/+15
| | | | | | | | | | I just added the general types creating warnings in the current state of the documentation (ie the ones references by already documented functions) and moved the section from the 'Utility' section to the 'General' section which I believe is a better fit as they are used by more than one type and not really utilities. (cherry picked from commit c51b147789763863ef32482d7ffa936160ed7c93)
* doc: Don't use the HTML <ul> but the DocBook equivalentDamien Lespiau2013-01-221-7/+8
| | | | | | Of course, this confused gtk-doc. (cherry picked from commit be512104784a9200a2e98a75d16a56e3897a8845)
* doc: Fix the remaining warning around the depth stateDamien Lespiau2013-01-223-10/+9
| | | | | | | Various changes have led to the current, separate from the pipeline, depth state, this commit fixes the remaining waring around that. (cherry picked from commit 111e687e722ad67a0e1c09f881c6282ccb06410b)
* doc: Expose CoglDepthStateDamien Lespiau2013-01-221-5/+9
| | | | | | It wasn't included to the documention up to now. (cherry picked from commit 826c0d5c8333ad31595d690d7c8753f84d12b2ad)
* doc: Use <ulink> to make Gimbal Lock reactiveDamien Lespiau2013-01-221-3/+5
| | | | | | | Instead of just having the reference at the end of the paragraph. Usually seen as more usable. (cherry picked from commit 6988d3ae61ab16fb298b34d2bd31860833f04186)
* doc: Unhide cogl-matrix-stack.hDamien Lespiau2013-01-221-1/+1
| | | | | | The documentation welcomes a new 2.0 API. (cherry picked from commit 8d78957c8d29b89c7bf352131d84c9755083eed9)
* doc: Document CoglColorDamien Lespiau2013-01-221-0/+4
| | | | (cherry picked from commit a0dfba1eb1c541490611a021799e656bf43a04fe)
* doc: Document the members of CoglPollFDEventDamien Lespiau2013-01-221-0/+7
| | | | (cherry picked from commit 7cc94c2a994a774f0d8db172c9e0bec506bd2287)
* doc: Fix various mismatches between arguments and their documentationDamien Lespiau2013-01-2213-20/+39
| | | | | | | Argument names and @$arg suffered from various little mismatches, fix them in a batch commit. (cherry picked from commit d2ac3c5a88d980e7519c98bd261111b93cf73a6e)
* doc: Make a pass on CoglRenderer argument documentationDamien Lespiau2013-01-222-2/+18
| | | | | | Various arguments where missing, added them. (cherry picked from commit 6e6ee4acb5524ced2f82d42d9c6a706f84f8184c)
* doc: Finish describing the arguments of cogl_error_matches()Damien Lespiau2013-01-221-1/+3
| | | | (cherry picked from commit 8f429d9ce45e3df204db0bdc0d988fd07f103282)
* doc: Fix small typo of sequenceDamien Lespiau2013-01-221-1/+1
| | | | (cherry picked from commit 09706dc78178d022b4313572600a245112d23fd9)
* doc: Update the section name and description of CoglIndicesDamien Lespiau2013-01-221-3/+2
| | | | | | | | cogl-index-range was the old API, update the section name to match what is declared in the documentation. Also update the short description to better match the new API. (cherry picked from commit d73df38ff2a8ebe477e139e5ac20838c8f4364bb)
* doc: s/Fuction/Function/Damien Lespiau2013-01-223-3/+3
| | | | (cherry picked from commit 8e62a12cff9ba0a267d199c359fdc8e591f65264)
* doc: Fix argument syntax of existing commment blocksDamien Lespiau2013-01-224-15/+15
| | | | | | | | | Fixes: Parsing comment block file : parameter expecter by correctly declaring parameters. (cherry picked from commit 2fe9bc2017fa966ab445674a530aac0c17204040)
* doc: Fix a typo in the description of cogl-bitmapDamien Lespiau2013-01-221-1/+1
| | | | (cherry picked from commit 423b8f8c62b1f73d6b0e24a5689428821e154703)
* doc: Expose the Cogl GLES 2.0 facilities in the documentationDamien Lespiau2013-01-221-0/+1
| | | | (cherry picked from commit 0c2344b9aafe4afdf7782fd9badc451de79b7a63)
* doc: Add missing symbol in cogl_framebuffer_get_context() documentationDamien Lespiau2013-01-221-0/+1
| | | | (cherry picked from commit 146a1bfc2655c7e7ed0a5a4fd64b490385159f49)
* doc: Use Returns: to annotate return valuesDamien Lespiau2013-01-222-2/+2
| | | | | | | | | | | | gtk-doc complains that having a sentence starting by Return is a bit ambiguous and it'd rather see 'Returns:' spelled out. Fixes 2 warnings: warning: Free-form return value description in $symbol. Use `Returns:' to avoid ambiguities (cherry picked from commit 9718f31717b3a0e01b7c4c69cea138f39d23c0e0)
* Don't use #if with defines that are either defined or notDamien Lespiau2013-01-223-4/+4
| | | | | | | | | COGL_HAS_* and COGL_ENABLE_DEBUG are either defined in config.h or not. So let's test against this, not against their truth value, this allow us to use -Wundef to catch undefined macros in preprocessor directives. (cherry picked from commit 73b62832f24711073b0876a6c0f5c61727842c1c)
* sdl: Bind the default window when currently bound window is destroyedNeil Roberts2013-01-221-1/+12
| | | | | | | | | | | | | | Cogl always needs to have the context bound to something so that it can freely create resources such as textures even if there is no current window. When the currently bound SDLWindow is destroyed, SDL apparently explicitly unbinds the GL context. If something then later for example tries to create a texture Cogl would start getting GL errors and fail. To fix this the SDL winsys now just binds the dummy window before deiniting the currently bound onscreen. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 2c0cfdefbb9d1ac5097d98887d3581b67a324fae)
* matrix-stack: make CoglMatrixStack publicRobert Bragg2013-01-2216-423/+935
| | | | | | | | | | | | We have found several times now when writing code using Cogl that it would really help if Cogl's matrix stack api was public as a utility api. In Rig for example we want to avoid redundant arithmetic when deriving the matrices of entities used to render and we aren't able to simply use the framebuffer's matrix stack to achieve this. Also when implementing cairo-cogl we found that it would be really useful if we could have a matrix stack utility api. (cherry picked from commit d17a01fd935d88fab96fe6cc0b906c84026c0067)
* matrix-stack: only maintain composite_gets in debug buildsRobert Bragg2013-01-222-1/+9
| | | | | | | | | | | | | | | At times there can be huge numbers of CoglMatrixEntry structures allocated if they are being used to track the transform of many drawing commands or objects in a scenegraph. Therefore the size of a CoglMatrixEntry should be kept as small as possible both to help reduce the memory usage of applications but also to improve cache usage since matrix stack manipulations are performance critical at times. This reduces the size of CoglMatrixEntry structures for non-debug builds by removing the composite_gets counter used to sanity check how often the transform for an entry is resolved. (cherry picked from commit c400b86681a328b1e12b7e120e9c3f4f12c356e0)
* matrix-stack: move pointer to top of CoglMatrixEntryRobert Bragg2013-01-221-1/+1
| | | | | | | | This moves the parent pointer member to the top of the CoglMatrixEntry structure since it will lead to wasted padding when we build for 64bit cpus. (cherry picked from commit 42b4750070286a6404b103d8a827a46efb6b344c)
* matrix-stack: getting parent ptr before freeingRobert Bragg2013-01-221-1/+5
| | | | | | | | | | When unrefing a CoglMatrixEntry we walk up the ancestry unrefing and freeing entries until we find an entry that doesn't need to be freed. The problem fixed by this patch was that we didn't dereference the parent member of each entry until after the entry was freed and so there was the potential for reading a junk parent pointer back. (cherry picked from commit e5d836b84acb35a009854a0cc0892320023789d1)
* journal: don't call cogl_attribute_buffer_new with NULLRobert Bragg2013-01-221-1/+1
| | | | | | | | It is considered an error to pass a NULL data pointer to cogl_attribute_buffer_new so we now call cogl_attribute_buffer_new_with_size instead. (cherry picked from commit 8e201574b9c35847aa4e999a391741538a0b356b)
* x11: Replace all internal usage of cogl_xlib_get_display()Damien Lespiau2013-01-222-9/+19
| | | | | | And use the renderer replacement, cogl_xlib_renderer_get_display() (cherry picked from commit ea355792e88b09b0b0afa6fb5c5acc311d41688e)
* Fix handling of binding errors when uploading a full textureNeil Roberts2013-01-222-5/+25
| | | | | | | | | | | Both the texture drivers weren't handling errors correctly when a CoglPixelBuffer was used to set the contents of an entire texture. This was causing it to hit an assertion failure in the pixel buffer tests. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 888733d3c3b24080d2f136cedb3876a41312e4cf)
* texture: expose mipmap level in set region apisRobert Bragg2013-01-2224-208/+529
| | | | | | | | | | | | | | | | | | | cogl_texture_set_region() and cogl_texture_set_region_from_bitmap() now have a level argument so image data can be uploaded to a specific mipmap level. The prototype for cogl_texture_set_region was also updated to simplify the arguments. The arguments for cogl_texture_set_region_from_bitmap were reordered to be consistent with cogl_texture_set_region with the source related arguments listed first followed by the destination arguments. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit 3a336a8adcd406b53731a6de0e7d97ba7932c1a8) Note: Public API changes were reverted in cherry-picking this patch