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