gpu.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright 2018 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include "video_core/engines/fermi_2d.h"
  5. #include "video_core/engines/maxwell_3d.h"
  6. #include "video_core/engines/maxwell_compute.h"
  7. #include "video_core/engines/maxwell_dma.h"
  8. #include "video_core/gpu.h"
  9. namespace Tegra {
  10. GPU::GPU() {
  11. memory_manager = std::make_unique<MemoryManager>();
  12. maxwell_3d = std::make_unique<Engines::Maxwell3D>(*memory_manager);
  13. fermi_2d = std::make_unique<Engines::Fermi2D>(*memory_manager);
  14. maxwell_compute = std::make_unique<Engines::MaxwellCompute>();
  15. maxwell_dma = std::make_unique<Engines::MaxwellDMA>(*memory_manager);
  16. }
  17. GPU::~GPU() = default;
  18. const Engines::Maxwell3D& GPU::Maxwell3D() const {
  19. return *maxwell_3d;
  20. }
  21. Engines::Maxwell3D& GPU::Maxwell3D() {
  22. return *maxwell_3d;
  23. }
  24. u32 RenderTargetBytesPerPixel(RenderTargetFormat format) {
  25. ASSERT(format != RenderTargetFormat::NONE);
  26. switch (format) {
  27. case RenderTargetFormat::RGBA32_FLOAT:
  28. return 16;
  29. case RenderTargetFormat::RGBA16_FLOAT:
  30. return 8;
  31. case RenderTargetFormat::RGBA8_UNORM:
  32. case RenderTargetFormat::RGB10_A2_UNORM:
  33. return 4;
  34. default:
  35. UNIMPLEMENTED_MSG("Unimplemented render target format {}", static_cast<u32>(format));
  36. }
  37. }
  38. } // namespace Tegra