aboutsummaryrefslogtreecommitdiffstats
path: root/emulator/opengl/host/libs
diff options
context:
space:
mode:
authorbohu <bohu@google.com>2014-10-29 09:47:20 -0700
committerBo Hu <bohu@google.com>2014-10-29 16:50:16 +0000
commit98fbf8a9d670f951b6ca1453e09288784078116f (patch)
tree09fcea9070843e26f486d9478d5c085ab1bc7b65 /emulator/opengl/host/libs
parentcf7e8c7948b3b811a6693ac871d2578a2bdf0a46 (diff)
downloadsdk-98fbf8a9d670f951b6ca1453e09288784078116f.zip
sdk-98fbf8a9d670f951b6ca1453e09288784078116f.tar.gz
sdk-98fbf8a9d670f951b6ca1453e09288784078116f.tar.bz2
Check and return correct error code
check and return proper error codes when negative width, height or size or wrong internal texture format is passed in. Change-Id: Ic4ddea55042d8e21f8729a7ca675a44a232b7c7c
Diffstat (limited to 'emulator/opengl/host/libs')
-rw-r--r--emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp b/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp
index fe64f6f..cbec552 100644
--- a/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp
+++ b/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp
@@ -367,6 +367,7 @@ GL_APICALL void GL_APIENTRY glCompressedTexImage2D(GLenum target, GLint level,
{
GET_CTX();
SET_ERROR_IF(!GLESv2Validate::textureTargetEx(target),GL_INVALID_ENUM);
+ SET_ERROR_IF(level < 0 || imageSize < 0, GL_INVALID_VALUE);
doCompressedTexImage2D(ctx, target, level, internalformat,
width, height, border,
@@ -1739,10 +1740,10 @@ GL_APICALL void GL_APIENTRY glStencilOpSeparate(GLenum face, GLenum fail, GLenu
GL_APICALL void GL_APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels){
GET_CTX();
SET_ERROR_IF(!(GLESv2Validate::textureTargetEx(target) &&
- GLESv2Validate::pixelFrmt(ctx,internalformat) &&
GLESv2Validate::pixelFrmt(ctx,format)&&
GLESv2Validate::pixelType(ctx,type)),GL_INVALID_ENUM);
+ SET_ERROR_IF(!GLESv2Validate::pixelFrmt(ctx,internalformat), GL_INVALID_VALUE);
SET_ERROR_IF((format == GL_DEPTH_COMPONENT || internalformat == GL_DEPTH_COMPONENT) &&
(type != GL_UNSIGNED_SHORT && type != GL_UNSIGNED_INT), GL_INVALID_OPERATION);
@@ -1813,8 +1814,9 @@ GL_APICALL void GL_APIENTRY glTexParameteriv(GLenum target, GLenum pname, const
GL_APICALL void GL_APIENTRY glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels){
GET_CTX();
- SET_ERROR_IF(!(GLESv2Validate::textureTargetEx(target) &&
- GLESv2Validate::pixelFrmt(ctx,format)&&
+ SET_ERROR_IF(!(GLESv2Validate::textureTargetEx(target)), GL_INVALID_ENUM);
+ SET_ERROR_IF(width < 0 || height < 0, GL_INVALID_VALUE);
+ SET_ERROR_IF(!(GLESv2Validate::pixelFrmt(ctx,format)&&
GLESv2Validate::pixelType(ctx,type)),GL_INVALID_ENUM);
SET_ERROR_IF(!GLESv2Validate::pixelOp(format,type),GL_INVALID_OPERATION);
if (type==GL_HALF_FLOAT_OES)