author | Chris Lord <chrislord.net@gmail.com> |
Wed, 31 Aug 2011 18:25:25 +0100 | |
changeset 77653 | 891e5dbae3ec7f84ee003213e6377b2602066119 |
parent 77652 | 5a7e488482a5e1a23bbc9ea07a36a92894a1fec2 |
child 77654 | 5c4506fdbde9047caa1f63facecb4d30c48c4bee |
child 77655 | 5d5f7f13f0ba9cf42024ca57108bd974aae37c34 |
push id | 78 |
push user | clegnitto@mozilla.com |
push date | Fri, 16 Dec 2011 17:32:24 +0000 |
treeherder | mozilla-release@79d24e644fdd [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | joe |
bugs | 683514 |
milestone | 9.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
gfx/thebes/GLContext.cpp | file | annotate | diff | comparison | revisions | |
gfx/thebes/GLContext.h | file | annotate | diff | comparison | revisions |
--- a/gfx/thebes/GLContext.cpp +++ b/gfx/thebes/GLContext.cpp @@ -431,16 +431,17 @@ static const char *sExtensionNames[] = { "GL_IMG_read_format", "GL_EXT_read_format_bgra", "GL_APPLE_client_storage", "GL_ARB_texture_non_power_of_two", "GL_ARB_pixel_buffer_object", "GL_ARB_ES2_compatibility", "GL_OES_texture_float", "GL_ARB_texture_float", + "GL_EXT_unpack_subimage", NULL }; void GLContext::InitExtensions() { MakeCurrent(); const GLubyte *extensions = fGetString(LOCAL_GL_EXTENSIONS); @@ -1834,19 +1835,27 @@ GLContext::TexImage2D(GLenum target, GLi GLint pixelsize, GLint border, GLenum format, GLenum type, const GLvoid *pixels) { fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT, NS_MIN(GetAddressAlignment((ptrdiff_t)pixels), GetAddressAlignment((ptrdiff_t)stride))); #ifndef USE_GLES2 - fPixelStorei(LOCAL_GL_UNPACK_ROW_LENGTH, stride/pixelsize); + bool useUnpackRowLength = true; #else - if (stride != width * pixelsize) { + // A Khronos extension, GL_EXT_unpack_subimage, that restores support + // for GL_UNPACK_ROW_LENGTH, GL_UNPACK_SKIP_ROWS and GL_UNPACK_SKIP_PIXELS + // exists on Tegra 2 (and possibly other chipsets) + bool useUnpackRowLength = IsExtensionSupported(EXT_unpack_subimage); +#endif + + if (useUnpackRowLength) + fPixelStorei(LOCAL_GL_UNPACK_ROW_LENGTH, stride/pixelsize); + else if (stride != width * pixelsize) { // Not using the whole row of texture data and GLES doesn't // support GL_UNPACK_ROW_LENGTH. We need to upload each row // separately. fTexImage2D(target, border, internalformat, width, height, @@ -1868,31 +1877,29 @@ GLContext::TexImage2D(GLenum target, GLi row); row += stride; } fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT, 4); return; } -#endif fTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); -#ifndef USE_GLES2 - fPixelStorei(LOCAL_GL_UNPACK_ROW_LENGTH, 0); -#endif + if (useUnpackRowLength) + fPixelStorei(LOCAL_GL_UNPACK_ROW_LENGTH, 0); fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT, 4); } void GLContext::TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLsizei stride, GLint pixelsize, GLenum format,
--- a/gfx/thebes/GLContext.h +++ b/gfx/thebes/GLContext.h @@ -975,16 +975,17 @@ public: IMG_read_format, EXT_read_format_bgra, APPLE_client_storage, ARB_texture_non_power_of_two, ARB_pixel_buffer_object, ARB_ES2_compatibility, OES_texture_float, ARB_texture_float, + EXT_unpack_subimage, Extensions_Max }; PRBool IsExtensionSupported(GLExtensions aKnownExtension) { return mAvailableExtensions[aKnownExtension]; } // for unknown extensions