mesa: don't advertise ARB_texture_buffer_object in legacy contexts
authorMarek Olšák <maraeo@gmail.com>
Sat, 8 Dec 2012 21:53:23 +0000 (22:53 +0100)
committerMarek Olšák <maraeo@gmail.com>
Wed, 12 Dec 2012 12:09:54 +0000 (13:09 +0100)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/dri/intel/intel_extensions.c
src/mesa/main/bufferobj.c
src/mesa/main/extensions.c
src/mesa/main/get.c
src/mesa/main/teximage.c
src/mesa/main/texobj.c
src/mesa/main/texparam.c

index df886a5cdfd307bd34d288e99c0e8084560d6b5a..7b2b595b9a40c9c68d07a18b1181dcee642d59e5 100755 (executable)
@@ -102,10 +102,7 @@ intelInitExtensions(struct gl_context *ctx)
       ctx->Extensions.ARB_blend_func_extended = !driQueryOptionb(&intel->optionCache, "disable_blend_func_extended");
       ctx->Extensions.ARB_draw_buffers_blend = true;
       ctx->Extensions.ARB_uniform_buffer_object = true;
-
-      if (ctx->API == API_OPENGL_CORE) {
-         ctx->Extensions.ARB_texture_buffer_object = true;
-      }
+      ctx->Extensions.ARB_texture_buffer_object = true;
    }
 
    if (intel->gen >= 5)
index 6733644b6124dad8757b0e9659e26bf0cb129395..4a844308b05b609fdf97b5d0fabf70feced3bccf 100644 (file)
@@ -93,8 +93,8 @@ get_buffer_target(struct gl_context *ctx, GLenum target)
       }
       break;
    case GL_TEXTURE_BUFFER:
-      if (_mesa_is_desktop_gl(ctx)
-          && ctx->Extensions.ARB_texture_buffer_object) {
+      if (ctx->API == API_OPENGL_CORE &&
+          ctx->Extensions.ARB_texture_buffer_object) {
          return &ctx->Texture.BufferObject;
       }
       break;
index 11cbea2b40e55e96fe431bb8f2f41f48852fb267..e86e43600226eb161f3cbec084ba26984127e53b 100644 (file)
@@ -126,7 +126,7 @@ static const struct extension extension_table[] = {
    { "GL_ARB_shadow",                              o(ARB_shadow),                              GLL,            2001 },
    { "GL_ARB_sync",                                o(ARB_sync),                                GL,             2003 },
    { "GL_ARB_texture_border_clamp",                o(ARB_texture_border_clamp),                GLL,            2000 },
-   { "GL_ARB_texture_buffer_object",               o(ARB_texture_buffer_object),               GL            2008 },
+   { "GL_ARB_texture_buffer_object",               o(ARB_texture_buffer_object),               GLC,            2008 },
    { "GL_ARB_texture_compression",                 o(dummy_true),                              GLL,            2000 },
    { "GL_ARB_texture_compression_rgtc",            o(ARB_texture_compression_rgtc),            GL,             2004 },
    { "GL_ARB_texture_cube_map",                    o(ARB_texture_cube_map),                    GLL,            1999 },
index 97dccd0edc153cf9a60d96efa9f5a5ba939e09ca..f3dbda2d3d2259f0b7959c9e950eab88f6104e20 100644 (file)
@@ -129,6 +129,7 @@ enum value_extra {
    EXTRA_VERSION_31,
    EXTRA_VERSION_32,
    EXTRA_API_GL,
+   EXTRA_API_GL_CORE,
    EXTRA_API_ES2,
    EXTRA_NEW_BUFFERS, 
    EXTRA_NEW_FRAG_CLAMP,
@@ -283,6 +284,7 @@ static const int extra_GLSL_130[] = {
 };
 
 static const int extra_texture_buffer_object[] = {
+   EXTRA_API_GL_CORE,
    EXTRA_VERSION_31,
    EXT(ARB_texture_buffer_object),
    EXTRA_END
@@ -329,7 +331,6 @@ EXTRA_EXT2(ARB_vertex_program, ARB_fragment_program);
 EXTRA_EXT(ARB_geometry_shader4);
 EXTRA_EXT(ARB_color_buffer_float);
 EXTRA_EXT(EXT_framebuffer_sRGB);
-EXTRA_EXT(ARB_texture_buffer_object);
 EXTRA_EXT(OES_EGL_image_external);
 EXTRA_EXT(ARB_blend_func_extended);
 EXTRA_EXT(ARB_uniform_buffer_object);
@@ -879,6 +880,12 @@ check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d
            enabled++;
         }
         break;
+      case EXTRA_API_GL_CORE:
+        if (ctx->API == API_OPENGL_CORE) {
+           total++;
+           enabled++;
+        }
+        break;
       case EXTRA_NEW_BUFFERS:
         if (ctx->NewState & _NEW_BUFFERS)
            _mesa_update_state(ctx);
index 83b7e1488ecd6365bb998fc6c9a3a3179322efc4..47c4ed235906ccc866788fca460fbe3ccca824cc 100644 (file)
@@ -791,9 +791,9 @@ _mesa_select_tex_object(struct gl_context *ctx,
       case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
          return arrayTex ? ctx->Texture.ProxyTex[TEXTURE_2D_ARRAY_INDEX] : NULL;
       case GL_TEXTURE_BUFFER:
-         return _mesa_is_desktop_gl(ctx) 
-            && ctx->Extensions.ARB_texture_buffer_object
-            ? texUnit->CurrentTex[TEXTURE_BUFFER_INDEX] : NULL;
+         return ctx->API == API_OPENGL_CORE &&
+                ctx->Extensions.ARB_texture_buffer_object ?
+                texUnit->CurrentTex[TEXTURE_BUFFER_INDEX] : NULL;
       case GL_TEXTURE_EXTERNAL_OES:
          return ctx->Extensions.OES_EGL_image_external
             ? texUnit->CurrentTex[TEXTURE_EXTERNAL_INDEX] : NULL;
@@ -994,9 +994,8 @@ _mesa_max_texture_levels(struct gl_context *ctx, GLenum target)
       return ctx->Extensions.ARB_texture_cube_map_array
          ? ctx->Const.MaxCubeTextureLevels : 0;
    case GL_TEXTURE_BUFFER:
-      return _mesa_is_desktop_gl(ctx)
-         && ctx->Extensions.ARB_texture_buffer_object
-         ? 1 : 0;
+      return ctx->API == API_OPENGL_CORE &&
+             ctx->Extensions.ARB_texture_buffer_object ? 1 : 0;
    case GL_TEXTURE_EXTERNAL_OES:
       /* fall-through */
    default:
@@ -3895,8 +3894,8 @@ _mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer)
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
-   if (!(ctx->Extensions.ARB_texture_buffer_object
-         && _mesa_is_desktop_gl(ctx))) {
+   if (!(ctx->API == API_OPENGL_CORE &&
+         ctx->Extensions.ARB_texture_buffer_object)) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBuffer");
       return;
    }
index d650c75e4e711fe31aab39f5ce360b6e910afeaf..cb7ac19a804e2400ca8b438262783e520782a6b0 100644 (file)
@@ -1148,9 +1148,9 @@ target_enum_to_index(struct gl_context *ctx, GLenum target)
          || _mesa_is_gles3(ctx)
          ? TEXTURE_2D_ARRAY_INDEX : -1;
    case GL_TEXTURE_BUFFER_ARB:
-      return _mesa_is_desktop_gl(ctx)
-         && ctx->Extensions.ARB_texture_buffer_object
-         ? TEXTURE_BUFFER_INDEX : -1;
+      return ctx->API == API_OPENGL_CORE &&
+             ctx->Extensions.ARB_texture_buffer_object ?
+             TEXTURE_BUFFER_INDEX : -1;
    case GL_TEXTURE_EXTERNAL_OES:
       return _mesa_is_gles(ctx) && ctx->Extensions.OES_EGL_image_external
          ? TEXTURE_EXTERNAL_INDEX : -1;
index c2d161f9a9dc1063369e6c64853c6bfbcfd50b14..ca5a21f788b773b4989b47f24201fba525eb2c71 100644 (file)
@@ -976,7 +976,7 @@ legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target)
        * From the OpenGL 3.1 spec:
        * "target may also be TEXTURE_BUFFER, indicating the texture buffer."
        */
-      return _mesa_is_desktop_gl(ctx) && ctx->Version >= 31;
+      return ctx->API == API_OPENGL_CORE && ctx->Version >= 31;
    default:
       return GL_FALSE;
    }