1 // Copyright 2018 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_PASSRESOURCEUSAGE_H 16 #define DAWNNATIVE_PASSRESOURCEUSAGE_H 17 18 #include "dawn_native/dawn_platform.h" 19 20 #include <set> 21 #include <vector> 22 23 namespace dawn_native { 24 25 class BufferBase; 26 class TextureBase; 27 28 // Which resources are used by pass and how they are used. The command buffer validation 29 // pre-computes this information so that backends with explicit barriers don't have to 30 // re-compute it. 31 struct PassResourceUsage { 32 std::vector<BufferBase*> buffers; 33 std::vector<dawn::BufferUsageBit> bufferUsages; 34 35 std::vector<TextureBase*> textures; 36 std::vector<dawn::TextureUsageBit> textureUsages; 37 }; 38 39 struct CommandBufferResourceUsage { 40 std::vector<PassResourceUsage> perPass; 41 std::set<BufferBase*> topLevelBuffers; 42 std::set<TextureBase*> topLevelTextures; 43 }; 44 45 } // namespace dawn_native 46 47 #endif // DAWNNATIVE_PASSRESOURCEUSAGE_H 48