Update configs. IGNORE BROKEN CHANGESETS CLOSED TREE NO BUG a=release ba=release
[gecko.git] / gfx / gl / SharedSurfaceD3D11Interop.h
blob960850c27ef93531285b20f303e758fc4e086c55
1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 4; -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef SHARED_SURFACE_D3D11_INTEROP_H_
7 #define SHARED_SURFACE_D3D11_INTEROP_H_
9 #include <d3d11.h>
10 #include <windows.h>
11 #include "SharedSurface.h"
13 namespace mozilla {
15 namespace gfx {
16 class FileHandleWrapper;
17 } // namespace gfx
19 namespace gl {
21 class DXInterop2Device;
22 class GLContext;
23 class WGLLibrary;
25 class SharedSurface_D3D11Interop final : public SharedSurface {
26 public:
27 struct Data final {
28 const RefPtr<DXInterop2Device> interop;
29 HANDLE lockHandle;
30 RefPtr<ID3D11Texture2D> texD3D;
31 RefPtr<gfx::FileHandleWrapper> dxgiHandle;
32 UniquePtr<Renderbuffer> interopRb;
33 UniquePtr<MozFramebuffer> interopFbIfNeedsIndirect;
35 const Data mData;
36 const bool mNeedsFinish;
38 private:
39 bool mLockedForGL = false;
41 public:
42 static UniquePtr<SharedSurface_D3D11Interop> Create(const SharedSurfaceDesc&,
43 DXInterop2Device*);
45 private:
46 SharedSurface_D3D11Interop(const SharedSurfaceDesc&,
47 UniquePtr<MozFramebuffer>&& fbForDrawing, Data&&);
49 public:
50 virtual ~SharedSurface_D3D11Interop();
52 void LockProdImpl() override {}
53 void UnlockProdImpl() override {}
55 void ProducerAcquireImpl() override;
56 void ProducerReleaseImpl() override;
58 Maybe<layers::SurfaceDescriptor> ToSurfaceDescriptor() override;
61 class SurfaceFactory_D3D11Interop : public SurfaceFactory {
62 public:
63 const RefPtr<DXInterop2Device> mInterop;
65 static UniquePtr<SurfaceFactory_D3D11Interop> Create(GLContext& gl);
67 protected:
68 SurfaceFactory_D3D11Interop(const PartialSharedSurfaceDesc&,
69 DXInterop2Device* interop);
71 public:
72 virtual ~SurfaceFactory_D3D11Interop();
74 protected:
75 UniquePtr<SharedSurface> CreateSharedImpl(
76 const SharedSurfaceDesc& desc) override {
77 return SharedSurface_D3D11Interop::Create(desc, mInterop);
81 } /* namespace gl */
82 } /* namespace mozilla */
84 #endif /* SHARED_SURFACE_D3D11_INTEROP_H_ */