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_RenderPassEncoder_H_
7 #define GPU_RenderPassEncoder_H_
9 #include "ObjectModel.h"
13 class DoubleSequenceOrGPUColorDict
;
16 namespace binding_detail
{
19 } // namespace binding_detail
27 class RenderPassEncoder final
: public ObjectBase
,
28 public ChildOf
<CommandEncoder
> {
30 GPU_DECL_CYCLE_COLLECTION(RenderPassEncoder
)
31 GPU_DECL_JS_WRAP(RenderPassEncoder
)
33 RenderPassEncoder(CommandEncoder
* const aParent
,
34 const dom::GPURenderPassDescriptor
& aDesc
);
37 virtual ~RenderPassEncoder();
40 ffi::WGPURawPass mRaw
;
41 // keep all the used objects alive while the pass is recorded
42 nsTArray
<RefPtr
<const BindGroup
>> mUsedBindGroups
;
43 nsTArray
<RefPtr
<const Buffer
>> mUsedBuffers
;
44 nsTArray
<RefPtr
<const RenderPipeline
>> mUsedPipelines
;
45 nsTArray
<RefPtr
<const TextureView
>> mUsedTextureViews
;
48 void SetBindGroup(uint32_t aSlot
, const BindGroup
& aBindGroup
,
49 const dom::Sequence
<uint32_t>& aDynamicOffsets
);
50 void SetPipeline(const RenderPipeline
& aPipeline
);
51 void SetIndexBuffer(const Buffer
& aBuffer
, uint64_t aOffset
, uint64_t aSize
);
52 void SetVertexBuffer(uint32_t aSlot
, const Buffer
& aBuffer
, uint64_t aOffset
,
54 void Draw(uint32_t aVertexCount
, uint32_t aInstanceCount
,
55 uint32_t aFirstVertex
, uint32_t aFirstInstance
);
56 void DrawIndexed(uint32_t aIndexCount
, uint32_t aInstanceCount
,
57 uint32_t aFirstIndex
, int32_t aBaseVertex
,
58 uint32_t aFirstInstance
);
59 void DrawIndirect(const Buffer
& aIndirectBuffer
, uint64_t aIndirectOffset
);
60 void DrawIndexedIndirect(const Buffer
& aIndirectBuffer
,
61 uint64_t aIndirectOffset
);
62 void EndPass(ErrorResult
& aRv
);
66 } // namespace mozilla
68 #endif // GPU_RenderPassEncoder_H_