diff --git a/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp b/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp index b0ef13182..9cc5f748c 100644 --- a/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp +++ b/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp @@ -323,7 +323,7 @@ GL_API void GL_APIENTRY glBindTexture( GLenum target, GLuint texture) { if (texData->target==0) texData->target = target; //if texture was already bound to another target - SET_ERROR_IF(texData->target!=target,GL_INVALID_OPERATION); + SET_ERROR_IF(ctx->GLTextureTargetToLocal(texData->target) != ctx->GLTextureTargetToLocal(target), GL_INVALID_OPERATION); texData->wasBound = true; } @@ -532,7 +532,7 @@ GL_API void GL_APIENTRY glDisable( GLenum cap) { ctx->dispatcher().glDisable(GL_TEXTURE_GEN_T); ctx->dispatcher().glDisable(GL_TEXTURE_GEN_R); } - ctx->dispatcher().glDisable(cap); + else ctx->dispatcher().glDisable(cap); if (cap==GL_TEXTURE_2D || cap==GL_TEXTURE_CUBE_MAP_OES) ctx->setTextureEnabled(cap,false); } @@ -1849,9 +1849,9 @@ GL_API void GL_APIENTRY glTexGenfOES (GLenum coord, GLenum pname, GLfloat param) GET_CTX() SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM); if (coord == GL_TEXTURE_GEN_STR_OES) { - ctx->dispatcher().glTexGenf(GL_TEXTURE_GEN_S,pname,param); - ctx->dispatcher().glTexGenf(GL_TEXTURE_GEN_T,pname,param); - ctx->dispatcher().glTexGenf(GL_TEXTURE_GEN_R,pname,param); + ctx->dispatcher().glTexGenf(GL_S,pname,param); + ctx->dispatcher().glTexGenf(GL_T,pname,param); + ctx->dispatcher().glTexGenf(GL_R,pname,param); } else ctx->dispatcher().glTexGenf(coord,pname,param); @@ -1861,9 +1861,9 @@ GL_API void GL_APIENTRY glTexGenfvOES (GLenum coord, GLenum pname, const GLfloat GET_CTX() SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM); if (coord == GL_TEXTURE_GEN_STR_OES) { - ctx->dispatcher().glTexGenfv(GL_TEXTURE_GEN_S,pname,params); - ctx->dispatcher().glTexGenfv(GL_TEXTURE_GEN_T,pname,params); - ctx->dispatcher().glTexGenfv(GL_TEXTURE_GEN_R,pname,params); + ctx->dispatcher().glTexGenfv(GL_S,pname,params); + ctx->dispatcher().glTexGenfv(GL_T,pname,params); + ctx->dispatcher().glTexGenfv(GL_R,pname,params); } else ctx->dispatcher().glTexGenfv(coord,pname,params); @@ -1872,9 +1872,9 @@ GL_API void GL_APIENTRY glTexGeniOES (GLenum coord, GLenum pname, GLint param) { GET_CTX() SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM); if (coord == GL_TEXTURE_GEN_STR_OES) { - ctx->dispatcher().glTexGeni(GL_TEXTURE_GEN_S,pname,param); - ctx->dispatcher().glTexGeni(GL_TEXTURE_GEN_T,pname,param); - ctx->dispatcher().glTexGeni(GL_TEXTURE_GEN_R,pname,param); + ctx->dispatcher().glTexGeni(GL_S,pname,param); + ctx->dispatcher().glTexGeni(GL_T,pname,param); + ctx->dispatcher().glTexGeni(GL_R,pname,param); } else ctx->dispatcher().glTexGeni(coord,pname,param); @@ -1883,9 +1883,9 @@ GL_API void GL_APIENTRY glTexGenivOES (GLenum coord, GLenum pname, const GLint * GET_CTX() SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM); if (coord == GL_TEXTURE_GEN_STR_OES) { - ctx->dispatcher().glTexGeniv(GL_TEXTURE_GEN_S,pname,params); - ctx->dispatcher().glTexGeniv(GL_TEXTURE_GEN_T,pname,params); - ctx->dispatcher().glTexGeniv(GL_TEXTURE_GEN_R,pname,params); + ctx->dispatcher().glTexGeniv(GL_S,pname,params); + ctx->dispatcher().glTexGeniv(GL_T,pname,params); + ctx->dispatcher().glTexGeniv(GL_R,pname,params); } else ctx->dispatcher().glTexGeniv(coord,pname,params); @@ -1894,9 +1894,9 @@ GL_API void GL_APIENTRY glTexGenxOES (GLenum coord, GLenum pname, GLfixed param) GET_CTX() SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM); if (coord == GL_TEXTURE_GEN_STR_OES) { - ctx->dispatcher().glTexGenf(GL_TEXTURE_GEN_S,pname,X2F(param)); - ctx->dispatcher().glTexGenf(GL_TEXTURE_GEN_T,pname,X2F(param)); - ctx->dispatcher().glTexGenf(GL_TEXTURE_GEN_R,pname,X2F(param)); + ctx->dispatcher().glTexGenf(GL_S,pname,X2F(param)); + ctx->dispatcher().glTexGenf(GL_T,pname,X2F(param)); + ctx->dispatcher().glTexGenf(GL_R,pname,X2F(param)); } else ctx->dispatcher().glTexGenf(coord,pname,X2F(param)); @@ -1907,9 +1907,9 @@ GL_API void GL_APIENTRY glTexGenxvOES (GLenum coord, GLenum pname, const GLfixed SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM); tmpParams[0] = X2F(params[0]); if (coord == GL_TEXTURE_GEN_STR_OES) { - ctx->dispatcher().glTexGenfv(GL_TEXTURE_GEN_S,pname,tmpParams); - ctx->dispatcher().glTexGenfv(GL_TEXTURE_GEN_T,pname,tmpParams); - ctx->dispatcher().glTexGenfv(GL_TEXTURE_GEN_R,pname,tmpParams); + ctx->dispatcher().glTexGenfv(GL_S,pname,tmpParams); + ctx->dispatcher().glTexGenfv(GL_T,pname,tmpParams); + ctx->dispatcher().glTexGenfv(GL_R,pname,tmpParams); } else ctx->dispatcher().glTexGenfv(coord,pname,tmpParams); @@ -1922,9 +1922,9 @@ GL_API void GL_APIENTRY glGetTexGenfvOES (GLenum coord, GLenum pname, GLfloat *p GLfloat state_s = GL_FALSE; GLfloat state_t = GL_FALSE; GLfloat state_r = GL_FALSE; - ctx->dispatcher().glGetTexGenfv(GL_TEXTURE_GEN_S,pname,&state_s); - ctx->dispatcher().glGetTexGenfv(GL_TEXTURE_GEN_T,pname,&state_t); - ctx->dispatcher().glGetTexGenfv(GL_TEXTURE_GEN_R,pname,&state_r); + ctx->dispatcher().glGetTexGenfv(GL_S,pname,&state_s); + ctx->dispatcher().glGetTexGenfv(GL_T,pname,&state_t); + ctx->dispatcher().glGetTexGenfv(GL_R,pname,&state_r); *params = state_s && state_t && state_r ? GL_TRUE: GL_FALSE; } else @@ -1938,9 +1938,9 @@ GL_API void GL_APIENTRY glGetTexGenivOES (GLenum coord, GLenum pname, GLint *par GLint state_s = GL_FALSE; GLint state_t = GL_FALSE; GLint state_r = GL_FALSE; - ctx->dispatcher().glGetTexGeniv(GL_TEXTURE_GEN_S,pname,&state_s); - ctx->dispatcher().glGetTexGeniv(GL_TEXTURE_GEN_T,pname,&state_t); - ctx->dispatcher().glGetTexGeniv(GL_TEXTURE_GEN_R,pname,&state_r); + ctx->dispatcher().glGetTexGeniv(GL_S,pname,&state_s); + ctx->dispatcher().glGetTexGeniv(GL_T,pname,&state_t); + ctx->dispatcher().glGetTexGeniv(GL_R,pname,&state_r); *params = state_s && state_t && state_r ? GL_TRUE: GL_FALSE; } else diff --git a/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmValidate.cpp b/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmValidate.cpp index 65a512216..1970232c7 100644 --- a/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmValidate.cpp +++ b/tools/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmValidate.cpp @@ -116,7 +116,7 @@ bool GLEScmValidate::texParams(GLenum target,GLenum pname) { default: return false; } - return target == GL_TEXTURE_2D; + return (target == GL_TEXTURE_2D)||(target == GL_TEXTURE_CUBE_MAP_OES); } bool GLEScmValidate::texEnv(GLenum target,GLenum pname) { diff --git a/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp b/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp index e621364ab..6f5fa9bfe 100644 --- a/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp +++ b/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp @@ -244,7 +244,7 @@ GL_APICALL void GL_APIENTRY glBindTexture(GLenum target, GLuint texture){ if (texData->target==0) texData->target = target; //if texture was already bound to another target - SET_ERROR_IF(texData->target !=target,GL_INVALID_OPERATION); + SET_ERROR_IF(ctx->GLTextureTargetToLocal(texData->target) != ctx->GLTextureTargetToLocal(target), GL_INVALID_OPERATION); texData->wasBound = true; } diff --git a/tools/emulator/opengl/host/libs/Translator/include/GLcommon/GLEScontext.h b/tools/emulator/opengl/host/libs/Translator/include/GLcommon/GLEScontext.h index 66e900359..e87125e10 100644 --- a/tools/emulator/opengl/host/libs/Translator/include/GLcommon/GLEScontext.h +++ b/tools/emulator/opengl/host/libs/Translator/include/GLcommon/GLEScontext.h @@ -143,6 +143,7 @@ public: static int getMaxTexSize(){return s_glSupport.maxTexSize;} static Version glslVersion(){return s_glSupport.glslVersion;} static bool isAutoMipmapSupported(){return s_glSupport.GL_SGIS_GENERATE_MIPMAP;} + static TextureTarget GLTextureTargetToLocal(GLenum target); virtual bool glGetIntegerv(GLenum pname, GLint *params); virtual bool glGetBooleanv(GLenum pname, GLboolean *params); @@ -170,7 +171,6 @@ private: virtual void setupArr(const GLvoid* arr,GLenum arrayType,GLenum dataType,GLint size,GLsizei stride, GLboolean normalized, int pointsIndex = -1) = 0 ; GLuint getBuffer(GLenum target); - TextureTarget GLTextureTargetToLocal(GLenum target); ShareGroupPtr m_shareGroup; GLenum m_glError; diff --git a/tools/emulator/opengl/host/libs/Translator/include/GLcommon/gldefs.h b/tools/emulator/opengl/host/libs/Translator/include/GLcommon/gldefs.h index 24e4a23e3..23a2923ce 100644 --- a/tools/emulator/opengl/host/libs/Translator/include/GLcommon/gldefs.h +++ b/tools/emulator/opengl/host/libs/Translator/include/GLcommon/gldefs.h @@ -17,6 +17,10 @@ typedef double GLclampd; /* double precision float in [0,1] */ typedef double GLdouble; /* double precision float */ +#define GL_S 0x2000 +#define GL_T 0x2001 +#define GL_R 0x2002 +#define GL_Q 0x2003 #define GL_TEXTURE_GEN_S 0x0C60 #define GL_TEXTURE_GEN_T 0x0C61 #define GL_TEXTURE_GEN_R 0x0C62