Skip to content

Update bgfx.cmake to latest and drop the local SSE4.2 workaround - #1804

Closed
SergioRZMasson wants to merge 1 commit into
masterfrom
sergio/update-bgfx-cmake-sse-minspec
Closed

SergioRZMasson wants to merge 1 commit into
masterfrom
sergio/update-bgfx-cmake-sse-minspec

Conversation

@SergioRZMasson

Copy link
Copy Markdown
Contributor

Bumps bgfx.cmake from 6c55158 to
5c98749,
which brings in:

Why

bx/include/bx/simd_t.h uses SSE4.1 intrinsics (_mm_round_ps, _mm_blendv_ps) whenever
BX_CPU_X86 && __SSE2__, so every x86 target needs the SSE4.2 minspec that bx's own
scripts/toolchain.lua sets. Two configurations were missing it:

  • the x86_64 slice of Apple universal builds — CMAKE_SYSTEM_PROCESSOR names only one
    slice, so ios-cmake's SIMULATOR64COMBINED (which reports aarch64 while also building
    an x86_64 slice) compiled that slice without the flag;
  • 32-bit x86 — the Android NDK sets CMAKE_SYSTEM_PROCESSOR to i686 for the x86 ABI,
    which the old x86_64-only guard did not match.

Both failed with:

simd128_sse.inl:296:10: error: '__builtin_ia32_roundps' needs target feature sse4.1
simd128_sse.inl:769:10: error: always_inline function '_mm_blendv_ps' requires target
                               feature 'sse4.1', but would be inlined into function
                               'simd128_selb' that is compiled without support for 'sse4.1'

Removed workaround

Dependencies/CMakeLists.txt carried a local -msse4.2 workaround. The minspec is now
applied PUBLIC on the bx target, and bgfx / bimg / bimg_decode / bimg_encode all
link bx PUBLIC, so it is redundant.

It was also narrower than the problem it was working around — NOT APPLE AND NOT ANDROID
plus an x86_64-only processor match meant it never covered the Apple universal or
Android x86 cases that were actually failing.

Verification

Reproduced and validated on a mirror of the NuGet packager pipeline (iOS
SIMULATOR64COMBINED / Debug, Xcode 26.0.1, macos-latest):

before the bgfx.cmake fix after
needs target feature sse4.1 errors 2 0
result FAILED at bimg → image.o (x86_64 slice) BUILD SUCCEEDED
static libs linked / files installed 12 / — 70 / 66

The bgfx.cmake change itself was verified across 25 platform configurations (macOS/iOS/watchOS
single and universal slices, Android x86/x86_64/armeabi-v7a/arm64-v8a, Linux
x86_64/i686/aarch64, MSVC x64/ARM64/Win32, clang-cl, Emscripten) — see
BabylonJS/bgfx.cmake#135 for the full table.

Bumps bgfx.cmake from 6c55158 to 5c98749, which brings in:

  * BabylonJS/bgfx.cmake#135 - bx's SSE4.2 minspec is now applied to every x86
    target instead of only x86_64, and Apple universal builds scope it per slice
    with -Xarch_.
  * BabylonJS/bgfx.cmake#136 - bgfx and bimg submodule updates.

bx/include/bx/simd_t.h uses SSE4.1 intrinsics (_mm_round_ps, _mm_blendv_ps)
whenever BX_CPU_X86 && __SSE2__, so every x86 target needs the SSE4.2 minspec
bx's own scripts/toolchain.lua sets. Two configurations were missing it:

  * the x86_64 slice of Apple universal builds - CMAKE_SYSTEM_PROCESSOR only
    names one slice, so ios-cmake's SIMULATOR64COMBINED (which reports aarch64
    while also building x86_64) built that slice without the flag;
  * 32-bit x86 - the Android NDK sets CMAKE_SYSTEM_PROCESSOR to i686 for the
    x86 ABI, which the old x86_64-only guard did not match.

Both failed with "'__builtin_ia32_roundps' needs target feature sse4.1".

With the minspec now applied PUBLIC on the bx target, and bgfx / bimg /
bimg_decode / bimg_encode all linking bx PUBLIC, the local workaround in
Dependencies/CMakeLists.txt is redundant and is removed. It was also narrower
than the problem: it excluded ANDROID and only matched x86_64, so it never
covered the Android x86 or Apple cases.

Verified on a mirror of the packager pipeline (iOS SIMULATOR64COMBINED / Debug,
Xcode 26.0.1): before the bgfx.cmake fix the build stopped at bimg/image.o with
two sse4.1 errors after linking 12 static libraries; after it, BUILD SUCCEEDED
with 70 static libraries built and 66 files installed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1c7db476-5b27-4766-a4c7-909a52864b42
Copilot AI review requested due to automatic review settings July 30, 2026 16:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the bgfx.cmake FetchContent pin to a newer upstream commit that fixes SSE4.2 minspec propagation for all x86 targets (including Apple universal slice scoping and Android x86), and removes the now-redundant local -msse4.2 workaround previously applied in this repo.

Changes:

  • Bump bgfx.cmake to commit 5c98749de48e8609a62e5c1fd2cfffbbd970588e.
  • Remove the local SSE4.2 compile-options workaround block from Dependencies/CMakeLists.txt.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
CMakeLists.txt Updates the bgfx.cmake FetchContent GIT_TAG to the upstream commit that includes the SSE minspec fix and submodule updates.
Dependencies/CMakeLists.txt Drops the repo-local -msse4.2 workaround since the updated bgfx.cmake is expected to propagate the required x86 minspec via bx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants