From fb615feafb848bbccbdb751f552263bd32a37d82 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 26 Mar 2014 11:25:16 -0700 Subject: [PATCH] mesa: Remove support for desktop OpenGL GL_EXT_separate_shader_objects 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 Reviewed-by: Eric Anholt --- src/glsl/opt_dead_builtin_varyings.cpp | 7 +- .../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 c2a306e7bce..6612592aab7 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 03f90a1b164..9079363ceef 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 @@ - + - + - + diff --git a/src/mesa/drivers/dri/i915/intel_extensions.c b/src/mesa/drivers/dri/i915/intel_extensions.c index 11be0045e37..76f608e2a19 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 892a04801cf..4a2a711636e 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 aea5d44aefa..5874b99f072 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 e60d7b0d57c..0d1126e29da 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -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; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index b3fdf0662a1..7cfa9d02b88 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -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; diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 8368ec56abf..6f84acd01f6 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 a245fdf1877..33cd1295bfd 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; -- 2.30.2