mirror of
https://github.com/brl/mutter.git
synced 2024-11-10 07:56:14 -05:00
f005f517fe
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>
70 lines
2.0 KiB
C
70 lines
2.0 KiB
C
/*
|
|
* Cogl
|
|
*
|
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
|
*
|
|
* Copyright (C) 2011 Intel Corporation.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library. If not, see
|
|
* <http://www.gnu.org/licenses/>.
|
|
*
|
|
*
|
|
*
|
|
* Authors:
|
|
* Neil Roberts <neil@linux.intel.com>
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
#include "config.h"
|
|
#endif
|
|
|
|
#include <string.h>
|
|
|
|
#include "cogl-pipeline-private.h"
|
|
|
|
#ifdef COGL_PIPELINE_PROGEND_FIXED
|
|
|
|
#include "cogl-context.h"
|
|
#include "cogl-context-private.h"
|
|
|
|
static void
|
|
_cogl_pipeline_progend_fixed_pre_paint (CoglPipeline *pipeline)
|
|
{
|
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
|
|
|
if (pipeline->vertend != COGL_PIPELINE_VERTEND_FIXED)
|
|
return;
|
|
|
|
if (ctx->current_projection_stack)
|
|
_cogl_matrix_stack_flush_to_gl_builtins (ctx,
|
|
ctx->current_projection_stack,
|
|
COGL_MATRIX_PROJECTION,
|
|
FALSE /* enable flip */);
|
|
if (ctx->current_modelview_stack)
|
|
_cogl_matrix_stack_flush_to_gl_builtins (ctx,
|
|
ctx->current_modelview_stack,
|
|
COGL_MATRIX_MODELVIEW,
|
|
FALSE /* enable flip */);
|
|
}
|
|
|
|
const CoglPipelineProgend _cogl_pipeline_fixed_progend =
|
|
{
|
|
NULL, /* end */
|
|
NULL, /* pre_change_notify */
|
|
NULL, /* layer_pre_change_notify */
|
|
_cogl_pipeline_progend_fixed_pre_paint
|
|
};
|
|
|
|
#endif /* COGL_PIPELINE_PROGEND_FIXED */
|