kepler_memory.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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}, memory_manager{memory_manager}, 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().dirty.OnMemoryWrite();
  31. }
  32. break;
  33. }
  34. }
  35. }
  36. } // namespace Tegra::Engines