Commit Graph

34 Commits

Author SHA1 Message Date
Neil Roberts
a3989d035e Fix removing layers when the pipeline is not the owner
If cogl_pipeline_remove_layer is called on a copied pipeline to remove
a parent layer then it will still end up calling
_cogl_pipeline_remove_layer_difference on the layer. This function
was directly trying to remove the layer from the pipeline's list of
layer differences. However in the child pipeline the layer isn't in
the list because it is unchanged from its parent. The function had an
assertion to verify that this situation wasn't hit so in a debug build
it would just bail out.

This patch removes the assertion and changes it to only remove the
layer if it is owned by the pipeline. Otherwise it just sets the
COGL_PIPELINE_STATE_LAYERS difference as normal and decrements the
number of layers. This will cause it to successfully remove the layer
because either it is the last layer in which case it will be ignored
after n_layers is decreased or if it is in the middle of the list then
the subsequent layers will all be shifted down so there will be a
replacement layer difference.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 88e73dd93fa09a158064a946ab229591a5888b97)
2012-08-06 14:27:45 +01:00
Neil Roberts
2e50693821 Add a conformance test for removing a pipeline layer
The test creates a pipeline with two layers which add two different
color constants together and then tries various combinations of
removing the layers and checks that it gets the right color.

Currently this is failing if a pipeline is copied and then a layer is
removed from the copy.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 844440a5cee5907c4d61e995804534ac0613bb0f)
2012-08-06 14:27:45 +01:00
Neil Roberts
9026acde8f Add a basic conformance test for eulers and quaternions
This adds some preliminary testing for eulers and quaternions. It
mostly just tests the cogl_matrix_init_from_{quaternion,euler}
functions as well as applying a euler or quaternion transformation to
a framebuffer's modelview matrix.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit a32eb76e16d7d76af2fe8a6ba9151d8826b58864)
2012-08-06 14:27:43 +01:00
Robert Bragg
498937083e Adds gles2-context renderer constraint
This adds a new renderer constraint enum:
  COGL_RENDERER_CONSTRAINT_SUPPORTS_GLES2_CONTEXT
that can be used by applications to ensure the renderer they connect to
has support for creating a GLES2 context via cogl_gles2_context_new().

The cogl-gles2-context and cogl-gles2-gears examples and the conformance
tests have been updated to use this constraint.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit ed61463d7194354b26624e8014859f0fbfc06a12)
2012-08-06 14:27:43 +01:00
Robert Bragg
8d0b771cd3 conform: Adds a gles2 context test
This adds a conformance test that creates a GLES2 context via the cogl
api and verifies clearing an offscreen framebuffer via the gles2 api,
and switching back and forth between the Cogl and GLES2 apis.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 9369c60a596c0cbc7a8bb9a45d7b8ffb6a848311)
2012-08-06 14:27:42 +01:00
Neil Roberts
f729798f03 Convert the test-atlas-migration test to a standalone Cogl test
This updates test-atlas-migration from being a Clutter-based test to a
Cogl-based test.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 32c5a3ed546effd2e2946f22f173a20cf36b2fdf)
2012-08-06 14:27:42 +01:00
Neil Roberts
b6b9ac0b85 Add a cogl-version header
This adds a version header which contains macros to define which
version of Cogl the application is being compiled against. This helps
applications that want to support multiple incompatible versions of
Cogl at compile time.

The macros are called COGL_VERSION_{MAJOR,MINOR,MICRO}. This does not
match Clutter which names them CLUTTER_{MAJOR,MINOR,MICRO}_VERSION but
I think the former is nicer and it at least matches Cairo and Pango.

The values of the macro are defined to COGL_VERSION_*_INTERNAL which
is generated by the configure script into cogl-defines.h.

There is also a macro for the entire version as a string called
COGL_VERSION_STRING.

The internal utility macros for encoding a 3 part version number into
a single integer have been moved into the new header so they can be
used publicly as a convenient way to check if the version is within a
particular range. There is also a COGL_VERSION_CHECK macro for the
very common case that a feature will be used since a particular
version of Cogl. There is a macro called COGL_VERSION which contains
the pre-encoded version of Cogl being compiled against for
convenience.

Unlike in Clutter this patch does not add any runtime version
identification mechanism.

A test case is also added which just contains static asserts to sanity
check the macros.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 3480cf140dc355fa87ab3fbcf0aeeb0124798a8f)
2012-08-06 14:27:40 +01:00
Luca Bruno
d3215b802d tests: Port test-premult
This ports the test-offscreen test from being a Clutter test to a
straight Cogl test.

https://bugzilla.gnome.org/show_bug.cgi?id=660617

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-04-11 16:49:42 +01:00
Robert Bragg
3881fd3259 Adds cogl_framebuffer_draw_[*_]rectangle functions
This adds experimental 2.0 api replacements for the cogl_rectangle[_*]
functions that don't depend on having a current pipeline set on the
context via cogl_{set,push}_source() or having a current framebuffer set
on the context via cogl_push_framebuffer(). The aim for 2.0 is to switch
away from having a statefull context that affects drawing to having
framebuffer drawing apis that are explicitly passed a framebuffer and
pipeline.

To test this change several of the conformance tests were updated to use
this api instead of cogl_rectangle and
cogl_rectangle_with_texture_coords. Since it's quite laborious going
through all of the conformance tests the opportunity was taken to make
other clean ups in the conformance tests to replace other uses of
1.x api with experimental 2.0 api so long as that didn't affect what was
being tested.
2012-03-20 12:33:40 +00:00
Neil Roberts
1d59fccf10 Add a conformance test for point sprites
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>
2012-03-07 15:13:29 +00:00
Neil Roberts
3c0226b3fb Add a conformance test for point sizes
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>
2012-03-07 15:13:29 +00:00
Robert Bragg
13ba312d3a test: remove FEATURE_GL requirement for sub_texture test
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.
2012-03-05 22:58:42 +00:00
Neil Roberts
6ad168e4be Port the test-pixel-buffer test
This ports the text-pixel-buffer test from being a Clutter test to a
straight Cogl test.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-03-05 19:02:37 +00:00
Neil Roberts
b85f2e907a tests: Add a test which writes all pixel formats
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>
2012-03-05 17:44:52 +00:00
Neil Roberts
70dfbdd5e3 tests: Test reading all pixel formats
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>
2012-03-05 17:44:51 +00:00
Neil Roberts
b6dc23370d Add a conformance test for reading back an RGBA texture as alpha-only
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>
2012-03-05 17:43:46 +00:00
Robert Bragg
bbcbece6c9 tests: Improve thoroughness and reporting of make test
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>
2012-02-24 14:42:31 +00:00
Neil Roberts
bf7f1e358d Add a test for pipelines with sparse layer indices
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>
2012-02-13 17:15:35 +00:00
Neil Roberts
7cd2f25eb0 test-texture-3d: Port to Cogl
This ports the texture-3d test to Cogl instead of depending on
Clutter.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-02-13 17:15:35 +00:00
Neil Roberts
a226b368f3 Port the test-primitive test from Clutter to Cogl
This converts test-primitive to be a standalone Cogl test instead of
relying on Clutter code.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-02-07 15:25:36 +00:00
Neil Roberts
bd6810de10 tests: Port test-offscreen
This ports the test-offscreen test from being a Clutter test to a
straight Cogl test.

https://bugzilla.gnome.org/show_bug.cgi?id=668913

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-01-31 12:01:20 +00:00
Neil Roberts
72097ac01d Add a conformance test for custom attributes
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>
2011-12-06 19:02:06 +00:00
Neil Roberts
2f66cd7036 Add a conformance test for CoglSnippets
This adds a conformance test testing various operations on
CoglSnippets.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-12-06 19:02:05 +00:00
Neil Roberts
8805d835aa Add a conformance test for setting uniforms on a pipeline
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>
2011-11-16 16:32:11 +00:00
Neil Roberts
ec1c3406ad Add a conformance test for CoglBitmask
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>
2011-11-16 16:21:13 +00:00
Luca Bruno
3a27ae0dc8 tests: Port test-path conformance test from Clutter
Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-11-03 20:31:14 +00:00
Robert Bragg
b2b4eba0e7 tests: ports test-sub-texture to not depend on clutter
As part of the on going effort to port the conformance tests that were
originally written as clutter tests to be standalone cogl tests this
patch ports the test-sub-texture test to be standalone now.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-11-01 12:03:04 +00:00
Robert Bragg
3c129f5c18 tests: ports test-wrap-modes.c to be standalone cogl test
This ports test-wrap-modes.c from being a clutter based test to one that
is a standalone cogl test.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-11-01 12:03:01 +00:00
Luca Bruno
bdfaf94afb tests: Port blend-strings to test both the legacy and the new API
https://bugzilla.gnome.org/show_bug.cgi?id=660617

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-10-12 13:50:11 +01:00
Luca Bruno
3d75bd35ba Port the pipeline-user-matrix conformance test from Clutter
Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-10-01 15:10:55 +01:00
Luca Bruno
5784905462 Port just-vertex-shader to test both the legacy and the new API
Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-10-01 15:02:03 +01:00
Neil Roberts
8fba6265d2 Port the backface culling test
This ports the backface culling conformance test to work without
Clutter.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-09-19 16:40:07 +01:00
Neil Roberts
56216b294f Add a conformance test for setting the color mask on a framebuffer
There is a currently a bug where pushing a buffer with a different
color mask will not cause the color mask to be flushed. This adds a
test to demonstrate that.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-09-19 16:40:07 +01:00
Robert Bragg
b5a7657076 Starts porting Cogl conformance tests from Clutter
This makes a start on porting the Cogl conformance tests that currently
still live in the Clutter repository to be standalone Cogl tests that no
longer require a ClutterStage.

The main thing is that this commit brings in is the basic testing
infrastructure we need, so now we can port more and more tests
incrementally.

Since the test suite wants a way to synchronize X requests/replies and
we can't simply call XSynchronize in the test-utils code before we know
if we are really running on X this adds a check for an environment
variable named "COGL_X11_SYNC" in cogl-xlib-renderer.c and if it's set
it forces XSynchronize (dpy, TRUE) to be called.

By default the conformance tests are run off screen. This makes the
tests run much faster and they also don't interfere with other work you
may want to do by constantly stealing focus. CoglOnscreen framebuffers
obviously don't get tested this way so it's important that the tests
also get run on screen every once in a while, especially if changes are
being made to CoglFramebuffer related code.  On screen testing can be
enabled by setting COGL_TEST_ONSCREEN=1 in your environment.
2011-09-08 15:48:07 +01:00