Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Graphics/GraphicsTools/interface/RenderStateCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
/// Defines Diligent::IRenderStateCache interface

#include "../../GraphicsEngine/interface/RenderDevice.h"
#include "../../Archiver/interface/ArchiverFactory.h"

DILIGENT_BEGIN_NAMESPACE(Diligent)

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

/// Let user decide how to get archiver factory, either Load DLL or static link
IArchiverFactory* pArchiverFactory DEFAULT_INITIALIZER(nullptr);

#if DILIGENT_CPP_INTERFACE
constexpr RenderStateCacheCreateInfo() noexcept
{}
Expand Down
19 changes: 7 additions & 12 deletions Graphics/GraphicsTools/src/RenderStateCacheImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@

#include "Archiver.h"
#include "Dearchiver.h"
#include "ArchiverFactory.h"
#include "ArchiverFactoryLoader.h"

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

IArchiverFactory* pArchiverFactory = nullptr;
#if EXPLICITLY_LOAD_ARCHIVER_FACTORY_DLL
auto GetArchiverFactory = LoadArchiverFactory();
if (GetArchiverFactory != nullptr)
{
pArchiverFactory = GetArchiverFactory();
}
#else
pArchiverFactory = GetArchiverFactory();
#endif
IArchiverFactory* pArchiverFactory = CreateInfo.pArchiverFactory;

VERIFY_EXPR(pArchiverFactory != nullptr);

SerializationDeviceCreateInfo SerializationDeviceCI;
Expand Down Expand Up @@ -964,6 +954,11 @@ Uint32 RenderStateCacheImpl::Reload(ReloadGraphicsPipelineCallbackType ReloadGra

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

//Fix <Windows.h> conflict
#ifdef CreateDirectory
# undef CreateDirectory
#endif

std::string GetRenderStateCacheFilePath(const char* CacheLocation, const char* AppName, RENDER_DEVICE_TYPE DeviceType)
{
if (CacheLocation == nullptr)
Expand Down