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