engine_interface.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include <bitset>
  5. #include <limits>
  6. #include <vector>
  7. #include "common/common_types.h"
  8. namespace Tegra::Engines {
  9. class EngineInterface {
  10. public:
  11. virtual ~EngineInterface() = default;
  12. /// Write the value to the register identified by method.
  13. virtual void CallMethod(u32 method, u32 method_argument, bool is_last_call) = 0;
  14. /// Write multiple values to the register identified by method.
  15. virtual void CallMultiMethod(u32 method, const u32* base_start, u32 amount,
  16. u32 methods_pending) = 0;
  17. void ConsumeSink() {
  18. if (method_sink.empty()) {
  19. return;
  20. }
  21. ConsumeSinkImpl();
  22. }
  23. std::bitset<std::numeric_limits<u16>::max()> execution_mask{};
  24. std::vector<std::pair<u32, u32>> method_sink{};
  25. bool current_dirty{};
  26. GPUVAddr current_dma_segment;
  27. protected:
  28. virtual void ConsumeSinkImpl() {
  29. for (auto [method, value] : method_sink) {
  30. CallMethod(method, value, true);
  31. }
  32. method_sink.clear();
  33. }
  34. };
  35. } // namespace Tegra::Engines