diff options
author | Robert Bragg <robert@linux.intel.com> | 2012-09-25 21:08:10 +0100 |
---|---|---|
committer | Robert Bragg <robert@linux.intel.com> | 2013-01-22 17:48:00 +0000 |
commit | 8f3380adc30dceb23122a31a6526c517e0a85794 (patch) | |
tree | e1538699519186607e60f8651b62d54db24c7720 /cogl/driver/gl/cogl-pipeline-vertend-glsl.c | |
parent | f05a1a62f408f458a530aade107b66c6cb06ddd0 (diff) | |
download | cogl-8f3380adc30dceb23122a31a6526c517e0a85794.tar.gz |
Clearly define 3 progends that own the frag+vertends
This adds a new "fixed-arbfp" progend so we now have 3 distinct ways of
setting up the state of a pipeline:
» fixed; where the vertex and fragment processing are implemented
using fixed function opengl apis.
» fixed-arbfp; where vertex processing is implemented using fixed
function opengl apis but fragment processing is implemented
using the ARB Fragment Processing language.
» glsl; there vertex and fragment processing are both implemented
using glsl.
This means we avoid unusual, combinations such as glsl for vertex
processing and arbfp for fragment processing, and also avoid pairing
fixed-function vertex processing with glsl fragment processing which we
happen to know hits some awkward code paths in Mesa that lead to poor
performance.
As part of this change, the progend now implies specific vertend and
fragend choices so instead of associating a vertend and fragend with a
pipeline we now just associate a progend choice.
When flushing a pipeline and choosing what progend to use, we now call a
progend->start() method that is able to determine if the vertend and
fragend together will be able to handle the given pipeline so the
vertend and fragend ->start() methods no longer need to return a boolean
status.
Since we now don't need to support glsl used in conjunction with fixed
function this will allow us to avoid ever using OpenGL builtin attribute
names, though this patch doesn't change that yet.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit cec381f50c7a2f2186bd4a8c5f38fecd5f099075)
Diffstat (limited to 'cogl/driver/gl/cogl-pipeline-vertend-glsl.c')
-rw-r--r-- | cogl/driver/gl/cogl-pipeline-vertend-glsl.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/cogl/driver/gl/cogl-pipeline-vertend-glsl.c b/cogl/driver/gl/cogl-pipeline-vertend-glsl.c index d8b7e6dc..16f037cb 100644 --- a/cogl/driver/gl/cogl-pipeline-vertend-glsl.c +++ b/cogl/driver/gl/cogl-pipeline-vertend-glsl.c @@ -149,7 +149,7 @@ get_layer_vertex_snippets (CoglPipelineLayer *layer) return &layer->big_state->vertex_snippets; } -static CoglBool +static void _cogl_pipeline_vertend_glsl_start (CoglPipeline *pipeline, int n_layers, unsigned long pipelines_difference, @@ -157,21 +157,9 @@ _cogl_pipeline_vertend_glsl_start (CoglPipeline *pipeline, { CoglPipelineShaderState *shader_state; CoglPipeline *template_pipeline = NULL; - CoglProgram *user_program; - - _COGL_GET_CONTEXT (ctx, FALSE); - - if (!cogl_has_feature (ctx, COGL_FEATURE_ID_GLSL)) - return FALSE; - - user_program = cogl_pipeline_get_user_program (pipeline); + CoglProgram *user_program = cogl_pipeline_get_user_program (pipeline); - /* If the user program has a vertex shader that isn't GLSL then the - appropriate vertend for that language should handle it */ - if (user_program && - _cogl_program_has_vertex_shader (user_program) && - _cogl_program_get_language (user_program) != COGL_SHADER_LANGUAGE_GLSL) - return FALSE; + _COGL_GET_CONTEXT (ctx, NO_RETVAL); /* Now lookup our glsl backend private state (allocating if * necessary) */ @@ -238,7 +226,7 @@ _cogl_pipeline_vertend_glsl_start (CoglPipeline *pipeline, shader_state->user_program_age == user_program->age) && (ctx->driver != COGL_DRIVER_GLES2 || shader_state->n_tex_coord_attribs == n_tex_coord_attribs)) - return TRUE; + return; /* We need to recreate the shader so destroy the existing one */ GE( ctx, glDeleteShader (shader_state->gl_shader) ); @@ -258,7 +246,7 @@ _cogl_pipeline_vertend_glsl_start (CoglPipeline *pipeline, to generate one */ if (user_program && _cogl_program_has_vertex_shader (user_program)) - return TRUE; + return; /* We reuse two grow-only GStrings for code-gen. One string contains the uniform and attribute declarations while the @@ -280,8 +268,6 @@ _cogl_pipeline_vertend_glsl_start (CoglPipeline *pipeline, to copy it from the custom uniform in the vertex shader */ g_string_append (shader_state->source, " cogl_point_size_out = cogl_point_size_in;\n"); - - return TRUE; } static CoglBool |