-
I am passing in an ID3D11Device pointer to bgfx::init to use an existing device. It appears bgfx will take this pointer as is but yet it will release the pointer on shutdown. This seems asymmetrical. Is this on purpose for some reason? Why not AddRef and Release or not Release? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
Yeah, it should AddRef to it. |
Beta Was this translation helpful? Give feedback.
-
Can you try changing code here: Line 886 in 3b9b2aa To this: if (NULL != m_device)
{
m_device->AddRef();
m_device->GetImmediateContext(&m_deviceCtx);
if (NULL == m_deviceCtx)
{
BX_TRACE("Init error: Unable to retrieve Direct3D11 ImmediateContext.");
goto error;
}
m_featureLevel = m_device->GetFeatureLevel();
}
else |
Beta Was this translation helpful? Give feedback.
-
I can try tomorrow. I'm a bit worried changing this will break someone and they won't know it since it will just leak. How many people use this feature? |
Beta Was this translation helpful? Give feedback.
-
I've add a single line to AddRef the device and that seems to work for my scenario. I will send a PR soon. |
Beta Was this translation helpful? Give feedback.
Yeah, it should AddRef to it.