1
0
Fork 0
Commit graph

14 commits

Author SHA1 Message Date
Emmanuele Bassi
fc89513295 actor: Move the ShaderData out of the private data
Let's try and start reducing the size of ClutterActorPrivate by moving
some optional, out-of-band data from it to GObject data.

The ShaderData structure is a prime candidate for this migration: it
does not need to be inspected by the actor, and its relationship with an
actor is transient and optional.

By attaching it to the actor's instance through g_object_set_data() we
neatly tie its lifetime to the instance, and we don't have to care
cleaning it up in the finalize()/dispose() implementation of
ClutterActor itself.
2011-02-18 11:43:27 +00:00
Damien Lespiau
b922ac6059 test-shader: Fix the edge-detect shader
cogl_text_coord_in in a array to access the texture units. In this case
we want to sample texture unit 0, where the texture is.
2011-01-11 14:21:21 +00:00
Robert Bragg
5f30835eae cogl-shader: Prepend boilerplate for portable shaders
We now prepend a set of defines to any given GLSL shader so that we can
define builtin uniforms/attributes within the "cogl" namespace that we
can use to provide compatibility across a range of the earlier versions
of GLSL.

This updates test-cogl-shader-glsl.c and test-shader.c so they no longer
needs to special case GLES vs GL when splicing together its shaders as
well as the blur, colorize and desaturate effects.

To get a feel for the new, portable uniform/attribute names here are the
defines for OpenGL vertex shaders:

 #define cogl_position_in gl_Vertex
 #define cogl_color_in gl_Color
 #define cogl_tex_coord_in  gl_MultiTexCoord0
 #define cogl_tex_coord0_in gl_MultiTexCoord0
 #define cogl_tex_coord1_in gl_MultiTexCoord1
 #define cogl_tex_coord2_in gl_MultiTexCoord2
 #define cogl_tex_coord3_in gl_MultiTexCoord3
 #define cogl_tex_coord4_in gl_MultiTexCoord4
 #define cogl_tex_coord5_in gl_MultiTexCoord5
 #define cogl_tex_coord6_in gl_MultiTexCoord6
 #define cogl_tex_coord7_in gl_MultiTexCoord7
 #define cogl_normal_in gl_Normal

 #define cogl_position_out gl_Position
 #define cogl_point_size_out gl_PointSize
 #define cogl_color_out gl_FrontColor
 #define cogl_tex_coord_out gl_TexCoord

 #define cogl_modelview_matrix gl_ModelViewMatrix
 #define cogl_modelview_projection_matrix gl_ModelViewProjectionMatrix
 #define cogl_projection_matrix gl_ProjectionMatrix
 #define cogl_texture_matrix gl_TextureMatrix

And for fragment shaders we have:

 #define cogl_color_in gl_Color
 #define cogl_tex_coord_in gl_TexCoord

 #define cogl_color_out gl_FragColor
 #define cogl_depth_out gl_FragDepth

 #define cogl_front_facing gl_FrontFacing
2010-11-10 14:24:52 +00:00
Neil Roberts
616eccdad6 test-shader: Unref the ClutterShader after setting it on an actor
Otherwise the test leaks the shader object and the underlying GLSL
program.
2010-07-22 21:51:47 +01:00
Neil Roberts
a1c7420979 test-shader: The tex_coord varying is now an array under GLES2
Since the GLES2 wrapper grew support for multi-texturing, the
tex_coord varying variable defined in the vertex shader is actually an
array of texture coordinates so it ought to match in the fragment
shader in test-shader. This seemed to work anyway under Mesa/Intel but
under NVidia it does not so I don't think it's safe to assume that
linking a non-array varying with an array will work.
2010-07-22 21:48:16 +01:00
Robert Bragg
a871ac669f test-shader: guard GLES2 specific changes with COGL_HAS_GLES2
Previously we were using an internal only HAVE_COGL_GLES2 define to
guard GLES 2 specific changes so for instance the precision modifiers
weren't being emitted in the shader source.

http://bugzilla.o-hand.com/show_bug.cgi?id=2178
2010-06-22 11:35:29 +01:00
Emmanuele Bassi
e55966d675 Deprecate clutter_util_next_p2()
The next_p2() function should have never been publicly exposed by
Clutter.
2010-02-06 10:49:33 +00:00
Emmanuele Bassi
0b4899ef23 tests: Clean up interactive test build
The build for interactive tests creates symbolic links for the data
under tests/data; it also uses symbolic links for creating "binaries"
for each interactive test. This is less than ideal, though.

Instead, the tests should build a path to the data files by using
a pre-processor define like TESTS_DATADIR; both g_build_filename() and
pre-processor string concatenation can be used to generate a valid
file name with the full path to the files.

The build system should also create wrapper scripts, just like we
do inside the conformance test suite, to be able to launch single
tests.
2009-11-05 17:47:26 +00:00
Haakon Sporsheim
f852ade823 Remove config.h inclusion. 2009-07-28 12:13:42 +01:00
Neil Roberts
20f3c173fe [test-shader] Fix some of the shaders to use premultiplied colors
Texture data is now in premultiplied format and the shader should
output a premultiplied color if the default blend mode is being
used. Shaders that directly manipulate the rgb values now
unpremultiply and premultiply again afterwards.
2009-06-24 12:05:19 +01:00
Emmanuele Bassi
c759aeb6a7 Uniformly use floats in Actor properties
All the underlying implementation and the public entry points have
been switched to floats; the only missing bits are the Actor properties
that deal with positioning and sizing.

This usually means a major pain when dealing with GValues and varargs
functions. While GValue will warn you when dealing with the wrong
conversions, varags will simply die an horrible (and hard to debug)
death via segfault. Nothing much to do here, except warn people in the
release notes and hope for the best.
2009-06-01 14:57:18 +01:00
Emmanuele Bassi
5c14044e52 Update the interactive tests to ClutterText
Instead of using ClutterLabel, use ClutterText to display some
text where needed.
2008-12-11 13:48:01 +00:00
Emmanuele Bassi
af0cb47570 2008-11-18 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1049 - Clutter doesn't support most GLSL uniforms (patch
	by Chris Lord and Neil Roberts)

	* README: Update release notes.

	* clutter/Makefile.am:
	* clutter/clutter-shader-types.[ch]: Add GValue types for
	shader values.

	* clutter/clutter-actor.[ch]: Update the shader API to use
	the newly added GValue support for GLSL shader uniform
	setters.

	* clutter/clutter-shader.[ch]: Add float and integer convenience
	API for single value GLSL uniform setters.

	* clutter/cogl/cogl-shader.h: Add new uniform setters.

	* clutter/cogl/gl/cogl-context.c:
	* clutter/cogl/gl/cogl-context.h:
	* clutter/cogl/gl/cogl-defines.h.in:
	* clutter/cogl/gl/cogl-program.c:
	* clutter/cogl/gl/cogl.c: Update the GL implementation of COGL
	to handle the GLSL uniform setters.

	* clutter/cogl/gles/cogl-gles2-wrapper.c:
	* clutter/cogl/gles/cogl-gles2-wrapper.h:
	* clutter/cogl/gles/cogl-internal.h:
	* clutter/cogl/gles/cogl-program.c: Update the GLES 2.0 implementation
	of COGL to handle the GLSL uniform setters.

	* doc/reference/clutter/clutter-sections.txt:
	* doc/reference/cogl/cogl-sections.txt: Update the documentation.

	* tests/interactive/test-fbo.c:
	* tests/interactive/test-shader.c: Update the shader tests.
2008-11-18 15:08:40 +00:00
Robert Bragg
603f936745 Bug 1162 - Re-works the tests/ to use the glib-2.16 unit testing
framework

	* configure.ac:
	* tests/*:
	The tests have been reorganised into different categories: conformance,
	interactive and micro benchmarks.
	- conformance tests can be run as part of automated tests
	- interactive tests are basically all the existing tests
	- micro benchmarks focus on a single performance metric

	I converted the timeline tests to conformance tests and also added some
	tests from Neil Roberts and Ebassi.

	Note: currently only the conformance tests use the glib test APIs,
	though the micro benchmarks should too.

	The other change is to make the unit tests link into monolithic binaries
	which makes the build time for unit tests considerably faster. To deal
	with the extra complexity this adds to debugging individual tests I
	have added some sugar to the makefiles so all the tests can be run
	directly via a symlink and when an individual test is run this way,
	then a note is printed to the terminal explaining exactly how that test
	may be debugged using GDB.

	There is a convenience make rule: 'make test-report', that will run all
	the conformance tests and hopefully even open the results in your web
	browser. It skips some of the slower timeline tests, but you can run
	those using 'make full-report'
2008-11-07 19:32:28 +00:00
Renamed from tests/test-shader.c (Browse further)