fix mingw-gcc bug like #1239 (#1345)

This commit is contained in:
云风 2018-03-06 00:00:54 +08:00 committed by Branimir Karadžić
parent fa7a871ca7
commit c5f7ad598b

View File

@ -464,11 +464,20 @@ namespace bgfx { namespace d3d12
};
BX_STATIC_ASSERT(BX_COUNTOF(s_heapProperties) == HeapProperty::Count);
static inline D3D12_HEAP_PROPERTIES ID3D12DeviceGetCustomHeapProperties(ID3D12Device *device, UINT nodeMask, D3D12_HEAP_TYPE heapType)
{
// NOTICE: gcc trick for return struct
typedef void (STDMETHODCALLTYPE ID3D12Device::*GetCustomHeapProperties_f)(D3D12_HEAP_PROPERTIES *, UINT, D3D12_HEAP_TYPE);
D3D12_HEAP_PROPERTIES ret;
(device->*(GetCustomHeapProperties_f)(&ID3D12Device::GetCustomHeapProperties))(&ret, nodeMask, heapType);
return ret;
}
static void initHeapProperties(ID3D12Device* _device, D3D12_HEAP_PROPERTIES& _properties)
{
if (D3D12_HEAP_TYPE_CUSTOM != _properties.Type)
{
_properties = _device->GetCustomHeapProperties(1, _properties.Type);
_properties = ID3D12DeviceGetCustomHeapProperties(_device, 1, _properties.Type);
}
}