web: rename WEBGL to WASM for cmake (#9941)

This is a more accurate name because it specifies the platform and
not the graphics API.
This commit is contained in:
Powei Feng
2026-04-29 15:21:25 -07:00
committed by GitHub
parent 9c27bfa3e1
commit 96b8015fb4
31 changed files with 95 additions and 93 deletions

View File

@@ -26,7 +26,7 @@ jobs:
cd build/web && printf "y" | ./build.sh release
- name: Deploy to npm
run: |
cd out/cmake-webgl-release/web/filament-js
cd out/cmake-wasm-release/web/filament-js
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@@ -177,7 +177,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# ==================================================================================================
# OS specific
# ==================================================================================================
if (UNIX AND NOT APPLE AND NOT ANDROID AND NOT WEBGL)
if (UNIX AND NOT APPLE AND NOT ANDROID AND NOT WASM)
set(LINUX TRUE)
else()
# since cmake 3.25 LINUX is automatically set based on CMAKE_SYSTEM_NAME, which the android
@@ -218,7 +218,7 @@ if (LINUX)
endif()
endif()
if (ANDROID OR WEBGL OR IOS OR FILAMENT_LINUX_IS_MOBILE)
if (ANDROID OR WASM OR IOS OR FILAMENT_LINUX_IS_MOBILE)
set(IS_MOBILE_TARGET TRUE)
endif()
@@ -226,7 +226,7 @@ if (ANDROID)
add_definitions(-D__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__)
endif()
if (NOT ANDROID AND NOT WEBGL AND NOT IOS AND NOT FILAMENT_LINUX_IS_MOBILE)
if (NOT ANDROID AND NOT WASM AND NOT IOS AND NOT FILAMENT_LINUX_IS_MOBILE)
set(IS_HOST_PLATFORM TRUE)
endif()
@@ -473,7 +473,7 @@ if (NOT MSVC)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffunction-sections -fdata-sections")
endif()
if (ANDROID OR WEBGL)
if (ANDROID OR WASM)
# On Android and WebGL RELEASE builds, we omit unwind info to save space.
# (We keep unwind info on iOS to allow readable stack traces in crash reports.)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-unwind-tables -fno-asynchronous-unwind-tables")
@@ -482,11 +482,11 @@ endif()
# With WebGL, we disable RTTI because we pass emscripten::val back and forth
# between C++ and JavaScript in order to efficiently access typed arrays, which are unbound.
# NOTE: This is not documented in emscripten so we should consider a different approach.
if (WEBGL)
if (WASM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
endif()
if (WEBGL_PTHREADS)
if (WASM_PTHREADS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
endif()
@@ -503,7 +503,7 @@ if (ANDROID)
# keep STL debug infos (mimics what the NDK does)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-limit-debug-info")
endif()
if (NOT MSVC AND NOT WEBGL)
if (NOT MSVC AND NOT WASM)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fstack-protector")
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${EXTRA_SANITIZE_OPTIONS}")
@@ -522,7 +522,7 @@ endif()
# Linker flags
# ==================================================================================================
# Strip unused sections
if (NOT WEBGL)
if (NOT WASM)
set(GC_SECTIONS "-Wl,--gc-sections")
endif()
@@ -556,7 +556,7 @@ endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GC_SECTIONS} ${NO_EXEC_STACK}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${GC_SECTIONS} ${B_SYMBOLIC_FUNCTIONS} ${BINARY_ALIGNMENT}")
if (WEBGL_PTHREADS)
if (WASM_PTHREADS)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pthread")
endif()
@@ -586,7 +586,7 @@ endif()
# By default, build with Vulkan support on desktop platforms, although clients must request to use
# it at run time.
if (WIN32 OR WEBGL OR IOS)
if (WIN32 OR WASM OR IOS)
option(FILAMENT_SUPPORTS_VULKAN "Include the Vulkan backend" OFF)
else()
option(FILAMENT_SUPPORTS_VULKAN "Include the Vulkan backend" ON)
@@ -604,7 +604,7 @@ if (FILAMENT_SUPPORTS_WEBP_TEXTURES)
endif()
# Build with Metal support on non-WebGL Apple platforms.
if (APPLE AND NOT WEBGL)
if (APPLE AND NOT WASM)
option(FILAMENT_SUPPORTS_METAL "Include the Metal backend" ON)
else()
option(FILAMENT_SUPPORTS_METAL "Include the Metal backend" OFF)
@@ -614,7 +614,7 @@ if (FILAMENT_SUPPORTS_METAL)
endif()
# Building filamat increases build times and isn't required for web, so turn it off by default.
if (NOT WEBGL)
if (NOT WASM)
option(FILAMENT_BUILD_FILAMAT "Build filamat and JNI buildings" ON)
else()
option(FILAMENT_BUILD_FILAMAT "Build filamat and JNI buildings" OFF)
@@ -840,7 +840,7 @@ if (FILAMENT_IMPORT_PREBUILT_EXECUTABLES_DIR)
set(IMPORT_EXECUTABLES_DIR ${FILAMENT_IMPORT_PREBUILT_EXECUTABLES_DIR})
endif()
if (WEBGL)
if (WASM)
set(IMPORT_EXECUTABLES ${FILAMENT}/${IMPORT_EXECUTABLES_DIR}/ImportExecutables-Release.cmake)
else()
if (FILAMENT_EXPORT_PREBUILT_EXECUTABLES OR FILAMENT_IMPORT_PREBUILT_EXECUTABLES)
@@ -875,7 +875,7 @@ function(get_resgen_vars ARCHIVE_DIR ARCHIVE_NAME)
set(RESGEN_HEADER "${ARCHIVE_DIR}/${ARCHIVE_NAME}.h" PARENT_SCOPE)
# Visual Studio makes it difficult to use assembly without using MASM. MASM doesn't support
# the equivalent of .incbin, so on Windows we'll just tell resgen to output a C file.
if (WEBGL OR WIN32 OR ANDROID_ON_WINDOWS)
if (WASM OR WIN32 OR ANDROID_ON_WINDOWS)
set(RESGEN_OUTPUTS "${OUTPUTS};${ARCHIVE_DIR}/${ARCHIVE_NAME}.c" PARENT_SCOPE)
set(RESGEN_FLAGS -qcx ${ARCHIVE_DIR} -p ${ARCHIVE_NAME} PARENT_SCOPE)
set(RESGEN_SOURCE "${ARCHIVE_DIR}/${ARCHIVE_NAME}.c" PARENT_SCOPE)
@@ -980,7 +980,7 @@ add_subdirectory(${FILAMENT}/filament)
set(FILAMENT_SAMPLES_BINARY_DIR ${PROJECT_BINARY_DIR}/samples)
if (WEBGL)
if (WASM)
add_subdirectory(web/filament-js)
add_subdirectory(web/examples)
endif()

View File

@@ -6,3 +6,5 @@
appropriate header in [RELEASE_NOTES.md](./RELEASE_NOTES.md).
## Release notes for next branch cut
- WEBGL_PTHREADS renamed to WASM_PTHREADS in CMakeLists.txt

View File

@@ -8,7 +8,7 @@
[![Web Build Status](https://github.com/google/filament/actions/workflows/status-web.yml/badge.svg)](https://github.com/google/filament/actions/workflows/status-web.yml)
Filament is a real-time physically based rendering engine for Android, iOS, Linux, macOS, Windows,
and WebGL. It is designed to be as small as possible and as efficient as possible on Android.
and WASM. It is designed to be as small as possible and as efficient as possible on Android.
## Download

View File

@@ -1,7 +1,7 @@
#!/bin/bash
set -e
# Host tools required by Android, WebGL, and iOS builds
# Host tools required by Android, WASM, and iOS builds
MOBILE_HOST_TOOLS="matc resgen cmgen filamesh uberz"
WEB_HOST_TOOLS="${MOBILE_HOST_TOOLS} mipgen filamesh"
@@ -34,7 +34,7 @@ function print_help {
echo " -m"
echo " Compile with make instead of ninja."
echo " -p platform1,platform2,..."
echo " Where platformN is [desktop|android|ios|webgl|all]."
echo " Where platformN is [desktop|android|ios|wasm|all]."
echo " Platform(s) to build, defaults to desktop."
echo " Building for iOS will automatically perform a partial desktop build."
echo " -q abi1,abi2,..."
@@ -173,7 +173,7 @@ ISSUE_RELEASE_BUILD=false
ISSUE_ANDROID_BUILD=false
ISSUE_IOS_BUILD=false
ISSUE_DESKTOP_BUILD=true
ISSUE_WEBGL_BUILD=false
ISSUE_WASM_BUILD=false
# Default: all
ABI_ARMEABI_V7A=true
@@ -356,12 +356,12 @@ function build_desktop {
fi
}
function build_webgl_with_target {
function build_wasm_with_target {
local lc_target=$(echo "$1" | tr '[:upper:]' '[:lower:]')
echo "Building WebGL ${lc_target}..."
mkdir -p "out/cmake-webgl-${lc_target}"
pushd "out/cmake-webgl-${lc_target}" > /dev/null
echo "Building WASM ${lc_target}..."
mkdir -p "out/cmake-wasm-${lc_target}"
pushd "out/cmake-wasm-${lc_target}" > /dev/null
if [[ ! "${BUILD_TARGETS}" ]]; then
BUILD_TARGETS=${BUILD_CUSTOM_TARGETS}
@@ -378,13 +378,13 @@ function build_webgl_with_target {
${IMPORT_EXECUTABLES_DIR_OPTION} \
-DCMAKE_TOOLCHAIN_FILE="${EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" \
-DCMAKE_BUILD_TYPE="$1" \
-DCMAKE_INSTALL_PREFIX="../webgl-${lc_target}/filament" \
-DWEBGL=1 \
-DCMAKE_INSTALL_PREFIX="../wasm-${lc_target}/filament" \
-DWASM=1 \
${WEBGPU_OPTION} \
${BACKEND_DEBUG_FLAG_OPTION} \
${EXCEPTIONS_OPTION} \
../..
ln -sf "out/cmake-webgl-${lc_target}/compile_commands.json" \
ln -sf "out/cmake-wasm-${lc_target}/compile_commands.json" \
../../compile_commands.json
${BUILD_COMMAND} ${BUILD_TARGETS}
)
@@ -416,7 +416,7 @@ function build_webgl_with_target {
popd > /dev/null
}
function build_webgl {
function build_wasm {
# For the host tools, suppress install and always use Release.
local old_install_command=${INSTALL_COMMAND}; INSTALL_COMMAND=
local old_issue_debug_build=${ISSUE_DEBUG_BUILD}; ISSUE_DEBUG_BUILD=false
@@ -429,11 +429,11 @@ function build_webgl {
ISSUE_RELEASE_BUILD=${old_issue_release_build}
if [[ "${ISSUE_DEBUG_BUILD}" == "true" ]]; then
build_webgl_with_target "Debug"
build_wasm_with_target "Debug"
fi
if [[ "${ISSUE_RELEASE_BUILD}" == "true" ]]; then
build_webgl_with_target "Release"
build_wasm_with_target "Release"
fi
}
@@ -809,7 +809,7 @@ function validate_build_command {
fi
fi
# If building a WebAssembly module, ensure we know where Emscripten lives.
if [[ "${EMSDK}" == "" ]] && [[ "${ISSUE_WEBGL_BUILD}" == "true" ]]; then
if [[ "${EMSDK}" == "" ]] && [[ "${ISSUE_WASM_BUILD}" == "true" ]]; then
echo "Error: EMSDK is not set, exiting"
exit 1
fi
@@ -835,7 +835,7 @@ function run_test {
}
function run_tests {
if [[ "${ISSUE_WEBGL_BUILD}" == "true" ]]; then
if [[ "${ISSUE_WASM_BUILD}" == "true" ]]; then
if ! echo "TypeScript $(tsc --version)" ; then
tsc --noEmit \
third_party/gl-matrix/gl-matrix.d.ts \
@@ -920,18 +920,18 @@ while getopts ":hacCfgimp:q:uvWslwedtk:bVx:S:X:Py:E" opt; do
ios)
ISSUE_IOS_BUILD=true
;;
webgl)
ISSUE_WEBGL_BUILD=true
wasm)
ISSUE_WASM_BUILD=true
;;
all)
ISSUE_ANDROID_BUILD=true
ISSUE_IOS_BUILD=true
ISSUE_DESKTOP_BUILD=true
ISSUE_WEBGL_BUILD=false
ISSUE_WASM_BUILD=false
;;
*)
echo "Unknown platform ${platform}"
echo "Platform must be one of [desktop|android|ios|webgl|all]"
echo "Platform must be one of [desktop|android|ios|wasm|all]"
echo ""
exit 1
;;
@@ -1112,8 +1112,8 @@ if [[ "${ISSUE_IOS_BUILD}" == "true" ]]; then
check_debug_release_build build_ios
fi
if [[ "${ISSUE_WEBGL_BUILD}" == "true" ]]; then
check_debug_release_build build_webgl
if [[ "${ISSUE_WASM_BUILD}" == "true" ]]; then
check_debug_release_build build_wasm
fi
if [[ "${RUN_TESTS}" == "true" ]]; then

View File

@@ -8,4 +8,4 @@ set -x
source `dirname $0`/../common/build-common.sh
pushd `dirname $0`/../.. > /dev/null
./build.sh -p webgl -c $RUN_TESTS $GENERATE_ARCHIVES $BUILD_DEBUG $BUILD_RELEASE
./build.sh -p wasm -c $RUN_TESTS $GENERATE_ARCHIVES $BUILD_DEBUG $BUILD_RELEASE

View File

@@ -81,10 +81,10 @@ The process for copying and processing these READMEs is outlined in
[Introductory docs](#introductory-doc).
### Web Examples and Tutorials
Filament provides a number of WebGL tutorials and examples in the `web/` directory. These are
compiled during the WebGL CMake build and are integrated into the documentation via
Filament provides a number of web tutorials and examples in the `web/` directory. These are
compiled during the web CMake build and are integrated into the documentation via
`duplicates.json`. The process is entirely automated:
1. `run.py` maps the `.html` and `.md` WebGL outputs from the `out/cmake-webgl-release/...`
1. `run.py` maps the `.html` and `.md` web outputs from the `out/cmake-wasm-release/...`
directory into `docs_src/src_mdbook/src/samples/web/` using the instructions in `duplicates.json`.
2. While transferring `.html` to `.md`, `run.py` strips away the `<!DOCTYPE html>`, `<head>`, and
`<html>` tags. By retaining only the `<style>` and `<body>` elements, the HTML samples can be

View File

@@ -20,7 +20,7 @@ import glob
import re
CUR_DIR = os.path.dirname(os.path.abspath(__file__))
OUT_DIR = os.path.join(CUR_DIR, "../../out/cmake-webgl-release/web/examples/examples")
OUT_DIR = os.path.join(CUR_DIR, "../../out/cmake-wasm-release/web/examples/examples")
BOOK_DIR = os.path.join(CUR_DIR, "../src_mdbook/book")
def setup_dirs():

View File

@@ -106,43 +106,43 @@
"filament/backend/test/README.md": {
"dest": "dup/backend_test.md"
},
"out/cmake-webgl-release/web/examples/examples/triangle/triangle.md": {
"out/cmake-wasm-release/web/examples/examples/triangle/triangle.md": {
"dest": "samples/web/triangle.md"
},
"out/cmake-webgl-release/web/examples/examples/redball/redball.md": {
"out/cmake-wasm-release/web/examples/examples/redball/redball.md": {
"dest": "samples/web/redball.md"
},
"out/cmake-webgl-release/web/examples/examples/suzanne/suzanne.md": {
"out/cmake-wasm-release/web/examples/examples/suzanne/suzanne.md": {
"dest": "samples/web/suzanne.md"
},
"out/cmake-webgl-release/web/examples/examples/animation/animation.html": {
"out/cmake-wasm-release/web/examples/examples/animation/animation.html": {
"dest": "samples/web/animation.md"
},
"out/cmake-webgl-release/web/examples/examples/cube_fl0/cube_fl0.html": {
"out/cmake-wasm-release/web/examples/examples/cube_fl0/cube_fl0.html": {
"dest": "samples/web/cube_fl0.md"
},
"out/cmake-webgl-release/web/examples/examples/helmet/helmet.html": {
"out/cmake-wasm-release/web/examples/examples/helmet/helmet.html": {
"dest": "samples/web/helmet.md"
},
"out/cmake-webgl-release/web/examples/examples/morphing/morphing.html": {
"out/cmake-wasm-release/web/examples/examples/morphing/morphing.html": {
"dest": "samples/web/morphing.md"
},
"out/cmake-webgl-release/web/examples/examples/parquet/parquet.html": {
"out/cmake-wasm-release/web/examples/examples/parquet/parquet.html": {
"dest": "samples/web/parquet.md"
},
"out/cmake-webgl-release/web/examples/examples/skinning/skinning.html": {
"out/cmake-wasm-release/web/examples/examples/skinning/skinning.html": {
"dest": "samples/web/skinning.md"
},
"out/cmake-webgl-release/web/examples/examples/sky/sky.html": {
"out/cmake-wasm-release/web/examples/examples/sky/sky.html": {
"dest": "samples/web/sky.md",
"replacements": {
"<!-- mdbook: add fullscreen mode -->": "<a href=\"../../web/sky.html\">Full screen</a>"
}
},
"./out/cmake-webgl-release/web/examples/examples/sky/sky.html": {
"./out/cmake-wasm-release/web/examples/examples/sky/sky.html": {
"dest": "web/sky.html"
},
"out/cmake-webgl-release/web/examples/examples/remote/remote.html": {
"out/cmake-wasm-release/web/examples/examples/remote/remote.html": {
"dest": "remote/index.html"
}
}

View File

@@ -19,7 +19,7 @@ FILAMENT_BOT_TOKEN=$2
set -ex
function update_to_main() {
./build.sh -p webgl release
./build.sh -p wasm release
python3 docs_src/build/run.py
mkdir -p tmp
pushd .

View File

@@ -744,10 +744,10 @@ if (MSVC)
set(OPTIMIZATION_FLAGS
/fp:fast
)
elseif(WEBGL)
elseif (WASM)
# Avoid strict-vtable-pointers here, it is broken in WebAssembly.
set(OPTIMIZATION_FLAGS -fvisibility-inlines-hidden)
elseif(FILAMENT_USING_GCC)
elseif (FILAMENT_USING_GCC)
set(OPTIMIZATION_FLAGS
-ffast-math
-fno-finite-math-only

View File

@@ -124,7 +124,7 @@ if (FILAMENT_SUPPORTS_OPENGL AND NOT FILAMENT_USE_EXTERNAL_GLES3)
list(APPEND SRCS src/opengl/platforms/PlatformCocoaGL.mm)
list(APPEND SRCS src/opengl/platforms/CocoaExternalImage.mm)
endif()
elseif (WEBGL)
elseif (WASM)
list(APPEND SRCS src/opengl/platforms/PlatformWebGL.cpp)
elseif (LINUX)
if (FILAMENT_SUPPORTS_X11)
@@ -432,7 +432,7 @@ if (FILAMENT_USE_ABSEIL_LOGGING)
endif()
# Android, iOS, and WebGL do not use bluegl.
if(FILAMENT_SUPPORTS_OPENGL AND NOT IOS AND NOT ANDROID AND NOT WEBGL)
if(FILAMENT_SUPPORTS_OPENGL AND NOT IOS AND NOT ANDROID AND NOT WASM)
target_link_libraries(${TARGET} PRIVATE bluegl)
endif()
@@ -463,7 +463,7 @@ if (MSVC)
set(OPTIMIZATION_FLAGS
/fp:fast
)
elseif(WEBGL)
elseif(WASM)
# Avoid strict-vtable-pointers here, it is broken in WebAssembly.
set(OPTIMIZATION_FLAGS -fvisibility-inlines-hidden)
elseif(FILAMENT_USING_GCC)
@@ -699,7 +699,7 @@ if (FILAMENT_BUILD_TESTING)
# ==================================================================================================
# Compute tests
#
#if (NOT IOS AND NOT WEBGL)
#if (NOT IOS AND NOT WASM)
#
#add_executable(compute_test
# test/ComputeTest.cpp

View File

@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.19)
project(filament-tests)
if(IOS OR WEBGL)
if(IOS OR WASM)
return()
endif()

View File

@@ -50,7 +50,7 @@ install(DIRECTORY ${PUBLIC_HDR_DIR}/camutils DESTINATION include)
# ==================================================================================================
# Tests
# ==================================================================================================
if (FILAMENT_BUILD_TESTING AND NOT ANDROID AND NOT WEBGL AND NOT IOS)
if (FILAMENT_BUILD_TESTING AND NOT ANDROID AND NOT WASM AND NOT IOS)
add_executable(test_${TARGET} tests/test_camutils.cpp)
target_link_libraries(test_${TARGET} PRIVATE camutils gtest)
set_target_properties(test_${TARGET} PROPERTIES FOLDER Tests)

View File

@@ -37,7 +37,7 @@ install(FILES ${DIST_HDRS} DESTINATION include/${TARGET})
# ==================================================================================================
# Tests
# ==================================================================================================
if (FILAMENT_BUILD_TESTING AND NOT IOS AND NOT WEBGL AND NOT ANDROID)
if (FILAMENT_BUILD_TESTING AND NOT IOS AND NOT WASM AND NOT ANDROID)
add_executable(test_${TARGET} tests/test_filamesh.cpp )
target_link_libraries(test_${TARGET} PRIVATE filameshio gtest)
set_target_properties(test_${TARGET} PROPERTIES FOLDER Tests)

View File

@@ -46,7 +46,7 @@ if (MSVC)
set(OPTIMIZATION_FLAGS
/fp:fast
)
elseif(WEBGL)
elseif (WASM)
# Avoid strict-vtable-pointers here, it is broken in WebAssembly.
set(OPTIMIZATION_FLAGS -fvisibility-inlines-hidden)
else()

View File

@@ -73,7 +73,7 @@ install(FILES "${GEOMETRY_COMBINED_OUTPUT}" DESTINATION lib/${DIST_DIR} RENAME $
# ==================================================================================================
# Tests
# ==================================================================================================
if (FILAMENT_BUILD_TESTING AND NOT ANDROID AND NOT WEBGL AND NOT IOS)
if (FILAMENT_BUILD_TESTING AND NOT ANDROID AND NOT WASM AND NOT IOS)
set(TARGET test_transcoder)
add_executable(${TARGET} tests/test_transcoder.cpp)
target_link_libraries(${TARGET} PRIVATE geometry gtest)

View File

@@ -198,13 +198,13 @@ set_target_properties(gltfio_core PROPERTIES FOLDER Libs)
target_compile_definitions(gltfio_core PUBLIC -DGLTFIO_DRACO_SUPPORTED=1)
target_link_libraries(gltfio_core PUBLIC dracodec meshoptimizer ${WEBP_DECODER_LIB_TARGET})
if (WEBGL_PTHREADS)
if (WASM_PTHREADS)
target_compile_definitions(gltfio_core PUBLIC -DFILAMENT_WASM_THREADS)
endif()
target_compile_options(gltfio_core PRIVATE ${FILAMENT_WARNINGS})
if (NOT WEBGL AND NOT ANDROID AND NOT IOS)
if (NOT WASM AND NOT ANDROID AND NOT IOS)
# ==================================================================================================
# Link the core library with additional dependencies to create the "full" library
@@ -246,7 +246,7 @@ if (FILAMENT_BUILD_TESTING)
# The following tests rely on private APIs that are stripped
# away in Release builds
if (TNT_DEV AND NOT WEBGL AND NOT ANDROID AND NOT IOS)
if (TNT_DEV AND NOT WASM AND NOT ANDROID AND NOT IOS)
set(TEST_TARGET test_gltfio)
add_executable(${TEST_TARGET} test/gltfio_test.cpp)

View File

@@ -99,7 +99,7 @@ if (MSVC)
set(OPTIMIZATION_FLAGS
/fp:fast
)
elseif(WEBGL)
elseif (WASM)
# Avoid strict-vtable-pointers here, it is broken in WebAssembly.
set(OPTIMIZATION_FLAGS -fvisibility-inlines-hidden)
else()

View File

@@ -53,7 +53,7 @@ install(DIRECTORY ${PUBLIC_HDR_DIR}/image DESTINATION include)
# ==================================================================================================
# Tests
# ==================================================================================================
if (FILAMENT_BUILD_TESTING AND NOT ANDROID AND NOT WEBGL AND NOT IOS AND NOT FILAMENT_SKIP_SDL2)
if (FILAMENT_BUILD_TESTING AND NOT ANDROID AND NOT WASM AND NOT IOS AND NOT FILAMENT_SKIP_SDL2)
add_executable(test_${TARGET} tests/test_image.cpp)
target_link_libraries(test_${TARGET} PRIVATE imageio gtest)
set_target_properties(test_${TARGET} PROPERTIES FOLDER Tests)

View File

@@ -17,7 +17,7 @@ target_link_libraries(imagediff PRIVATE
)
if (NOT ANDROID AND NOT WEBGL AND NOT IOS)
if (NOT ANDROID AND NOT WASM AND NOT IOS)
add_executable(test_imagediff tests/test_ImageDiff.cpp)
target_link_libraries(test_imagediff PRIVATE imagediff gtest image utils)
endif()

View File

@@ -45,7 +45,7 @@ install(DIRECTORY ${PUBLIC_HDR_DIR}/imageio-lite DESTINATION include)
# ==================================================================================================
# Tests
# ==================================================================================================
if (NOT ANDROID AND NOT WEBGL AND NOT IOS)
if (NOT ANDROID AND NOT WASM AND NOT IOS)
add_executable(test_${TARGET} tests/test_imageio-lite.cpp)
target_link_libraries(test_${TARGET} PRIVATE ${TARGET} image gtest)
set_target_properties(test_${TARGET} PROPERTIES FOLDER Tests)

View File

@@ -60,7 +60,7 @@ endfunction()
add_testfile(color_grid_uastc_zstd.ktx2)
add_testfile(lightroom_ibl.ktx)
if (FILAMENT_BUILD_TESTING AND NOT ANDROID AND NOT WEBGL AND NOT IOS)
if (FILAMENT_BUILD_TESTING AND NOT ANDROID AND NOT WASM AND NOT IOS)
add_executable(test_ktxreader tests/test_ktxreader.cpp ${TESTFILES})
target_link_libraries(test_ktxreader PRIVATE ${TARGET} gtest)
set_target_properties(test_ktxreader PROPERTIES FOLDER Tests)

View File

@@ -115,7 +115,7 @@ if (APPLE)
list(APPEND SRCS src/darwin/Systrace.cpp)
list(APPEND SRCS src/darwin/Tracing.cpp)
endif()
if (WEBGL)
if (WASM)
list(APPEND SRCS src/web/Path.cpp)
endif()
@@ -208,12 +208,12 @@ if (FILAMENT_BUILD_TESTING)
test/test_Status.cpp
)
if (WEBGL_PTHREADS)
if (WASM_PTHREADS)
target_compile_definitions(${TARGET} PUBLIC -DFILAMENT_WASM_THREADS)
endif()
# The Path tests are platform-specific
if (NOT WEBGL)
if (NOT WASM)
if (WIN32)
list(APPEND TEST_SRCS test/test_WinPath.cpp)
else()
@@ -231,7 +231,7 @@ endif()
# Benchmarks
# ==================================================================================================
if (FILAMENT_BUILD_TESTING AND NOT WEBGL)
if (FILAMENT_BUILD_TESTING AND NOT WASM)
add_library(benchmark_${TARGET}_callee SHARED benchmark/benchmark_callee.cpp)
set_target_properties(benchmark_${TARGET}_callee PROPERTIES FOLDER Benchmarks)

View File

@@ -57,7 +57,7 @@ install(DIRECTORY ${PUBLIC_HDR_DIR}/viewer DESTINATION include)
# ==================================================================================================
# Tests
# ==================================================================================================
if (FILAMENT_BUILD_TESTING AND NOT ANDROID AND NOT WEBGL AND NOT IOS)
if (FILAMENT_BUILD_TESTING AND NOT ANDROID AND NOT WASM AND NOT IOS)
add_executable(test_settings tests/test_settings.cpp)
target_link_libraries(test_settings PRIVATE ${TARGET} gtest)
set_target_properties(test_settings PROPERTIES FOLDER Tests)

View File

@@ -15,11 +15,11 @@ set(WEBP_BUILD_WEBPMUX OFF)
set(WEBP_BUILD_EXTRAS OFF)
set(WEBP_BUILD_FUZZTEST OFF)
if (WEBGL)
if (WASM)
set(WEBP_BUILD_WEBP_JS ON)
set(WEBP_ENABLE_SIMD OFF)
# ensure non-empty config var value
if (WEBGL_PTHREADS)
if (WASM_PTHREADS)
set(WEBP_USE_THREAD ON)
else()
set(WEBP_USE_THREAD OFF)

View File

@@ -5,7 +5,7 @@ This directory contains the web-based samples, tutorials, and the JavaScript wra
## Structure
- `examples/`
Contains the source for the WebGL tutorials, HTML samples, materials, and assets.
Contains the source for the Web tutorials, HTML samples, materials, and assets.
These examples use `filament.js` and `filament.wasm` to demonstrate various features of the engine.
- `filament-js/`
@@ -13,7 +13,7 @@ This directory contains the web-based samples, tutorials, and the JavaScript wra
## Building the Web Examples
To build the WebGL targets and compile all required materials and assets, you will need the Emscripten SDK installed and activated.
To build the Web targets and compile all required materials and assets, you will need the Emscripten SDK installed and activated.
1. **Activate Emscripten SDK:**
Make sure you have `EMSDK` in your environment.
@@ -24,15 +24,15 @@ To build the WebGL targets and compile all required materials and assets, you wi
```
2. **Run the Build Script:**
From the root directory of the repository, execute the build script targeting WebGL:
From the root directory of the repository, execute the build script targeting Web:
```bash
./build.sh -p webgl release
./build.sh -p wasm release
```
This will:
- Compile the C++ engine to `filament.wasm` and `filament.js`.
- Build all materials (`.mat` to `.filamat`) and process textures required by the examples.
- Output everything into `out/cmake-webgl-release/examples/`.
- Output everything into `out/cmake-wasm-release/examples/`.
## Running the Examples
@@ -71,7 +71,7 @@ If you want your web sample or tutorial to appear on the official Filament docum
Add your generated `.html` or `.md` file to the mapping in `docs_src/build/duplicates.json`. This
tells the documentation build script to copy your sample into the `mdbook` structure.
```json
"out/cmake-webgl-release/web/examples/examples/your_sample/your_sample.html": {
"out/cmake-wasm-release/web/examples/examples/your_sample/your_sample.html": {
"dest": "samples/web/your_sample.md"
}
```

View File

@@ -42,7 +42,7 @@ def find_examples_dir():
examples_dir = find_examples_dir()
if not examples_dir:
print("Could not find the built examples directory in out/. Please build the webgl target first.", file=sys.stderr)
print("Could not find the built examples directory in out/. Please build the wasm target first.", file=sys.stderr)
# fallback to web/examples for testing, though it won't have the built assets
examples_dir = str(SCRIPT_DIR)

View File

@@ -17,7 +17,7 @@ set(CPP_SRC
# The emcc options are not documented well, the best place to find them is the source:
# https://github.com/kripken/emscripten/blob/main/src/settings.js
if (WEBGL_PTHREADS)
if (WASM_PTHREADS)
set(COPTS "${COPTS} -pthread")
set(LOPTS "${LOPTS} -pthread")
endif()

View File

@@ -22,7 +22,7 @@ To publish a new package to npm, do the following.
3. Edit the version number in `package.json`. You cannot publish the same version more than once.
4. From the root folder in your Filament repo, do:
```
./build.sh -ap webgl release
./build.sh -ap wasm release
./build.sh -ap all release
```
5. Make a commit and a tag whose label is the 3-tiered version number prefixed with a `v`:
@@ -36,7 +36,7 @@ git commit && git tag -a v{XX}.{YY}.{ZZ}
:---: | :---
```
cd out/cmake-webgl-release/web/filament-js
cd out/cmake-wasm-release/web/filament-js
npm publish --dry-run
```
8. If the output of the dry run looks okay to you (double check the version number!), then finally

View File

@@ -16,7 +16,7 @@
/*
* This file exists only to test the buildability of our TypeScript annotations, To run the test,
* invoke Filament's easy build script with "./build.sh -up webgl release", or do:
* invoke Filament's easy build script with "./build.sh -up wasm release", or do:
*
* npx tsc --noEmit \
* ../../third_party/gl-matrix/gl-matrix.d.ts \