[cogl/wip/point-fixes: 4/6] vertend-glsl: Fix flushing the point size with the GL driver



commit 1eaf754f7ae81cdf72a0569f5ee95df1dcfc11f9
Author: Neil Roberts <neil linux intel com>
Date:   Tue Feb 28 14:10:43 2012 +0000

    vertend-glsl: Fix flushing the point size with the GL driver
    
    When using the GLSL vertend on GL, the point size was being flushed in
    _cogl_pipeline_vertend_glsl_start. However, this function bails out
    early if the pipeline already has a usable program so it would not hit
    the code to flush the point size in that case. This patch moves the
    code to _cogl_pipeline_vertend_glsl_end so that it will always be
    flushed if it is different. That is the same place that is flushed for
    the fixed vertend.

 cogl/cogl-pipeline-vertend-glsl.c |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)
---
diff --git a/cogl/cogl-pipeline-vertend-glsl.c b/cogl/cogl-pipeline-vertend-glsl.c
index 31cc8e9..7ad5fc7 100644
--- a/cogl/cogl-pipeline-vertend-glsl.c
+++ b/cogl/cogl-pipeline-vertend-glsl.c
@@ -280,18 +280,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");
-  /* On regular OpenGL we'll just flush the point size builtin */
-  else if (pipelines_difference & COGL_PIPELINE_STATE_POINT_SIZE)
-    {
-      CoglPipeline *authority =
-        _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_POINT_SIZE);
-
-      if (ctx->point_size_cache != authority->big_state->point_size)
-        {
-          GE( ctx, glPointSize (authority->big_state->point_size) );
-          ctx->point_size_cache = authority->big_state->point_size;
-        }
-    }
 
   return TRUE;
 }
@@ -509,6 +497,19 @@ _cogl_pipeline_vertend_glsl_end (CoglPipeline *pipeline,
       shader_state->gl_shader = shader;
     }
 
+  if (ctx->driver == COGL_DRIVER_GL &&
+      (pipelines_difference & COGL_PIPELINE_STATE_POINT_SIZE))
+    {
+      CoglPipeline *authority =
+        _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_POINT_SIZE);
+
+      if (ctx->point_size_cache != authority->big_state->point_size)
+        {
+          GE( ctx, glPointSize (authority->big_state->point_size) );
+          ctx->point_size_cache = authority->big_state->point_size;
+        }
+    }
+
   return TRUE;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]