mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1592026 - When using the OS compositor with WebRender on macOS, use NativeLayerRootSnapshotter for reftest readback. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D57070 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
adfb18b9ed
commit
056c822645
@ -60,6 +60,7 @@ RenderCompositorOGL::~RenderCompositorOGL() {
|
||||
if (mNativeLayerRoot) {
|
||||
mNativeLayerRoot->SetLayers({});
|
||||
mNativeLayerForEntireWindow = nullptr;
|
||||
mNativeLayerRootSnapshotter = nullptr;
|
||||
mNativeLayerRoot = nullptr;
|
||||
}
|
||||
|
||||
@ -171,6 +172,27 @@ bool RenderCompositorOGL::ShouldUseNativeCompositor() {
|
||||
return mNativeLayerRoot && gfx::gfxVars::UseWebRenderCompositor();
|
||||
}
|
||||
|
||||
bool RenderCompositorOGL::MaybeReadback(const gfx::IntSize& aReadbackSize,
|
||||
const wr::ImageFormat& aReadbackFormat,
|
||||
const Range<uint8_t>& aReadbackBuffer) {
|
||||
if (!ShouldUseNativeCompositor()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MOZ_RELEASE_ASSERT(aReadbackFormat == wr::ImageFormat::BGRA8);
|
||||
if (!mNativeLayerRootSnapshotter) {
|
||||
mNativeLayerRootSnapshotter = mNativeLayerRoot->CreateSnapshotter();
|
||||
}
|
||||
bool success = mNativeLayerRootSnapshotter->ReadbackPixels(
|
||||
aReadbackSize, gfx::SurfaceFormat::B8G8R8A8, aReadbackBuffer);
|
||||
|
||||
// ReadbackPixels might have changed the current context. Make sure mGL is
|
||||
// current again.
|
||||
mGL->MakeCurrent();
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
uint32_t RenderCompositorOGL::GetMaxUpdateRects() {
|
||||
if (ShouldUseNativeCompositor() &&
|
||||
StaticPrefs::gfx_webrender_compositor_max_update_rects_AtStartup() > 0) {
|
||||
|
@ -13,6 +13,7 @@
|
||||
namespace mozilla {
|
||||
|
||||
namespace layers {
|
||||
class NativeLayerRootSnapshotter;
|
||||
class NativeLayerRoot;
|
||||
class NativeLayer;
|
||||
class SurfacePoolHandle;
|
||||
@ -44,6 +45,11 @@ class RenderCompositorOGL : public RenderCompositor {
|
||||
bool ShouldUseNativeCompositor() override;
|
||||
uint32_t GetMaxUpdateRects() override;
|
||||
|
||||
// Does the readback for the ShouldUseNativeCompositor() case.
|
||||
bool MaybeReadback(const gfx::IntSize& aReadbackSize,
|
||||
const wr::ImageFormat& aReadbackFormat,
|
||||
const Range<uint8_t>& aReadbackBuffer) override;
|
||||
|
||||
// Interface for wr::Compositor
|
||||
void CompositorBeginFrame() override;
|
||||
void CompositorEndFrame() override;
|
||||
@ -73,6 +79,7 @@ class RenderCompositorOGL : public RenderCompositor {
|
||||
|
||||
// Can be null.
|
||||
RefPtr<layers::NativeLayerRoot> mNativeLayerRoot;
|
||||
UniquePtr<layers::NativeLayerRootSnapshotter> mNativeLayerRootSnapshotter;
|
||||
RefPtr<layers::NativeLayer> mNativeLayerForEntireWindow;
|
||||
RefPtr<layers::SurfacePoolHandle> mSurfacePoolHandle;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user