Changeset 114961 in webkit
- Timestamp:
- Apr 23, 2012, 4:22:03 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r114959 r114961 1 2012-04-23 Zhenyao Mo <zmo@google.com> 2 3 framebuffer binding should not be changed after canvas resize or compositing 4 https://bugs.webkit.org/show_bug.cgi?id=84609 5 6 Reviewed by Kenneth Russell. 7 8 * fast/canvas/webgl/framebuffer-bindings-unaffected-on-resize-expected.txt: Added. 9 * fast/canvas/webgl/framebuffer-bindings-unaffected-on-resize.html: Added. 10 * fast/canvas/webgl/resources/webgl-test-utils.js: Sync with khronos side (partial) 11 (WebGLTestUtils.): 12 (WebGLTestUtils): 13 1 14 2012-04-23 Oliver Hunt <oliver@apple.com> 2 15 -
trunk/LayoutTests/fast/canvas/webgl/resources/webgl-test-utils.js
r114935 r114961 1105 1105 }; 1106 1106 1107 /** 1108 * Provides requestAnimationFrame in a cross browser way. 1109 */ 1110 var requestAnimFrameImpl_; 1111 1112 var requestAnimFrame = function(callback, element) { 1113 if (!requestAnimFrameImpl_) { 1114 requestAnimFrameImpl_ = function() { 1115 var functionNames = [ 1116 "requestAnimationFrame", 1117 "webkitRequestAnimationFrame", 1118 "mozRequestAnimationFrame", 1119 "oRequestAnimationFrame", 1120 "msRequestAnimationFrame" 1121 ]; 1122 for (var jj = 0; jj < functionNames.length; ++jj) { 1123 var functionName = functionNames[jj]; 1124 if (window[functionName]) { 1125 return function(name) { 1126 return function(callback, element) { 1127 return window[name].call(window, callback, element); 1128 }; 1129 }(functionName); 1130 } 1131 } 1132 return function(callback, element) { 1133 return window.setTimeout(callback, 1000 / 70); 1134 }; 1135 }(); 1136 } 1137 1138 return requestAnimFrameImpl_(callback, element); 1139 }; 1140 1141 /** 1142 * Provides cancelAnimationFrame in a cross browser way. 1143 */ 1144 var cancelAnimFrame = (function() { 1145 return window.cancelAnimationFrame || 1146 window.webkitCancelAnimationFrame || 1147 window.mozCancelAnimationFrame || 1148 window.oCancelAnimationFrame || 1149 window.msCancelAnimationFrame || 1150 window.clearTimeout; 1151 })(); 1152 1153 var waitFrames = function(frames, callback) { 1154 var countDown = function() { 1155 if (frames == 0) { 1156 callback(); 1157 } else { 1158 --frames; 1159 requestAnimFrame(countDown); 1160 } 1161 }; 1162 countDown(); 1163 }; 1164 1107 1165 return { 1166 cancelAnimFrame: cancelAnimFrame, 1108 1167 create3DContext: create3DContext, 1109 1168 create3DContextWithWrapperThatThrowsOnGLError: … … 1148 1207 readFile: readFile, 1149 1208 readFileList: readFileList, 1209 requestAnimFrame: requestAnimFrame, 1210 waitFrames: waitFrames, 1150 1211 1151 1212 none: false -
trunk/Source/WebCore/ChangeLog
r114957 r114961 1 2012-04-23 Zhenyao Mo <zmo@google.com> 2 3 framebuffer binding should not be changed after canvas resize or compositing 4 https://bugs.webkit.org/show_bug.cgi?id=84609 5 6 Reviewed by Kenneth Russell. 7 8 Test: fast/canvas/webgl/framebuffer-bindings-unaffected-on-resize.html 9 10 * html/canvas/WebGLRenderingContext.cpp: set framebuffer binding to DrawingBuffer. 11 (WebCore): 12 (WebCore::WebGLRenderingContext::bindFramebuffer): 13 (WebCore::WebGLRenderingContext::deleteFramebuffer): 14 (WebCore::WebGLRenderingContext::loseContextImpl): 15 * platform/graphics/cairo/DrawingBufferCairo.cpp: initialize m_framebufferBinding. 16 (WebCore::DrawingBuffer::DrawingBuffer): 17 * platform/graphics/chromium/DrawingBufferChromium.cpp: Ditto. 18 (WebCore::DrawingBuffer::DrawingBuffer): 19 * platform/graphics/chromium/WebGLLayerChromium.cpp: Recover framebuffer binding after update(). 20 (WebCore::WebGLLayerChromium::update): 21 * platform/graphics/gpu/DrawingBuffer.cpp: Add a function to restore framebuffer binding. 22 (WebCore::DrawingBuffer::restoreFramebufferBinding): 23 (WebCore): 24 * platform/graphics/gpu/DrawingBuffer.h: Ditto. 25 (WebCore::DrawingBuffer::setTexture2DBinding): 26 (DrawingBuffer): 27 (WebCore::DrawingBuffer::setFramebufferBinding): 28 * platform/graphics/gpu/mac/DrawingBufferMac.mm: initialize m_framebufferBinding. 29 (WebCore::DrawingBuffer::DrawingBuffer): 30 * platform/graphics/gpu/qt/DrawingBufferQt.cpp: initialize m_framebufferBinding. 31 (WebCore::DrawingBuffer::DrawingBuffer): 32 1 33 2012-04-23 Victor Carbune <vcarbune@adobe.com> 2 34 -
trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
r114935 r114961 921 921 } 922 922 m_framebufferBinding = buffer; 923 if (m_drawingBuffer) 924 m_drawingBuffer->setFramebufferBinding(objectOrZero(m_framebufferBinding.get())); 923 925 if (!m_framebufferBinding && m_drawingBuffer) { 924 926 // Instead of binding fb 0, bind the drawing buffer. … … 1534 1536 if (framebuffer == m_framebufferBinding) { 1535 1537 m_framebufferBinding = 0; 1536 // Have to call bindFramebuffer here to bind back to internal fbo. 1537 if (m_drawingBuffer) 1538 if (m_drawingBuffer) { 1539 m_drawingBuffer->setFramebufferBinding(0); 1540 // Have to call bindFramebuffer here to bind back to internal fbo. 1538 1541 m_drawingBuffer->bind(); 1539 else1542 } else 1540 1543 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, 0); 1541 1544 } … … 4308 4311 4309 4312 if (m_drawingBuffer) { 4310 // Make absolutely sure we do not refer to an already-deleted texture .4313 // Make absolutely sure we do not refer to an already-deleted texture or framebuffer. 4311 4314 m_drawingBuffer->setTexture2DBinding(0); 4315 m_drawingBuffer->setFramebufferBinding(0); 4312 4316 } 4313 4317 -
trunk/Source/WebCore/platform/graphics/cairo/DrawingBufferCairo.cpp
r114935 r114961 44 44 , m_scissorEnabled(false) 45 45 , m_texture2DBinding(0) 46 , m_framebufferBinding(0) 46 47 , m_activeTextureUnit(GraphicsContext3D::TEXTURE0) 47 48 , m_context(context) -
trunk/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
r114935 r114961 70 70 , m_scissorEnabled(false) 71 71 , m_texture2DBinding(0) 72 , m_framebufferBinding(0) 72 73 , m_activeTextureUnit(GraphicsContext3D::TEXTURE0) 73 74 , m_context(context) -
trunk/Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp
r114935 r114961 87 87 if (m_drawingBuffer->requiresCopyFromBackToFrontBuffer()) 88 88 updater.appendCopy(m_drawingBuffer->colorBuffer(), m_textureId, bounds()); 89 90 m_drawingBuffer->restoreFramebufferBinding(); 89 91 } 90 92 -
trunk/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp
r114935 r114961 337 337 } 338 338 339 void DrawingBuffer::restoreFramebufferBinding() 340 { 341 if (!m_context || !m_framebufferBinding) 342 return; 343 344 m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_framebufferBinding); 345 } 346 339 347 bool DrawingBuffer::multisample() const 340 348 { -
trunk/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h
r114935 r114961 100 100 // The DrawingBuffer needs to track the texture bound to texture unit 0. 101 101 // The bound texture is tracked to avoid costly queries during rendering. 102 void setTexture2DBinding(GC3Dint texture) { m_texture2DBinding = texture; } 102 void setTexture2DBinding(Platform3DObject texture) { m_texture2DBinding = texture; } 103 104 // The DrawingBuffer needs to track the currently bound framebuffer so it 105 // restore the binding when needed. 106 void setFramebufferBinding(Platform3DObject fbo) { m_framebufferBinding = fbo; } 107 108 // Bind to the m_framebufferBinding if it's not 0. 109 void restoreFramebufferBinding(); 103 110 104 111 // Track the currently active texture unit. Texture unit 0 is used as host for a scratch … … 136 143 bool m_scissorEnabled; 137 144 Platform3DObject m_texture2DBinding; 145 Platform3DObject m_framebufferBinding; 138 146 GC3Denum m_activeTextureUnit; 139 147 -
trunk/Source/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm
r114935 r114961 47 47 , m_scissorEnabled(false) 48 48 , m_texture2DBinding(0) 49 , m_framebufferBinding(0) 49 50 , m_activeTextureUnit(GraphicsContext3D::TEXTURE0) 50 51 , m_context(context) -
trunk/Source/WebCore/platform/graphics/gpu/qt/DrawingBufferQt.cpp
r114935 r114961 42 42 , m_scissorEnabled(false) 43 43 , m_texture2DBinding(0) 44 , m_framebufferBinding(0) 44 45 , m_activeTextureUnit(GraphicsContext3D::TEXTURE0) 45 46 , m_context(context)
Note:
See TracChangeset
for help on using the changeset viewer.