diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2015-04-16 14:16:14 +0200 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2015-04-16 14:16:14 +0200 |
commit | 2b97bfba29e2ff0ed1864f6111a687ac1b61da43 (patch) | |
tree | 5913c15c09f03992d7f744d97957f978d2c8723a /3rdparty/bx | |
parent | 08747b36ecb01d5d77e33908372ac132fdd61453 (diff) |
update to latest 3rdparty, rollback of genie change (nw)
Diffstat (limited to '3rdparty/bx')
-rw-r--r-- | 3rdparty/bx/include/bx/os.h | 2 | ||||
-rw-r--r-- | 3rdparty/bx/include/bx/radixsort.h | 20 | ||||
-rw-r--r-- | 3rdparty/bx/include/bx/uint32_t.h | 58 | ||||
-rw-r--r-- | 3rdparty/bx/tests/uint32_t.cpp | 22 | ||||
-rw-r--r-- | 3rdparty/bx/tools/bin/darwin/genie | bin | 410544 -> 410464 bytes | |||
-rw-r--r-- | 3rdparty/bx/tools/bin/linux/genie | bin | 388544 -> 388544 bytes | |||
-rw-r--r-- | 3rdparty/bx/tools/bin/windows/genie.exe | bin | 394240 -> 394240 bytes |
7 files changed, 92 insertions, 10 deletions
diff --git a/3rdparty/bx/include/bx/os.h b/3rdparty/bx/include/bx/os.h index 939119f9090..4fcd2c08079 100644 --- a/3rdparty/bx/include/bx/os.h +++ b/3rdparty/bx/include/bx/os.h @@ -164,6 +164,7 @@ namespace bx { #if BX_PLATFORM_WINRT BX_UNUSED(_path); + return -1; #elif BX_COMPILER_MSVC_COMPATIBLE return ::_chdir(_path); #else @@ -175,6 +176,7 @@ namespace bx { #if BX_PLATFORM_WINRT BX_UNUSED(_buffer, _size); + return NULL; #elif BX_COMPILER_MSVC_COMPATIBLE return ::_getcwd(_buffer, (int)_size); #else diff --git a/3rdparty/bx/include/bx/radixsort.h b/3rdparty/bx/include/bx/radixsort.h index 5f37a269c9d..9ed4011fbf0 100644 --- a/3rdparty/bx/include/bx/radixsort.h +++ b/3rdparty/bx/include/bx/radixsort.h @@ -22,12 +22,12 @@ namespace bx Ty* __restrict values = _values; Ty* __restrict tempValues = _tempValues; - uint16_t histogram[BX_RADIXSORT_HISTOGRAM_SIZE]; + uint32_t histogram[BX_RADIXSORT_HISTOGRAM_SIZE]; uint16_t shift = 0; uint32_t pass = 0; for (; pass < 3; ++pass) { - memset(histogram, 0, sizeof(uint16_t)*BX_RADIXSORT_HISTOGRAM_SIZE); + memset(histogram, 0, sizeof(uint32_t)*BX_RADIXSORT_HISTOGRAM_SIZE); bool sorted = true; { @@ -47,10 +47,10 @@ namespace bx goto done; } - uint16_t offset = 0; + uint32_t offset = 0; for (uint32_t ii = 0; ii < BX_RADIXSORT_HISTOGRAM_SIZE; ++ii) { - uint16_t count = histogram[ii]; + uint32_t count = histogram[ii]; histogram[ii] = offset; offset += count; } @@ -59,7 +59,7 @@ namespace bx { uint32_t key = keys[ii]; uint16_t index = (key>>shift)&BX_RADIXSORT_BIT_MASK; - uint16_t dest = histogram[index]++; + uint32_t dest = histogram[index]++; tempKeys[dest] = key; tempValues[dest] = values[ii]; } @@ -95,12 +95,12 @@ done: Ty* __restrict values = _values; Ty* __restrict tempValues = _tempValues; - uint16_t histogram[BX_RADIXSORT_HISTOGRAM_SIZE]; + uint32_t histogram[BX_RADIXSORT_HISTOGRAM_SIZE]; uint16_t shift = 0; uint32_t pass = 0; for (; pass < 6; ++pass) { - memset(histogram, 0, sizeof(uint16_t)*BX_RADIXSORT_HISTOGRAM_SIZE); + memset(histogram, 0, sizeof(uint32_t)*BX_RADIXSORT_HISTOGRAM_SIZE); bool sorted = true; { @@ -120,10 +120,10 @@ done: goto done; } - uint16_t offset = 0; + uint32_t offset = 0; for (uint32_t ii = 0; ii < BX_RADIXSORT_HISTOGRAM_SIZE; ++ii) { - uint16_t count = histogram[ii]; + uint32_t count = histogram[ii]; histogram[ii] = offset; offset += count; } @@ -132,7 +132,7 @@ done: { uint64_t key = keys[ii]; uint16_t index = (key>>shift)&BX_RADIXSORT_BIT_MASK; - uint16_t dest = histogram[index]++; + uint32_t dest = histogram[index]++; tempKeys[dest] = key; tempValues[dest] = values[ii]; } diff --git a/3rdparty/bx/include/bx/uint32_t.h b/3rdparty/bx/include/bx/uint32_t.h index 9e77295c5e5..16ce229429c 100644 --- a/3rdparty/bx/include/bx/uint32_t.h +++ b/3rdparty/bx/include/bx/uint32_t.h @@ -679,6 +679,64 @@ namespace bx #endif // BX_COMPILER_ } + /// Greatest common divisor. + inline uint32_t uint32_gcd(uint32_t _a, uint32_t _b) + { + do + { + uint32_t tmp = _a % _b; + _a = _b; + _b = tmp; + } + while (_b); + + return _a; + } + + /// Least common multiple. + inline uint32_t uint32_lcm(uint32_t _a, uint32_t _b) + { + return _a * (_b / uint32_gcd(_a, _b) ); + } + + /// Align to arbitrary stride. + inline uint32_t strideAlign(uint32_t _offset, uint32_t _stride) + { + const uint32_t mod = uint32_mod(_offset, _stride); + const uint32_t add = uint32_sub(_stride, mod); + const uint32_t mask = uint32_cmpeq(mod, 0); + const uint32_t tmp = uint32_selb(mask, 0, add); + const uint32_t result = uint32_add(_offset, tmp); + + return result; + } + + /// Align to arbitrary stride and 16-bytes. + inline uint32_t strideAlign16(uint32_t _offset, uint32_t _stride) + { + const uint32_t align = uint32_lcm(16, _stride); + const uint32_t mod = uint32_mod(_offset, align); + const uint32_t mask = uint32_cmpeq(mod, 0); + const uint32_t tmp0 = uint32_selb(mask, 0, align); + const uint32_t tmp1 = uint32_add(_offset, tmp0); + const uint32_t result = uint32_sub(tmp1, mod); + + return result; + } + + /// Align to arbitrary stride and 256-bytes. + inline uint32_t strideAlign256(uint32_t _offset, uint32_t _stride) + { + const uint32_t align = uint32_lcm(256, _stride); + const uint32_t mod = uint32_mod(_offset, align); + const uint32_t mask = uint32_cmpeq(mod, 0); + const uint32_t tmp0 = uint32_selb(mask, 0, align); + const uint32_t tmp1 = uint32_add(_offset, tmp0); + const uint32_t result = uint32_sub(tmp1, mod); + + return result; + } + } // namespace bx #endif // BX_UINT32_T_H_HEADER_GUARD diff --git a/3rdparty/bx/tests/uint32_t.cpp b/3rdparty/bx/tests/uint32_t.cpp new file mode 100644 index 00000000000..b232ff63ac1 --- /dev/null +++ b/3rdparty/bx/tests/uint32_t.cpp @@ -0,0 +1,22 @@ +/* + * Copyright 2010-2015 Branimir Karadzic. All rights reserved. + * License: http://www.opensource.org/licenses/BSD-2-Clause + */ + +#include "test.h" +#include <bx/uint32_t.h> + +TEST(StrideAlign) +{ + CHECK(0 == bx::strideAlign(0, 12) ); + for (uint32_t ii = 0; ii < 12; ++ii) + { + CHECK(12 == bx::strideAlign(ii+1, 12) ); + } + + CHECK(0 == bx::strideAlign16(0, 12) ); + for (uint32_t ii = 0; ii < 12; ++ii) + { + CHECK(48 == bx::strideAlign16(ii+1, 12) ); + } +} diff --git a/3rdparty/bx/tools/bin/darwin/genie b/3rdparty/bx/tools/bin/darwin/genie Binary files differindex 93e518e687c..2d6bd49e5b0 100644 --- a/3rdparty/bx/tools/bin/darwin/genie +++ b/3rdparty/bx/tools/bin/darwin/genie diff --git a/3rdparty/bx/tools/bin/linux/genie b/3rdparty/bx/tools/bin/linux/genie Binary files differindex 59318fd4cb5..9e1c5a8ebb0 100644 --- a/3rdparty/bx/tools/bin/linux/genie +++ b/3rdparty/bx/tools/bin/linux/genie diff --git a/3rdparty/bx/tools/bin/windows/genie.exe b/3rdparty/bx/tools/bin/windows/genie.exe Binary files differindex e3d94152944..8b788066d1c 100644 --- a/3rdparty/bx/tools/bin/windows/genie.exe +++ b/3rdparty/bx/tools/bin/windows/genie.exe |