Commit graph

22 commits

Author SHA1 Message Date
Bryce Harrington
8ff3019f51 gl: Add support for OpenGL ES 3.0
This improves the OpenGL ES support to extend it to version 3.0.
A number of new features are available in glesv3 including creation of
multi-sampled renderbuffers.  These renderbuffers can be blitted to
single sample textures (but not the other way around).  Other features
such as PBO for image uploading, are left as followon work.

For this preliminary implementation, glesv3 backends always create
renderbuffers, which can be set as single sample or multisample.  The
renderbuffer's content is blitted to the texture only when used as a
source or a mask.

Images uploaded to a texture stay there until the surface is used as a
rendering target, at which point its painted to the renderbuffer.

This patch is heavily based off of Henry Song's initial GLESv3 patch
6f7f3795 from his cairogles fork of Cairo, and incorporates subsequent
fixes and pertinent refactorings from his trunk and review feedback from
Uli.

This implements the *functional* support for glesv3, excluding the
various optimization work to utilize its features.  Rendering and
performance should not be expected to improve notably from pure glesv2.
As the GL backend for Cairo remains "experimental", these changes should
likewise be considered as such.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2017-09-13 15:18:04 -07:00
Bryce Harrington
3f1a6f7225 gl: Fix one more CAIRO_GL_FLAVOR_ES3 enum 2016-11-03 09:16:24 -07:00
Henry Song
9f43f096b2 gl: Flush context upon evicting a gradient
As the random selection of a gradient can possible destroy the currently
active gradient, we need to flush the context in order to flush any
references to the texture before deletion.
2012-12-01 17:08:56 +00:00
Chris Wilson
adfe9b7eb6 gl: Fudge gradient color generation to handle multiple stops at 0
In order to generate the correct left-hand border color, we need to
fudge the offsets of the color stops if multiple stops are defined at 0.
The reason is that pixman will generate our color ramp by using the
right-most color stop for the pixel centre, but in order to provide the
sample colour outside of the gradient we need pixel 0 to be have the
left-most color.

Reported by Henry Song.
2012-08-11 18:25:27 +01:00
Chris Wilson
b0336e9aad gl: Use a wide texture ramp to emulate a linear step function
If the gradient contains a step function, we need an infinitely sharp
texture to emulate the correct output. Failing that, lets just use as
large a texture as can be reasonably handled by the hardware
2012-08-11 18:25:27 +01:00
Henry Song
1e9abd6e4e gl: use absolute value for color difference between gradient stops 2012-07-26 18:32:00 +01:00
Henry Song
64a236246b gl: generate correct gradient color texture
Pixman generates gradient color at the center of pixel.  We need to
adjust such accordingly in GL when generating gradient texture
2012-07-10 16:14:54 +01:00
Alexandros Frantzis
e6a04c2f67 gl: Fix creation of gradient ramps for GLESv2
glTexImage2D is not allowed to perform an implicit format conversion
with GLESv2, so fixup the internal format to match the incoming pixel
format.
2012-04-23 20:21:40 +01:00
Henry (Yu) Song
cc247c346b gl: Remove an unused variable 2012-04-02 14:39:54 -07:00
Henry Song
bc97bcf0ef gl: use direct mode for uploading gradient texture
The gradient is relatively small and any differences between upload
methods should be hidden by the caching. As it stands, using pbo with
the gradient fails with fglrx. As the workaround to use a simple
TexImage2D is inconsequential (may even be a minute win) and simplifies
the code, just do it.
2012-03-22 23:13:30 +00:00
Chris Wilson
34f507a919 gl: Need to increment reference count when copying operands
Or else watch everything die with use-after-free of the cached
gradients.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-09 19:54:15 +01:00
Chris Wilson
a6c27b500b gl: Basic fixes to get cairo-gl running again
Let there be textures!

Unbreak the setup of surface operands after my lazy convertion to the
new compositor interface. This is still only the first step, but it gets
the essentials up and running again, enough to keep me happy whilst
sitting in the airport.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-09 19:54:15 +01:00
Alexandros Frantzis
0e41145a75 gl: Use conventional texture upload for GLES2
GLES2 doesn't support Pixel Buffer Objects. Use conventional texture upload
for GLES2 (using client-side memory).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:30:29 +01:00
Alexandros Frantzis
d20f66608c gl: Require the GL_EXT_texture_format_BGRA8888 extension for GLES2
This extension adds limited BGRA support to GLES2. It is better than
nothing...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:30:02 +01:00
Alexandros Frantzis
7bfcf1deaf gl: Store gradients in 2D textures of height 1 instead of 1D textures
1D textures are not available in GLES2. We use 2D textures with height 1
instead, which are equivalent to 1D textures and exist across all GL flavors.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-05-10 08:20:54 +01:00
Alexandros Frantzis
cf518b29e0 gl: Use the dispatch table for calling ARB/EXT functions
Use the dispatch table for calling GL functions that can have multiple name
variants. Also, always use the core variant names for GL constants.
2010-12-15 15:32:20 +00:00
Benjamin Otte
9669faa936 gl: Handle errors from _cairo_gl_gradient_render()
Thanks Andrea for finding this.
2010-08-08 17:23:05 +02:00
Benjamin Otte
64f90322f7 gl: Refactor status handling in _cairo_gl_context_release()
Previously, the code returned a status and required the caller to mangle
this status with his own status. Now, the function takes the previous
status ass an argument and does the mangling itself.

Also contains fixes for all the callers to actually check the return
value - which is now rather trivial as it just requires passing through
the status variable.
2010-06-18 16:31:52 +02:00
Chris Wilson
4e4724d48c gl: make check insists "cairoint.h" is first. 2010-06-11 12:19:56 +01:00
Andrea Canciani
836f616659 gl: support single stop gradients 2010-06-10 16:07:42 +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
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