mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
DX11: Fixed assert when running with GPA.
This commit is contained in:
parent
5b415315dc
commit
41d5bcfc1b
2 changed files with 13 additions and 14 deletions
|
@ -65,26 +65,22 @@ namespace bgfx
|
||||||
BX_CHECK(_expected == count, "RefCount is %d (expected %d).", count, _expected); \
|
BX_CHECK(_expected == count, "RefCount is %d (expected %d).", count, _expected); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
# define DX_RELEASE(_ptr, _expected) \
|
#else
|
||||||
|
# define DX_CHECK_REFCOUNT(_ptr, _expected)
|
||||||
|
#endif // BGFX_CONFIG_DEBUG
|
||||||
|
|
||||||
|
#define _DX_RELEASE(_ptr, _expected, _check) \
|
||||||
do { \
|
do { \
|
||||||
if (NULL != _ptr) \
|
if (NULL != _ptr) \
|
||||||
{ \
|
{ \
|
||||||
ULONG count = _ptr->Release(); \
|
ULONG count = _ptr->Release(); \
|
||||||
BX_CHECK(_expected == count, "RefCount is %d (expected %d).", count, _expected); \
|
_check(_expected == count, "RefCount is %d (expected %d).", count, _expected); \
|
||||||
_ptr = NULL; \
|
_ptr = NULL; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else
|
|
||||||
# define DX_CHECK_REFCOUNT(_ptr, _expected)
|
#define DX_RELEASE(_ptr, _expected) _DX_RELEASE(_ptr, _expected, BX_CHECK)
|
||||||
# define DX_RELEASE(_ptr, _expected) \
|
#define DX_RELEASE_WARNONLY(_ptr, _expected) _DX_RELEASE(_ptr, _expected, BX_WARN)
|
||||||
do { \
|
|
||||||
if (NULL != _ptr) \
|
|
||||||
{ \
|
|
||||||
_ptr->Release(); \
|
|
||||||
_ptr = NULL; \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
#endif // BGFX_CONFIG_DEBUG
|
|
||||||
|
|
||||||
inline int getRefCount(IUnknown* _interface)
|
inline int getRefCount(IUnknown* _interface)
|
||||||
{
|
{
|
||||||
|
|
|
@ -454,7 +454,10 @@ namespace bgfx
|
||||||
|
|
||||||
hr = device->GetParent(__uuidof(IDXGIAdapter), (void**)&adapter);
|
hr = device->GetParent(__uuidof(IDXGIAdapter), (void**)&adapter);
|
||||||
BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 device.");
|
BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 device.");
|
||||||
DX_RELEASE(device, 2);
|
|
||||||
|
// GPA increases device ref count and triggers assert in debug
|
||||||
|
// build. Warn only instead.
|
||||||
|
DX_RELEASE_WARNONLY(device, 2);
|
||||||
|
|
||||||
hr = adapter->GetDesc(&m_adapterDesc);
|
hr = adapter->GetDesc(&m_adapterDesc);
|
||||||
BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 device.");
|
BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 device.");
|
||||||
|
|
Loading…
Reference in a new issue