From c5f7ad598bf5f2204f9b96499baa323808798d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=91=E9=A3=8E?= Date: Tue, 6 Mar 2018 00:00:54 +0800 Subject: [PATCH] fix mingw-gcc bug like #1239 (#1345) --- src/renderer_d3d12.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/renderer_d3d12.cpp b/src/renderer_d3d12.cpp index 72c5ae81f..70890ac95 100644 --- a/src/renderer_d3d12.cpp +++ b/src/renderer_d3d12.cpp @@ -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); } }