mirror of
https://github.com/holub/mame
synced 2025-04-21 07:52:35 +03:00
Update BX (nw)
This commit is contained in:
parent
a642e29ecd
commit
04faaaf7ff
1
3rdparty/bx/.appveyor.yml
vendored
1
3rdparty/bx/.appveyor.yml
vendored
@ -5,7 +5,6 @@ os:
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- TOOLSET: vs2010
|
||||
- TOOLSET: vs2012
|
||||
- TOOLSET: vs2013
|
||||
- TOOLSET: vs2015
|
||||
|
12
3rdparty/bx/.travis.yml
vendored
12
3rdparty/bx/.travis.yml
vendored
@ -6,8 +6,18 @@ matrix:
|
||||
- compiler: clang
|
||||
os: osx
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- gcc-4.8
|
||||
- g++-4.8
|
||||
- clang
|
||||
|
||||
script:
|
||||
make test
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then make test CXX="g++-4.8" CC="gcc-4.8"; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then make test; fi
|
||||
|
||||
branches:
|
||||
only:
|
||||
|
2
3rdparty/bx/LICENSE
vendored
2
3rdparty/bx/LICENSE
vendored
@ -1,4 +1,4 @@
|
||||
Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
|
||||
https://github.com/bkaradzic/bx
|
||||
|
||||
|
2
3rdparty/bx/README.md
vendored
2
3rdparty/bx/README.md
vendored
@ -19,7 +19,7 @@ https://github.com/bkaradzic/bx
|
||||
[License (BSD 2-clause)](https://github.com/bkaradzic/bx/blob/master/LICENSE)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
|
||||
https://github.com/bkaradzic/bx
|
||||
|
||||
|
2
3rdparty/bx/include/bx/allocator.h
vendored
2
3rdparty/bx/include/bx/allocator.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
5
3rdparty/bx/include/bx/bx.h
vendored
5
3rdparty/bx/include/bx/bx.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
@ -81,7 +81,4 @@ namespace bx
|
||||
|
||||
} // namespace bx
|
||||
|
||||
// Annoying C++0x stuff..
|
||||
//namespace std { namespace tr1 {}; using namespace tr1; }
|
||||
|
||||
#endif // BX_H_HEADER_GUARD
|
||||
|
2
3rdparty/bx/include/bx/cl.h
vendored
2
3rdparty/bx/include/bx/cl.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
2
3rdparty/bx/include/bx/commandline.h
vendored
2
3rdparty/bx/include/bx/commandline.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
2
3rdparty/bx/include/bx/config.h
vendored
2
3rdparty/bx/include/bx/config.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
2
3rdparty/bx/include/bx/cpu.h
vendored
2
3rdparty/bx/include/bx/cpu.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
64
3rdparty/bx/include/bx/crtimpl.h
vendored
64
3rdparty/bx/include/bx/crtimpl.h
vendored
@ -1,11 +1,13 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
#ifndef BX_CRTIMPL_H_HEADER_GUARD
|
||||
#define BX_CRTIMPL_H_HEADER_GUARD
|
||||
|
||||
#include "bx.h"
|
||||
|
||||
#if BX_CONFIG_ALLOCATOR_CRT
|
||||
# include <malloc.h>
|
||||
# include "allocator.h"
|
||||
@ -115,6 +117,12 @@ namespace bx
|
||||
{
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
|
||||
if (NULL != m_file)
|
||||
{
|
||||
BX_ERROR_SET(_err, BX_ERROR_READERWRITER_ALREADY_OPEN, "CrtFileReader: File is already open.");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_file = fopen(_filePath, "rb");
|
||||
if (NULL == m_file)
|
||||
{
|
||||
@ -127,17 +135,21 @@ namespace bx
|
||||
|
||||
virtual void close() BX_OVERRIDE
|
||||
{
|
||||
BX_CHECK(NULL != m_file, "Reader/Writer file is not open.");
|
||||
fclose(m_file);
|
||||
m_file = NULL;
|
||||
}
|
||||
|
||||
virtual int64_t seek(int64_t _offset = 0, Whence::Enum _whence = Whence::Current) BX_OVERRIDE
|
||||
{
|
||||
BX_CHECK(NULL != m_file, "Reader/Writer file is not open.");
|
||||
fseeko64(m_file, _offset, _whence);
|
||||
return ftello64(m_file);
|
||||
}
|
||||
|
||||
virtual int32_t read(void* _data, int32_t _size, Error* _err) BX_OVERRIDE
|
||||
{
|
||||
BX_CHECK(NULL != m_file, "Reader/Writer file is not open.");
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
|
||||
int32_t size = (int32_t)fread(_data, 1, _size, m_file);
|
||||
@ -145,11 +157,11 @@ namespace bx
|
||||
{
|
||||
if (0 != feof(m_file) )
|
||||
{
|
||||
BX_ERROR_SET(_err, BX_ERROR_READERWRITER_EOF, "CrtFileWriter: EOF.");
|
||||
BX_ERROR_SET(_err, BX_ERROR_READERWRITER_EOF, "CrtFileReader: EOF.");
|
||||
}
|
||||
else if (0 != ferror(m_file) )
|
||||
{
|
||||
BX_ERROR_SET(_err, BX_ERROR_READERWRITER_READ, "CrtFileWriter: read error.");
|
||||
BX_ERROR_SET(_err, BX_ERROR_READERWRITER_READ, "CrtFileReader: read error.");
|
||||
}
|
||||
|
||||
return size >= 0 ? size : 0;
|
||||
@ -176,6 +188,14 @@ namespace bx
|
||||
|
||||
virtual bool open(const char* _filePath, bool _append, Error* _err) BX_OVERRIDE
|
||||
{
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
|
||||
if (NULL != m_file)
|
||||
{
|
||||
BX_ERROR_SET(_err, BX_ERROR_READERWRITER_ALREADY_OPEN, "CrtFileReader: File is already open.");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_file = fopen(_filePath, _append ? "ab" : "wb");
|
||||
|
||||
if (NULL == m_file)
|
||||
@ -189,17 +209,21 @@ namespace bx
|
||||
|
||||
virtual void close() BX_OVERRIDE
|
||||
{
|
||||
BX_CHECK(NULL != m_file, "Reader/Writer file is not open.");
|
||||
fclose(m_file);
|
||||
m_file = NULL;
|
||||
}
|
||||
|
||||
virtual int64_t seek(int64_t _offset = 0, Whence::Enum _whence = Whence::Current) BX_OVERRIDE
|
||||
{
|
||||
BX_CHECK(NULL != m_file, "Reader/Writer file is not open.");
|
||||
fseeko64(m_file, _offset, _whence);
|
||||
return ftello64(m_file);
|
||||
}
|
||||
|
||||
virtual int32_t write(const void* _data, int32_t _size, Error* _err) BX_OVERRIDE
|
||||
{
|
||||
BX_CHECK(NULL != m_file, "Reader/Writer file is not open.");
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
|
||||
int32_t size = (int32_t)fwrite(_data, 1, _size, m_file);
|
||||
@ -241,6 +265,12 @@ namespace bx
|
||||
{
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
|
||||
if (NULL != m_file)
|
||||
{
|
||||
BX_ERROR_SET(_err, BX_ERROR_READERWRITER_ALREADY_OPEN, "ProcessReader: File is already open.");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_file = popen(_command, "r");
|
||||
if (NULL == m_file)
|
||||
{
|
||||
@ -254,7 +284,7 @@ namespace bx
|
||||
virtual void close() BX_OVERRIDE
|
||||
{
|
||||
BX_CHECK(NULL != m_file, "Process not open!");
|
||||
pclose(m_file);
|
||||
m_exitCode = pclose(m_file);
|
||||
m_file = NULL;
|
||||
}
|
||||
|
||||
@ -267,11 +297,11 @@ namespace bx
|
||||
{
|
||||
if (0 != feof(m_file) )
|
||||
{
|
||||
BX_ERROR_SET(_err, BX_ERROR_READERWRITER_EOF, "CrtFileWriter: EOF.");
|
||||
BX_ERROR_SET(_err, BX_ERROR_READERWRITER_EOF, "ProcessReader: EOF.");
|
||||
}
|
||||
else if (0 != ferror(m_file) )
|
||||
{
|
||||
BX_ERROR_SET(_err, BX_ERROR_READERWRITER_READ, "CrtFileWriter: read error.");
|
||||
BX_ERROR_SET(_err, BX_ERROR_READERWRITER_READ, "ProcessReader: read error.");
|
||||
}
|
||||
|
||||
return size >= 0 ? size : 0;
|
||||
@ -280,8 +310,14 @@ namespace bx
|
||||
return size;
|
||||
}
|
||||
|
||||
int32_t getExitCode() const
|
||||
{
|
||||
return m_exitCode;
|
||||
}
|
||||
|
||||
private:
|
||||
FILE* m_file;
|
||||
int32_t m_exitCode;
|
||||
};
|
||||
|
||||
class ProcessWriter : public WriterOpenI, public CloserI, public WriterI
|
||||
@ -301,6 +337,12 @@ namespace bx
|
||||
{
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
|
||||
if (NULL != m_file)
|
||||
{
|
||||
BX_ERROR_SET(_err, BX_ERROR_READERWRITER_ALREADY_OPEN, "ProcessWriter: File is already open.");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_file = popen(_command, "w");
|
||||
if (NULL == m_file)
|
||||
{
|
||||
@ -314,7 +356,7 @@ namespace bx
|
||||
virtual void close() BX_OVERRIDE
|
||||
{
|
||||
BX_CHECK(NULL != m_file, "Process not open!");
|
||||
pclose(m_file);
|
||||
m_exitCode = pclose(m_file);
|
||||
m_file = NULL;
|
||||
}
|
||||
|
||||
@ -327,7 +369,7 @@ namespace bx
|
||||
{
|
||||
if (0 != ferror(m_file) )
|
||||
{
|
||||
BX_ERROR_SET(_err, BX_ERROR_READERWRITER_WRITE, "CrtFileWriter: write error.");
|
||||
BX_ERROR_SET(_err, BX_ERROR_READERWRITER_WRITE, "ProcessWriter: write error.");
|
||||
}
|
||||
|
||||
return size >= 0 ? size : 0;
|
||||
@ -336,8 +378,14 @@ namespace bx
|
||||
return size;
|
||||
}
|
||||
|
||||
int32_t getExitCode() const
|
||||
{
|
||||
return m_exitCode;
|
||||
}
|
||||
|
||||
private:
|
||||
FILE* m_file;
|
||||
int32_t m_exitCode;
|
||||
};
|
||||
|
||||
#endif // BX_CONFIG_CRT_PROCESS
|
||||
|
2
3rdparty/bx/include/bx/debug.h
vendored
2
3rdparty/bx/include/bx/debug.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
315
3rdparty/bx/include/bx/easing.h
vendored
Normal file
315
3rdparty/bx/include/bx/easing.h
vendored
Normal file
@ -0,0 +1,315 @@
|
||||
/*
|
||||
* Copyright 2011-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
#ifndef BX_EASING_H_HEADER_GUARD
|
||||
#define BX_EASING_H_HEADER_GUARD
|
||||
|
||||
#include "fpumath.h"
|
||||
|
||||
// Reference:
|
||||
// http://easings.net/
|
||||
// http://robertpenner.com/easing/
|
||||
|
||||
namespace bx
|
||||
{
|
||||
struct Easing
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
Linear,
|
||||
InQuad,
|
||||
OutQuad,
|
||||
InOutQuad,
|
||||
OutInQuad,
|
||||
InCubic,
|
||||
OutCubic,
|
||||
InOutCubic,
|
||||
OutInCubic,
|
||||
InQuart,
|
||||
OutQuart,
|
||||
InOutQuart,
|
||||
OutInQuart,
|
||||
InQuint,
|
||||
OutQuint,
|
||||
InOutQuint,
|
||||
OutInQuint,
|
||||
InSine,
|
||||
OutSine,
|
||||
InOutSine,
|
||||
OutInSine,
|
||||
InExpo,
|
||||
OutExpo,
|
||||
InOutExpo,
|
||||
OutInExpo,
|
||||
InCirc,
|
||||
OutCirc,
|
||||
InOutCirc,
|
||||
OutInCirc,
|
||||
InElastic,
|
||||
OutElastic,
|
||||
InOutElastic,
|
||||
OutInElastic,
|
||||
InBack,
|
||||
OutBack,
|
||||
InOutBack,
|
||||
OutInBack,
|
||||
InBounce,
|
||||
OutBounce,
|
||||
InOutBounce,
|
||||
OutInBounce,
|
||||
|
||||
Count
|
||||
};
|
||||
};
|
||||
|
||||
typedef float (*EaseFn)(float _t);
|
||||
|
||||
template<EaseFn ease>
|
||||
float easeOut(float _t)
|
||||
{
|
||||
return 1.0f - ease(1.0f - _t);
|
||||
}
|
||||
|
||||
template<EaseFn easeFrom0toH, EaseFn easeFromHto1>
|
||||
float easeMix(float _t)
|
||||
{
|
||||
return _t < 0.5f
|
||||
? easeFrom0toH(2.0f*_t)*0.5f
|
||||
: easeFromHto1(2.0f*_t - 1.0f)*0.5f + 0.5f
|
||||
;
|
||||
}
|
||||
|
||||
inline float easeLinear(float _t)
|
||||
{
|
||||
return _t;
|
||||
}
|
||||
|
||||
inline float easeInQuad(float _t)
|
||||
{
|
||||
return fsq(_t);
|
||||
}
|
||||
|
||||
inline float easeOutQuad(float _t)
|
||||
{
|
||||
return easeOut<easeInQuad>(_t);
|
||||
}
|
||||
|
||||
inline float easeInOutQuad(float _t)
|
||||
{
|
||||
return easeMix<easeInQuad, easeOutQuad>(_t);
|
||||
}
|
||||
|
||||
inline float easeOutInQuad(float _t)
|
||||
{
|
||||
return easeMix<easeOutQuad, easeInQuad>(_t);
|
||||
}
|
||||
|
||||
inline float easeInCubic(float _t)
|
||||
{
|
||||
return _t*_t*_t;
|
||||
}
|
||||
|
||||
inline float easeOutCubic(float _t)
|
||||
{
|
||||
return easeOut<easeInCubic>(_t);
|
||||
}
|
||||
|
||||
inline float easeInOutCubic(float _t)
|
||||
{
|
||||
return easeMix<easeInCubic, easeOutCubic>(_t);
|
||||
}
|
||||
|
||||
inline float easeOutInCubic(float _t)
|
||||
{
|
||||
return easeMix<easeOutCubic, easeInCubic>(_t);
|
||||
}
|
||||
|
||||
inline float easeInQuart(float _t)
|
||||
{
|
||||
return _t*_t*_t*_t;
|
||||
}
|
||||
|
||||
inline float easeOutQuart(float _t)
|
||||
{
|
||||
return easeOut<easeInQuart>(_t);
|
||||
}
|
||||
|
||||
inline float easeInOutQuart(float _t)
|
||||
{
|
||||
return easeMix<easeInQuart, easeOutQuart>(_t);
|
||||
}
|
||||
|
||||
inline float easeOutInQuart(float _t)
|
||||
{
|
||||
return easeMix<easeOutQuart, easeInQuart>(_t);
|
||||
}
|
||||
|
||||
inline float easeInQuint(float _t)
|
||||
{
|
||||
return _t*_t*_t*_t*_t;
|
||||
}
|
||||
|
||||
inline float easeOutQuint(float _t)
|
||||
{
|
||||
return easeOut<easeInQuint>(_t);
|
||||
}
|
||||
|
||||
inline float easeInOutQuint(float _t)
|
||||
{
|
||||
return easeMix<easeInQuint, easeOutQuint>(_t);
|
||||
}
|
||||
|
||||
inline float easeOutInQuint(float _t)
|
||||
{
|
||||
return easeMix<easeOutQuint, easeInQuint>(_t);
|
||||
}
|
||||
|
||||
inline float easeInSine(float _t)
|
||||
{
|
||||
return 1.0f - fcos(_t*piHalf);
|
||||
}
|
||||
|
||||
inline float easeOutSine(float _t)
|
||||
{
|
||||
return easeOut<easeInSine>(_t);
|
||||
}
|
||||
|
||||
inline float easeInOutSine(float _t)
|
||||
{
|
||||
return easeMix<easeInSine, easeOutSine>(_t);
|
||||
}
|
||||
|
||||
inline float easeOutInSine(float _t)
|
||||
{
|
||||
return easeMix<easeOutSine, easeInSine>(_t);
|
||||
}
|
||||
|
||||
inline float easeInExpo(float _t)
|
||||
{
|
||||
return fpow(2.0f, 10.0f * (_t - 1.0f) ) - 0.001f;
|
||||
}
|
||||
|
||||
inline float easeOutExpo(float _t)
|
||||
{
|
||||
return easeOut<easeInExpo>(_t);
|
||||
}
|
||||
|
||||
inline float easeInOutExpo(float _t)
|
||||
{
|
||||
return easeMix<easeInExpo, easeOutExpo>(_t);
|
||||
}
|
||||
|
||||
inline float easeOutInExpo(float _t)
|
||||
{
|
||||
return easeMix<easeOutExpo, easeInExpo>(_t);
|
||||
}
|
||||
|
||||
inline float easeInCirc(float _t)
|
||||
{
|
||||
return -(fsqrt(1.0f - _t*_t) - 1.0f);
|
||||
}
|
||||
|
||||
inline float easeOutCirc(float _t)
|
||||
{
|
||||
return easeOut<easeInCirc>(_t);
|
||||
}
|
||||
|
||||
inline float easeInOutCirc(float _t)
|
||||
{
|
||||
return easeMix<easeInCirc, easeOutCirc>(_t);
|
||||
}
|
||||
|
||||
inline float easeOutInCirc(float _t)
|
||||
{
|
||||
return easeMix<easeOutCirc, easeInCirc>(_t);
|
||||
}
|
||||
|
||||
inline float easeOutElastic(float _t)
|
||||
{
|
||||
return fpow(2.0f, -10.0f*_t)*fsin( (_t-0.3f/4.0f)*(2.0f*pi)/0.3f) + 1.0f;
|
||||
}
|
||||
|
||||
inline float easeInElastic(float _t)
|
||||
{
|
||||
return easeOut<easeOutElastic>(_t);
|
||||
}
|
||||
|
||||
inline float easeInOutElastic(float _t)
|
||||
{
|
||||
return easeMix<easeInElastic, easeOutElastic>(_t);
|
||||
}
|
||||
|
||||
inline float easeOutInElastic(float _t)
|
||||
{
|
||||
return easeMix<easeOutElastic, easeInElastic>(_t);
|
||||
}
|
||||
|
||||
inline float easeInBack(float _t)
|
||||
{
|
||||
return easeInCubic(_t) - _t*fsin(_t*pi);
|
||||
}
|
||||
|
||||
inline float easeOutBack(float _t)
|
||||
{
|
||||
return easeOut<easeInBack>(_t);
|
||||
}
|
||||
|
||||
inline float easeInOutBack(float _t)
|
||||
{
|
||||
return easeMix<easeInBack, easeOutBack>(_t);
|
||||
}
|
||||
|
||||
inline float easeOutInBack(float _t)
|
||||
{
|
||||
return easeMix<easeOutBack, easeInBack>(_t);
|
||||
}
|
||||
|
||||
inline float easeOutBounce(float _t)
|
||||
{
|
||||
if (4.0f/11.0f > _t)
|
||||
{
|
||||
return 121.0f/16.0f*_t*_t;
|
||||
}
|
||||
|
||||
if (8.0f/11.0f > _t)
|
||||
{
|
||||
return 363.0f/40.0f*_t*_t
|
||||
- 99.0f/10.0f*_t
|
||||
+ 17.0f/ 5.0f
|
||||
;
|
||||
}
|
||||
|
||||
if (9.0f/10.0f > _t)
|
||||
{
|
||||
return 4356.0f/ 361.0f*_t*_t
|
||||
- 35442.0f/1805.0f*_t
|
||||
+ 16061.0f/1805.0f
|
||||
;
|
||||
}
|
||||
|
||||
return 54.0f/ 5.0f*_t*_t
|
||||
- 513.0f/25.0f*_t
|
||||
+ 268.0f/25.0f
|
||||
;
|
||||
}
|
||||
|
||||
inline float easeInBounce(float _t)
|
||||
{
|
||||
return easeOut<easeOutBounce>(_t);
|
||||
}
|
||||
|
||||
inline float easeInOutBounce(float _t)
|
||||
{
|
||||
return easeMix<easeInBounce, easeOutBounce>(_t);
|
||||
}
|
||||
|
||||
inline float easeOutInBounce(float _t)
|
||||
{
|
||||
return easeMix<easeOutBounce, easeInBounce>(_t);
|
||||
}
|
||||
|
||||
} // namespace bx
|
||||
|
||||
#endif // BX_EASING_H_HEADER_GUARD
|
2
3rdparty/bx/include/bx/endian.h
vendored
2
3rdparty/bx/include/bx/endian.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
20
3rdparty/bx/include/bx/error.h
vendored
20
3rdparty/bx/include/bx/error.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
#define BX_ERROR_H_HEADER_GUARD
|
||||
|
||||
#include "bx.h"
|
||||
#include "string.h"
|
||||
|
||||
#define BX_ERROR_SET(_ptr, _result, _msg) \
|
||||
BX_MACRO_BLOCK_BEGIN \
|
||||
@ -48,7 +49,13 @@ namespace bx
|
||||
{
|
||||
}
|
||||
|
||||
void setError(ErrorResult _errorResult, const char* _msg)
|
||||
void reset()
|
||||
{
|
||||
m_code = 0;
|
||||
m_msg.clear();
|
||||
}
|
||||
|
||||
void setError(ErrorResult _errorResult, const StringView& _msg)
|
||||
{
|
||||
BX_CHECK(0 != _errorResult.code, "Invalid ErrorResult passed to setError!");
|
||||
|
||||
@ -72,6 +79,11 @@ namespace bx
|
||||
return result;
|
||||
}
|
||||
|
||||
const StringView& getMessage() const
|
||||
{
|
||||
return m_msg;
|
||||
}
|
||||
|
||||
bool operator==(const ErrorResult& _rhs) const
|
||||
{
|
||||
return _rhs.code == m_code;
|
||||
@ -83,8 +95,8 @@ namespace bx
|
||||
}
|
||||
|
||||
private:
|
||||
const char* m_msg;
|
||||
uint32_t m_code;
|
||||
StringView m_msg;
|
||||
uint32_t m_code;
|
||||
};
|
||||
|
||||
///
|
||||
|
2
3rdparty/bx/include/bx/float4x4_t.h
vendored
2
3rdparty/bx/include/bx/float4x4_t.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
2
3rdparty/bx/include/bx/foreach.h
vendored
2
3rdparty/bx/include/bx/foreach.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
72
3rdparty/bx/include/bx/fpumath.h
vendored
72
3rdparty/bx/include/bx/fpumath.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2011-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
@ -102,16 +102,6 @@ namespace bx
|
||||
return _a < 0.0f ? -1.0f : 1.0f;
|
||||
}
|
||||
|
||||
inline float fstep(float _edge, float _a)
|
||||
{
|
||||
return _a < _edge ? 0.0f : 1.0f;
|
||||
}
|
||||
|
||||
inline float fpulse(float _a, float _start, float _end)
|
||||
{
|
||||
return fstep(_a, _start) - fstep(_a, _end);
|
||||
}
|
||||
|
||||
inline float fabsolute(float _a)
|
||||
{
|
||||
return fabsf(_a);
|
||||
@ -127,11 +117,21 @@ namespace bx
|
||||
return sinf(_a);
|
||||
}
|
||||
|
||||
inline float fasin(float _a)
|
||||
{
|
||||
return asinf(_a);
|
||||
}
|
||||
|
||||
inline float fcos(float _a)
|
||||
{
|
||||
return cosf(_a);
|
||||
}
|
||||
|
||||
inline float facos(float _a)
|
||||
{
|
||||
return acosf(_a);
|
||||
}
|
||||
|
||||
inline float fpow(float _a, float _b)
|
||||
{
|
||||
return powf(_a, _b);
|
||||
@ -197,6 +197,21 @@ namespace bx
|
||||
return result;
|
||||
}
|
||||
|
||||
inline float fstep(float _edge, float _a)
|
||||
{
|
||||
return _a < _edge ? 0.0f : 1.0f;
|
||||
}
|
||||
|
||||
inline float fpulse(float _a, float _start, float _end)
|
||||
{
|
||||
return fstep(_a, _start) - fstep(_a, _end);
|
||||
}
|
||||
|
||||
inline float fsmoothstep(float _a)
|
||||
{
|
||||
return fsq(_a)*(3.0f - 2.0f*_a);
|
||||
}
|
||||
|
||||
// References:
|
||||
// - Bias And Gain Are Your Friend
|
||||
// http://blog.demofox.org/2012/09/24/bias-and-gain-are-your-friend/
|
||||
@ -341,6 +356,7 @@ namespace bx
|
||||
_result[2] = 1.0f / _a[2];
|
||||
}
|
||||
|
||||
/// Calculate tangent frame from normal.
|
||||
inline void vec3TangentFrame(const float* __restrict _n, float* __restrict _t, float* __restrict _b)
|
||||
{
|
||||
const float nx = _n[0];
|
||||
@ -365,6 +381,21 @@ namespace bx
|
||||
bx::vec3Cross(_b, _n, _t);
|
||||
}
|
||||
|
||||
/// Calculate tangent frame from normal and angle.
|
||||
inline void vec3TangentFrame(const float* __restrict _n, float* __restrict _t, float* __restrict _b, float _angle)
|
||||
{
|
||||
vec3TangentFrame(_n, _t, _b);
|
||||
|
||||
const float sa = fsin(_angle);
|
||||
const float ca = fcos(_angle);
|
||||
|
||||
_t[0] = -sa * _b[0] + ca * _t[0];
|
||||
_t[1] = -sa * _b[1] + ca * _t[1];
|
||||
_t[2] = -sa * _b[2] + ca * _t[2];
|
||||
|
||||
bx::vec3Cross(_b, _n, _t);
|
||||
}
|
||||
|
||||
inline void quatIdentity(float* _result)
|
||||
{
|
||||
_result[0] = 0.0f;
|
||||
@ -574,6 +605,25 @@ namespace bx
|
||||
_result[15] = 1.0f;
|
||||
}
|
||||
|
||||
inline void mtxFromNormal(float* __restrict _result, const float* __restrict _normal, float _scale, const float* __restrict _pos, float _angle)
|
||||
{
|
||||
float tangent[3];
|
||||
float bitangent[3];
|
||||
vec3TangentFrame(_normal, tangent, bitangent, _angle);
|
||||
|
||||
vec3Mul(&_result[ 0], bitangent, _scale);
|
||||
vec3Mul(&_result[ 4], _normal, _scale);
|
||||
vec3Mul(&_result[ 8], tangent, _scale);
|
||||
|
||||
_result[ 3] = 0.0f;
|
||||
_result[ 7] = 0.0f;
|
||||
_result[11] = 0.0f;
|
||||
_result[12] = _pos[0];
|
||||
_result[13] = _pos[1];
|
||||
_result[14] = _pos[2];
|
||||
_result[15] = 1.0f;
|
||||
}
|
||||
|
||||
inline void mtxQuat(float* __restrict _result, const float* __restrict _quat)
|
||||
{
|
||||
const float x = _quat[0];
|
||||
|
2
3rdparty/bx/include/bx/handlealloc.h
vendored
2
3rdparty/bx/include/bx/handlealloc.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
5
3rdparty/bx/include/bx/hash.h
vendored
5
3rdparty/bx/include/bx/hash.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
@ -30,8 +30,7 @@ namespace bx
|
||||
|
||||
void add(const void* _data, int _len)
|
||||
{
|
||||
if (BX_ENABLED(BX_PLATFORM_EMSCRIPTEN)
|
||||
&& BX_UNLIKELY(!isPtrAligned(_data, 4) ) )
|
||||
if (BX_UNLIKELY(!isPtrAligned(_data, 4) ) )
|
||||
{
|
||||
addUnaligned(_data, _len);
|
||||
return;
|
||||
|
2
3rdparty/bx/include/bx/macros.h
vendored
2
3rdparty/bx/include/bx/macros.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
2
3rdparty/bx/include/bx/maputil.h
vendored
2
3rdparty/bx/include/bx/maputil.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
2
3rdparty/bx/include/bx/mpscqueue.h
vendored
2
3rdparty/bx/include/bx/mpscqueue.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
2
3rdparty/bx/include/bx/mutex.h
vendored
2
3rdparty/bx/include/bx/mutex.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
2
3rdparty/bx/include/bx/os.h
vendored
2
3rdparty/bx/include/bx/os.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
8
3rdparty/bx/include/bx/platform.h
vendored
8
3rdparty/bx/include/bx/platform.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
@ -202,7 +202,7 @@
|
||||
# undef BX_PLATFORM_RPI
|
||||
# define BX_PLATFORM_RPI 1
|
||||
#elif defined(__linux__) \
|
||||
|| defined(__riscv__)
|
||||
|| BX_CPU_RISCV
|
||||
# undef BX_PLATFORM_LINUX
|
||||
# define BX_PLATFORM_LINUX 1
|
||||
#elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) \
|
||||
@ -265,7 +265,9 @@
|
||||
BX_STRINGIZE(__clang_minor__) "." \
|
||||
BX_STRINGIZE(__clang_patchlevel__)
|
||||
#elif BX_COMPILER_MSVC
|
||||
# if BX_COMPILER_MSVC >= 1900 // Visual Studio 2015
|
||||
# if BX_COMPILER_MSVC >= 1910 // Visual Studio 2017
|
||||
# define BX_COMPILER_NAME "MSVC 15.0"
|
||||
# elif BX_COMPILER_MSVC >= 1900 // Visual Studio 2015
|
||||
# define BX_COMPILER_NAME "MSVC 14.0"
|
||||
# elif BX_COMPILER_MSVC >= 1800 // Visual Studio 2013
|
||||
# define BX_COMPILER_NAME "MSVC 12.0"
|
||||
|
2
3rdparty/bx/include/bx/process.h
vendored
2
3rdparty/bx/include/bx/process.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
2
3rdparty/bx/include/bx/radixsort.h
vendored
2
3rdparty/bx/include/bx/radixsort.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
46
3rdparty/bx/include/bx/readerwriter.h
vendored
46
3rdparty/bx/include/bx/readerwriter.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
@ -16,10 +16,11 @@
|
||||
#include "error.h"
|
||||
#include "uint32_t.h"
|
||||
|
||||
BX_ERROR_RESULT(BX_ERROR_READERWRITER_OPEN, BX_MAKEFOURCC('R', 'W', 0, 1) );
|
||||
BX_ERROR_RESULT(BX_ERROR_READERWRITER_READ, BX_MAKEFOURCC('R', 'W', 0, 2) );
|
||||
BX_ERROR_RESULT(BX_ERROR_READERWRITER_WRITE, BX_MAKEFOURCC('R', 'W', 0, 3) );
|
||||
BX_ERROR_RESULT(BX_ERROR_READERWRITER_EOF, BX_MAKEFOURCC('R', 'W', 0, 4) );
|
||||
BX_ERROR_RESULT(BX_ERROR_READERWRITER_OPEN, BX_MAKEFOURCC('R', 'W', 0, 1) );
|
||||
BX_ERROR_RESULT(BX_ERROR_READERWRITER_READ, BX_MAKEFOURCC('R', 'W', 0, 2) );
|
||||
BX_ERROR_RESULT(BX_ERROR_READERWRITER_WRITE, BX_MAKEFOURCC('R', 'W', 0, 3) );
|
||||
BX_ERROR_RESULT(BX_ERROR_READERWRITER_EOF, BX_MAKEFOURCC('R', 'W', 0, 4) );
|
||||
BX_ERROR_RESULT(BX_ERROR_READERWRITER_ALREADY_OPEN, BX_MAKEFOURCC('R', 'W', 0, 5) );
|
||||
|
||||
namespace bx
|
||||
{
|
||||
@ -223,6 +224,41 @@ namespace bx
|
||||
{
|
||||
};
|
||||
|
||||
/// Align reader stream.
|
||||
inline int32_t align(ReaderSeekerI* _reader, uint32_t _alignment, Error* _err = NULL)
|
||||
{
|
||||
BX_ERROR_SCOPE(_err);
|
||||
const int64_t current = bx::seek(_reader);
|
||||
const int64_t aligned = ( (current + _alignment-1)/_alignment) * _alignment;
|
||||
const int32_t size = int32_t(aligned - current);
|
||||
if (0 != size)
|
||||
{
|
||||
const int64_t offset = bx::seek(_reader, size);
|
||||
if (offset != aligned)
|
||||
{
|
||||
BX_ERROR_SET(_err, BX_ERROR_READERWRITER_WRITE, "Align: read truncated.");
|
||||
}
|
||||
return int32_t(offset - current);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Align writer stream (pads stream with zeros).
|
||||
inline int32_t align(WriterSeekerI* _writer, uint32_t _alignment, Error* _err = NULL)
|
||||
{
|
||||
BX_ERROR_SCOPE(_err);
|
||||
const int64_t current = bx::seek(_writer);
|
||||
const int64_t aligned = ( (current + _alignment-1)/_alignment) * _alignment;
|
||||
const int32_t size = int32_t(aligned - current);
|
||||
if (0 != size)
|
||||
{
|
||||
return writeRep(_writer, 0, size, _err);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct BX_NO_VTABLE ReaderOpenI
|
||||
{
|
||||
virtual ~ReaderOpenI() = 0;
|
||||
|
2
3rdparty/bx/include/bx/ringbuffer.h
vendored
2
3rdparty/bx/include/bx/ringbuffer.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
63
3rdparty/bx/include/bx/rng.h
vendored
63
3rdparty/bx/include/bx/rng.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
|
||||
#include "bx.h"
|
||||
#include "fpumath.h"
|
||||
#include "uint32_t.h"
|
||||
|
||||
namespace bx
|
||||
{
|
||||
@ -94,36 +95,47 @@ namespace bx
|
||||
};
|
||||
|
||||
/// Returns random number between 0.0f and 1.0f.
|
||||
template <typename Ty>
|
||||
inline float frnd(Ty* _rng)
|
||||
template <typename Rng>
|
||||
inline float frnd(Rng* _rng)
|
||||
{
|
||||
uint32_t rnd = _rng->gen() & UINT16_MAX;
|
||||
return float(rnd) * 1.0f/float(UINT16_MAX);
|
||||
}
|
||||
|
||||
/// Returns random number between -1.0f and 1.0f.
|
||||
template <typename Ty>
|
||||
inline float frndh(Ty* _rng)
|
||||
template <typename Rng>
|
||||
inline float frndh(Rng* _rng)
|
||||
{
|
||||
return 2.0f * bx::frnd(_rng) - 1.0f;
|
||||
}
|
||||
|
||||
/// Generate random point on unit sphere.
|
||||
template <typename Ty>
|
||||
static inline void randUnitSphere(float _result[3], Ty* _rng)
|
||||
/// Generate random point on unit circle.
|
||||
template <typename Rng>
|
||||
inline void randUnitCircle(float _result[3], Rng* _rng)
|
||||
{
|
||||
float rand0 = frnd(_rng) * 2.0f - 1.0f;
|
||||
float rand1 = frnd(_rng) * pi * 2.0f;
|
||||
const float angle = frnd(_rng) * pi * 2.0f;
|
||||
|
||||
float sqrtf1 = sqrtf(1.0f - rand0*rand0);
|
||||
_result[0] = sqrtf1 * cosf(rand1);
|
||||
_result[1] = sqrtf1 * sinf(rand1);
|
||||
_result[0] = fcos(angle);
|
||||
_result[1] = 0.0f;
|
||||
_result[2] = fsin(angle);
|
||||
}
|
||||
|
||||
/// Generate random point on unit sphere.
|
||||
template <typename Rng>
|
||||
inline void randUnitSphere(float _result[3], Rng* _rng)
|
||||
{
|
||||
const float rand0 = frnd(_rng) * 2.0f - 1.0f;
|
||||
const float rand1 = frnd(_rng) * pi * 2.0f;
|
||||
const float sqrtf1 = fsqrt(1.0f - rand0*rand0);
|
||||
|
||||
_result[0] = sqrtf1 * fcos(rand1);
|
||||
_result[1] = sqrtf1 * fsin(rand1);
|
||||
_result[2] = rand0;
|
||||
}
|
||||
|
||||
/// Generate random point on unit hemisphere.
|
||||
template <typename Ty>
|
||||
static inline void randUnitHemisphere(float _result[3], Ty* _rng, const float _normal[3])
|
||||
inline void randUnitHemisphere(float _result[3], Ty* _rng, const float _normal[3])
|
||||
{
|
||||
float dir[3];
|
||||
randUnitSphere(dir, _rng);
|
||||
@ -148,7 +160,7 @@ namespace bx
|
||||
/// Sampling with Hammersley and Halton Points
|
||||
/// http://www.cse.cuhk.edu.hk/~ttwong/papers/udpoint/udpoints.html
|
||||
///
|
||||
static inline void generateSphereHammersley(void* _data, uint32_t _stride, uint32_t _num, float _scale = 1.0f)
|
||||
inline void generateSphereHammersley(void* _data, uint32_t _stride, uint32_t _num, float _scale = 1.0f)
|
||||
{
|
||||
uint8_t* data = (uint8_t*)_data;
|
||||
|
||||
@ -164,19 +176,32 @@ namespace bx
|
||||
|
||||
tt = 2.0f * tt - 1.0f;
|
||||
|
||||
const float phi = (ii + 0.5f) / _num;
|
||||
const float phi = (ii + 0.5f) / _num;
|
||||
const float phirad = phi * 2.0f * pi;
|
||||
const float st = sqrtf(1.0f-tt*tt) * _scale;
|
||||
const float st = fsqrt(1.0f-tt*tt) * _scale;
|
||||
|
||||
float* xyz = (float*)data;
|
||||
data += _stride;
|
||||
|
||||
xyz[0] = st * cosf(phirad);
|
||||
xyz[1] = st * sinf(phirad);
|
||||
xyz[0] = st * fcos(phirad);
|
||||
xyz[1] = st * fsin(phirad);
|
||||
xyz[2] = tt * _scale;
|
||||
}
|
||||
}
|
||||
|
||||
/// Fisher-Yates shuffle.
|
||||
template<typename Rng, typename Ty>
|
||||
inline void shuffle(Rng* _rng, Ty* _array, uint32_t _num)
|
||||
{
|
||||
BX_CHECK(_num != 0, "Number of elements can't be 0!");
|
||||
|
||||
for (uint32_t ii = 0, num = _num-1; ii < num; ++ii)
|
||||
{
|
||||
uint32_t jj = ii + 1 + _rng->gen() % (num - ii);
|
||||
bx::xchg(_array[ii], _array[jj]);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace bx
|
||||
|
||||
#endif // BX_RNG_H_HEADER_GUARD
|
||||
|
2
3rdparty/bx/include/bx/sem.h
vendored
2
3rdparty/bx/include/bx/sem.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
34
3rdparty/bx/include/bx/simd256_avx.inl
vendored
34
3rdparty/bx/include/bx/simd256_avx.inl
vendored
@ -10,7 +10,6 @@
|
||||
|
||||
namespace bx
|
||||
{
|
||||
|
||||
template<>
|
||||
BX_SIMD_FORCE_INLINE simd256_avx_t simd_ld(const void* _ptr)
|
||||
{
|
||||
@ -38,6 +37,39 @@ namespace bx
|
||||
return result;
|
||||
}
|
||||
|
||||
template<>
|
||||
BX_SIMD_FORCE_INLINE simd256_avx_t_t simd_splat(float _a)
|
||||
{
|
||||
return _mm256_set1_ps(_a);
|
||||
}
|
||||
|
||||
template<>
|
||||
BX_SIMD_FORCE_INLINE simd256_avx_t_t simd_isplat(uint32_t _a)
|
||||
{
|
||||
const __m256i splat = _mm256_set1_epi32(_a);
|
||||
const simd256_avx_t_t result = _mm256_castsi256_ps(splat);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template<>
|
||||
BX_SIMD_FORCE_INLINE simd256_avx_t_t simd_itof(simd256_avx_t_t _a)
|
||||
{
|
||||
const __m256i itof = _mm256_castps_si256(_a);
|
||||
const simd256_avx_t_t result = _mm256_cvtepi32_ps(itof);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template<>
|
||||
BX_SIMD_FORCE_INLINE simd256_avx_t_t simd_ftoi(simd256_avx_t_t _a)
|
||||
{
|
||||
const __m256i ftoi = _mm256_cvtps_epi32(_a);
|
||||
const simd256_avx_t_t result = _mm256_castsi256_ps(ftoi);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
typedef simd256_avx_t simd256_t;
|
||||
|
||||
} // namespace bx
|
||||
|
56
3rdparty/bx/include/bx/simd256_ref.inl
vendored
56
3rdparty/bx/include/bx/simd256_ref.inl
vendored
@ -13,27 +13,27 @@ namespace bx
|
||||
template<>
|
||||
BX_SIMD_FORCE_INLINE simd256_ref_t simd_ld(const void* _ptr)
|
||||
{
|
||||
const simd128_t* ptr = reinterpret_cast<const simd128_t*>(_ptr);
|
||||
const simd256_ref_t::type* ptr = reinterpret_cast<const simd256_ref_t::type*>(_ptr);
|
||||
simd256_ref_t result;
|
||||
result.simd128_0 = simd_ld<simd128_t>(&ptr[0]);
|
||||
result.simd128_1 = simd_ld<simd128_t>(&ptr[1]);
|
||||
result.simd128_0 = simd_ld<simd256_ref_t::type>(&ptr[0]);
|
||||
result.simd128_1 = simd_ld<simd256_ref_t::type>(&ptr[1]);
|
||||
return result;
|
||||
}
|
||||
|
||||
template<>
|
||||
BX_SIMD_FORCE_INLINE void simd_st(void* _ptr, simd256_ref_t& _a)
|
||||
{
|
||||
simd128_t* result = reinterpret_cast<simd128_t*>(_ptr);
|
||||
simd_st<simd128_t>(&result[0], _a.simd128_0);
|
||||
simd_st<simd128_t>(&result[1], _a.simd128_1);
|
||||
simd256_ref_t* result = reinterpret_cast<simd256_ref_t*>(_ptr);
|
||||
simd_st<simd256_ref_t::type>(&result[0], _a.simd128_0);
|
||||
simd_st<simd256_ref_t::type>(&result[1], _a.simd128_1);
|
||||
}
|
||||
|
||||
template<>
|
||||
BX_SIMD_FORCE_INLINE simd256_ref_t simd_ld(float _x, float _y, float _z, float _w, float _a, float _b, float _c, float _d)
|
||||
{
|
||||
simd256_ref_t result;
|
||||
result.simd128_0 = simd_ld<simd128_t>(_x, _y, _z, _w);
|
||||
result.simd128_1 = simd_ld<simd128_t>(_a, _b, _c, _d);
|
||||
result.simd128_0 = simd_ld<simd256_ref_t::type>(_x, _y, _z, _w);
|
||||
result.simd128_1 = simd_ld<simd256_ref_t::type>(_a, _b, _c, _d);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -41,8 +41,44 @@ namespace bx
|
||||
BX_SIMD_FORCE_INLINE simd256_ref_t simd_ild(uint32_t _x, uint32_t _y, uint32_t _z, uint32_t _w, uint32_t _a, uint32_t _b, uint32_t _c, uint32_t _d)
|
||||
{
|
||||
simd256_ref_t result;
|
||||
result.simd128_0 = simd_ild<simd128_t>(_x, _y, _z, _w);
|
||||
result.simd128_1 = simd_ild<simd128_t>(_a, _b, _c, _d);
|
||||
result.simd128_0 = simd_ild<simd256_ref_t::type>(_x, _y, _z, _w);
|
||||
result.simd128_1 = simd_ild<simd256_ref_t::type>(_a, _b, _c, _d);
|
||||
return result;
|
||||
}
|
||||
|
||||
template<>
|
||||
BX_SIMD_FORCE_INLINE simd256_ref_t simd_splat(float _a)
|
||||
{
|
||||
simd256_ref_t result;
|
||||
result.simd128_0 = simd_splat<simd256_ref_t::type>(_a);
|
||||
result.simd128_1 = simd_splat<simd256_ref_t::type>(_a);
|
||||
return result;
|
||||
}
|
||||
|
||||
template<>
|
||||
BX_SIMD_FORCE_INLINE simd256_ref_t simd_isplat(uint32_t _a)
|
||||
{
|
||||
simd256_ref_t result;
|
||||
result.simd128_0 = simd_isplat<simd256_ref_t::type>(_a);
|
||||
result.simd128_1 = simd_isplat<simd256_ref_t::type>(_a);
|
||||
return result;
|
||||
}
|
||||
|
||||
template<>
|
||||
BX_SIMD_FORCE_INLINE simd256_ref_t simd_itof(simd256_ref_t _a)
|
||||
{
|
||||
simd256_ref_t result;
|
||||
result.simd128_0 = simd_itof(_a.simd128_0);
|
||||
result.simd128_1 = simd_itof(_a.simd128_1);
|
||||
return result;
|
||||
}
|
||||
|
||||
template<>
|
||||
BX_SIMD_FORCE_INLINE simd256_ref_t simd_ftoi(simd256_ref_t _a)
|
||||
{
|
||||
simd256_ref_t result;
|
||||
result.simd128_0 = simd_ftoi(_a.simd128_0);
|
||||
result.simd128_1 = simd_ftoi(_a.simd128_1);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
12
3rdparty/bx/include/bx/simd_t.h
vendored
12
3rdparty/bx/include/bx/simd_t.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
@ -402,8 +402,14 @@ namespace bx
|
||||
|
||||
struct simd256_ref_t
|
||||
{
|
||||
simd128_t simd128_0;
|
||||
simd128_t simd128_1;
|
||||
#if BX_COMPILER_MSVC
|
||||
typedef simd128_ref_t type;
|
||||
#else
|
||||
typedef simd128_t type;
|
||||
#endif // BX_COMPILER_MSVC
|
||||
|
||||
type simd128_0;
|
||||
type simd128_1;
|
||||
};
|
||||
|
||||
#if !BX_SIMD_AVX
|
||||
|
2
3rdparty/bx/include/bx/spscqueue.h
vendored
2
3rdparty/bx/include/bx/spscqueue.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
39
3rdparty/bx/include/bx/string.h
vendored
39
3rdparty/bx/include/bx/string.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
@ -48,6 +48,23 @@ namespace bx
|
||||
return ptr - _str;
|
||||
}
|
||||
|
||||
/// Copy _num characters from string _src to _dst buffer of maximum _dstSize capacity
|
||||
/// including zero terminator. Copy will be terminated with '\0'.
|
||||
inline size_t strlncpy(char* _dst, size_t _dstSize, const char* _src, size_t _num = -1)
|
||||
{
|
||||
BX_CHECK(NULL != _dst, "_dst can't be NULL!");
|
||||
BX_CHECK(NULL != _src, "_src can't be NULL!");
|
||||
BX_CHECK(0 < _dstSize, "_dstSize can't be 0!");
|
||||
|
||||
const size_t len = strnlen(_src, _num);
|
||||
const size_t max = _dstSize-1;
|
||||
const size_t num = (len < max ? len : max);
|
||||
strncpy(_dst, _src, num);
|
||||
_dst[num] = '\0';
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
/// Find substring in string. Limit search to _size.
|
||||
inline const char* strnstr(const char* _str, const char* _find, size_t _size)
|
||||
{
|
||||
@ -550,12 +567,12 @@ namespace bx
|
||||
return *this;
|
||||
}
|
||||
|
||||
StringView(const char* _ptr, uint32_t _len = UINT32_MAX)
|
||||
StringView(const char* _ptr, uint32_t _len = UINT16_MAX)
|
||||
{
|
||||
set(_ptr, _len);
|
||||
}
|
||||
|
||||
void set(const char* _ptr, uint32_t _len = UINT32_MAX)
|
||||
void set(const char* _ptr, uint32_t _len = UINT16_MAX)
|
||||
{
|
||||
clear();
|
||||
|
||||
@ -619,11 +636,12 @@ namespace bx
|
||||
{
|
||||
public:
|
||||
StringT()
|
||||
: StringView("", 0)
|
||||
: StringView()
|
||||
{
|
||||
}
|
||||
|
||||
StringT(const StringT<AllocatorT>& _rhs)
|
||||
: StringView()
|
||||
{
|
||||
set(_rhs.m_ptr, _rhs.m_len);
|
||||
}
|
||||
@ -652,15 +670,18 @@ namespace bx
|
||||
void set(const char* _ptr, uint32_t _len = UINT32_MAX)
|
||||
{
|
||||
clear();
|
||||
append(_ptr, _len);
|
||||
}
|
||||
|
||||
void append(const char* _ptr, uint32_t _len = UINT32_MAX)
|
||||
{
|
||||
if (0 != _len)
|
||||
{
|
||||
uint32_t len = uint32_t(strnlen(_ptr, _len) );
|
||||
uint32_t old = m_len;
|
||||
uint32_t len = m_len + uint32_t(strnlen(_ptr, _len) );
|
||||
char* ptr = (char*)BX_REALLOC(*AllocatorT, 0 != m_len ? const_cast<char*>(m_ptr) : NULL, len+1);
|
||||
m_len = len;
|
||||
char* ptr = (char*)BX_ALLOC(*AllocatorT, len+1);
|
||||
|
||||
memcpy(ptr, _ptr, len);
|
||||
ptr[len] = '\0';
|
||||
strlncpy(ptr + old, len-old+1, _ptr, _len);
|
||||
|
||||
*const_cast<char**>(&m_ptr) = ptr;
|
||||
}
|
||||
|
2
3rdparty/bx/include/bx/thread.h
vendored
2
3rdparty/bx/include/bx/thread.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
2
3rdparty/bx/include/bx/timer.h
vendored
2
3rdparty/bx/include/bx/timer.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
2
3rdparty/bx/include/bx/tokenizecmd.h
vendored
2
3rdparty/bx/include/bx/tokenizecmd.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2012-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
2
3rdparty/bx/include/bx/uint32_t.h
vendored
2
3rdparty/bx/include/bx/uint32_t.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
17
3rdparty/bx/makefile
vendored
17
3rdparty/bx/makefile
vendored
@ -6,8 +6,6 @@
|
||||
GENIE=../bx/tools/bin/$(OS)/genie
|
||||
|
||||
all:
|
||||
$(GENIE) vs2008
|
||||
$(GENIE) vs2010
|
||||
$(GENIE) vs2012
|
||||
$(GENIE) vs2013
|
||||
$(GENIE) --gcc=android-arm gmake
|
||||
@ -83,21 +81,6 @@ mingw-clang-release64: .build/projects/gmake-mingw-clang
|
||||
make -R -C .build/projects/gmake-mingw-clang config=release64
|
||||
mingw-clang: mingw-clang-debug32 mingw-clang-release32 mingw-clang-debug64 mingw-clang-release64
|
||||
|
||||
.build/projects/vs2008:
|
||||
$(GENIE) vs2008
|
||||
vs2008-debug32:
|
||||
devenv .build/projects/vs2008/bgfx.sln /Build "Debug|Win32"
|
||||
vs2008-release32:
|
||||
devenv .build/projects/vs2008/bgfx.sln /Build "Release|Win32"
|
||||
vs2008-debug64:
|
||||
devenv .build/projects/vs2008/bgfx.sln /Build "Debug|x64"
|
||||
vs2008-release64:
|
||||
devenv .build/projects/vs2008/bgfx.sln /Build "Release|x64"
|
||||
vs2008: vs2008-debug32 vs2008-release32 vs2008-debug64 vs2008-release64
|
||||
|
||||
.build/projects/vs2010:
|
||||
$(GENIE) vs2010
|
||||
|
||||
.build/projects/vs2012:
|
||||
$(GENIE) vs2012
|
||||
|
||||
|
2
3rdparty/bx/scripts/bin2c.lua
vendored
2
3rdparty/bx/scripts/bin2c.lua
vendored
@ -1,5 +1,5 @@
|
||||
--
|
||||
-- Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
-- Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
-- License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
--
|
||||
|
||||
|
2
3rdparty/bx/scripts/bx.lua
vendored
2
3rdparty/bx/scripts/bx.lua
vendored
@ -1,5 +1,5 @@
|
||||
--
|
||||
-- Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
-- Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
-- License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
--
|
||||
|
||||
|
2
3rdparty/bx/scripts/genie.lua
vendored
2
3rdparty/bx/scripts/genie.lua
vendored
@ -1,5 +1,5 @@
|
||||
--
|
||||
-- Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
-- Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
-- License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
--
|
||||
|
||||
|
169
3rdparty/bx/scripts/toolchain.lua
vendored
169
3rdparty/bx/scripts/toolchain.lua
vendored
@ -1,5 +1,5 @@
|
||||
--
|
||||
-- Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
-- Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
-- License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
--
|
||||
|
||||
@ -39,6 +39,7 @@ function toolchain(_buildDir, _libDir)
|
||||
{ "pnacl", "Native Client - PNaCl" },
|
||||
{ "orbis", "Orbis" },
|
||||
{ "qnx-arm", "QNX/Blackberry - ARM" },
|
||||
{ "riscv", "RISC-V" },
|
||||
{ "rpi", "RaspberryPi" },
|
||||
},
|
||||
}
|
||||
@ -51,9 +52,11 @@ function toolchain(_buildDir, _libDir)
|
||||
{ "vs2012-clang", "Clang 3.6" },
|
||||
{ "vs2013-clang", "Clang 3.6" },
|
||||
{ "vs2015-clang", "Clang 3.9" },
|
||||
{ "vs2017-clang", "Clang with MS CodeGen" },
|
||||
{ "vs2012-xp", "Visual Studio 2012 targeting XP" },
|
||||
{ "vs2013-xp", "Visual Studio 2013 targeting XP" },
|
||||
{ "vs2015-xp", "Visual Studio 2015 targeting XP" },
|
||||
{ "vs2017-xp", "Visual Studio 2017 targeting XP" },
|
||||
{ "winphone8", "Windows Phone 8.0" },
|
||||
{ "winphone81", "Windows Phone 8.1" },
|
||||
{ "winstore81", "Windows Store 8.1" },
|
||||
@ -92,6 +95,12 @@ function toolchain(_buildDir, _libDir)
|
||||
description = "Set tvOS target version (default: 9.0).",
|
||||
}
|
||||
|
||||
newoption {
|
||||
trigger = "with-windows",
|
||||
value = "#",
|
||||
description = "Set the Windows target platform version (default: 10.0.10240.0).",
|
||||
}
|
||||
|
||||
newoption {
|
||||
trigger = "with-dynamic-runtime",
|
||||
description = "Dynamically link with the runtime rather than statically",
|
||||
@ -118,7 +127,7 @@ function toolchain(_buildDir, _libDir)
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
local androidPlatform = "android-14"
|
||||
local androidPlatform = "android-24"
|
||||
if _OPTIONS["with-android"] then
|
||||
androidPlatform = "android-" .. _OPTIONS["with-android"]
|
||||
end
|
||||
@ -133,6 +142,11 @@ function toolchain(_buildDir, _libDir)
|
||||
tvosPlatform = _OPTIONS["with-tvos"]
|
||||
end
|
||||
|
||||
local windowsPlatform = "10.0.10240.0"
|
||||
if _OPTIONS["with-windows"] then
|
||||
windowsPlatform = _OPTIONS["with-windows"]
|
||||
end
|
||||
|
||||
local compiler32bit = false
|
||||
if _OPTIONS["with-32bit-compiler"] then
|
||||
compiler32bit = true
|
||||
@ -151,35 +165,41 @@ function toolchain(_buildDir, _libDir)
|
||||
|
||||
if "android-arm" == _OPTIONS["gcc"] then
|
||||
|
||||
if not os.getenv("ANDROID_NDK_ARM") or not os.getenv("ANDROID_NDK_ROOT") then
|
||||
print("Set ANDROID_NDK_ARM and ANDROID_NDK_ROOT envrionment variables.")
|
||||
if not os.getenv("ANDROID_NDK_ARM")
|
||||
or not os.getenv("ANDROID_NDK_CLANG")
|
||||
or not os.getenv("ANDROID_NDK_ROOT") then
|
||||
print("Set ANDROID_NDK_CLANG and ANDROID_NDK_ROOT envrionment variables.")
|
||||
end
|
||||
|
||||
premake.gcc.cc = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-gcc"
|
||||
premake.gcc.cxx = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-g++"
|
||||
premake.gcc.ar = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-ar"
|
||||
premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang"
|
||||
premake.gcc.cxx = "$(ANDROID_NDK_CLANG)/bin/clang++"
|
||||
premake.gcc.llvm = true
|
||||
location (path.join(_buildDir, "projects", _ACTION .. "-android-arm"))
|
||||
|
||||
elseif "android-mips" == _OPTIONS["gcc"] then
|
||||
|
||||
if not os.getenv("ANDROID_NDK_MIPS") or not os.getenv("ANDROID_NDK_ROOT") then
|
||||
if not os.getenv("ANDROID_NDK_MIPS")
|
||||
or not os.getenv("ANDROID_NDK_CLANG")
|
||||
or not os.getenv("ANDROID_NDK_ROOT") then
|
||||
print("Set ANDROID_NDK_MIPS and ANDROID_NDK_ROOT envrionment variables.")
|
||||
end
|
||||
|
||||
premake.gcc.cc = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-gcc"
|
||||
premake.gcc.cxx = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-g++"
|
||||
premake.gcc.ar = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-ar"
|
||||
premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang"
|
||||
premake.gcc.cxx = "$(ANDROID_NDK_CLANG)/bin/clang++"
|
||||
premake.gcc.llvm = true
|
||||
location (path.join(_buildDir, "projects", _ACTION .. "-android-mips"))
|
||||
|
||||
elseif "android-x86" == _OPTIONS["gcc"] then
|
||||
|
||||
if not os.getenv("ANDROID_NDK_X86") or not os.getenv("ANDROID_NDK_ROOT") then
|
||||
if not os.getenv("ANDROID_NDK_X86")
|
||||
or not os.getenv("ANDROID_NDK_CLANG")
|
||||
or not os.getenv("ANDROID_NDK_ROOT") then
|
||||
print("Set ANDROID_NDK_X86 and ANDROID_NDK_ROOT envrionment variables.")
|
||||
end
|
||||
|
||||
premake.gcc.cc = "$(ANDROID_NDK_X86)/bin/i686-linux-android-gcc"
|
||||
premake.gcc.cxx = "$(ANDROID_NDK_X86)/bin/i686-linux-android-g++"
|
||||
premake.gcc.ar = "$(ANDROID_NDK_X86)/bin/i686-linux-android-ar"
|
||||
premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang"
|
||||
premake.gcc.cxx = "$(ANDROID_NDK_CLANG)/bin/clang++"
|
||||
premake.gcc.llvm = true
|
||||
location (path.join(_buildDir, "projects", _ACTION .. "-android-x86"))
|
||||
|
||||
elseif "asmjs" == _OPTIONS["gcc"] then
|
||||
@ -387,17 +407,23 @@ function toolchain(_buildDir, _libDir)
|
||||
location (path.join(_buildDir, "projects", _ACTION .. "-rpi"))
|
||||
|
||||
elseif "riscv" == _OPTIONS["gcc"] then
|
||||
premake.gcc.cc = "$(RISCV_DIR)/bin/riscv64-unknown-elf-gcc"
|
||||
premake.gcc.cxx = "$(RISCV_DIR)/bin/riscv64-unknown-elf-g++"
|
||||
premake.gcc.ar = "$(RISCV_DIR)/bin/riscv64-unknown-elf-ar"
|
||||
premake.gcc.cc = "$(FREEDOM_E_SDK)/toolchain/bin/riscv32-unknown-elf-gcc"
|
||||
premake.gcc.cxx = "$(FREEDOM_E_SDK)/toolchain/bin/riscv32-unknown-elf-g++"
|
||||
premake.gcc.ar = "$(FREEDOM_E_SDK)/toolchain/bin/riscv32-unknown-elf-ar"
|
||||
location (path.join(_buildDir, "projects", _ACTION .. "-riscv"))
|
||||
|
||||
end
|
||||
elseif _ACTION == "vs2012" or _ACTION == "vs2013" or _ACTION == "vs2015" then
|
||||
elseif _ACTION == "vs2012"
|
||||
or _ACTION == "vs2013"
|
||||
or _ACTION == "vs2015"
|
||||
or _ACTION == "vs2017"
|
||||
then
|
||||
|
||||
if (_ACTION .. "-clang") == _OPTIONS["vs"] then
|
||||
if "vs2015-clang" == _OPTIONS["vs"] then
|
||||
premake.vstudio.toolset = ("LLVM-vs2014")
|
||||
if "vs2017-clang" == _OPTIONS["vs"] then
|
||||
premake.vstudio.toolset = "v141_clang_c2"
|
||||
elseif "vs2015-clang" == _OPTIONS["vs"] then
|
||||
premake.vstudio.toolset = "LLVM-vs2014"
|
||||
else
|
||||
premake.vstudio.toolset = ("LLVM-" .. _ACTION)
|
||||
end
|
||||
@ -422,6 +448,11 @@ function toolchain(_buildDir, _libDir)
|
||||
elseif "winstore82" == _OPTIONS["vs"] then
|
||||
premake.vstudio.toolset = "v140"
|
||||
premake.vstudio.storeapp = "8.2"
|
||||
|
||||
local action = premake.action.current()
|
||||
action.vstudio.windowsTargetPlatformVersion = windowsPlatform
|
||||
action.vstudio.windowsTargetPlatformMinVersion = windowsPlatform
|
||||
|
||||
platforms { "ARM" }
|
||||
location (path.join(_buildDir, "projects", _ACTION .. "-winstore82"))
|
||||
|
||||
@ -457,6 +488,10 @@ function toolchain(_buildDir, _libDir)
|
||||
premake.vstudio.toolset = ("v140_xp")
|
||||
location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
|
||||
|
||||
elseif "vs2015-xp" == _OPTIONS["vs"] then
|
||||
premake.vstudio.toolset = ("v141_xp")
|
||||
location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
|
||||
|
||||
elseif _ACTION == "xcode4" then
|
||||
|
||||
if "osx" == _OPTIONS["xcode"] then
|
||||
@ -557,6 +592,21 @@ function toolchain(_buildDir, _libDir)
|
||||
path.join(_libDir, "lib/win64_" .. _ACTION),
|
||||
}
|
||||
|
||||
configuration { "x32", "vs2017" }
|
||||
targetdir (path.join(_buildDir, "win32_" .. _ACTION, "bin"))
|
||||
objdir (path.join(_buildDir, "win32_" .. _ACTION, "obj"))
|
||||
libdirs {
|
||||
path.join(_libDir, "lib/win32_" .. _ACTION),
|
||||
}
|
||||
|
||||
configuration { "x64", "vs2017" }
|
||||
defines { "_WIN64" }
|
||||
targetdir (path.join(_buildDir, "win64_" .. _ACTION, "bin"))
|
||||
objdir (path.join(_buildDir, "win64_" .. _ACTION, "obj"))
|
||||
libdirs {
|
||||
path.join(_libDir, "lib/win64_" .. _ACTION),
|
||||
}
|
||||
|
||||
configuration { "ARM", "vs*" }
|
||||
targetdir (path.join(_buildDir, "arm_" .. _ACTION, "bin"))
|
||||
objdir (path.join(_buildDir, "arm_" .. _ACTION, "obj"))
|
||||
@ -588,6 +638,9 @@ function toolchain(_buildDir, _libDir)
|
||||
configuration { "mingw-*" }
|
||||
defines { "WIN32" }
|
||||
includedirs { path.join(bxDir, "include/compat/mingw") }
|
||||
defines {
|
||||
"MINGW_HAS_SECURE_API=1",
|
||||
}
|
||||
buildoptions {
|
||||
"-Wunused-value",
|
||||
"-fdata-sections",
|
||||
@ -597,7 +650,7 @@ function toolchain(_buildDir, _libDir)
|
||||
"-Wundef",
|
||||
}
|
||||
buildoptions_cpp {
|
||||
"-std=c++0x",
|
||||
"-std=c++11",
|
||||
}
|
||||
linkoptions {
|
||||
"-Wl,--gc-sections",
|
||||
@ -679,7 +732,7 @@ function toolchain(_buildDir, _libDir)
|
||||
"-Wundef",
|
||||
}
|
||||
buildoptions_cpp {
|
||||
"-std=c++0x",
|
||||
"-std=c++11",
|
||||
}
|
||||
links {
|
||||
"rt",
|
||||
@ -687,6 +740,7 @@ function toolchain(_buildDir, _libDir)
|
||||
}
|
||||
linkoptions {
|
||||
"-Wl,--gc-sections",
|
||||
"-Wl,--as-needed",
|
||||
}
|
||||
|
||||
configuration { "linux-gcc*", "x32" }
|
||||
@ -730,7 +784,7 @@ function toolchain(_buildDir, _libDir)
|
||||
"-Wundef",
|
||||
}
|
||||
buildoptions_cpp {
|
||||
"-std=c++0x",
|
||||
"-std=c++11",
|
||||
}
|
||||
links {
|
||||
"rt",
|
||||
@ -749,7 +803,7 @@ function toolchain(_buildDir, _libDir)
|
||||
"-Wundef",
|
||||
}
|
||||
buildoptions_cpp {
|
||||
"-std=c++0x",
|
||||
"-std=c++11",
|
||||
}
|
||||
links {
|
||||
"rt",
|
||||
@ -765,12 +819,11 @@ function toolchain(_buildDir, _libDir)
|
||||
"NoImportLib",
|
||||
}
|
||||
includedirs {
|
||||
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include",
|
||||
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/include",
|
||||
"$(ANDROID_NDK_ROOT)/sources/android/native_app_glue",
|
||||
}
|
||||
linkoptions {
|
||||
"-nostdlib",
|
||||
"-static-libgcc",
|
||||
}
|
||||
links {
|
||||
"c",
|
||||
@ -778,21 +831,20 @@ function toolchain(_buildDir, _libDir)
|
||||
"m",
|
||||
"android",
|
||||
"log",
|
||||
"gnustl_static",
|
||||
"c++",
|
||||
"gcc",
|
||||
}
|
||||
buildoptions {
|
||||
"-fPIC",
|
||||
"-no-canonical-prefixes",
|
||||
"-Wa,--noexecstack",
|
||||
"-fstack-protector",
|
||||
"-fstack-protector-strong",
|
||||
"-ffunction-sections",
|
||||
"-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
|
||||
"-Wunused-value",
|
||||
"-Wundef",
|
||||
}
|
||||
buildoptions_cpp {
|
||||
"-std=c++0x",
|
||||
"-std=c++11",
|
||||
}
|
||||
linkoptions {
|
||||
"-no-canonical-prefixes",
|
||||
@ -811,7 +863,7 @@ function toolchain(_buildDir, _libDir)
|
||||
"__STEAMLINK__=1", -- There is no special prefedined compiler symbol to detect SteamLink, faking it.
|
||||
}
|
||||
buildoptions {
|
||||
"-std=c++0x",
|
||||
"-std=c++11",
|
||||
"-Wfatal-errors",
|
||||
"-Wunused-value",
|
||||
"-Wundef",
|
||||
@ -831,14 +883,16 @@ function toolchain(_buildDir, _libDir)
|
||||
objdir (path.join(_buildDir, "android-arm/obj"))
|
||||
libdirs {
|
||||
path.join(_libDir, "lib/android-arm"),
|
||||
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a",
|
||||
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a",
|
||||
}
|
||||
includedirs {
|
||||
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include",
|
||||
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include",
|
||||
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/include",
|
||||
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/include",
|
||||
}
|
||||
buildoptions {
|
||||
"-gcc-toolchain $(ANDROID_NDK_ARM)",
|
||||
"--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
|
||||
"-target armv7-none-linux-androideabi",
|
||||
"-mthumb",
|
||||
"-march=armv7-a",
|
||||
"-mfloat-abi=softfp",
|
||||
@ -847,9 +901,11 @@ function toolchain(_buildDir, _libDir)
|
||||
"-Wundef",
|
||||
}
|
||||
linkoptions {
|
||||
"-gcc-toolchain $(ANDROID_NDK_ARM)",
|
||||
"--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm"),
|
||||
path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtbegin_so.o"),
|
||||
path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm/usr/lib/crtend_so.o"),
|
||||
"-target armv7-none-linux-androideabi",
|
||||
"-march=armv7-a",
|
||||
"-Wl,--fix-cortex-a8",
|
||||
}
|
||||
@ -859,20 +915,26 @@ function toolchain(_buildDir, _libDir)
|
||||
objdir (path.join(_buildDir, "android-mips/obj"))
|
||||
libdirs {
|
||||
path.join(_libDir, "lib/android-mips"),
|
||||
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/mips",
|
||||
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/mips",
|
||||
}
|
||||
includedirs {
|
||||
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/mips/include",
|
||||
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/mips/include",
|
||||
}
|
||||
buildoptions {
|
||||
"-gcc-toolchain $(ANDROID_NDK_MIPS)",
|
||||
"--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips"),
|
||||
"-target mipsel-none-linux-android",
|
||||
"-mips32",
|
||||
"-Wunused-value",
|
||||
"-Wundef",
|
||||
}
|
||||
linkoptions {
|
||||
"-gcc-toolchain $(ANDROID_NDK_MIPS)",
|
||||
"--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips"),
|
||||
path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips/usr/lib/crtbegin_so.o"),
|
||||
path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-mips/usr/lib/crtend_so.o"),
|
||||
"-target mipsel-none-linux-android",
|
||||
"-mips32",
|
||||
}
|
||||
|
||||
configuration { "android-x86" }
|
||||
@ -880,13 +942,15 @@ function toolchain(_buildDir, _libDir)
|
||||
objdir (path.join(_buildDir, "android-x86/obj"))
|
||||
libdirs {
|
||||
path.join(_libDir, "lib/android-x86"),
|
||||
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86",
|
||||
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/x86",
|
||||
}
|
||||
includedirs {
|
||||
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include",
|
||||
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/x86/include",
|
||||
}
|
||||
buildoptions {
|
||||
"-gcc-toolchain $(ANDROID_NDK_X86)",
|
||||
"--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
|
||||
"-target i686-none-linux-android",
|
||||
"-march=i686",
|
||||
"-mtune=atom",
|
||||
"-mstackrealign",
|
||||
@ -896,9 +960,11 @@ function toolchain(_buildDir, _libDir)
|
||||
"-Wundef",
|
||||
}
|
||||
linkoptions {
|
||||
"-gcc-toolchain $(ANDROID_NDK_X86)",
|
||||
"--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86"),
|
||||
path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtbegin_so.o"),
|
||||
path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-x86/usr/lib/crtend_so.o"),
|
||||
"-target i686-none-linux-android",
|
||||
}
|
||||
|
||||
configuration { "asmjs" }
|
||||
@ -931,7 +997,7 @@ function toolchain(_buildDir, _libDir)
|
||||
"-Wundef",
|
||||
}
|
||||
buildoptions_cpp {
|
||||
"-std=c++0x",
|
||||
"-std=c++11",
|
||||
}
|
||||
includedirs {
|
||||
"$(NACL_SDK_ROOT)/include",
|
||||
@ -1045,6 +1111,9 @@ function toolchain(_buildDir, _libDir)
|
||||
objdir (path.join(_buildDir, "osx_universal/bin"))
|
||||
|
||||
configuration { "osx" }
|
||||
buildoptions_cpp {
|
||||
"-std=c++11",
|
||||
}
|
||||
buildoptions {
|
||||
"-Wfatal-errors",
|
||||
"-msse2",
|
||||
@ -1057,6 +1126,9 @@ function toolchain(_buildDir, _libDir)
|
||||
linkoptions {
|
||||
"-lc++",
|
||||
}
|
||||
buildoptions_cpp {
|
||||
"-std=c++11",
|
||||
}
|
||||
buildoptions {
|
||||
"-Wfatal-errors",
|
||||
"-Wunused-value",
|
||||
@ -1184,7 +1256,7 @@ function toolchain(_buildDir, _libDir)
|
||||
buildoptions {
|
||||
}
|
||||
buildoptions_cpp {
|
||||
"-std=c++0x",
|
||||
"-std=c++11",
|
||||
}
|
||||
linkoptions {
|
||||
}
|
||||
@ -1200,7 +1272,7 @@ function toolchain(_buildDir, _libDir)
|
||||
"-Wundef",
|
||||
}
|
||||
buildoptions_cpp {
|
||||
"-std=c++0x",
|
||||
"-std=c++11",
|
||||
}
|
||||
|
||||
configuration { "rpi" }
|
||||
@ -1219,7 +1291,7 @@ function toolchain(_buildDir, _libDir)
|
||||
"-Wundef",
|
||||
}
|
||||
buildoptions_cpp {
|
||||
"-std=c++0x",
|
||||
"-std=c++11",
|
||||
}
|
||||
includedirs {
|
||||
"/opt/vc/include",
|
||||
@ -1236,16 +1308,21 @@ function toolchain(_buildDir, _libDir)
|
||||
configuration { "riscv" }
|
||||
targetdir (path.join(_buildDir, "riscv/bin"))
|
||||
objdir (path.join(_buildDir, "riscv/obj"))
|
||||
defines {
|
||||
"__BSD_VISIBLE",
|
||||
"__MISC_VISIBLE",
|
||||
}
|
||||
includedirs {
|
||||
"$(RISCV_DIR)/sysroot/usr/include",
|
||||
"$(FREEDOM_E_SDK)/toolchain/riscv32-unknown-elf/include",
|
||||
path.join(bxDir, "include/compat/riscv"),
|
||||
}
|
||||
buildoptions {
|
||||
"-Wunused-value",
|
||||
"-Wundef",
|
||||
"--sysroot=$(RISCV_DIR)/sysroot",
|
||||
"--sysroot=$(FREEDOM_E_SDK)/toolchain/riscv32-unknown-elf",
|
||||
}
|
||||
buildoptions_cpp {
|
||||
"-std=c++0x",
|
||||
"-std=c++11",
|
||||
}
|
||||
|
||||
configuration {} -- reset configuration
|
||||
|
2
3rdparty/bx/tests/dbg.cpp
vendored
2
3rdparty/bx/tests/dbg.cpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2011-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
2
3rdparty/bx/tests/dbg.h
vendored
2
3rdparty/bx/tests/dbg.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2011-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
2
3rdparty/bx/tests/fpumath_test.cpp
vendored
2
3rdparty/bx/tests/fpumath_test.cpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
2
3rdparty/bx/tests/handle_bench.cpp
vendored
2
3rdparty/bx/tests/handle_bench.cpp
vendored
@ -52,7 +52,7 @@ int main()
|
||||
{
|
||||
typedef std::unordered_map<uint64_t, uint16_t> StdUnorderedMap;
|
||||
StdUnorderedMap map;
|
||||
// map.reserve(numElements);
|
||||
map.reserve(numElements);
|
||||
for (uint32_t jj = 0; jj < numElements; ++jj)
|
||||
{
|
||||
std::pair<StdUnorderedMap::iterator, bool> ok = map.insert(std::make_pair(uint64_t(jj), uint16_t(jj) ) );
|
||||
|
2
3rdparty/bx/tests/handle_test.cpp
vendored
2
3rdparty/bx/tests/handle_test.cpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
2
3rdparty/bx/tests/macros_test.cpp
vendored
2
3rdparty/bx/tests/macros_test.cpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
2
3rdparty/bx/tests/main_test.cpp
vendored
2
3rdparty/bx/tests/main_test.cpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
42
3rdparty/bx/tests/simd_test.cpp
vendored
42
3rdparty/bx/tests/simd_test.cpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
@ -11,11 +11,13 @@
|
||||
#if 0
|
||||
# define SIMD_DBG DBG
|
||||
#else
|
||||
# define SIMD_DBG(_fmt, ...) BX_UNUSED(__VA_ARGS__);
|
||||
# define SIMD_DBG unused
|
||||
#endif // 0
|
||||
|
||||
using namespace bx;
|
||||
|
||||
inline void unused(...) {}
|
||||
|
||||
union simd_cast
|
||||
{
|
||||
bx::simd256_t simd256;
|
||||
@ -59,7 +61,6 @@ void simd_check_int32(
|
||||
REQUIRE(c.i[3] == _3);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void simd_check_int32(
|
||||
const char* _str
|
||||
, bx::simd256_t _a
|
||||
@ -89,7 +90,6 @@ void simd_check_int32(
|
||||
REQUIRE(c.i[6] == _6);
|
||||
REQUIRE(c.i[7] == _7);
|
||||
}
|
||||
#endif // 0
|
||||
|
||||
void simd_check_uint32(
|
||||
const char* _str
|
||||
@ -114,7 +114,6 @@ void simd_check_uint32(
|
||||
REQUIRE(c.ui[3] == _3);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void simd_check_uint32(
|
||||
const char* _str
|
||||
, bx::simd256_t _a
|
||||
@ -145,7 +144,6 @@ void simd_check_uint32(
|
||||
REQUIRE(c.ui[6] == _6);
|
||||
REQUIRE(c.ui[7] == _7);
|
||||
}
|
||||
#endif // 0
|
||||
|
||||
void simd_check_float(
|
||||
const char* _str
|
||||
@ -170,7 +168,6 @@ void simd_check_float(
|
||||
CHECK(bx::fequal(c.f[3], _3, 0.0001f) );
|
||||
}
|
||||
|
||||
#if 0
|
||||
void simd_check_float(
|
||||
const char* _str
|
||||
, bx::simd256_t _a
|
||||
@ -201,7 +198,6 @@ void simd_check_float(
|
||||
CHECK(bx::fequal(c.f[6], _6, 0.0001f) );
|
||||
CHECK(bx::fequal(c.f[7], _7, 0.0001f) );
|
||||
}
|
||||
#endif // 0
|
||||
|
||||
void simd_check_string(const char* _str, bx::simd128_t _a)
|
||||
{
|
||||
@ -326,20 +322,20 @@ TEST_CASE("simd_load", "")
|
||||
, 0.0f, 1.0f, 2.0f, 3.0f
|
||||
);
|
||||
|
||||
// simd_check_float("ld"
|
||||
// , simd_ld<simd256_t>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f)
|
||||
// , 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f
|
||||
// );
|
||||
simd_check_float("ld"
|
||||
, simd_ld<simd256_t>(0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f)
|
||||
, 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f
|
||||
);
|
||||
|
||||
simd_check_int32("ild"
|
||||
, simd_ild(uint32_t(-1), 0, 1, 2)
|
||||
, uint32_t(-1), 0, 1, 2
|
||||
);
|
||||
|
||||
// simd_check_int32("ild"
|
||||
// , simd_ild<simd256_t>(uint32_t(-1), 0, 1, 2, 3, 4, 5, 6)
|
||||
// , uint32_t(-1), 0, 1, 2, 3, 4, 5, 6
|
||||
// );
|
||||
simd_check_int32("ild"
|
||||
, simd_ild<simd256_t>(uint32_t(-1), 0, 1, 2, 3, 4, 5, 6)
|
||||
, uint32_t(-1), 0, 1, 2, 3, 4, 5, 6
|
||||
);
|
||||
|
||||
simd_check_int32("ild"
|
||||
, simd_ild(uint32_t(-1), uint32_t(-2), uint32_t(-3), uint32_t(-4) )
|
||||
@ -350,13 +346,21 @@ TEST_CASE("simd_load", "")
|
||||
, 0, 0, 0, 0
|
||||
);
|
||||
|
||||
simd_check_uint32("isplat", simd_isplat(0x80000001)
|
||||
simd_check_uint32("isplat", simd_isplat<simd128_t>(0x80000001)
|
||||
, 0x80000001, 0x80000001, 0x80000001, 0x80000001
|
||||
);
|
||||
|
||||
simd_check_float("isplat", simd_splat(1.0f)
|
||||
simd_check_float("splat", simd_splat<simd128_t>(1.0f)
|
||||
, 1.0f, 1.0f, 1.0f, 1.0f
|
||||
);
|
||||
|
||||
simd_check_uint32("isplat", simd_isplat<simd256_t>(0x80000001)
|
||||
, 0x80000001, 0x80000001, 0x80000001, 0x80000001, 0x80000001, 0x80000001, 0x80000001, 0x80000001
|
||||
);
|
||||
|
||||
simd_check_float("splat", simd_splat<simd256_t>(1.0f)
|
||||
, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f
|
||||
);
|
||||
}
|
||||
|
||||
TEST_CASE("simd_arithmetic", "")
|
||||
@ -390,7 +394,7 @@ TEST_CASE("simd_sqrt", "")
|
||||
);
|
||||
}
|
||||
|
||||
TEST_CASE("float4", "")
|
||||
TEST_CASE("simd", "")
|
||||
{
|
||||
const simd128_t isplat = simd_isplat(0x80000001);
|
||||
simd_check_uint32("sll"
|
||||
|
34
3rdparty/bx/tests/string_test.cpp
vendored
34
3rdparty/bx/tests/string_test.cpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
@ -19,6 +19,27 @@ TEST_CASE("strnlen", "")
|
||||
REQUIRE(4 == bx::strnlen(test, UINT32_MAX) );
|
||||
}
|
||||
|
||||
TEST_CASE("strlncpy", "")
|
||||
{
|
||||
char dst[128];
|
||||
size_t num;
|
||||
|
||||
num = bx::strlncpy(dst, 1, "blah");
|
||||
REQUIRE(num == 0);
|
||||
|
||||
num = bx::strlncpy(dst, 3, "blah", 3);
|
||||
REQUIRE(0 == strcmp(dst, "bl") );
|
||||
REQUIRE(num == 2);
|
||||
|
||||
num = bx::strlncpy(dst, sizeof(dst), "blah", 3);
|
||||
REQUIRE(0 == strcmp(dst, "bla") );
|
||||
REQUIRE(num == 3);
|
||||
|
||||
num = bx::strlncpy(dst, sizeof(dst), "blah");
|
||||
REQUIRE(0 == strcmp(dst, "blah") );
|
||||
REQUIRE(num == 4);
|
||||
}
|
||||
|
||||
TEST_CASE("StringView", "")
|
||||
{
|
||||
bx::StringView sv("test");
|
||||
@ -32,10 +53,21 @@ TEST_CASE("StringView", "")
|
||||
String st(sv);
|
||||
REQUIRE(4 == st.getLength() );
|
||||
|
||||
st.append("test");
|
||||
REQUIRE(8 == st.getLength() );
|
||||
|
||||
st.append("test", 2);
|
||||
REQUIRE(10 == st.getLength() );
|
||||
|
||||
REQUIRE(0 == strcmp(st.getPtr(), "testtestte") );
|
||||
|
||||
st.clear();
|
||||
REQUIRE(0 == st.getLength() );
|
||||
REQUIRE(4 == sv.getLength() );
|
||||
|
||||
st.append("test");
|
||||
REQUIRE(4 == st.getLength() );
|
||||
|
||||
sv.clear();
|
||||
REQUIRE(0 == sv.getLength() );
|
||||
}
|
||||
|
2
3rdparty/bx/tests/test.h
vendored
2
3rdparty/bx/tests/test.h
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
2
3rdparty/bx/tests/thread_test.cpp
vendored
2
3rdparty/bx/tests/thread_test.cpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
2
3rdparty/bx/tests/tokenizecmd_test.cpp
vendored
2
3rdparty/bx/tests/tokenizecmd_test.cpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2012-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
2
3rdparty/bx/tests/uint32_test.cpp
vendored
2
3rdparty/bx/tests/uint32_test.cpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2010-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
|
BIN
3rdparty/bx/tools/bin/darwin/genie
vendored
BIN
3rdparty/bx/tools/bin/darwin/genie
vendored
Binary file not shown.
BIN
3rdparty/bx/tools/bin/linux/genie
vendored
BIN
3rdparty/bx/tools/bin/linux/genie
vendored
Binary file not shown.
BIN
3rdparty/bx/tools/bin/windows/genie.exe
vendored
BIN
3rdparty/bx/tools/bin/windows/genie.exe
vendored
Binary file not shown.
4
3rdparty/bx/tools/bin2c/bin2c.cpp
vendored
4
3rdparty/bx/tools/bin2c/bin2c.cpp
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2016 Branimir Karadzic. All rights reserved.
|
||||
* Copyright 2011-2017 Branimir Karadzic. All rights reserved.
|
||||
* License: https://github.com/bkaradzic/bx#license-bsd-2-clause
|
||||
*/
|
||||
|
||||
@ -95,7 +95,7 @@ void help(const char* _error = NULL)
|
||||
|
||||
fprintf(stderr
|
||||
, "bin2c, binary to C\n"
|
||||
"Copyright 2011-2016 Branimir Karadzic. All rights reserved.\n"
|
||||
"Copyright 2011-2017 Branimir Karadzic. All rights reserved.\n"
|
||||
"License: https://github.com/bkaradzic/bx#license-bsd-2-clause\n\n"
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user