This adds the following new public experimental functions to set
uniform values on a CoglPipeline:
void
cogl_pipeline_set_uniform_1f (CoglPipeline *pipeline,
int uniform_location,
float value);
void
cogl_pipeline_set_uniform_1i (CoglPipeline *pipeline,
int uniform_location,
int value);
void
cogl_pipeline_set_uniform_float (CoglPipeline *pipeline,
int uniform_location,
int n_components,
int count,
const float *value);
void
cogl_pipeline_set_uniform_int (CoglPipeline *pipeline,
int uniform_location,
int n_components,
int count,
const int *value);
void
cogl_pipeline_set_uniform_matrix (CoglPipeline *pipeline,
int uniform_location,
int dimensions,
int count,
gboolean transpose,
const float *value);
These are similar to the old functions used to set uniforms on a
CoglProgram. To get a value to pass in as the uniform_location there
is also:
int
cogl_pipeline_get_uniform_location (CoglPipeline *pipeline,
const char *uniform_name);
Conceptually the uniform locations are tied to the pipeline so that
whenever setting a value for a new pipeline the application is
expected to call this function. However in practice the uniform
locations are global to the CoglContext. The names are stored in a
linked list where the position in the list is the uniform location.
The global indices are used so that each pipeline can store a mask of
which uniforms it overrides. That way it is quicker to detect which
uniforms are different from the last pipeline that used the same
CoglProgramState so it can avoid flushing uniforms that haven't
changed. Currently the values are not actually compared which means
that it will only avoid flushing a uniform if there is a common
ancestor that sets the value (or if the same pipeline is being flushed
again - in which case the pipeline and its common ancestor are the
same thing).
The uniform values are stored in the big state of the pipeline as a
sparse linked list. A bitmask stores which values have been overridden
and only overridden values are stored in the linked list.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
This adds two new experimental public functions to replace the old
internal _cogl_pipeline_set_cull_face_state function:
void
cogl_pipeline_set_cull_face_mode (CoglPipeline *pipeline,
CoglPipelineCullFaceMode cull_face_mode);
void
cogl_pipeline_set_front_face_winding (CoglPipeline *pipeline,
CoglWinding front_winding);
There are also the corresponding getters.
https://bugzilla.gnome.org/show_bug.cgi?id=663628
Reviewed-by: Robert Bragg <robert@linux.intel.com>
This exposes cogl_sub_texture_new() and cogl_is_sub_texture() as
experimental public API. Previously sub-textures were only exposed via
cogl_texture_new_from_sub_texture() so there wasn't a corresponding
CoglSubTexture type. A CoglSubTexture is a high-level texture defined as
a sub-region of some other parent texture. CoglSubTextures are high
level textures that implement the CoglMetaTexture interface which can
be used to manually handle texture repeating.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
It's useful to be able to query back the number of
point_samples_per_pixel that may have previously be chosen using
cogl_framebuffer_set_samples_per_pixel().
Reviewed-by: Neil Roberts <neil@linux.intel.com>
When we make CoglTexture2D public as experimental api we forgot to add a
corresponding section the experimental 2.0 reference manual.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
This exposes CoglTextureRectangle in the experimental cogl 2.0 api. For
now we just expose a single constructor;
cogl_texture_rectangle_new_with_size() but we can add more later.
This is part of going work to improve our texture apis with more
emphasis on providing low-level access to the varying semantics of
different texture types understood by the gpu instead of only trying to
present a lowest common denominator api.
CoglTextureRectangle is notably useful for never being restricted to
power of two sizes and for being sampled with non-normalized texture
coordinates which can be convenient for use a lookup tables in glsl due
to not needing separate uniforms for mapping normalized coordinates to
texels. Unlike CoglTexture2D though rectangle textures can't have a
mipmap and they only support the _CLAMP_TO_EDGE wrap mode.
Applications wanting to use CoglTextureRectangle should first check
cogl_has_feature (COGL_FEATURE_ID_TEXTURE_RECTANGLE).
Reviewed-by: Neil Roberts <neil@linux.intel.com>
This factors out the CoglOnscreen code from cogl-framebuffer.c so we now
have cogl-onscreen.c, cogl-onscreen.h and cogl-onscreen-private.h.
Notably some of the functions pulled out are currently namespaced as
cogl_framebuffer but we know we are planning on renaming them to be in
the cogl_onscreen namespace; such as cogl_framebuffer_swap_buffers().
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Currently features are represented as bits in a 32bit mask so we
obviously can't have more than 32 features with that approach. The new
approach is to use the COGL_FLAGS_ macros which lets us handle bitmasks
without a size limit and we change the public api to accept individual
feature enums instead of a mask. This way there is no limit on the
number of features we can add to Cogl.
Instead of using cogl_features_available() there is a new
cogl_has_feature() function and for checking multiple features there is
cogl_has_features() which takes a zero terminated vararg list of
features.
In addition to being able to check for individual features this also
adds a way to query all the features currently available via
cogl_foreach_feature() which will call a callback for each feature.
Since the new functions take an explicit context pointer there is also
no longer any ambiguity over when users can first start to query
features.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
This adds a new experimental function, cogl_framebuffer_finish(), which
can be used to explicitly synchronize the CPU with the GPU. It's rare
that this level of explicit synchronization is desirable but for example
it can be useful during performance analysys to make sure measurements
reflect the working time of the GPU not just the time to queue commands.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
As part of an on-going effort to get cogl-pipeline.c into a more
maintainable state this splits out all the apis relating just to
layer state. This just leaves code relating to the core CoglPipeline
and CoglPipelineLayer design left in cogl-pipeline.c.
This splits out around 2k more lines from cogl-pipeline.c although we
are still left with nearly 4k lines so we still have some way to go!
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Since cogl-pipeline.c has become very unwieldy this make a start at
trying to shape this code back into a manageable state. This patche
moves all the API relating to core pipeline state into
cogl-pipeline-state.c. This doesn't move code relating to layer state
out nor does it move any of the code supporting the core design
of CoglPipeline itself.
This change alone factors out 2k lines of code from cogl-pipeline.c
which is obviously a good start. The next step will be to factor
out the layer state and then probably look at breaking all of this
state code down into state-groups.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Add a method on the renderer to know how many texture image units are
accessible from fragment shaders.
https://bugzilla.gnome.org/show_bug.cgi?id=657347
Reviewed-by: Robert Bragg <robert@linux.intel.com>
Similar to the widely used gluLookAt API, this adds a CoglMatrix utility
for setting up a view transform in terms of positioning a camera/eye
position that points to a given object position aligned to a given
world-up vector.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
This makes cogl_framebuffer_clear and cogl_framebuffer_clear4f public as
experimental API. Since these functions take explicit framebuffer
pointers you don't need to push/pop a framebuffer just to clear it. Also
these functions are implicitly tied to a specific CoglContext via the
framebuffer pointer unlike cogl_clear.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
This adds a function to query what CoglContext a given framebuffer
belongs too. This can be useful if you pass framebuffer pointers around
and at some point you want to create another framebuffer as part of the
same context as a given framebuffer without assuming there is a single
default context.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
This adds CoglPipeline and CoglFramebuffer support for setting a color
mask which is a bit mask defining which color channels should be written
to the current framebuffer.
The final color mask is the intersection of the framebuffer color mask
and the pipeline color mask. The framebuffer mask affects all rendering
to the framebuffer while the pipeline masks can be used to affect
individual primitives.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
The experimental 2.0 reference manual was setup with DOC_MODULE name of
"cogl" which conflicted with the 1.x API manual. This meant that when
running make install for both the reference manuals all the html files
would end up bundled together in the same location. The 2.0 API
reference now has a DOC_MODULE name of "cogl-2.0-experimental" the
corresponding -sections.txt and -docs.xml.in files have also been
renamed to match this.
Signed-off-by: Neil Roberts <neil@linux.intel.com>
There were several CoglOnscreen functions named like:
cogl_onscreen_<platform>_blah instead of cogl_<platform>_onscreen_blah
so this patch updates those to be consistent with other platform
specific apis we have in cogl.
Signed-off-by: Neil Roberts <neil@linux.intel.com>
This fixes the 2.0 reference manual Makefile to not ignore
cogl-context.h; it also adds cogl_context_new to cogl-sections.txt and
removes cogl_begin/end_gl. (For using raw GL with Cogl 2.0 the plan was
to add some API for creating additional GL contexts via some Cogl API
and a way to push/pop those contexts.)
Signed-off-by: Neil Roberts <neil@linux.intel.com>
This adds a description for the cogl-framebuffer section and adds lots
of missing symbols to the 2.0 reference manual.
Signed-off-by: Neil Roberts <neil@linux.intel.com>
There were a few cogl_matrix symbols missing from the cogl-sections.txt
for the 2.0 reference manual.
Signed-off-by: Neil Roberts <neil@linux.intel.com>
This adds a function called cogl_matrix_is_identity that can determine
if a given matrix is an identity matrix or not.
Signed-off-by: Neil Roberts <neil@linux.intel.com>
This updates the public wayland symbols to follow the pattern
cogl_wayland_blah instead of cogl_blah_wayland.
Signed-off-by: Neil Roberts <neil@linux.intel.com>
we've got into a bit of a mess with how we name platform specific
symbols and files, so this is a first pass at trying to tidy that up.
All platform specific symbols should be named like
cogl_<platform>_symbol_name and similarly files should be named like
cogl-<platform>-filename.c
This patch tackles the X11 specific renderer/display APIs as a start.
Signed-off-by: Neil Roberts <neil@linux.intel.com>
This adds Xlib and Win32 typesafe replacements for
cogl_renderer_handle_native_event, cogl_renderer_add_native_filter,
cogl_renderer_remove_native_filter. The old functions are kept as an
implementation detail so we can share code.
Signed-off-by: Neil Roberts <neil@linux.intel.com>
This does some minor gardening in cogl-sections.txt, tweaking some of
the section titles and removing some stale api references.
Signed-off-by: Neil Roberts <neil@linux.intel.com>
This adds the cogl_swap_chain and cogl_onscreen_template symbols to the
experimental 2.0 reference manual.
Signed-off-by: Neil Roberts <neil@linux.intel.com>
This lists the cogl_renderer symbols in the cogl-sections.txt for the
experimental 2.0 reference manual.
Signed-off-by: Neil Roberts <neil@linux.intel.com>
Since gtk-doc is an optional dependency for Cogl then we need to special
case how EXTRA_DIST is initialized. It shouldn't be set when using
gtk-doc since gtk-doc.make expects to initialize EXTRA_DIST. If we
aren't using gtk-doc then it should be initialized to an empty value
instead of including gtk-doc.make so that the later lines that append
various extra png files to EXTRA_DIST won't fail.
This explicitly renames the cogl-2.0 reference manual to
cogl-2.0-experimental and renames the cogl-2.0 pkg-config file to
cogl-2.0-experimental.pc. Hopefully this should avoid
miss-understandings.
This exposes a CoglTexture2D typedef and adds the following experimental
API:
cogl_is_texture_2d
cogl_texture_2d_new_with_size
cogl_texture_2d_new_from_data
cogl_texture_2d_new_from_foreign
Since this is experimental API you need to define
COGL_ENABLE_EXPERIMENTAL_API before including cogl.h.
Note: With these new entrypoints we now expect a CoglContext pointer to
be passed in, instead of assuming there is a default context. The aim is
that for Cogl 2.0 we won't have a default context so this is a step in
that direction.
Automake seems a bit fragile when trying to do cunning things like
including a file with "-include". It does not recurse into that file (if
it exists) to generate the final Makefiles.
Let's add a if BUILD_GTK_DOC guard around the gtk-doc.make inclusion
instead, hopefully should work as intended.
Instead of simply extending the cogl_pipeline_ namespace to add api for
controlling the depth testing state we now break the api out. This adds
a CoglDepthState type that can be stack allocated. The members of the
structure are private but we have the following API to setup the state:
cogl_depth_state_init
cogl_depth_state_set_test_enabled
cogl_depth_state_get_test_enabled
cogl_depth_state_set_test_function
cogl_depth_state_get_test_function
cogl_depth_state_set_writing_enabled
cogl_depth_state_get_writing_enabled
cogl_depth_state_set_range
cogl_depth_state_get_range
This removes the following experimental API which is now superseded:
cogl_material_set_depth_test_enabled
cogl_material_get_depth_test_enabled
cogl_material_set_depth_test_function
cogl_material_get_depth_test_function
cogl_material_set_depth_writing_enabled
cogl_material_get_depth_writing_enabled
cogl_material_set_depth_range
cogl_material_get_depth_range
Once a CoglDepthState structure is setup it can be set on a pipeline
using cogl_pipeline_set_depth_state().
This is part of a broader cleanup of some of the experimental Cogl API.
One of the reasons for this particular rename is to switch away from
using the term "Array" which implies a regular, indexable layout which
isn't the case. We also want to strongly imply a relationship between
CoglBuffers and CoglIndexBuffers and be consistent with the
CoglAttributeBuffer and CoglPixelBuffer APIs.
This is part of a broader cleanup of some of the experimental Cogl API.
One of the reasons for this particular rename is to switch away from
using the term "Array" which implies a regular, indexable layout which
isn't the case. We also want to strongly imply a relationship between
CoglBuffers and CoglPixelBuffers and be consistent with the
CoglAttributeBuffer and CoglIndexBuffer APIs.
This adds an experimental CoglEuler data type and the following new
functions:
cogl_euler_init
cogl_euler_init_from_matrix
cogl_euler_init_from_quaternion
cogl_euler_equal
cogl_euler_copy
cogl_euler_free
cogl_quaternion_init_from_euler
Since this is experimental API you need to define
COGL_ENABLE_EXPERIMENTAL_API before including cogl.h
This adds an experimental quaternion utility API. It's not yet fully
documented but it's complete enough that people can start to experiment
with using it. It adds the following functions:
cogl_quaternion_init_identity
cogl_quaternion_init
cogl_quaternion_init_from_angle_vector
cogl_quaternion_init_from_array
cogl_quaternion_init_from_x_rotation
cogl_quaternion_init_from_y_rotation
cogl_quaternion_init_from_z_rotation
cogl_quaternion_equal
cogl_quaternion_copy
cogl_quaternion_free
cogl_quaternion_get_rotation_angle
cogl_quaternion_get_rotation_axis
cogl_quaternion_normalize
cogl_quaternion_dot_product
cogl_quaternion_invert
cogl_quaternion_multiply
cogl_quaternion_pow
cogl_quaternion_slerp
cogl_quaternion_nlerp
cogl_quaternion_squad
cogl_get_static_identity_quaternion
cogl_get_static_zero_quaternion
Since it's experimental API you'll need to define
COGL_ENABLE_EXPERIMENTAL_API before including cogl.h.
Gtk-doc can be hard to install on Windows. This patch enables people wanting to
hack on Cogl itself from a Windows system to do so without the hassle to get
gtk-doc installed first.
This pulls in the experimental cogl 2.0 reference manual from the
clutter repository since it wasn't included in the filter-branch when we
split cogl out.