• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 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_INTERNALPIPELINESTORE_H_
16 #define DAWNNATIVE_INTERNALPIPELINESTORE_H_
17 
18 #include "dawn_native/ObjectBase.h"
19 #include "dawn_native/ScratchBuffer.h"
20 #include "dawn_native/dawn_platform.h"
21 
22 #include <unordered_map>
23 
24 namespace dawn_native {
25 
26     class DeviceBase;
27     class RenderPipelineBase;
28     class ShaderModuleBase;
29 
30     // Every DeviceBase owns an InternalPipelineStore. This is a general-purpose cache for
31     // long-lived objects scoped to a device and used to support arbitrary pipeline operations.
32     struct InternalPipelineStore {
33         explicit InternalPipelineStore(DeviceBase* device);
34         ~InternalPipelineStore();
35 
36         std::unordered_map<wgpu::TextureFormat, Ref<RenderPipelineBase>>
37             copyTextureForBrowserPipelines;
38 
39         Ref<ShaderModuleBase> copyTextureForBrowser;
40 
41         Ref<ComputePipelineBase> timestampComputePipeline;
42         Ref<ShaderModuleBase> timestampCS;
43 
44         Ref<ShaderModuleBase> dummyFragmentShader;
45 
46         // A scratch buffer suitable for use as a copy destination and storage binding.
47         ScratchBuffer scratchStorage;
48 
49         // A scratch buffer suitable for use as a copy destination, storage binding, and indirect
50         // buffer for indirect dispatch or draw calls.
51         ScratchBuffer scratchIndirectStorage;
52 
53         Ref<ComputePipelineBase> renderValidationPipeline;
54         Ref<ShaderModuleBase> renderValidationShader;
55         Ref<ComputePipelineBase> dispatchIndirectValidationPipeline;
56     };
57 
58 }  // namespace dawn_native
59 
60 #endif  // DAWNNATIVE_INTERNALPIPELINESTORE_H_
61