aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Turner <digit@google.com>2015-07-13 21:34:58 +0000
committerandroid-build-merger <android-build-merger@google.com>2015-07-13 21:34:58 +0000
commit0551db912c957e2d680bfedf8024508efb284130 (patch)
tree1cbd1449cbf35b363fcc11a686635f538f8280a5
parent88a6f5c6b97abf43f1ce097f67c8508fd4f49909 (diff)
parent14861f378d6e81a5ea84f6c49aab21de4c7b5d93 (diff)
downloadqemu-0551db912c957e2d680bfedf8024508efb284130.tar.gz
Merge "Fix cube map textures issue" into studio-1.4-dev
automerge: 14861f3 * commit '14861f378d6e81a5ea84f6c49aab21de4c7b5d93': Fix cube map textures issue
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp2
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Validate.cpp13
-rw-r--r--distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Validate.h1
3 files changed, 16 insertions, 0 deletions
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp b/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp
index aceb9863f4..b274e896aa 100644
--- a/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp
+++ b/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp
@@ -419,6 +419,7 @@ GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D(GLenum target, GLint leve
GL_APICALL void GL_APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border){
GET_CTX();
SET_ERROR_IF(!(GLESv2Validate::pixelFrmt(ctx,internalformat) && GLESv2Validate::textureTargetEx(target)),GL_INVALID_ENUM);
+ SET_ERROR_IF((GLESv2Validate::textureIsCubeMap(target) && width != height), GL_INVALID_VALUE);
SET_ERROR_IF(border != 0,GL_INVALID_VALUE);
ctx->dispatcher().glCopyTexImage2D(target,level,internalformat,x,y,width,height,border);
}
@@ -1880,6 +1881,7 @@ GL_APICALL void GL_APIENTRY glTexImage2D(GLenum target, GLint level, GLint inte
GLESv2Validate::pixelType(ctx,type)),GL_INVALID_ENUM);
SET_ERROR_IF(!GLESv2Validate::pixelFrmt(ctx,internalformat), GL_INVALID_VALUE);
+ SET_ERROR_IF((GLESv2Validate::textureIsCubeMap(target) && width != height), 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);
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Validate.cpp b/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Validate.cpp
index b711317501..f971864586 100644
--- a/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Validate.cpp
+++ b/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Validate.cpp
@@ -182,3 +182,16 @@ bool GLESv2Validate::programParam(GLenum pname){
}
return false;
}
+
+bool GLESv2Validate::textureIsCubeMap(GLenum target){
+ switch(target){
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ return true;
+ }
+ return false;
+}
diff --git a/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Validate.h b/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Validate.h
index b7cd07de6c..66787783b8 100644
--- a/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Validate.h
+++ b/distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Validate.h
@@ -38,6 +38,7 @@ static bool pixelFrmt(GLEScontext* ctx,GLenum format);
static bool attribName(const GLchar* name);
static bool attribIndex(int index);
static bool programParam(GLenum pname);
+static bool textureIsCubeMap(GLenum target);
};
#endif