From 4ff58cc63f5383d1bf037376c0fcf64426fdb79a Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Thu, 16 Jan 2020 16:42:16 -0500 Subject: [PATCH] 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 --- cogl/cogl/cogl-pipeline-layer.c | 12 ------------ cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c | 10 ++++++++++ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/cogl/cogl/cogl-pipeline-layer.c b/cogl/cogl/cogl-pipeline-layer.c index c6f13696a..3362c6220 100644 --- a/cogl/cogl/cogl-pipeline-layer.c +++ b/cogl/cogl/cogl-pipeline-layer.c @@ -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 @@ -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) diff --git a/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c b/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c index 8b318deb5..083308ced 100644 --- a/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c +++ b/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c @@ -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