Changeset 109173 in webkit
- Timestamp:
- Feb 28, 2012 5:17:27 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r109171 r109173 1 2012-02-28 Kenneth Russell <kbr@google.com> 2 3 [chromium] Work around IOSurface-related corruption during readback 4 https://bugs.webkit.org/show_bug.cgi?id=79735 5 6 Reviewed by James Robinson. 7 8 Copy the compositor's IOSurface-backed output into a temporary 9 texture and perform the ReadPixels operation against that texture. 10 11 It is infeasible to write an automated test for this issue. 12 Tested manually by performing print preview multiple times against 13 pages containing WebGL content on 10.7 and observing that the 14 corruption in the output is no longer present. 15 16 * platform/graphics/chromium/LayerRendererChromium.cpp: 17 (WebCore::LayerRendererChromium::getFramebufferPixels): 18 1 19 2012-02-28 Adrienne Walker <enne@google.com> 2 20 -
trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
r109168 r109173 136 136 #endif 137 137 138 bool needsLionIOSurfaceReadbackWorkaround() 139 { 140 #if OS(DARWIN) 141 static SInt32 systemVersion = 0; 142 if (!systemVersion) { 143 if (Gestalt(gestaltSystemVersion, &systemVersion) != noErr) 144 return false; 145 } 146 147 return systemVersion >= 0x1070; 148 #else 149 return false; 150 #endif 151 } 152 138 153 } // anonymous namespace 139 154 … … 1060 1075 makeContextCurrent(); 1061 1076 1062 GLC(m_context.get(), m_context->readPixels(rect.x(), rect.y(), rect.width(), rect.height(), 1063 GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixels)); 1077 bool doWorkaround = needsLionIOSurfaceReadbackWorkaround(); 1078 1079 Platform3DObject temporaryTexture = NullPlatform3DObject; 1080 Platform3DObject temporaryFBO = NullPlatform3DObject; 1081 GraphicsContext3D* context = m_context.get(); 1082 1083 if (doWorkaround) { 1084 // On Mac OS X 10.7, calling glReadPixels against an FBO whose color attachment is an 1085 // IOSurface-backed texture causes corruption of future glReadPixels calls, even those on 1086 // different OpenGL contexts. It is believed that this is the root cause of top crasher 1087 // http://crbug.com/99393. <rdar://problem/10949687> 1088 1089 temporaryTexture = context->createTexture(); 1090 GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, temporaryTexture)); 1091 GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); 1092 GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); 1093 GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE)); 1094 GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE)); 1095 // Copy the contents of the current (IOSurface-backed) framebuffer into a temporary texture. 1096 GLC(context, context->copyTexImage2D(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, 0, 0, rect.maxX(), rect.maxY(), 0)); 1097 temporaryFBO = context->createFramebuffer(); 1098 // Attach this texture to an FBO, and perform the readback from that FBO. 1099 GLC(context, context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, temporaryFBO)); 1100 GLC(context, context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, temporaryTexture, 0)); 1101 1102 ASSERT(context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) == GraphicsContext3D::FRAMEBUFFER_COMPLETE); 1103 } 1104 1105 GLC(context, context->readPixels(rect.x(), rect.y(), rect.width(), rect.height(), 1106 GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixels)); 1107 1108 if (doWorkaround) { 1109 // Clean up. 1110 GLC(context, context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0)); 1111 GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0)); 1112 GLC(context, context->deleteFramebuffer(temporaryFBO)); 1113 GLC(context, context->deleteTexture(temporaryTexture)); 1114 } 1064 1115 } 1065 1116
Note: See TracChangeset
for help on using the changeset viewer.