From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- gfx/gl/SharedSurfaceD3D11Interop.h | 79 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 gfx/gl/SharedSurfaceD3D11Interop.h (limited to 'gfx/gl/SharedSurfaceD3D11Interop.h') diff --git a/gfx/gl/SharedSurfaceD3D11Interop.h b/gfx/gl/SharedSurfaceD3D11Interop.h new file mode 100644 index 0000000000..5295c23f00 --- /dev/null +++ b/gfx/gl/SharedSurfaceD3D11Interop.h @@ -0,0 +1,79 @@ +/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 4; -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef SHARED_SURFACE_D3D11_INTEROP_H_ +#define SHARED_SURFACE_D3D11_INTEROP_H_ + +#include +#include +#include "SharedSurface.h" + +namespace mozilla { +namespace gl { + +class DXInterop2Device; +class GLContext; +class WGLLibrary; + +class SharedSurface_D3D11Interop final : public SharedSurface { + public: + struct Data final { + const RefPtr interop; + HANDLE lockHandle; + RefPtr texD3D; + HANDLE dxgiHandle; + UniquePtr interopRb; + UniquePtr interopFbIfNeedsIndirect; + }; + const Data mData; + const bool mNeedsFinish; + + private: + bool mLockedForGL = false; + + public: + static UniquePtr Create(const SharedSurfaceDesc&, + DXInterop2Device*); + + private: + SharedSurface_D3D11Interop(const SharedSurfaceDesc&, + UniquePtr&& fbForDrawing, Data&&); + + public: + virtual ~SharedSurface_D3D11Interop(); + + void LockProdImpl() override {} + void UnlockProdImpl() override {} + + void ProducerAcquireImpl() override; + void ProducerReleaseImpl() override; + + Maybe ToSurfaceDescriptor() override; +}; + +class SurfaceFactory_D3D11Interop : public SurfaceFactory { + public: + const RefPtr mInterop; + + static UniquePtr Create(GLContext& gl); + + protected: + SurfaceFactory_D3D11Interop(const PartialSharedSurfaceDesc&, + DXInterop2Device* interop); + + public: + virtual ~SurfaceFactory_D3D11Interop(); + + protected: + UniquePtr CreateSharedImpl( + const SharedSurfaceDesc& desc) override { + return SharedSurface_D3D11Interop::Create(desc, mInterop); + } +}; + +} /* namespace gl */ +} /* namespace mozilla */ + +#endif /* SHARED_SURFACE_D3D11_INTEROP_H_ */ -- cgit v1.2.3