- disabled usage of intrinsics on non-Intel platforms

This commit is contained in:
alexey.lysiuk 2019-02-04 11:40:32 +02:00
parent 2765159fc6
commit 8892cb619d
2 changed files with 8 additions and 0 deletions

View file

@ -36,6 +36,9 @@ if( ${ZDOOM_TARGET_ARCH} MATCHES "x86_64" )
set( X64 64 )
endif()
if( X64 OR ${ZDOOM_TARGET_ARCH} MATCHES "i386" )
add_definitions( -DARCH_IA32 )
endif()
if( NOT ZDOOM_LIBS )
set( ZDOOM_LIBS "" )

View file

@ -40,7 +40,10 @@
#include "hwrenderer/scene/hw_portal.h"
#include "hwrenderer/utility/hw_clock.h"
#include "hwrenderer/data/flatvertices.h"
#ifdef ARCH_IA32
#include <immintrin.h>
#endif // ARCH_IA32
CVAR(Bool, gl_multithread, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
@ -106,6 +109,7 @@ void HWDrawInfo::WorkerThread()
auto job = jobQueue.GetJob();
if (job == nullptr)
{
#ifdef ARCH_IA32
// The queue is empty. But yielding would be too costly here and possibly cause further delays down the line if the thread is halted.
// So instead add a few pause instructions and retry immediately.
_mm_pause();
@ -118,6 +122,7 @@ void HWDrawInfo::WorkerThread()
_mm_pause();
_mm_pause();
_mm_pause();
#endif // ARCH_IA32
}
// Note that the main thread MUST have prepared the fake sectors that get used below!
// This worker thread cannot prepare them itself without costly synchronization.