Changeset 224207 in webkit
- Timestamp:
- Oct 30, 2017 3:43:56 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r224206 r224207 1 2017-10-30 Jer Noble <jer.noble@apple.com> 2 3 [WebGL] Optimization to skip painting if texture and source surface hasn't changed isn't working; re-optimize. 4 https://bugs.webkit.org/show_bug.cgi?id=178953 5 6 Reviewed by Dean Jackson. 7 8 The "seed" value of the current bound texture never matches the last saved value in 9 VideoTextureCopierCV::copyImageToPlatformTexture(). The value is modified by the function 10 itself, so a fresh value needs to be re-queried after the image's surface is attached to the 11 texture. 12 13 Once this fix is in, however, the <canvas> being painted will flash when no new image is 14 available. This is because the wrong texture target is being restored by the GC3DStateSaver 15 at the end of copyImageToPlatformTexture(). While we're fixing that, we may as well use the 16 texture state saved by the GraphicsContext3D itself to restore the correct texture unit, 17 texture target, and texture. 18 19 * platform/graphics/GraphicsContext3D.h: 20 (WebCore::GraphicsContext3D::activeTextureUnit const): 21 (WebCore::GraphicsContext3D::currentBoundTexture const): 22 (WebCore::GraphicsContext3D::currentBoundTarget const): 23 (WebCore::GraphicsContext3D::GraphicsContext3DState::currentBoundTexture const): 24 (WebCore::GraphicsContext3D::GraphicsContext3DState::boundTexture const): 25 (WebCore::GraphicsContext3D::GraphicsContext3DState::currentBoundTarget const): 26 (WebCore::GraphicsContext3D::GraphicsContext3DState::boundTarget const): 27 (WebCore::GraphicsContext3D::GraphicsContext3DState::currentBoundTexture): Deleted. 28 (WebCore::GraphicsContext3D::GraphicsContext3DState::boundTexture): Deleted. 29 (WebCore::GraphicsContext3D::GraphicsContext3DState::boundTarget): Deleted. 30 * platform/graphics/cv/VideoTextureCopierCV.cpp: 31 (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture): 32 (WebCore::VideoTextureCopierCV::GC3DStateSaver::GC3DStateSaver): 33 (WebCore::VideoTextureCopierCV::GC3DStateSaver::~GC3DStateSaver): 34 * platform/graphics/cv/VideoTextureCopierCV.h: 35 * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: 36 (WebCore::GraphicsContext3D::prepareTexture): 37 (WebCore::GraphicsContext3D::activeTexture): 38 (WebCore::GraphicsContext3D::bindTexture): 39 1 40 2017-10-30 Michael Catanzaro <mcatanzaro@igalia.com> 2 41 -
trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h
r223728 r224207 1286 1286 void setFailNextGPUStatusCheck() { m_failNextStatusCheck = true; } 1287 1287 1288 GC3Denum activeTextureUnit() const { return m_state.activeTextureUnit; } 1289 GC3Denum currentBoundTexture() const { return m_state.currentBoundTexture(); } 1290 GC3Denum currentBoundTarget() const { return m_state.currentBoundTarget(); } 1288 1291 unsigned textureSeed(GC3Duint texture) { return m_state.textureSeedCount.count(texture); } 1289 1292 … … 1432 1435 struct GraphicsContext3DState { 1433 1436 GC3Duint boundFBO { 0 }; 1434 GC3Denum activeTexture { GraphicsContext3D::TEXTURE0 };1437 GC3Denum activeTextureUnit { GraphicsContext3D::TEXTURE0 }; 1435 1438 1436 1439 using BoundTextureMap = HashMap<GC3Denum, … … 1441 1444 >; 1442 1445 BoundTextureMap boundTextureMap; 1443 GC3Duint currentBoundTexture() { return boundTexture(activeTexture); }1444 GC3Duint boundTexture(GC3Denum textureUnit) 1446 GC3Duint currentBoundTexture() const { return boundTexture(activeTextureUnit); } 1447 GC3Duint boundTexture(GC3Denum textureUnit) const 1445 1448 { 1446 1449 auto iterator = boundTextureMap.find(textureUnit); … … 1450 1453 } 1451 1454 1452 GC3Denum boundTarget(GC3Denum textureUnit) 1455 GC3Duint currentBoundTarget() const { return boundTarget(activeTextureUnit); } 1456 GC3Denum boundTarget(GC3Denum textureUnit) const 1453 1457 { 1454 1458 auto iterator = boundTextureMap.find(textureUnit); -
trunk/Source/WebCore/platform/graphics/cv/VideoTextureCopierCV.cpp
r223974 r224207 518 518 519 519 auto newSurfaceSeed = IOSurfaceGetSeed(surface); 520 auto newTextureSeed = m_context->textureSeed(outputTexture);521 520 if (flipY == m_lastFlipY 522 521 && surface == m_lastSurface 523 522 && newSurfaceSeed == m_lastSurfaceSeed 524 && lastTextureSeed(outputTexture) == newTextureSeed) {523 && lastTextureSeed(outputTexture) == m_context->textureSeed(outputTexture)) { 525 524 // If the texture hasn't been modified since the last time we copied to it, and the 526 525 // image hasn't been modified since the last time it was copied, this is a no-op. … … 620 619 m_lastSurface = surface; 621 620 m_lastSurfaceSeed = newSurfaceSeed; 622 m_lastTextureSeed.set(outputTexture, newTextureSeed);621 m_lastTextureSeed.set(outputTexture, m_context->textureSeed(outputTexture)); 623 622 m_lastFlipY = flipY; 624 623 … … 724 723 : m_context(context) 725 724 { 726 m_context.getIntegerv(GraphicsContext3D::TEXTURE_BINDING_2D, &m_texture); 725 m_activeTextureUnit = m_context.activeTextureUnit(); 726 m_boundTarget = m_context.currentBoundTarget(); 727 m_boundTexture = m_context.currentBoundTexture(); 727 728 m_context.getIntegerv(GraphicsContext3D::FRAMEBUFFER_BINDING, &m_framebuffer); 728 729 m_context.getIntegerv(GraphicsContext3D::CURRENT_PROGRAM, &m_program); … … 742 743 m_context.vertexAttribPointer(m_vertexAttribIndex, m_vertexAttribSize, m_vertexAttribType, m_vertexAttribNormalized, m_vertexAttribStride, m_vertexAttribPointer); 743 744 744 m_context.bindTexture(GraphicsContext3D::TEXTURE_BINDING_2D, m_texture); 745 m_context.activeTexture(m_activeTextureUnit); 746 m_context.bindTexture(m_boundTarget, m_boundTexture); 745 747 m_context.bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_framebuffer); 746 748 m_context.useProgram(m_program); -
trunk/Source/WebCore/platform/graphics/cv/VideoTextureCopierCV.h
r223315 r224207 67 67 private: 68 68 GraphicsContext3D& m_context; 69 GC3Dint m_texture { 0 }; 69 GC3Denum m_activeTextureUnit { 0 }; 70 GC3Denum m_boundTarget { 0 }; 71 GC3Denum m_boundTexture { 0 }; 70 72 GC3Dint m_framebuffer { 0 }; 71 73 GC3Dint m_program { 0 }; -
trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
r223887 r224207 263 263 ::glActiveTexture(GL_TEXTURE0); 264 264 ::glBindTexture(GL_TEXTURE_2D, m_state.boundTarget(GL_TEXTURE0) == GL_TEXTURE_2D ? m_state.boundTexture(GL_TEXTURE0) : 0); 265 ::glActiveTexture(m_state.activeTexture );265 ::glActiveTexture(m_state.activeTextureUnit); 266 266 if (m_state.boundFBO != m_fbo) 267 267 ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_state.boundFBO); … … 453 453 { 454 454 makeContextCurrent(); 455 m_state.activeTexture = texture;455 m_state.activeTextureUnit = texture; 456 456 ::glActiveTexture(texture); 457 457 } … … 506 506 { 507 507 makeContextCurrent(); 508 m_state.setBoundTexture(m_state.activeTexture , texture, target);508 m_state.setBoundTexture(m_state.activeTextureUnit, texture, target); 509 509 ::glBindTexture(target, texture); 510 510 }
Note: See TracChangeset
for help on using the changeset viewer.