Bug 1857841 - pt 3. Add a new page kind named "fresh" r=glandium
[gecko.git] / dom / webgpu / ExternalTexture.cpp
blob0cab2ae3f2196dec2e3c3a5f54f001766920fb1b
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 #include "ExternalTexture.h"
8 #ifdef XP_WIN
9 # include "mozilla/webgpu/ExternalTextureD3D11.h"
10 #endif
12 namespace mozilla::webgpu {
14 // static
15 UniquePtr<ExternalTexture> ExternalTexture::Create(
16 const uint32_t aWidth, const uint32_t aHeight,
17 const struct ffi::WGPUTextureFormat aFormat,
18 const ffi::WGPUTextureUsages aUsage) {
19 UniquePtr<ExternalTexture> texture;
20 #ifdef XP_WIN
21 texture = ExternalTextureD3D11::Create(aWidth, aHeight, aFormat, aUsage);
22 #endif
23 return texture;
26 ExternalTexture::ExternalTexture(const uint32_t aWidth, const uint32_t aHeight,
27 const struct ffi::WGPUTextureFormat aFormat,
28 const ffi::WGPUTextureUsages aUsage)
29 : mWidth(aWidth), mHeight(aHeight), mFormat(aFormat), mUsage(aUsage) {}
31 ExternalTexture::~ExternalTexture() {}
33 void ExternalTexture::SetSubmissionIndex(uint64_t aSubmissionIndex) {
34 MOZ_ASSERT(aSubmissionIndex != 0);
36 mSubmissionIndex = aSubmissionIndex;
39 } // namespace mozilla::webgpu