Backed out 2 changesets (bug 1865921) for causing failures on test_device_lost.html...
[gecko.git] / dom / webgpu / Queue.h
blobd8cc890ff02782152313f3be609624f8a7f4e290
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_Queue_H_
7 #define GPU_Queue_H_
9 #include "nsWrapperCache.h"
10 #include "ObjectModel.h"
11 #include "mozilla/dom/TypedArray.h"
12 #include "mozilla/webgpu/WebGPUTypes.h"
14 namespace mozilla {
15 class ErrorResult;
16 namespace dom {
17 class RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict;
18 class ArrayBufferViewOrArrayBuffer;
19 template <typename T>
20 class Optional;
21 template <typename T>
22 class Sequence;
23 struct GPUImageCopyTexture;
24 struct GPUImageDataLayout;
25 struct TextureCopyView;
26 struct TextureDataLayout;
27 using GPUExtent3D = RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict;
28 } // namespace dom
29 namespace webgpu {
31 class Buffer;
32 class CommandBuffer;
33 class Device;
34 class Fence;
36 class Queue final : public ObjectBase, public ChildOf<Device> {
37 public:
38 GPU_DECL_CYCLE_COLLECTION(Queue)
39 GPU_DECL_JS_WRAP(Queue)
41 Queue(Device* const aParent, WebGPUChild* aBridge, RawId aId);
43 void Submit(
44 const dom::Sequence<OwningNonNull<CommandBuffer>>& aCommandBuffers);
46 already_AddRefed<dom::Promise> OnSubmittedWorkDone(ErrorResult& aRv);
48 void WriteBuffer(const Buffer& aBuffer, uint64_t aBufferOffset,
49 const dom::ArrayBufferViewOrArrayBuffer& aData,
50 uint64_t aDataOffset, const dom::Optional<uint64_t>& aSize,
51 ErrorResult& aRv);
53 void WriteTexture(const dom::GPUImageCopyTexture& aDestination,
54 const dom::ArrayBufferViewOrArrayBuffer& aData,
55 const dom::GPUImageDataLayout& aDataLayout,
56 const dom::GPUExtent3D& aSize, ErrorResult& aRv);
58 void CopyExternalImageToTexture(
59 const dom::GPUImageCopyExternalImage& aSource,
60 const dom::GPUImageCopyTextureTagged& aDestination,
61 const dom::GPUExtent3D& aCopySize, ErrorResult& aRv);
63 private:
64 virtual ~Queue();
65 void Cleanup() {}
67 RefPtr<WebGPUChild> mBridge;
68 const RawId mId;
70 public:
73 } // namespace webgpu
74 } // namespace mozilla
76 #endif // GPU_Queue_H_