Fix style issues
This commit is contained in:
parent
4f473cda64
commit
967307d3be
|
@ -3,13 +3,19 @@
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <condition_variable>
|
||||||
|
#include <mutex>
|
||||||
|
#include <thread>
|
||||||
|
#include <vector>
|
||||||
#include "video_core/engines/maxwell_3d.h"
|
#include "video_core/engines/maxwell_3d.h"
|
||||||
#include "video_core/renderer_base.h"
|
#include "video_core/renderer_base.h"
|
||||||
#include "video_core/renderer_opengl/gl_shader_cache.h"
|
#include "video_core/renderer_opengl/gl_shader_cache.h"
|
||||||
#include "video_core/shader/async_shaders.h"
|
#include "video_core/shader/async_shaders.h"
|
||||||
|
|
||||||
namespace VideoCommon::Shader {
|
namespace VideoCommon::Shader {
|
||||||
|
|
||||||
AsyncShaders::AsyncShaders(Core::Frontend::EmuWindow& emu_window) : emu_window(emu_window) {}
|
AsyncShaders::AsyncShaders(Core::Frontend::EmuWindow& emu_window) : emu_window(emu_window) {}
|
||||||
|
|
||||||
AsyncShaders::~AsyncShaders() {
|
AsyncShaders::~AsyncShaders() {
|
||||||
KillWorkers();
|
KillWorkers();
|
||||||
}
|
}
|
||||||
|
@ -64,7 +70,7 @@ bool AsyncShaders::HasWorkQueued() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AsyncShaders::HasCompletedWork() {
|
bool AsyncShaders::HasCompletedWork() {
|
||||||
std::shared_lock lock(completed_mutex);
|
std::shared_lock lock{completed_mutex};
|
||||||
return !finished_work.empty();
|
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> AsyncShaders::GetCompletedWork() {
|
||||||
std::vector<AsyncShaders::Result> results;
|
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()),
|
results.assign(std::make_move_iterator(finished_work.begin()),
|
||||||
std::make_move_iterator(finished_work.end()));
|
std::make_move_iterator(finished_work.end()));
|
||||||
finished_work.clear();
|
finished_work.clear();
|
||||||
|
@ -124,8 +130,8 @@ void AsyncShaders::QueueOpenGLShader(const OpenGL::Device& device,
|
||||||
void AsyncShaders::ShaderCompilerThread(Core::Frontend::GraphicsContext* context) {
|
void AsyncShaders::ShaderCompilerThread(Core::Frontend::GraphicsContext* context) {
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
while (!is_thread_exiting.load(std::memory_order_relaxed)) {
|
while (!is_thread_exiting.load(std::memory_order_relaxed)) {
|
||||||
std::unique_lock<std::mutex> lock(queue_mutex);
|
std::unique_lock lock{queue_mutex};
|
||||||
cv.wait(lock, [&] { return HasWorkQueued() || is_thread_exiting; });
|
cv.wait(lock, [this] { return HasWorkQueued() || is_thread_exiting; });
|
||||||
if (is_thread_exiting) {
|
if (is_thread_exiting) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,17 +25,17 @@ std::size_t ShaderNotify::GetShadersBuilding() {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t ShaderNotify::GetShadersBuildingAccurate() {
|
std::size_t ShaderNotify::GetShadersBuildingAccurate() {
|
||||||
std::shared_lock lock(mutex);
|
std::shared_lock lock{mutex};
|
||||||
return accurate_count;
|
return accurate_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShaderNotify::MarkShaderComplete() {
|
void ShaderNotify::MarkShaderComplete() {
|
||||||
std::unique_lock lock(mutex);
|
std::unique_lock lock{mutex};
|
||||||
accurate_count--;
|
accurate_count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShaderNotify::MarkSharderBuilding() {
|
void ShaderNotify::MarkSharderBuilding() {
|
||||||
std::unique_lock lock(mutex);
|
std::unique_lock lock{mutex};
|
||||||
accurate_count++;
|
accurate_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue