diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/video_core/engines/kepler_compute.cpp | 34 | ||||
| -rw-r--r-- | src/video_core/engines/kepler_compute.h (renamed from src/video_core/engines/maxwell_compute.h) | 31 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_compute.cpp | 28 | ||||
| -rw-r--r-- | src/video_core/gpu.cpp | 8 | ||||
| -rw-r--r-- | src/video_core/gpu.h | 6 |
6 files changed, 59 insertions, 52 deletions
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 33e507e69..1db0d031d 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt | |||
| @@ -5,12 +5,12 @@ add_library(video_core STATIC | |||
| 5 | debug_utils/debug_utils.h | 5 | debug_utils/debug_utils.h |
| 6 | engines/fermi_2d.cpp | 6 | engines/fermi_2d.cpp |
| 7 | engines/fermi_2d.h | 7 | engines/fermi_2d.h |
| 8 | engines/kepler_compute.cpp | ||
| 9 | engines/kepler_compute.h | ||
| 8 | engines/kepler_memory.cpp | 10 | engines/kepler_memory.cpp |
| 9 | engines/kepler_memory.h | 11 | engines/kepler_memory.h |
| 10 | engines/maxwell_3d.cpp | 12 | engines/maxwell_3d.cpp |
| 11 | engines/maxwell_3d.h | 13 | engines/maxwell_3d.h |
| 12 | engines/maxwell_compute.cpp | ||
| 13 | engines/maxwell_compute.h | ||
| 14 | engines/maxwell_dma.cpp | 14 | engines/maxwell_dma.cpp |
| 15 | engines/maxwell_dma.h | 15 | engines/maxwell_dma.h |
| 16 | engines/shader_bytecode.h | 16 | engines/shader_bytecode.h |
diff --git a/src/video_core/engines/kepler_compute.cpp b/src/video_core/engines/kepler_compute.cpp new file mode 100644 index 000000000..4ca856b6b --- /dev/null +++ b/src/video_core/engines/kepler_compute.cpp | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | // Copyright 2018 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "common/logging/log.h" | ||
| 6 | #include "core/core.h" | ||
| 7 | #include "core/memory.h" | ||
| 8 | #include "video_core/engines/kepler_compute.h" | ||
| 9 | #include "video_core/memory_manager.h" | ||
| 10 | |||
| 11 | namespace Tegra::Engines { | ||
| 12 | |||
| 13 | KeplerCompute::KeplerCompute(MemoryManager& memory_manager) : memory_manager{memory_manager} {} | ||
| 14 | |||
| 15 | KeplerCompute::~KeplerCompute() = default; | ||
| 16 | |||
| 17 | void KeplerCompute::CallMethod(const GPU::MethodCall& method_call) { | ||
| 18 | ASSERT_MSG(method_call.method < Regs::NUM_REGS, | ||
| 19 | "Invalid KeplerCompute register, increase the size of the Regs structure"); | ||
| 20 | |||
| 21 | regs.reg_array[method_call.method] = method_call.argument; | ||
| 22 | |||
| 23 | switch (method_call.method) { | ||
| 24 | case KEPLER_COMPUTE_REG_INDEX(launch): | ||
| 25 | // Abort execution since compute shaders can be used to alter game memory (e.g. CUDA | ||
| 26 | // kernels) | ||
| 27 | UNREACHABLE_MSG("Compute shaders are not implemented"); | ||
| 28 | break; | ||
| 29 | default: | ||
| 30 | break; | ||
| 31 | } | ||
| 32 | } | ||
| 33 | |||
| 34 | } // namespace Tegra::Engines | ||
diff --git a/src/video_core/engines/maxwell_compute.h b/src/video_core/engines/kepler_compute.h index 1d71f11bd..df0a32e0f 100644 --- a/src/video_core/engines/maxwell_compute.h +++ b/src/video_core/engines/kepler_compute.h | |||
| @@ -10,47 +10,48 @@ | |||
| 10 | #include "common/common_funcs.h" | 10 | #include "common/common_funcs.h" |
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | #include "video_core/gpu.h" | 12 | #include "video_core/gpu.h" |
| 13 | #include "video_core/memory_manager.h" | ||
| 13 | 14 | ||
| 14 | namespace Tegra::Engines { | 15 | namespace Tegra::Engines { |
| 15 | 16 | ||
| 16 | #define MAXWELL_COMPUTE_REG_INDEX(field_name) \ | 17 | #define KEPLER_COMPUTE_REG_INDEX(field_name) \ |
| 17 | (offsetof(Tegra::Engines::MaxwellCompute::Regs, field_name) / sizeof(u32)) | 18 | (offsetof(Tegra::Engines::KeplerCompute::Regs, field_name) / sizeof(u32)) |
| 18 | 19 | ||
| 19 | class MaxwellCompute final { | 20 | class KeplerCompute final { |
| 20 | public: | 21 | public: |
| 21 | MaxwellCompute() = default; | 22 | explicit KeplerCompute(MemoryManager& memory_manager); |
| 22 | ~MaxwellCompute() = default; | 23 | ~KeplerCompute(); |
| 24 | |||
| 25 | static constexpr std::size_t NumConstBuffers = 8; | ||
| 23 | 26 | ||
| 24 | struct Regs { | 27 | struct Regs { |
| 25 | static constexpr std::size_t NUM_REGS = 0xCF8; | 28 | static constexpr std::size_t NUM_REGS = 0xCF8; |
| 26 | 29 | ||
| 27 | union { | 30 | union { |
| 28 | struct { | 31 | struct { |
| 29 | INSERT_PADDING_WORDS(0x281); | 32 | INSERT_PADDING_WORDS(0xAF); |
| 30 | 33 | ||
| 31 | union { | 34 | u32 launch; |
| 32 | u32 compute_end; | ||
| 33 | BitField<0, 1, u32> unknown; | ||
| 34 | } compute; | ||
| 35 | 35 | ||
| 36 | INSERT_PADDING_WORDS(0xA76); | 36 | INSERT_PADDING_WORDS(0xC48); |
| 37 | }; | 37 | }; |
| 38 | std::array<u32, NUM_REGS> reg_array; | 38 | std::array<u32, NUM_REGS> reg_array; |
| 39 | }; | 39 | }; |
| 40 | } regs{}; | 40 | } regs{}; |
| 41 | |||
| 42 | static_assert(sizeof(Regs) == Regs::NUM_REGS * sizeof(u32), | 41 | static_assert(sizeof(Regs) == Regs::NUM_REGS * sizeof(u32), |
| 43 | "MaxwellCompute Regs has wrong size"); | 42 | "KeplerCompute Regs has wrong size"); |
| 43 | |||
| 44 | MemoryManager& memory_manager; | ||
| 44 | 45 | ||
| 45 | /// Write the value to the register identified by method. | 46 | /// Write the value to the register identified by method. |
| 46 | void CallMethod(const GPU::MethodCall& method_call); | 47 | void CallMethod(const GPU::MethodCall& method_call); |
| 47 | }; | 48 | }; |
| 48 | 49 | ||
| 49 | #define ASSERT_REG_POSITION(field_name, position) \ | 50 | #define ASSERT_REG_POSITION(field_name, position) \ |
| 50 | static_assert(offsetof(MaxwellCompute::Regs, field_name) == position * 4, \ | 51 | static_assert(offsetof(KeplerCompute::Regs, field_name) == position * 4, \ |
| 51 | "Field " #field_name " has invalid position") | 52 | "Field " #field_name " has invalid position") |
| 52 | 53 | ||
| 53 | ASSERT_REG_POSITION(compute, 0x281); | 54 | ASSERT_REG_POSITION(launch, 0xAF); |
| 54 | 55 | ||
| 55 | #undef ASSERT_REG_POSITION | 56 | #undef ASSERT_REG_POSITION |
| 56 | 57 | ||
diff --git a/src/video_core/engines/maxwell_compute.cpp b/src/video_core/engines/maxwell_compute.cpp deleted file mode 100644 index 656db6a61..000000000 --- a/src/video_core/engines/maxwell_compute.cpp +++ /dev/null | |||
| @@ -1,28 +0,0 @@ | |||
| 1 | // Copyright 2018 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "common/logging/log.h" | ||
| 6 | #include "core/core.h" | ||
| 7 | #include "video_core/engines/maxwell_compute.h" | ||
| 8 | |||
| 9 | namespace Tegra::Engines { | ||
| 10 | |||
| 11 | void MaxwellCompute::CallMethod(const GPU::MethodCall& method_call) { | ||
| 12 | ASSERT_MSG(method_call.method < Regs::NUM_REGS, | ||
| 13 | "Invalid MaxwellCompute register, increase the size of the Regs structure"); | ||
| 14 | |||
| 15 | regs.reg_array[method_call.method] = method_call.argument; | ||
| 16 | |||
| 17 | switch (method_call.method) { | ||
| 18 | case MAXWELL_COMPUTE_REG_INDEX(compute): { | ||
| 19 | LOG_CRITICAL(HW_GPU, "Compute shaders are not implemented"); | ||
| 20 | UNREACHABLE(); | ||
| 21 | break; | ||
| 22 | } | ||
| 23 | default: | ||
| 24 | break; | ||
| 25 | } | ||
| 26 | } | ||
| 27 | |||
| 28 | } // namespace Tegra::Engines | ||
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index d3d32a359..96c42b8a0 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -6,9 +6,9 @@ | |||
| 6 | #include "core/core_timing.h" | 6 | #include "core/core_timing.h" |
| 7 | #include "core/memory.h" | 7 | #include "core/memory.h" |
| 8 | #include "video_core/engines/fermi_2d.h" | 8 | #include "video_core/engines/fermi_2d.h" |
| 9 | #include "video_core/engines/kepler_compute.h" | ||
| 9 | #include "video_core/engines/kepler_memory.h" | 10 | #include "video_core/engines/kepler_memory.h" |
| 10 | #include "video_core/engines/maxwell_3d.h" | 11 | #include "video_core/engines/maxwell_3d.h" |
| 11 | #include "video_core/engines/maxwell_compute.h" | ||
| 12 | #include "video_core/engines/maxwell_dma.h" | 12 | #include "video_core/engines/maxwell_dma.h" |
| 13 | #include "video_core/gpu.h" | 13 | #include "video_core/gpu.h" |
| 14 | #include "video_core/rasterizer_interface.h" | 14 | #include "video_core/rasterizer_interface.h" |
| @@ -31,7 +31,7 @@ GPU::GPU(VideoCore::RasterizerInterface& rasterizer) { | |||
| 31 | dma_pusher = std::make_unique<Tegra::DmaPusher>(*this); | 31 | dma_pusher = std::make_unique<Tegra::DmaPusher>(*this); |
| 32 | maxwell_3d = std::make_unique<Engines::Maxwell3D>(rasterizer, *memory_manager); | 32 | maxwell_3d = std::make_unique<Engines::Maxwell3D>(rasterizer, *memory_manager); |
| 33 | fermi_2d = std::make_unique<Engines::Fermi2D>(rasterizer, *memory_manager); | 33 | fermi_2d = std::make_unique<Engines::Fermi2D>(rasterizer, *memory_manager); |
| 34 | maxwell_compute = std::make_unique<Engines::MaxwellCompute>(); | 34 | kepler_compute = std::make_unique<Engines::KeplerCompute>(*memory_manager); |
| 35 | maxwell_dma = std::make_unique<Engines::MaxwellDMA>(rasterizer, *memory_manager); | 35 | maxwell_dma = std::make_unique<Engines::MaxwellDMA>(rasterizer, *memory_manager); |
| 36 | kepler_memory = std::make_unique<Engines::KeplerMemory>(rasterizer, *memory_manager); | 36 | kepler_memory = std::make_unique<Engines::KeplerMemory>(rasterizer, *memory_manager); |
| 37 | } | 37 | } |
| @@ -245,8 +245,8 @@ void GPU::CallEngineMethod(const MethodCall& method_call) { | |||
| 245 | case EngineID::MAXWELL_B: | 245 | case EngineID::MAXWELL_B: |
| 246 | maxwell_3d->CallMethod(method_call); | 246 | maxwell_3d->CallMethod(method_call); |
| 247 | break; | 247 | break; |
| 248 | case EngineID::MAXWELL_COMPUTE_B: | 248 | case EngineID::KEPLER_COMPUTE_B: |
| 249 | maxwell_compute->CallMethod(method_call); | 249 | kepler_compute->CallMethod(method_call); |
| 250 | break; | 250 | break; |
| 251 | case EngineID::MAXWELL_DMA_COPY_A: | 251 | case EngineID::MAXWELL_DMA_COPY_A: |
| 252 | maxwell_dma->CallMethod(method_call); | 252 | maxwell_dma->CallMethod(method_call); |
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index fb8975811..21d82e426 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h | |||
| @@ -102,15 +102,15 @@ struct FramebufferConfig { | |||
| 102 | namespace Engines { | 102 | namespace Engines { |
| 103 | class Fermi2D; | 103 | class Fermi2D; |
| 104 | class Maxwell3D; | 104 | class Maxwell3D; |
| 105 | class MaxwellCompute; | ||
| 106 | class MaxwellDMA; | 105 | class MaxwellDMA; |
| 106 | class KeplerCompute; | ||
| 107 | class KeplerMemory; | 107 | class KeplerMemory; |
| 108 | } // namespace Engines | 108 | } // namespace Engines |
| 109 | 109 | ||
| 110 | enum class EngineID { | 110 | enum class EngineID { |
| 111 | FERMI_TWOD_A = 0x902D, // 2D Engine | 111 | FERMI_TWOD_A = 0x902D, // 2D Engine |
| 112 | MAXWELL_B = 0xB197, // 3D Engine | 112 | MAXWELL_B = 0xB197, // 3D Engine |
| 113 | MAXWELL_COMPUTE_B = 0xB1C0, | 113 | KEPLER_COMPUTE_B = 0xB1C0, |
| 114 | KEPLER_INLINE_TO_MEMORY_B = 0xA140, | 114 | KEPLER_INLINE_TO_MEMORY_B = 0xA140, |
| 115 | MAXWELL_DMA_COPY_A = 0xB0B5, | 115 | MAXWELL_DMA_COPY_A = 0xB0B5, |
| 116 | }; | 116 | }; |
| @@ -208,7 +208,7 @@ private: | |||
| 208 | /// 2D engine | 208 | /// 2D engine |
| 209 | std::unique_ptr<Engines::Fermi2D> fermi_2d; | 209 | std::unique_ptr<Engines::Fermi2D> fermi_2d; |
| 210 | /// Compute engine | 210 | /// Compute engine |
| 211 | std::unique_ptr<Engines::MaxwellCompute> maxwell_compute; | 211 | std::unique_ptr<Engines::KeplerCompute> kepler_compute; |
| 212 | /// DMA engine | 212 | /// DMA engine |
| 213 | std::unique_ptr<Engines::MaxwellDMA> maxwell_dma; | 213 | std::unique_ptr<Engines::MaxwellDMA> maxwell_dma; |
| 214 | /// Inline memory engine | 214 | /// Inline memory engine |