mesa: fix OES_EGL_image_external being partially allowed in the core profile
authorMarek Olšák <maraeo@gmail.com>
Wed, 29 May 2013 15:32:44 +0000 (17:32 +0200)
committerMarek Olšák <maraeo@gmail.com>
Thu, 13 Jun 2013 01:54:13 +0000 (03:54 +0200)
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
src/glsl/glcpp/glcpp-parse.y
src/mesa/drivers/common/meta.c
src/mesa/main/ff_fragment_shader.cpp
src/mesa/main/teximage.c
src/mesa/state_tracker/st_extensions.c

index fe36c124d1c209f791d281e7741ec3ee96949156..6cb5009e86193a4dc2d3705af6ff06529dea94fc 100644 (file)
@@ -1184,14 +1184,14 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api)
        parser->is_gles = false;
 
        /* Add pre-defined macros. */
-       if (extensions != NULL) {
-          if (extensions->OES_EGL_image_external)
-             add_builtin_define(parser, "GL_OES_EGL_image_external", 1);
-       }
-
        if (api == API_OPENGLES2) {
-               parser->is_gles = true;
-               add_builtin_define(parser, "GL_ES", 1);
+           parser->is_gles = true;
+           add_builtin_define(parser, "GL_ES", 1);
+
+           if (extensions != NULL) {
+              if (extensions->OES_EGL_image_external)
+                 add_builtin_define(parser, "GL_OES_EGL_image_external", 1);
+           }
        } else {
           add_builtin_define(parser, "GL_ARB_draw_buffers", 1);
           add_builtin_define(parser, "GL_ARB_texture_rectangle", 1);
index 373e8f55a7477136f82a24aece75449bb37e3de9..ce5b87b0be1d95cf2496f17b6bf309228c2e3681 100644 (file)
@@ -654,7 +654,8 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
                _mesa_set_enable(ctx, GL_TEXTURE_2D, GL_FALSE);
                if (ctx->Extensions.ARB_texture_cube_map)
                   _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE);
-               if (ctx->Extensions.OES_EGL_image_external)
+               if (_mesa_is_gles(ctx) &&
+                   ctx->Extensions.OES_EGL_image_external)
                   _mesa_set_enable(ctx, GL_TEXTURE_EXTERNAL_OES, GL_FALSE);
 
                if (ctx->API == API_OPENGL_COMPAT) {
index 91c425be678a21b6c7b0154c2102f763ecef295b..d162da8db0c6878f6ae3a6db188f92a2ee6dfbc7 100644 (file)
@@ -31,6 +31,7 @@ extern "C" {
 #include "glheader.h"
 #include "imports.h"
 #include "mtypes.h"
+#include "main/context.h"
 #include "main/uniforms.h"
 #include "main/macros.h"
 #include "main/samplerobj.h"
@@ -1309,7 +1310,7 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
 
    state->language_version = 130;
    state->es_shader = false;
-   if (ctx->Extensions.OES_EGL_image_external)
+   if (_mesa_is_gles(ctx) && ctx->Extensions.OES_EGL_image_external)
       state->OES_EGL_image_external_enable = true;
    _mesa_glsl_initialize_types(state);
    _mesa_glsl_initialize_variables(p.instructions, state);
index 9aaa63f136fb9b0e40a5a16c08d4e2338623c607..6f7fbc0d2a15a894723a70f4c82c806e62b0e098 100644 (file)
@@ -798,7 +798,7 @@ _mesa_select_tex_object(struct gl_context *ctx,
                 ctx->Extensions.ARB_texture_buffer_object ?
                 texUnit->CurrentTex[TEXTURE_BUFFER_INDEX] : NULL;
       case GL_TEXTURE_EXTERNAL_OES:
-         return ctx->Extensions.OES_EGL_image_external
+         return _mesa_is_gles(ctx) && ctx->Extensions.OES_EGL_image_external
             ? texUnit->CurrentTex[TEXTURE_EXTERNAL_INDEX] : NULL;
       case GL_TEXTURE_2D_MULTISAMPLE:
          return ctx->Extensions.ARB_texture_multisample
@@ -3243,7 +3243,8 @@ _mesa_EGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image)
       valid_target = ctx->Extensions.OES_EGL_image;
       break;
    case GL_TEXTURE_EXTERNAL_OES:
-      valid_target = ctx->Extensions.OES_EGL_image_external;
+      valid_target =
+         _mesa_is_gles(ctx) ? ctx->Extensions.OES_EGL_image_external : false;
       break;
    default:
       valid_target = false;
index ddae95639554ac6934d36176826243991dff75e6..966722c0ba9bea5063d15fc891c4ab6186766ccc 100644 (file)
@@ -573,8 +573,7 @@ void st_init_extensions(struct st_context *st)
    ctx->Extensions.NV_texture_rectangle = GL_TRUE;
 
    ctx->Extensions.OES_EGL_image = GL_TRUE;
-   if (ctx->API != API_OPENGL_COMPAT)
-      ctx->Extensions.OES_EGL_image_external = GL_TRUE;
+   ctx->Extensions.OES_EGL_image_external = GL_TRUE;
    ctx->Extensions.OES_draw_texture = GL_TRUE;
 
    /* Expose the extensions which directly correspond to gallium caps. */