[mutter] cogl: Remove ARBfp pipeline support



commit 97004e6114991ae4e30be7ef871aec49c8738187
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Thu May 17 13:45:16 2018 +0200

    cogl: Remove ARBfp pipeline support
    
    As with fixed pipelines, we require the use of the GLSL pipeline in
    mutter, and no point in supporting ARBfp anyway.

 clutter/clutter/deprecated/clutter-shader.c        |  30 +-
 clutter/tests/interactive/.gitignore               |   1 -
 clutter/tests/interactive/Makefile.am              |   1 -
 clutter/tests/interactive/test-cogl-shader-arbfp.c | 407 ---------
 cogl/cogl/Makefile.am                              |   2 -
 cogl/cogl/cogl-context.c                           |  10 -
 cogl/cogl/cogl-context.h                           |   2 -
 cogl/cogl/cogl-debug-options.h                     |   9 +-
 cogl/cogl/cogl-debug.c                             |   1 -
 cogl/cogl/cogl-debug.h                             |   1 -
 cogl/cogl/cogl-pipeline-private.h                  |  23 +-
 cogl/cogl/cogl-pipeline.c                          |   7 -
 cogl/cogl/cogl-private.h                           |   1 -
 cogl/cogl/cogl-renderer.c                          |   3 +-
 cogl/cogl/cogl-types.h                             |   2 -
 cogl/cogl/deprecated/cogl-program.c                |  68 +-
 cogl/cogl/deprecated/cogl-shader-private.h         |   1 -
 cogl/cogl/deprecated/cogl-shader.c                 | 190 ++--
 cogl/cogl/driver/gl/cogl-pipeline-opengl.c         |  33 +-
 cogl/cogl/driver/gl/gl/cogl-driver-gl.c            |   6 -
 .../gl/gl/cogl-pipeline-fragend-arbfp-private.h    |  42 -
 .../driver/gl/gl/cogl-pipeline-fragend-arbfp.c     | 988 ---------------------
 cogl/cogl/gl-prototypes/cogl-all-functions.h       |  25 -
 cogl/tests/run-tests.sh                            |   3 +-
 24 files changed, 70 insertions(+), 1786 deletions(-)
---
diff --git a/clutter/clutter/deprecated/clutter-shader.c b/clutter/clutter/deprecated/clutter-shader.c
index 60f15c679..7e286cfd3 100644
--- a/clutter/clutter/deprecated/clutter-shader.c
+++ b/clutter/clutter/deprecated/clutter-shader.c
@@ -70,8 +70,6 @@ struct _ClutterShaderPrivate
 {
   guint       compiled         : 1; /* Shader is bound to the GL context */
   guint       is_enabled       : 1;
-  guint       vertex_is_glsl   : 1;
-  guint       fragment_is_glsl : 1;
 
   gchar      *vertex_source;        /* GLSL source for vertex shader */
   gchar      *fragment_source;      /* GLSL source for fragment shader */
@@ -108,10 +106,10 @@ clutter_shader_release_internal (ClutterShader *shader)
 
   g_assert (priv->program != COGL_INVALID_HANDLE);
 
-  if (priv->vertex_is_glsl && priv->vertex_shader != COGL_INVALID_HANDLE)
+  if (priv->vertex_shader != COGL_INVALID_HANDLE)
     cogl_handle_unref (priv->vertex_shader);
 
-  if (priv->fragment_is_glsl && priv->fragment_shader != COGL_INVALID_HANDLE)
+  if (priv->fragment_shader != COGL_INVALID_HANDLE)
     cogl_handle_unref (priv->fragment_shader);
 
   if (priv->program != COGL_INVALID_HANDLE)
@@ -350,7 +348,6 @@ clutter_shader_set_source (ClutterShader     *shader,
                            gssize             length)
 {
   ClutterShaderPrivate *priv = shader->priv;
-  gboolean is_glsl = FALSE;
 
   if (length < 0)
     length = strlen (data);
@@ -363,12 +360,9 @@ clutter_shader_set_source (ClutterShader     *shader,
   if (clutter_shader_is_compiled (shader))
     clutter_shader_release (shader);
 
-  is_glsl = !g_str_has_prefix (data, "!!ARBfp");
-
   CLUTTER_NOTE (SHADER,
-                "setting %s shader (GLSL:%s, len:%" G_GSSIZE_FORMAT ")",
+                "setting %s shader (len:%" G_GSSIZE_FORMAT ")",
                 shader_type == CLUTTER_VERTEX_SHADER ? "vertex" : "fragment",
-                is_glsl ? "yes" : "no",
                 length);
 
   switch (shader_type)
@@ -377,7 +371,6 @@ clutter_shader_set_source (ClutterShader     *shader,
       g_free (priv->fragment_source);
 
       priv->fragment_source = g_strndup (data, length);
-      priv->fragment_is_glsl = is_glsl;
       g_object_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_FRAGMENT_SOURCE]);
       break;
 
@@ -385,7 +378,6 @@ clutter_shader_set_source (ClutterShader     *shader,
       g_free (priv->vertex_source);
 
       priv->vertex_source = g_strndup (data, length);
-      priv->vertex_is_glsl = is_glsl;
       g_object_notify_by_pspec (G_OBJECT (shader), obj_props[PROP_VERTEX_SOURCE]);
       break;
     }
@@ -538,7 +530,7 @@ bind_glsl_shader (ClutterShader  *self,
 
   priv->program = cogl_create_program ();
 
-  if (priv->vertex_is_glsl && priv->vertex_source != COGL_INVALID_HANDLE)
+  if (priv->vertex_source != COGL_INVALID_HANDLE)
     {
       res = clutter_shader_glsl_bind (self,
                                       CLUTTER_VERTEX_SHADER,
@@ -551,7 +543,7 @@ bind_glsl_shader (ClutterShader  *self,
         }
     }
 
-  if (priv->fragment_is_glsl && priv->fragment_source != COGL_INVALID_HANDLE)
+  if (priv->fragment_source != COGL_INVALID_HANDLE)
     {
       res = clutter_shader_glsl_bind (self,
                                       CLUTTER_FRAGMENT_SHADER,
@@ -597,18 +589,6 @@ clutter_shader_compile (ClutterShader  *shader,
   if (priv->compiled)
     return priv->compiled;
 
-  if ((priv->vertex_source != COGL_INVALID_HANDLE && !priv->vertex_is_glsl) ||
-      (priv->fragment_source != COGL_INVALID_HANDLE && !priv->fragment_is_glsl))
-    {
-      /* XXX: Could remove this check, since we only advertise support for GLSL
-       * shaders anyways. */
-      g_set_error (error, CLUTTER_SHADER_ERROR,
-                   CLUTTER_SHADER_ERROR_NO_ASM,
-                   "ASM shaders not supported");
-      priv->compiled = FALSE;
-      return priv->compiled;
-    }
-
   if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
     {
       g_set_error (error, CLUTTER_SHADER_ERROR,
diff --git a/clutter/tests/interactive/.gitignore b/clutter/tests/interactive/.gitignore
index 74d19ee62..7fde7f98f 100644
--- a/clutter/tests/interactive/.gitignore
+++ b/clutter/tests/interactive/.gitignore
@@ -12,7 +12,6 @@
 /test-cogl-offscreen
 /test-cogl-point-sprites
 /test-cogl-primitives
-/test-cogl-shader-arbfp
 /test-cogl-shader-glsl
 /test-cogl-tex-convert
 /test-cogl-tex-foreign
diff --git a/clutter/tests/interactive/Makefile.am b/clutter/tests/interactive/Makefile.am
index 34b6ac45a..0174e2a48 100644
--- a/clutter/tests/interactive/Makefile.am
+++ b/clutter/tests/interactive/Makefile.am
@@ -8,7 +8,6 @@ UNIT_TESTS = \
        test-shader-effects.c \
        test-script.c \
        test-grab.c \
-       test-cogl-shader-arbfp.c \
        test-cogl-shader-glsl.c \
        test-animator.c \
        test-state.c \
diff --git a/cogl/cogl/Makefile.am b/cogl/cogl/Makefile.am
index b21d9b935..be3c28972 100644
--- a/cogl/cogl/Makefile.am
+++ b/cogl/cogl/Makefile.am
@@ -171,8 +171,6 @@ cogl_driver_sources += \
        driver/gl/cogl-pipeline-opengl-private.h \
        driver/gl/cogl-pipeline-fragend-glsl.c \
        driver/gl/cogl-pipeline-fragend-glsl-private.h \
-       driver/gl/gl/cogl-pipeline-fragend-arbfp.c \
-       driver/gl/gl/cogl-pipeline-fragend-arbfp-private.h \
        driver/gl/cogl-pipeline-vertend-glsl.c \
        driver/gl/cogl-pipeline-vertend-glsl-private.h \
        driver/gl/cogl-pipeline-progend-glsl.c \
diff --git a/cogl/cogl/cogl-context.c b/cogl/cogl/cogl-context.c
index 34f2dd90d..40a490e8f 100644
--- a/cogl/cogl/cogl-context.c
+++ b/cogl/cogl/cogl-context.c
@@ -63,10 +63,6 @@
 #include <string.h>
 #include <stdlib.h>
 
-#ifdef HAVE_COGL_GL
-#include "cogl-pipeline-fragend-arbfp-private.h"
-#endif
-
 /* These aren't defined in the GLES headers */
 #ifndef GL_POINT_SPRITE
 #define GL_POINT_SPRITE 0x8861
@@ -113,12 +109,6 @@ _cogl_init_feature_overrides (CoglContext *ctx)
   if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_PBOS)))
     COGL_FLAGS_SET (ctx->private_features, COGL_PRIVATE_FEATURE_PBOS, FALSE);
 
-  if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_ARBFP)))
-    {
-      ctx->feature_flags &= ~COGL_FEATURE_SHADERS_ARBFP;
-      COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_ARBFP, FALSE);
-    }
-
   if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_GLSL)))
     {
       ctx->feature_flags &= ~COGL_FEATURE_SHADERS_GLSL;
diff --git a/cogl/cogl/cogl-context.h b/cogl/cogl/cogl-context.h
index add575b49..649f4392b 100644
--- a/cogl/cogl/cogl-context.h
+++ b/cogl/cogl/cogl-context.h
@@ -201,7 +201,6 @@ cogl_is_context (void *object);
  * @COGL_FEATURE_ID_ONSCREEN_MULTIPLE: Multiple onscreen framebuffers
  *    supported.
  * @COGL_FEATURE_ID_GLSL: GLSL support
- * @COGL_FEATURE_ID_ARBFP: ARBFP support
  * @COGL_FEATURE_ID_UNSIGNED_INT_INDICES: Set if
  *     %COGL_INDICES_TYPE_UNSIGNED_INT is supported in
  *     cogl_indices_new().
@@ -244,7 +243,6 @@ typedef enum _CoglFeatureID
   COGL_FEATURE_ID_TEXTURE_RECTANGLE,
   COGL_FEATURE_ID_TEXTURE_3D,
   COGL_FEATURE_ID_GLSL,
-  COGL_FEATURE_ID_ARBFP,
   COGL_FEATURE_ID_OFFSCREEN,
   COGL_FEATURE_ID_OFFSCREEN_MULTISAMPLE,
   COGL_FEATURE_ID_ONSCREEN_MULTIPLE,
diff --git a/cogl/cogl/cogl-debug-options.h b/cogl/cogl/cogl-debug-options.h
index fab521c46..9e328d7e0 100644
--- a/cogl/cogl/cogl-debug-options.h
+++ b/cogl/cogl/cogl-debug-options.h
@@ -130,11 +130,6 @@ OPT (DISABLE_TEXTURING,
      "disable-texturing",
      N_("Disable texturing"),
      N_("Disable texturing any primitives"))
-OPT (DISABLE_ARBFP,
-     N_("Root Cause"),
-     "disable-arbfp",
-     N_("Disable arbfp"),
-     N_("Disable use of ARB fragment programs"))
 OPT (DISABLE_GLSL,
      N_("Root Cause"),
      "disable-glsl",
@@ -160,7 +155,7 @@ OPT (SHOW_SOURCE,
      N_("Cogl Tracing"),
      "show-source",
      N_("Show source"),
-     N_("Show generated ARBfp/GLSL source code"))
+     N_("Show generated GLSL source code"))
 OPT (OPENGL,
      N_("Cogl Tracing"),
      "opengl",
@@ -175,7 +170,7 @@ OPT (DISABLE_BLENDING,
      N_("Root Cause"),
      "disable-program-caches",
      N_("Disable program caches"),
-     N_("Disable fallback caches for arbfp and glsl programs"))
+     N_("Disable fallback caches for glsl programs"))
 OPT (DISABLE_FAST_READ_PIXEL,
      N_("Root Cause"),
      "disable-fast-read-pixel",
diff --git a/cogl/cogl/cogl-debug.c b/cogl/cogl/cogl-debug.c
index d81f8400f..dc2f9f9c6 100644
--- a/cogl/cogl/cogl-debug.c
+++ b/cogl/cogl/cogl-debug.c
@@ -79,7 +79,6 @@ static const GDebugKey cogl_behavioural_debug_keys[] = {
   { "disable-atlas", COGL_DEBUG_DISABLE_ATLAS },
   { "disable-shared-atlas", COGL_DEBUG_DISABLE_SHARED_ATLAS },
   { "disable-texturing", COGL_DEBUG_DISABLE_TEXTURING},
-  { "disable-arbfp", COGL_DEBUG_DISABLE_ARBFP},
   { "disable-glsl", COGL_DEBUG_DISABLE_GLSL},
   { "disable-blending", COGL_DEBUG_DISABLE_BLENDING},
   { "disable-npot-textures", COGL_DEBUG_DISABLE_NPOT_TEXTURES},
diff --git a/cogl/cogl/cogl-debug.h b/cogl/cogl/cogl-debug.h
index dd8fcafb0..7223be9b7 100644
--- a/cogl/cogl/cogl-debug.h
+++ b/cogl/cogl/cogl-debug.h
@@ -60,7 +60,6 @@ typedef enum {
   COGL_DEBUG_DISABLE_SHARED_ATLAS,
   COGL_DEBUG_OPENGL,
   COGL_DEBUG_DISABLE_TEXTURING,
-  COGL_DEBUG_DISABLE_ARBFP,
   COGL_DEBUG_DISABLE_GLSL,
   COGL_DEBUG_SHOW_SOURCE,
   COGL_DEBUG_DISABLE_BLENDING,
diff --git a/cogl/cogl/cogl-pipeline-private.h b/cogl/cogl/cogl-pipeline-private.h
index 21da80959..e0de0824b 100644
--- a/cogl/cogl/cogl-pipeline-private.h
+++ b/cogl/cogl/cogl-pipeline-private.h
@@ -49,21 +49,7 @@
 
 #include <glib.h>
 
-#ifdef HAVE_COGL_GL
-
-#define COGL_PIPELINE_PROGEND_GLSL        0
-#define COGL_PIPELINE_N_PROGENDS          1
-
-#define COGL_PIPELINE_VERTEND_GLSL  0
-#define COGL_PIPELINE_N_VERTENDS    1
-
-#define COGL_PIPELINE_FRAGEND_ARBFP 0
-#define COGL_PIPELINE_FRAGEND_GLSL  1
-#define COGL_PIPELINE_N_FRAGENDS    2
-
-#else /* HAVE_COGL_GL */
-
-#ifdef HAVE_COGL_GLES2
+#if defined(HAVE_COGL_GL) || defined(HAVE_COGL_GLES2)
 
 #define COGL_PIPELINE_PROGEND_GLSL 0
 #define COGL_PIPELINE_VERTEND_GLSL 0
@@ -73,13 +59,11 @@
 #define COGL_PIPELINE_N_VERTENDS    1
 #define COGL_PIPELINE_N_FRAGENDS    1
 
-#else /* HAVE_COGL_GLES2 */
+#else /* defined(HAVE_COGL_GL) || defined(HAVE_COGL_GLES2) */
 
 #error No drivers defined
 
-#endif /* HAVE_COGL_GLES2 */
-
-#endif /* HAVE_COGL_GL */
+#endif /* defined(HAVE_COGL_GL) || defined(HAVE_COGL_GLES2) */
 
 #define COGL_PIPELINE_PROGEND_DEFAULT    0
 #define COGL_PIPELINE_PROGEND_UNDEFINED  3
@@ -553,7 +537,6 @@ typedef struct
 typedef enum
 {
   COGL_PIPELINE_PROGRAM_TYPE_GLSL = 1,
-  COGL_PIPELINE_PROGRAM_TYPE_ARBFP,
 } CoglPipelineProgramType;
 
 extern const CoglPipelineFragend *
diff --git a/cogl/cogl/cogl-pipeline.c b/cogl/cogl/cogl-pipeline.c
index 211f28145..d18b9f52a 100644
--- a/cogl/cogl/cogl-pipeline.c
+++ b/cogl/cogl/cogl-pipeline.c
@@ -71,9 +71,6 @@ _cogl_pipeline_progends[MAX (COGL_PIPELINE_N_PROGENDS, 1)];
 #ifdef COGL_PIPELINE_FRAGEND_GLSL
 #include "cogl-pipeline-fragend-glsl-private.h"
 #endif
-#ifdef COGL_PIPELINE_FRAGEND_ARBFP
-#include "cogl-pipeline-fragend-arbfp-private.h"
-#endif
 
 #ifdef COGL_PIPELINE_VERTEND_GLSL
 #include "cogl-pipeline-vertend-glsl-private.h"
@@ -115,10 +112,6 @@ _cogl_pipeline_init_default_pipeline (void)
   _cogl_pipeline_fragends[COGL_PIPELINE_FRAGEND_GLSL] =
     &_cogl_pipeline_glsl_fragend;
 #endif
-#ifdef COGL_PIPELINE_FRAGEND_ARBFP
-  _cogl_pipeline_fragends[COGL_PIPELINE_FRAGEND_ARBFP] =
-    &_cogl_pipeline_arbfp_fragend;
-#endif
 #ifdef COGL_PIPELINE_PROGEND_GLSL
   _cogl_pipeline_progends[COGL_PIPELINE_PROGEND_GLSL] =
     &_cogl_pipeline_glsl_progend;
diff --git a/cogl/cogl/cogl-private.h b/cogl/cogl/cogl-private.h
index e5dc9feda..5d3eff328 100644
--- a/cogl/cogl/cogl-private.h
+++ b/cogl/cogl/cogl-private.h
@@ -62,7 +62,6 @@ typedef enum
   COGL_PRIVATE_FEATURE_ALPHA_TEXTURES,
   COGL_PRIVATE_FEATURE_TEXTURE_SWIZZLE,
   COGL_PRIVATE_FEATURE_TEXTURE_MAX_LEVEL,
-  COGL_PRIVATE_FEATURE_ARBFP,
   COGL_PRIVATE_FEATURE_OES_EGL_SYNC,
   /* If this is set then the winsys is responsible for queueing dirty
    * events. Otherwise a dirty event will be queued when the onscreen
diff --git a/cogl/cogl/cogl-renderer.c b/cogl/cogl/cogl-renderer.c
index 042110c45..bee7bdb72 100644
--- a/cogl/cogl/cogl-renderer.c
+++ b/cogl/cogl/cogl-renderer.c
@@ -787,8 +787,7 @@ cogl_renderer_get_n_fragment_texture_units (CoglRenderer *renderer)
   _COGL_GET_CONTEXT (ctx, 0);
 
 #if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES2)
-  if (cogl_has_feature (ctx, COGL_FEATURE_ID_GLSL) ||
-      cogl_has_feature (ctx, COGL_FEATURE_ID_ARBFP))
+  if (cogl_has_feature (ctx, COGL_FEATURE_ID_GLSL))
     GE (ctx, glGetIntegerv (GL_MAX_TEXTURE_IMAGE_UNITS, &n));
 #endif
 
diff --git a/cogl/cogl/cogl-types.h b/cogl/cogl/cogl-types.h
index f67895dd9..b351cfd2d 100644
--- a/cogl/cogl/cogl-types.h
+++ b/cogl/cogl/cogl-types.h
@@ -366,7 +366,6 @@ typedef enum { /*< prefix=COGL_PIXEL_FORMAT >*/
  * @COGL_FEATURE_TEXTURE_YUV: ycbcr conversion support
  * @COGL_FEATURE_TEXTURE_READ_PIXELS: glReadPixels() support
  * @COGL_FEATURE_SHADERS_GLSL: GLSL support
- * @COGL_FEATURE_SHADERS_ARBFP: ARBFP support
  * @COGL_FEATURE_OFFSCREEN: FBO support
  * @COGL_FEATURE_OFFSCREEN_MULTISAMPLE: Multisample support on FBOs
  * @COGL_FEATURE_OFFSCREEN_BLIT: Blit support on FBOs
@@ -424,7 +423,6 @@ typedef enum
   COGL_FEATURE_TEXTURE_NPOT_REPEAT    = (1 << 17),
   COGL_FEATURE_POINT_SPRITE           = (1 << 18),
   COGL_FEATURE_TEXTURE_3D             = (1 << 19),
-  COGL_FEATURE_SHADERS_ARBFP          = (1 << 20),
   COGL_FEATURE_MAP_BUFFER_FOR_READ    = (1 << 21),
   COGL_FEATURE_MAP_BUFFER_FOR_WRITE   = (1 << 22),
   COGL_FEATURE_ONSCREEN_MULTIPLE      = (1 << 23),
diff --git a/cogl/cogl/deprecated/cogl-program.c b/cogl/cogl/deprecated/cogl-program.c
index 7115a6749..f44d72561 100644
--- a/cogl/cogl/deprecated/cogl-program.c
+++ b/cogl/cogl/deprecated/cogl-program.c
@@ -112,10 +112,7 @@ cogl_program_attach_shader (CoglHandle program_handle,
   program = program_handle;
   shader = shader_handle;
 
-  /* Only one shader is allowed if the type is ARBfp */
-  if (shader->language == COGL_SHADER_LANGUAGE_ARBFP)
-    _COGL_RETURN_IF_FAIL (program->attached_shaders == NULL);
-  else if (shader->language == COGL_SHADER_LANGUAGE_GLSL)
+  if (shader->language == COGL_SHADER_LANGUAGE_GLSL)
     _COGL_RETURN_IF_FAIL (_cogl_program_get_language (program) ==
                       COGL_SHADER_LANGUAGE_GLSL);
 
@@ -346,59 +343,6 @@ cogl_program_uniform_matrix (int uniform_no,
   _cogl_boxed_value_set_matrix (&uniform->value, size, count, transpose, value);
 }
 
-/* ARBfp local parameters can be referenced like:
- *
- * "program.local[5]"
- *                ^14char offset (after whitespace is stripped)
- */
-static int
-get_local_param_index (const char *uniform_name)
-{
-  char *input = g_strdup (uniform_name);
-  int i;
-  char *p = input;
-  char *endptr;
-  int _index;
-
-  for (i = 0; input[i] != '\0'; i++)
-    if (input[i] != '_' && input[i] != '\t')
-      *p++ = input[i];
-  input[i] = '\0';
-
-  _COGL_RETURN_VAL_IF_FAIL (strncmp ("program.local[", input, 14) == 0, -1);
-
-  _index = g_ascii_strtoull (input + 14, &endptr, 10);
-  _COGL_RETURN_VAL_IF_FAIL (endptr != input + 14, -1);
-  _COGL_RETURN_VAL_IF_FAIL (*endptr == ']', -1);
-
-  _COGL_RETURN_VAL_IF_FAIL (_index >= 0, -1);
-
-  g_free (input);
-
-  return _index;
-}
-
-#ifdef HAVE_COGL_GL
-
-static void
-_cogl_program_flush_uniform_arbfp (GLint location,
-                                   CoglBoxedValue *value)
-{
-  _COGL_GET_CONTEXT (ctx, NO_RETVAL);
-
-  if (value->type != COGL_BOXED_NONE)
-    {
-      _COGL_RETURN_IF_FAIL (value->type == COGL_BOXED_FLOAT);
-      _COGL_RETURN_IF_FAIL (value->size == 4);
-      _COGL_RETURN_IF_FAIL (value->count == 1);
-
-      GE( ctx, glProgramLocalParameter4fv (GL_FRAGMENT_PROGRAM_ARB, location,
-                                           value->v.float_value) );
-    }
-}
-
-#endif /* HAVE_COGL_GL */
-
 void
 _cogl_program_flush_uniforms (CoglProgram *program,
                               GLuint gl_program,
@@ -422,9 +366,6 @@ _cogl_program_flush_uniforms (CoglProgram *program,
                   COGL_SHADER_LANGUAGE_GLSL)
                 uniform->location =
                   ctx->glGetUniformLocation (gl_program, uniform->name);
-              else
-                uniform->location =
-                  get_local_param_index (uniform->name);
 
               uniform->location_valid = TRUE;
             }
@@ -440,13 +381,6 @@ _cogl_program_flush_uniforms (CoglProgram *program,
                                                  uniform->location,
                                                  &uniform->value);
                   break;
-
-                case COGL_SHADER_LANGUAGE_ARBFP:
-#ifdef HAVE_COGL_GL
-                  _cogl_program_flush_uniform_arbfp (uniform->location,
-                                                     &uniform->value);
-#endif
-                  break;
                 }
             }
 
diff --git a/cogl/cogl/deprecated/cogl-shader-private.h b/cogl/cogl/deprecated/cogl-shader-private.h
index dcc16b924..5651c0ac8 100644
--- a/cogl/cogl/deprecated/cogl-shader-private.h
+++ b/cogl/cogl/deprecated/cogl-shader-private.h
@@ -41,7 +41,6 @@ typedef struct _CoglShader CoglShader;
 typedef enum
 {
   COGL_SHADER_LANGUAGE_GLSL,
-  COGL_SHADER_LANGUAGE_ARBFP
 } CoglShaderLanguage;
 
 struct _CoglShader
diff --git a/cogl/cogl/deprecated/cogl-shader.c b/cogl/cogl/deprecated/cogl-shader.c
index 4a2af043c..e4497a70d 100644
--- a/cogl/cogl/deprecated/cogl-shader.c
+++ b/cogl/cogl/deprecated/cogl-shader.c
@@ -62,14 +62,6 @@ _cogl_shader_free (CoglShader *shader)
      released! Do that separately before this! */
   _COGL_GET_CONTEXT (ctx, NO_RETVAL);
 
-#ifdef HAVE_COGL_GL
-  if (shader->language == COGL_SHADER_LANGUAGE_ARBFP)
-    {
-      if (shader->gl_handle)
-        GE (ctx, glDeletePrograms (1, &shader->gl_handle));
-    }
-  else
-#endif
     if (shader->gl_handle)
       GE (ctx, glDeleteShader (shader->gl_handle));
 
@@ -108,18 +100,8 @@ delete_shader (CoglShader *shader)
 {
   _COGL_GET_CONTEXT (ctx, NO_RETVAL);
 
-#ifdef HAVE_COGL_GL
-  if (shader->language == COGL_SHADER_LANGUAGE_ARBFP)
-    {
-      if (shader->gl_handle)
-        GE (ctx, glDeletePrograms (1, &shader->gl_handle));
-    }
-  else
-#endif
-    {
-      if (shader->gl_handle)
-        GE (ctx, glDeleteShader (shader->gl_handle));
-    }
+  if (shader->gl_handle)
+    GE (ctx, glDeleteShader (shader->gl_handle));
 
   shader->gl_handle = 0;
 
@@ -143,13 +125,7 @@ cogl_shader_source (CoglHandle   handle,
     return;
 
   shader = handle;
-
-#ifdef HAVE_COGL_GL
-  if (strncmp (source, "!!ARBfp1.0", 10) == 0)
-    language = COGL_SHADER_LANGUAGE_ARBFP;
-  else
-#endif
-    language = COGL_SHADER_LANGUAGE_GLSL;
+  language = COGL_SHADER_LANGUAGE_GLSL;
 
   /* Delete the old object if the language is changing... */
   if (G_UNLIKELY (language != shader->language) &&
@@ -164,19 +140,6 @@ cogl_shader_source (CoglHandle   handle,
 void
 cogl_shader_compile (CoglHandle handle)
 {
-  CoglShader *shader;
-
-  _COGL_GET_CONTEXT (ctx, NO_RETVAL);
-
-  if (!cogl_is_shader (handle))
-    return;
-
-#ifdef HAVE_COGL_GL
-  shader = handle;
-  if (shader->language == COGL_SHADER_LANGUAGE_ARBFP)
-    _cogl_shader_compile_real (handle, NULL);
-#endif
-
   /* XXX: For GLSL we don't actually compile anything until the shader
    * gets used so we have an opportunity to add some boilerplate to
    * the shader.
@@ -192,110 +155,69 @@ _cogl_shader_compile_real (CoglHandle handle,
                            CoglPipeline *pipeline)
 {
   CoglShader *shader = handle;
+  GLenum gl_type;
+  GLint status;
 
   _COGL_GET_CONTEXT (ctx, NO_RETVAL);
 
-#ifdef HAVE_COGL_GL
-  if (shader->language == COGL_SHADER_LANGUAGE_ARBFP)
+  if (shader->gl_handle)
     {
-#ifdef COGL_GL_DEBUG
-      GLenum gl_error;
-#endif
-
-      if (shader->gl_handle)
+      CoglPipeline *prev = shader->compilation_pipeline;
+
+      /* XXX: currently the only things that will affect the
+       * boilerplate for user shaders, apart from driver features,
+       * are the pipeline layer-indices and texture-unit-indices
+       */
+      if (pipeline == prev ||
+          _cogl_pipeline_layer_and_unit_numbers_equal (prev, pipeline))
         return;
+    }
+
+  if (shader->gl_handle)
+    delete_shader (shader);
+
+  switch (shader->type)
+    {
+    case COGL_SHADER_TYPE_VERTEX:
+      gl_type = GL_VERTEX_SHADER;
+      break;
+    case COGL_SHADER_TYPE_FRAGMENT:
+      gl_type = GL_FRAGMENT_SHADER;
+      break;
+    default:
+      g_assert_not_reached ();
+      break;
+    }
 
-      GE (ctx, glGenPrograms (1, &shader->gl_handle));
+  shader->gl_handle = ctx->glCreateShader (gl_type);
 
-      GE (ctx, glBindProgram (GL_FRAGMENT_PROGRAM_ARB, shader->gl_handle));
+  _cogl_glsl_shader_set_source_with_boilerplate (ctx,
+                                                 shader->gl_handle,
+                                                 gl_type,
+                                                 pipeline,
+                                                 1,
+                                                 (const char **)
+                                                  &shader->source,
+                                                 NULL);
 
-      if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_SHOW_SOURCE)))
-        g_message ("user ARBfp program:\n%s", shader->source);
+  GE (ctx, glCompileShader (shader->gl_handle));
 
-#ifdef COGL_GL_DEBUG
-      _cogl_gl_util_clear_gl_errors (ctx);
-#endif
-      ctx->glProgramString (GL_FRAGMENT_PROGRAM_ARB,
-                            GL_PROGRAM_FORMAT_ASCII_ARB,
-                            strlen (shader->source),
-                            shader->source);
-#ifdef COGL_GL_DEBUG
-      gl_error = _cogl_gl_util_get_error (ctx);
-      if (gl_error != GL_NO_ERROR)
-        {
-          g_warning ("%s: GL error (%d): Failed to compile ARBfp:\n%s\n%s",
-                     G_STRLOC,
-                     gl_error,
-                     shader->source,
-                     ctx->glGetString (GL_PROGRAM_ERROR_STRING_ARB));
-        }
-#endif
-    }
-  else
-#endif
+  shader->compilation_pipeline = cogl_object_ref (pipeline);
+
+  GE (ctx, glGetShaderiv (shader->gl_handle, GL_COMPILE_STATUS, &status));
+  if (!status)
     {
-      GLenum gl_type;
-      GLint status;
-
-      if (shader->gl_handle)
-        {
-          CoglPipeline *prev = shader->compilation_pipeline;
-
-          /* XXX: currently the only things that will affect the
-           * boilerplate for user shaders, apart from driver features,
-           * are the pipeline layer-indices and texture-unit-indices
-           */
-          if (pipeline == prev ||
-              _cogl_pipeline_layer_and_unit_numbers_equal (prev, pipeline))
-            return;
-        }
-
-      if (shader->gl_handle)
-        delete_shader (shader);
-
-      switch (shader->type)
-        {
-        case COGL_SHADER_TYPE_VERTEX:
-          gl_type = GL_VERTEX_SHADER;
-          break;
-        case COGL_SHADER_TYPE_FRAGMENT:
-          gl_type = GL_FRAGMENT_SHADER;
-          break;
-        default:
-          g_assert_not_reached ();
-          break;
-        }
-
-      shader->gl_handle = ctx->glCreateShader (gl_type);
-
-      _cogl_glsl_shader_set_source_with_boilerplate (ctx,
-                                                     shader->gl_handle,
-                                                     gl_type,
-                                                     pipeline,
-                                                     1,
-                                                     (const char **)
-                                                      &shader->source,
-                                                     NULL);
-
-      GE (ctx, glCompileShader (shader->gl_handle));
-
-      shader->compilation_pipeline = cogl_object_ref (pipeline);
-
-      GE (ctx, glGetShaderiv (shader->gl_handle, GL_COMPILE_STATUS, &status));
-      if (!status)
-        {
-          char buffer[512];
-          int len = 0;
-
-          ctx->glGetShaderInfoLog (shader->gl_handle, 511, &len, buffer);
-          buffer[len] = '\0';
-
-          g_warning ("Failed to compile GLSL program:\n"
-                     "src:\n%s\n"
-                     "error:\n%s\n",
-                     shader->source,
-                     buffer);
-        }
+      char buffer[512];
+      int len = 0;
+
+      ctx->glGetShaderInfoLog (shader->gl_handle, 511, &len, buffer);
+      buffer[len] = '\0';
+
+      g_warning ("Failed to compile GLSL program:\n"
+                 "src:\n%s\n"
+                 "error:\n%s\n",
+                 shader->source,
+                 buffer);
     }
 }
 
diff --git a/cogl/cogl/driver/gl/cogl-pipeline-opengl.c b/cogl/cogl/driver/gl/cogl-pipeline-opengl.c
index 13e61c06f..f15706813 100644
--- a/cogl/cogl/driver/gl/cogl-pipeline-opengl.c
+++ b/cogl/cogl/driver/gl/cogl-pipeline-opengl.c
@@ -283,23 +283,11 @@ _cogl_use_fragment_program (GLuint gl_program, CoglPipelineProgramType type)
               COGL_PIPELINE_PROGRAM_TYPE_GLSL)
             set_glsl_program (0);
           break;
-
-        case COGL_PIPELINE_PROGRAM_TYPE_ARBFP:
-#ifdef HAVE_COGL_GL
-          GE( ctx, glDisable (GL_FRAGMENT_PROGRAM_ARB) );
-#endif
-          break;
         }
 
       /* ... and enable the new type */
       switch (type)
         {
-        case COGL_PIPELINE_PROGRAM_TYPE_ARBFP:
-#ifdef HAVE_COGL_GL
-          GE( ctx, glEnable (GL_FRAGMENT_PROGRAM_ARB) );
-#endif
-          break;
-
         case COGL_PIPELINE_PROGRAM_TYPE_GLSL:
           /* don't need to to anything */
           break;
@@ -317,10 +305,6 @@ _cogl_use_fragment_program (GLuint gl_program, CoglPipelineProgramType type)
 
 #endif /* COGL_PIPELINE_FRAGEND_GLSL */
     }
-#ifndef COGL_PIPELINE_FRAGEND_ARBFP
-  else if (type == COGL_PIPELINE_PROGRAM_TYPE_ARBFP)
-    g_warning ("Unexpected use of ARBFP fragend!");
-#endif /* COGL_PIPELINE_FRAGEND_ARBFP */
 
   ctx->current_fragment_program_type = type;
 }
@@ -343,21 +327,11 @@ _cogl_use_vertex_program (GLuint gl_program, CoglPipelineProgramType type)
               COGL_PIPELINE_PROGRAM_TYPE_GLSL)
             set_glsl_program (0);
           break;
-
-        case COGL_PIPELINE_PROGRAM_TYPE_ARBFP:
-          /* It doesn't make sense to enable ARBfp for the vertex program */
-          g_assert_not_reached ();
-          break;
         }
 
       /* ... and enable the new type */
       switch (type)
         {
-        case COGL_PIPELINE_PROGRAM_TYPE_ARBFP:
-          /* It doesn't make sense to enable ARBfp for the vertex program */
-          g_assert_not_reached ();
-          break;
-
         case COGL_PIPELINE_PROGRAM_TYPE_GLSL:
           /* don't need to to anything */
           break;
@@ -375,10 +349,6 @@ _cogl_use_vertex_program (GLuint gl_program, CoglPipelineProgramType type)
 
 #endif /* COGL_PIPELINE_VERTEND_GLSL */
     }
-#ifndef COGL_PIPELINE_VERTEND_ARBFP
-  else if (type == COGL_PIPELINE_PROGRAM_TYPE_ARBFP)
-    g_warning ("Unexpected use of ARBFP vertend!");
-#endif /* COGL_PIPELINE_VERTEND_ARBFP */
 
   ctx->current_vertex_program_type = type;
 }
@@ -720,8 +690,7 @@ get_max_activateable_texture_units (void)
              defines the number of texture coordinates that can be
              uploaded (but doesn't necessarily relate to how many texture
              images can be sampled) */
-          if (cogl_has_feature (ctx, COGL_FEATURE_ID_GLSL) ||
-              cogl_has_feature (ctx, COGL_FEATURE_ID_ARBFP))
+          if (cogl_has_feature (ctx, COGL_FEATURE_ID_GLSL))
             /* Previously this code subtracted the value by one but there
                was no explanation for why it did this and it doesn't seem
                to make sense so it has been removed */
diff --git a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c
index 178262ac0..b46a7a8a2 100644
--- a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c
+++ b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c
@@ -518,12 +518,6 @@ _cogl_driver_update_features (CoglContext *ctx,
     COGL_FLAGS_SET (private_features,
                     COGL_PRIVATE_FEATURE_BLEND_CONSTANT, TRUE);
 
-  if (ctx->glGenPrograms)
-    {
-      flags |= COGL_FEATURE_SHADERS_ARBFP;
-      COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_ARBFP, TRUE);
-    }
-
   if (ctx->glCreateProgram)
     {
       flags |= COGL_FEATURE_SHADERS_GLSL;
diff --git a/cogl/cogl/gl-prototypes/cogl-all-functions.h b/cogl/cogl/gl-prototypes/cogl-all-functions.h
index 0e71ae81f..924ee349d 100644
--- a/cogl/cogl/gl-prototypes/cogl-all-functions.h
+++ b/cogl/cogl/gl-prototypes/cogl-all-functions.h
@@ -148,31 +148,6 @@ COGL_EXT_FUNCTION (void, glBlitFramebuffer,
                     GLenum                filter))
 COGL_EXT_END ()
 
-/* ARB_fragment_program */
-COGL_EXT_BEGIN (arbfp, 255, 255,
-                0, /* not in either GLES */
-                "ARB\0",
-                "fragment_program\0")
-COGL_EXT_FUNCTION (void, glGenPrograms,
-                   (GLsizei               n,
-                    GLuint               *programs))
-COGL_EXT_FUNCTION (void, glDeletePrograms,
-                   (GLsizei               n,
-                    GLuint               *programs))
-COGL_EXT_FUNCTION (void, glBindProgram,
-                   (GLenum                target,
-                    GLuint                program))
-COGL_EXT_FUNCTION (void, glProgramString,
-                   (GLenum                target,
-                    GLenum                format,
-                    GLsizei               len,
-                    const void           *program))
-COGL_EXT_FUNCTION (void, glProgramLocalParameter4fv,
-                   (GLenum                target,
-                    GLuint                index,
-                    GLfloat              *params))
-COGL_EXT_END ()
-
 COGL_EXT_BEGIN (EGL_image, 255, 255,
                 0, /* not in either GLES */
                 "OES\0",
diff --git a/cogl/tests/run-tests.sh b/cogl/tests/run-tests.sh
index 9c9b609d6..1e15fdd0c 100755
--- a/cogl/tests/run-tests.sh
+++ b/cogl/tests/run-tests.sh
@@ -88,7 +88,7 @@ printf $TITLE_FORMAT "Test"
 
 if test $HAVE_GL -eq 1; then
   GL_FORMAT=" %6s %8s %7s %6s %6s"
-  printf "$GL_FORMAT" GL+ARBFP" "GL+GLSL" "GL-NPT" "GL3"
+  printf "$GL_FORMAT" "GL+GLSL" "GL-NPT" "GL3"
 fi
 if test $HAVE_GLES2 -eq 1; then
   GLES2_FORMAT=" %6s %7s"
@@ -136,7 +136,6 @@ do
   printf $TITLE_FORMAT "$test:"
   if test $HAVE_GL -eq 1; then
     printf "$GL_FORMAT" \
-      "`get_status $gl_arbfp_result`" \
       "`get_status $gl_glsl_result`" \
       "`get_status $gl_npot_result`" \
       "`get_status $gl3_result`"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]