1 // Copyright 2017 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_VULKAN_FENCEDDELETER_H_ 16 #define DAWNNATIVE_VULKAN_FENCEDDELETER_H_ 17 18 #include "common/SerialQueue.h" 19 #include "common/vulkan_platform.h" 20 #include "dawn_native/IntegerTypes.h" 21 22 namespace dawn_native { namespace vulkan { 23 24 class Device; 25 26 class FencedDeleter { 27 public: 28 FencedDeleter(Device* device); 29 ~FencedDeleter(); 30 31 void DeleteWhenUnused(VkBuffer buffer); 32 void DeleteWhenUnused(VkDescriptorPool pool); 33 void DeleteWhenUnused(VkDeviceMemory memory); 34 void DeleteWhenUnused(VkFramebuffer framebuffer); 35 void DeleteWhenUnused(VkImage image); 36 void DeleteWhenUnused(VkImageView view); 37 void DeleteWhenUnused(VkPipelineLayout layout); 38 void DeleteWhenUnused(VkRenderPass renderPass); 39 void DeleteWhenUnused(VkPipeline pipeline); 40 void DeleteWhenUnused(VkQueryPool querypool); 41 void DeleteWhenUnused(VkSampler sampler); 42 void DeleteWhenUnused(VkSemaphore semaphore); 43 void DeleteWhenUnused(VkShaderModule module); 44 void DeleteWhenUnused(VkSurfaceKHR surface); 45 void DeleteWhenUnused(VkSwapchainKHR swapChain); 46 47 void Tick(ExecutionSerial completedSerial); 48 49 private: 50 Device* mDevice = nullptr; 51 SerialQueue<ExecutionSerial, VkBuffer> mBuffersToDelete; 52 SerialQueue<ExecutionSerial, VkDescriptorPool> mDescriptorPoolsToDelete; 53 SerialQueue<ExecutionSerial, VkDeviceMemory> mMemoriesToDelete; 54 SerialQueue<ExecutionSerial, VkFramebuffer> mFramebuffersToDelete; 55 SerialQueue<ExecutionSerial, VkImage> mImagesToDelete; 56 SerialQueue<ExecutionSerial, VkImageView> mImageViewsToDelete; 57 SerialQueue<ExecutionSerial, VkPipeline> mPipelinesToDelete; 58 SerialQueue<ExecutionSerial, VkPipelineLayout> mPipelineLayoutsToDelete; 59 SerialQueue<ExecutionSerial, VkQueryPool> mQueryPoolsToDelete; 60 SerialQueue<ExecutionSerial, VkRenderPass> mRenderPassesToDelete; 61 SerialQueue<ExecutionSerial, VkSampler> mSamplersToDelete; 62 SerialQueue<ExecutionSerial, VkSemaphore> mSemaphoresToDelete; 63 SerialQueue<ExecutionSerial, VkShaderModule> mShaderModulesToDelete; 64 SerialQueue<ExecutionSerial, VkSurfaceKHR> mSurfacesToDelete; 65 SerialQueue<ExecutionSerial, VkSwapchainKHR> mSwapChainsToDelete; 66 }; 67 68 }} // namespace dawn_native::vulkan 69 70 #endif // DAWNNATIVE_VULKAN_FENCEDDELETER_H_ 71