3rdparty: cherry-pick upstream fixes for clangcl

This commit is contained in:
Patrick Mackinlay 2025-05-13 11:41:23 +07:00
parent da468a4f50
commit cb045de3d2
2 changed files with 16 additions and 15 deletions

View File

@ -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)
@ -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);
}
@ -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)

View File

@ -1,6 +1,6 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2001-2009 Josh Coalson
* Copyright (C) 2011-2023 Xiph.Org Foundation
* Copyright (C) 2011-2025 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -82,7 +82,7 @@ static inline uint32_t FLAC__clz_uint32(FLAC__uint32 v)
return __builtin_clz(v);
#elif defined(_MSC_VER)
{
uint32_t idx;
unsigned long idx;
_BitScanReverse(&idx, v);
return idx ^ 31U;
}
@ -106,7 +106,7 @@ static inline uint32_t FLAC__clz_uint64(FLAC__uint64 v)
return __builtin_clzll(v);
#elif (defined(__INTEL_COMPILER) || defined(_MSC_VER)) && (defined(_M_IA64) || defined(_M_X64))
{
uint32_t idx;
unsigned long idx;
_BitScanReverse64(&idx, v);
return idx ^ 63U;
}
@ -160,7 +160,7 @@ static inline uint32_t FLAC__bitmath_ilog2(FLAC__uint32 v)
return _bit_scan_reverse(v);
#elif defined(_MSC_VER)
{
uint32_t idx;
unsigned long idx;
_BitScanReverse(&idx, v);
return idx;
}
@ -177,7 +177,7 @@ static inline uint32_t FLAC__bitmath_ilog2_wide(FLAC__uint64 v)
/* Sorry, only supported in x64/Itanium.. and both have fast FPU which makes integer-only encoder pointless */
#elif (defined(__INTEL_COMPILER) || defined(_MSC_VER)) && (defined(_M_IA64) || defined(_M_X64))
{
uint32_t idx;
unsigned long idx;
_BitScanReverse64(&idx, v);
return idx;
}
@ -206,5 +206,6 @@ static inline uint32_t FLAC__bitmath_ilog2_wide(FLAC__uint64 v)
}
uint32_t FLAC__bitmath_silog2(FLAC__int64 v);
uint32_t FLAC__bitmath_extra_mulbits_unsigned(FLAC__uint32 v);
#endif