1 // 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"
22 #include "dawn_native/ObjectBase.h"
23 #include "dawn_native/PassResourceUsage.h"
24 
25 #include "dawn_native/dawn_platform.h"
26 
27 #include <bitset>
28 
29 namespace dawn_native {
30 
31     struct BeginRenderPassCmd;
32     struct RenderBundleDescriptor;
33     class RenderBundleEncoder;
34 
35     class RenderBundleBase : public ObjectBase {
36       public:
37         RenderBundleBase(RenderBundleEncoder* encoder,
38                          const RenderBundleDescriptor* descriptor,
39                          AttachmentState* attachmentState,
40                          PassResourceUsage resourceUsage);
41         ~RenderBundleBase() override;
42 
43         static RenderBundleBase* MakeError(DeviceBase* device);
44 
45         CommandIterator* GetCommands();
46 
47         const AttachmentState* GetAttachmentState() const;
48         const PassResourceUsage& GetResourceUsage() const;
49 
50       private:
51         RenderBundleBase(DeviceBase* device, ErrorTag errorTag);
52 
53         CommandIterator mCommands;
54         Ref<AttachmentState> mAttachmentState;
55         PassResourceUsage mResourceUsage;
56     };
57 
58 }  // namespace dawn_native
59 
60 #endif  // DAWNNATIVE_RENDERBUNDLE_H_
61