1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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 GPU_ExternalTextureD3D11_H_
7 #define GPU_ExternalTextureD3D11_H_
9 #include "mozilla/gfx/FileHandleWrapper.h"
10 #include "mozilla/webgpu/ExternalTexture.h"
12 struct ID3D11Texture2D
;
18 class ExternalTextureD3D11 final
: public ExternalTexture
{
20 static UniquePtr
<ExternalTextureD3D11
> Create(
21 const uint32_t aWidth
, const uint32_t aHeight
,
22 const struct ffi::WGPUTextureFormat aFormat
,
23 const ffi::WGPUTextureUsages aUsage
);
25 ExternalTextureD3D11(const uint32_t aWidth
, const uint32_t aHeight
,
26 const struct ffi::WGPUTextureFormat aFormat
,
27 const ffi::WGPUTextureUsages aUsage
,
28 const RefPtr
<ID3D11Texture2D
> aTexture
,
29 RefPtr
<gfx::FileHandleWrapper
>&& aSharedHandle
);
30 virtual ~ExternalTextureD3D11();
32 void* GetExternalTextureHandle() override
;
34 Maybe
<layers::SurfaceDescriptor
> ToSurfaceDescriptor(
35 Maybe
<gfx::FenceInfo
>& aFenceInfo
) override
;
37 void GetSnapshot(const ipc::Shmem
& aDestShmem
,
38 const gfx::IntSize
& aSize
) override
;
41 const RefPtr
<ID3D11Texture2D
> mTexture
;
42 const RefPtr
<gfx::FileHandleWrapper
> mSharedHandle
;
46 } // namespace mozilla
48 #endif // GPU_Texture_H_