swr: fix build with mingw

Reviewed-by: Jan Zielinski <jan.zielinski@intel.com>
Tested-by: Prodea Alexandru-Liviu <liviuprodea@yahoo.com>
Cc: mesa-stable

closes #3454

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6532>
This commit is contained in:
Michel Zou 2020-09-01 09:22:27 +02:00 committed by Marge Bot
parent c56fbed99b
commit 2c94a9788e
12 changed files with 25 additions and 21 deletions

View file

@ -18,9 +18,7 @@
*/
#include "tessellator.hpp"
#if defined(__MINGW32__) || defined(__MINGW64__)
#include <cmath>
#elif defined(_WIN32) || defined(_WIN64)
#if defined(_MSC_VER)
#include <math.h> // ceil
#else
#include <cmath>
@ -195,7 +193,7 @@ INT32 floatToIDotF( const float& input )
if (iShift >= 0)
{
// assert( iShift < 32 );
#if defined(_WIN32) || defined(_WIN64)
#if defined(_MSC_VER)
#pragma warning( suppress : 4293 )
#endif
_fxpMaxPosValueFloat -= INT32( 1 ) << iShift;
@ -217,7 +215,7 @@ INT32 floatToIDotF( const float& input )
if (iShift >= 0)
{
// assert( iShift < 32 );
#if defined(_WIN32) || defined(_WIN64)
#if defined(_MSC_VER)
#pragma warning( suppress : 4293 )
#endif
_fxpMaxPosValueFloat -= INT32( 1 ) << iShift;

View file

@ -239,6 +239,7 @@ if with_swr_arches.contains('skx')
version : '0.0.0',
soversion : host_machine.system() == 'windows' ? '' : '0',
install : true,
name_prefix : host_machine.system() == 'windows' ? '' : 'lib',
)
else
swr_arch_libs += static_library(
@ -280,6 +281,7 @@ if with_swr_arches.contains('knl')
version : '0.0.0',
soversion : host_machine.system() == 'windows' ? '' : '0',
install : true,
name_prefix : host_machine.system() == 'windows' ? '' : 'lib',
)
else
swr_arch_libs += static_library(
@ -326,6 +328,7 @@ if with_swr_arches.contains('avx2')
version : '0.0.0',
soversion : host_machine.system() == 'windows' ? '' : '0',
install : true,
name_prefix : host_machine.system() == 'windows' ? '' : 'lib',
)
else
swr_arch_libs += static_library(
@ -360,6 +363,7 @@ if with_swr_arches.contains('avx')
version : '0.0.0',
soversion : host_machine.system() == 'windows' ? '' : '0',
install : true,
name_prefix : host_machine.system() == 'windows' ? '' : 'lib',
)
else
swr_arch_libs += static_library(

View file

@ -25,6 +25,8 @@
* @brief Implementation for archrast.
*
******************************************************************************/
#include <sys/stat.h>
#include <atomic>
#include <map>

View file

@ -34,7 +34,7 @@
#include <pthread.h>
#endif // Linux
#if defined(_WIN32)
#if defined(_MSC_VER)
static const DWORD MS_VC_EXCEPTION = 0x406D1388;
#pragma pack(push, 8)
@ -76,7 +76,7 @@ void LegacySetThreadName(const char* pThreadName)
void SWR_API SetCurrentThreadName(const char* pThreadName)
{
#if defined(_WIN32)
#if defined(_MSC_VER)
// The SetThreadDescription API was brought in version 1607 of Windows 10.
typedef HRESULT(WINAPI * PFNSetThreadDescription)(HANDLE hThread, PCWSTR lpThreadDescription);
// The SetThreadDescription API works even if no debugger is attached.

View file

@ -49,7 +49,11 @@
#undef MemoryFence
#endif
#if defined(_MSC_VER)
#define OSALIGN(RWORD, WIDTH) __declspec(align(WIDTH)) RWORD
#elif defined(__GNUC__)
#define OSALIGN(RWORD, WIDTH) RWORD __attribute__((aligned(WIDTH)))
#endif
#if defined(_DEBUG)
// We compile Debug builds with inline function expansion enabled. This allows

View file

@ -30,7 +30,7 @@
#if SWR_ENABLE_ASSERTS || SWR_ENABLE_REL_ASSERTS
#if defined(_WIN32)
#if defined(_MSC_VER)
#pragma comment(lib, "user32.lib")
#endif // _WIN32

View file

@ -71,7 +71,7 @@
while (0) \
_SWR_WARN_RESTORE
#if defined(_WIN32)
#if defined(_MSC_VER)
#define SWR_ASSUME(e, ...) \
_SWR_MACRO_START __assume(e); \
_SWR_MACRO_END

View file

@ -18,7 +18,7 @@
*/
#include "tessellator.hpp"
#if defined(_WIN32) || defined(_WIN64)
#if defined(_MSC_VER)
#include <math.h> // ceil
#else
#include <cmath>
@ -179,7 +179,7 @@ INT32 floatToIDotF( const float& input )
if (iShift >= 0)
{
// assert( iShift < 32 );
#if defined(_WIN32) || defined(_WIN64)
#if defined(_MSC_VER)
#pragma warning( suppress : 4293 )
#endif
_fxpMaxPosValueFloat -= INT32( 1 ) << iShift;
@ -201,7 +201,7 @@ INT32 floatToIDotF( const float& input )
if (iShift >= 0)
{
// assert( iShift < 32 );
#if defined(_WIN32) || defined(_WIN64)
#if defined(_MSC_VER)
#pragma warning( suppress : 4293 )
#endif
_fxpMaxPosValueFloat -= INT32( 1 ) << iShift;

View file

@ -105,8 +105,6 @@ void CalculateProcessorTopology(CPUNumaNodes& out_nodes, uint32_t& out_numThread
Core* pCore = nullptr;
uint32_t numThreads = (uint32_t)_mm_popcount_sizeT(gmask.Mask);
while (BitScanForwardSizeT((unsigned long*)&threadId, gmask.Mask))
{
// clear mask
@ -148,8 +146,6 @@ void CalculateProcessorTopology(CPUNumaNodes& out_nodes, uint32_t& out_numThread
auto& numaNode = out_nodes[numaId];
numaNode.numaId = numaId;
uint32_t coreId = 0;
if (nullptr == pCore)
{
numaNode.cores.push_back(Core());
@ -980,14 +976,14 @@ DWORD workerThreadMain<false, false>(LPVOID) = delete;
template <bool IsFEThread, bool IsBEThread>
DWORD workerThreadInit(LPVOID pData)
{
#if defined(_WIN32)
#if defined(_MSC_VER)
__try
#endif // _WIN32
{
return workerThreadMain<IsFEThread, IsBEThread>(pData);
}
#if defined(_WIN32)
#if defined(_MSC_VER)
__except (EXCEPTION_CONTINUE_SEARCH)
{
}

View file

@ -159,7 +159,7 @@ JitManager::JitManager(uint32_t simdWidth, const char* arch, const char* core) :
mFetchShaderTy = FunctionType::get(Type::getVoidTy(mContext), fsArgs, false);
#if defined(_WIN32)
#if defined(_MSC_VER)
// explicitly instantiate used symbols from potentially staticly linked libs
sys::DynamicLibrary::AddSymbol("exp2f", &exp2f);
sys::DynamicLibrary::AddSymbol("log2f", &log2f);

View file

@ -30,7 +30,7 @@
#pragma once
#if defined(_WIN32)
#if defined(_MSC_VER)
#pragma warning(disable : 4146 4244 4267 4800 4996)
#endif

View file

@ -27,7 +27,7 @@
******************************************************************************/
#pragma once
#if defined(_WIN32)
#if defined(_MSC_VER)
// disable "potential divide by 0"
#pragma warning(disable: 4723)
#endif