From 98fbf8a9d670f951b6ca1453e09288784078116f Mon Sep 17 00:00:00 2001 From: bohu Date: Wed, 29 Oct 2014 09:47:20 -0700 Subject: 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 --- emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'emulator/opengl') diff --git a/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp b/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp index fe64f6f43..cbec552c6 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) -- cgit v1.2.3