[cairo] Cairo OpenGL ES 2.0 backend is rotting away?
Alexandros Frantzis
alexandros.frantzis at linaro.org
Mon Apr 23 07:15:31 PDT 2012
On Mon, Apr 23, 2012 at 03:39:28PM +0300, Siarhei Siamashka wrote:
> Hello,
>
> Tried cairo-perf-trace benchmark using GLES2 backend (--enable-glesv2) on
> x86-64 computer with open source radeon drivers.
>
> === after the merge of GLES2 in 4d96859ba5eb6018ae257ef6bfead228583908cf ===
>
> [ # ] backend test min(s) median(s) stddev. count
> [ 0] egl firefox-fishtank 10.282 10.282 0.00% 1/1
>
> === starting with 2855ff4666922f2c38505414270d47f659b0d499 ===
>
> [ # ] backend test min(s) median(s) stddev. count
> [ 0] egl firefox-fishtank 0.000 0.000 -nan% 0/1
>
> === starting with af9fbd176b145f042408ef5391eef2a51d7531f8 ===
>
> Segmentation fault
>
> === current git master abedc6b46ad283f896e078479174312cb87e6700 ===
>
> cairo-perf-trace: cairo-gl-operand.c:450: _cairo_gl_operand_destroy:
> Assertion `!"reached"' failed.
>
> --
> Best regards,
> Siarhei Siamashka
>
Hi,
the patch below fixes things for me (tried it on a x86-64 with r600g).
Please try it out and check if it fixes the perf test case in your system, too.
Thanks,
Alexandros
diff --git a/src/cairo-gl-gradient.c b/src/cairo-gl-gradient.c
index ce7c0dd..08c2866 100644
--- a/src/cairo-gl-gradient.c
+++ b/src/cairo-gl-gradient.c
@@ -206,6 +206,7 @@ _cairo_gl_gradient_create (cairo_gl_context_t *ctx,
cairo_gl_gradient_t *gradient;
cairo_status_t status;
int tex_width;
+ GLint internal_format;
void *data;
if ((unsigned int) ctx->max_texture_size / 2 <= n_stops)
@@ -247,7 +248,16 @@ _cairo_gl_gradient_create (cairo_gl_context_t *ctx,
if (unlikely (status))
goto cleanup_data;
- glTexImage2D (ctx->tex_target, 0, GL_RGBA, tex_width, 1, 0,
+ /*
+ * In OpenGL ES 2.0 no format conversion is allowed i.e. 'internalFormat'
+ * must match 'format' in glTexImage2D.
+ */
+ if (_cairo_gl_get_flavor () == CAIRO_GL_FLAVOR_ES)
+ internal_format = GL_BGRA;
+ else
+ internal_format = GL_RGBA;
+
+ glTexImage2D (ctx->tex_target, 0, internal_format, tex_width, 1, 0,
GL_BGRA, GL_UNSIGNED_BYTE, data);
free (data);
More information about the cairo
mailing list