diff options
| author | Hendrik Brucker <hendrik.brucker@mail.de> | 2021-04-18 16:15:43 +0200 |
|---|---|---|
| committer | Hendrik Brucker <hendrik.brucker@mail.de> | 2021-04-18 18:00:15 +0200 |
| commit | 9d186101908fcd3c342e4ca5764929da113bf0ca (patch) | |
| tree | 0661a1427579ea67683144e068b9e04f03453832 /thirdparty/meshoptimizer/vertexcodec.cpp | |
| parent | c05245f539326cfafeaed7334b09e29db2376dd9 (diff) | |
| download | redot-engine-9d186101908fcd3c342e4ca5764929da113bf0ca.tar.gz | |
update meshoptimizer to 0.16
Diffstat (limited to 'thirdparty/meshoptimizer/vertexcodec.cpp')
| -rw-r--r-- | thirdparty/meshoptimizer/vertexcodec.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/thirdparty/meshoptimizer/vertexcodec.cpp b/thirdparty/meshoptimizer/vertexcodec.cpp index 2cbfaac367..5f3ec204ab 100644 --- a/thirdparty/meshoptimizer/vertexcodec.cpp +++ b/thirdparty/meshoptimizer/vertexcodec.cpp @@ -710,18 +710,12 @@ static v128_t decodeShuffleMask(unsigned char mask0, unsigned char mask1) SIMD_TARGET static void wasmMoveMask(v128_t mask, unsigned char& mask0, unsigned char& mask1) { - v128_t mask_0 = wasm_v32x4_shuffle(mask, mask, 0, 2, 1, 3); - - uint64_t mask_1a = wasm_i64x2_extract_lane(mask_0, 0) & 0x0804020108040201ull; - uint64_t mask_1b = wasm_i64x2_extract_lane(mask_0, 1) & 0x8040201080402010ull; + // magic constant found using z3 SMT assuming mask has 8 groups of 0xff or 0x00 + const uint64_t magic = 0x000103070f1f3f80ull; // TODO: This can use v8x16_bitmask in the future - uint64_t mask_2 = mask_1a | mask_1b; - uint64_t mask_4 = mask_2 | (mask_2 >> 16); - uint64_t mask_8 = mask_4 | (mask_4 >> 8); - - mask0 = uint8_t(mask_8); - mask1 = uint8_t(mask_8 >> 32); + mask0 = uint8_t((wasm_i64x2_extract_lane(mask, 0) * magic) >> 56); + mask1 = uint8_t((wasm_i64x2_extract_lane(mask, 1) * magic) >> 56); } SIMD_TARGET |
