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 ExternalTexture_H_
7 #define ExternalTexture_H_
9 #include "mozilla/gfx/Point.h"
10 #include "mozilla/layers/LayersSurfaces.h"
11 #include "mozilla/webgpu/ffi/wgpu.h"
17 // A texture that can be used by the WebGPU implementation but is created and
19 class ExternalTexture
{
21 static UniquePtr
<ExternalTexture
> Create(
22 const uint32_t aWidth
, const uint32_t aHeight
,
23 const struct ffi::WGPUTextureFormat aFormat
);
25 ExternalTexture(const uint32_t aWidth
, const uint32_t aHeight
,
26 const struct ffi::WGPUTextureFormat aFormat
);
27 virtual ~ExternalTexture();
29 virtual void* GetExternalTextureHandle() { return nullptr; }
31 virtual Maybe
<layers::SurfaceDescriptor
> ToSurfaceDescriptor() = 0;
33 gfx::IntSize
GetSize() { return gfx::IntSize(mWidth
, mHeight
); }
35 const uint32_t mWidth
;
36 const uint32_t mHeight
;
37 const struct ffi::WGPUTextureFormat mFormat
;
41 } // namespace mozilla
43 #endif // GPU_ExternalTexture_H_