diff options
| -rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 20 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 2 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index 78ba29fc1..27ef865a2 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.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 <cinttypes> | 5 | #include <cinttypes> |
| 6 | #include <cstring> | ||
| 6 | #include "common/assert.h" | 7 | #include "common/assert.h" |
| 7 | #include "core/core.h" | 8 | #include "core/core.h" |
| 8 | #include "core/core_timing.h" | 9 | #include "core/core_timing.h" |
| @@ -19,7 +20,24 @@ namespace Tegra::Engines { | |||
| 19 | constexpr u32 MacroRegistersStart = 0xE00; | 20 | constexpr u32 MacroRegistersStart = 0xE00; |
| 20 | 21 | ||
| 21 | Maxwell3D::Maxwell3D(VideoCore::RasterizerInterface& rasterizer, MemoryManager& memory_manager) | 22 | Maxwell3D::Maxwell3D(VideoCore::RasterizerInterface& rasterizer, MemoryManager& memory_manager) |
| 22 | : memory_manager(memory_manager), rasterizer{rasterizer}, macro_interpreter(*this) {} | 23 | : memory_manager(memory_manager), rasterizer{rasterizer}, macro_interpreter(*this) { |
| 24 | InitializeRegisterDefaults(); | ||
| 25 | } | ||
| 26 | |||
| 27 | void Maxwell3D::InitializeRegisterDefaults() { | ||
| 28 | // Initializes registers to their default values - what games expect them to be at boot. This is | ||
| 29 | // for certain registers that may not be explicitly set by games. | ||
| 30 | |||
| 31 | // Reset all registers to zero | ||
| 32 | std::memset(®s, 0, sizeof(regs)); | ||
| 33 | |||
| 34 | // Depth range near/far is not always set, but is expected to be the default 0.0f, 1.0f. This is | ||
| 35 | // needed for ARMS. | ||
| 36 | for (std::size_t viewport{}; viewport < Regs::NumViewports; ++viewport) { | ||
| 37 | regs.viewport[viewport].depth_range_near = 0.0f; | ||
| 38 | regs.viewport[viewport].depth_range_far = 1.0f; | ||
| 39 | } | ||
| 40 | } | ||
| 23 | 41 | ||
| 24 | void Maxwell3D::CallMacroMethod(u32 method, std::vector<u32> parameters) { | 42 | void Maxwell3D::CallMacroMethod(u32 method, std::vector<u32> parameters) { |
| 25 | // Reset the current macro. | 43 | // Reset the current macro. |
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 0e09a7ee5..754a149fa 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -984,6 +984,8 @@ public: | |||
| 984 | Texture::FullTextureInfo GetStageTexture(Regs::ShaderStage stage, std::size_t offset) const; | 984 | Texture::FullTextureInfo GetStageTexture(Regs::ShaderStage stage, std::size_t offset) const; |
| 985 | 985 | ||
| 986 | private: | 986 | private: |
| 987 | void InitializeRegisterDefaults(); | ||
| 988 | |||
| 987 | VideoCore::RasterizerInterface& rasterizer; | 989 | VideoCore::RasterizerInterface& rasterizer; |
| 988 | 990 | ||
| 989 | std::unordered_map<u32, std::vector<u32>> uploaded_macros; | 991 | std::unordered_map<u32, std::vector<u32>> uploaded_macros; |