Skip to content

Commit 9014dee

Browse files
IRenderStateCache: added GetReloadVersion method
1 parent 54d524a commit 9014dee

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

Graphics/GraphicsTools/include/RenderStateCacheImpl.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Diligent Graphics LLC
2+
* Copyright 2024-2025 Diligent Graphics LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -105,6 +105,11 @@ class RenderStateCacheImpl final : public ObjectBase<IRenderStateCache>
105105
return m_pDearchiver ? m_pDearchiver->GetContentVersion() : ~0u;
106106
}
107107

108+
virtual Uint32 DILIGENT_CALL_TYPE GetReloadVersion() const override final
109+
{
110+
return m_ReloadVersion;
111+
}
112+
108113
bool CreateShaderInternal(const ShaderCreateInfo& ShaderCI,
109114
IShader** ppShader);
110115

@@ -150,6 +155,8 @@ class RenderStateCacheImpl final : public ObjectBase<IRenderStateCache>
150155

151156
std::mutex m_ReloadablePipelinesMtx;
152157
std::unordered_map<UniqueIdentifier, RefCntWeakPtr<IPipelineState>> m_ReloadablePipelines;
158+
159+
Uint32 m_ReloadVersion = 0;
153160
};
154161

155162
} // namespace Diligent

Graphics/GraphicsTools/interface/RenderStateCache.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2024 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -250,6 +250,11 @@ DILIGENT_BEGIN_INTERFACE(IRenderStateCache, IObject)
250250
/// Returns the content version of the cache data.
251251
/// If no data has been loaded, returns ~0u (aka 0xFFFFFFFF).
252252
VIRTUAL Uint32 METHOD(GetContentVersion)(THIS) CONST PURE;
253+
254+
255+
/// Returns the reload version of the cache data.
256+
/// The reload version is incremented every time the cache is reloaded.
257+
VIRTUAL Uint32 METHOD(GetReloadVersion)(THIS) CONST PURE;
253258
};
254259
DILIGENT_END_INTERFACE
255260

@@ -269,6 +274,7 @@ DILIGENT_END_INTERFACE
269274
# define IRenderStateCache_Reset(This) CALL_IFACE_METHOD(RenderStateCache, Reset, This)
270275
# define IRenderStateCache_Reload(This, ...) CALL_IFACE_METHOD(RenderStateCache, Reload, This, __VA_ARGS__)
271276
# define IRenderStateCache_GetContentVersion(This) CALL_IFACE_METHOD(RenderStateCache, GetContentVersion, This)
277+
# define IRenderStateCache_GetReloadVersion(This) CALL_IFACE_METHOD(RenderStateCache, GetReloadVersion, This)
272278
// clang-format on
273279

274280
#endif

Graphics/GraphicsTools/src/RenderStateCacheImpl.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2024 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -941,6 +941,8 @@ Uint32 RenderStateCacheImpl::Reload(ReloadGraphicsPipelineCallbackType ReloadGra
941941
}
942942
}
943943

944+
++m_ReloadVersion;
945+
944946
return NumStatesReloaded;
945947
}
946948

0 commit comments

Comments
 (0)