KhronosGroup / Vulkan-Samples

One stop solution for all Vulkan samples
Apache License 2.0
4.36k stars 648 forks source link

Add compile option -fno-strict-aliasing for all compilers but MSVC. #1212

Closed asuessenbach closed 2 weeks ago

asuessenbach commented 3 weeks ago

Description

Due to using reinterpret_casts in our code base, we need to set -fno-strict-aliasing for all compilers but MSVC (which does not have such a switch but acts as if it were set) to prevent potentially wrong optimizations.

Fixes #1207

General Checklist:

Please ensure the following points are checked:

Sample Checklist

If your PR contains a new or modified sample, these further checks must be carried out in addition to the General Checklist:

jeroenbakker-atmind commented 2 weeks ago

I will test on Mac&Linux desktop this week.

jeroenbakker-atmind commented 2 weeks ago

Validated on

Operating system: Linux-6.8.0-48-generic-x86_64-with-glibc2.39 64 Bits, WAYLAND UI
Graphics card: AMD Radeon PRO W6800 Advanced Micro Devices AMD proprietary driver (AMD proprietary shader compiler)

Operating system: macOS-14.6.1-arm64-arm-64bit 64 Bits
Graphics card: Apple M2 Apple MoltenVK 1.2.11
marty-johnson59 commented 2 weeks ago

Merging with Steve and Jeroen's approvals per discussion on Monday