git.s-ol.nu ~forks/DiligentTools / 2001a8b
GLTF Loader: made Model::GPUDataInitialized atomic assiduous 10 months ago
2 changed file(s) with 5 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
3232 #include <cfloat>
3333 #include <unordered_map>
3434 #include <mutex>
35 #include <atomic>
3536
3637 #include "../../../DiligentCore/Graphics/GraphicsEngine/interface/RenderDevice.h"
3738 #include "../../../DiligentCore/Graphics/GraphicsEngine/interface/DeviceContext.h"
424425
425426 bool IsGPUDataInitialized() const
426427 {
427 return GPUDataInitialized;
428 return GPUDataInitialized.load();
428429 }
429430
430431 void Transform(const float4x4& Matrix);
488489 Node* FindNode(Node* parent, Uint32 index);
489490 Node* NodeFromIndex(uint32_t index);
490491
491 bool GPUDataInitialized = false;
492 std::atomic_bool GPUDataInitialized = false;
492493
493494 struct BufferInfo
494495 {
910910
911911 void Model::PrepareGPUResources(IRenderDevice* pDevice, IDeviceContext* pCtx)
912912 {
913 if (GPUDataInitialized)
913 if (GPUDataInitialized.load())
914914 return;
915915
916916 std::vector<StateTransitionDesc> Barriers;
10631063 if (!Barriers.empty())
10641064 pCtx->TransitionResourceStates(static_cast<Uint32>(Barriers.size()), Barriers.data());
10651065
1066 GPUDataInitialized = true;
1066 GPUDataInitialized.store(true);
10671067 }
10681068
10691069 namespace