summaryrefslogtreecommitdiff
path: root/cogl/cogl-pipeline-private.h
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-private.h
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-private.h')
-rw-r--r--cogl/cogl-pipeline-private.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/cogl/cogl-pipeline-private.h b/cogl/cogl-pipeline-private.h
index 8e7f3213..f676b1a0 100644
--- a/cogl/cogl-pipeline-private.h
+++ b/cogl/cogl-pipeline-private.h
@@ -137,11 +137,21 @@
/* If we have either of the GLSL backends then we also need a GLSL
progend to combine the shaders generated into a single
- program. Currently there is only one progend but if we ever add
- other languages they would likely need their own progend too. The
- progends are different from the other backends because there can be
- more than one in use for each pipeline. All of the progends are
- invoked whenever a pipeline is flushed. */
+ program. Same goes for the fixed progends which are used to flush
+ the matrices */
+#ifdef COGL_PIPELINE_FRAGEND_FIXED
+
+#define COGL_PIPELINE_PROGEND_FIXED 0
+
+#ifdef COGL_PIPELINE_FRAGEND_GLSL
+#define COGL_PIPELINE_PROGEND_GLSL 1
+#define COGL_PIPELINE_N_PROGENDS 2
+#else
+#define COGL_PIPELINE_N_PROGENDS 1
+#endif
+
+#else /* COGL_PIPELINE_FRAGEND_FIXED */
+
#ifdef COGL_PIPELINE_FRAGEND_GLSL
#define COGL_PIPELINE_PROGEND_GLSL 0
#define COGL_PIPELINE_N_PROGENDS 1
@@ -149,6 +159,8 @@
#define COGL_PIPELINE_N_PROGENDS 0
#endif
+#endif /* COGL_PIPELINE_FRAGEND_FIXED */
+
/* XXX: should I rename these as
* COGL_PIPELINE_STATE_INDEX_XYZ... ?
*/