History

Removing the atomics and fixing mistakes pointed out inreview

Sam Gateau committed 7 years ago

Commit f51e4911 parent 6acc3982 files · +24 −24Browse files

Showing the changes to interface/src/scripting/RenderScriptingInterface.cpp (1 of 2 files). Show all

Unified · Split

interface/src/scripting/RenderScriptingInterface.cpp+19−19
@@ -10,13 +10,14 @@ · 9 unmodified lines
1010 #include "LightingModel.h"
1111 #include "AntialiasingEffect.h"
1212
13−std::once_flag RenderScriptingInterface::registry_flag;
1413
1514 RenderScriptingInterface* RenderScriptingInterface::getInstance() {
1615 static RenderScriptingInterface sharedInstance;
1716 return &sharedInstance;
1817 }
1918
19+std::once_flag RenderScriptingInterface::registry_flag;
20+
2021 RenderScriptingInterface::RenderScriptingInterface() {
2122 std::call_once(registry_flag, [] {
2223 qmlRegisterType<RenderScriptingInterface>("RenderEnums", 1, 0, "RenderEnums");
@@ -25,19 +26,19 @@ RenderScriptingInterface::RenderScriptingInterface() { · 2 unmodified lines
2526
2627 void RenderScriptingInterface::loadSettings() {
2728 _renderSettingLock.withReadLock([&] {
28− _renderMethod.store(_renderMethodSetting.get());
29− _shadowsEnabled.store(_shadowsEnabledSetting.get());
30− _ambientOcclusionEnabled.store(_ambientOcclusionEnabledSetting.get());
31− _antialiasingEnabled.store(_antialiasingEnabledSetting.get());
29+ _renderMethod = (_renderMethodSetting.get());
30+ _shadowsEnabled = (_shadowsEnabledSetting.get());
31+ _ambientOcclusionEnabled = (_ambientOcclusionEnabledSetting.get());
32+ _antialiasingEnabled = (_antialiasingEnabledSetting.get());
3233 });
33− forceRenderMethod((RenderMethod)_renderMethod.load());
34− forceShadowsEnabled(_shadowsEnabled.load());
35− forceAmbientOcclusionEnabled(_ambientOcclusionEnabled.load());
36− forceAntialiasingEnabled(_antialiasingEnabled.load());
34+ forceRenderMethod((RenderMethod)_renderMethod);
35+ forceShadowsEnabled(_shadowsEnabled);
36+ forceAmbientOcclusionEnabled(_ambientOcclusionEnabled);
37+ forceAntialiasingEnabled(_antialiasingEnabled);
3738 }
3839
3940 RenderScriptingInterface::RenderMethod RenderScriptingInterface::getRenderMethod() {
40− return (RenderMethod) _renderMethod.load();
41+ return (RenderMethod) _renderMethod;
4142 }
4243
4344 void RenderScriptingInterface::setRenderMethod(RenderMethod renderMethod) {
@@ -53,7 +54,6 @@ void RenderScriptingInterface::forceRenderMethod(RenderMethod renderMethod) { · 9 unmodified lines
5354
5455 auto config = dynamic_cast<task::SwitchConfig*>(qApp->getRenderEngine()->getConfiguration()->getConfig("RenderMainView.DeferredForwardSwitch"));
5556 if (config) {
56− _renderMethodSetting.set((int)renderMethod);
5757 config->setBranch((int)renderMethod);
5858 }
5959 });
@@ -65,7 +65,7 @@ QStringList RenderScriptingInterface::getRenderMethodNames() const { · 5 unmodified lines
6565 }
6666
6767 bool RenderScriptingInterface::getShadowsEnabled() {
68− return _shadowsEnabled.load();
68+ return _shadowsEnabled;
6969 }
7070
7171 void RenderScriptingInterface::setShadowsEnabled(bool enabled) {
@@ -77,7 +77,7 @@ void RenderScriptingInterface::setShadowsEnabled(bool enabled) { · 5 unmodified lines
7777
7878 void RenderScriptingInterface::forceShadowsEnabled(bool enabled) {
7979 _renderSettingLock.withWriteLock([&] {
80− _shadowsEnabled.store(enabled);
80+ _shadowsEnabled = (enabled);
8181 _shadowsEnabledSetting.set(enabled);
8282
8383 auto lightingModelConfig = qApp->getRenderEngine()->getConfiguration()->getConfig<MakeLightingModel>("RenderMainView.LightingModel");
@@ -89,11 +89,11 @@ void RenderScriptingInterface::forceShadowsEnabled(bool enabled) { · 5 unmodified lines
8989 }
9090
9191 bool RenderScriptingInterface::getAmbientOcclusionEnabled() {
92− return _ambientOcclusionEnabled.load();
92+ return _ambientOcclusionEnabled;
9393 }
9494
9595 void RenderScriptingInterface::setAmbientOcclusionEnabled(bool enabled) {
96− if (_ambientOcclusionEnabled.load() != enabled) {
96+ if (_ambientOcclusionEnabled != enabled) {
9797 forceAmbientOcclusionEnabled(enabled);
9898 emit settingsChanged();
9999 }
@@ -101,7 +101,7 @@ void RenderScriptingInterface::setAmbientOcclusionEnabled(bool enabled) { · 1 unmodified line
101101
102102 void RenderScriptingInterface::forceAmbientOcclusionEnabled(bool enabled) {
103103 _renderSettingLock.withWriteLock([&] {
104− _ambientOcclusionEnabled.store(enabled);
104+ _ambientOcclusionEnabled = (enabled);
105105 _ambientOcclusionEnabledSetting.set(enabled);
106106
107107 auto lightingModelConfig = qApp->getRenderEngine()->getConfiguration()->getConfig<MakeLightingModel>("RenderMainView.LightingModel");
@@ -113,11 +113,11 @@ void RenderScriptingInterface::forceAmbientOcclusionEnabled(bool enabled) { · 5 unmodified lines
113113 }
114114
115115 bool RenderScriptingInterface::getAntialiasingEnabled() {
116− return _antialiasingEnabled.load();
116+ return _antialiasingEnabled;
117117 }
118118
119119 void RenderScriptingInterface::setAntialiasingEnabled(bool enabled) {
120− if (_antialiasingEnabled.load() != enabled) {
120+ if (_antialiasingEnabled != enabled) {
121121 forceAntialiasingEnabled(enabled);
122122 emit settingsChanged();
123123 }
@@ -125,7 +125,7 @@ void RenderScriptingInterface::setAntialiasingEnabled(bool enabled) { · 1 unmodified line
125125
126126 void RenderScriptingInterface::forceAntialiasingEnabled(bool enabled) {
127127 _renderSettingLock.withWriteLock([&] {
128− _antialiasingEnabled.store(enabled);
128+ _antialiasingEnabled = (enabled);
129129 _antialiasingEnabledSetting.set(enabled);
130130
131131 auto mainViewJitterCamConfig = qApp->getRenderEngine()->getConfiguration()->getConfig<JitterSample>("RenderMainView.JitterCam");