@@ -144,13 +144,13 @@ std::string RenderStateCacheImpl::MakeHashStr(const char* Name, const XXH128Hash
144144}
145145
146146
147- static size_t ComputeDeviceAttribsHash (IRenderDevice* pDevice)
147+ static void ComputeDeviceAttribsHash (XXH128State& Hasher, IRenderDevice* pDevice)
148148{
149- if (pDevice = = nullptr )
150- return 0 ;
151-
152- const RenderDeviceInfo& DeviceInfo = pDevice-> GetDeviceInfo ( );
153- return ComputeHash (DeviceInfo. Type , DeviceInfo. NDC . MinZ , DeviceInfo. Features . SeparablePrograms );
149+ if (pDevice ! = nullptr )
150+ {
151+ const RenderDeviceInfo& DeviceInfo = pDevice-> GetDeviceInfo ();
152+ Hasher. Update (DeviceInfo. Type , DeviceInfo. NDC . MinZ , DeviceInfo. Features . SeparablePrograms );
153+ }
154154}
155155
156156RenderStateCacheImpl::RenderStateCacheImpl (IReferenceCounters* pRefCounters,
@@ -159,7 +159,6 @@ RenderStateCacheImpl::RenderStateCacheImpl(IReferenceCounters* pRe
159159 // clang-format off
160160 m_pDevice {CreateInfo.pDevice },
161161 m_DeviceType {CreateInfo.pDevice != nullptr ? CreateInfo.pDevice ->GetDeviceInfo ().Type : RENDER_DEVICE_TYPE_UNDEFINED},
162- m_DeviceHash {ComputeDeviceAttribsHash (CreateInfo.pDevice )},
163162 m_CI {CreateInfo},
164163 m_pReloadSource{CreateInfo.pReloadSource }
165164// clang-format on
@@ -318,7 +317,8 @@ bool RenderStateCacheImpl::CreateShaderInternal(const ShaderCreateInfo& ShaderCI
318317#else
319318 constexpr bool IsDebug = false ;
320319#endif
321- Hasher.Update (ShaderCI, m_DeviceHash, IsDebug);
320+ ComputeDeviceAttribsHash (Hasher, m_pDevice);
321+ Hasher.Update (ShaderCI, IsDebug);
322322 const XXH128Hash Hash = Hasher.Digest ();
323323
324324 // First, try to check if the shader has already been requested
@@ -765,7 +765,8 @@ bool RenderStateCacheImpl::CreatePipelineStateInternal(const CreateInfoType& PSO
765765 }
766766
767767 XXH128State Hasher;
768- Hasher.Update (PSOCreateInfo, m_DeviceHash);
768+ ComputeDeviceAttribsHash (Hasher, m_pDevice);
769+ Hasher.Update (PSOCreateInfo);
769770 const auto Hash = Hasher.Digest ();
770771
771772 // First, try to check if the PSO has already been requested
0 commit comments