• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/Forward.h"
23 #include "dawn_native/IndirectDrawMetadata.h"
24 #include "dawn_native/ObjectBase.h"
25 #include "dawn_native/PassResourceUsage.h"
26 
27 #include "dawn_native/dawn_platform.h"
28 
29 #include <bitset>
30 
31 namespace dawn_native {
32 
33     struct RenderBundleDescriptor;
34     class RenderBundleEncoder;
35 
36     class RenderBundleBase final : public ApiObjectBase {
37       public:
38         RenderBundleBase(RenderBundleEncoder* encoder,
39                          const RenderBundleDescriptor* descriptor,
40                          Ref<AttachmentState> attachmentState,
41                          bool depthReadOnly,
42                          bool stencilReadOnly,
43                          RenderPassResourceUsage resourceUsage,
44                          IndirectDrawMetadata indirectDrawMetadata);
45 
46         static RenderBundleBase* MakeError(DeviceBase* device);
47 
48         ObjectType GetType() const override;
49 
50         CommandIterator* GetCommands();
51 
52         const AttachmentState* GetAttachmentState() const;
53         bool IsDepthReadOnly() const;
54         bool IsStencilReadOnly() const;
55         const RenderPassResourceUsage& GetResourceUsage() const;
56         const IndirectDrawMetadata& GetIndirectDrawMetadata();
57 
58       private:
59         RenderBundleBase(DeviceBase* device, ErrorTag errorTag);
60 
61         void DestroyImpl() override;
62 
63         CommandIterator mCommands;
64         IndirectDrawMetadata mIndirectDrawMetadata;
65         Ref<AttachmentState> mAttachmentState;
66         bool mDepthReadOnly;
67         bool mStencilReadOnly;
68         RenderPassResourceUsage mResourceUsage;
69     };
70 
71 }  // namespace dawn_native
72 
73 #endif  // DAWNNATIVE_RENDERBUNDLE_H_
74