This adds a conformance test which renders a texture point using a 2x2
texture with a different color for each texel. It then verifies that
each texel is mapped to the correct position on the point. The test is
currently failing.
The test requires the point sprite feature flag so this patch also
adds a TEST_REQUIREMENT_* flag for that.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
This tries rendering some points at various sizes and checks that they
are the expected size and make a rectangle shape. This is currently
failing when the GLSL vertend is used because it flushes the point
size in the wrong place.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
This renames the TestRequirement enum to TestFlags and then adds a
TEST_KNOWN_FAILURE flag. The rename is because the new flag is not
really a requirement. If the flag is set then the test is assumed to
always fail.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
This option to GCC makes it give a warning whenever a global function
is defined without a declaration. This should catch cases were we've
defined a function but forgot to put it in a header. In that case it
is either only used within one file so we should make it static or we
should declare it in a header.
The following changes where made to fix problems:
• Some functions were made static
• cogl-path.h (the one containing the 1.0 API) was split into two
files, one defining the functions and one defining the enums so that
cogl-path.c can include the enum and function declarations from the
2.0 API as well as the function declarations from the 1.0 API.
• cogl2-clip-state has been removed. This only had one experimental
function called cogl_clip_push_from_path but as this is unstable we
might as well remove it favour of the equivalent cogl_framebuffer_*
API.
• The GLX, SDL and WGL winsys's now have a private header to define
their get_vtable function instead of directly declaring in the C
file where it is called.
• All places that were calling COGL_OBJECT_DEFINE need to have the
cogl_is_whatever function declared so these have been added either
as a public function or in a private header.
• Some files that were not including the header containing their
function declarations have been fixed to do so.
• Any unused error quark functions have been removed. If we later want
them we should add them back one by one and add a declaration for
them in a header.
• _cogl_is_framebuffer has been renamed to cogl_is_framebuffer and
made a public function with a declaration in cogl-framebuffer.h
• Similarly for CoglOnscreen.
• cogl_vdraw_indexed_attributes is called
cogl_framebuffer_vdraw_indexed_attributes in the header. The
definition has been changed to match the header.
• cogl_index_buffer_allocate has been removed. This had no declaration
and I'm not sure what it's supposed to do.
• CoglJournal has been changed to use the internal CoglObject macro so
that it won't define an exported cogl_is_journal symbol.
• The _cogl_blah_pointer_from_handle functions have been removed.
CoglHandle isn't used much anymore anyway and in the few places
where it is used I think it's safe to just use the implicit cast
from void* to the right type.
• The test-utils.h header for the conformance tests explicitly
disables the -Wmissing-declaration option using a pragma because all
of the tests declare their main function without a header. Any
mistakes relating to missing declarations aren't really important
for the tests.
• cogl_quaternion_init_from_quaternion and init_from_matrix have been
given declarations in cogl-quaternion.h
Reviewed-by: Robert Bragg <robert@linux.intel.com>
test-cogl-sub-texture was fixed to now run on GLES2 since commit
5928cade0b so this removes the TEST_REQUIREMENT_GL flag for this test
so it doesn't get flagged as an unexpected pass.
This adds a test similar to the test-read-texture-formats test but
that updates data on a 1x1 pixel RGBA texture instead. On GLES2 this
should end up testing all of the convesion code because in that case
GL only supports reading back RGBA data.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
The test-read-alpha-texture test has been replaced with a test that
tries reading an RGBA texture in all current pixel formats. On GLES2
this should end up testing all of the convesion code because in that
case GL only supports reading back RGBA data. The test now works on
GLES2 since the conversion code for all of the formats has been added
so this also removes the GL requirement.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
This just creates a 1x1 RGBA texture and then reads it back in
COGL_PIXEL_FORMAT_A_8 format. Gnome Shell is doing this to create a
shadow and I accidentally broke it so this should hopefully stop that
happening again.
https://bugzilla.gnome.org/show_bug.cgi?id=671016
Reviewed-by: Robert Bragg <robert@linux.intel.com>
This patch reworks our conformance testing framework because it seems
that glib's gtesting framework isn't really well suited to our use case.
For example we weren't able to test windows builds given the way we
were using it and also for each test we'd like to repeat the test
with several different environments so we can test important driver and
feature combinations.
This patch instead switches away to a simplified but custom approach for
running our unit tests. We hope that having a more bespoke setup will
enable us to easily extend it to focus on the details important to us.
Notable changes with this new approach are:
We can now run 'make test' for our mingw windows builds.
We've got rid of all the test-*report* make rules and we're just left
with 'make test'
'make test' now runs each test several times with different driver and
feature combinations checking the result for each run. 'make test' will
then output a concise table of all of the results.
The combinations tested are:
- OpenGL Fixed Function
- OpenGL ARBfp
- OpenGL GLSL
- OpenGL No NPOT texture support
- OpenGLES 2.0
- OpenGLES 2.0 No NPOT texture support
Reviewed-by: Neil Roberts <neil@linux.intel.com>
When requesting the texture data to test that we get back what we
uploaded, we need to ask for it in a premult format otherwise it will
get converted and the test will fail. This was working for the GL
driver because of a bug where it would fail to do the conversion.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
As we move towards Cogl 2.0 we are aiming to remove the need for a
default global CoglContext and so everything should be explicitly
related to a context somehow. CoglPipelines are top level objects and
so this patch adds a context argument to cogl_pipeline_new().
Reviewed-by: Neil Roberts <neil@linux.intel.com>
We are in the process of removing all _EXP suffix mangling for
experimental APIs (Ref: c6528c4b6c) 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 cogl-texture-3d
api symbols.
This patch also replaces use of CoglHandle with a CoglTexture3D type
instead.
Finally this patch also ensures the CoglTexture3D constructors take an
explicit CoglContext pointer but not a CoglTextureFlags argument,
consistent with other CoglTexture constructors.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
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
Reviewed-by: Neil Roberts <neil@linux.intel.com>
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>
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>
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>
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>
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>
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>
This adds a little test which makes a copy of a CoglPrimitive and
verifies that all of the properties on the new primitive are the same
as the old one.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
This adds an extra test to test-offscreen then ensures the offscreen
framebuffer for a texture automatically flushes its journal in the
following three situations:
1. cogl_read_pixels is called immediately when the offscreen buffer is
current.
2. cogl_texture_get_data is called on the offscreen's texture
immediately after rendering to it.
3. The texture is rendered to the screen and immediately read back
with cogl_read_pixels.
Currently the 2nd situation fails.
https://bugzilla.gnome.org/show_bug.cgi?id=668913
Reviewed-by: Robert Bragg <robert@linux.intel.com>
The compare pixel function was a static function used internally by
the test_utils_check_* functions. It takes a pointer to a pixel in a
buffer read back from Cogl and compares it with an expected value.
This function could also be useful in tests wanting to check the data
returned from a call to cogl_texture_get_data so we should share it
with the rest of the tests.
https://bugzilla.gnome.org/show_bug.cgi?id=668913
Reviewed-by: Robert Bragg <robert@linux.intel.com>
This makes the test launcher script pass on the exit code from the
conformance test as its own exit status. This makes using a particular
test with git bisect run easier.
https://bugzilla.gnome.org/show_bug.cgi?id=665190
Reviewed-by: Robert Bragg <robert@linux.intel.com>
When comparing a pixel, the comparison routines now allow each
component to be off by +/- 1. This is to compensate for varying
rounding across drivers.
https://bugzilla.gnome.org/show_bug.cgi?id=665723
Reviewed-by: Robert Bragg <robert@linux.intel.com>
This verifies that the post strings are executed in the order they
were added to the pipeline and the post strings are executed in the
reverse order.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
The test creates some pipelines with snippets with custom attributes
and uses CoglAttribute to define values for them.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
This adds a hook called COGL_SNIPPET_HOOK_TEXTURE_COORD_TRANSFORM.
This can be used to alter the application of the layer user matrix to
a texture coordinate or it can bypass it altogether.
This is the first per-layer hook that affects the vertex shader state
so the patch includes the boilerplate needed to get that to work.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
Previously the function containing the default texture lookup is
always generated regardless of whether there is a snippet with a
replace string which would cause it not be used. Now this snippets are
all scanned to check for replace strings before generating the texture
lookup.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
The loop that generates code for a list of snippets now starts from
the first snippet that has a replace string. Any snippets before that
would be ignored so there's no point in generating code for them.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
Instead of specifying the hook point when adding to the pipeline using
a separate function for each hook, the hook is now a property of the
snippet. The hook is set on construction and is then read-only.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
This adds a per-layer snippet hook for the texure lookup. Here the
snippet can modify the texture coordinates used for the lookup or
modify the texel resulting from the lookup. This is the first
per-layer hook so this also adds the
COGL_PIPELINE_LAYER_STATE_FRAGMENT_SNIPPETS state and all of the
boilerplate needed to make that work.
Most of the functions used by the pipeline state to manage the snippet
list has been moved into cogl-pipeline-snippet.c so that it can be
shared with the layer state.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
If present, the 'replace' string will be used instead of whatever code
would normally be invoked for that hook point. It will also replace
any previous snippets.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
Each snippet is now given its own function which contains the pre and
post strings. Between these strings the function will chain on to
another function. The generated cogl source is now stored in a
function called cogl_generated_source() which the last snippet will
chain on to. This should make it so that each snippet has its own
namespace for local variables and it can share variables declared in
the pre string in the post string. Hopefully the GLSL compiler will
just inline all of the functions so it shouldn't make much difference
to the compiled output.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
These are the VS 2008/2010 project files to build Cogl, with a README.txt
to explain the process involved.
Note that the Cogl and Cogl-Pango projects (and filters for VS2010) are
expanded with the correct source file listings during "make dist", which
is done to simplify maintenance of these project files.
-added preconfigured config.h(.win32.in), which is expanded with the
correct versioining info during autogen
-added preconfigued cogl/cogl-defines.h.win32
-added symbols files for cogl and cogl-pango
-Have configure.ac expand the config.h.win32.in into config.h.win32
with the correct versioning info, etc, and to include the Visual C++
project files for distribution
-Added rules in cogl/Makefile.am to expand the cogl VS 2008/2010 projects
and filters from the templates with up-to-date source file listings, to
distribute cogl-enum-types.c, cogl-enum-types.h to ease compilation and
to avoid depending on PERL on Windows installations.
-Added rules in cogl-pango/Makefile.am to expand the cogl-pango VS2008/
2010 projects and filters from the templates with up-to-date source file
listings.
-Added/edited various Makefile.am's in build to distribute the VS2008/2010
project files and associated items required for the build.
-Update .gitignore. There needs to be a pre-configured
config.h(.win32) and its template, config.h.win32.in for Visual C++
builds
https://bugzilla.gnome.org/show_bug.cgi?id=650020
Reviewed-by: Neil Roberts <neil@linux.intel.com>
This returns a population count of all the bits that are set in the
bitmask.
There is now also a _cogl_bitmask_popcount_upto which counts the
number of bits set up to but not including the given bit index. This
will be useful to determine the number of uniform overrides to skip if
we tightly pack the values in an array.
The test-bitmask test has been modified to check these two functions.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
The tests tries all of the various combinations of setting uniform
values on a pipeline and verifies the expected results with a some
example shaders.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
Instead of testing each bit when iterating a bitmask, we can use ffsl
to skip over unset bits in single instruction. That way it will scale
by the number of bits set, not the total number of bits.
ffsl is a non-standard function which glibc only provides by defining
GNUC_SOURCE. However if we are compiling with GCC we can avoid that
mess and just use the equivalent builtin. When not compiling for GCC
it will fall back to _cogl_util_ffs if the size of ints and longs are
the same (which is the case on i686). Otherwise it fallbacks to a slow
function implementation.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
This adds a test which tries manipulating some bits on a CoglBitmask
and verifies that it gets the expected result. This test is fairly
unusual in that it is directly testing some internal Cogl code that
isn't exposed through the public API. To make this work it directly
includes the source for CoglBitmask.
CoglBitmask does some somewhat dodgy things with converting longs to
pointers and back so it makes sense to have a test case to verify that
this is working on all platforms.
Reviewed-by: Robert Bragg <robert@linux.intel.com>