mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-12 22:14:29 +02:00
Couple of fixes to allow SIMD on Emscripten
- Add `-msimd128` to flags to actually enable WebAssembly SIMD when performing SIMD detection. It's currently required in addition to `-msse*` / `-mfpu=neon` flags which only perform translation of corresponding intrinsics to Wasm SIMD ones. See a discussion at emscripten-core/emscripten#12714 for automating this and making easier in the future. - Remove compilation branch that prevented definitions of `WEBP_USE_SSE` and `WEBP_USE_NEON` on Emscripten even when SIMD support was detected at compile-time. - Add an implementation of `VP8GetCPUInfo` for Emscripten which uses static `WEBP_USE_*` flags to determine if a corresponding SIMD instruction is supported. This is because Wasm doesn't have proper feature detection (yet) and requires making separate build for SIMD version anyway. Change-Id: I77592081b91fd0e4cbc9242f5600ce905184f506
This commit is contained in:
committed by
Pascal Massimino
parent
17fd4ba820
commit
52273943c6
@ -3,7 +3,13 @@ cmake_minimum_required(VERSION 3.5)
|
||||
project(WebP C)
|
||||
|
||||
# Options for coder / decoder executables.
|
||||
option(WEBP_ENABLE_SIMD "Enable any SIMD optimization." ON)
|
||||
if(NOT EMSCRIPTEN)
|
||||
# Disable SIMD on Emscripten by default, as it's a new unstable Wasm feature.
|
||||
# Users can still explicitly opt-in to make a SIMD-enabled build.
|
||||
set(WEBP_ENABLE_SIMD_DEFAULT ON)
|
||||
endif()
|
||||
option(WEBP_ENABLE_SIMD "Enable any SIMD optimization."
|
||||
${WEBP_ENABLE_SIMD_DEFAULT})
|
||||
option(WEBP_BUILD_ANIM_UTILS "Build animation utilities." ON)
|
||||
option(WEBP_BUILD_CWEBP "Build the cwebp command line tool." ON)
|
||||
option(WEBP_BUILD_DWEBP "Build the dwebp command line tool." ON)
|
||||
@ -26,7 +32,6 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
if(WEBP_BUILD_WEBP_JS)
|
||||
set(WEBP_ENABLE_SIMD OFF)
|
||||
set(WEBP_BUILD_ANIM_UTILS OFF)
|
||||
set(WEBP_BUILD_CWEBP OFF)
|
||||
set(WEBP_BUILD_DWEBP OFF)
|
||||
|
Reference in New Issue
Block a user