engine_upload.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 <vector>
  6. #include "common/bit_field.h"
  7. #include "common/common_types.h"
  8. namespace Tegra {
  9. class MemoryManager;
  10. }
  11. namespace Tegra::Engines::Upload {
  12. struct Registers {
  13. u32 line_length_in;
  14. u32 line_count;
  15. struct {
  16. u32 address_high;
  17. u32 address_low;
  18. u32 pitch;
  19. union {
  20. BitField<0, 4, u32> block_width;
  21. BitField<4, 4, u32> block_height;
  22. BitField<8, 4, u32> block_depth;
  23. };
  24. u32 width;
  25. u32 height;
  26. u32 depth;
  27. u32 z;
  28. u32 x;
  29. u32 y;
  30. GPUVAddr Address() const {
  31. return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | address_low);
  32. }
  33. u32 BlockWidth() const {
  34. return block_width.Value();
  35. }
  36. u32 BlockHeight() const {
  37. return block_height.Value();
  38. }
  39. u32 BlockDepth() const {
  40. return block_depth.Value();
  41. }
  42. } dest;
  43. };
  44. class State {
  45. public:
  46. State(MemoryManager& memory_manager, Registers& regs);
  47. ~State();
  48. void ProcessExec(bool is_linear);
  49. void ProcessData(u32 data, bool is_last_call);
  50. private:
  51. u32 write_offset = 0;
  52. u32 copy_size = 0;
  53. std::vector<u8> inner_buffer;
  54. std::vector<u8> tmp_buffer;
  55. bool is_linear = false;
  56. Registers& regs;
  57. MemoryManager& memory_manager;
  58. };
  59. } // namespace Tegra::Engines::Upload