Skip to content

Commit 7d9b851

Browse files
committed
RenderStateCacheCreateInfo takes IArchiverFactory *pArchiverFactory as input.
1 parent 72633aa commit 7d9b851

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

Graphics/GraphicsTools/interface/RenderStateCache.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
/// Defines Diligent::IRenderStateCache interface
3131

3232
#include "../../GraphicsEngine/interface/RenderDevice.h"
33+
#include "ArchiverFactory.h"
3334

3435
DILIGENT_BEGIN_NAMESPACE(Diligent)
3536

@@ -76,6 +77,9 @@ struct RenderStateCacheCreateInfo
7677
/// shaders. If null, original source factory will be used.
7778
IShaderSourceInputStreamFactory* pReloadSource DEFAULT_INITIALIZER(nullptr);
7879

80+
/// Let user decide how to get archiver factory, either Load DLL or static link
81+
IArchiverFactory* pArchiverFactory DEFAULT_INITIALIZER(nullptr);
82+
7983
#if DILIGENT_CPP_INTERFACE
8084
constexpr RenderStateCacheCreateInfo() noexcept
8185
{}

Graphics/GraphicsTools/src/RenderStateCacheImpl.cpp

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@
3838

3939
#include "Archiver.h"
4040
#include "Dearchiver.h"
41-
#include "ArchiverFactory.h"
42-
#include "ArchiverFactoryLoader.h"
4341

4442
#include "PipelineStateBase.hpp"
4543
#include "RefCntAutoPtr.hpp"
@@ -179,16 +177,8 @@ RenderStateCacheImpl::RenderStateCacheImpl(IReferenceCounters* pRe
179177
if (CreateInfo.pDevice == nullptr)
180178
LOG_ERROR_AND_THROW("CreateInfo.pDevice must not be null");
181179

182-
IArchiverFactory* pArchiverFactory = nullptr;
183-
#if EXPLICITLY_LOAD_ARCHIVER_FACTORY_DLL
184-
auto GetArchiverFactory = LoadArchiverFactory();
185-
if (GetArchiverFactory != nullptr)
186-
{
187-
pArchiverFactory = GetArchiverFactory();
188-
}
189-
#else
190-
pArchiverFactory = GetArchiverFactory();
191-
#endif
180+
IArchiverFactory* pArchiverFactory = CreateInfo.pArchiverFactory;
181+
192182
VERIFY_EXPR(pArchiverFactory != nullptr);
193183

194184
SerializationDeviceCreateInfo SerializationDeviceCI;
@@ -964,6 +954,11 @@ Uint32 RenderStateCacheImpl::Reload(ReloadGraphicsPipelineCallbackType ReloadGra
964954

965955
static constexpr char RenderStateCacheFileExtension[] = ".diligentcache";
966956

957+
//Fix <Windows.h> conflict
958+
#ifdef CreateDirectory
959+
# undef CreateDirectory
960+
#endif
961+
967962
std::string GetRenderStateCacheFilePath(const char* CacheLocation, const char* AppName, RENDER_DEVICE_TYPE DeviceType)
968963
{
969964
if (CacheLocation == nullptr)

0 commit comments

Comments
 (0)