summaryrefslogtreecommitdiff
path: root/cogl/cogl-pipeline.c
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2011-11-29 14:21:07 +0000
committerRobert Bragg <robert@linux.intel.com>2011-12-06 19:02:06 +0000
commitf005f517fe03f28bb7fe09383490d069fc1400e9 (patch)
tree5d65e12140a474d5d541487f9ee1a8e9b8881ff6 /cogl/cogl-pipeline.c
parent7590fc3ec35aa87f980ebed4fef634b50fcd2460 (diff)
downloadcogl-f005f517fe03f28bb7fe09383490d069fc1400e9.tar.gz
Flush matrices in the progend and flip with a vector
Previously flushing the matrices was performed as part of the framebuffer state. When on GLES2 this matrix flushing is actually diverted so that it only keeps a reference to the intended matrix stack. This is necessary because on GLES2 there are no builtin uniforms so it can't actually flush the matrices until the program for the pipeline is generated. When the matrices are flushed it would store the age of modifications on the matrix stack so that it could detect when the matrix hasn't changed and avoid flushing it. This patch changes it so that the pipeline is responsible for flushing the matrices even when we are using the GL builtins. The same mechanism for detecting unmodified matrix stacks is used in all cases. There is a new CoglMatrixStackCache type which is used to store a reference to the intended matrix stack along with its last flushed age. There are now two of these attached to the CoglContext to track the flushed state for the global matrix builtins and also two for each glsl progend program state to track the flushed state for a program. The framebuffer matrix flush now just updates the intended matrix stacks without actually trying to flush. When a vertex snippet is attached to the pipeline, the GLSL vertend will now avoid using the projection matrix to flip the rendering. This is necessary because any vertex snippet may cause the projection matrix not to be used. Instead the flip is done as a forced final step by multiplying cogl_position_out by a vec4 uniform. This uniform is updated as part of the progend pre_paint depending on whether the framebuffer is offscreen or not. Reviewed-by: Robert Bragg <robert@linux.intel.com>
Diffstat (limited to 'cogl/cogl-pipeline.c')
-rw-r--r--cogl/cogl-pipeline.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c
index 72777822..74ba1606 100644
--- a/cogl/cogl-pipeline.c
+++ b/cogl/cogl-pipeline.c
@@ -71,9 +71,6 @@ _cogl_pipeline_progends[MAX (COGL_PIPELINE_N_PROGENDS, 1)];
#ifdef COGL_PIPELINE_FRAGEND_FIXED
#include "cogl-pipeline-fragend-fixed-private.h"
#endif
-#ifdef COGL_PIPELINE_PROGEND_GLSL
-#include "cogl-pipeline-progend-glsl-private.h"
-#endif
#ifdef COGL_PIPELINE_VERTEND_GLSL
#include "cogl-pipeline-vertend-glsl-private.h"
@@ -82,6 +79,13 @@ _cogl_pipeline_progends[MAX (COGL_PIPELINE_N_PROGENDS, 1)];
#include "cogl-pipeline-vertend-fixed-private.h"
#endif
+#ifdef COGL_PIPELINE_PROGEND_FIXED
+#include "cogl-pipeline-progend-fixed-private.h"
+#endif
+#ifdef COGL_PIPELINE_PROGEND_GLSL
+#include "cogl-pipeline-progend-glsl-private.h"
+#endif
+
COGL_OBJECT_DEFINE (Pipeline, pipeline);
GQuark
@@ -128,6 +132,10 @@ _cogl_pipeline_init_default_pipeline (void)
_cogl_pipeline_fragends[COGL_PIPELINE_FRAGEND_FIXED] =
&_cogl_pipeline_fixed_fragend;
#endif
+#ifdef COGL_PIPELINE_PROGEND_FIXED
+ _cogl_pipeline_progends[COGL_PIPELINE_PROGEND_FIXED] =
+ &_cogl_pipeline_fixed_progend;
+#endif
#ifdef COGL_PIPELINE_PROGEND_GLSL
_cogl_pipeline_progends[COGL_PIPELINE_PROGEND_GLSL] =
&_cogl_pipeline_glsl_progend;