Merge pull request #328 from akb825/linux-fix-2

Linux build fixes.
pull/329/head
Ignacio 4 years ago committed by GitHub
commit 6f3d02deab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1015,15 +1015,7 @@ void debug::dumpInfo()
#endif
}
static va_list getEmptyVAList(va_list list, ...)
{
va_start(list, list);
va_end(list);
return list;
}
/// Dump callstack using the specified handler.
void debug::dumpCallstack(MessageHandler *messageHandler, int callstackLevelsToSkip /*= 0*/)
static void dumpCallstackImpl(MessageHandler *messageHandler, int callstackLevelsToSkip, ...)
{
#if (NV_OS_WIN32 && NV_CC_MSVC) || (defined(HAVE_SIGNAL_H) && defined(HAVE_EXECINFO_H))
if (hasStackTrace())
@ -1035,7 +1027,8 @@ void debug::dumpCallstack(MessageHandler *messageHandler, int callstackLevelsToS
writeStackTrace(trace, size, callstackLevelsToSkip + 1, lines); // + 1 to skip the call to dumpCallstack
va_list empty;
empty = getEmptyVAList(empty);
va_start(empty, callstackLevelsToSkip);
va_end(empty);
for (uint i = 0; i < lines.count(); i++) {
messageHandler->log(lines[i], empty);
@ -1045,6 +1038,12 @@ void debug::dumpCallstack(MessageHandler *messageHandler, int callstackLevelsToS
#endif
}
/// Dump callstack using the specified handler.
void debug::dumpCallstack(MessageHandler *messageHandler, int callstackLevelsToSkip /*= 0*/)
{
dumpCallstackImpl(messageHandler, callstackLevelsToSkip);
}
/// Set the debug message handler.
void debug::setMessageHandler(MessageHandler * message_handler)

@ -6,6 +6,8 @@
#include "nvcore/Debug.h" // nvDebugCheck
#include "nvcore/Utils.h" // max, clamp
// Both cmath and math for C++11 and C function definitions.
#include <cmath>
#include <math.h>
#if NV_OS_WIN32 || NV_OS_XBOX
@ -81,7 +83,7 @@ inline float sqrtf_assert(const float f)
return sqrtf(f);
}
extern "C" inline double acos_assert(const double f)
extern "C" inline double acos_assert(const double f)
{
nvDebugCheck(f >= -1.0f && f <= 1.0f);
return acos(f);
@ -162,7 +164,9 @@ namespace nv
inline bool isNan(const float f)
{
#if NV_OS_WIN32 || NV_OS_XBOX
#if __cplusplus >= 199711L
return std::isnan(f);
#elif NV_OS_WIN32 || NV_OS_XBOX
return _isnan(f) != 0;
#elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_NETBSD || NV_OS_OPENBSD || NV_OS_ORBIS || NV_OS_LINUX
return isnan(f);
@ -227,7 +231,7 @@ namespace nv
}
inline float smoothstep(float edge0, float edge1, float x) {
x = linearstep(edge0, edge1, x);
x = linearstep(edge0, edge1, x);
// Evaluate polynomial
return x*x*(3 - 2*x);

Loading…
Cancel
Save