2018-11-30 22:52:05 +03:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 4; -*- */
|
2013-02-14 03:26:24 +04:00
|
|
|
/* 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_ANGLE_H_
|
|
|
|
#define SHARED_SURFACE_ANGLE_H_
|
|
|
|
|
|
|
|
#include <windows.h>
|
2020-08-07 10:14:46 +03:00
|
|
|
#include <memory>
|
2014-07-12 02:10:49 +04:00
|
|
|
#include "SharedSurface.h"
|
|
|
|
|
2014-10-31 17:57:32 +03:00
|
|
|
struct IDXGIKeyedMutex;
|
|
|
|
struct ID3D11Texture2D;
|
|
|
|
|
2013-02-14 03:26:24 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace gl {
|
|
|
|
|
|
|
|
class GLContext;
|
2020-08-07 10:14:46 +03:00
|
|
|
class EglDisplay;
|
2013-02-14 03:26:24 +04:00
|
|
|
|
2020-06-15 21:25:55 +03:00
|
|
|
class SharedSurface_ANGLEShareHandle final : public SharedSurface {
|
2013-02-14 03:26:24 +04:00
|
|
|
public:
|
2020-08-07 10:14:46 +03:00
|
|
|
const std::weak_ptr<EglDisplay> mEGL;
|
2015-06-05 03:15:38 +03:00
|
|
|
const EGLSurface mPBuffer;
|
2015-10-12 06:21:03 +03:00
|
|
|
const HANDLE mShareHandle;
|
2020-06-15 21:25:55 +03:00
|
|
|
const RefPtr<IDXGIKeyedMutex> mKeyedMutex;
|
2013-02-14 03:26:24 +04:00
|
|
|
|
2020-06-15 21:25:55 +03:00
|
|
|
static UniquePtr<SharedSurface_ANGLEShareHandle> Create(
|
|
|
|
const SharedSurfaceDesc&);
|
2013-02-14 03:26:24 +04:00
|
|
|
|
2020-06-15 21:25:55 +03:00
|
|
|
private:
|
2020-08-07 10:14:46 +03:00
|
|
|
SharedSurface_ANGLEShareHandle(const SharedSurfaceDesc&,
|
|
|
|
const std::weak_ptr<EglDisplay>& egl,
|
2015-09-24 22:21:05 +03:00
|
|
|
EGLSurface pbuffer, HANDLE shareHandle,
|
2016-07-07 01:20:52 +03:00
|
|
|
const RefPtr<IDXGIKeyedMutex>& keyedMutex);
|
2013-02-14 03:26:24 +04:00
|
|
|
|
|
|
|
public:
|
2014-08-16 04:38:08 +04:00
|
|
|
virtual ~SharedSurface_ANGLEShareHandle();
|
2013-02-14 03:26:24 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void LockProdImpl() override;
|
|
|
|
virtual void UnlockProdImpl() override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2013-02-14 03:26:24 +04:00
|
|
|
virtual void ProducerAcquireImpl() override;
|
2015-06-05 03:15:38 +03:00
|
|
|
virtual void ProducerReleaseImpl() override;
|
|
|
|
virtual void ProducerReadAcquireImpl() override;
|
|
|
|
virtual void ProducerReadReleaseImpl() override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2020-06-15 21:25:55 +03:00
|
|
|
Maybe<layers::SurfaceDescriptor> ToSurfaceDescriptor() override;
|
2015-09-24 22:21:05 +03:00
|
|
|
};
|
2013-02-14 03:26:24 +04:00
|
|
|
|
2020-06-15 21:25:55 +03:00
|
|
|
class SurfaceFactory_ANGLEShareHandle final : public SurfaceFactory {
|
2020-06-11 19:44:20 +03:00
|
|
|
public:
|
2020-06-15 21:25:55 +03:00
|
|
|
static UniquePtr<SurfaceFactory_ANGLEShareHandle> Create(GLContext& gl);
|
|
|
|
|
|
|
|
private:
|
|
|
|
explicit SurfaceFactory_ANGLEShareHandle(const PartialSharedSurfaceDesc& desc)
|
|
|
|
: SurfaceFactory(desc) {}
|
|
|
|
|
|
|
|
virtual UniquePtr<SharedSurface> CreateSharedImpl(
|
|
|
|
const SharedSurfaceDesc& desc) override {
|
|
|
|
return SharedSurface_ANGLEShareHandle::Create(desc);
|
2013-02-14 03:26:24 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace gl
|
|
|
|
} /* namespace mozilla */
|
|
|
|
|
|
|
|
#endif /* SHARED_SURFACE_ANGLE_H_ */
|