From 5b1ff5935ef1a3e6d22ae25ca65c8c661b6aa376 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Fri, 10 Jan 2020 16:52:41 -0500 Subject: [PATCH] cogl: Clean up private feature flags and GLSL builtin handling of same https://gitlab.gnome.org/GNOME/mutter/merge_requests/995 --- cogl/cogl/cogl-private.h | 2 -- .../driver/gl/cogl-pipeline-progend-glsl.c | 26 +++++-------------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/cogl/cogl/cogl-private.h b/cogl/cogl/cogl-private.h index f4378d92e..76829d454 100644 --- a/cogl/cogl/cogl-private.h +++ b/cogl/cogl/cogl-private.h @@ -50,10 +50,8 @@ typedef enum COGL_PRIVATE_FEATURE_UNPACK_SUBIMAGE, COGL_PRIVATE_FEATURE_SAMPLER_OBJECTS, COGL_PRIVATE_FEATURE_READ_PIXELS_ANY_FORMAT, - COGL_PRIVATE_FEATURE_ALPHA_TEST, COGL_PRIVATE_FEATURE_FORMAT_CONVERSION, COGL_PRIVATE_FEATURE_QUERY_FRAMEBUFFER_BITS, - COGL_PRIVATE_FEATURE_BUILTIN_POINT_SIZE_UNIFORM, COGL_PRIVATE_FEATURE_QUERY_TEXTURE_PARAMETERS, COGL_PRIVATE_FEATURE_ALPHA_TEXTURES, COGL_PRIVATE_FEATURE_TEXTURE_SWIZZLE, diff --git a/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c b/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c index af7797ead..641d719f8 100644 --- a/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c +++ b/cogl/cogl/driver/gl/cogl-pipeline-progend-glsl.c @@ -71,22 +71,16 @@ typedef struct void *getter_func; UpdateUniformFunc update_func; CoglPipelineState change; - - /* This builtin is only necessary if the following private feature - * is not implemented in the driver */ - CoglPrivateFeature feature_replacement; } BuiltinUniformData; static BuiltinUniformData builtin_uniforms[] = { { "cogl_point_size_in", cogl_pipeline_get_point_size, update_float_uniform, - COGL_PIPELINE_STATE_POINT_SIZE, - COGL_PRIVATE_FEATURE_BUILTIN_POINT_SIZE_UNIFORM }, + COGL_PIPELINE_STATE_POINT_SIZE }, { "_cogl_alpha_test_ref", cogl_pipeline_get_alpha_test_reference, update_float_uniform, - COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE, - COGL_PRIVATE_FEATURE_ALPHA_TEST } + COGL_PIPELINE_STATE_ALPHA_FUNC_REFERENCE }, }; const CoglPipelineProgend _cogl_pipeline_glsl_progend; @@ -462,9 +456,7 @@ update_builtin_uniforms (CoglContext *context, return; for (i = 0; i < G_N_ELEMENTS (builtin_uniforms); i++) - if (!_cogl_has_private_feature (context, - builtin_uniforms[i].feature_replacement) && - (program_state->dirty_builtin_uniforms & (1 << i)) && + if ((program_state->dirty_builtin_uniforms & (1 << i)) && program_state->builtin_uniform_locations[i] != -1) builtin_uniforms[i].update_func (pipeline, program_state @@ -793,11 +785,9 @@ _cogl_pipeline_progend_glsl_end (CoglPipeline *pipeline, clear_flushed_matrix_stacks (program_state); for (i = 0; i < G_N_ELEMENTS (builtin_uniforms); i++) - if (!_cogl_has_private_feature - (ctx, builtin_uniforms[i].feature_replacement)) - GE_RET( program_state->builtin_uniform_locations[i], ctx, - glGetUniformLocation (gl_program, - builtin_uniforms[i].uniform_name) ); + GE_RET( program_state->builtin_uniform_locations[i], ctx, + glGetUniformLocation (gl_program, + builtin_uniforms[i].uniform_name) ); GE_RET( program_state->modelview_uniform, ctx, glGetUniformLocation (gl_program, @@ -850,9 +840,7 @@ _cogl_pipeline_progend_glsl_pre_change_notify (CoglPipeline *pipeline, int i; for (i = 0; i < G_N_ELEMENTS (builtin_uniforms); i++) - if (!_cogl_has_private_feature - (ctx, builtin_uniforms[i].feature_replacement) && - (change & builtin_uniforms[i].change)) + if (change & builtin_uniforms[i].change) { CoglPipelineProgramState *program_state = get_program_state (pipeline);