diff options
author | Ian Romanick <[email protected]> | 2012-07-25 16:13:33 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2012-08-23 10:15:30 -0700 |
commit | ea9b212fca78eada7cc7c4449de3f31d2ceea1c3 (patch) | |
tree | 97c46bbc3bc6ee69bcb14ee66c94de5ed60d3cb2 /src/mesa/main/teximage.c | |
parent | a0595cb4506251509e032a2592d6bb684480de4b (diff) |
mesa/es: Validate EGLImageTargetTexture2DOES target in Mesa code rather than the ES wrapper
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/mesa/main/teximage.c')
-rw-r--r-- | src/mesa/main/teximage.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 27294ba8018..095db4ff9c1 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -28,7 +28,7 @@ * Texture image-related functions. */ - +#include <stdbool.h> #include "glheader.h" #include "bufferobj.h" #include "context.h" @@ -2670,13 +2670,23 @@ _mesa_EGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image) { struct gl_texture_object *texObj; struct gl_texture_image *texImage; + bool valid_target; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if ((target == GL_TEXTURE_2D && - !ctx->Extensions.OES_EGL_image) || - (target == GL_TEXTURE_EXTERNAL_OES && - !ctx->Extensions.OES_EGL_image_external)) { + switch (target) { + case GL_TEXTURE_2D: + valid_target = ctx->Extensions.OES_EGL_image; + break; + case GL_TEXTURE_EXTERNAL_OES: + valid_target = ctx->Extensions.OES_EGL_image_external; + break; + default: + valid_target = false; + break; + } + + if (!valid_target) { _mesa_error(ctx, GL_INVALID_ENUM, "glEGLImageTargetTexture2D(target=%d)", target); return; |