kepler_compute.cpp 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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_compute.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. KeplerCompute::KeplerCompute(Core::System& system, VideoCore::RasterizerInterface& rasterizer,
  15. MemoryManager& memory_manager)
  16. : system{system}, rasterizer{rasterizer}, memory_manager{memory_manager}, upload_state{
  17. memory_manager,
  18. regs.upload} {}
  19. KeplerCompute::~KeplerCompute() = default;
  20. void KeplerCompute::CallMethod(const GPU::MethodCall& method_call) {
  21. ASSERT_MSG(method_call.method < Regs::NUM_REGS,
  22. "Invalid KeplerCompute register, increase the size of the Regs structure");
  23. regs.reg_array[method_call.method] = method_call.argument;
  24. switch (method_call.method) {
  25. case KEPLER_COMPUTE_REG_INDEX(exec_upload): {
  26. upload_state.ProcessExec(regs.exec_upload.linear != 0);
  27. break;
  28. }
  29. case KEPLER_COMPUTE_REG_INDEX(data_upload): {
  30. const bool is_last_call = method_call.IsLastCall();
  31. upload_state.ProcessData(method_call.argument, is_last_call);
  32. if (is_last_call) {
  33. system.GPU().Maxwell3D().dirty_flags.OnMemoryWrite();
  34. }
  35. break;
  36. }
  37. case KEPLER_COMPUTE_REG_INDEX(launch):
  38. ProcessLaunch();
  39. break;
  40. default:
  41. break;
  42. }
  43. }
  44. void KeplerCompute::ProcessLaunch() {
  45. const GPUVAddr launch_desc_loc = regs.launch_desc_loc.Address();
  46. memory_manager.ReadBlockUnsafe(launch_desc_loc, &launch_description,
  47. LaunchParams::NUM_LAUNCH_PARAMETERS * sizeof(u32));
  48. const GPUVAddr code_loc = regs.code_loc.Address() + launch_description.program_start;
  49. LOG_WARNING(HW_GPU, "Compute Kernel Execute at Address 0x{:016x}, STUBBED", code_loc);
  50. }
  51. } // namespace Tegra::Engines