diff options
| author | 2018-07-18 18:55:58 -0700 | |
|---|---|---|
| committer | 2018-07-18 18:55:58 -0700 | |
| commit | 49b0966003caeaafe2f5455d06b16175f02686fb (patch) | |
| tree | 141c8d3c09f9eca021dddedb17cdc3cc6607a19a /src/video_core | |
| parent | Merge pull request #680 from bunnei/fix-swizz (diff) | |
| parent | core: Make System's default constructor private (diff) | |
| download | yuzu-49b0966003caeaafe2f5455d06b16175f02686fb.tar.gz yuzu-49b0966003caeaafe2f5455d06b16175f02686fb.tar.xz yuzu-49b0966003caeaafe2f5455d06b16175f02686fb.zip | |
Merge pull request #687 from lioncash/instance
core: Don't construct instance of Core::System, just to access its live instance
Diffstat (limited to 'src/video_core')
| -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 |
3 files changed, 15 insertions, 15 deletions
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; |