cogl: Move some pre-layer-change-notify code into the driver

A CoglTextureUnit is a GL-specific type, this should happen in the
driver not the core.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1194
This commit is contained in:
Adam Jackson 2020-01-16 16:42:16 -05:00
parent 462df7e61a
commit 4ff58cc63f
2 changed files with 10 additions and 12 deletions

View File

@ -44,7 +44,6 @@
#include "cogl-node-private.h"
#include "cogl-context-private.h"
#include "cogl-texture-private.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
#include <string.h>
@ -342,8 +341,6 @@ _cogl_pipeline_layer_pre_change_notify (CoglPipeline *required_owner,
CoglPipelineLayer *layer,
CoglPipelineLayerState change)
{
CoglTextureUnit *unit;
/* Identify the case where the layer is new with no owner or
* dependants and so we don't need to do anything. */
if (_cogl_list_empty (&COGL_NODE (layer)->children) &&
@ -403,15 +400,6 @@ _cogl_pipeline_layer_pre_change_notify (CoglPipeline *required_owner,
progend->layer_pre_change_notify (required_owner, layer, change);
}
/* If the layer being changed is the same as the last layer we
* flushed to the corresponding texture unit then we keep a track of
* the changes so we can try to minimize redundant OpenGL calls if
* the same layer is flushed again.
*/
unit = _cogl_get_texture_unit (_cogl_pipeline_layer_get_unit_index (layer));
if (unit->layer == layer)
unit->layer_changes_since_flush |= change;
init_layer_state:
if (required_owner)

View File

@ -953,6 +953,7 @@ _cogl_pipeline_progend_glsl_layer_pre_change_notify (
CoglPipelineLayerState change)
{
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
CoglTextureUnit *unit;
if ((change & (_cogl_pipeline_get_layer_state_for_fragment_codegen (ctx) |
COGL_PIPELINE_LAYER_STATE_AFFECTS_VERTEX_CODEGEN)))
@ -977,6 +978,15 @@ _cogl_pipeline_progend_glsl_layer_pre_change_notify (
program_state->unit_state[unit_index].dirty_texture_matrix = TRUE;
}
}
/* If the layer being changed is the same as the last layer we
* flushed to the corresponding texture unit then we keep a track of
* the changes so we can try to minimize redundant OpenGL calls if
* the same layer is flushed again.
*/
unit = _cogl_get_texture_unit (_cogl_pipeline_layer_get_unit_index (layer));
if (unit->layer == layer)
unit->layer_changes_since_flush |= change;
}
static void