summaryrefslogtreecommitdiffstats
path: root/Graphics
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-04-14 15:57:17 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-04-14 15:57:17 +0000
commit53e45f6540066115332a1471b98182b3baa82feb (patch)
tree2374329947d5eb318dc72e9fc3d2def0011aba2b /Graphics
parentImplemented generate PSO cache warmup when texture view is created (diff)
downloadDiligentCore-53e45f6540066115332a1471b98182b3baa82feb.tar.gz
DiligentCore-53e45f6540066115332a1471b98182b3baa82feb.zip
Added comments about Fence thread safety; minor code improvements
Diffstat (limited to 'Graphics')
-rw-r--r--Graphics/GraphicsEngine/interface/Fence.h4
-rw-r--r--Graphics/GraphicsEngineVulkan/include/FenceVkImpl.h5
-rw-r--r--Graphics/GraphicsTools/include/TextureUploader.h6
-rw-r--r--Graphics/GraphicsTools/include/TextureUploaderBase.h2
4 files changed, 13 insertions, 4 deletions
diff --git a/Graphics/GraphicsEngine/interface/Fence.h b/Graphics/GraphicsEngine/interface/Fence.h
index 7a7ee8c5..d2a27473 100644
--- a/Graphics/GraphicsEngine/interface/Fence.h
+++ b/Graphics/GraphicsEngine/interface/Fence.h
@@ -54,6 +54,10 @@ public:
virtual const FenceDesc& GetDesc()const override = 0;
/// Returns the last completed value signaled by the GPU
+
+ /// \remarks This method is not thread safe (even if the fence object is protected by mutex)
+ /// and must only be called by the same thread that signals the fence via
+ /// IDeviceContext::SignalFence().
virtual Uint64 GetCompletedValue() = 0;
/// Resets the fence to the specified value.
diff --git a/Graphics/GraphicsEngineVulkan/include/FenceVkImpl.h b/Graphics/GraphicsEngineVulkan/include/FenceVkImpl.h
index 7004d92e..894451e6 100644
--- a/Graphics/GraphicsEngineVulkan/include/FenceVkImpl.h
+++ b/Graphics/GraphicsEngineVulkan/include/FenceVkImpl.h
@@ -49,6 +49,11 @@ public:
bool IsDeviceInternal = false);
~FenceVkImpl();
+ // Note that this method is not thread-safe. The reason is that VulkanFencePool is not thread
+ // safe, and DeviceContextVkImpl::SignalFence() adds the fence to the pending fences list that
+ // are signalled later by the command context when it submits the command list. So there is no
+ // guarantee that the fence pool is not accessed simultaneously by multiple threads even if the
+ // fence object itself is protected by mutex.
virtual Uint64 GetCompletedValue()override final;
/// Resets the fence to the specified value.
diff --git a/Graphics/GraphicsTools/include/TextureUploader.h b/Graphics/GraphicsTools/include/TextureUploader.h
index dbbf65d0..8066e0ca 100644
--- a/Graphics/GraphicsTools/include/TextureUploader.h
+++ b/Graphics/GraphicsTools/include/TextureUploader.h
@@ -30,9 +30,9 @@ namespace Diligent
{
struct UploadBufferDesc
{
- Uint32 Width = 0;
- Uint32 Height = 0;
- Uint32 Depth = 1;
+ Uint32 Width = 0;
+ Uint32 Height = 0;
+ Uint32 Depth = 1;
TEXTURE_FORMAT Format = TEX_FORMAT_UNKNOWN;
bool operator == (const UploadBufferDesc &rhs) const
diff --git a/Graphics/GraphicsTools/include/TextureUploaderBase.h b/Graphics/GraphicsTools/include/TextureUploaderBase.h
index cd26c86d..d1c460a1 100644
--- a/Graphics/GraphicsTools/include/TextureUploaderBase.h
+++ b/Graphics/GraphicsTools/include/TextureUploaderBase.h
@@ -66,7 +66,7 @@ namespace Diligent
class TextureUploaderBase : public ObjectBase<ITextureUploader>
{
public:
- TextureUploaderBase(IReferenceCounters *pRefCounters, IRenderDevice *pDevice, const TextureUploaderDesc Desc) :
+ TextureUploaderBase(IReferenceCounters* pRefCounters, IRenderDevice* pDevice, const TextureUploaderDesc Desc) :
ObjectBase<ITextureUploader>(pRefCounters),
m_pDevice(pDevice)
{}