[Mesa-dev] [PATCH] mesa: fix OES_EGL_image_external being partially allowed in the core profile
Marek Olšák
maraeo at gmail.com
Sat Jun 1 06:23:18 PDT 2013
---
src/glsl/glcpp/glcpp-parse.y | 14 +++++++-------
src/mesa/drivers/common/meta.c | 3 ++-
src/mesa/main/ff_fragment_shader.cpp | 3 ++-
src/mesa/main/teximage.c | 2 +-
src/mesa/state_tracker/st_extensions.c | 3 +--
5 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 81ba04b..6439f77 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -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);
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index ca5f5a1..2444c04 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -655,7 +655,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) {
diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
index 91c425b..d162da8 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -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);
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 9aaa63f..1c27bef 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -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
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 46acc87..e1d0d01 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -572,8 +572,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. */
--
1.7.10.4
More information about the mesa-dev
mailing list