summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader
diff options
context:
space:
mode:
authorDavid Marcec <dmarcecguzman@gmail.com>2020-07-18 06:24:32 +0200
committerDavid Marcec <dmarcecguzman@gmail.com>2020-07-18 06:24:32 +0200
commit967307d3beb59b64e40c4b3f44ed839d87325e5c (patch)
tree31c44595c797f29df24a3890fa9c26cd3f4c7332 /src/video_core/shader
parentDrop settings namespace (diff)
downloadyuzu-967307d3beb59b64e40c4b3f44ed839d87325e5c.tar
yuzu-967307d3beb59b64e40c4b3f44ed839d87325e5c.tar.gz
yuzu-967307d3beb59b64e40c4b3f44ed839d87325e5c.tar.bz2
yuzu-967307d3beb59b64e40c4b3f44ed839d87325e5c.tar.lz
yuzu-967307d3beb59b64e40c4b3f44ed839d87325e5c.tar.xz
yuzu-967307d3beb59b64e40c4b3f44ed839d87325e5c.tar.zst
yuzu-967307d3beb59b64e40c4b3f44ed839d87325e5c.zip
Diffstat (limited to 'src/video_core/shader')
-rw-r--r--src/video_core/shader/async_shaders.cpp14
1 files changed, 10 insertions, 4 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 @@
// Refer to the license.txt file included.
#include <chrono>
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+#include <vector>
#include "video_core/engines/maxwell_3d.h"
#include "video_core/renderer_base.h"
#include "video_core/renderer_opengl/gl_shader_cache.h"
#include "video_core/shader/async_shaders.h"
namespace VideoCommon::Shader {
+
AsyncShaders::AsyncShaders(Core::Frontend::EmuWindow& emu_window) : emu_window(emu_window) {}
+
AsyncShaders::~AsyncShaders() {
KillWorkers();
}
@@ -64,7 +70,7 @@ bool AsyncShaders::HasWorkQueued() {
}
bool AsyncShaders::HasCompletedWork() {
- std::shared_lock lock(completed_mutex);
+ std::shared_lock lock{completed_mutex};
return !finished_work.empty();
}
@@ -90,7 +96,7 @@ bool AsyncShaders::IsShaderAsync(const Tegra::GPU& gpu) const {
std::vector<AsyncShaders::Result> AsyncShaders::GetCompletedWork() {
std::vector<AsyncShaders::Result> results;
{
- std::unique_lock lock(completed_mutex);
+ std::unique_lock lock{completed_mutex};
results.assign(std::make_move_iterator(finished_work.begin()),
std::make_move_iterator(finished_work.end()));
finished_work.clear();
@@ -124,8 +130,8 @@ void AsyncShaders::QueueOpenGLShader(const OpenGL::Device& device,
void AsyncShaders::ShaderCompilerThread(Core::Frontend::GraphicsContext* context) {
using namespace std::chrono_literals;
while (!is_thread_exiting.load(std::memory_order_relaxed)) {
- std::unique_lock<std::mutex> lock(queue_mutex);
- cv.wait(lock, [&] { return HasWorkQueued() || is_thread_exiting; });
+ std::unique_lock lock{queue_mutex};
+ cv.wait(lock, [this] { return HasWorkQueued() || is_thread_exiting; });
if (is_thread_exiting) {
return;
}