[Mesa-dev] [PATCH 18/21] mesa: Remove support for desktop OpenGL GL_EXT_separate_shader_objects

Ian Romanick idr at freedesktop.org
Tue Apr 29 17:52:21 PDT 2014


From: Ian Romanick <ian.d.romanick at intel.com>

I don't know of any applications that actually use it.  Now that Mesa
supports GL_ARB_separate_shader_objects in all drivers, this extension
is just cruft.

The entrypoints for the extension remain in the XML.  This is done so
that a new libGL will continue to provide dispatch support for old
drivers that try to expose this extension.

Future patches will add OpenGL ES GL_EXT_separate_shader_objects, but
that's a different thing.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/glsl/opt_dead_builtin_varyings.cpp             |   7 +-
 src/mapi/glapi/gen/EXT_separate_shader_objects.xml |   6 +-
 src/mesa/drivers/dri/i915/intel_extensions.c       |   1 -
 src/mesa/drivers/dri/i965/intel_extensions.c       |   1 -
 src/mesa/main/dlist.c                              |  45 -------
 src/mesa/main/extensions.c                         |   2 -
 src/mesa/main/mtypes.h                             |   5 +-
 src/mesa/main/shaderapi.c                          | 146 +--------------------
 src/mesa/state_tracker/st_extensions.c             |   7 -
 9 files changed, 11 insertions(+), 209 deletions(-)

diff --git a/src/glsl/opt_dead_builtin_varyings.cpp b/src/glsl/opt_dead_builtin_varyings.cpp
index c2a306e..6612592 100644
--- a/src/glsl/opt_dead_builtin_varyings.cpp
+++ b/src/glsl/opt_dead_builtin_varyings.cpp
@@ -518,14 +518,9 @@ do_dead_builtin_varyings(struct gl_context *ctx,
 
    /* Lowering of built-in varyings has no effect with the core context and
     * GLES2, because they are not available there.
-    *
-    * EXT_separate_shader_objects doesn't allow this optimization,
-    * because a program object can be bound partially (e.g. only one
-    * stage of a program object can be bound).
     */
    if (ctx->API == API_OPENGL_CORE ||
-       ctx->API == API_OPENGLES2 ||
-       ctx->Extensions.EXT_separate_shader_objects) {
+       ctx->API == API_OPENGLES2) {
       return;
    }
 
diff --git a/src/mapi/glapi/gen/EXT_separate_shader_objects.xml b/src/mapi/glapi/gen/EXT_separate_shader_objects.xml
index 03f90a1..9079363 100644
--- a/src/mapi/glapi/gen/EXT_separate_shader_objects.xml
+++ b/src/mapi/glapi/gen/EXT_separate_shader_objects.xml
@@ -8,16 +8,16 @@
     <!-- Alias of CURRENT_PROGRAM -->
     <enum name="ACTIVE_PROGRAM_EXT"               value="0x8B8D"/>
 
-    <function name="UseShaderProgramEXT" deprecated="3.1" offset="assign">
+    <function name="UseShaderProgramEXT" deprecated="3.1" offset="assign" exec="skip">
         <param name="type" type="GLenum"/>
 	<param name="program" type="GLuint"/>
     </function>
 
-    <function name="ActiveProgramEXT" deprecated="3.1" offset="assign">
+    <function name="ActiveProgramEXT" deprecated="3.1" offset="assign" exec="skip">
 	<param name="program" type="GLuint"/>
     </function>
 
-    <function name="CreateShaderProgramEXT" deprecated="3.1" offset="assign">
+    <function name="CreateShaderProgramEXT" deprecated="3.1" offset="assign" exec="skip">
         <param name="type" type="GLenum"/>
         <param name="string" type="const GLchar *"/>
         <return type="GLuint"/>
diff --git a/src/mesa/drivers/dri/i915/intel_extensions.c b/src/mesa/drivers/dri/i915/intel_extensions.c
index 11be004..76f608e 100644
--- a/src/mesa/drivers/dri/i915/intel_extensions.c
+++ b/src/mesa/drivers/dri/i915/intel_extensions.c
@@ -66,7 +66,6 @@ intelInitExtensions(struct gl_context *ctx)
    ctx->Extensions.EXT_pixel_buffer_object = true;
    ctx->Extensions.EXT_point_parameters = true;
    ctx->Extensions.EXT_provoking_vertex = true;
-   ctx->Extensions.EXT_separate_shader_objects = true;
    ctx->Extensions.EXT_texture_env_dot3 = true;
    ctx->Extensions.EXT_texture_filter_anisotropic = true;
    ctx->Extensions.APPLE_object_purgeable = true;
diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
index 892a048..4a2a711 100644
--- a/src/mesa/drivers/dri/i965/intel_extensions.c
+++ b/src/mesa/drivers/dri/i965/intel_extensions.c
@@ -213,7 +213,6 @@ intelInitExtensions(struct gl_context *ctx)
    ctx->Extensions.EXT_pixel_buffer_object = true;
    ctx->Extensions.EXT_point_parameters = true;
    ctx->Extensions.EXT_provoking_vertex = true;
-   ctx->Extensions.EXT_separate_shader_objects = true;
    ctx->Extensions.EXT_texture_array = true;
    ctx->Extensions.EXT_texture_env_dot3 = true;
    ctx->Extensions.EXT_texture_filter_anisotropic = true;
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index aea5d44..5874b99 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -443,10 +443,6 @@ typedef enum
    OPCODE_TEXPARAMETER_I,
    OPCODE_TEXPARAMETER_UI,
 
-   /* GL_EXT_separate_shader_objects */
-   OPCODE_ACTIVE_PROGRAM_EXT,
-   OPCODE_USE_SHADER_PROGRAM_EXT,
-
    /* GL_ARB_instanced_arrays */
    OPCODE_VERTEX_ATTRIB_DIVISOR,
 
@@ -7259,37 +7255,6 @@ save_ClampColorARB(GLenum target, GLenum clamp)
    }
 }
 
-static void GLAPIENTRY
-save_UseShaderProgramEXT(GLenum type, GLuint program)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   Node *n;
-   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = alloc_instruction(ctx, OPCODE_USE_SHADER_PROGRAM_EXT, 2);
-   if (n) {
-      n[1].ui = type;
-      n[2].ui = program;
-   }
-   if (ctx->ExecuteFlag) {
-      CALL_UseShaderProgramEXT(ctx->Exec, (type, program));
-   }
-}
-
-static void GLAPIENTRY
-save_ActiveProgramEXT(GLuint program)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   Node *n;
-   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = alloc_instruction(ctx, OPCODE_ACTIVE_PROGRAM_EXT, 1);
-   if (n) {
-      n[1].ui = program;
-   }
-   if (ctx->ExecuteFlag) {
-      CALL_ActiveProgramEXT(ctx->Exec, (program));
-   }
-}
-
 /** GL_EXT_texture_integer */
 static void GLAPIENTRY
 save_ClearColorIi(GLint red, GLint green, GLint blue, GLint alpha)
@@ -8426,12 +8391,6 @@ execute_list(struct gl_context *ctx, GLuint list)
 	 case OPCODE_USE_PROGRAM:
 	    CALL_UseProgram(ctx->Exec, (n[1].ui));
 	    break;
-	 case OPCODE_USE_SHADER_PROGRAM_EXT:
-	    CALL_UseShaderProgramEXT(ctx->Exec, (n[1].ui, n[2].ui));
-	    break;
-	 case OPCODE_ACTIVE_PROGRAM_EXT:
-	    CALL_ActiveProgramEXT(ctx->Exec, (n[1].ui));
-	    break;
 	 case OPCODE_UNIFORM_1F:
 	    CALL_Uniform1f(ctx->Exec, (n[1].i, n[2].f));
 	    break;
@@ -9638,10 +9597,6 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
    SET_TexParameterIiv(table, save_TexParameterIiv);
    SET_TexParameterIuiv(table, save_TexParameterIuiv);
 
-   /* 377. GL_EXT_separate_shader_objects */
-   SET_UseShaderProgramEXT(table, save_UseShaderProgramEXT);
-   SET_ActiveProgramEXT(table, save_ActiveProgramEXT);
-
    /* GL_ARB_color_buffer_float */
    SET_ClampColor(table, save_ClampColorARB);
 
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index a066d78..ea6019b 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -217,7 +217,6 @@ static const struct extension extension_table[] = {
    { "GL_EXT_provoking_vertex",                    o(EXT_provoking_vertex),                    GL,             2009 },
    { "GL_EXT_rescale_normal",                      o(dummy_true),                              GLL,            1997 },
    { "GL_EXT_secondary_color",                     o(dummy_true),                              GLL,            1999 },
-   { "GL_EXT_separate_shader_objects",             o(EXT_separate_shader_objects),             GLL,            2008 },
    { "GL_EXT_separate_specular_color",             o(dummy_true),                              GLL,            1997 },
    { "GL_EXT_shader_integer_mix",                  o(EXT_shader_integer_mix),                  GL       | ES3, 2013 },
    { "GL_EXT_shadow_funcs",                        o(ARB_shadow),                              GLL,            2002 },
@@ -409,7 +408,6 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
    ctx->Extensions.ARB_occlusion_query = GL_TRUE;
    ctx->Extensions.ARB_occlusion_query2 = GL_TRUE;
    ctx->Extensions.ARB_point_sprite = GL_TRUE;
-   ctx->Extensions.EXT_separate_shader_objects = GL_TRUE;
    ctx->Extensions.ARB_shadow = GL_TRUE;
    ctx->Extensions.ARB_texture_border_clamp = GL_TRUE;
    ctx->Extensions.ARB_texture_cube_map = GL_TRUE;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 75d74bf..3009fda 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2792,9 +2792,7 @@ struct gl_pipeline_object
    /**
     * Programs used for rendering
     *
-    * There is a separate program set for each shader stage.  If
-    * GL_EXT_separate_shader_objects is not supported, each of these must point
-    * to \c NULL or to the same program.
+    * There is a separate program set for each shader stage.
     */
    struct gl_shader_program *CurrentProgram[MESA_SHADER_STAGES];
 
@@ -3578,7 +3576,6 @@ struct gl_extensions
    GLboolean EXT_pixel_buffer_object;
    GLboolean EXT_point_parameters;
    GLboolean EXT_provoking_vertex;
-   GLboolean EXT_separate_shader_objects;
    GLboolean EXT_shader_integer_mix;
    GLboolean EXT_stencil_two_side;
    GLboolean EXT_texture3D;
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 8368ec5..6f84acd 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -792,7 +792,7 @@ get_shader_source(struct gl_context *ctx, GLuint shader, GLsizei maxLength,
 
 /**
  * Set/replace shader source code.  A helper function used by
- * glShaderSource[ARB] and glCreateShaderProgramEXT.
+ * glShaderSource[ARB].
  */
 static void
 shader_source(struct gl_context *ctx, GLuint shader, const GLchar *source)
@@ -1545,15 +1545,14 @@ _mesa_UseProgram(GLhandleARB program)
       shProg = NULL;
    }
 
-   /* The "Dependencies on EXT_separate_shader_objects" section of the
-    * ARB_separate_shader_object spec says:
+   /* The ARB_separate_shader_object spec says:
     *
     *     "The executable code for an individual shader stage is taken from
     *     the current program for that stage.  If there is a current program
-    *     object for any shader stage or for uniform updates established by
-    *     UseProgram, UseShaderProgramEXT, or ActiveProgramEXT, the current
-    *     program for that stage (if any) is considered current.  Otherwise,
-    *     if there is a bound program pipeline object ..."
+    *     object established by UseProgram, that program is considered current
+    *     for all stages.  Otherwise, if there is a bound program pipeline
+    *     object (section 2.14.PPO), the program bound to the appropriate
+    *     stage of the pipeline object is considered current."
     */
    if (program) {
       /* Attach shader state to the binding point */
@@ -1808,124 +1807,6 @@ _mesa_use_shader_program(struct gl_context *ctx, GLenum type,
 }
 
 
-/**
- * For GL_EXT_separate_shader_objects
- */
-void GLAPIENTRY
-_mesa_UseShaderProgramEXT(GLenum type, GLuint program)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   struct gl_shader_program *shProg = NULL;
-
-   if (!_mesa_validate_shader_target(ctx, type)) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "glUseShaderProgramEXT(type)");
-      return;
-   }
-
-   if (_mesa_is_xfb_active_and_unpaused(ctx)) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glUseShaderProgramEXT(transform feedback is active)");
-      return;
-   }
-
-   if (program) {
-      shProg = _mesa_lookup_shader_program_err(ctx, program,
-					       "glUseShaderProgramEXT");
-      if (shProg == NULL)
-	 return;
-
-      if (!shProg->LinkStatus) {
-	 _mesa_error(ctx, GL_INVALID_OPERATION,
-		     "glUseShaderProgramEXT(program not linked)");
-	 return;
-      }
-   }
-
-   /* The "Dependencies on EXT_separate_shader_objects" section of the
-    * ARB_separate_shader_object spec says:
-    *
-    *     "The executable code for an individual shader stage is taken from
-    *     the current program for that stage.  If there is a current program
-    *     object for any shader stage or for uniform updates established by
-    *     UseProgram, UseShaderProgramEXT, or ActiveProgramEXT, the current
-    *     program for that stage (if any) is considered current.  Otherwise,
-    *     if there is a bound program pipeline object ..."
-    */
-   if (program) {
-      /* Attach shader state to the binding point */
-      _mesa_reference_pipeline_object(ctx, &ctx->_Shader, &ctx->Shader);
-      /* Update the program */
-      _mesa_use_shader_program(ctx, type, shProg, ctx->_Shader);
-   } else {
-      /* Must be done first: detach the progam */
-      _mesa_use_shader_program(ctx, type, shProg, ctx->_Shader);
-
-      /* Nothing remains current */
-      if (!ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX] &&
-          !ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY] &&
-          !ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT] &&
-          !ctx->Shader.ActiveProgram) {
-
-         /* Unattach shader_state binding point */
-         _mesa_reference_pipeline_object(ctx, &ctx->_Shader,
-                                         ctx->Pipeline.Default);
-
-         /* If a pipeline was bound, rebind it */
-         if (ctx->Pipeline.Current) {
-            _mesa_BindProgramPipeline(ctx->Pipeline.Current->Name);
-         }
-      }
-   }
-}
-
-
-/**
- * For GL_EXT_separate_shader_objects
- */
-void GLAPIENTRY
-_mesa_ActiveProgramEXT(GLuint program)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   struct gl_shader_program *shProg = (program != 0)
-      ? _mesa_lookup_shader_program_err(ctx, program, "glActiveProgramEXT")
-      : NULL;
-
-   /* The "Dependencies on EXT_separate_shader_objects" section of the
-    * ARB_separate_shader_object spec says:
-    *
-    *     "The executable code for an individual shader stage is taken from
-    *     the current program for that stage.  If there is a current program
-    *     object for any shader stage or for uniform updates established by
-    *     UseProgram, UseShaderProgramEXT, or ActiveProgramEXT, the current
-    *     program for that stage (if any) is considered current.  Otherwise,
-    *     if there is a bound program pipeline object ..."
-    */
-   if (shProg != NULL) {
-      /* Attach shader state to the binding point */
-      _mesa_reference_pipeline_object(ctx, &ctx->_Shader, &ctx->Shader);
-      _mesa_active_program(ctx, shProg, "glActiveProgramEXT");
-   } else {
-      /* Must be done first: unset the current active progam */
-      _mesa_active_program(ctx, shProg, "glActiveProgramEXT");
-
-      /* Nothing remains current */
-      if (!ctx->Shader.CurrentProgram[MESA_SHADER_VERTEX] &&
-          !ctx->Shader.CurrentProgram[MESA_SHADER_GEOMETRY] &&
-          !ctx->Shader.CurrentProgram[MESA_SHADER_FRAGMENT] &&
-          !ctx->Shader.ActiveProgram) {
-
-         /* Unattach shader_state binding point */
-         _mesa_reference_pipeline_object(ctx, &ctx->_Shader, ctx->Pipeline.Default);
-         /* If a pipeline was bound, rebind it */
-         if (ctx->Pipeline.Current) {
-            _mesa_BindProgramPipeline(ctx->Pipeline.Current->Name);
-         }
-      }
-   }
-
-   return;
-}
-
 static GLuint
 _mesa_create_shader_program(struct gl_context* ctx, GLboolean separate,
                             GLenum type, GLsizei count, const GLchar* const *strings)
@@ -2010,23 +1891,8 @@ _mesa_copy_linked_program_data(gl_shader_stage type,
    }
 }
 
-
-/**
- * For GL_EXT_separate_shader_objects
- */
-GLuint GLAPIENTRY
-_mesa_CreateShaderProgramEXT(GLenum type, const GLchar *string)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   return _mesa_create_shader_program(ctx, GL_FALSE, type, 1, &string);
-}
-
 /**
  * ARB_separate_shader_objects: Compile & Link Program
- *
- * Basically the same as _mesa_CreateShaderProgramEXT but with support of
- * multiple strings and sets the SeparateShader flag to true.
  */
 GLuint GLAPIENTRY
 _mesa_CreateShaderProgramv(GLenum type, GLsizei count,
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index a245fdf..33cd129 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -560,13 +560,6 @@ void st_init_extensions(struct st_context *st)
    ctx->Extensions.EXT_point_parameters = GL_TRUE;
    ctx->Extensions.EXT_provoking_vertex = GL_TRUE;
 
-   /* IMPORTANT:
-    *    Don't enable EXT_separate_shader_objects. It disallows a certain
-    *    optimization in the GLSL compiler and therefore is considered
-    *    harmful.
-    */
-   ctx->Extensions.EXT_separate_shader_objects = GL_FALSE;
-
    ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE;
    ctx->Extensions.EXT_vertex_array_bgra = GL_TRUE;
 
-- 
1.8.1.4



More information about the mesa-dev mailing list