From f6ec6e2d0ee576b136e49f5c8faf77fda50e89b8 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Wed, 14 Sep 2011 15:25:58 +0100 Subject: [PATCH] pipeline-arbfp: Check for fog on the pipeline not the legacy state The ARBfp backend can't handle fog so it tries to check for when it's enabled and bails out. However it was checking using the global legacy state value on the CoglContext but this doesn't necessarily reflect the state that will actually be used by the pipeline because Cogl may have internally pushed a different pipeline. This patch adds an internal _cogl_pipeline_get_fog_enabled which the ARBfp backend now uses. Reviewed-by: Robert Bragg --- cogl/cogl-pipeline-fragend-arbfp.c | 2 +- cogl/cogl-pipeline-private.h | 3 +++ cogl/cogl-pipeline.c | 12 ++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cogl/cogl-pipeline-fragend-arbfp.c b/cogl/cogl-pipeline-fragend-arbfp.c index 294daa96f..8c25b3631 100644 --- a/cogl/cogl-pipeline-fragend-arbfp.c +++ b/cogl/cogl-pipeline-fragend-arbfp.c @@ -165,7 +165,7 @@ _cogl_pipeline_fragend_arbfp_start (CoglPipeline *pipeline, return FALSE; /* TODO: support fog */ - if (ctx->legacy_fog_state.enabled) + if (_cogl_pipeline_get_fog_enabled (pipeline)) return FALSE; user_program = cogl_pipeline_get_user_program (pipeline); diff --git a/cogl/cogl-pipeline-private.h b/cogl/cogl-pipeline-private.h index 7e019c28e..de96c6c75 100644 --- a/cogl/cogl-pipeline-private.h +++ b/cogl/cogl-pipeline-private.h @@ -1184,6 +1184,9 @@ void _cogl_pipeline_set_blend_enabled (CoglPipeline *pipeline, CoglPipelineBlendEnable enable); +gboolean +_cogl_pipeline_get_fog_enabled (CoglPipeline *pipeline); + void _cogl_pipeline_set_static_breadcrumb (CoglPipeline *pipeline, const char *breadcrumb); diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c index 70bda8ffb..d0e32d94c 100644 --- a/cogl/cogl-pipeline.c +++ b/cogl/cogl-pipeline.c @@ -2855,6 +2855,18 @@ _cogl_pipeline_update_authority (CoglPipeline *pipeline, } } +gboolean +_cogl_pipeline_get_fog_enabled (CoglPipeline *pipeline) +{ + CoglPipeline *authority; + + g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE); + + authority = + _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_FOG); + return authority->big_state->fog_state.enabled; +} + unsigned long _cogl_pipeline_get_age (CoglPipeline *pipeline) {