File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Graphics/GraphicsTools/src Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,8 @@ class ReloadableShader final : public ObjectBase<IShader>
116116 {
117117 if (ppInterface == nullptr )
118118 return ;
119+ DEV_CHECK_ERR (*ppInterface == nullptr , " Overwriting reference to an existing object may result in memory leaks" );
120+ *ppInterface = nullptr ;
119121
120122 if (IID == IID_InternalImpl || IID == IID_Shader || IID == IID_DeviceObject || IID == IID_Unknown)
121123 {
@@ -129,6 +131,14 @@ class ReloadableShader final : public ObjectBase<IShader>
129131 // (PipelineStateD3D11Impl, PipelineStateD3D12Impl, etc.)
130132 m_pShader->QueryInterface (IID, ppInterface);
131133 }
134+
135+ if (*ppInterface == nullptr )
136+ {
137+ // This will handle IID_SerializedShader.
138+ RefCntAutoPtr<IObject> pObject;
139+ m_pShader->GetReferenceCounters ()->QueryObject (&pObject);
140+ pObject->QueryInterface (IID, ppInterface);
141+ }
132142 }
133143
134144 // Delegate all calls to the internal shader object
@@ -187,6 +197,8 @@ class ReloadablePipelineState final : public ObjectBase<IPipelineState>
187197 {
188198 if (ppInterface == nullptr )
189199 return ;
200+ DEV_CHECK_ERR (*ppInterface == nullptr , " Overwriting reference to an existing object may result in memory leaks" );
201+ *ppInterface = nullptr ;
190202
191203 if (IID == IID_InternalImpl || IID == IID_PipelineState || IID == IID_DeviceObject || IID == IID_Unknown)
192204 {
You can’t perform that action at this time.
0 commit comments