Commit graph

171 commits

Author SHA1 Message Date
Benjamin Otte
29dfd5b488 gl: Remove unused variables 2010-05-17 01:13:46 +02:00
Benjamin Otte
4144488f51 gl: Convert span renderer to use cairo_gl_composite_begin/end()
Adds two new APIs to the composite API:
- _cairo_gl_composite_set_mask_spans()
  Tells the composite renderer to use the color values for spans.
- _cairo_gl_composite_set_clip_region()
  Tells the composite renderer to use GL_SCISSORS_TEST to clip when
  drawing. This function is very unperformant, so if it can be avoided,
  it probably shouldn't be used.
2010-05-17 01:13:46 +02:00
Benjamin Otte
6e81d85e36 gl: Change _cairo_gl_composite_emit_rect()
Two changes:
- The function now takes x1/y1,x2/y2 instead of x,y,width,height
- The function takes a color uint32_t. This will be used by spans.
2010-05-17 01:13:46 +02:00
Benjamin Otte
f8398cc2d8 gl: remove unused variables from span renderer 2010-05-17 01:13:46 +02:00
Benjamin Otte
f5c5077def gl: Support component alpha in gl_composite_t
Use that to get rid of cairo_gl_surface_composite_component_alpha()
2010-05-17 01:13:46 +02:00
Benjamin Otte
88c118f891 gl: Implement _composite_emit_rect() and _composite_end()
And use it in cairo_gl_surface_composite()
2010-05-17 01:13:46 +02:00
Benjamin Otte
b96735f7b4 gl: Add _cairo_gl_composite_begin() function
This is the first step at adding the following function set:
_cairo_gl_composite_begin()
_cairo_gl_composite_emit_*()
_cairo_gl_composite_end()
which will take care of proiding a unified model for emitting vertexes
using vbos instead of the 5 different methods we currently have.
2010-05-17 01:13:46 +02:00
Benjamin Otte
948290de12 gl: Make the span renderer use the new composite APIs 2010-05-17 01:13:46 +02:00
Benjamin Otte
7ad8c3b456 gl: Move composite code into own file
This allows designing a cleaner interface for cairo_composite_t as there
will not be static functions that get called outside of the "published"
interfaces.
2010-05-17 01:13:46 +02:00
Benjamin Otte
3ff32b00f0 gl: cairo_gl_compsite_setup_t => cairo_gl_composite_t 2010-05-17 01:13:46 +02:00
Benjamin Otte
c16edee26f gl: use glBlendFuncSeparate()
This way we can treat alpha-only textures correctly and don't have to
emit different shaders for it. Also gets rid of
GL_OPERAND_TEXTURE_ALPHA.
2010-05-17 01:13:46 +02:00
Benjamin Otte
08b04caf52 gl: Add cairo_gl_composite_setup_init/fini() functions
Simplifies the main code paths, and can be extended to do dest copies.
2010-05-17 01:13:46 +02:00
Benjamin Otte
aa14df0db5 gl: move operator check
component alpha compositing checks the operator itself
2010-05-17 01:13:46 +02:00
Benjamin Otte
a3ee0a7f11 gl: Programmatically generate fragment shaders 2010-05-17 01:13:46 +02:00
Benjamin Otte
fe43b13052 gl: Automatically generate the vertex shader source
The idea is being able to generate shaders from the given input
on-demand. This allows creating more advanced shaders, such as those
that include the destination (for self-painting and
unsupported-by-blending operator) or painting images in weird formats
(extra translation step in shader, think YUV).
2010-05-17 01:13:46 +02:00
Benjamin Otte
405eee07ad gl: Get rid of cairo_gl_shader_source/mask_t
Use the cairo_gl_operand_type_t instead. Those enums are pretty much
identical.
2010-05-17 01:13:46 +02:00
Benjamin Otte
5149bb87d7 gl: s/_cairo_gl_set_destination/_cairo_gl_context_set_destination/
It's an operation on the context, so name it accordingly
2010-05-17 01:13:46 +02:00
Benjamin Otte
9f34e403f3 gl: Share vertex shaders
Previously, we created a new vertex shader for every shader program we
used. Now the code shares identical vertex shaders between programs.
2010-05-17 01:13:46 +02:00
Benjamin Otte
a9d821b7a0 gl: gl surfaces are only similar when they share the same device
Fixes gl-surface-source test for gl target
2010-05-14 21:07:03 +02:00
Benjamin Otte
3a550eb225 gl: Remove gradient optimizations
These optimizations are done in cairo-gstate.c these days.
2010-05-14 15:57:58 +02:00
Benjamin Otte
ec1ca17b71 gl: Don't create 0x0 surfaces
We get a very annoyed libGL if we try to create 0x0 textures, so we
return an image surface instead.

Tested by the zero-mask test.
2010-05-13 12:11:09 +02:00
Chris Wilson
dfa2544f15 color: Special case comparing color stops.
color stops are not premultiplied so we need to handle them carefully
when comparing. The next step will be to make cairo_color_stop_t a
unique type to prevent this mistake again.
2010-05-13 09:52:39 +01:00
Benjamin Otte
d2a250ad33 gl: Make the shader implementation per-context, not global 2010-05-08 18:08:18 +02:00
Benjamin Otte
4571055c46 gl: Print GL errors when releasing the device
Don't scatter calls to error printing around everywhere, instead do it
in the one place where it matters.

Also, convert the functions to macros, so we can use __FILE__ and
__LINE__ when printing a warning
2010-05-08 18:03:05 +02:00
Benjamin Otte
59b31aeed9 gl: Make check_span_renderer() call not require a device lock
Note that we didn't lock the device previously, so the function was
broken.
2010-05-08 15:09:39 +02:00
Chris Wilson
cc8442514a gl: Enable fixed-function without glsl.
Through a very simple mistake we were triggering fallbacks after
detecting we were not able to perform the composite using GLSL -- we
were just returning the UNSUPPORTED status instead of enabling the
fixed-function path.
2010-05-06 21:55:44 +01:00
Benjamin Otte
9c594d8b40 gl: Get rid of ctx variable
The code used renderer->ctx and ctx interchangably, that was confusing.
2010-05-05 12:30:01 +02:00
Benjamin Otte
a354f1f92a gl: Another case of proper device acquiring
This patch isn't strictly necessary, but it cleans up the code.
2010-05-05 12:30:01 +02:00
Benjamin Otte
36210ee514 gl: Get rid of another cast to cairo_gl_context_t 2010-05-05 12:30:01 +02:00
Benjamin Otte
58b03691d3 gl: Introduce _cairo_gl_device_has_glsl() function
The function takes a cairo_device_t argument as it can be called on an
unacquired device.

This is the first patch in a process to try to rid cairo-gl-surface.c of
casts from cairo_device_t to cairo_gl_context_t. As its members should
usually only be accessed when the device is locked, the only way the
cairo_gl_context_t should be acquired is using
_cairo_gl_context_acquire().
2010-05-05 12:30:01 +02:00
Benjamin Otte
5223b65423 gl: Get rid of cairo_gl_surface_glfinish() from public API
This is now done explicitly in the boilerplate code. It was not a useful
public API to begin with.
2010-05-05 12:30:01 +02:00
Benjamin Otte
90c64f60d8 gl: Move device-specific code into cairo-gl-device.c 2010-05-05 12:30:01 +02:00
Benjamin Otte
0ff5a18fd5 gl: Make _gl_set_destination() take the context as an argument
Keeping with the API introduced for Xlib, functions that require an
acquired context take this context as the first argument.
2010-05-05 12:30:01 +02:00
Benjamin Otte
53508e6e30 gl: Acquire the context before destroying it. 2010-05-05 12:30:01 +02:00
Benjamin Otte
c46aec4897 gl: acquire/release context during surface_finish() 2010-05-05 12:30:01 +02:00
Benjamin Otte
88801aabb3 gl: Acquire context when initing/destroying gl operands 2010-05-05 12:30:00 +02:00
Benjamin Otte
bc49df3227 pixman_image_composite => pixman_image_composite32
Fix up the remaining callers
2010-04-28 20:14:55 +02:00
Andrea Canciani
b8a7f8621a Update FSF address
I updated the Free Software Foundation address using the following script.

for i in $(git grep Temple | cut -d: -f1 )
do
  sed -e 's/59 Temple Place[, -]* Suite 330, Boston, MA *02111-1307[, ]* USA/51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA/' -i "$i"
done

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21356
2010-04-27 11:13:38 +02:00
Benjamin Otte
49b52a8946 gl: Make drawing to windows work again
The correct MIN/MAG_FILTER wasn't set.
2010-04-23 21:46:22 +02:00
Benjamin Otte
3efbc0c5c8 gl: Only unref a surface if it exists
Note: This will likely work for NULL clones, but I prefer not
dereferencing NULLs. That gives people a wrong understanding of the code
(i.e. me).
2010-04-23 21:46:12 +02:00
Benjamin Otte
64662be4ef gl: Use GLfloat instead of float in gl*Array() functions 2010-04-23 21:46:04 +02:00
Benjamin Otte
e4f84f97b2 gl: Don't acquire the gl context twice 2010-04-23 21:45:56 +02:00
Benjamin Otte
e40a2d1f5e gl: Use correct type when uploading images 2010-04-23 21:45:01 +02:00
Benjamin Otte
55cf323f96 gl: fix typo in comment 2010-04-23 21:44:20 +02:00
Benjamin Otte
0a19ad7c10 gl: Get rid of "return value not checked" warnings
Assert that those functions only return successfully.
2010-04-15 18:31:00 +02:00
Benjamin Otte
7745ea21e1 gl: acquire/release properly in _cairo_gl_draw_image()
Fixes various testsuite failures, in particular ones related to masks.
2010-04-15 18:31:00 +02:00
Benjamin Otte
596d3017a1 gl: acquire/release context when getting images
Avoids Mesa complaining about no current context.
2010-04-15 18:31:00 +02:00
Benjamin Otte
712919223d gl: Make code safe for multithreaded access
The code callss the gl device's acquire/release in
cairo_device_acquire/release(). This way, external APIs can use these
functions to prepare for rendering GL.

Also adds code to unset the glx context if it wasn't set when acquiring
the device. This allows multithreaded apps to work fine with just using
cairo APIs, but might introduce penalties in single-threaded
applications.
2010-04-15 18:30:54 +02:00
Benjamin Otte
ebc9cc46fe gl: Use right format
The internal format should always be GL_RGBA.
2010-04-15 17:43:32 +02:00
Chris Wilson
4142f0836d gl: Handle component-alpha ADD
A simple extension to the component-alpha OVER [as ca-ADD is just the
second pass in ca-OVER] to support amalgamation of glyph masks. This
speeds up firefox-36 by ~5% on g45.

Before:
  firefox-36-20090611   76.185
After:
  firefox-36-20090611   72.863
2010-04-15 09:21:05 +01:00