Added a mutex to protect the mesh and BLAS lists in the RayTracingFeatureProcessor

Signed-off-by: dmcdiar <dmcdiar@amazon.com>
This commit is contained in:
dmcdiar
2021-09-20 12:13:29 -07:00
parent efce1033bc
commit 154b6dc461
2 changed files with 9 additions and 0 deletions
@@ -89,6 +89,9 @@ namespace AZ
RHI::Ptr<RHI::Device> device = RHI::RHISystemInterface::Get()->GetDevice();
uint32_t objectIndex = objectId.GetIndex();
// lock the mutex to protect the mesh and BLAS lists
AZStd::unique_lock<AZStd::mutex> lock(m_mutex);
MeshMap::iterator itMesh = m_meshes.find(objectIndex);
if (itMesh == m_meshes.end())
{
@@ -169,6 +172,9 @@ namespace AZ
return;
}
// lock the mutex to protect the mesh and BLAS lists
AZStd::unique_lock<AZStd::mutex> lock(m_mutex);
MeshMap::iterator itMesh = m_meshes.find(objectId.GetIndex());
if (itMesh != m_meshes.end())
{
@@ -223,6 +223,9 @@ namespace AZ
// cached TransformServiceFeatureProcessor
TransformServiceFeatureProcessor* m_transformServiceFeatureProcessor = nullptr;
// mutex for the mesh and BLAS lists
AZStd::mutex m_mutex;
// structure for data in the m_meshInfoBuffer, shaders that use the buffer must match this type
struct MeshInfo
{