diff options
Diffstat (limited to 'src/video_core/gpu.cpp')
| -rw-r--r-- | src/video_core/gpu.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 51b3904f6..4a96530ae 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "common/assert.h" | 5 | #include "common/assert.h" |
| 6 | #include "common/microprofile.h" | ||
| 6 | #include "video_core/engines/fermi_2d.h" | 7 | #include "video_core/engines/fermi_2d.h" |
| 7 | #include "video_core/engines/kepler_memory.h" | 8 | #include "video_core/engines/kepler_memory.h" |
| 8 | #include "video_core/engines/maxwell_3d.h" | 9 | #include "video_core/engines/maxwell_3d.h" |
| @@ -26,6 +27,7 @@ u32 FramebufferConfig::BytesPerPixel(PixelFormat format) { | |||
| 26 | 27 | ||
| 27 | GPU::GPU(VideoCore::RasterizerInterface& rasterizer) { | 28 | GPU::GPU(VideoCore::RasterizerInterface& rasterizer) { |
| 28 | memory_manager = std::make_unique<Tegra::MemoryManager>(); | 29 | memory_manager = std::make_unique<Tegra::MemoryManager>(); |
| 30 | dma_pusher = std::make_unique<Tegra::DmaPusher>(*this); | ||
| 29 | maxwell_3d = std::make_unique<Engines::Maxwell3D>(rasterizer, *memory_manager); | 31 | maxwell_3d = std::make_unique<Engines::Maxwell3D>(rasterizer, *memory_manager); |
| 30 | fermi_2d = std::make_unique<Engines::Fermi2D>(rasterizer, *memory_manager); | 32 | fermi_2d = std::make_unique<Engines::Fermi2D>(rasterizer, *memory_manager); |
| 31 | maxwell_compute = std::make_unique<Engines::MaxwellCompute>(); | 33 | maxwell_compute = std::make_unique<Engines::MaxwellCompute>(); |
| @@ -51,6 +53,14 @@ const MemoryManager& GPU::MemoryManager() const { | |||
| 51 | return *memory_manager; | 53 | return *memory_manager; |
| 52 | } | 54 | } |
| 53 | 55 | ||
| 56 | DmaPusher& GPU::DmaPusher() { | ||
| 57 | return *dma_pusher; | ||
| 58 | } | ||
| 59 | |||
| 60 | const DmaPusher& GPU::DmaPusher() const { | ||
| 61 | return *dma_pusher; | ||
| 62 | } | ||
| 63 | |||
| 54 | u32 RenderTargetBytesPerPixel(RenderTargetFormat format) { | 64 | u32 RenderTargetBytesPerPixel(RenderTargetFormat format) { |
| 55 | ASSERT(format != RenderTargetFormat::NONE); | 65 | ASSERT(format != RenderTargetFormat::NONE); |
| 56 | 66 | ||
| @@ -113,4 +123,52 @@ u32 DepthFormatBytesPerPixel(DepthFormat format) { | |||
| 113 | } | 123 | } |
| 114 | } | 124 | } |
| 115 | 125 | ||
| 126 | enum class BufferMethods { | ||
| 127 | BindObject = 0, | ||
| 128 | CountBufferMethods = 0x40, | ||
| 129 | }; | ||
| 130 | |||
| 131 | MICROPROFILE_DEFINE(ProcessCommandLists, "GPU", "Execute command buffer", MP_RGB(128, 128, 192)); | ||
| 132 | |||
| 133 | void GPU::CallMethod(const MethodCall& method_call) { | ||
| 134 | MICROPROFILE_SCOPE(ProcessCommandLists); | ||
| 135 | |||
| 136 | LOG_TRACE(HW_GPU, | ||
| 137 | "Processing method {:08X} on subchannel {} value " | ||
| 138 | "{:08X} remaining params {}", | ||
| 139 | MethCall.method, MethCall.subchannel, value, remaining_params); | ||
| 140 | |||
| 141 | ASSERT(method_call.subchannel < bound_engines.size()); | ||
| 142 | |||
| 143 | if (method_call.method == static_cast<u32>(BufferMethods::BindObject)) { | ||
| 144 | // Bind the current subchannel to the desired engine id. | ||
| 145 | LOG_DEBUG(HW_GPU, "Binding subchannel {} to engine {}", method_call.subchannel, | ||
| 146 | method_call.argument); | ||
| 147 | bound_engines[method_call.subchannel] = static_cast<EngineID>(method_call.argument); | ||
| 148 | return; | ||
| 149 | } | ||
| 150 | |||
| 151 | const EngineID engine = bound_engines[method_call.subchannel]; | ||
| 152 | |||
| 153 | switch (engine) { | ||
| 154 | case EngineID::FERMI_TWOD_A: | ||
| 155 | fermi_2d->CallMethod(method_call); | ||
| 156 | break; | ||
| 157 | case EngineID::MAXWELL_B: | ||
| 158 | maxwell_3d->CallMethod(method_call); | ||
| 159 | break; | ||
| 160 | case EngineID::MAXWELL_COMPUTE_B: | ||
| 161 | maxwell_compute->CallMethod(method_call); | ||
| 162 | break; | ||
| 163 | case EngineID::MAXWELL_DMA_COPY_A: | ||
| 164 | maxwell_dma->CallMethod(method_call); | ||
| 165 | break; | ||
| 166 | case EngineID::KEPLER_INLINE_TO_MEMORY_B: | ||
| 167 | kepler_memory->CallMethod(method_call); | ||
| 168 | break; | ||
| 169 | default: | ||
| 170 | UNIMPLEMENTED_MSG("Unimplemented engine"); | ||
| 171 | } | ||
| 172 | } | ||
| 173 | |||
| 116 | } // namespace Tegra | 174 | } // namespace Tegra |