diff options
| author | Lioncash <mathew1800@gmail.com> | 2015-05-14 12:33:19 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2015-05-14 12:33:19 -0400 |
| commit | 26a3eaf95906b047170a6871371fb6201d90d81b (patch) | |
| tree | 2d724a6931c61455d13bf9ea21ac5316db8fd13d /Source/Core/VideoBackends/Software/SWRenderer.cpp | |
| parent | 8290fa1e462236115772b7498fe8032792a3ee5c (diff) | |
Software: Convert most volatile variables to atomics
Diffstat (limited to 'Source/Core/VideoBackends/Software/SWRenderer.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/Software/SWRenderer.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Source/Core/VideoBackends/Software/SWRenderer.cpp b/Source/Core/VideoBackends/Software/SWRenderer.cpp index 8ec66d4ffb..9662e21b9d 100644 --- a/Source/Core/VideoBackends/Software/SWRenderer.cpp +++ b/Source/Core/VideoBackends/Software/SWRenderer.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include <algorithm> +#include <atomic> #include <string> #include "Common/CommonTypes.h" @@ -26,7 +27,7 @@ static GLuint program; static u8 *s_xfbColorTexture[2]; static int s_currentColorTexture = 0; -static volatile bool s_bScreenshot; +static std::atomic<bool> s_bScreenshot; static std::mutex s_criticalScreenshot; static std::string s_sScreenshotName; @@ -37,7 +38,7 @@ static RasterFont* s_pfont = nullptr; void SWRenderer::Init() { - s_bScreenshot = false; + s_bScreenshot.store(false); } void SWRenderer::Shutdown() @@ -109,7 +110,7 @@ void SWRenderer::SetScreenshot(const char *_szFilename) { std::lock_guard<std::mutex> lk(s_criticalScreenshot); s_sScreenshotName = _szFilename; - s_bScreenshot = true; + s_bScreenshot.store(true); } void SWRenderer::RenderText(const char* pstr, int left, int top, u32 color) @@ -222,13 +223,13 @@ void SWRenderer::DrawTexture(u8 *texture, int width, int height) // FIXME: This should add black bars when the game has set the VI to render less than the full xfb. // Save screenshot - if (s_bScreenshot) + if (s_bScreenshot.load()) { std::lock_guard<std::mutex> lk(s_criticalScreenshot); TextureToPng(texture, width * 4, s_sScreenshotName, width, height, false); // Reset settings s_sScreenshotName.clear(); - s_bScreenshot = false; + s_bScreenshot.store(false); } GLsizei glWidth = (GLsizei)GLInterface->GetBackBufferWidth(); |
