Skip to content

Commit b690a08

Browse files
authored
Merge pull request #1467 from WebPlatformForEmbedded/pgorszkowski/2.38/revert_offscreenCanvas_take_webgl_rendered_textures_to_the_compositor_instead_of_copying
Revert "[offscreenCanvas] Take WebGL's rendered textures directly to …
2 parents c89f56d + 835ea60 commit b690a08

8 files changed

Lines changed: 1 addition & 57 deletions

File tree

Source/WebCore/html/OffscreenCanvas.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ void OffscreenCanvas::createContextWebGL(RenderingContextType contextType, WebGL
209209
UNUSED_PARAM(contextType);
210210
#endif
211211
m_context = WebGLRenderingContextBase::create(*this, attrs, webGLVersion);
212-
m_placeholderData->bufferPipeSource->setGraphicsContextGL(static_cast<WebGLRenderingContextBase*>(m_context.get())->graphicsContextGL());
213212
}
214213

215214
#endif // ENABLE(WEBGL)
@@ -449,10 +448,8 @@ void OffscreenCanvas::commitToPlaceholderCanvas()
449448

450449
// FIXME: Transfer texture over if we're using accelerated compositing
451450
if (m_context && (m_context->isWebGL() || m_context->isAccelerated())) {
452-
m_context->prepareForDisplayWithSwapBuffers();
453-
m_placeholderData->bufferPipeSource->swapBuffers();
451+
m_context->prepareForDisplayWithPaint();
454452
m_context->paintRenderingResultsToCanvas();
455-
return;
456453
}
457454

458455
if (m_placeholderData->bufferPipeSource) {

Source/WebCore/html/canvas/CanvasRenderingContext.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ class CanvasRenderingContext : public ScriptWrappable, public CanMakeWeakPtr<Can
7676
// Called before paintRenderingResultsToCanvas if paintRenderingResultsToCanvas is
7777
// used for compositing purposes.
7878
virtual void prepareForDisplayWithPaint() { }
79-
virtual void prepareForDisplayWithSwapBuffers() { }
8079
virtual void paintRenderingResultsToCanvas() { }
8180
virtual RefPtr<GraphicsLayerContentsDisplayDelegate> layerContentsDisplayDelegate();
8281

Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,22 +1455,11 @@ void WebGLRenderingContextBase::prepareForDisplayWithPaint()
14551455
m_isDisplayingWithPaint = true;
14561456
}
14571457

1458-
void WebGLRenderingContextBase::prepareForDisplayWithSwapBuffers()
1459-
{
1460-
m_isDisplayingWithSwapBuffers = true;
1461-
}
1462-
14631458
void WebGLRenderingContextBase::paintRenderingResultsToCanvas()
14641459
{
14651460
if (isContextLostOrPending())
14661461
return;
14671462

1468-
if (m_isDisplayingWithSwapBuffers) {
1469-
m_isDisplayingWithSwapBuffers = false;
1470-
m_markedCanvasDirty = false;
1471-
return;
1472-
}
1473-
14741463
if (m_isDisplayingWithPaint) {
14751464
bool canvasContainsDisplayBuffer = !m_markedCanvasDirty;
14761465
prepareForDisplay();

Source/WebCore/html/canvas/WebGLRenderingContextBase.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,6 @@ class WebGLRenderingContextBase : public GraphicsContextGL::Client, public GPUBa
424424
void reshape(int width, int height) override;
425425

426426
void prepareForDisplayWithPaint() final;
427-
void prepareForDisplayWithSwapBuffers() final;
428427
void paintRenderingResultsToCanvas() final;
429428
RefPtr<PixelBuffer> paintRenderingResultsToPixelBuffer();
430429
#if ENABLE(MEDIA_STREAM)
@@ -748,7 +747,6 @@ class WebGLRenderingContextBase : public GraphicsContextGL::Client, public GPUBa
748747

749748
bool m_compositingResultsNeedUpdating { false };
750749
bool m_isDisplayingWithPaint { false };
751-
bool m_isDisplayingWithSwapBuffers { false };
752750

753751
// Enabled extension objects.
754752
// FIXME: Move some of these to WebGLRenderingContext, the ones not needed for WebGL2

Source/WebCore/platform/graphics/ImageBufferPipe.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
namespace WebCore {
3535

3636
class ImageBuffer;
37-
class GraphicsContextGL;
3837

3938
// Used to provide GraphicsLayer contents for an externally managed ImageBuffer; e.g. an ImageBuffer created and owned by a Worker thread
4039
class ImageBufferPipe : public RefCounted<ImageBufferPipe> {
@@ -44,8 +43,6 @@ class ImageBufferPipe : public RefCounted<ImageBufferPipe> {
4443
virtual ~Source() = default;
4544

4645
virtual void handle(RefPtr<ImageBuffer>&&) = 0;
47-
virtual void swapBuffers() = 0;
48-
virtual void setGraphicsContextGL(GraphicsContextGL*) = 0;
4946
};
5047

5148
static RefPtr<ImageBufferPipe> create();

Source/WebCore/platform/graphics/nicosia/NicosiaImageBufferPipe.cpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -104,36 +104,6 @@ void NicosiaImageBufferPipeSource::handle(RefPtr<ImageBuffer>&& buffer)
104104
m_imageBuffer = WTFMove(buffer);
105105
}
106106

107-
void NicosiaImageBufferPipeSource::swapBuffers()
108-
{
109-
if (!m_context)
110-
return;
111-
112-
if (m_context->layerComposited())
113-
return;
114-
115-
m_context->prepareTexture();
116-
IntSize textureSize(m_context->m_currentWidth, m_context->m_currentHeight);
117-
118-
TextureMapperGL::Flags flags = TextureMapperGL::ShouldFlipTexture;
119-
if (m_context->contextAttributes().alpha)
120-
flags |= TextureMapperGL::ShouldBlend;
121-
122-
{
123-
auto& proxy = downcast<Nicosia::ContentLayerTextureMapperImpl>(m_nicosiaLayer->impl()).proxy();
124-
Locker locker { proxy.lock() };
125-
ASSERT(is<TextureMapperPlatformLayerProxyGL>(proxy));
126-
downcast<TextureMapperPlatformLayerProxyGL>(proxy).pushNextBuffer(makeUnique<TextureMapperPlatformLayerBuffer>(m_context->m_compositorTexture, textureSize, flags, m_context->m_internalColorFormat));
127-
}
128-
129-
m_context->markLayerComposited();
130-
}
131-
132-
void NicosiaImageBufferPipeSource::setGraphicsContextGL(GraphicsContextGL* context)
133-
{
134-
m_context = static_cast<GraphicsContextGLOpenGL*>(context);
135-
}
136-
137107
void NicosiaImageBufferPipeSource::swapBuffersIfNeeded()
138108
{
139109
}

Source/WebCore/platform/graphics/nicosia/NicosiaImageBufferPipe.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
#pragma once
2828

29-
#include "GraphicsContextGLOpenGL.h"
3029
#include "ImageBufferPipe.h"
3130
#include "NicosiaContentLayerTextureMapperImpl.h"
3231

@@ -57,8 +56,6 @@ class NicosiaImageBufferPipeSource : public WebCore::ImageBufferPipe::Source, pu
5756

5857
// ImageBufferPipe::Source overrides.
5958
void handle(RefPtr<WebCore::ImageBuffer>&&) final;
60-
void swapBuffers() final;
61-
void setGraphicsContextGL(WebCore::GraphicsContextGL*) final;
6259

6360
// ContentLayerTextureMapperImpl::Client overrides.
6461
void swapBuffersIfNeeded() override;
@@ -69,7 +66,6 @@ class NicosiaImageBufferPipeSource : public WebCore::ImageBufferPipe::Source, pu
6966

7067
mutable Lock m_imageBufferLock;
7168
RefPtr<WebCore::ImageBuffer> m_imageBuffer;
72-
WebCore::GraphicsContextGLOpenGL* m_context;
7369
};
7470

7571
class NicosiaImageBufferPipe final : public WebCore::ImageBufferPipe {

Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#if USE(NICOSIA)
4040
namespace Nicosia {
4141
class GCGLLayer;
42-
class NicosiaImageBufferPipeSource;
4342
}
4443
#endif
4544

@@ -575,7 +574,6 @@ class WEBCORE_EXPORT GraphicsContextGLOpenGL : public GraphicsContextGL
575574

576575
#if USE(NICOSIA)
577576
friend class Nicosia::GCGLLayer;
578-
friend class Nicosia::NicosiaImageBufferPipeSource;
579577
std::unique_ptr<Nicosia::GCGLLayer> m_nicosiaLayer;
580578
#elif USE(TEXTURE_MAPPER)
581579
friend class TextureMapperGCGLPlatformLayer;

0 commit comments

Comments
 (0)