diff options
| author | 2019-03-27 13:17:35 -0400 | |
|---|---|---|
| committer | 2019-03-28 11:14:24 -0400 | |
| commit | 7d88fc83bf31619fbb640dff532fe01f5e983361 (patch) | |
| tree | 2d2d1a7d9849c1fe0b64ab183c50f5b227e32c1e /src | |
| parent | gl_shader_manager: Amend Doxygen string for MaxwellUniformData (diff) | |
| download | yuzu-7d88fc83bf31619fbb640dff532fe01f5e983361.tar.gz yuzu-7d88fc83bf31619fbb640dff532fe01f5e983361.tar.xz yuzu-7d88fc83bf31619fbb640dff532fe01f5e983361.zip | |
gl_shader_manager: Remove reliance on global accessor within MaxwellUniformData::SetFromRegs()
We can just pass in the Maxwell3D instance instead of going through the
system class to get at it.
This also lets us simplify the interface a little bit. Since we pass in
the Maxwell3D context now, we only really need to pass the shader stage
index value in.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_manager.cpp | 13 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_manager.h | 3 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index e06dfe43f..7c23056eb 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -320,7 +320,7 @@ void RasterizerOpenGL::SetupShaders(GLenum primitive_mode) { | |||
| 320 | const std::size_t stage{index == 0 ? 0 : index - 1}; // Stage indices are 0 - 5 | 320 | const std::size_t stage{index == 0 ? 0 : index - 1}; // Stage indices are 0 - 5 |
| 321 | 321 | ||
| 322 | GLShader::MaxwellUniformData ubo{}; | 322 | GLShader::MaxwellUniformData ubo{}; |
| 323 | ubo.SetFromRegs(gpu.state.shader_stages[stage]); | 323 | ubo.SetFromRegs(gpu, stage); |
| 324 | const GLintptr offset = buffer_cache.UploadHostMemory( | 324 | const GLintptr offset = buffer_cache.UploadHostMemory( |
| 325 | &ubo, sizeof(ubo), static_cast<std::size_t>(uniform_buffer_alignment)); | 325 | &ubo, sizeof(ubo), static_cast<std::size_t>(uniform_buffer_alignment)); |
| 326 | 326 | ||
diff --git a/src/video_core/renderer_opengl/gl_shader_manager.cpp b/src/video_core/renderer_opengl/gl_shader_manager.cpp index 6a30c28d2..a670855b0 100644 --- a/src/video_core/renderer_opengl/gl_shader_manager.cpp +++ b/src/video_core/renderer_opengl/gl_shader_manager.cpp | |||
| @@ -2,15 +2,13 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "core/core.h" | ||
| 6 | #include "video_core/renderer_opengl/gl_shader_manager.h" | 5 | #include "video_core/renderer_opengl/gl_shader_manager.h" |
| 7 | 6 | ||
| 8 | namespace OpenGL::GLShader { | 7 | namespace OpenGL::GLShader { |
| 9 | 8 | ||
| 10 | void MaxwellUniformData::SetFromRegs(const Maxwell3D::State::ShaderStageInfo& shader_stage) { | 9 | void MaxwellUniformData::SetFromRegs(const Maxwell3D& maxwell, std::size_t shader_stage) { |
| 11 | const auto& gpu = Core::System::GetInstance().GPU().Maxwell3D(); | 10 | const auto& regs = maxwell.regs; |
| 12 | const auto& regs = gpu.regs; | 11 | const auto& state = maxwell.state; |
| 13 | const auto& state = gpu.state; | ||
| 14 | 12 | ||
| 15 | // TODO(bunnei): Support more than one viewport | 13 | // TODO(bunnei): Support more than one viewport |
| 16 | viewport_flip[0] = regs.viewport_transform[0].scale_x < 0.0 ? -1.0f : 1.0f; | 14 | viewport_flip[0] = regs.viewport_transform[0].scale_x < 0.0 ? -1.0f : 1.0f; |
| @@ -31,8 +29,9 @@ void MaxwellUniformData::SetFromRegs(const Maxwell3D::State::ShaderStageInfo& sh | |||
| 31 | 29 | ||
| 32 | // Assign in which stage the position has to be flipped | 30 | // Assign in which stage the position has to be flipped |
| 33 | // (the last stage before the fragment shader). | 31 | // (the last stage before the fragment shader). |
| 34 | if (gpu.regs.shader_config[static_cast<u32>(Maxwell3D::Regs::ShaderProgram::Geometry)].enable) { | 32 | constexpr u32 geometry_index = static_cast<u32>(Maxwell3D::Regs::ShaderProgram::Geometry); |
| 35 | flip_stage = static_cast<u32>(Maxwell3D::Regs::ShaderProgram::Geometry); | 33 | if (maxwell.regs.shader_config[geometry_index].enable) { |
| 34 | flip_stage = geometry_index; | ||
| 36 | } else { | 35 | } else { |
| 37 | flip_stage = static_cast<u32>(Maxwell3D::Regs::ShaderProgram::VertexB); | 36 | flip_stage = static_cast<u32>(Maxwell3D::Regs::ShaderProgram::VertexB); |
| 38 | } | 37 | } |
diff --git a/src/video_core/renderer_opengl/gl_shader_manager.h b/src/video_core/renderer_opengl/gl_shader_manager.h index d0e0ab95b..98217eed6 100644 --- a/src/video_core/renderer_opengl/gl_shader_manager.h +++ b/src/video_core/renderer_opengl/gl_shader_manager.h | |||
| @@ -19,7 +19,8 @@ using Tegra::Engines::Maxwell3D; | |||
| 19 | /// the end of a uniform block is included in UNIFORM_BLOCK_DATA_SIZE or not. | 19 | /// the end of a uniform block is included in UNIFORM_BLOCK_DATA_SIZE or not. |
| 20 | /// Not following that rule will cause problems on some AMD drivers. | 20 | /// Not following that rule will cause problems on some AMD drivers. |
| 21 | struct MaxwellUniformData { | 21 | struct MaxwellUniformData { |
| 22 | void SetFromRegs(const Maxwell3D::State::ShaderStageInfo& shader_stage); | 22 | void SetFromRegs(const Maxwell3D& maxwell, std::size_t shader_stage); |
| 23 | |||
| 23 | alignas(16) GLvec4 viewport_flip; | 24 | alignas(16) GLvec4 viewport_flip; |
| 24 | struct alignas(16) { | 25 | struct alignas(16) { |
| 25 | GLuint instance_id; | 26 | GLuint instance_id; |