summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Handle all formats in _cogl_texture_driver_pixel_format_to_glwip/pixel-format-2101010Robert Bragg2012-02-172-16/+38
| | | | | | | | | | The _cogl_texture_driver_pixel_format_to_gl functions for OpenGL and OpenGLES convert CoglPixelFormats into corresponding gl enums that can be used to upload texture data. Previously we were only handling a few specific formats but this patch updates the functions to handle all the formats we know about. The functions now also switch() on the format so that we will get build time warnings if we forget to handle new formats in these functions.
* Add support for X101010 and 2101010 pixel formats to fallback OpenGL renderingDamien Leone2012-02-172-0/+29
| | | | | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=660188 edit: tweaked the internal format returned by pixel_format_to_gl(); handled 1010102 formats and rebased -- Robert Bragg Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Improve pixel format detection for fallback OpenGL renderingDamien Leone2012-02-171-41/+9
| | | | | | | | | | | | | | The previous detection was based on bits per pixel only and would consider bpp >= 24 as X888 or 8888 24-bit color depth formats. This commit ensures we now use the newly added _cogl_util_pixel_format_from_masks() api that returns a CoglPixelFormat according to channel masks and color depth. This helps to add support for more pixel formats. https://bugzilla.gnome.org/show_bug.cgi?id=660188 Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Adds a _cogl_util_pixel_format_from_masks APIRobert Bragg2012-02-173-0/+144
| | | | | | | | | | | | | This adds a utility function for inferring a CoglPixelFormat from a set of channel masks, a bits-per-pixel value, a pixel-depth value and pixel byte order. This plan is to use this to improve how we map X visuals to Cogl pixel formats. This patch was based on some ideas from Damien Leone <dleone@nvidia.com> https://bugzilla.gnome.org/show_bug.cgi?id=660188
* pixel formats: Documents the internal representationRobert Bragg2012-02-171-9/+76
| | | | | | | | | This adds a comment to cogl-types.h where we define all the CoglPixelFormat enums to give lots of information about the internal representation of the format and to explain how new formats should be allocated. This information came from the discussion in bug #660188
* Add 30-bit color depth pixel formats X101010 and 2101010Damien Leone2012-02-172-12/+43
| | | | | | | | | | | | | | | | | 30-bit color depth formats are defined by using value 13 in the least significant nibble of the pixel format enumeration. This nibble encodes bytes-per-pixel and byte alignment. The _cogl_pixel_format_get_bytes_per_pixl() function is updated accordingly to support these new formats. https://bugzilla.gnome.org/show_bug.cgi?id=660188 edit: dropped the X101010 formats but also added 1010102 formats since Cogl avoids exposing any padded formats and leaves it to applications to consider the A component to be padding as needed. -- Robert Bragg Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Removes the COGL_PIXEL_FORMAT_{24,32} definesRobert Bragg2012-02-173-16/+10
| | | | | | | | | | | | | | | | | Although these are in the public headers we should assume that no one is using them since they were never documented so no could know what they are useful for. If you were to guess you'd be forgiven for thinking they were bitmasks for checking some flags to see if a format is 24 or 32 bits. If you looked further you might instead be forgiven for thinking that if you masked of the least significant nibble of a pixel-format then you could check the value against these defines. Neither of the previous operations are reliable ways to check if a format is 24 or 32bit and instead code must use then internal _cogl_pixel_format_get_bytes_per_pixel() api if they want to know the pixel size for a given format which relies on a 16 entry lookup table using the least significant nibble of a pixel-format.
* Remove COGL_UNORDERED_MASK defineRobert Bragg2012-02-175-32/+23
| | | | | | | | | | | | | Although it's in a public header nothing should be using this define since it's not documented what it could be used for. The cases where we were using it internally were quite fragile because they were trying to mask information from the least significant nibble of CoglPixelFormat but really that nibble just has to be dealt with using lookup tables. The least significant nibble of a pixel format gives information about the bytes per pixel and whether the components are byte aligned but the information needs to be accessed using _cogl_pixel_format_get_byes_per_pixel() and _cogl_pixel_format_is_endian_dependant().
* Remove COGL_UNPREMULT_MASK defineRobert Bragg2012-02-175-9/+5
| | | | | | | | Since (A & ~COGL_PREMULT_BIT) is basically as readable as (A & COGL_UNPREMULT_MASK) this patch removes the mask define. Without the mask the code is slightly more explicit and there's less risk in error caused by us forgetting to update the COGL_UNPREMULT_MASK if the way CoglPixelFormat is defined evolves.
* Adds _cogl_pixel_format_is_endian_dependant apiRobert Bragg2012-02-172-0/+37
| | | | | | | | This adds an internal utility function _cogl_pixel_format_is_endian_dependant() that can query whether accessing the components of a given format depends on the endianness of the current host CPU or whether a pixel can be loaded as a word and channels accessed using bit masking and shifting.
* moves and renames _cogl_get_format_bppRobert Bragg2012-02-1715-67/+87
| | | | | | | | | | | This moves _cogl_get_format_bpp from cogl-bitmap.c to cogl.c and renames it to _cogl_pixel_format_get_bytes_per_pixel. This makes it clearer that it doesn't return bits per pixel and makes the naming consistent with other cogl api. The prototype has been moved to cogl-private.h since it seems we should be aiming to get rid of cogl-internal.h at some point. The patch also adds a simple gtk-doc comment since we might want to make this api public.
* cogl-private.h: include cogl-context.hRobert Bragg2012-02-171-0/+2
| | | | | cogl-private.h contains prototypes depending on CoglContext so explicitly include cogl-context.h
* Move all types/prototypes from cogl.h -> cogl-context.hRobert Bragg2012-02-1710-1323/+1348
| | | | | | | | | | 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 cogl-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.
* Clean up cogl 1.x/2.0 header separationRobert Bragg2012-02-171-35/+37
| | | | | | | | | The cogl_public_h variable in cogl/Makefile.am was a mixture of 1.x headers and experimental headers which meant that glib-mkenums was processing lots of experimental api headers. This patch lists experimental api headers under the cogl_experimental_h variable instead. This patch also ensures we undef the COGL_ENABLE_EXPERIMENTAL_* defines when running the gobject introspection scanner for Cogl-1.0.gir
* Fix build on OSXEmmanuele Bassi2012-02-151-0/+1
| | | | | | A missing include prevents Cogl from building on OSX. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Ensure that the CoglPango GIR is built against the correct libcoglEmmanuele Bassi2012-02-151-1/+1
| | | | | | | If we don't specify the dependency we may end up linking against a stale libcogl.la, or, worse, a globally installed one. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Update cogl.symbolsChun-wei Fan2012-02-151-0/+1
| | | | | | | Add cogl_pipline_set_layer_null_texture... which was just added to the COGL API Checked with Neil Roberts <neil@linux.intel.com> on IRC.
* Update .gitignoreJasper St. Pierre2012-02-141-4/+15
| | | | Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Fix some doc issuesJasper St. Pierre2012-02-146-12/+12
| | | | Reviewed-by: Neil Roberts <neil@linux.intel.com>
* pipeline-state: Fix crash in the get_all_uniform_values functionNeil Roberts2012-02-131-9/+10
| | | | | | | | | | | The get_all_uniform_values function tries to walk the parent hierarchy of pipelines to find pipelines overriding the uniforms state and then grabs the values from the override. However it was accessing data inside the ‘big state’ even if the pipeline didn't override the uniforms state so it would crash if it encountered a parent pipeline with no big state. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* test-snippets: Add a test case for sampling arbitrary unitsNeil Roberts2012-02-131-0/+43
| | | | | | | This adds a sub-test that samples from two texture units by naming their layer numbers. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* tests: Move the create_color_texture function to test-utilsNeil Roberts2012-02-133-21/+30
| | | | | | | This adds a shared utility function to create a 1x1 texture with a given color. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* test-snippets: Add a test for using cogl_sampler in tex hookNeil Roberts2012-02-131-0/+29
| | | | | | | This adds a test for doing custom sampling using the cogl_sampler variable in the texture lookup hook. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* test-snippets: Split up the tests into multiple functionsNeil Roberts2012-02-131-31/+195
| | | | | | | | | There were lots of tests bundled into a single long function which was becoming a bit unwieldy. It was also quite difficult to match up the test's drawing with its color test. This patch just moves each little sub test into its own function. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Pass the sampler object to snippet hooks on the texture_hookupNeil Roberts2012-02-132-19/+28
| | | | | | | | | | The snippet hook COGL_SNIPPET_HOOK_TEXTURE_LOOKUP now gets passed an extra variable called cogl_sampler which is the sampler attached to this layer. For example this will be useful when implementing the blur effect in Clutter so that it can make the texture hook for that layer sample the texture multiple times. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* glsl: always emit sampler uniforms for non NULL layersRobert Bragg2012-02-132-33/+61
| | | | | | | | | | | | | There might be custom hooks that want to sample arbitrary layers even though they aren't referenced as part of the auto generated layer combine code. This ensures the sampler uniforms are always output for non-null layers so at least these can be used. We may consider changing this later to always emit a wrapper cogl_sampleX() function for each layer so all samples of a layer can consistently be modified by a COGL_SNIPPET_HOOK_TEXTURE_LOOKUP hook. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* glsl: Use layer numbers not unit numbers for builtin uniformsNeil Roberts2012-02-132-8/+6
| | | | | | | | | When generating GLSL code, the names of the builtin uniforms for the sampler and the layer constant have been renamed to use the layer number not the unit number. This will make it easier if we ever want to make them public. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* pipeline: Use layer numbers not unit numbers in the combine stringsNeil Roberts2012-02-134-76/+158
| | | | | | | | | | | | | | | | | | | | | In a combine string the application can specify TEXTURE_? as a source to sample from the texture attached to a particular unit. The number specified here was being interpreted as a unit index. This is not helpful to applications because theoretically the unit index is an internal implementation detail so they can't reliably determine what it is. This patch changes them to be interpreted as layer indices instead. To make this work the enums in CoglPipelineCombineSource are no longer directly mapped to GLenums. Otherwise it implies a low limit on the number of layer indices because there are only 32 reserved numbers between GL_TEXTURE0 and GL_ACTIVE_TEXTURE. This also fixes a bug in the ARBfp fragend where it was generating code using the texture type of the layer doing the referencing rather than the layer that was being referenced. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Add a version of _cogl_pipeline_get_layer which does not create itNeil Roberts2012-02-132-5/+15
| | | | | | | | | This adds _cogl_pipeline_get_layer_with_flags which takes a set of flags to modify the behaviour. The only flag currently available is one to disable creating the layer if the layer index does not already exist. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Add a test for pipelines with sparse layer indicesNeil Roberts2012-02-133-0/+92
| | | | | | | | | | | | | | | | | | | | | | There are currently quite a few places in Cogl where we muddle the layer index and the texture unit number. The theory is that these two numbers shouldn't be related and it should be possible to pick large layer numbers with gaps. This patch adds a test case to check that we can reference a large layer number from a texture combine string by creating a pipeline with only three layers but that have very large layer indices. This doesn't currently work because Cogl interprets the numbers in the combine strings to be the unit indices and not the layer indices. The documentation however calls these numbers layer numbers so presumably it is not meant to work that way. There are probably many other bugs related to this that the test case doesn't pick up so it would be good to add some more tests here, for example to test that you can bind an attribute to the texture coordinates for a large layer index. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* test-texture-3d: Add a test for multi-texturing 3D and 2D texturesNeil Roberts2012-02-131-0/+64
| | | | | | | | | The ARBfp fragend has a bug when the texture combine string references another texture unit where it will use the texture type of the current layer rather than the texture type of the layer the string refers to. This patch adds a small test which demonstrates that. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* test-texture-3d: Port to CoglNeil Roberts2012-02-133-78/+79
| | | | | | | This ports the texture-3d test to Cogl instead of depending on Clutter. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Add cogl_pipeline_set_layer_null_texture()Neil Roberts2012-02-133-0/+71
| | | | | | | | | | | | | | This adds a public function to replace the texture for a layer with the default white texture. It is equivalent to calling cogl_pipeline_set_layer_texture with NULL for the texture object except that it also lets you choose a type for the texture. The idea is that applications using a base pipeline to make multiple copies that can share the generated shaders can use this function to make the layer come into existence with the right texture type. Previously the idiom would be to create a 1x1 dummy texture of the right type but this ends up creating lots of redundant little textures. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogl-pipeline: Fix comparing the texture data state for NULL texturesNeil Roberts2012-02-131-4/+17
| | | | | | | | | | When comparing the texture data for a pipeline layer it tries to get the GL texture handle out of the texture object. However it's valid for a layer to have a NULL texture object but in that case the code would just crash. This patch fixes it to compare the texture types when the texture object is NULL. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogl-pipeline-layer: Use CoglTextureType instead of GL target enumNeil Roberts2012-02-1311-172/+204
| | | | | | | | | | | | | | | | | | | | | | | | | Instead of storing the GLenum for the target of the last used texture for a layer it now stores the CoglTextureType instead. The state name has been renamed to 'texture type' instead of 'texture target'. Previously the default pipeline layer would store 0 here to represent that there is no texture. This has been changed to store COGL_TEXTURE_TYPE_2D instead which means that all pipeline layers always have a valid value for the texture type. Any places that were previously fetching the texture from a layer to determine the target (for example when generating shaders or when enabling a particular texture target) now use the texture type instead. This means they will work even for layers that don't have a texture. This also changes it so that when binding a fallback texture instead of always using a 2D texture it will now use the default texture corresponding to the texture type of the layer. That way when the generated shader tries to do a texture lookup for that type of texture it will get a valid texture object. To make this work the patch adds a default texture for 3D textures to the context and also makes the default rectangle texture actually be a rectangle texture instead of using a 2D texture. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* Add _cogl_texture_get_type()Neil Roberts2012-02-1311-0/+96
| | | | | | | | | | | | | | | | This adds an internal function to get the type of the underlying hardware texture for any CoglTexture. It can return one of three values to represent 2D textures, 3D textures or rectangle textures. The idea is that this can be used as a replacement for cogl_texture_get_gl_texture when only the target is required to make it a bit less GL-centric. The implementation adds a new virtual function which all of the texture backends now implement. The enum is in a public header because a later patch will want to use it from the CoglPipeline API. We may want to consider making the function public too later. Reviewed-by: Robert Bragg <robert@linux.intel.com>
* cogl/Makefile.am: Filter out SDL winsys for Visual C++ buildsChun-wei Fan2012-02-131-3/+3
| | | | | | | | | | Just being a bit paranoid here, as the SDL winsys sources are dealt in the projects as they are not built for all configurations to avoid them included more than once in the projects, which can cause trouble. https://bugzilla.gnome.org/show_bug.cgi?id=669785 Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Update cogl.symbolsChun-wei Fan2012-02-131-183/+203
| | | | | | | | | | | -Adapt to the removal of _EXP mangling from many of the experimental functions -Adapt to newly added/replaced APIs -_cogl_handle_atlas_texture_get_type is gone https://bugzilla.gnome.org/show_bug.cgi?id=669785 Reviewed-by: Neil Roberts <neil@linux.intel.com>
* cogl-in-gles-core-functions.h: Remove stray ';'Chun-wei Fan2012-02-131-1/+1
| | | | | | | | There is a stray ';' which some compilers are not fond of. https://bugzilla.gnome.org/show_bug.cgi?id=669785 Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Win32: Update predefined cogl-defines.h'sChun-wei Fan2012-02-132-0/+16
| | | | | | | | | | | | | | -Add a define for COGL_HAS_GLIB_SUPPORT, the Visual C++ projects will build GLib support for COGL for all builds at this time, unless there is a significant call for the need of a COGL Visual C++ build with no dependency on GLib -Pre-define COGL_SYSDEF_POLL* as listed in the default values in commit 74974752 since Windows does not have poll.h and thus does not have special values for these. https://bugzilla.gnome.org/show_bug.cgi?id=669785 Reviewed-by: Neil Roberts <neil@linux.intel.com>
* Update Visual C++ property sheetsChun-wei Fan2012-02-102-2/+2
| | | | | Make sure GLib support functions are placed into the cogl.def file so that they will be exported.
* buffer: explicitly relate buffers to a contextRobert Bragg2012-02-0926-148/+214
| | | | | | | | 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: Neil Roberts <neil@linux.intel.com>
* debug: don't overlay wireframeRobert Bragg2012-02-091-41/+45
| | | | | | | | | | When using COGL_DEBUG=wireframe we were overlaying a wireframe of the users geometry over the top of what was drawn for each primitive. It seems to be more useful though that if the wireframe debug option has been enabled then we should draw only the wireframes instead of overlaying them. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* cogl-crate: remove spurious cogl_set_depth_test_enabled callRobert Bragg2012-02-091-2/+0
| | | | | | | | | Use of cogl_set_depth_test_enabled() has been deprecated for some time and cogl-create already uses the new api for enabling depth testing so it was just an oversight that we forgot to remove the old call to cogl_set_depth_test_enabled(). Reviewed-by: Neil Roberts <neil@linux.intel.com>
* journal: use pipeline term instead of sourceRobert Bragg2012-02-091-13/+13
| | | | | | | | | | | Since we are adapting the Cogl api to be less stateful one of the things we no longer require is the cogl_set_source() api since a pipeline can be explicitly passed as an argument when drawing. This means the term "source" has been deprecated and internally we should aim to consistently use the term "pipeline" instead. This patch updates the journal code to use the term pipeline instead of source. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* debug: Adds COGL_DEBUG=winsys optionRobert Bragg2012-02-091-1/+2
| | | | | | | | | Although we internally had a COGL_DEBUG_WINSYS enum we weren't providing a way to enable that via the COGL_DEBUG environment variable. This adds a "winsys" option that can be used to enable printing of winsys debug notes. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* display: Remove _EXP symbol mangling and add gtk-docRobert Bragg2012-02-091-27/+112
| | | | | | | | | | We are in the process of removing all _EXP suffix mangling for experimental APIs (Ref: c6528c4b6c3c34) and adding missing gtk-doc comments so that we can instead rely on the "Stability: unstable" markers in the gtk-doc comments. This patch tackles the display api symbols. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* framebuffer: Add cogl_framebuffer draw methodsRobert Bragg2012-02-0925-724/+958
| | | | | | | | | | | | | | | | | | | | | 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: Neil Roberts <neil@linux.intel.com>
* examples: use framebuffer matrix stack apisRobert Bragg2012-02-093-17/+23
| | | | | | | | | | Instead of using apis like cogl_push/pop_matrix, cogl_rotate, cogl_translate and cogl_scale all the examples now use the cogl_framebuffer_* equivalents. Our aim is to remove the need for the default CoglContext and so we are switching towards apis that are explicitly tied to a specific context. Reviewed-by: Neil Roberts <neil@linux.intel.com>
* examples: use cogl_framebuffer_clear4f not cogl_clearRobert Bragg2012-02-097-24/+12
| | | | | | | | | | | | | cogl_clear depends on the default CoglContext which we are trying to steer the API away from requiring. cogl_framebuffer_clear4f is explicitly passed a framebuffer pointer which is implicitly related to a specific context. This updates all the examples to use cogl_framebuffer_clear4f instead of cogl_clear and removes any redundant CoglColor that was previously passed to cogl_clear. Reviewed-by: Neil Roberts <neil@linux.intel.com>