diff options
| author | 2020-07-18 14:24:32 +1000 | |
|---|---|---|
| committer | 2020-07-18 14:24:32 +1000 | |
| commit | 967307d3beb59b64e40c4b3f44ed839d87325e5c (patch) | |
| tree | 31c44595c797f29df24a3890fa9c26cd3f4c7332 /src/video_core | |
| parent | Drop settings namespace (diff) | |
| download | yuzu-967307d3beb59b64e40c4b3f44ed839d87325e5c.tar.gz yuzu-967307d3beb59b64e40c4b3f44ed839d87325e5c.tar.xz yuzu-967307d3beb59b64e40c4b3f44ed839d87325e5c.zip | |
Fix style issues
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/shader/async_shaders.cpp | 14 | ||||
| -rw-r--r-- | src/video_core/shader_notify.cpp | 6 |
2 files changed, 13 insertions, 7 deletions
diff --git a/src/video_core/shader/async_shaders.cpp b/src/video_core/shader/async_shaders.cpp index 64fad46e7..b7f66d7ee 100644 --- a/src/video_core/shader/async_shaders.cpp +++ b/src/video_core/shader/async_shaders.cpp | |||
| @@ -3,13 +3,19 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <chrono> | 5 | #include <chrono> |
| 6 | #include <condition_variable> | ||
| 7 | #include <mutex> | ||
| 8 | #include <thread> | ||
| 9 | #include <vector> | ||
| 6 | #include "video_core/engines/maxwell_3d.h" | 10 | #include "video_core/engines/maxwell_3d.h" |
| 7 | #include "video_core/renderer_base.h" | 11 | #include "video_core/renderer_base.h" |
| 8 | #include "video_core/renderer_opengl/gl_shader_cache.h" | 12 | #include "video_core/renderer_opengl/gl_shader_cache.h" |
| 9 | #include "video_core/shader/async_shaders.h" | 13 | #include "video_core/shader/async_shaders.h" |
| 10 | 14 | ||
| 11 | namespace VideoCommon::Shader { | 15 | namespace VideoCommon::Shader { |
| 16 | |||
| 12 | AsyncShaders::AsyncShaders(Core::Frontend::EmuWindow& emu_window) : emu_window(emu_window) {} | 17 | AsyncShaders::AsyncShaders(Core::Frontend::EmuWindow& emu_window) : emu_window(emu_window) {} |
| 18 | |||
| 13 | AsyncShaders::~AsyncShaders() { | 19 | AsyncShaders::~AsyncShaders() { |
| 14 | KillWorkers(); | 20 | KillWorkers(); |
| 15 | } | 21 | } |
| @@ -64,7 +70,7 @@ bool AsyncShaders::HasWorkQueued() { | |||
| 64 | } | 70 | } |
| 65 | 71 | ||
| 66 | bool AsyncShaders::HasCompletedWork() { | 72 | bool AsyncShaders::HasCompletedWork() { |
| 67 | std::shared_lock lock(completed_mutex); | 73 | std::shared_lock lock{completed_mutex}; |
| 68 | return !finished_work.empty(); | 74 | return !finished_work.empty(); |
| 69 | } | 75 | } |
| 70 | 76 | ||
| @@ -90,7 +96,7 @@ bool AsyncShaders::IsShaderAsync(const Tegra::GPU& gpu) const { | |||
| 90 | std::vector<AsyncShaders::Result> AsyncShaders::GetCompletedWork() { | 96 | std::vector<AsyncShaders::Result> AsyncShaders::GetCompletedWork() { |
| 91 | std::vector<AsyncShaders::Result> results; | 97 | std::vector<AsyncShaders::Result> results; |
| 92 | { | 98 | { |
| 93 | std::unique_lock lock(completed_mutex); | 99 | std::unique_lock lock{completed_mutex}; |
| 94 | results.assign(std::make_move_iterator(finished_work.begin()), | 100 | results.assign(std::make_move_iterator(finished_work.begin()), |
| 95 | std::make_move_iterator(finished_work.end())); | 101 | std::make_move_iterator(finished_work.end())); |
| 96 | finished_work.clear(); | 102 | finished_work.clear(); |
| @@ -124,8 +130,8 @@ void AsyncShaders::QueueOpenGLShader(const OpenGL::Device& device, | |||
| 124 | void AsyncShaders::ShaderCompilerThread(Core::Frontend::GraphicsContext* context) { | 130 | void AsyncShaders::ShaderCompilerThread(Core::Frontend::GraphicsContext* context) { |
| 125 | using namespace std::chrono_literals; | 131 | using namespace std::chrono_literals; |
| 126 | while (!is_thread_exiting.load(std::memory_order_relaxed)) { | 132 | while (!is_thread_exiting.load(std::memory_order_relaxed)) { |
| 127 | std::unique_lock<std::mutex> lock(queue_mutex); | 133 | std::unique_lock lock{queue_mutex}; |
| 128 | cv.wait(lock, [&] { return HasWorkQueued() || is_thread_exiting; }); | 134 | cv.wait(lock, [this] { return HasWorkQueued() || is_thread_exiting; }); |
| 129 | if (is_thread_exiting) { | 135 | if (is_thread_exiting) { |
| 130 | return; | 136 | return; |
| 131 | } | 137 | } |
diff --git a/src/video_core/shader_notify.cpp b/src/video_core/shader_notify.cpp index 46fd0baae..c3c71657d 100644 --- a/src/video_core/shader_notify.cpp +++ b/src/video_core/shader_notify.cpp | |||
| @@ -25,17 +25,17 @@ std::size_t ShaderNotify::GetShadersBuilding() { | |||
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | std::size_t ShaderNotify::GetShadersBuildingAccurate() { | 27 | std::size_t ShaderNotify::GetShadersBuildingAccurate() { |
| 28 | std::shared_lock lock(mutex); | 28 | std::shared_lock lock{mutex}; |
| 29 | return accurate_count; | 29 | return accurate_count; |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | void ShaderNotify::MarkShaderComplete() { | 32 | void ShaderNotify::MarkShaderComplete() { |
| 33 | std::unique_lock lock(mutex); | 33 | std::unique_lock lock{mutex}; |
| 34 | accurate_count--; | 34 | accurate_count--; |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | void ShaderNotify::MarkSharderBuilding() { | 37 | void ShaderNotify::MarkSharderBuilding() { |
| 38 | std::unique_lock lock(mutex); | 38 | std::unique_lock lock{mutex}; |
| 39 | accurate_count++; | 39 | accurate_count++; |
| 40 | } | 40 | } |
| 41 | 41 | ||