diff options
author | Neil Roberts <neil@linux.intel.com> | 2010-12-06 12:31:51 +0000 |
---|---|---|
committer | Neil Roberts <neil@linux.intel.com> | 2010-12-13 17:29:13 +0000 |
commit | a05c701e6b354f699b0886eb16b3863ed735d3c5 (patch) | |
tree | bb6fb534c8328ee59a6afd1155b5a9f2f5c099bc /cogl/cogl-pipeline-private.h | |
parent | 35b07f6b8394c0ca371183f9bd2709812c884754 (diff) | |
download | cogl-a05c701e6b354f699b0886eb16b3863ed735d3c5.tar.gz |
cogl: upload matrices with uniforms on GLES2
Once the GLES2 wrapper is removed we won't be able to upload the
matrices with the fixed function API any more. The fixed function API
gives a global state for setting the matrix but if a custom shader
uniform is used for the matrices then the state is per
program. _cogl_matrix_stack_flush_to_gl is called in a few places and
it is assumed the current pipeline doesn't need to be flushed before
it is called. To allow these semantics to continue to work, on GLES2
the matrix flush now just stores a reference to the matrix stack in
the CoglContext. A pre_paint virtual is added to the progend which is
called whenever a pipeline is flushed, even if the same pipeline was
flushed already. This gives the GLSL progend a chance to upload the
matrices to the uniforms. The combined modelview/projection matrix is
only calculated if it is used. The generated programs end up never
using the modelview or projection matrix so it usually only has to
upload the combined matrix. When a matrix stack is flushed a reference
is taked to it by the pipeline progend and the age is stored so that
if the same state is used with the same program again then we don't
need to reupload the uniform.
Diffstat (limited to 'cogl/cogl-pipeline-private.h')
-rw-r--r-- | cogl/cogl-pipeline-private.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cogl/cogl-pipeline-private.h b/cogl/cogl-pipeline-private.h index 6720a027..cb81cf3c 100644 --- a/cogl/cogl-pipeline-private.h +++ b/cogl/cogl-pipeline-private.h @@ -735,6 +735,10 @@ typedef struct void (*layer_pre_change_notify) (CoglPipeline *owner, CoglPipelineLayer *layer, CoglPipelineLayerState change); + /* This is called after all of the other functions whenever the + pipeline is flushed, even if the pipeline hasn't changed since + the last flush */ + void (* pre_paint) (CoglPipeline *pipeline); } CoglPipelineProgend; typedef enum |