Austin Eng | 8a488c1 | 2019-08-13 22:12:54 +0000 | [diff] [blame] | 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" |
Loko Kung | 8d195d5 | 2021-09-28 15:40:01 +0000 | [diff] [blame] | 22 | #include "dawn_native/Forward.h" |
Ken Rockot | ebf183b | 2021-09-23 00:15:19 +0000 | [diff] [blame] | 23 | #include "dawn_native/IndirectDrawMetadata.h" |
Austin Eng | 8a488c1 | 2019-08-13 22:12:54 +0000 | [diff] [blame] | 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 | |
Corentin Wallez | ec9cf2a | 2022-01-12 09:17:35 +0000 | [diff] [blame] | 31 | namespace dawn::native { |
Austin Eng | 8a488c1 | 2019-08-13 22:12:54 +0000 | [diff] [blame] | 32 | |
Austin Eng | 8a488c1 | 2019-08-13 22:12:54 +0000 | [diff] [blame] | 33 | struct RenderBundleDescriptor; |
Corentin Wallez | 321c122 | 2019-11-13 17:00:37 +0000 | [diff] [blame] | 34 | class RenderBundleEncoder; |
Austin Eng | 8a488c1 | 2019-08-13 22:12:54 +0000 | [diff] [blame] | 35 | |
Loko Kung | 970739e | 2021-11-16 22:46:34 +0000 | [diff] [blame] | 36 | class RenderBundleBase final : public ApiObjectBase { |
Austin Eng | 8a488c1 | 2019-08-13 22:12:54 +0000 | [diff] [blame] | 37 | public: |
Corentin Wallez | 321c122 | 2019-11-13 17:00:37 +0000 | [diff] [blame] | 38 | RenderBundleBase(RenderBundleEncoder* encoder, |
Austin Eng | 8a488c1 | 2019-08-13 22:12:54 +0000 | [diff] [blame] | 39 | const RenderBundleDescriptor* descriptor, |
Corentin Wallez | 95ff834 | 2021-01-27 17:20:16 +0000 | [diff] [blame] | 40 | Ref<AttachmentState> attachmentState, |
Yunchao He | d2c9cd3 | 2021-10-19 21:10:23 +0000 | [diff] [blame] | 41 | bool depthReadOnly, |
| 42 | bool stencilReadOnly, |
Ken Rockot | ebf183b | 2021-09-23 00:15:19 +0000 | [diff] [blame] | 43 | RenderPassResourceUsage resourceUsage, |
| 44 | IndirectDrawMetadata indirectDrawMetadata); |
Austin Eng | 8a488c1 | 2019-08-13 22:12:54 +0000 | [diff] [blame] | 45 | |
| 46 | static RenderBundleBase* MakeError(DeviceBase* device); |
| 47 | |
Loko Kung | 8d195d5 | 2021-09-28 15:40:01 +0000 | [diff] [blame] | 48 | ObjectType GetType() const override; |
| 49 | |
Austin Eng | 8a488c1 | 2019-08-13 22:12:54 +0000 | [diff] [blame] | 50 | CommandIterator* GetCommands(); |
| 51 | |
| 52 | const AttachmentState* GetAttachmentState() const; |
Yunchao He | d2c9cd3 | 2021-10-19 21:10:23 +0000 | [diff] [blame] | 53 | bool IsDepthReadOnly() const; |
| 54 | bool IsStencilReadOnly() const; |
Corentin Wallez | ec7ea6a | 2021-05-05 19:55:23 +0000 | [diff] [blame] | 55 | const RenderPassResourceUsage& GetResourceUsage() const; |
Ken Rockot | ebf183b | 2021-09-23 00:15:19 +0000 | [diff] [blame] | 56 | const IndirectDrawMetadata& GetIndirectDrawMetadata(); |
Austin Eng | 8a488c1 | 2019-08-13 22:12:54 +0000 | [diff] [blame] | 57 | |
Austin Eng | 8a488c1 | 2019-08-13 22:12:54 +0000 | [diff] [blame] | 58 | private: |
| 59 | RenderBundleBase(DeviceBase* device, ErrorTag errorTag); |
| 60 | |
Loko Kung | 970739e | 2021-11-16 22:46:34 +0000 | [diff] [blame] | 61 | void DestroyImpl() override; |
| 62 | |
Austin Eng | 8a488c1 | 2019-08-13 22:12:54 +0000 | [diff] [blame] | 63 | CommandIterator mCommands; |
Ken Rockot | ebf183b | 2021-09-23 00:15:19 +0000 | [diff] [blame] | 64 | IndirectDrawMetadata mIndirectDrawMetadata; |
Austin Eng | 8a488c1 | 2019-08-13 22:12:54 +0000 | [diff] [blame] | 65 | Ref<AttachmentState> mAttachmentState; |
Yunchao He | d2c9cd3 | 2021-10-19 21:10:23 +0000 | [diff] [blame] | 66 | bool mDepthReadOnly; |
| 67 | bool mStencilReadOnly; |
Corentin Wallez | ec7ea6a | 2021-05-05 19:55:23 +0000 | [diff] [blame] | 68 | RenderPassResourceUsage mResourceUsage; |
Austin Eng | 8a488c1 | 2019-08-13 22:12:54 +0000 | [diff] [blame] | 69 | }; |
| 70 | |
Corentin Wallez | ec9cf2a | 2022-01-12 09:17:35 +0000 | [diff] [blame] | 71 | } // namespace dawn::native |
Austin Eng | 8a488c1 | 2019-08-13 22:12:54 +0000 | [diff] [blame] | 72 | |
| 73 | #endif // DAWNNATIVE_RENDERBUNDLE_H_ |