kepler_memory.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright 2018 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include "common/assert.h"
  5. #include "common/logging/log.h"
  6. #include "core/core.h"
  7. #include "video_core/engines/kepler_memory.h"
  8. #include "video_core/engines/maxwell_3d.h"
  9. #include "video_core/memory_manager.h"
  10. #include "video_core/rasterizer_interface.h"
  11. #include "video_core/renderer_base.h"
  12. #include "video_core/textures/decoders.h"
  13. namespace Tegra::Engines {
  14. KeplerMemory::KeplerMemory(Core::System& system, MemoryManager& memory_manager)
  15. : system{system}, upload_state{memory_manager, regs.upload} {}
  16. KeplerMemory::~KeplerMemory() = default;
  17. void KeplerMemory::CallMethod(const GPU::MethodCall& method_call) {
  18. ASSERT_MSG(method_call.method < Regs::NUM_REGS,
  19. "Invalid KeplerMemory register, increase the size of the Regs structure");
  20. regs.reg_array[method_call.method] = method_call.argument;
  21. switch (method_call.method) {
  22. case KEPLERMEMORY_REG_INDEX(exec): {
  23. upload_state.ProcessExec(regs.exec.linear != 0);
  24. break;
  25. }
  26. case KEPLERMEMORY_REG_INDEX(data): {
  27. const bool is_last_call = method_call.IsLastCall();
  28. upload_state.ProcessData(method_call.argument, is_last_call);
  29. if (is_last_call) {
  30. system.GPU().Maxwell3D().OnMemoryWrite();
  31. }
  32. break;
  33. }
  34. }
  35. }
  36. void KeplerMemory::CallMultiMethod(u32 method, const u32* base_start, u32 amount,
  37. u32 methods_pending) {
  38. for (std::size_t i = 0; i < amount; i++) {
  39. CallMethod({method, base_start[i], 0, methods_pending - static_cast<u32>(i)});
  40. }
  41. }
  42. } // namespace Tegra::Engines