mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-09 04:58:04 +02:00
gl: Avoid attempting to create a program on GLSL-incapable h/w for spans
This commit is contained in:
parent
29df5c91d0
commit
668ac047e6
2 changed files with 18 additions and 5 deletions
|
|
@ -542,7 +542,13 @@ bind_texture_to_shader (GLuint program, const char *name, GLuint tex_unit)
|
|||
void
|
||||
_cairo_gl_use_program (cairo_gl_shader_program_t *program)
|
||||
{
|
||||
get_impl()->use_program (program);
|
||||
const shader_impl_t *impl;
|
||||
|
||||
impl = get_impl ();
|
||||
if (impl == NULL)
|
||||
return;
|
||||
|
||||
impl->use_program (program);
|
||||
}
|
||||
|
||||
static const char *vs_no_coords =
|
||||
|
|
@ -827,6 +833,9 @@ _cairo_gl_get_program (cairo_gl_context_t *ctx,
|
|||
if (program->build_failure)
|
||||
return CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
|
||||
if (get_impl () == NULL)
|
||||
return CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
|
||||
source_source = source_sources[source];
|
||||
mask_source = mask_sources[mask];
|
||||
in_source = in_sources[in];
|
||||
|
|
@ -850,6 +859,8 @@ _cairo_gl_get_program (cairo_gl_context_t *ctx,
|
|||
strlen(mask_source) +
|
||||
strlen(in_source) +
|
||||
1);
|
||||
if (unlikely (fs_source == NULL))
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
|
||||
if (source == CAIRO_GL_SHADER_SOURCE_CONSTANT ||
|
||||
source == CAIRO_GL_SHADER_SOURCE_LINEAR_GRADIENT ||
|
||||
|
|
@ -873,9 +884,6 @@ _cairo_gl_get_program (cairo_gl_context_t *ctx,
|
|||
vs_source = vs_source_mask_coords;
|
||||
}
|
||||
|
||||
if (!fs_source)
|
||||
return CAIRO_STATUS_NO_MEMORY;
|
||||
|
||||
sprintf(fs_source, "%s%s%s", source_source, mask_source, in_source);
|
||||
|
||||
init_shader_program (program);
|
||||
|
|
@ -902,6 +910,5 @@ _cairo_gl_get_program (cairo_gl_context_t *ctx,
|
|||
_cairo_gl_use_program (NULL);
|
||||
|
||||
*out_program = program;
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2922,6 +2922,12 @@ _cairo_gl_surface_create_span_renderer (cairo_operator_t op,
|
|||
CAIRO_GL_SHADER_MASK_SPANS,
|
||||
CAIRO_GL_SHADER_IN_NORMAL,
|
||||
&renderer->setup.shader);
|
||||
if (_cairo_status_is_error (status)) {
|
||||
_cairo_gl_operand_destroy (&renderer->setup.src);
|
||||
_cairo_gl_context_release (renderer->ctx);
|
||||
free (renderer);
|
||||
return _cairo_span_renderer_create_in_error (status);
|
||||
}
|
||||
|
||||
src_attributes = &renderer->setup.src.operand.texture.attributes;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue