Skip to content

Guard MSVC-specific __m128 field access from clang#14

Open
EnterTheArcane wants to merge 1 commit into
o3de:release/104.1from
EnterTheArcane:release/104.1
Open

Guard MSVC-specific __m128 field access from clang#14
EnterTheArcane wants to merge 1 commit into
o3de:release/104.1from
EnterTheArcane:release/104.1

Conversation

@EnterTheArcane

Copy link
Copy Markdown

This change fixes build failures when compiling PhysX with clang and clang-cl on Windows.

Several functions in PxWindowsInlineAoS.h access __m128 through MSVC-specific union members such as m128_u16 and m128_u32, e.g.:

result.m128_u16[i] = ...

This works with MSVC because its headers expose __m128 as a union-like type with named members. However, clang treats __m128 as a builtin vector type rather than a struct/union, so member access is not supported. As a result, it emits errors like:

error: member reference base type 'VecU16V' (aka '__m128') is not a structure or union

Changes

The affected functions that rely on MSVC-only __m128 member access are now excluded when compiling under clang:

#ifndef __clang__
    ...
#endif

The excluded functions are not used by O3DE, so conditionally compiling them out under clang is a safe and minimal fix. This avoids introducing more invasive changes, such as rewriting the implementations to use portable intrinsics or alternative vector types.

Signed-off-by: EnterTheArcane <96613937+EnterTheArcane@users.noreply.github.com>
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.

1 participant