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_ANGLE_H_
7 #define SHARED_SURFACE_ANGLE_H_
11 #include "SharedSurface.h"
13 struct IDXGIKeyedMutex
;
14 struct ID3D11Texture2D
;
22 class SharedSurface_ANGLEShareHandle final
: public SharedSurface
{
24 const std::weak_ptr
<EglDisplay
> mEGL
;
25 const EGLSurface mPBuffer
;
26 const HANDLE mShareHandle
;
27 const RefPtr
<IDXGIKeyedMutex
> mKeyedMutex
;
29 static UniquePtr
<SharedSurface_ANGLEShareHandle
> Create(
30 const SharedSurfaceDesc
&);
33 SharedSurface_ANGLEShareHandle(const SharedSurfaceDesc
&,
34 const std::weak_ptr
<EglDisplay
>& egl
,
35 EGLSurface pbuffer
, HANDLE shareHandle
,
36 const RefPtr
<IDXGIKeyedMutex
>& keyedMutex
);
39 virtual ~SharedSurface_ANGLEShareHandle();
41 virtual void LockProdImpl() override
;
42 virtual void UnlockProdImpl() override
;
44 virtual void ProducerAcquireImpl() override
;
45 virtual void ProducerReleaseImpl() override
;
46 virtual void ProducerReadAcquireImpl() override
;
47 virtual void ProducerReadReleaseImpl() override
;
49 Maybe
<layers::SurfaceDescriptor
> ToSurfaceDescriptor() override
;
52 class SurfaceFactory_ANGLEShareHandle final
: public SurfaceFactory
{
54 static UniquePtr
<SurfaceFactory_ANGLEShareHandle
> Create(GLContext
& gl
);
57 explicit SurfaceFactory_ANGLEShareHandle(const PartialSharedSurfaceDesc
& desc
)
58 : SurfaceFactory(desc
) {}
60 virtual UniquePtr
<SharedSurface
> CreateSharedImpl(
61 const SharedSurfaceDesc
& desc
) override
{
62 return SharedSurface_ANGLEShareHandle::Create(desc
);
67 } /* namespace mozilla */
69 #endif /* SHARED_SURFACE_ANGLE_H_ */