aboutsummaryrefslogtreecommitdiffstats
path: root/emulator
diff options
context:
space:
mode:
authorbohu <bohu@google.com>2014-10-29 09:47:20 -0700
committerbohu <bohu@google.com>2014-11-25 12:31:49 -0800
commit6f568b0d164d90cd7efd9c1d225e5990dead1ba7 (patch)
tree41bcbf72ed7b77be22c655f693e088b874ad5a1a /emulator
parent64a5506fd2dc6e3b1adf17ddd928a66a4756c96f (diff)
downloadsdk-6f568b0d164d90cd7efd9c1d225e5990dead1ba7.zip
sdk-6f568b0d164d90cd7efd9c1d225e5990dead1ba7.tar.gz
sdk-6f568b0d164d90cd7efd9c1d225e5990dead1ba7.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')
-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 0ee71ef..8ab75c7 100644
--- a/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp
+++ b/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp
@@ -390,6 +390,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,
@@ -1839,10 +1840,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);
@@ -1913,8 +1914,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)