diff options
author | 2010-02-04 17:04:53 -0800 | |
---|---|---|
committer | 2010-02-04 17:04:53 -0800 | |
commit | 8dccb26901973722164f2a11551fd6d5c52081bf (patch) | |
tree | 085878f347b99a4b5141e5e68b7b63939f8848a6 /opengl/libagl/texture.cpp | |
parent | 6b578cba3971f0e4f2489c4cd40785872ab48463 (diff) |
Proper EGLImageKHR error handling
Validate EGLImageKHR format and return an error for unsupported ones.
Also make sure to return an error when binding EGL_NO_IMAGE_KHR to a texture
Diffstat (limited to 'opengl/libagl/texture.cpp')
-rw-r--r-- | opengl/libagl/texture.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/opengl/libagl/texture.cpp b/opengl/libagl/texture.cpp index a1a776f990..fa25fa92f0 100644 --- a/opengl/libagl/texture.cpp +++ b/opengl/libagl/texture.cpp @@ -1628,6 +1628,11 @@ void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image) return; } + if (image == EGL_NO_IMAGE_KHR) { + ogles_error(c, GL_INVALID_VALUE); + return; + } + android_native_buffer_t* native_buffer = (android_native_buffer_t*)image; if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) { ogles_error(c, GL_INVALID_VALUE); @@ -1652,4 +1657,26 @@ void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image) void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) { + ogles_context_t* c = ogles_context_t::get(); + if (target != GL_RENDERBUFFER_OES) { + ogles_error(c, GL_INVALID_ENUM); + return; + } + + if (image == EGL_NO_IMAGE_KHR) { + ogles_error(c, GL_INVALID_VALUE); + return; + } + + android_native_buffer_t* native_buffer = (android_native_buffer_t*)image; + if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC) { + ogles_error(c, GL_INVALID_VALUE); + return; + } + if (native_buffer->common.version != sizeof(android_native_buffer_t)) { + ogles_error(c, GL_INVALID_VALUE); + return; + } + + // well, we're not supporting this extension anyways } |