mirror of
https://github.com/KhronosGroup/Vulkan-Hpp
synced 2024-11-21 20:00:11 +00:00
Use compile option -fno-strict-aliasing to prevent breaking optimizations due to using reinterpret_cast (#1985)
This commit is contained in:
parent
17a245e6ec
commit
ab5eb71025
@ -63,6 +63,9 @@ function( vulkan_hpp__setup_platform )
|
|||||||
else()
|
else()
|
||||||
message( FATAL_ERROR, "Vulkan-Hpp: unhandled platform!" )
|
message( FATAL_ERROR, "Vulkan-Hpp: unhandled platform!" )
|
||||||
endif()
|
endif()
|
||||||
|
if( !MSVC )
|
||||||
|
target_compile_options( ${TARGET_NAME} PRIVATE -fno-strict-aliasing )
|
||||||
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function( vulkan_hpp__setup_vulkan_include )
|
function( vulkan_hpp__setup_vulkan_include )
|
||||||
|
@ -846,6 +846,10 @@ Currently, there are just a couple of such defines:
|
|||||||
- `VULKAN_HPP_NO_TO_STRING`, which removes the various `vk::to_string` functions on enums and bitmasks.
|
- `VULKAN_HPP_NO_TO_STRING`, which removes the various `vk::to_string` functions on enums and bitmasks.
|
||||||
- `VULKAN_HPP_USE_REFLECT`, this one needs to be defined to use the reflection function on structures. It's very slow to compile, though!
|
- `VULKAN_HPP_USE_REFLECT`, this one needs to be defined to use the reflection function on structures. It's very slow to compile, though!
|
||||||
|
|
||||||
|
### Strict aliasing issue
|
||||||
|
|
||||||
|
As Vulkan-Hpp often needs to switch between C++ vk-types and corresponding bit-identical C-types, using `reinterpret_cast`, it is highly recommended to use the compile option `-fno-strict-aliasing` to prevent potentially breaking compile optimizations.
|
||||||
|
|
||||||
## Configuration Options
|
## Configuration Options
|
||||||
|
|
||||||
There are a couple of defines you can use to control the feature set and behaviour of `vulkan.hpp`:
|
There are a couple of defines you can use to control the feature set and behaviour of `vulkan.hpp`:
|
||||||
|
Loading…
Reference in New Issue
Block a user