maxwell_compute.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright 2018 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <array>
  6. #include "common/assert.h"
  7. #include "common/bit_field.h"
  8. #include "common/common_funcs.h"
  9. #include "common/common_types.h"
  10. #include "video_core/gpu.h"
  11. namespace Tegra::Engines {
  12. #define MAXWELL_COMPUTE_REG_INDEX(field_name) \
  13. (offsetof(Tegra::Engines::MaxwellCompute::Regs, field_name) / sizeof(u32))
  14. class MaxwellCompute final {
  15. public:
  16. MaxwellCompute() = default;
  17. ~MaxwellCompute() = default;
  18. struct Regs {
  19. static constexpr std::size_t NUM_REGS = 0xCF8;
  20. union {
  21. struct {
  22. INSERT_PADDING_WORDS(0x281);
  23. union {
  24. u32 compute_end;
  25. BitField<0, 1, u32> unknown;
  26. } compute;
  27. INSERT_PADDING_WORDS(0xA76);
  28. };
  29. std::array<u32, NUM_REGS> reg_array;
  30. };
  31. } regs{};
  32. static_assert(sizeof(Regs) == Regs::NUM_REGS * sizeof(u32),
  33. "MaxwellCompute Regs has wrong size");
  34. /// Write the value to the register identified by method.
  35. void CallMethod(const GPU::MethodCall& method_call);
  36. };
  37. #define ASSERT_REG_POSITION(field_name, position) \
  38. static_assert(offsetof(MaxwellCompute::Regs, field_name) == position * 4, \
  39. "Field " #field_name " has invalid position")
  40. ASSERT_REG_POSITION(compute, 0x281);
  41. #undef ASSERT_REG_POSITION
  42. } // namespace Tegra::Engines