Fix build using clang-cl on windows and improve driver detection (#129)

This commit is contained in:
Jun Bo Bi 2022-09-04 17:15:40 -04:00 committed by GitHub
parent 4ed18a65c3
commit a54a3ec74e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 32 additions and 9 deletions

View file

@ -110,7 +110,8 @@ uint64 PPCTimer_tscToMicroseconds(uint64 us)
uint64 remainder;
#if _MSC_VER < 1923
#if _MSC_VER < 1923 || defined(__clang__)
const uint64 microseconds = udiv128(r.low, r.high, _rdtscFrequency, &remainder);
#else
const uint64 microseconds = _udiv128(r.high, r.low, _rdtscFrequency, &remainder);
@ -158,7 +159,7 @@ uint64 PPCTimer_getFromRDTSC()
#endif
uint64 remainder;
#if _MSC_VER < 1923
#if _MSC_VER < 1923 || defined(__clang__)
uint64 elapsedTick = udiv128(_rdtscAcc.low, _rdtscAcc.high, _rdtscFrequency, &remainder);
#else
uint64 elapsedTick = _udiv128(_rdtscAcc.high, _rdtscAcc.low, _rdtscFrequency, &remainder);

View file

@ -145,7 +145,7 @@ uint32 LatteTexture_CalculateTextureDataHash(LatteTexture* hostTexture)
bool isCompressedFormat = hostTexture->IsCompressedFormat();
if( isCompressedFormat == false )
{
#if BOOST_OS_WINDOWS
#if BOOST_OS_WINDOWS
if (_cpuExtension_AVX2)
{
__m256i h256 = { 0 };
@ -157,7 +157,11 @@ uint32 LatteTexture_CalculateTextureDataHash(LatteTexture* hostTexture)
readPtr += (288 / 32);
h256 = _mm256_xor_si256(h256, temp);
}
#ifdef __clang__
hashVal = h256[0] + h256[1] + h256[2] + h256[3] + h256[4] + h256[5] + h256[6] + h256[7];
#else
hashVal = h256.m256i_u32[0] + h256.m256i_u32[1] + h256.m256i_u32[2] + h256.m256i_u32[3] + h256.m256i_u32[4] + h256.m256i_u32[5] + h256.m256i_u32[6] + h256.m256i_u32[7];
#endif
}
#else
if( false ) {}

View file

@ -378,7 +378,7 @@ void OpenGLRenderer::GetVendorInformation()
forceLog_printf("GL_RENDERER: %s", glRendererString ? glRendererString : "unknown");
forceLog_printf("GL_VERSION: %s", glVersionString ? glVersionString : "unknown");
if(boost::icontains(glVersionString, "Mesa") || IsRunningInWine())
if(boost::icontains(glVersionString, "Mesa"))
{
m_vendor = GfxVendor::Mesa;
return;

View file

@ -197,7 +197,9 @@ void VulkanRenderer::DetermineVendor()
break;
}
if (IsRunningInWine())
VkDriverId driverId = driverProperties.driverID;
if(driverId == VK_DRIVER_ID_MESA_RADV || driverId == VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA)
m_vendor = GfxVendor::Mesa;
forceLog_printf("Using GPU: %s", properties.properties.deviceName);
@ -216,7 +218,7 @@ void VulkanRenderer::DetermineVendor()
else
{
forceLog_printf("Driver version (as stored in device info): %08X", properties.properties.driverVersion);
if(m_vendor == GfxVendor::Nvidia)
{
// if the driver does not support the extension,

Binary file not shown.