Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 1011 vs 1012 for /trunk/Source Code/Platform/Video/Shaders/ShaderProgram.cpp

Diff revisions: vs.
  @@ -10,6 +10,7 @@
10 10 #include "Rendering/Lighting/ShadowMapping/Headers/ShadowMap.h"
11 11 #include "Platform/Video/Headers/GFXDevice.h"
12 12 #include "Platform/File/Headers/FileUpdateMonitor.h"
13 + #include "Platform/File/Headers/FileWatcherManager.h"
13 14 #include "Platform/Video/Buffers/ShaderBuffer/Headers/ShaderBuffer.h"
14 15
15 16 namespace Divide {
  @@ -29,7 +30,7 @@
29 30
30 31 SharedLock ShaderProgram::_programLock;
31 32
32 - std::unique_ptr<FW::FileWatcher> ShaderProgram::s_shaderFileWatcher;
33 + I64 ShaderProgram::s_shaderFileWatcherID = -1;
33 34
34 35 ShaderProgram::ShaderProgram(GFXDevice& context, size_t descriptorHash, const stringImpl& name, const stringImpl& resourceName, const stringImpl& resourceLocation, bool asyncLoad)
35 36 : CachedResource(ResourceType::GPU_OBJECT, descriptorHash, name, resourceName, resourceLocation),
  @@ -133,9 +134,6 @@
133 134 }
134 135 _recompileQueue.pop();
135 136 }
136 - if (!Config::Build::IS_SHIPPING_BUILD) {
137 - s_shaderFileWatcher->update();
138 - }
139 137 }
140 138
141 139 /// Calling this will force a recompilation of all shader stages for the program
  @@ -220,15 +218,16 @@
220 218 }
221 219
222 220 void ShaderProgram::onStartup(GFXDevice& context, ResourceCache& parentCache) {
223 - s_shaderFileWatcher = std::make_unique<FW::FileWatcher>();
224 -
225 221 if (!Config::Build::IS_SHIPPING_BUILD) {
222 + FileWatcher& watcher = FileWatcherManager::allocateWatcher();
223 + s_shaderFileWatcherID = watcher.getGUID();
224 + s_fileWatcherListener.addIgnoredEndCharacter('~');
225 + s_fileWatcherListener.addIgnoredExtension("tmp");
226 +
226 227 vectorImpl<stringImpl> atomLocations = getAllAtomLocations();
227 228 for (const stringImpl& loc : atomLocations) {
228 229 createDirectories(loc.c_str());
229 - s_fileWatcherListener.addIgnoredEndCharacter('~');
230 - s_fileWatcherListener.addIgnoredExtension("tmp");
231 - s_shaderFileWatcher->addWatch(loc, &s_fileWatcherListener);
230 + watcher().addWatch(loc, &s_fileWatcherListener);
232 231 }
233 232 }
234 233
  @@ -252,8 +251,8 @@
252 251 while (!_recompileQueue.empty()) {
253 252 _recompileQueue.pop();
254 253 }
255 -
256 - s_shaderFileWatcher.reset();
254 + FileWatcherManager::deallocateWatcher(s_shaderFileWatcherID);
255 + s_shaderFileWatcherID = -1;
257 256 }
258 257
259 258 bool ShaderProgram::updateAll(const U64 deltaTimeUS) {