Updated meshoptimizer.
This commit is contained in:
parent
09ac630f0a
commit
ddfae2f915
4
3rdparty/meshoptimizer/src/meshoptimizer.h
vendored
4
3rdparty/meshoptimizer/src/meshoptimizer.h
vendored
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* meshoptimizer - version 0.18
|
* meshoptimizer - version 0.19
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016-2023, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
* Copyright (C) 2016-2023, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||||
* Report bugs and download new versions at https://github.com/zeux/meshoptimizer
|
* Report bugs and download new versions at https://github.com/zeux/meshoptimizer
|
||||||
@ -12,7 +12,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
/* Version macro; major * 1000 + minor * 10 + patch */
|
/* Version macro; major * 1000 + minor * 10 + patch */
|
||||||
#define MESHOPTIMIZER_VERSION 180 /* 0.18 */
|
#define MESHOPTIMIZER_VERSION 190 /* 0.19 */
|
||||||
|
|
||||||
/* If no API is defined, assume default */
|
/* If no API is defined, assume default */
|
||||||
#ifndef MESHOPTIMIZER_API
|
#ifndef MESHOPTIMIZER_API
|
||||||
|
31
3rdparty/meshoptimizer/src/vertexcodec.cpp
vendored
31
3rdparty/meshoptimizer/src/vertexcodec.cpp
vendored
@ -44,6 +44,10 @@
|
|||||||
// When targeting Wasm SIMD we can't use runtime cpuid checks so we unconditionally enable SIMD
|
// When targeting Wasm SIMD we can't use runtime cpuid checks so we unconditionally enable SIMD
|
||||||
#if defined(__wasm_simd128__)
|
#if defined(__wasm_simd128__)
|
||||||
#define SIMD_WASM
|
#define SIMD_WASM
|
||||||
|
// Prevent compiling other variant when wasm simd compilation is active
|
||||||
|
#undef SIMD_NEON
|
||||||
|
#undef SIMD_SSE
|
||||||
|
#undef SIMD_AVX
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SIMD_TARGET
|
#ifndef SIMD_TARGET
|
||||||
@ -83,19 +87,17 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SIMD_WASM
|
#ifdef SIMD_WASM
|
||||||
#undef __DEPRECATED
|
|
||||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
#include <wasm_simd128.h>
|
#include <wasm_simd128.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SIMD_WASM
|
#ifdef SIMD_WASM
|
||||||
#define wasmx_splat_v32x4(v, i) wasm_v32x4_shuffle(v, v, i, i, i, i)
|
#define wasmx_splat_v32x4(v, i) wasm_i32x4_shuffle(v, v, i, i, i, i)
|
||||||
#define wasmx_unpacklo_v8x16(a, b) wasm_v8x16_shuffle(a, b, 0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23)
|
#define wasmx_unpacklo_v8x16(a, b) wasm_i8x16_shuffle(a, b, 0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23)
|
||||||
#define wasmx_unpackhi_v8x16(a, b) wasm_v8x16_shuffle(a, b, 8, 24, 9, 25, 10, 26, 11, 27, 12, 28, 13, 29, 14, 30, 15, 31)
|
#define wasmx_unpackhi_v8x16(a, b) wasm_i8x16_shuffle(a, b, 8, 24, 9, 25, 10, 26, 11, 27, 12, 28, 13, 29, 14, 30, 15, 31)
|
||||||
#define wasmx_unpacklo_v16x8(a, b) wasm_v16x8_shuffle(a, b, 0, 8, 1, 9, 2, 10, 3, 11)
|
#define wasmx_unpacklo_v16x8(a, b) wasm_i16x8_shuffle(a, b, 0, 8, 1, 9, 2, 10, 3, 11)
|
||||||
#define wasmx_unpackhi_v16x8(a, b) wasm_v16x8_shuffle(a, b, 4, 12, 5, 13, 6, 14, 7, 15)
|
#define wasmx_unpackhi_v16x8(a, b) wasm_i16x8_shuffle(a, b, 4, 12, 5, 13, 6, 14, 7, 15)
|
||||||
#define wasmx_unpacklo_v64x2(a, b) wasm_v64x2_shuffle(a, b, 0, 2)
|
#define wasmx_unpacklo_v64x2(a, b) wasm_i64x2_shuffle(a, b, 0, 2)
|
||||||
#define wasmx_unpackhi_v64x2(a, b) wasm_v64x2_shuffle(a, b, 1, 3)
|
#define wasmx_unpackhi_v64x2(a, b) wasm_i64x2_shuffle(a, b, 1, 3)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace meshopt
|
namespace meshopt
|
||||||
@ -294,7 +296,7 @@ static unsigned char* encodeVertexBlock(unsigned char* data, unsigned char* data
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SIMD_FALLBACK) || (!defined(SIMD_SSE) && !defined(SIMD_NEON) && !defined(SIMD_AVX))
|
#if defined(SIMD_FALLBACK) || (!defined(SIMD_SSE) && !defined(SIMD_NEON) && !defined(SIMD_AVX) && !defined(SIMD_WASM))
|
||||||
static const unsigned char* decodeBytesGroup(const unsigned char* data, unsigned char* buffer, int bitslog2)
|
static const unsigned char* decodeBytesGroup(const unsigned char* data, unsigned char* buffer, int bitslog2)
|
||||||
{
|
{
|
||||||
#define READ() byte = *data++
|
#define READ() byte = *data++
|
||||||
@ -757,7 +759,7 @@ static v128_t decodeShuffleMask(unsigned char mask0, unsigned char mask1)
|
|||||||
v128_t sm1 = wasm_v128_load(&kDecodeBytesGroupShuffle[mask1]);
|
v128_t sm1 = wasm_v128_load(&kDecodeBytesGroupShuffle[mask1]);
|
||||||
|
|
||||||
v128_t sm1off = wasm_v128_load(&kDecodeBytesGroupCount[mask0]);
|
v128_t sm1off = wasm_v128_load(&kDecodeBytesGroupCount[mask0]);
|
||||||
sm1off = wasm_v8x16_shuffle(sm1off, sm1off, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
sm1off = wasm_i8x16_shuffle(sm1off, sm1off, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||||
|
|
||||||
v128_t sm1r = wasm_i8x16_add(sm1, sm1off);
|
v128_t sm1r = wasm_i8x16_add(sm1, sm1off);
|
||||||
|
|
||||||
@ -777,9 +779,6 @@ static void wasmMoveMask(v128_t mask, unsigned char& mask0, unsigned char& mask1
|
|||||||
SIMD_TARGET
|
SIMD_TARGET
|
||||||
static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsigned char* buffer, int bitslog2)
|
static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsigned char* buffer, int bitslog2)
|
||||||
{
|
{
|
||||||
unsigned char byte, enc, encv;
|
|
||||||
const unsigned char* data_var;
|
|
||||||
|
|
||||||
switch (bitslog2)
|
switch (bitslog2)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@ -807,7 +806,7 @@ static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsi
|
|||||||
|
|
||||||
v128_t shuf = decodeShuffleMask(mask0, mask1);
|
v128_t shuf = decodeShuffleMask(mask0, mask1);
|
||||||
|
|
||||||
v128_t result = wasm_v128_bitselect(wasm_v8x16_swizzle(rest, shuf), sel, mask);
|
v128_t result = wasm_v128_bitselect(wasm_i8x16_swizzle(rest, shuf), sel, mask);
|
||||||
|
|
||||||
wasm_v128_store(buffer, result);
|
wasm_v128_store(buffer, result);
|
||||||
|
|
||||||
@ -829,7 +828,7 @@ static const unsigned char* decodeBytesGroupSimd(const unsigned char* data, unsi
|
|||||||
|
|
||||||
v128_t shuf = decodeShuffleMask(mask0, mask1);
|
v128_t shuf = decodeShuffleMask(mask0, mask1);
|
||||||
|
|
||||||
v128_t result = wasm_v128_bitselect(wasm_v8x16_swizzle(rest, shuf), sel, mask);
|
v128_t result = wasm_v128_bitselect(wasm_i8x16_swizzle(rest, shuf), sel, mask);
|
||||||
|
|
||||||
wasm_v128_store(buffer, result);
|
wasm_v128_store(buffer, result);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user