Title: [283143] branches/safari-612-branch

Diff

Modified: branches/safari-612-branch/LayoutTests/TestExpectations (283142 => 283143)


--- branches/safari-612-branch/LayoutTests/TestExpectations	2021-09-27 22:30:45 UTC (rev 283142)
+++ branches/safari-612-branch/LayoutTests/TestExpectations	2021-09-27 22:49:21 UTC (rev 283143)
@@ -3676,16 +3676,14 @@
 webgl/1.0.x/conformance/canvas/to-data-url-test.html [ Pass ]
 webgl/1.0.x/conformance/misc/invalid-passed-params.html [ Pass ]
 webgl/1.0.x/conformance/glsl/bugs/character-set.html [ Pass ]
-webgl/1.0.x/conformance/textures/misc/texture-corner-case-videos.html [ Pass ]
 
 # WebGL conformance test suite 2.0.1 is skipped until 2.0.0 is retired.
 webgl/2.0.y [ Skip ]
 
-# Explicitly enable tests which we have fixed and do not have corresponding 2.0.0 test functionality.
+# Explicitly enable tests which we have fixed and do not have corresponding 2.0.y test functionality.
 webgl/2.0.y/conformance/canvas/to-data-url-test.html [ Pass ]
 webgl/2.0.y/conformance/misc/invalid-passed-params.html [ Pass ]
 webgl/2.0.y/conformance/glsl/bugs/character-set.html [ Pass ]
-webgl/2.0.y/conformance/textures/misc/texture-corner-case-videos.html [ Pass ]
 
 # WebGL 1.0.3 and 2.0.0 tests where behavior is obsolete and WebKit contains implementation
 # and tests for the new behavior. Should be removed once 1.0.3 and 2.0.0 are retired.

Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (283142 => 283143)


--- branches/safari-612-branch/Source/WebCore/ChangeLog	2021-09-27 22:30:45 UTC (rev 283142)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog	2021-09-27 22:49:21 UTC (rev 283143)
@@ -1,3 +1,7 @@
+2021-09-27  Alan Coon  <[email protected]>
+
+        Revert r280963. rdar://problem/83587220
+
 2021-09-24  Russell Epstein  <[email protected]>
 
         Cherry-pick r282084. rdar://problem/83429618

Modified: branches/safari-612-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (283142 => 283143)


--- branches/safari-612-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2021-09-27 22:30:45 UTC (rev 283142)
+++ branches/safari-612-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp	2021-09-27 22:49:21 UTC (rev 283143)
@@ -4933,7 +4933,7 @@
         }
 
         // Fallback pure SW path.
-        RefPtr<Image> image = videoFrameToImage(video.get(), DontCopyBackingStore, functionName);
+        RefPtr<Image> image = videoFrameToImage(video.get(), DontCopyBackingStore);
         if (!image)
             return { };
         texImageImpl(functionID, target, level, internalformat, xoffset, yoffset, zoffset, format, type, image.get(), GraphicsContextGL::DOMSource::Video, m_unpackFlipY, m_unpackPremultiplyAlpha, false, inputSourceImageRect, depth, unpackImageHeight);
@@ -5767,44 +5767,18 @@
 
 #if ENABLE(VIDEO)
 
-RefPtr<Image> WebGLRenderingContextBase::videoFrameToImage(HTMLVideoElement* video, BackingStoreCopy backingStoreCopy, const char* functionName)
+RefPtr<Image> WebGLRenderingContextBase::videoFrameToImage(HTMLVideoElement* video, BackingStoreCopy backingStoreCopy)
 {
-#if USE(AVFOUNDATION)
-    auto nativeImage = video->nativeImageForCurrentTime();
-    // Currently we might be missing an image due to MSE not being able to provide the first requested frame.
-    // https://bugs.webkit.org/show_bug.cgi?id=228997
-    if (!nativeImage)
+    IntSize size(video->videoWidth(), video->videoHeight());
+    ImageBuffer* buf = m_generatedImageCache.imageBuffer(size);
+    if (!buf) {
+        synthesizeGLError(GraphicsContextGL::OUT_OF_MEMORY, "texImage2D", "out of memory");
         return nullptr;
-    IntSize imageSize = nativeImage->size();
-    if (imageSize.isEmpty()) {
-        synthesizeGLError(GraphicsContextGL::INVALID_VALUE, functionName, "video visible size is empty");
-        return nullptr;
     }
-    FloatRect imageRect { { }, imageSize };
-    ImageBuffer* imageBuffer = m_generatedImageCache.imageBuffer(imageSize, CompositeOperator::Copy);
-    if (!imageBuffer) {
-        synthesizeGLError(GraphicsContextGL::OUT_OF_MEMORY, functionName, "out of memory");
-        return nullptr;
-    }
-    imageBuffer->context().drawNativeImage(*nativeImage, imageRect.size(), imageRect, imageRect, CompositeOperator::Copy);
-#else
-    // This is a legacy code path that produces incompatible texture size when the
-    // video visible size is different to the natural size. This should be removed
-    // once all platforms implement nativeImageForCurrentTime().
-    IntSize videoSize { static_cast<int>(video->videoWidth()), static_cast<int>(video->videoHeight()) };
-    ImageBuffer* imageBuffer = m_generatedImageCache.imageBuffer(videoSize);
-    if (!imageBuffer) {
-        synthesizeGLError(GraphicsContextGL::OUT_OF_MEMORY, functionName, "out of memory");
-        return nullptr;
-    }
-    video->paintCurrentFrameInContext(imageBuffer->context(), { { }, videoSize });
-#endif
-    RefPtr<Image> image = imageBuffer->copyImage(backingStoreCopy);
-    if (!image) {
-        synthesizeGLError(GraphicsContextGL::OUT_OF_MEMORY, functionName, "out of memory");
-        return nullptr;
-    }
-    return image;
+    FloatRect destRect(0, 0, size.width(), size.height());
+    // FIXME: Turn this into a GPU-GPU texture copy instead of CPU readback.
+    video->paintCurrentFrameInContext(buf->context(), destRect);
+    return buf->copyImage(backingStoreCopy);
 }
 
 #endif
@@ -7645,7 +7619,7 @@
 {
 }
 
-ImageBuffer* WebGLRenderingContextBase::LRUImageBufferCache::imageBuffer(const IntSize& size, CompositeOperator fillOperator)
+ImageBuffer* WebGLRenderingContextBase::LRUImageBufferCache::imageBuffer(const IntSize& size)
 {
     size_t i;
     for (i = 0; i < m_buffers.size(); ++i) {
@@ -7655,8 +7629,7 @@
         if (buf->logicalSize() != size)
             continue;
         bubbleToFront(i);
-        if (fillOperator != CompositeOperator::Copy && fillOperator != CompositeOperator::Clear)
-            buf->context().clearRect({ { }, size });
+        buf->context().clearRect(FloatRect({ }, FloatSize(size)));
         return buf;
     }
 

Modified: branches/safari-612-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.h (283142 => 283143)


--- branches/safari-612-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.h	2021-09-27 22:30:45 UTC (rev 283142)
+++ branches/safari-612-branch/Source/WebCore/html/canvas/WebGLRenderingContextBase.h	2021-09-27 22:49:21 UTC (rev 283143)
@@ -524,7 +524,7 @@
     RefPtr<Image> drawImageIntoBuffer(Image&, int width, int height, int deviceScaleFactor, const char* functionName);
 
 #if ENABLE(VIDEO)
-    RefPtr<Image> videoFrameToImage(HTMLVideoElement*, BackingStoreCopy, const char* functionName);
+    RefPtr<Image> videoFrameToImage(HTMLVideoElement*, BackingStoreCopy);
 #endif
 
     WebGLTexture::TextureExtensionFlag textureExtensionFlags() const;
@@ -614,9 +614,8 @@
     class LRUImageBufferCache {
     public:
         LRUImageBufferCache(int capacity);
-        // Returns pointer to a cleared image buffer that is owned by the cache. The pointer is valid until next call.
-        // Using fillOperator == CompositeOperator::Copy can be used to omit the clear of the buffer.
-        ImageBuffer* imageBuffer(const IntSize&, CompositeOperator fillOperator = CompositeOperator::SourceOver);
+        // The pointer returned is owned by the image buffer map.
+        ImageBuffer* imageBuffer(const IntSize& size);
     private:
         void bubbleToFront(size_t idx);
         Vector<RefPtr<ImageBuffer>> m_buffers;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to