[cogl/wip/rig: 18/33] Remove ARBfp support



commit 7475ef62fd5bdfcf484144434837f6f2ffc71a2f
Author: Robert Bragg <robert bragg intel com>
Date:   Wed Mar 19 00:49:15 2014 +0000

    Remove ARBfp support
    
    For simplicity we would like to only support GLSL based progends even
    though it's still quite possible that the ARBfp backend may be slightly
    faster in some cases.

 cogl/Makefile.sources                              |    4 -
 cogl/cogl-blit.c                                   |    2 +-
 cogl/cogl-context.c                                |    7 -
 cogl/cogl-debug-options.h                          |    9 +-
 cogl/cogl-debug.c                                  |    1 -
 cogl/cogl-debug.h                                  |    1 -
 cogl/cogl-pipeline-private.h                       |   20 +-
 cogl/cogl-pipeline.c                               |   14 -
 cogl/cogl-private.h                                |    1 -
 cogl/driver/gl/cogl-pipeline-opengl.c              |   68 +-
 cogl/driver/gl/gl/cogl-driver-gl.c                 |    3 -
 .../gl/gl/cogl-pipeline-fragend-arbfp-private.h    |   42 -
 cogl/driver/gl/gl/cogl-pipeline-fragend-arbfp.c    |  950 --------------------
 .../gl/cogl-pipeline-progend-fixed-arbfp-private.h |   42 -
 .../gl/gl/cogl-pipeline-progend-fixed-arbfp.c      |  113 ---
 cogl/gl-prototypes/cogl-all-functions.h            |   25 -
 tests/run-tests.sh                                 |   14 +-
 17 files changed, 36 insertions(+), 1280 deletions(-)
---
diff --git a/cogl/Makefile.sources b/cogl/Makefile.sources
index 8188805..7855c41 100644
--- a/cogl/Makefile.sources
+++ b/cogl/Makefile.sources
@@ -88,10 +88,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/gl/cogl-pipeline-progend-fixed-arbfp.c \
-       driver/gl/gl/cogl-pipeline-progend-fixed-arbfp-private.h \
        driver/gl/cogl-pipeline-fragend-fixed.c \
        driver/gl/cogl-pipeline-fragend-fixed-private.h \
        driver/gl/cogl-pipeline-vertend-glsl.c \
diff --git a/cogl/cogl-blit.c b/cogl/cogl-blit.c
index 248120e..580fc91 100644
--- a/cogl/cogl-blit.c
+++ b/cogl/cogl-blit.c
@@ -138,7 +138,7 @@ _cogl_blit_texture_render_end (CoglBlitData *data)
      atlas code. It may be better in future to keep around a set of
      dummy 1x1 textures for each texture target that we could bind
      instead. This would also be useful when using a pipeline as a
-     hash table key such as for the ARBfp program cache. */
+     hash table key such as for the GLSL program cache. */
   cogl_pipeline_set_layer_texture (ctx->blit_texture_pipeline, 0,
                                    data->dst_tex);
 
diff --git a/cogl/cogl-context.c b/cogl/cogl-context.c
index e85a6c0..550cc4b 100644
--- a/cogl/cogl-context.c
+++ b/cogl/cogl-context.c
@@ -59,10 +59,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
@@ -90,9 +86,6 @@ _cogl_init_feature_overrides (CoglContext *ctx)
   if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_PBOS)))
     COGL_FLAGS_SET (ctx->private_features, COGL_PRIVATE_FEATURE_PBOS, FALSE);
 
-  if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_ARBFP)))
-    COGL_FLAGS_SET (ctx->private_features, COGL_PRIVATE_FEATURE_ARBFP, FALSE);
-
   if (U_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_GLSL)))
     {
       COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_GLSL, FALSE);
diff --git a/cogl/cogl-debug-options.h b/cogl/cogl-debug-options.h
index 02734f6..d04654f 100644
--- a/cogl/cogl-debug-options.h
+++ b/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_FIXED,
      N_("Root Cause"),
      "disable-fixed",
@@ -165,7 +160,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",
@@ -180,7 +175,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-debug.c b/cogl/cogl-debug.c
index 6ea5d5e..3e10305 100644
--- a/cogl/cogl-debug.c
+++ b/cogl/cogl-debug.c
@@ -78,7 +78,6 @@ static const UDebugKey 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-fixed", COGL_DEBUG_DISABLE_FIXED},
   { "disable-glsl", COGL_DEBUG_DISABLE_GLSL},
   { "disable-blending", COGL_DEBUG_DISABLE_BLENDING},
diff --git a/cogl/cogl-debug.h b/cogl/cogl-debug.h
index 742ac8f..0b86c19 100644
--- a/cogl/cogl-debug.h
+++ b/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_FIXED,
   COGL_DEBUG_DISABLE_GLSL,
   COGL_DEBUG_SHOW_SOURCE,
diff --git a/cogl/cogl-pipeline-private.h b/cogl/cogl-pipeline-private.h
index 189b00d..c6d8094 100644
--- a/cogl/cogl-pipeline-private.h
+++ b/cogl/cogl-pipeline-private.h
@@ -51,19 +51,17 @@
 
 #ifdef HAVE_COGL_GL
 
-#define COGL_PIPELINE_PROGEND_FIXED_ARBFP 0
-#define COGL_PIPELINE_PROGEND_FIXED       1
-#define COGL_PIPELINE_PROGEND_GLSL        2
-#define COGL_PIPELINE_N_PROGENDS          3
+#define COGL_PIPELINE_PROGEND_FIXED       0
+#define COGL_PIPELINE_PROGEND_GLSL        1
+#define COGL_PIPELINE_N_PROGENDS          2
 
 #define COGL_PIPELINE_VERTEND_FIXED 0
 #define COGL_PIPELINE_VERTEND_GLSL  1
 #define COGL_PIPELINE_N_VERTENDS    2
 
-#define COGL_PIPELINE_FRAGEND_ARBFP 0
-#define COGL_PIPELINE_FRAGEND_FIXED 1
-#define COGL_PIPELINE_FRAGEND_GLSL  2
-#define COGL_PIPELINE_N_FRAGENDS    3
+#define COGL_PIPELINE_FRAGEND_FIXED 0
+#define COGL_PIPELINE_FRAGEND_GLSL  1
+#define COGL_PIPELINE_N_FRAGENDS    2
 
 #else /* HAVE_COGL_GL */
 
@@ -435,9 +433,8 @@ struct _CoglPipeline
 #endif
 
   /* There are multiple fragment and vertex processing backends for
-   * CoglPipeline, glsl, arbfp and fixed that are bundled under a
-   * "progend". This identifies the backend being used for the
-   * pipeline. */
+   * CoglPipeline that are bundled under a "progend". This identifies
+   * the backend being used for the pipeline. */
   unsigned int          progend:3;
 };
 
@@ -504,7 +501,6 @@ typedef struct
 typedef enum
 {
   COGL_PIPELINE_PROGRAM_TYPE_GLSL = 1,
-  COGL_PIPELINE_PROGRAM_TYPE_ARBFP,
   COGL_PIPELINE_PROGRAM_TYPE_FIXED
 } CoglPipelineProgramType;
 
diff --git a/cogl/cogl-pipeline.c b/cogl/cogl-pipeline.c
index b4b3f21..96b74e4 100644
--- a/cogl/cogl-pipeline.c
+++ b/cogl/cogl-pipeline.c
@@ -69,9 +69,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_FRAGEND_FIXED
 #include "cogl-pipeline-fragend-fixed-private.h"
 #endif
@@ -83,9 +80,6 @@ _cogl_pipeline_progends[MAX (COGL_PIPELINE_N_PROGENDS, 1)];
 #include "cogl-pipeline-vertend-fixed-private.h"
 #endif
 
-#ifdef COGL_PIPELINE_PROGEND_FIXED_ARBFP
-#include "cogl-pipeline-progend-fixed-arbfp-private.h"
-#endif
 #ifdef COGL_PIPELINE_PROGEND_FIXED
 #include "cogl-pipeline-progend-fixed-private.h"
 #endif
@@ -123,19 +117,11 @@ _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_FRAGEND_FIXED
   _cogl_pipeline_fragends[COGL_PIPELINE_FRAGEND_FIXED] =
     &_cogl_pipeline_fixed_fragend;
 #endif
 #ifdef COGL_PIPELINE_PROGEND_FIXED
-  _cogl_pipeline_progends[COGL_PIPELINE_PROGEND_FIXED_ARBFP] =
-    &_cogl_pipeline_fixed_arbfp_progend;
-#endif
-#ifdef COGL_PIPELINE_PROGEND_FIXED
   _cogl_pipeline_progends[COGL_PIPELINE_PROGEND_FIXED] =
     &_cogl_pipeline_fixed_progend;
 #endif
diff --git a/cogl/cogl-private.h b/cogl/cogl-private.h
index ab3d9f3..85a1b8b 100644
--- a/cogl/cogl-private.h
+++ b/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/driver/gl/cogl-pipeline-opengl.c b/cogl/driver/gl/cogl-pipeline-opengl.c
index 460df55..81260fb 100644
--- a/cogl/driver/gl/cogl-pipeline-opengl.c
+++ b/cogl/driver/gl/cogl-pipeline-opengl.c
@@ -287,12 +287,6 @@ _cogl_use_fragment_program (GLuint gl_program, CoglPipelineProgramType type)
             set_glsl_program (0);
           break;
 
-        case COGL_PIPELINE_PROGRAM_TYPE_ARBFP:
-#ifdef HAVE_COGL_GL
-          GE( ctx, glDisable (GL_FRAGMENT_PROGRAM_ARB) );
-#endif
-          break;
-
         case COGL_PIPELINE_PROGRAM_TYPE_FIXED:
           /* don't need to to anything */
           break;
@@ -301,12 +295,6 @@ _cogl_use_fragment_program (GLuint gl_program, CoglPipelineProgramType type)
       /* ... 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:
         case COGL_PIPELINE_PROGRAM_TYPE_FIXED:
           /* don't need to to anything */
@@ -325,10 +313,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)
-    u_warning ("Unexpected use of ARBFP fragend!");
-#endif /* COGL_PIPELINE_FRAGEND_ARBFP */
 
   ctx->current_fragment_program_type = type;
 }
@@ -352,11 +336,6 @@ _cogl_use_vertex_program (GLuint gl_program, CoglPipelineProgramType type)
             set_glsl_program (0);
           break;
 
-        case COGL_PIPELINE_PROGRAM_TYPE_ARBFP:
-          /* It doesn't make sense to enable ARBfp for the vertex program */
-          u_assert_not_reached ();
-          break;
-
         case COGL_PIPELINE_PROGRAM_TYPE_FIXED:
           /* don't need to to anything */
           break;
@@ -365,11 +344,6 @@ _cogl_use_vertex_program (GLuint gl_program, CoglPipelineProgramType type)
       /* ... 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 */
-          u_assert_not_reached ();
-          break;
-
         case COGL_PIPELINE_PROGRAM_TYPE_GLSL:
         case COGL_PIPELINE_PROGRAM_TYPE_FIXED:
           /* don't need to to anything */
@@ -388,10 +362,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)
-    u_warning ("Unexpected use of ARBFP vertend!");
-#endif /* COGL_PIPELINE_VERTEND_ARBFP */
 
   ctx->current_vertex_program_type = type;
 }
@@ -704,23 +674,22 @@ get_max_activateable_texture_units (void)
 #ifdef HAVE_COGL_GL
       if (!_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_EMBEDDED))
         {
-          /* GL_MAX_TEXTURE_COORDS is provided for both GLSL and ARBfp. It
-             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_private_feature (ctx, COGL_PRIVATE_FEATURE_ARBFP))
-            /* 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 */
-            GE (ctx, glGetIntegerv (GL_MAX_TEXTURE_COORDS,
-                                    values + n_values++));
-
-          /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS is defined for GLSL but
-             not ARBfp */
+          /* GL_MAX_TEXTURE_COORDS is provided for GLSL. It 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))
-            GE (ctx, glGetIntegerv (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,
-                                    values + n_values++));
+            {
+              /* 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 */
+              GE (ctx, glGetIntegerv (GL_MAX_TEXTURE_COORDS,
+                                      values + n_values++));
+
+              /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS is defined for GLSL */
+              GE (ctx, glGetIntegerv (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,
+                                      values + n_values++));
+            }
         }
 #endif /* HAVE_COGL_GL */
 
@@ -1375,6 +1344,13 @@ _cogl_pipeline_flush_gl_state (CoglContext *ctx,
       break;
     }
 
+#ifdef COGL_ENABLE_DEBUG
+  /* XXX: Since the GLSL progend should be able to handle all features
+   * we should only hit this case if glsl was disabled for debugging
+   * and we tried to flush a pipeline that requires GLSL. */
+  g_assert (i != COGL_PIPELINE_N_PROGENDS);
+#endif
+
   /* FIXME: This reference is actually resulting in lots of
    * copy-on-write reparenting because one-shot pipelines end up
    * living for longer than necessary and so any later modification of
diff --git a/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/driver/gl/gl/cogl-driver-gl.c
index 355ccea..3ec109b 100644
--- a/cogl/driver/gl/gl/cogl-driver-gl.c
+++ b/cogl/driver/gl/gl/cogl-driver-gl.c
@@ -498,9 +498,6 @@ _cogl_driver_update_features (CoglContext *ctx,
     COGL_FLAGS_SET (private_features,
                     COGL_PRIVATE_FEATURE_BLEND_CONSTANT, TRUE);
 
-  if (ctx->glGenPrograms)
-    COGL_FLAGS_SET (private_features, COGL_PRIVATE_FEATURE_ARBFP, TRUE);
-
   if (ctx->glCreateProgram)
     COGL_FLAGS_SET (ctx->features, COGL_FEATURE_ID_GLSL, TRUE);
   else
diff --git a/cogl/gl-prototypes/cogl-all-functions.h b/cogl/gl-prototypes/cogl-all-functions.h
index 8a6d055..a206238 100644
--- a/cogl/gl-prototypes/cogl-all-functions.h
+++ b/cogl/gl-prototypes/cogl-all-functions.h
@@ -145,31 +145,6 @@ COGL_EXT_FUNCTION (void, glBlitFramebuffer,
                     GLenum                filter))
 COGL_EXT_END ()
 
-/* ARB_fragment_program */
-COGL_EXT_BEGIN (arbfp, 255, 255,
-                0, /* not in 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 GLES */
                 "OES\0",
diff --git a/tests/run-tests.sh b/tests/run-tests.sh
index 7e62bf0..180de35 100755
--- a/tests/run-tests.sh
+++ b/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+FF" "GL+ARBFP" "GL+GLSL" "GL-NPT" "GL3"
+  printf "$GL_FORMAT" "GL+FF" "GL+GLSL" "GL-NPT" "GL3"
 fi
 if test $HAVE_GLES2 -eq 1; then
   GLES2_FORMAT=" %6s %7s"
@@ -104,18 +104,11 @@ do
 
   if test $HAVE_GL -eq 1; then
     export COGL_DRIVER=gl
-    export COGL_DEBUG=disable-glsl,disable-arbfp
+    export COGL_DEBUG=disable-glsl
     run_test $test gl_ff
 
     export COGL_DRIVER=gl
-    # NB: we can't explicitly disable fixed + glsl in this case since
-    # the arbfp code only supports fragment processing so we need either
-    # the fixed or glsl vertends
-    export COGL_DEBUG=
-    run_test $test gl_arbfp
-
-    export COGL_DRIVER=gl
-    export COGL_DEBUG=disable-fixed,disable-arbfp
+    export COGL_DEBUG=disable-fixed
     run_test $test gl_glsl
 
     export COGL_DRIVER=gl
@@ -141,7 +134,6 @@ do
   if test $HAVE_GL -eq 1; then
     printf "$GL_FORMAT" \
       "`get_status $gl_ff_result`" \
-      "`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]