Bug 1890793: Assert CallArgs::newTarget is not gray. r=spidermonkey-reviewers,sfink...
[gecko.git] / dom / webgpu / ExternalTextureD3D11.h
blob74f4cbdc8630c272cf41bdcc03b6165b1d91bfdc
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;
14 namespace mozilla {
16 namespace webgpu {
18 class ExternalTextureD3D11 final : public ExternalTexture {
19 public:
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;
40 protected:
41 const RefPtr<ID3D11Texture2D> mTexture;
42 const RefPtr<gfx::FileHandleWrapper> mSharedHandle;
45 } // namespace webgpu
46 } // namespace mozilla
48 #endif // GPU_Texture_H_