Skip to content

Commit

Permalink
Minor changes to support Clang on Windows (#3216)
Browse files Browse the repository at this point in the history
* Minor changes to support Clang on Windows

* Use _MSC_VER instead of BX_PLATFORM_WINDOWS
  • Loading branch information
justinboswell authored Dec 7, 2023
1 parent 07be0f2 commit db40a04
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/renderer_d3d12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,13 +474,13 @@ namespace bgfx { namespace d3d12

static inline D3D12_HEAP_PROPERTIES ID3D12DeviceGetCustomHeapProperties(ID3D12Device *device, uint32_t nodeMask, D3D12_HEAP_TYPE heapType)
{
#if BX_COMPILER_MSVC
#if BX_COMPILER_MSVC || (BX_COMPILER_CLANG && defined(_MSC_VER))
return device->GetCustomHeapProperties(nodeMask, heapType);
#else
D3D12_HEAP_PROPERTIES ret;
device->GetCustomHeapProperties(&ret, nodeMask, heapType);
return ret;
#endif // BX_COMPILER_MSVC
#endif // BX_COMPILER_MSVC || (BX_COMPILER_CLANG && defined(_MSC_VER))
}

static void initHeapProperties(ID3D12Device* _device, D3D12_HEAP_PROPERTIES& _properties)
Expand Down Expand Up @@ -525,11 +525,11 @@ namespace bgfx { namespace d3d12
void* ptr;
DX_CHECK(resource->Map(0, NULL, &ptr) );
D3D12_RESOURCE_ALLOCATION_INFO rai;
#if BX_COMPILER_MSVC
#if BX_COMPILER_MSVC || (BX_COMPILER_CLANG && defined(_MSC_VER))
rai = _device->GetResourceAllocationInfo(1, 1, _resourceDesc);
#else
_device->GetResourceAllocationInfo(&rai, 1, 1, _resourceDesc);
#endif // BX_COMPILER_MSVC
#endif // BX_COMPILER_MSVC || (BX_COMPILER_CLANG && defined(_MSC_VER))
bx::memSet(ptr, 0, size_t(rai.SizeInBytes) );
resource->Unmap(0, NULL);
}
Expand Down Expand Up @@ -626,35 +626,35 @@ namespace bgfx { namespace d3d12

inline D3D12_CPU_DESCRIPTOR_HANDLE getCPUHandleHeapStart(ID3D12DescriptorHeap* _heap)
{
#if BX_COMPILER_MSVC
#if BX_COMPILER_MSVC || (BX_COMPILER_CLANG && defined(_MSC_VER))
return _heap->GetCPUDescriptorHandleForHeapStart();
#else
D3D12_CPU_DESCRIPTOR_HANDLE handle;
_heap->GetCPUDescriptorHandleForHeapStart(&handle);
return handle;
#endif // BX_COMPILER_MSVC
#endif // BX_COMPILER_MSVC || (BX_COMPILER_CLANG && defined(_MSC_VER))
}

inline D3D12_GPU_DESCRIPTOR_HANDLE getGPUHandleHeapStart(ID3D12DescriptorHeap* _heap)
{
#if BX_COMPILER_MSVC
#if BX_COMPILER_MSVC || (BX_COMPILER_CLANG && defined(_MSC_VER))
return _heap->GetGPUDescriptorHandleForHeapStart();
#else
D3D12_GPU_DESCRIPTOR_HANDLE handle;
_heap->GetGPUDescriptorHandleForHeapStart(&handle);
return handle;
#endif // BX_COMPILER_MSVC
#endif // BX_COMPILER_MSVC || (BX_COMPILER_CLANG && defined(_MSC_VER))
}

inline D3D12_RESOURCE_DESC getResourceDesc(ID3D12Resource* _resource)
{
#if BX_COMPILER_MSVC
#if BX_COMPILER_MSVC || (BX_COMPILER_CLANG && defined(_MSC_VER))
return _resource->GetDesc();
#else
D3D12_RESOURCE_DESC desc;
_resource->GetDesc(&desc);
return desc;
#endif // BX_COMPILER_MSVC
#endif // BX_COMPILER_MSVC || (BX_COMPILER_CLANG && defined(_MSC_VER))
}

#if BGFX_CONFIG_DEBUG_ANNOTATION && (BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT)
Expand Down

0 comments on commit db40a04

Please sign in to comment.