Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Add support for the BGRA OpenGL extension to the B2G emulator
Browse files Browse the repository at this point in the history
  • Loading branch information
Benoit Jacob authored and vicamo committed Jan 13, 2014
1 parent 86de8a9 commit 0951179
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Expand Up @@ -154,6 +154,8 @@ void GLESv2Context::initExtensionString() {
*s_glExtensions+="GL_OES_vertex_half_float ";
if (s_glSupport.GL_OES_STANDARD_DERIVATIVES)
*s_glExtensions+="GL_OES_standard_derivatives ";
if (s_glSupport.GL_EXT_TEXTURE_FORMAT_BGRA8888)
*s_glExtensions+="GL_EXT_texture_format_BGRA8888 ";
}

int GLESv2Context::getMaxTexUnits() {
Expand Down
7 changes: 7 additions & 0 deletions emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp
Expand Up @@ -1777,6 +1777,13 @@ GL_APICALL void GL_APIENTRY glTexImage2D(GLenum target, GLint level, GLint inte
type = GL_HALF_FLOAT_NV;
if (pixels==NULL && type==GL_UNSIGNED_SHORT_5_5_5_1)
type = GL_UNSIGNED_SHORT;
if (internalformat == GL_BGRA_EXT) {
// On non-ES OpenGL, contrary to OpenGL ES, internalformat cannot be BGRA;
// instead, one is supposed to use internalformat=RGBA with format=BGRA.
// This code assumes non-ES OpenGL; will have to be avoided if ever ported
// to OpenGL ES.
internalformat = GL_RGBA;
}
ctx->dispatcher().glTexImage2D(target,level,internalformat,width,height,border,format,type,pixels);
}

Expand Down

0 comments on commit 0951179

Please sign in to comment.