summaryrefslogtreecommitdiffstats
path: root/AssetLoader
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2021-01-13 21:11:03 +0000
committerassiduous <assiduous@diligentgraphics.com>2021-01-13 21:11:03 +0000
commit2001a8b9d2399f3697d2ec8c5c52c43c29bc72f2 (patch)
treee2817a5437d49250fb262a4495c89fda9343914a /AssetLoader
parentGLTF Loader: moved AlphaMode parameter to Material::ShaderAttribs (diff)
downloadDiligentTools-2001a8b9d2399f3697d2ec8c5c52c43c29bc72f2.tar.gz
DiligentTools-2001a8b9d2399f3697d2ec8c5c52c43c29bc72f2.zip
GLTF Loader: made Model::GPUDataInitialized atomic
Diffstat (limited to 'AssetLoader')
-rw-r--r--AssetLoader/interface/GLTFLoader.hpp5
-rw-r--r--AssetLoader/src/GLTFLoader.cpp4
2 files changed, 5 insertions, 4 deletions
diff --git a/AssetLoader/interface/GLTFLoader.hpp b/AssetLoader/interface/GLTFLoader.hpp
index a4bc29f..125c16a 100644
--- a/AssetLoader/interface/GLTFLoader.hpp
+++ b/AssetLoader/interface/GLTFLoader.hpp
@@ -33,6 +33,7 @@
#include <cfloat>
#include <unordered_map>
#include <mutex>
+#include <atomic>
#include "../../../DiligentCore/Graphics/GraphicsEngine/interface/RenderDevice.h"
#include "../../../DiligentCore/Graphics/GraphicsEngine/interface/DeviceContext.h"
@@ -425,7 +426,7 @@ struct Model
bool IsGPUDataInitialized() const
{
- return GPUDataInitialized;
+ return GPUDataInitialized.load();
}
void Transform(const float4x4& Matrix);
@@ -489,7 +490,7 @@ private:
Node* FindNode(Node* parent, Uint32 index);
Node* NodeFromIndex(uint32_t index);
- bool GPUDataInitialized = false;
+ std::atomic_bool GPUDataInitialized = false;
struct BufferInfo
{
diff --git a/AssetLoader/src/GLTFLoader.cpp b/AssetLoader/src/GLTFLoader.cpp
index 13f5886..485def6 100644
--- a/AssetLoader/src/GLTFLoader.cpp
+++ b/AssetLoader/src/GLTFLoader.cpp
@@ -911,7 +911,7 @@ void Model::LoadTextures(IRenderDevice* pDevice,
void Model::PrepareGPUResources(IRenderDevice* pDevice, IDeviceContext* pCtx)
{
- if (GPUDataInitialized)
+ if (GPUDataInitialized.load())
return;
std::vector<StateTransitionDesc> Barriers;
@@ -1064,7 +1064,7 @@ void Model::PrepareGPUResources(IRenderDevice* pDevice, IDeviceContext* pCtx)
if (!Barriers.empty())
pCtx->TransitionResourceStates(static_cast<Uint32>(Barriers.size()), Barriers.data());
- GPUDataInitialized = true;
+ GPUDataInitialized.store(true);
}
namespace