[Mesa-dev] [PATCH 17/21] mesa: GL_ARB_shader_objects is not optional

Ian Romanick idr at freedesktop.org
Thu Jun 27 18:20:30 PDT 2013


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

This extension just provides some of the most basic software framework
for GLSL.  Without GL_ARB_vertex_shader or GL_ARB_fragment_shader,
applications still cannot use GLSL.  There's no value in
conditionalizing support for this extension.

NOTE: This has the side effect of enabling the extension in the radeon,
r200, and nouveau drivers.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/drivers/common/meta.c               | 22 ++++++++++------------
 src/mesa/drivers/dri/i915/intel_extensions.c |  1 -
 src/mesa/drivers/dri/i965/intel_extensions.c |  1 -
 src/mesa/main/extensions.c                   |  7 +++----
 src/mesa/main/get.c                          |  1 -
 src/mesa/main/get_hash_params.py             |  6 +++---
 src/mesa/main/getstring.c                    |  5 -----
 src/mesa/main/mtypes.h                       |  1 -
 src/mesa/main/version.c                      |  2 --
 src/mesa/state_tracker/st_extensions.c       |  1 -
 10 files changed, 16 insertions(+), 31 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index d9bffd7..e848429 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -615,18 +615,16 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
          _mesa_set_enable(ctx, GL_FRAGMENT_SHADER_ATI, GL_FALSE);
       }
 
-      if (ctx->Extensions.ARB_shader_objects) {
-	 _mesa_reference_shader_program(ctx, &save->VertexShader,
-					ctx->Shader.CurrentVertexProgram);
-	 _mesa_reference_shader_program(ctx, &save->GeometryShader,
-					ctx->Shader.CurrentGeometryProgram);
-	 _mesa_reference_shader_program(ctx, &save->FragmentShader,
-					ctx->Shader.CurrentFragmentProgram);
-	 _mesa_reference_shader_program(ctx, &save->ActiveShader,
-					ctx->Shader.ActiveProgram);
-
-         _mesa_UseProgram(0);
-      }
+      _mesa_reference_shader_program(ctx, &save->VertexShader,
+                                     ctx->Shader.CurrentVertexProgram);
+      _mesa_reference_shader_program(ctx, &save->GeometryShader,
+                                     ctx->Shader.CurrentGeometryProgram);
+      _mesa_reference_shader_program(ctx, &save->FragmentShader,
+                                     ctx->Shader.CurrentFragmentProgram);
+      _mesa_reference_shader_program(ctx, &save->ActiveShader,
+                                     ctx->Shader.ActiveProgram);
+
+      _mesa_UseProgram(0);
    }
 
    if (state & MESA_META_STENCIL_TEST) {
diff --git a/src/mesa/drivers/dri/i915/intel_extensions.c b/src/mesa/drivers/dri/i915/intel_extensions.c
index e6241b5..53a9ea4 100644
--- a/src/mesa/drivers/dri/i915/intel_extensions.c
+++ b/src/mesa/drivers/dri/i915/intel_extensions.c
@@ -51,7 +51,6 @@ intelInitExtensions(struct gl_context *ctx)
    ctx->Extensions.ARB_internalformat_query = true;
    ctx->Extensions.ARB_map_buffer_range = true;
    ctx->Extensions.ARB_point_sprite = true;
-   ctx->Extensions.ARB_shader_objects = true;
    ctx->Extensions.ARB_shading_language_100 = true;
    ctx->Extensions.ARB_sync = true;
    ctx->Extensions.ARB_texture_border_clamp = true;
diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
index 8c61867..97fb781 100644
--- a/src/mesa/drivers/dri/i965/intel_extensions.c
+++ b/src/mesa/drivers/dri/i965/intel_extensions.c
@@ -66,7 +66,6 @@ intelInitExtensions(struct gl_context *ctx)
    ctx->Extensions.ARB_point_sprite = true;
    ctx->Extensions.ARB_seamless_cube_map = true;
    ctx->Extensions.ARB_shader_bit_encoding = true;
-   ctx->Extensions.ARB_shader_objects = true;
    ctx->Extensions.ARB_shader_texture_lod = true;
    ctx->Extensions.ARB_shading_language_100 = true;
    ctx->Extensions.ARB_shadow = true;
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 100d437..fdaef7f 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -100,7 +100,7 @@ static const struct extension extension_table[] = {
    { "GL_ARB_fragment_shader",                     o(ARB_fragment_shader),                     GL,             2002 },
    { "GL_ARB_framebuffer_object",                  o(ARB_framebuffer_object),                  GL,             2005 },
    { "GL_ARB_framebuffer_sRGB",                    o(EXT_framebuffer_sRGB),                    GL,             1998 },
-   { "GL_ARB_get_program_binary",                  o(ARB_shader_objects),                      GL,             2010 },
+   { "GL_ARB_get_program_binary",                  o(dummy_true),                              GL,             2010 },
    { "GL_ARB_gpu_shader5",                         o(ARB_gpu_shader5),                         GL,             2010 },
    { "GL_ARB_half_float_pixel",                    o(ARB_half_float_pixel),                    GL,             2003 },
    { "GL_ARB_half_float_vertex",                   o(ARB_half_float_vertex),                   GL,             2008 },
@@ -121,7 +121,7 @@ static const struct extension extension_table[] = {
    { "GL_ARB_sampler_objects",                     o(dummy_true),                              GL,             2009 },
    { "GL_ARB_seamless_cube_map",                   o(ARB_seamless_cube_map),                   GL,             2009 },
    { "GL_ARB_shader_bit_encoding",                 o(ARB_shader_bit_encoding),                 GL,             2010 },
-   { "GL_ARB_shader_objects",                      o(ARB_shader_objects),                      GL,             2002 },
+   { "GL_ARB_shader_objects",                      o(dummy_true),                              GL,             2002 },
    { "GL_ARB_shader_stencil_export",               o(ARB_shader_stencil_export),               GL,             2009 },
    { "GL_ARB_shader_texture_lod",                  o(ARB_shader_texture_lod),                  GL,             2009 },
    { "GL_ARB_shading_language_100",                o(ARB_shading_language_100),                GLL,            2003 },
@@ -260,7 +260,7 @@ static const struct extension extension_table[] = {
    { "GL_OES_fbo_render_mipmap",                   o(dummy_true),                                   ES1 | ES2, 2005 },
    { "GL_OES_fixed_point",                         o(dummy_true),                                   ES1,       2002 },
    { "GL_OES_framebuffer_object",                  o(dummy_true),                                   ES1,       2005 },
-   { "GL_OES_get_program_binary",                  o(ARB_shader_objects),                                 ES2, 2008 },
+   { "GL_OES_get_program_binary",                  o(dummy_true),                                         ES2, 2008 },
    { "GL_OES_mapbuffer",                           o(dummy_true),                                   ES1 | ES2, 2005 },
    { "GL_OES_matrix_get",                          o(dummy_true),                                   ES1,       2004 },
    { "GL_OES_packed_depth_stencil",                o(EXT_packed_depth_stencil),                     ES1 | ES2, 2007 },
@@ -390,7 +390,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.ARB_shader_objects = GL_TRUE;
    ctx->Extensions.EXT_separate_shader_objects = GL_TRUE;
    ctx->Extensions.ARB_shading_language_100 = GL_TRUE;
    ctx->Extensions.ARB_shadow = GL_TRUE;
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index ac9c1d4..0b33fa4 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -342,7 +342,6 @@ EXTRA_EXT(EXT_depth_bounds_test);
 EXTRA_EXT(ARB_depth_clamp);
 EXTRA_EXT(ATI_fragment_shader);
 EXTRA_EXT(EXT_framebuffer_blit);
-EXTRA_EXT(ARB_shader_objects);
 EXTRA_EXT(EXT_provoking_vertex);
 EXTRA_EXT(ARB_fragment_shader);
 EXTRA_EXT(ARB_fragment_program);
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 91ddf80..fde4537 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -280,7 +280,7 @@ descriptor=[
 # GL_ARB_shader_objects
 # Actually, this token isn't part of GL_ARB_shader_objects, but is
 # close enough for now.
-  [ "CURRENT_PROGRAM", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_shader_objects" ],
+  [ "CURRENT_PROGRAM", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
 
 # OpenGL 2.0
   [ "STENCIL_BACK_FUNC", "CONTEXT_ENUM(Stencil.Function[1]), NO_EXTRA" ],
@@ -311,8 +311,8 @@ descriptor=[
   [ "SHADER_BINARY_FORMATS", "CONST(0), extra_ARB_ES2_compatibility_api_es2" ],
 
 # GL_ARB_get_program_binary / GL_OES_get_program_binary
-  [ "NUM_PROGRAM_BINARY_FORMATS", "CONST(0), extra_ARB_shader_objects" ],
-  [ "PROGRAM_BINARY_FORMATS", "LOC_CUSTOM, TYPE_INVALID, 0, extra_ARB_shader_objects" ],
+  [ "NUM_PROGRAM_BINARY_FORMATS", "CONST(0), NO_EXTRA" ],
+  [ "PROGRAM_BINARY_FORMATS", "LOC_CUSTOM, TYPE_INVALID, 0, NO_EXTRA" ],
 ]},
 
 # GLES3 is not a typo.
diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c
index 1145d0f..39fd260 100644
--- a/src/mesa/main/getstring.c
+++ b/src/mesa/main/getstring.c
@@ -41,11 +41,6 @@ shading_language_version(struct gl_context *ctx)
    switch (ctx->API) {
    case API_OPENGL_COMPAT:
    case API_OPENGL_CORE:
-      if (!ctx->Extensions.ARB_shader_objects) {
-         _mesa_error(ctx, GL_INVALID_ENUM, "glGetString");
-         return (const GLubyte *) 0;
-      }
-
       switch (ctx->Const.GLSLVersion) {
       case 110:
          return (const GLubyte *) "1.10";
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 34cffeb..553b0ec 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3014,7 +3014,6 @@ struct gl_extensions
    GLboolean ARB_point_sprite;
    GLboolean ARB_seamless_cube_map;
    GLboolean ARB_shader_bit_encoding;
-   GLboolean ARB_shader_objects;
    GLboolean ARB_shader_stencil_export;
    GLboolean ARB_shader_texture_lod;
    GLboolean ARB_shading_language_100;
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 16185bf..1bff19f 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -211,7 +211,6 @@ compute_version(struct gl_context *ctx)
                               ctx->Extensions.EXT_shadow_funcs);
    const GLboolean ver_2_0 = (ver_1_5 &&
                               ctx->Extensions.ARB_point_sprite &&
-                              ctx->Extensions.ARB_shader_objects &&
                               ctx->Extensions.ARB_vertex_shader &&
                               ctx->Extensions.ARB_fragment_shader &&
                               ctx->Extensions.ARB_texture_non_power_of_two &&
@@ -358,7 +357,6 @@ compute_version_es2(struct gl_context *ctx)
                               ctx->Extensions.EXT_blend_color &&
                               ctx->Extensions.EXT_blend_func_separate &&
                               ctx->Extensions.EXT_blend_minmax &&
-                              ctx->Extensions.ARB_shader_objects &&
                               ctx->Extensions.ARB_vertex_shader &&
                               ctx->Extensions.ARB_fragment_shader &&
                               ctx->Extensions.ARB_texture_non_power_of_two &&
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index cc25ae4..1ae4729 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -537,7 +537,6 @@ void st_init_extensions(struct st_context *st)
    ctx->Extensions.ARB_half_float_vertex = GL_TRUE;
    ctx->Extensions.ARB_internalformat_query = GL_TRUE;
    ctx->Extensions.ARB_map_buffer_range = GL_TRUE;
-   ctx->Extensions.ARB_shader_objects = GL_TRUE;
    ctx->Extensions.ARB_shading_language_100 = GL_TRUE;
    ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; /* XXX temp */
    ctx->Extensions.ARB_texture_cube_map = GL_TRUE;
-- 
1.8.1.4



More information about the mesa-dev mailing list