blob: a2db78ae7a7a92c0bda071a6ed956c84b2c53d7d [file] [log] [blame]
Austin Eng8a488c12019-08-13 22:12:54 +00001// Copyright 2019 The Dawn Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef DAWNNATIVE_RENDERBUNDLE_H_
16#define DAWNNATIVE_RENDERBUNDLE_H_
17
18#include "common/Constants.h"
19#include "dawn_native/AttachmentState.h"
20#include "dawn_native/CommandAllocator.h"
21#include "dawn_native/Error.h"
Loko Kung8d195d52021-09-28 15:40:01 +000022#include "dawn_native/Forward.h"
Ken Rockotebf183b2021-09-23 00:15:19 +000023#include "dawn_native/IndirectDrawMetadata.h"
Austin Eng8a488c12019-08-13 22:12:54 +000024#include "dawn_native/ObjectBase.h"
25#include "dawn_native/PassResourceUsage.h"
26
27#include "dawn_native/dawn_platform.h"
28
29#include <bitset>
30
Corentin Wallezec9cf2a2022-01-12 09:17:35 +000031namespace dawn::native {
Austin Eng8a488c12019-08-13 22:12:54 +000032
Austin Eng8a488c12019-08-13 22:12:54 +000033 struct RenderBundleDescriptor;
Corentin Wallez321c1222019-11-13 17:00:37 +000034 class RenderBundleEncoder;
Austin Eng8a488c12019-08-13 22:12:54 +000035
Loko Kung970739e2021-11-16 22:46:34 +000036 class RenderBundleBase final : public ApiObjectBase {
Austin Eng8a488c12019-08-13 22:12:54 +000037 public:
Corentin Wallez321c1222019-11-13 17:00:37 +000038 RenderBundleBase(RenderBundleEncoder* encoder,
Austin Eng8a488c12019-08-13 22:12:54 +000039 const RenderBundleDescriptor* descriptor,
Corentin Wallez95ff8342021-01-27 17:20:16 +000040 Ref<AttachmentState> attachmentState,
Yunchao Hed2c9cd32021-10-19 21:10:23 +000041 bool depthReadOnly,
42 bool stencilReadOnly,
Ken Rockotebf183b2021-09-23 00:15:19 +000043 RenderPassResourceUsage resourceUsage,
44 IndirectDrawMetadata indirectDrawMetadata);
Austin Eng8a488c12019-08-13 22:12:54 +000045
46 static RenderBundleBase* MakeError(DeviceBase* device);
47
Loko Kung8d195d52021-09-28 15:40:01 +000048 ObjectType GetType() const override;
49
Austin Eng8a488c12019-08-13 22:12:54 +000050 CommandIterator* GetCommands();
51
52 const AttachmentState* GetAttachmentState() const;
Yunchao Hed2c9cd32021-10-19 21:10:23 +000053 bool IsDepthReadOnly() const;
54 bool IsStencilReadOnly() const;
Corentin Wallezec7ea6a2021-05-05 19:55:23 +000055 const RenderPassResourceUsage& GetResourceUsage() const;
Ken Rockotebf183b2021-09-23 00:15:19 +000056 const IndirectDrawMetadata& GetIndirectDrawMetadata();
Austin Eng8a488c12019-08-13 22:12:54 +000057
Austin Eng8a488c12019-08-13 22:12:54 +000058 private:
59 RenderBundleBase(DeviceBase* device, ErrorTag errorTag);
60
Loko Kung970739e2021-11-16 22:46:34 +000061 void DestroyImpl() override;
62
Austin Eng8a488c12019-08-13 22:12:54 +000063 CommandIterator mCommands;
Ken Rockotebf183b2021-09-23 00:15:19 +000064 IndirectDrawMetadata mIndirectDrawMetadata;
Austin Eng8a488c12019-08-13 22:12:54 +000065 Ref<AttachmentState> mAttachmentState;
Yunchao Hed2c9cd32021-10-19 21:10:23 +000066 bool mDepthReadOnly;
67 bool mStencilReadOnly;
Corentin Wallezec7ea6a2021-05-05 19:55:23 +000068 RenderPassResourceUsage mResourceUsage;
Austin Eng8a488c12019-08-13 22:12:54 +000069 };
70
Corentin Wallezec9cf2a2022-01-12 09:17:35 +000071} // namespace dawn::native
Austin Eng8a488c12019-08-13 22:12:54 +000072
73#endif // DAWNNATIVE_RENDERBUNDLE_H_