[cairo] [PATCH 2/3] gl: Remove unnecessary checks for NULL shader implementation
Alexandros Frantzis
alexandros.frantzis at linaro.org
Fri Jan 28 05:02:53 PST 2011
Due to the fact that we fail if the system doesn't support shaders, we
now always have a valid shader implementation.
---
src/cairo-gl-shaders.c | 29 ++++++++---------------------
1 files changed, 8 insertions(+), 21 deletions(-)
diff --git a/src/cairo-gl-shaders.c b/src/cairo-gl-shaders.c
index 6a42fd1..a39883d 100644
--- a/src/cairo-gl-shaders.c
+++ b/src/cairo-gl-shaders.c
@@ -379,16 +379,14 @@ _cairo_gl_context_init_shaders (cairo_gl_context_t *ctx)
if (unlikely (status))
return status;
- if (ctx->shader_impl != NULL) {
- _cairo_gl_shader_init (&ctx->fill_rectangles_shader);
- status = _cairo_gl_shader_compile (ctx,
- &ctx->fill_rectangles_shader,
- CAIRO_GL_VAR_NONE,
- CAIRO_GL_VAR_NONE,
- fill_fs_source);
- if (unlikely (status))
- return status;
- }
+ _cairo_gl_shader_init (&ctx->fill_rectangles_shader);
+ status = _cairo_gl_shader_compile (ctx,
+ &ctx->fill_rectangles_shader,
+ CAIRO_GL_VAR_NONE,
+ CAIRO_GL_VAR_NONE,
+ fill_fs_source);
+ if (unlikely (status))
+ return status;
return CAIRO_STATUS_SUCCESS;
}
@@ -719,9 +717,6 @@ _cairo_gl_shader_compile (cairo_gl_context_t *ctx,
unsigned int vertex_shader;
cairo_status_t status;
- if (ctx->shader_impl == NULL)
- return CAIRO_STATUS_SUCCESS;
-
assert (shader->program == 0);
vertex_shader = cairo_gl_var_type_hash (src, mask, CAIRO_GL_VAR_NONE);
@@ -813,9 +808,6 @@ void
_cairo_gl_set_shader (cairo_gl_context_t *ctx,
cairo_gl_shader_t *shader)
{
- if (ctx->shader_impl == NULL)
- return;
-
if (ctx->current_shader == shader)
return;
@@ -835,11 +827,6 @@ _cairo_gl_get_shader_by_type (cairo_gl_context_t *ctx,
char *fs_source;
cairo_status_t status;
- if (ctx->shader_impl == NULL) {
- *shader = NULL;
- return CAIRO_STATUS_SUCCESS;
- }
-
lookup.src = source;
lookup.mask = mask;
lookup.dest = CAIRO_GL_OPERAND_NONE;
--
1.7.2.3
More information about the cairo
mailing list