mirror of
https://github.com/brl/mutter.git
synced 2025-06-14 01:09:30 +00:00
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>
This commit is contained in:

committed by
Robert Bragg

parent
7590fc3ec3
commit
f005f517fe
@ -34,6 +34,14 @@
|
||||
|
||||
typedef struct _CoglMatrixStack CoglMatrixStack;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CoglMatrixStack *stack;
|
||||
unsigned int age;
|
||||
gboolean flushed_identity;
|
||||
gboolean flipped;
|
||||
} CoglMatrixStackCache;
|
||||
|
||||
typedef enum {
|
||||
COGL_MATRIX_MODELVIEW,
|
||||
COGL_MATRIX_PROJECTION,
|
||||
@ -107,10 +115,12 @@ _cogl_matrix_stack_get (CoglMatrixStack *stack,
|
||||
void
|
||||
_cogl_matrix_stack_set (CoglMatrixStack *stack,
|
||||
const CoglMatrix *matrix);
|
||||
|
||||
void
|
||||
_cogl_matrix_stack_flush_to_gl (CoglContext *ctx,
|
||||
CoglMatrixStack *stack,
|
||||
CoglMatrixMode mode);
|
||||
_cogl_matrix_stack_flush_to_gl_builtins (CoglContext *ctx,
|
||||
CoglMatrixStack *stack,
|
||||
CoglMatrixMode mode,
|
||||
gboolean disable_flip);
|
||||
|
||||
unsigned int
|
||||
_cogl_matrix_stack_get_age (CoglMatrixStack *stack);
|
||||
@ -122,15 +132,19 @@ _cogl_matrix_stack_get_age (CoglMatrixStack *stack);
|
||||
gboolean
|
||||
_cogl_matrix_stack_has_identity_flag (CoglMatrixStack *stack);
|
||||
|
||||
void
|
||||
_cogl_prepare_matrix_stack_for_flush (CoglContext *context,
|
||||
CoglMatrixStack *stack,
|
||||
CoglMatrixMode mode,
|
||||
CoglMatrixStackFlushFunc callback,
|
||||
void *user_data);
|
||||
|
||||
gboolean
|
||||
_cogl_matrix_stack_equal (CoglMatrixStack *stack0,
|
||||
CoglMatrixStack *stack1);
|
||||
|
||||
void
|
||||
_cogl_matrix_stack_init_cache (CoglMatrixStackCache *cache);
|
||||
|
||||
gboolean
|
||||
_cogl_matrix_stack_check_and_update_cache (CoglMatrixStack *stack,
|
||||
CoglMatrixStackCache *cache,
|
||||
gboolean flip);
|
||||
|
||||
void
|
||||
_cogl_matrix_stack_destroy_cache (CoglMatrixStackCache *cache);
|
||||
|
||||
#endif /* __COGL_MATRIX_STACK_H */
|
||||
|
Reference in New Issue
Block a user