diff options
Diffstat (limited to '')
| -rw-r--r-- | src/core/core.cpp | 4 | ||||
| -rw-r--r-- | src/core/core.h | 2 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 12 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 26 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_manager.cpp | 2 |
6 files changed, 26 insertions, 22 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 82db5cccf..9bd9f4bd9 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -26,11 +26,13 @@ namespace Core { | |||
| 26 | 26 | ||
| 27 | /*static*/ System System::s_instance; | 27 | /*static*/ System System::s_instance; |
| 28 | 28 | ||
| 29 | System::System() = default; | ||
| 30 | |||
| 29 | System::~System() = default; | 31 | System::~System() = default; |
| 30 | 32 | ||
| 31 | /// Runs a CPU core while the system is powered on | 33 | /// Runs a CPU core while the system is powered on |
| 32 | static void RunCpuCore(std::shared_ptr<Cpu> cpu_state) { | 34 | static void RunCpuCore(std::shared_ptr<Cpu> cpu_state) { |
| 33 | while (Core::System().GetInstance().IsPoweredOn()) { | 35 | while (Core::System::GetInstance().IsPoweredOn()) { |
| 34 | cpu_state->RunLoop(true); | 36 | cpu_state->RunLoop(true); |
| 35 | } | 37 | } |
| 36 | } | 38 | } |
diff --git a/src/core/core.h b/src/core/core.h index f90f085ad..c6f69f001 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
| @@ -168,6 +168,8 @@ public: | |||
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | private: | 170 | private: |
| 171 | System(); | ||
| 172 | |||
| 171 | /// Returns the currently running CPU core | 173 | /// Returns the currently running CPU core |
| 172 | Cpu& CurrentCpuCore(); | 174 | Cpu& CurrentCpuCore(); |
| 173 | 175 | ||
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 9a9746585..0b3c66428 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -165,7 +165,7 @@ void Thread::CancelWakeupTimer() { | |||
| 165 | static boost::optional<s32> GetNextProcessorId(u64 mask) { | 165 | static boost::optional<s32> GetNextProcessorId(u64 mask) { |
| 166 | for (s32 index = 0; index < Core::NUM_CPU_CORES; ++index) { | 166 | for (s32 index = 0; index < Core::NUM_CPU_CORES; ++index) { |
| 167 | if (mask & (1ULL << index)) { | 167 | if (mask & (1ULL << index)) { |
| 168 | if (!Core::System().GetInstance().Scheduler(index)->GetCurrentThread()) { | 168 | if (!Core::System::GetInstance().Scheduler(index)->GetCurrentThread()) { |
| 169 | // Core is enabled and not running any threads, use this one | 169 | // Core is enabled and not running any threads, use this one |
| 170 | return index; | 170 | return index; |
| 171 | } | 171 | } |
| @@ -215,14 +215,14 @@ void Thread::ResumeFromWait() { | |||
| 215 | new_processor_id = processor_id; | 215 | new_processor_id = processor_id; |
| 216 | } | 216 | } |
| 217 | if (ideal_core != -1 && | 217 | if (ideal_core != -1 && |
| 218 | Core::System().GetInstance().Scheduler(ideal_core)->GetCurrentThread() == nullptr) { | 218 | Core::System::GetInstance().Scheduler(ideal_core)->GetCurrentThread() == nullptr) { |
| 219 | new_processor_id = ideal_core; | 219 | new_processor_id = ideal_core; |
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | ASSERT(*new_processor_id < 4); | 222 | ASSERT(*new_processor_id < 4); |
| 223 | 223 | ||
| 224 | // Add thread to new core's scheduler | 224 | // Add thread to new core's scheduler |
| 225 | auto& next_scheduler = Core::System().GetInstance().Scheduler(*new_processor_id); | 225 | auto& next_scheduler = Core::System::GetInstance().Scheduler(*new_processor_id); |
| 226 | 226 | ||
| 227 | if (*new_processor_id != processor_id) { | 227 | if (*new_processor_id != processor_id) { |
| 228 | // Remove thread from previous core's scheduler | 228 | // Remove thread from previous core's scheduler |
| @@ -325,7 +325,7 @@ ResultVal<SharedPtr<Thread>> Thread::Create(std::string name, VAddr entry_point, | |||
| 325 | thread->name = std::move(name); | 325 | thread->name = std::move(name); |
| 326 | thread->callback_handle = wakeup_callback_handle_table.Create(thread).Unwrap(); | 326 | thread->callback_handle = wakeup_callback_handle_table.Create(thread).Unwrap(); |
| 327 | thread->owner_process = owner_process; | 327 | thread->owner_process = owner_process; |
| 328 | thread->scheduler = Core::System().GetInstance().Scheduler(processor_id); | 328 | thread->scheduler = Core::System::GetInstance().Scheduler(processor_id); |
| 329 | thread->scheduler->AddThread(thread, priority); | 329 | thread->scheduler->AddThread(thread, priority); |
| 330 | 330 | ||
| 331 | // Find the next available TLS index, and mark it as used | 331 | // Find the next available TLS index, and mark it as used |
| @@ -481,14 +481,14 @@ void Thread::ChangeCore(u32 core, u64 mask) { | |||
| 481 | new_processor_id = processor_id; | 481 | new_processor_id = processor_id; |
| 482 | } | 482 | } |
| 483 | if (ideal_core != -1 && | 483 | if (ideal_core != -1 && |
| 484 | Core::System().GetInstance().Scheduler(ideal_core)->GetCurrentThread() == nullptr) { | 484 | Core::System::GetInstance().Scheduler(ideal_core)->GetCurrentThread() == nullptr) { |
| 485 | new_processor_id = ideal_core; | 485 | new_processor_id = ideal_core; |
| 486 | } | 486 | } |
| 487 | 487 | ||
| 488 | ASSERT(*new_processor_id < 4); | 488 | ASSERT(*new_processor_id < 4); |
| 489 | 489 | ||
| 490 | // Add thread to new core's scheduler | 490 | // Add thread to new core's scheduler |
| 491 | auto& next_scheduler = Core::System().GetInstance().Scheduler(*new_processor_id); | 491 | auto& next_scheduler = Core::System::GetInstance().Scheduler(*new_processor_id); |
| 492 | 492 | ||
| 493 | if (*new_processor_id != processor_id) { | 493 | if (*new_processor_id != processor_id) { |
| 494 | // Remove thread from previous core's scheduler | 494 | // Remove thread from previous core's scheduler |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index eecbc5ff0..7e620584f 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -128,8 +128,8 @@ RasterizerOpenGL::~RasterizerOpenGL() { | |||
| 128 | std::pair<u8*, GLintptr> RasterizerOpenGL::SetupVertexArrays(u8* array_ptr, | 128 | std::pair<u8*, GLintptr> RasterizerOpenGL::SetupVertexArrays(u8* array_ptr, |
| 129 | GLintptr buffer_offset) { | 129 | GLintptr buffer_offset) { |
| 130 | MICROPROFILE_SCOPE(OpenGL_VAO); | 130 | MICROPROFILE_SCOPE(OpenGL_VAO); |
| 131 | const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; | 131 | const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs; |
| 132 | const auto& memory_manager = Core::System().GetInstance().GPU().memory_manager; | 132 | const auto& memory_manager = Core::System::GetInstance().GPU().memory_manager; |
| 133 | 133 | ||
| 134 | state.draw.vertex_array = hw_vao.handle; | 134 | state.draw.vertex_array = hw_vao.handle; |
| 135 | state.draw.vertex_buffer = stream_buffer->GetHandle(); | 135 | state.draw.vertex_buffer = stream_buffer->GetHandle(); |
| @@ -184,7 +184,7 @@ std::pair<u8*, GLintptr> RasterizerOpenGL::SetupVertexArrays(u8* array_ptr, | |||
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | static GLShader::ProgramCode GetShaderProgramCode(Maxwell::ShaderProgram program) { | 186 | static GLShader::ProgramCode GetShaderProgramCode(Maxwell::ShaderProgram program) { |
| 187 | auto& gpu = Core::System().GetInstance().GPU().Maxwell3D(); | 187 | auto& gpu = Core::System::GetInstance().GPU().Maxwell3D(); |
| 188 | 188 | ||
| 189 | // Fetch program code from memory | 189 | // Fetch program code from memory |
| 190 | GLShader::ProgramCode program_code; | 190 | GLShader::ProgramCode program_code; |
| @@ -207,7 +207,7 @@ void RasterizerOpenGL::SetupShaders(u8* buffer_ptr, GLintptr buffer_offset) { | |||
| 207 | } | 207 | } |
| 208 | }; | 208 | }; |
| 209 | 209 | ||
| 210 | auto& gpu = Core::System().GetInstance().GPU().Maxwell3D(); | 210 | auto& gpu = Core::System::GetInstance().GPU().Maxwell3D(); |
| 211 | 211 | ||
| 212 | // Next available bindpoints to use when uploading the const buffers and textures to the GLSL | 212 | // Next available bindpoints to use when uploading the const buffers and textures to the GLSL |
| 213 | // shaders. The constbuffer bindpoint starts after the shader stage configuration bind points. | 213 | // shaders. The constbuffer bindpoint starts after the shader stage configuration bind points. |
| @@ -297,7 +297,7 @@ void RasterizerOpenGL::SetupShaders(u8* buffer_ptr, GLintptr buffer_offset) { | |||
| 297 | } | 297 | } |
| 298 | 298 | ||
| 299 | size_t RasterizerOpenGL::CalculateVertexArraysSize() const { | 299 | size_t RasterizerOpenGL::CalculateVertexArraysSize() const { |
| 300 | const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; | 300 | const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs; |
| 301 | 301 | ||
| 302 | size_t size = 0; | 302 | size_t size = 0; |
| 303 | for (u32 index = 0; index < Maxwell::NumVertexArrays; ++index) { | 303 | for (u32 index = 0; index < Maxwell::NumVertexArrays; ++index) { |
| @@ -322,7 +322,7 @@ bool RasterizerOpenGL::AccelerateDrawBatch(bool is_indexed) { | |||
| 322 | 322 | ||
| 323 | std::pair<Surface, Surface> RasterizerOpenGL::ConfigureFramebuffers(bool using_color_fb, | 323 | std::pair<Surface, Surface> RasterizerOpenGL::ConfigureFramebuffers(bool using_color_fb, |
| 324 | bool using_depth_fb) { | 324 | bool using_depth_fb) { |
| 325 | const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; | 325 | const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs; |
| 326 | 326 | ||
| 327 | // TODO(bunnei): Implement this | 327 | // TODO(bunnei): Implement this |
| 328 | const bool has_stencil = false; | 328 | const bool has_stencil = false; |
| @@ -374,7 +374,7 @@ std::pair<Surface, Surface> RasterizerOpenGL::ConfigureFramebuffers(bool using_c | |||
| 374 | } | 374 | } |
| 375 | 375 | ||
| 376 | void RasterizerOpenGL::Clear() { | 376 | void RasterizerOpenGL::Clear() { |
| 377 | const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; | 377 | const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs; |
| 378 | 378 | ||
| 379 | bool use_color_fb = false; | 379 | bool use_color_fb = false; |
| 380 | bool use_depth_fb = false; | 380 | bool use_depth_fb = false; |
| @@ -426,7 +426,7 @@ void RasterizerOpenGL::DrawArrays() { | |||
| 426 | return; | 426 | return; |
| 427 | 427 | ||
| 428 | MICROPROFILE_SCOPE(OpenGL_Drawing); | 428 | MICROPROFILE_SCOPE(OpenGL_Drawing); |
| 429 | const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; | 429 | const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs; |
| 430 | 430 | ||
| 431 | ScopeAcquireGLContext acquire_context; | 431 | ScopeAcquireGLContext acquire_context; |
| 432 | 432 | ||
| @@ -473,7 +473,7 @@ void RasterizerOpenGL::DrawArrays() { | |||
| 473 | // If indexed mode, copy the index buffer | 473 | // If indexed mode, copy the index buffer |
| 474 | GLintptr index_buffer_offset = 0; | 474 | GLintptr index_buffer_offset = 0; |
| 475 | if (is_indexed) { | 475 | if (is_indexed) { |
| 476 | const auto& memory_manager = Core::System().GetInstance().GPU().memory_manager; | 476 | const auto& memory_manager = Core::System::GetInstance().GPU().memory_manager; |
| 477 | const boost::optional<VAddr> index_data_addr{ | 477 | const boost::optional<VAddr> index_data_addr{ |
| 478 | memory_manager->GpuToCpuAddress(regs.index_array.StartAddress())}; | 478 | memory_manager->GpuToCpuAddress(regs.index_array.StartAddress())}; |
| 479 | Memory::ReadBlock(*index_data_addr, offseted_buffer, index_buffer_size); | 479 | Memory::ReadBlock(*index_data_addr, offseted_buffer, index_buffer_size); |
| @@ -775,7 +775,7 @@ void RasterizerOpenGL::BindFramebufferSurfaces(const Surface& color_surface, | |||
| 775 | } | 775 | } |
| 776 | 776 | ||
| 777 | void RasterizerOpenGL::SyncViewport(const MathUtil::Rectangle<u32>& surfaces_rect) { | 777 | void RasterizerOpenGL::SyncViewport(const MathUtil::Rectangle<u32>& surfaces_rect) { |
| 778 | const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; | 778 | const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs; |
| 779 | const MathUtil::Rectangle<s32> viewport_rect{regs.viewport_transform[0].GetRect()}; | 779 | const MathUtil::Rectangle<s32> viewport_rect{regs.viewport_transform[0].GetRect()}; |
| 780 | 780 | ||
| 781 | state.viewport.x = static_cast<GLint>(surfaces_rect.left) + viewport_rect.left; | 781 | state.viewport.x = static_cast<GLint>(surfaces_rect.left) + viewport_rect.left; |
| @@ -793,7 +793,7 @@ void RasterizerOpenGL::SyncClipCoef() { | |||
| 793 | } | 793 | } |
| 794 | 794 | ||
| 795 | void RasterizerOpenGL::SyncCullMode() { | 795 | void RasterizerOpenGL::SyncCullMode() { |
| 796 | const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; | 796 | const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs; |
| 797 | 797 | ||
| 798 | state.cull.enabled = regs.cull.enabled != 0; | 798 | state.cull.enabled = regs.cull.enabled != 0; |
| 799 | 799 | ||
| @@ -825,7 +825,7 @@ void RasterizerOpenGL::SyncDepthOffset() { | |||
| 825 | } | 825 | } |
| 826 | 826 | ||
| 827 | void RasterizerOpenGL::SyncDepthTestState() { | 827 | void RasterizerOpenGL::SyncDepthTestState() { |
| 828 | const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; | 828 | const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs; |
| 829 | 829 | ||
| 830 | state.depth.test_enabled = regs.depth_test_enable != 0; | 830 | state.depth.test_enabled = regs.depth_test_enable != 0; |
| 831 | state.depth.write_mask = regs.depth_write_enabled ? GL_TRUE : GL_FALSE; | 831 | state.depth.write_mask = regs.depth_write_enabled ? GL_TRUE : GL_FALSE; |
| @@ -837,7 +837,7 @@ void RasterizerOpenGL::SyncDepthTestState() { | |||
| 837 | } | 837 | } |
| 838 | 838 | ||
| 839 | void RasterizerOpenGL::SyncBlendState() { | 839 | void RasterizerOpenGL::SyncBlendState() { |
| 840 | const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; | 840 | const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs; |
| 841 | 841 | ||
| 842 | // TODO(Subv): Support more than just render target 0. | 842 | // TODO(Subv): Support more than just render target 0. |
| 843 | state.blend.enabled = regs.blend.enable[0] != 0; | 843 | state.blend.enabled = regs.blend.enable[0] != 0; |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index c171c4c5b..2c43982b0 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -505,7 +505,7 @@ Surface RasterizerCacheOpenGL::GetTextureSurface(const Tegra::Texture::FullTextu | |||
| 505 | 505 | ||
| 506 | SurfaceSurfaceRect_Tuple RasterizerCacheOpenGL::GetFramebufferSurfaces( | 506 | SurfaceSurfaceRect_Tuple RasterizerCacheOpenGL::GetFramebufferSurfaces( |
| 507 | bool using_color_fb, bool using_depth_fb, const MathUtil::Rectangle<s32>& viewport) { | 507 | bool using_color_fb, bool using_depth_fb, const MathUtil::Rectangle<s32>& viewport) { |
| 508 | const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; | 508 | const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs; |
| 509 | 509 | ||
| 510 | // TODO(bunnei): This is hard corded to use just the first render buffer | 510 | // TODO(bunnei): This is hard corded to use just the first render buffer |
| 511 | LOG_WARNING(Render_OpenGL, "hard-coded for render target 0!"); | 511 | LOG_WARNING(Render_OpenGL, "hard-coded for render target 0!"); |
diff --git a/src/video_core/renderer_opengl/gl_shader_manager.cpp b/src/video_core/renderer_opengl/gl_shader_manager.cpp index d7167b298..1aa437f76 100644 --- a/src/video_core/renderer_opengl/gl_shader_manager.cpp +++ b/src/video_core/renderer_opengl/gl_shader_manager.cpp | |||
| @@ -35,7 +35,7 @@ void SetShaderUniformBlockBindings(GLuint shader) { | |||
| 35 | } // namespace Impl | 35 | } // namespace Impl |
| 36 | 36 | ||
| 37 | void MaxwellUniformData::SetFromRegs(const Maxwell3D::State::ShaderStageInfo& shader_stage) { | 37 | void MaxwellUniformData::SetFromRegs(const Maxwell3D::State::ShaderStageInfo& shader_stage) { |
| 38 | const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs; | 38 | const auto& regs = Core::System::GetInstance().GPU().Maxwell3D().regs; |
| 39 | 39 | ||
| 40 | // TODO(bunnei): Support more than one viewport | 40 | // TODO(bunnei): Support more than one viewport |
| 41 | viewport_flip[0] = regs.viewport_transform[0].scale_x < 0.0 ? -1.0f : 1.0f; | 41 | viewport_flip[0] = regs.viewport_transform[0].scale_x < 0.0 ? -1.0f : 1.0f; |