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
2 changes: 1 addition & 1 deletion Graphics/GraphicsTools/include/RenderStateCacheImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class RenderStateCacheImpl final : public ObjectBase<IRenderStateCache>
private:
RefCntAutoPtr<IRenderDevice> m_pDevice;
const RENDER_DEVICE_TYPE m_DeviceType;
const size_t m_DeviceHash; // Hash of the device-specific properties
const XXH128Hash m_DeviceHash; // Hash of the device-specific properties
const RenderStateCacheCreateInfo m_CI;
RefCntAutoPtr<IShaderSourceInputStreamFactory> m_pReloadSource;
RefCntAutoPtr<ISerializationDevice> m_pSerializationDevice;
Expand Down
2 changes: 2 additions & 0 deletions Graphics/GraphicsTools/interface/XXH128Hasher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ struct XXH128State final

void Update(const ShaderCreateInfo& ShaderCI) noexcept;

void Update(const XXH128Hash& Hash) noexcept;

template <typename T>
typename std::enable_if<(std::is_same<typename std::remove_cv<T>::type, SamplerDesc>::value ||
std::is_same<typename std::remove_cv<T>::type, StencilOpDesc>::value ||
Expand Down
8 changes: 5 additions & 3 deletions Graphics/GraphicsTools/src/RenderStateCacheImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,15 @@ std::string RenderStateCacheImpl::MakeHashStr(const char* Name, const XXH128Hash
}


static size_t ComputeDeviceAttribsHash(IRenderDevice* pDevice)
static XXH128Hash ComputeDeviceAttribsHash(IRenderDevice* pDevice)
{
if (pDevice == nullptr)
return 0;
return {};

const RenderDeviceInfo& DeviceInfo = pDevice->GetDeviceInfo();
return ComputeHash(DeviceInfo.Type, DeviceInfo.NDC.MinZ, DeviceInfo.Features.SeparablePrograms);
XXH128State Hasher;
Hasher.Update(DeviceInfo.Type, DeviceInfo.NDC.MinZ, DeviceInfo.Features.SeparablePrograms);
return Hasher.Digest();
}

RenderStateCacheImpl::RenderStateCacheImpl(IReferenceCounters* pRefCounters,
Expand Down
5 changes: 5 additions & 0 deletions Graphics/GraphicsTools/src/XXH128Hasher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,9 @@ void XXH128State::Update(const ShaderCreateInfo& ShaderCI) noexcept
}
}

void XXH128State::Update(const XXH128Hash& Hash) noexcept
{
Update(Hash.LowPart, Hash.HighPart);
}

} // namespace Diligent
Loading