Benjamin Otte
ef8fd1355e
gl: Fix span renderer for unbounded spans
...
The span renderer used to not output rects for the top and bottom rows
when they didn't contain any spans.
2010-06-07 15:03:37 +02:00
Benjamin Otte
1d11af083f
gl: Add a simple spans renderer for stroke/fill
...
It's very simple as clipped polygons or ANTIALIAS_NONE still return
UNSUPPORTED. Also, no optimizations are done, so even pixel-aligned
rectangles use the full span rendering.
Still, there are no performance regressions in the benchmark traces and
firefox-talos-svg and swfdec-giant-steps both got ~15% faster.
2010-06-07 13:37:49 +02:00
Benjamin Otte
550335efed
Remove _cairo_surface_composite_trapezoids_as_polygon()
...
The function computed the composite rectangles wrong and was only used
in a gl fallback anyway. So instead of trying to fix it, just remove it
and make sure gl doesn't fallback.
2010-06-07 13:37:49 +02:00
Benjamin Otte
1e003fce8f
gl: Fix vertex size changes not causing updates of the operands
...
Check vertex size stays identical when setting up vertices.
2010-06-07 13:37:49 +02:00
Benjamin Otte
39143400dd
gl: Add a gradient texture cache
...
For firefox-planet-gnome, 19135 times a gradient gets rendered using
only 10 different gradients. So we get a 100% hit rate in the cache.
Unfortunately, texture upload is not the biggest problem of this test,
as the performance increase is only moderate - at least on i965:
34.3s => 33.5s
2010-06-07 13:37:49 +02:00
Benjamin Otte
932ab2641e
device: flush before setting finished
...
Otherwise APIs critical for flushing - in particular acquiring the
device - do not work.
2010-06-07 13:37:49 +02:00
Benjamin Otte
35e219d08f
gl: Make gradient textures a separate object
...
This is necessary so we can do proper refcounting and don't delete the
gradient texture prematurely.
2010-06-07 13:37:49 +02:00
Benjamin Otte
9c17a477d2
gl: Use the generic functions for filter/extend in gradients
2010-06-07 13:37:49 +02:00
Benjamin Otte
df93802765
gl: Create separate functions for setting extend and filter
2010-06-07 13:37:49 +02:00
Benjamin Otte
10e71806d2
gl: Switch to deferred rendering
...
1) call _cairo_gl_composite_flush() or cairo_surface_flush() where
needed
2) Destroy texture operands when necessary
3) get rid of _cairo_gl_composite_end()
With this patch, vertices are not flushed immediately anymore, but only
when needed or when a new set of vertices is emitted that requires an
incompatible setup. This improves performance a lot in particular for
text. (gnome-terminal-vim gets 10x faster)
2010-06-07 13:37:48 +02:00
Benjamin Otte
f2f79ca1b3
gl: Make using shaders an explicit argument
...
This is preparation for a followup patch
2010-06-07 13:37:48 +02:00
Benjamin Otte
19c1d8316e
gl: Special case blend mode for CAIRO_CONTENT_COLOR
...
This ensures that alpha stays at 1 for RGB in all cases.
2010-06-07 13:37:48 +02:00
Benjamin Otte
1f249064cc
gl: rework _cairo_gl_set_operator()
...
1) store the current operator. This will be useful later to check if the
operator changed.
2) pass the context instead of the destination as first argument. The
destination is known to be the current target.
2010-06-07 13:37:48 +02:00
Benjamin Otte
f66500d8b0
gl: Only resetup textures if we need to
2010-06-07 13:37:48 +02:00
Benjamin Otte
d9dcafd61a
gl: Do not reset the current target on release
...
This now also requires a call to cairo_device_flush().
2010-06-07 13:37:48 +02:00
Benjamin Otte
ce36be5c67
glx: When acquiring device, use the correct drawable
2010-06-07 13:37:48 +02:00
Benjamin Otte
5819bb07eb
gl: Store the vertex offset in the operand
2010-06-07 13:37:48 +02:00
Benjamin Otte
c75460c54d
gl: Introduce a temporary texture unit
...
...and use it for image uploads. This makes sure that the texture units
used for SOURCE and MASK get not clobbered when images get uploaded to
textures.
2010-06-07 13:37:48 +02:00
Benjamin Otte
1ddff8aba3
gl: Only allocate a framebuffer if we need one
...
This way, we don't clobber the current target when creating textures for
image surfaces.
2010-06-07 13:37:48 +02:00
Benjamin Otte
1c15510c3d
Call cairo_surface_flush() before setting finished
...
With the current code, the surface will never be flushed as the flush
function checks if the surface is finished, and if so, doesn't call the
vfunc. Ooops.
2010-06-07 13:37:48 +02:00
Benjamin Otte
467d5e7f90
gl: Flush properly in set_destination
2010-06-07 13:37:48 +02:00
Benjamin Otte
e15348d8d0
gl: Don't reset vertex size
2010-06-07 13:37:48 +02:00
Benjamin Otte
a8d6ac1efc
gl: Remove check if we're between begin/end
...
This will be useless soon, because we will keep the current state alive as
long as possible.
2010-06-07 13:37:48 +02:00
Benjamin Otte
8f675fb801
gl: Stop disabling the vertex array and the array buffer
2010-06-07 13:37:48 +02:00
Benjamin Otte
bef0b54149
gl: Do not reset shaders on _end()
...
Instead, keep the shader around until cairo_device_flush() is called.
2010-06-07 13:37:48 +02:00
Benjamin Otte
534c147299
region: clarify docs of cairo_region_equal()
2010-06-07 13:37:48 +02:00
Benjamin Otte
0fc6f08981
gl: Make _shader_by_type() a getter
...
And refactor code to do the current_shader assigning itself.
2010-06-07 13:37:48 +02:00
Benjamin Otte
2971ca0498
gl: bind all shader variables at the same place
...
Avoids the need to bind the shader when creating it.
2010-06-07 13:37:48 +02:00
Benjamin Otte
e11d8370e0
gl: Set GL_BLEND and GL_SCISSOR_TEST globally
...
Note that we do set them unconditionally in _begin() because a flush
might have cleared them.
2010-06-07 13:37:48 +02:00
Benjamin Otte
7747f6d914
gl: Introduce flush functions
...
The flush functions will clear the state that will in the future be kep
unconditionally.
2010-06-07 13:37:48 +02:00
Benjamin Otte
5c74beaaa5
docs: fix typo
2010-06-07 13:37:48 +02:00
Benjamin Otte
92d7b1eee9
device: Make flush vfunc return a cairo_status_t
...
Mirror the behavior of the surface flush vfunc: Make it return a status
and if it's an error set it on the device.
2010-06-07 13:37:48 +02:00
Benjamin Otte
63e3cf3888
gl: Move unsetting the state into the operand destroy function
2010-06-07 13:37:48 +02:00
Benjamin Otte
b9b85dbf37
gl: get rid of the operand's pattern variable
...
Now someone just needs to teach cairo-gl to not use
cairo_pattern_acquire_surface() and we could avoid the nasty hack in
cairo_gl_operand_destroy().
2010-06-07 13:37:47 +02:00
Benjamin Otte
ae9517a39f
gl: Check mask's attributes for component alpha
...
... and don't duplicate that information into the cairo_gl_composite_t
2010-06-07 13:37:47 +02:00
Benjamin Otte
f72afc09d0
gl: Merge fixed function setup into general texture setup
2010-06-07 13:37:47 +02:00
Benjamin Otte
dd1faaf02e
gl: Move function
...
I wanna use it elsewhere and keep the diff small.
2010-06-07 13:37:47 +02:00
Benjamin Otte
d038003136
gl: Simplify mask operand setup code
...
Component alpha just has one different value
2010-06-07 13:37:47 +02:00
Benjamin Otte
e20261ddda
gl: Get rid of operand argument to emit functions
2010-06-07 13:37:47 +02:00
Benjamin Otte
8062fb352e
gl: Add an enum for tex units
...
Instead of hardcoding 0 for source and 1 for mask, use an enum. It's
also clearer when functions take a cairo_gl_tex_t argument instead of a
GLuint.
2010-06-07 13:37:47 +02:00
Benjamin Otte
5db362dd67
gl: Keep a copy of the current operand in the context
...
Note that they are currently only valid as long as the
cairo_gl_composite_t exists, but that will be changed soon.
2010-06-07 13:37:47 +02:00
Benjamin Otte
a05f062c80
gl: Move struct definitions in header
2010-06-07 13:37:47 +02:00
Benjamin Otte
85d4c6c55b
gl: operand->texture.surface cannot be NULL
2010-06-07 13:37:47 +02:00
Benjamin Otte
9486ad5fbd
gl: Remove composite_t argument from _flush() function
2010-06-07 13:37:47 +02:00
Benjamin Otte
16e420b4dc
gl: Remove dependency on composite_t in draw function
2010-06-07 13:37:47 +02:00
Benjamin Otte
e46215ec6b
gl: Remove unneeded and broken workaround
...
We now ensure the values are properly zeroed when setting the operator.
2010-06-07 13:37:47 +02:00
Benjamin Otte
b2d709b5c7
gl: Switch src alpha handling to a tiny on/off function
...
Instead of doing setup every time, we just set this one flag. Much
nicer.
2010-06-07 13:37:47 +02:00
Benjamin Otte
53fd451f85
gl: Avoid redundant mask setup
...
The mask doesn't change, so no need to set it up twice
2010-06-07 13:37:47 +02:00
Benjamin Otte
1b3675fc4b
gl: Split fixed-function operand setup into own function
2010-06-07 13:37:47 +02:00
Benjamin Otte
02da871050
gl: Unify fixed function setup code
2010-06-07 13:37:47 +02:00