mesa: Remove support for desktop OpenGL GL_EXT_separate_shader_objects
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 26 Mar 2014 18:25:16 +0000 (11:25 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 2 May 2014 14:20:10 +0000 (07:20 -0700)
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@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/glsl/opt_dead_builtin_varyings.cpp
src/mapi/glapi/gen/EXT_separate_shader_objects.xml
src/mesa/drivers/dri/i915/intel_extensions.c
src/mesa/drivers/dri/i965/intel_extensions.c
src/mesa/main/dlist.c
src/mesa/main/extensions.c
src/mesa/main/mtypes.h
src/mesa/main/shaderapi.c
src/mesa/state_tracker/st_extensions.c

index c2a306e7bce8b942db31cfa737720111405a4979..6612592aab7a0a1aa4306293e75985d08868be20 100644 (file)
@@ -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;
    }
 
index 03f90a1b1644bd8da9153aeca3f2cd7e8a5b509b..9079363ceefc0d4ff959785e7091670592ad8585 100644 (file)
@@ -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"/>
index 11be0045e377d7a2935e0e57e9956a27d78758fa..76f608e2a19a76ae13240345086a9d8626603b95 100644 (file)
@@ -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;
index 892a04801cfdef69b17118d8f9a639d77b3f1333..4a2a711636e6e9571949c284d937c8759b331ee7 100644 (file)
@@ -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;
index aea5d44aefab09c55b8f56599ced357420ac90bb..5874b99f0722bdfe04b13504f72b275da7233ac2 100644 (file)
@@ -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);
 
index e60d7b0d57c733768b6fa5ecebaf44c5b19f1a75..0d1126e29daf6e214d05af00efda01a50c598cda 100644 (file)
@@ -218,7 +218,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 },
@@ -410,7 +409,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;
index b3fdf0662a15c16b534fe2505494cc248a1d00ce..7cfa9d02b88b769122451f0b5eefbc22a2aa991f 100644 (file)
@@ -2809,9 +2809,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];
 
@@ -3596,7 +3594,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;
index 8368ec56abfba50a18933bc92d08a2102662e2c9..6f84acd01f6587fee80fb1a6292b2076e5babb21 100644 (file)
@@ -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,
index a245fdf187710e6a2dad91a7cd7bae0dc7a19d83..33cd1295bfd433a640093208bc133d4f0dd00bdf 100644 (file)
@@ -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;