From 65f8c50cbb8dbf311d08c0389f50328d52bff26c Mon Sep 17 00:00:00 2001 From: Yochai Shefi Simchon Date: Thu, 28 Jul 2011 13:38:50 +0300 Subject: [PATCH] opengles emulator: add GL_OES_depth_texture extension Change-Id: I4f254be743b61ba00ebf58d136aa91f4eaf8b643 --- .../host/libs/Translator/GLES_V2/GLESv2Context.cpp | 2 +- .../host/libs/Translator/GLES_V2/GLESv2Imp.cpp | 6 ++++++ .../libs/Translator/GLES_V2/GLESv2Validate.cpp | 14 ++++++++++++++ .../host/libs/Translator/GLES_V2/GLESv2Validate.h | 2 ++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Context.cpp b/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Context.cpp index 38a758929..c369d485c 100644 --- a/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Context.cpp +++ b/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Context.cpp @@ -90,7 +90,7 @@ bool GLESv2Context::needConvert(GLESConversionArrays& cArrs,GLint first,GLsizei void GLESv2Context::initExtensionString() { *s_glExtensions = "GL_OES_EGL_image GL_OES_depth24 GL_OES_depth32 GL_OES_element_index_uint " "GL_OES_standard_derivatives GL_OES_texture_float GL_OES_texture_float_linear " - "GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture "; + "GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture "; if (s_glSupport.GL_ARB_HALF_FLOAT_PIXEL || s_glSupport.GL_NV_HALF_FLOAT) *s_glExtensions+="GL_OES_texture_half_float GL_OES_texture_half_float_linear "; if (s_glSupport.GL_EXT_PACKED_DEPTH_STENCIL) 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 4439782f4..e621364ab 100644 --- a/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp +++ b/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp @@ -1415,6 +1415,12 @@ GL_APICALL void GL_APIENTRY glTexImage2D(GLenum target, GLint level, GLint inte GLESv2Validate::pixelFrmt(ctx,format)&& GLESv2Validate::pixelType(ctx,type)),GL_INVALID_ENUM); + SET_ERROR_IF((format == GL_DEPTH_COMPONENT || internalformat == GL_DEPTH_COMPONENT) && + (type != GL_UNSIGNED_SHORT && type != GL_UNSIGNED_INT), GL_INVALID_OPERATION); + + SET_ERROR_IF((type == GL_UNSIGNED_SHORT || type == GL_UNSIGNED_INT) && + (format != GL_DEPTH_COMPONENT || internalformat != GL_DEPTH_COMPONENT), GL_INVALID_OPERATION); + SET_ERROR_IF(!(GLESv2Validate::pixelOp(format,type) && internalformat == ((GLint)format)),GL_INVALID_OPERATION); SET_ERROR_IF(border != 0,GL_INVALID_VALUE); diff --git a/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Validate.cpp b/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Validate.cpp index 429877c3f..050cd2b12 100644 --- a/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Validate.cpp +++ b/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Validate.cpp @@ -140,3 +140,17 @@ bool GLESv2Validate::precisionType(GLenum type){ bool GLESv2Validate::arrayIndex(GLEScontext * ctx,GLuint index) { return index < (GLuint)ctx->getCaps()->maxVertexAttribs; } + +bool GLESv2Validate::pixelType(GLEScontext * ctx,GLenum type) { + if(type == GL_UNSIGNED_SHORT || type == GL_UNSIGNED_INT) + return true; + + return GLESvalidate::pixelType(ctx, type); +} + +bool GLESv2Validate::pixelFrmt(GLEScontext* ctx,GLenum format) { + if(format == GL_DEPTH_COMPONENT) + return true; + + return GLESvalidate::pixelFrmt(ctx, format); +} diff --git a/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Validate.h b/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Validate.h index f6212e863..f34e2d8a6 100644 --- a/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Validate.h +++ b/tools/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Validate.h @@ -33,6 +33,8 @@ static bool readPixelFrmt(GLenum format); static bool shaderType(GLenum type); static bool precisionType(GLenum type); static bool arrayIndex(GLEScontext * ctx,GLuint index); +static bool pixelType(GLEScontext * ctx,GLenum type); +static bool pixelFrmt(GLEScontext* ctx,GLenum format); }; #endif