vk_pipeline.h 648 B

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright 2019 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <cstddef>
  6. #include "video_core/vulkan_common/vulkan_wrapper.h"
  7. namespace Vulkan {
  8. class Pipeline {
  9. public:
  10. /// Add a reference count to the pipeline
  11. void AddRef() noexcept {
  12. ++ref_count;
  13. }
  14. [[nodiscard]] bool RemoveRef() noexcept {
  15. --ref_count;
  16. return ref_count == 0;
  17. }
  18. [[nodiscard]] u64 UsageTick() const noexcept {
  19. return usage_tick;
  20. }
  21. protected:
  22. u64 usage_tick{};
  23. private:
  24. size_t ref_count{};
  25. };
  26. } // namespace Vulkan