Bug 724476 - Add ANGLE patch file for impl. readpixel format BGRA - r=bjacob
authorJeff Gilbert <jgilbert@mozilla.com>
Fri, 24 Feb 2012 14:37:06 -0800
changeset 87703 b4d48afb5859a9fb6428cfa6748ab6bdf9ebb486
parent 87702 388d3a2c8f12a59fc644353915f0f0ba64a965d7
child 87704 51830afab77b861380c587f606227893fa9fe214
push id560
push usertim.taubert@gmx.de
push dateSun, 26 Feb 2012 18:17:04 +0000
treeherderfx-team@fecf5879cbf1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbjacob
bugs724476
milestone13.0a1
Bug 724476 - Add ANGLE patch file for impl. readpixel format BGRA - r=bjacob
gfx/angle/README.mozilla
gfx/angle/angle-impl-read-bgra.patch
--- a/gfx/angle/README.mozilla
+++ b/gfx/angle/README.mozilla
@@ -6,16 +6,17 @@ Current revision: r963
 
 In this order:
   angle-renaming-debug.patch - rename debug.h to compilerdebug.h to avoid conflict in our makefiles
   angle-intrinsic-msvc2005.patch - work around a MSVC 2005 compile error
   angle-limit-identifiers-to-250-chars.patch - see bug 675625
   angle-use-xmalloc.patch - see bug 680840. Can drop this patch whenever the new preprocessor lands.
   angle-castrate-bug-241.patch - see bug 699033 / angle bug 241
   angle-enforce-readpixels-spec.patch - see bug 724476.
+  angle-impl-read-bgra.patch - see bug 724476.
 
 In addition to these patches, the Makefile.in files are ours, they're not present in upsteam ANGLE.
 
 == How to update this ANGLE copy ==
 
 1. Unapply patches
 2. Apply diff with new ANGLE version
 3. Reapply patches.
new file mode 100644
--- /dev/null
+++ b/gfx/angle/angle-impl-read-bgra.patch
@@ -0,0 +1,71 @@
+From: Jeff Gilbert <jgilbert@mozilla.com>
+Bug 724476 - ANGLE Bug 294 - Use BGRA/UBYTE as exposed fast format/type for readPixels
+
+diff --git a/gfx/angle/src/libGLESv2/Context.cpp b/gfx/angle/src/libGLESv2/Context.cpp
+--- a/gfx/angle/src/libGLESv2/Context.cpp
++++ b/gfx/angle/src/libGLESv2/Context.cpp
+@@ -2520,16 +2520,17 @@ void Context::readPixels(GLint x, GLint 
+     {
+         if (desc.Format == D3DFMT_A8R8G8B8 &&
+             format == GL_BGRA_EXT &&
+             type == GL_UNSIGNED_BYTE)
+         {
+             // Fast path for EXT_read_format_bgra, given
+             // an RGBA source buffer.  Note that buffers with no
+             // alpha go through the slow path below.
++            // Note that this is also the combo exposed by IMPLEMENTATION_COLOR_READ_TYPE/FORMAT
+             memcpy(dest + j * outputPitch,
+                    source + j * inputPitch,
+                    (rect.right - rect.left) * 4);
+             continue;
+         }
+ 
+         for (int i = 0; i < rect.right - rect.left; i++)
+         {
+@@ -2666,20 +2667,20 @@ void Context::readPixels(GLint x, GLint 
+                         ((unsigned short)(     a + 0.5f) << 15) |
+                         ((unsigned short)(31 * r + 0.5f) << 10) |
+                         ((unsigned short)(31 * g + 0.5f) << 5) |
+                         ((unsigned short)(31 * b + 0.5f) << 0);
+                     break;
+                   default: UNREACHABLE();
+                 }
+                 break;
+-              case GL_RGB:   // IMPLEMENTATION_COLOR_READ_FORMAT
++              case GL_RGB:
+                 switch (type)
+                 {
+-                  case GL_UNSIGNED_SHORT_5_6_5:   // IMPLEMENTATION_COLOR_READ_TYPE
++                  case GL_UNSIGNED_SHORT_5_6_5:
+                     dest16[i + j * outputPitch / sizeof(unsigned short)] = 
+                         ((unsigned short)(31 * b + 0.5f) << 0) |
+                         ((unsigned short)(63 * g + 0.5f) << 5) |
+                         ((unsigned short)(31 * r + 0.5f) << 11);
+                     break;
+                   default: UNREACHABLE();
+                 }
+                 break;
+diff --git a/gfx/angle/src/libGLESv2/Context.h b/gfx/angle/src/libGLESv2/Context.h
+--- a/gfx/angle/src/libGLESv2/Context.h
++++ b/gfx/angle/src/libGLESv2/Context.h
+@@ -69,18 +69,18 @@ enum
+     MAX_VARYING_VECTORS_SM3 = 10,
+     MAX_TEXTURE_IMAGE_UNITS = 16,
+     MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF = 4,   // For devices supporting vertex texture fetch
+     MAX_COMBINED_TEXTURE_IMAGE_UNITS_VTF = MAX_TEXTURE_IMAGE_UNITS + MAX_VERTEX_TEXTURE_IMAGE_UNITS_VTF,    
+     MAX_FRAGMENT_UNIFORM_VECTORS_SM2 = 32 - 3,    // Reserve space for dx_Coord, dx_Depth, and dx_DepthRange. dx_PointOrLines and dx_FrontCCW use separate bool registers.
+     MAX_FRAGMENT_UNIFORM_VECTORS_SM3 = 224 - 3,
+     MAX_DRAW_BUFFERS = 1,
+ 
+-    IMPLEMENTATION_COLOR_READ_FORMAT = GL_RGB,
+-    IMPLEMENTATION_COLOR_READ_TYPE = GL_UNSIGNED_SHORT_5_6_5
++    IMPLEMENTATION_COLOR_READ_FORMAT = GL_BGRA_EXT,
++    IMPLEMENTATION_COLOR_READ_TYPE = GL_UNSIGNED_BYTE
+ };
+ 
+ enum QueryType
+ {
+     QUERY_ANY_SAMPLES_PASSED,
+     QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE,
+ 
+     QUERY_TYPE_COUNT