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_
11 #include "SharedSurface.h"
16 class FileHandleWrapper
;
21 class DXInterop2Device
;
25 class SharedSurface_D3D11Interop final
: public SharedSurface
{
28 const RefPtr
<DXInterop2Device
> interop
;
30 RefPtr
<ID3D11Texture2D
> texD3D
;
31 RefPtr
<gfx::FileHandleWrapper
> dxgiHandle
;
32 UniquePtr
<Renderbuffer
> interopRb
;
33 UniquePtr
<MozFramebuffer
> interopFbIfNeedsIndirect
;
36 const bool mNeedsFinish
;
39 bool mLockedForGL
= false;
42 static UniquePtr
<SharedSurface_D3D11Interop
> Create(const SharedSurfaceDesc
&,
46 SharedSurface_D3D11Interop(const SharedSurfaceDesc
&,
47 UniquePtr
<MozFramebuffer
>&& fbForDrawing
, Data
&&);
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
{
63 const RefPtr
<DXInterop2Device
> mInterop
;
65 static UniquePtr
<SurfaceFactory_D3D11Interop
> Create(GLContext
& gl
);
68 SurfaceFactory_D3D11Interop(const PartialSharedSurfaceDesc
&,
69 DXInterop2Device
* interop
);
72 virtual ~SurfaceFactory_D3D11Interop();
75 UniquePtr
<SharedSurface
> CreateSharedImpl(
76 const SharedSurfaceDesc
& desc
) override
{
77 return SharedSurface_D3D11Interop::Create(desc
, mInterop
);
82 } /* namespace mozilla */
84 #endif /* SHARED_SURFACE_D3D11_INTEROP_H_ */