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 DXInterop2Device
;
20 class SharedSurface_D3D11Interop final
: public SharedSurface
{
23 const RefPtr
<DXInterop2Device
> interop
;
25 RefPtr
<ID3D11Texture2D
> texD3D
;
27 UniquePtr
<Renderbuffer
> interopRb
;
28 UniquePtr
<MozFramebuffer
> interopFbIfNeedsIndirect
;
31 const bool mNeedsFinish
;
34 bool mLockedForGL
= false;
37 static UniquePtr
<SharedSurface_D3D11Interop
> Create(const SharedSurfaceDesc
&,
41 SharedSurface_D3D11Interop(const SharedSurfaceDesc
&,
42 UniquePtr
<MozFramebuffer
>&& fbForDrawing
, Data
&&);
45 virtual ~SharedSurface_D3D11Interop();
47 void LockProdImpl() override
{}
48 void UnlockProdImpl() override
{}
50 void ProducerAcquireImpl() override
;
51 void ProducerReleaseImpl() override
;
53 Maybe
<layers::SurfaceDescriptor
> ToSurfaceDescriptor() override
;
56 class SurfaceFactory_D3D11Interop
: public SurfaceFactory
{
58 const RefPtr
<DXInterop2Device
> mInterop
;
60 static UniquePtr
<SurfaceFactory_D3D11Interop
> Create(GLContext
& gl
);
63 SurfaceFactory_D3D11Interop(const PartialSharedSurfaceDesc
&,
64 DXInterop2Device
* interop
);
67 virtual ~SurfaceFactory_D3D11Interop();
70 UniquePtr
<SharedSurface
> CreateSharedImpl(
71 const SharedSurfaceDesc
& desc
) override
{
72 return SharedSurface_D3D11Interop::Create(desc
, mInterop
);
77 } /* namespace mozilla */
79 #endif /* SHARED_SURFACE_D3D11_INTEROP_H_ */