From 6749151ac9dcf4e289390ffe258ec8f41cce896b Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Fri, 15 Dec 2023 16:17:19 +0100 Subject: [PATCH] cogl/pipeline: Use the pipeline context instead of the default context In practise they are the same right now but this prepares CoglPipeline for a future where we have multiple contexts. Part-of: --- cogl/cogl/cogl-pipeline.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/cogl/cogl/cogl-pipeline.c b/cogl/cogl/cogl-pipeline.c index 81e19931f..46704824f 100644 --- a/cogl/cogl/cogl-pipeline.c +++ b/cogl/cogl/cogl-pipeline.c @@ -1044,7 +1044,7 @@ _cogl_pipeline_pre_change_notify (CoglPipeline *pipeline, const CoglColor *new_color, gboolean from_layer_change) { - _COGL_GET_CONTEXT (ctx, NO_RETVAL); + CoglContext *ctx = pipeline->context; /* If primitives have been logged in the journal referencing the * current state of this pipeline we need to flush the journal @@ -1567,7 +1567,7 @@ _cogl_pipeline_get_layer_with_flags (CoglPipeline *pipeline, CoglPipelineLayer *layer; int unit_index; int i; - CoglContext *ctx; + CoglContext *ctx = pipeline->context; /* The layer index of the layer we want info about */ layer_info.layer_index = layer_index; @@ -1596,8 +1596,6 @@ _cogl_pipeline_get_layer_with_flags (CoglPipeline *pipeline, if (layer_info.layer || (flags & COGL_PIPELINE_GET_LAYER_NO_CREATE)) return layer_info.layer; - ctx = _cogl_context_get_default (); - unit_index = layer_info.insert_after + 1; if (unit_index == 0) layer = _cogl_pipeline_layer_copy (ctx->default_layer_0); @@ -1721,6 +1719,7 @@ fallback_layer_cb (CoglPipelineLayer *layer, void *user_data) { CoglPipelineFallbackState *state = user_data; CoglPipeline *pipeline = state->pipeline; + CoglContext *ctx = pipeline->context; CoglTexture *texture = NULL; COGL_STATIC_COUNTER (layer_fallback_counter, "layer fallback counter", @@ -1728,8 +1727,6 @@ fallback_layer_cb (CoglPipelineLayer *layer, void *user_data) "forced to a fallback texture", 0 /* no application private data */); - _COGL_GET_CONTEXT (ctx, FALSE); - if (!(state->fallback_layers & 1<i)) return TRUE; @@ -2563,10 +2560,9 @@ _cogl_pipeline_deep_copy (CoglPipeline *pipeline, unsigned long layer_differences) { CoglPipeline *new, *authority; + CoglContext *ctx = pipeline->context; gboolean copy_layer_state; - _COGL_GET_CONTEXT (ctx, NULL); - if ((differences & COGL_PIPELINE_STATE_LAYERS)) { copy_layer_state = TRUE; @@ -2769,11 +2765,10 @@ int cogl_pipeline_get_uniform_location (CoglPipeline *pipeline, const char *uniform_name) { + CoglContext *ctx = pipeline->context; void *location_ptr; char *uniform_name_copy; - _COGL_GET_CONTEXT (ctx, -1); - /* This API is designed as if the uniform locations are specific to a pipeline but they are actually unique across a whole CoglContext. Potentially this could just be