Enable /WX, warning as error on Visual Studio

This commit is contained in:
Christophe Riccio 2017-08-17 19:51:03 +02:00
parent 23db2cd8b9
commit e9f210c85f
15 changed files with 192 additions and 178 deletions

View File

@ -133,7 +133,7 @@ endif()
# Compiler and default options # Compiler and default options
if((CMAKE_CXX_COMPILER_ID MATCHES "Clang")) if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message("GLM: Clang - ${CMAKE_CXX_COMPILER_ID} compiler") message("GLM: Clang - ${CMAKE_CXX_COMPILER_ID} compiler")
add_compile_options(-Werror -Weverything) add_compile_options(-Werror -Weverything)
@ -152,7 +152,8 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
message("GLM: Visual C++ - ${CMAKE_CXX_COMPILER_ID} compiler") message("GLM: Visual C++ - ${CMAKE_CXX_COMPILER_ID} compiler")
add_compile_options(/FAs) add_compile_options(/FAs /W4 /WX)
add_compile_options(/wd4324 /wd4389 /wd4127 /wd4309 /wd4267 /wd4146 /wd4201 /wd4464 /wd4514 /wd4701 /wd4820 /wd4365)
add_definitions(-D_CRT_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif() endif()

View File

@ -63,6 +63,5 @@ else(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE)
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER} ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}
${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER}) ${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER})
target_compile_options(glm_dummy PRIVATE -ffast-math)
endif(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE) endif(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE)

View File

@ -21,14 +21,14 @@ namespace detail
glm::uint16 REG1(x); glm::uint16 REG1(x);
glm::uint16 REG2(y); glm::uint16 REG2(y);
REG1 = ((REG1 << 4) | REG1) & glm::uint16(0x0F0F); REG1 = ((REG1 << 4) | REG1) & static_cast<glm::uint16>(0x0F0F);
REG2 = ((REG2 << 4) | REG2) & glm::uint16(0x0F0F); REG2 = ((REG2 << 4) | REG2) & static_cast<glm::uint16>(0x0F0F);
REG1 = ((REG1 << 2) | REG1) & glm::uint16(0x3333); REG1 = ((REG1 << 2) | REG1) & static_cast<glm::uint16>(0x3333);
REG2 = ((REG2 << 2) | REG2) & glm::uint16(0x3333); REG2 = ((REG2 << 2) | REG2) & static_cast<glm::uint16>(0x3333);
REG1 = ((REG1 << 1) | REG1) & glm::uint16(0x5555); REG1 = ((REG1 << 1) | REG1) & static_cast<glm::uint16>(0x5555);
REG2 = ((REG2 << 1) | REG2) & glm::uint16(0x5555); REG2 = ((REG2 << 1) | REG2) & static_cast<glm::uint16>(0x5555);
return REG1 | static_cast<glm::uint16>(REG2 << 1); return REG1 | static_cast<glm::uint16>(REG2 << 1);
} }
@ -39,17 +39,17 @@ namespace detail
glm::uint32 REG1(x); glm::uint32 REG1(x);
glm::uint32 REG2(y); glm::uint32 REG2(y);
REG1 = ((REG1 << 8) | REG1) & glm::uint32(0x00FF00FF); REG1 = ((REG1 << 8) | REG1) & static_cast<glm::uint32>(0x00FF00FF);
REG2 = ((REG2 << 8) | REG2) & glm::uint32(0x00FF00FF); REG2 = ((REG2 << 8) | REG2) & static_cast<glm::uint32>(0x00FF00FF);
REG1 = ((REG1 << 4) | REG1) & glm::uint32(0x0F0F0F0F); REG1 = ((REG1 << 4) | REG1) & static_cast<glm::uint32>(0x0F0F0F0F);
REG2 = ((REG2 << 4) | REG2) & glm::uint32(0x0F0F0F0F); REG2 = ((REG2 << 4) | REG2) & static_cast<glm::uint32>(0x0F0F0F0F);
REG1 = ((REG1 << 2) | REG1) & glm::uint32(0x33333333); REG1 = ((REG1 << 2) | REG1) & static_cast<glm::uint32>(0x33333333);
REG2 = ((REG2 << 2) | REG2) & glm::uint32(0x33333333); REG2 = ((REG2 << 2) | REG2) & static_cast<glm::uint32>(0x33333333);
REG1 = ((REG1 << 1) | REG1) & glm::uint32(0x55555555); REG1 = ((REG1 << 1) | REG1) & static_cast<glm::uint32>(0x55555555);
REG2 = ((REG2 << 1) | REG2) & glm::uint32(0x55555555); REG2 = ((REG2 << 1) | REG2) & static_cast<glm::uint32>(0x55555555);
return REG1 | (REG2 << 1); return REG1 | (REG2 << 1);
} }
@ -60,20 +60,20 @@ namespace detail
glm::uint64 REG1(x); glm::uint64 REG1(x);
glm::uint64 REG2(y); glm::uint64 REG2(y);
REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x0000FFFF0000FFFFull); REG1 = ((REG1 << 16) | REG1) & static_cast<glm::uint64>(0x0000FFFF0000FFFFull);
REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x0000FFFF0000FFFFull); REG2 = ((REG2 << 16) | REG2) & static_cast<glm::uint64>(0x0000FFFF0000FFFFull);
REG1 = ((REG1 << 8) | REG1) & glm::uint64(0x00FF00FF00FF00FFull); REG1 = ((REG1 << 8) | REG1) & static_cast<glm::uint64>(0x00FF00FF00FF00FFull);
REG2 = ((REG2 << 8) | REG2) & glm::uint64(0x00FF00FF00FF00FFull); REG2 = ((REG2 << 8) | REG2) & static_cast<glm::uint64>(0x00FF00FF00FF00FFull);
REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x0F0F0F0F0F0F0F0Full); REG1 = ((REG1 << 4) | REG1) & static_cast<glm::uint64>(0x0F0F0F0F0F0F0F0Full);
REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x0F0F0F0F0F0F0F0Full); REG2 = ((REG2 << 4) | REG2) & static_cast<glm::uint64>(0x0F0F0F0F0F0F0F0Full);
REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x3333333333333333ull); REG1 = ((REG1 << 2) | REG1) & static_cast<glm::uint64>(0x3333333333333333ull);
REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x3333333333333333ull); REG2 = ((REG2 << 2) | REG2) & static_cast<glm::uint64>(0x3333333333333333ull);
REG1 = ((REG1 << 1) | REG1) & glm::uint64(0x5555555555555555ull); REG1 = ((REG1 << 1) | REG1) & static_cast<glm::uint64>(0x5555555555555555ull);
REG2 = ((REG2 << 1) | REG2) & glm::uint64(0x5555555555555555ull); REG2 = ((REG2 << 1) | REG2) & static_cast<glm::uint64>(0x5555555555555555ull);
return REG1 | (REG2 << 1); return REG1 | (REG2 << 1);
} }
@ -85,21 +85,21 @@ namespace detail
glm::uint32 REG2(y); glm::uint32 REG2(y);
glm::uint32 REG3(z); glm::uint32 REG3(z);
REG1 = ((REG1 << 16) | REG1) & glm::uint32(0x00FF0000FF0000FF); REG1 = ((REG1 << 16) | REG1) & static_cast<glm::uint32>(0x00FF0000FF0000FF);
REG2 = ((REG2 << 16) | REG2) & glm::uint32(0x00FF0000FF0000FF); REG2 = ((REG2 << 16) | REG2) & static_cast<glm::uint32>(0x00FF0000FF0000FF);
REG3 = ((REG3 << 16) | REG3) & glm::uint32(0x00FF0000FF0000FF); REG3 = ((REG3 << 16) | REG3) & static_cast<glm::uint32>(0x00FF0000FF0000FF);
REG1 = ((REG1 << 8) | REG1) & glm::uint32(0xF00F00F00F00F00F); REG1 = ((REG1 << 8) | REG1) & static_cast<glm::uint32>(0xF00F00F00F00F00F);
REG2 = ((REG2 << 8) | REG2) & glm::uint32(0xF00F00F00F00F00F); REG2 = ((REG2 << 8) | REG2) & static_cast<glm::uint32>(0xF00F00F00F00F00F);
REG3 = ((REG3 << 8) | REG3) & glm::uint32(0xF00F00F00F00F00F); REG3 = ((REG3 << 8) | REG3) & static_cast<glm::uint32>(0xF00F00F00F00F00F);
REG1 = ((REG1 << 4) | REG1) & glm::uint32(0x30C30C30C30C30C3); REG1 = ((REG1 << 4) | REG1) & static_cast<glm::uint32>(0x30C30C30C30C30C3);
REG2 = ((REG2 << 4) | REG2) & glm::uint32(0x30C30C30C30C30C3); REG2 = ((REG2 << 4) | REG2) & static_cast<glm::uint32>(0x30C30C30C30C30C3);
REG3 = ((REG3 << 4) | REG3) & glm::uint32(0x30C30C30C30C30C3); REG3 = ((REG3 << 4) | REG3) & static_cast<glm::uint32>(0x30C30C30C30C30C3);
REG1 = ((REG1 << 2) | REG1) & glm::uint32(0x9249249249249249); REG1 = ((REG1 << 2) | REG1) & static_cast<glm::uint32>(0x9249249249249249);
REG2 = ((REG2 << 2) | REG2) & glm::uint32(0x9249249249249249); REG2 = ((REG2 << 2) | REG2) & static_cast<glm::uint32>(0x9249249249249249);
REG3 = ((REG3 << 2) | REG3) & glm::uint32(0x9249249249249249); REG3 = ((REG3 << 2) | REG3) & static_cast<glm::uint32>(0x9249249249249249);
return REG1 | (REG2 << 1) | (REG3 << 2); return REG1 | (REG2 << 1) | (REG3 << 2);
} }
@ -111,25 +111,25 @@ namespace detail
glm::uint64 REG2(y); glm::uint64 REG2(y);
glm::uint64 REG3(z); glm::uint64 REG3(z);
REG1 = ((REG1 << 32) | REG1) & glm::uint64(0xFFFF00000000FFFFull); REG1 = ((REG1 << 32) | REG1) & static_cast<glm::uint64>(0xFFFF00000000FFFFull);
REG2 = ((REG2 << 32) | REG2) & glm::uint64(0xFFFF00000000FFFFull); REG2 = ((REG2 << 32) | REG2) & static_cast<glm::uint64>(0xFFFF00000000FFFFull);
REG3 = ((REG3 << 32) | REG3) & glm::uint64(0xFFFF00000000FFFFull); REG3 = ((REG3 << 32) | REG3) & static_cast<glm::uint64>(0xFFFF00000000FFFFull);
REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x00FF0000FF0000FFull); REG1 = ((REG1 << 16) | REG1) & static_cast<glm::uint64>(0x00FF0000FF0000FFull);
REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x00FF0000FF0000FFull); REG2 = ((REG2 << 16) | REG2) & static_cast<glm::uint64>(0x00FF0000FF0000FFull);
REG3 = ((REG3 << 16) | REG3) & glm::uint64(0x00FF0000FF0000FFull); REG3 = ((REG3 << 16) | REG3) & static_cast<glm::uint64>(0x00FF0000FF0000FFull);
REG1 = ((REG1 << 8) | REG1) & glm::uint64(0xF00F00F00F00F00Full); REG1 = ((REG1 << 8) | REG1) & static_cast<glm::uint64>(0xF00F00F00F00F00Full);
REG2 = ((REG2 << 8) | REG2) & glm::uint64(0xF00F00F00F00F00Full); REG2 = ((REG2 << 8) | REG2) & static_cast<glm::uint64>(0xF00F00F00F00F00Full);
REG3 = ((REG3 << 8) | REG3) & glm::uint64(0xF00F00F00F00F00Full); REG3 = ((REG3 << 8) | REG3) & static_cast<glm::uint64>(0xF00F00F00F00F00Full);
REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x30C30C30C30C30C3ull); REG1 = ((REG1 << 4) | REG1) & static_cast<glm::uint64>(0x30C30C30C30C30C3ull);
REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x30C30C30C30C30C3ull); REG2 = ((REG2 << 4) | REG2) & static_cast<glm::uint64>(0x30C30C30C30C30C3ull);
REG3 = ((REG3 << 4) | REG3) & glm::uint64(0x30C30C30C30C30C3ull); REG3 = ((REG3 << 4) | REG3) & static_cast<glm::uint64>(0x30C30C30C30C30C3ull);
REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x9249249249249249ull); REG1 = ((REG1 << 2) | REG1) & static_cast<glm::uint64>(0x9249249249249249ull);
REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x9249249249249249ull); REG2 = ((REG2 << 2) | REG2) & static_cast<glm::uint64>(0x9249249249249249ull);
REG3 = ((REG3 << 2) | REG3) & glm::uint64(0x9249249249249249ull); REG3 = ((REG3 << 2) | REG3) & static_cast<glm::uint64>(0x9249249249249249ull);
return REG1 | (REG2 << 1) | (REG3 << 2); return REG1 | (REG2 << 1) | (REG3 << 2);
} }
@ -141,25 +141,25 @@ namespace detail
glm::uint64 REG2(y); glm::uint64 REG2(y);
glm::uint64 REG3(z); glm::uint64 REG3(z);
REG1 = ((REG1 << 32) | REG1) & glm::uint64(0xFFFF00000000FFFFull); REG1 = ((REG1 << 32) | REG1) & static_cast<glm::uint64>(0xFFFF00000000FFFFull);
REG2 = ((REG2 << 32) | REG2) & glm::uint64(0xFFFF00000000FFFFull); REG2 = ((REG2 << 32) | REG2) & static_cast<glm::uint64>(0xFFFF00000000FFFFull);
REG3 = ((REG3 << 32) | REG3) & glm::uint64(0xFFFF00000000FFFFull); REG3 = ((REG3 << 32) | REG3) & static_cast<glm::uint64>(0xFFFF00000000FFFFull);
REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x00FF0000FF0000FFull); REG1 = ((REG1 << 16) | REG1) & static_cast<glm::uint64>(0x00FF0000FF0000FFull);
REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x00FF0000FF0000FFull); REG2 = ((REG2 << 16) | REG2) & static_cast<glm::uint64>(0x00FF0000FF0000FFull);
REG3 = ((REG3 << 16) | REG3) & glm::uint64(0x00FF0000FF0000FFull); REG3 = ((REG3 << 16) | REG3) & static_cast<glm::uint64>(0x00FF0000FF0000FFull);
REG1 = ((REG1 << 8) | REG1) & glm::uint64(0xF00F00F00F00F00Full); REG1 = ((REG1 << 8) | REG1) & static_cast<glm::uint64>(0xF00F00F00F00F00Full);
REG2 = ((REG2 << 8) | REG2) & glm::uint64(0xF00F00F00F00F00Full); REG2 = ((REG2 << 8) | REG2) & static_cast<glm::uint64>(0xF00F00F00F00F00Full);
REG3 = ((REG3 << 8) | REG3) & glm::uint64(0xF00F00F00F00F00Full); REG3 = ((REG3 << 8) | REG3) & static_cast<glm::uint64>(0xF00F00F00F00F00Full);
REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x30C30C30C30C30C3ull); REG1 = ((REG1 << 4) | REG1) & static_cast<glm::uint64>(0x30C30C30C30C30C3ull);
REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x30C30C30C30C30C3ull); REG2 = ((REG2 << 4) | REG2) & static_cast<glm::uint64>(0x30C30C30C30C30C3ull);
REG3 = ((REG3 << 4) | REG3) & glm::uint64(0x30C30C30C30C30C3ull); REG3 = ((REG3 << 4) | REG3) & static_cast<glm::uint64>(0x30C30C30C30C30C3ull);
REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x9249249249249249ull); REG1 = ((REG1 << 2) | REG1) & static_cast<glm::uint64>(0x9249249249249249ull);
REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x9249249249249249ull); REG2 = ((REG2 << 2) | REG2) & static_cast<glm::uint64>(0x9249249249249249ull);
REG3 = ((REG3 << 2) | REG3) & glm::uint64(0x9249249249249249ull); REG3 = ((REG3 << 2) | REG3) & static_cast<glm::uint64>(0x9249249249249249ull);
return REG1 | (REG2 << 1) | (REG3 << 2); return REG1 | (REG2 << 1) | (REG3 << 2);
} }
@ -172,20 +172,20 @@ namespace detail
glm::uint32 REG3(z); glm::uint32 REG3(z);
glm::uint32 REG4(w); glm::uint32 REG4(w);
REG1 = ((REG1 << 12) | REG1) & glm::uint32(0x000F000F000F000F); REG1 = ((REG1 << 12) | REG1) & static_cast<glm::uint32>(0x000F000F000F000F);
REG2 = ((REG2 << 12) | REG2) & glm::uint32(0x000F000F000F000F); REG2 = ((REG2 << 12) | REG2) & static_cast<glm::uint32>(0x000F000F000F000F);
REG3 = ((REG3 << 12) | REG3) & glm::uint32(0x000F000F000F000F); REG3 = ((REG3 << 12) | REG3) & static_cast<glm::uint32>(0x000F000F000F000F);
REG4 = ((REG4 << 12) | REG4) & glm::uint32(0x000F000F000F000F); REG4 = ((REG4 << 12) | REG4) & static_cast<glm::uint32>(0x000F000F000F000F);
REG1 = ((REG1 << 6) | REG1) & glm::uint32(0x0303030303030303); REG1 = ((REG1 << 6) | REG1) & static_cast<glm::uint32>(0x0303030303030303);
REG2 = ((REG2 << 6) | REG2) & glm::uint32(0x0303030303030303); REG2 = ((REG2 << 6) | REG2) & static_cast<glm::uint32>(0x0303030303030303);
REG3 = ((REG3 << 6) | REG3) & glm::uint32(0x0303030303030303); REG3 = ((REG3 << 6) | REG3) & static_cast<glm::uint32>(0x0303030303030303);
REG4 = ((REG4 << 6) | REG4) & glm::uint32(0x0303030303030303); REG4 = ((REG4 << 6) | REG4) & static_cast<glm::uint32>(0x0303030303030303);
REG1 = ((REG1 << 3) | REG1) & glm::uint32(0x1111111111111111); REG1 = ((REG1 << 3) | REG1) & static_cast<glm::uint32>(0x1111111111111111);
REG2 = ((REG2 << 3) | REG2) & glm::uint32(0x1111111111111111); REG2 = ((REG2 << 3) | REG2) & static_cast<glm::uint32>(0x1111111111111111);
REG3 = ((REG3 << 3) | REG3) & glm::uint32(0x1111111111111111); REG3 = ((REG3 << 3) | REG3) & static_cast<glm::uint32>(0x1111111111111111);
REG4 = ((REG4 << 3) | REG4) & glm::uint32(0x1111111111111111); REG4 = ((REG4 << 3) | REG4) & static_cast<glm::uint32>(0x1111111111111111);
return REG1 | (REG2 << 1) | (REG3 << 2) | (REG4 << 3); return REG1 | (REG2 << 1) | (REG3 << 2) | (REG4 << 3);
} }
@ -198,25 +198,25 @@ namespace detail
glm::uint64 REG3(z); glm::uint64 REG3(z);
glm::uint64 REG4(w); glm::uint64 REG4(w);
REG1 = ((REG1 << 24) | REG1) & glm::uint64(0x000000FF000000FFull); REG1 = ((REG1 << 24) | REG1) & static_cast<glm::uint64>(0x000000FF000000FFull);
REG2 = ((REG2 << 24) | REG2) & glm::uint64(0x000000FF000000FFull); REG2 = ((REG2 << 24) | REG2) & static_cast<glm::uint64>(0x000000FF000000FFull);
REG3 = ((REG3 << 24) | REG3) & glm::uint64(0x000000FF000000FFull); REG3 = ((REG3 << 24) | REG3) & static_cast<glm::uint64>(0x000000FF000000FFull);
REG4 = ((REG4 << 24) | REG4) & glm::uint64(0x000000FF000000FFull); REG4 = ((REG4 << 24) | REG4) & static_cast<glm::uint64>(0x000000FF000000FFull);
REG1 = ((REG1 << 12) | REG1) & glm::uint64(0x000F000F000F000Full); REG1 = ((REG1 << 12) | REG1) & static_cast<glm::uint64>(0x000F000F000F000Full);
REG2 = ((REG2 << 12) | REG2) & glm::uint64(0x000F000F000F000Full); REG2 = ((REG2 << 12) | REG2) & static_cast<glm::uint64>(0x000F000F000F000Full);
REG3 = ((REG3 << 12) | REG3) & glm::uint64(0x000F000F000F000Full); REG3 = ((REG3 << 12) | REG3) & static_cast<glm::uint64>(0x000F000F000F000Full);
REG4 = ((REG4 << 12) | REG4) & glm::uint64(0x000F000F000F000Full); REG4 = ((REG4 << 12) | REG4) & static_cast<glm::uint64>(0x000F000F000F000Full);
REG1 = ((REG1 << 6) | REG1) & glm::uint64(0x0303030303030303ull); REG1 = ((REG1 << 6) | REG1) & static_cast<glm::uint64>(0x0303030303030303ull);
REG2 = ((REG2 << 6) | REG2) & glm::uint64(0x0303030303030303ull); REG2 = ((REG2 << 6) | REG2) & static_cast<glm::uint64>(0x0303030303030303ull);
REG3 = ((REG3 << 6) | REG3) & glm::uint64(0x0303030303030303ull); REG3 = ((REG3 << 6) | REG3) & static_cast<glm::uint64>(0x0303030303030303ull);
REG4 = ((REG4 << 6) | REG4) & glm::uint64(0x0303030303030303ull); REG4 = ((REG4 << 6) | REG4) & static_cast<glm::uint64>(0x0303030303030303ull);
REG1 = ((REG1 << 3) | REG1) & glm::uint64(0x1111111111111111ull); REG1 = ((REG1 << 3) | REG1) & static_cast<glm::uint64>(0x1111111111111111ull);
REG2 = ((REG2 << 3) | REG2) & glm::uint64(0x1111111111111111ull); REG2 = ((REG2 << 3) | REG2) & static_cast<glm::uint64>(0x1111111111111111ull);
REG3 = ((REG3 << 3) | REG3) & glm::uint64(0x1111111111111111ull); REG3 = ((REG3 << 3) | REG3) & static_cast<glm::uint64>(0x1111111111111111ull);
REG4 = ((REG4 << 3) | REG4) & glm::uint64(0x1111111111111111ull); REG4 = ((REG4 << 3) | REG4) & static_cast<glm::uint64>(0x1111111111111111ull);
return REG1 | (REG2 << 1) | (REG3 << 2) | (REG4 << 3); return REG1 | (REG2 << 1) | (REG3 << 2) | (REG4 << 3);
} }

View File

@ -18,11 +18,13 @@ namespace floor_
{ {
float A = 1.1f; float A = 1.1f;
float B = glm::floor(A); float B = glm::floor(A);
Error += glm::epsilonEqual(B, 1.f, 0.0001f) ? 0 : 1;
} }
{ {
double A = 1.1; double A = 1.1;
double B = glm::floor(A); double B = glm::floor(A);
Error += glm::epsilonEqual(B, 1.0, 0.0001) ? 0 : 1;
} }
{ {

View File

@ -218,12 +218,12 @@ namespace bitfieldReverse
GLM_FUNC_QUALIFIER glm::vec<L, T, Q> bitfieldReverseOps(glm::vec<L, T, Q> const& v) GLM_FUNC_QUALIFIER glm::vec<L, T, Q> bitfieldReverseOps(glm::vec<L, T, Q> const& v)
{ {
glm::vec<L, T, Q> x(v); glm::vec<L, T, Q> x(v);
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 2>::call(x, T(0x5555555555555555ull), static_cast<T>( 1)); x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 2>::call(x, static_cast<T>(0x5555555555555555ull), static_cast<T>( 1));
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 4>::call(x, T(0x3333333333333333ull), static_cast<T>( 2)); x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 4>::call(x, static_cast<T>(0x3333333333333333ull), static_cast<T>( 2));
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 8>::call(x, T(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4)); x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 8>::call(x, static_cast<T>(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4));
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 16>::call(x, T(0x00FF00FF00FF00FFull), static_cast<T>( 8)); x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 16>::call(x, static_cast<T>(0x00FF00FF00FF00FFull), static_cast<T>( 8));
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 32>::call(x, T(0x0000FFFF0000FFFFull), static_cast<T>(16)); x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 32>::call(x, static_cast<T>(0x0000FFFF0000FFFFull), static_cast<T>(16));
x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 64>::call(x, T(0x00000000FFFFFFFFull), static_cast<T>(32)); x = compute_bitfieldReverseStep<sizeof(T) * 8 >= 64>::call(x, static_cast<T>(0x00000000FFFFFFFFull), static_cast<T>(32));
return x; return x;
} }
@ -1418,12 +1418,12 @@ namespace bitCount
static glm::vec<L, int, Q> bitCount_bitfield(glm::vec<L, T, Q> const& v) static glm::vec<L, int, Q> bitCount_bitfield(glm::vec<L, T, Q> const& v)
{ {
glm::vec<L, typename glm::detail::make_unsigned<T>::type, Q> x(*reinterpret_cast<glm::vec<L, typename glm::detail::make_unsigned<T>::type, Q> const *>(&v)); glm::vec<L, typename glm::detail::make_unsigned<T>::type, Q> x(*reinterpret_cast<glm::vec<L, typename glm::detail::make_unsigned<T>::type, Q> const *>(&v));
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 2>::call(x, typename glm::detail::make_unsigned<T>::type(0x5555555555555555ull), typename glm::detail::make_unsigned<T>::type( 1)); x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 2>::call(x, static_cast<typename glm::detail::make_unsigned<T>::type>(0x5555555555555555ull), static_cast<typename glm::detail::make_unsigned<T>::type>( 1));
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 4>::call(x, typename glm::detail::make_unsigned<T>::type(0x3333333333333333ull), typename glm::detail::make_unsigned<T>::type( 2)); x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 4>::call(x, static_cast<typename glm::detail::make_unsigned<T>::type>(0x3333333333333333ull), static_cast<typename glm::detail::make_unsigned<T>::type>( 2));
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 8>::call(x, typename glm::detail::make_unsigned<T>::type(0x0F0F0F0F0F0F0F0Full), typename glm::detail::make_unsigned<T>::type( 4)); x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 8>::call(x, static_cast<typename glm::detail::make_unsigned<T>::type>(0x0F0F0F0F0F0F0F0Full), static_cast<typename glm::detail::make_unsigned<T>::type>( 4));
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 16>::call(x, typename glm::detail::make_unsigned<T>::type(0x00FF00FF00FF00FFull), typename glm::detail::make_unsigned<T>::type( 8)); x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 16>::call(x, static_cast<typename glm::detail::make_unsigned<T>::type>(0x00FF00FF00FF00FFull), static_cast<typename glm::detail::make_unsigned<T>::type>( 8));
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 32>::call(x, typename glm::detail::make_unsigned<T>::type(0x0000FFFF0000FFFFull), typename glm::detail::make_unsigned<T>::type(16)); x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 32>::call(x, static_cast<typename glm::detail::make_unsigned<T>::type>(0x0000FFFF0000FFFFull), static_cast<typename glm::detail::make_unsigned<T>::type>(16));
x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 64>::call(x, typename glm::detail::make_unsigned<T>::type(0x00000000FFFFFFFFull), typename glm::detail::make_unsigned<T>::type(32)); x = compute_bitfieldBitCountStep<sizeof(T) * 8 >= 64>::call(x, static_cast<typename glm::detail::make_unsigned<T>::type>(0x00000000FFFFFFFFull), static_cast<typename glm::detail::make_unsigned<T>::type>(32));
return glm::vec<L, int, Q>(x); return glm::vec<L, int, Q>(x);
} }

View File

@ -1,22 +1,7 @@
struct vec4
{
static int length();
};
int vec4::length()
{
return 4;
}
int main() int main()
{ {
int Failed = 0; int Error = 0;
vec4 V; return Error;
int LengthA = V.length();
int LengthB = vec4::length();
return Failed;
} }

View File

@ -124,7 +124,7 @@ namespace mask
{32, 0xffffffff} {32, 0xffffffff}
}; };
int Error(0); int Error = 0;
/* mask_zero is sadly not a correct code /* mask_zero is sadly not a correct code
for(std::size_t i = 0; i < sizeof(Data) / sizeof(type<int>); ++i) for(std::size_t i = 0; i < sizeof(Data) / sizeof(type<int>); ++i)
{ {
@ -495,6 +495,9 @@ namespace bitfieldInterleave
glm::uint64 B(glm::bitfieldInterleave(glm::uint16(x), glm::uint16(y))); glm::uint64 B(glm::bitfieldInterleave(glm::uint16(x), glm::uint16(y)));
glm::uint64 C(glm::bitfieldInterleave(glm::uint32(x), glm::uint32(y))); glm::uint64 C(glm::bitfieldInterleave(glm::uint32(x), glm::uint32(y)));
assert(A == B);
assert(A == C);
glm::int64 D(glm::bitfieldInterleave(glm::int8(x), glm::int8(y))); glm::int64 D(glm::bitfieldInterleave(glm::int8(x), glm::int8(y)));
glm::int64 E(glm::bitfieldInterleave(glm::int16(x), glm::int16(y))); glm::int64 E(glm::bitfieldInterleave(glm::int16(x), glm::int16(y)));
glm::int64 F(glm::bitfieldInterleave(glm::int32(x), glm::int32(y))); glm::int64 F(glm::bitfieldInterleave(glm::int32(x), glm::int32(y)));
@ -675,10 +678,10 @@ namespace bitfieldInterleave5
GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave_u16vec2(glm::uint16 x, glm::uint16 y) GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave_u16vec2(glm::uint16 x, glm::uint16 y)
{ {
glm::uint64 Result = (glm::uint64(y) << 32) | glm::uint64(x); glm::uint64 Result = (glm::uint64(y) << 32) | glm::uint64(x);
Result = ((Result << 8) | Result) & glm::uint32(0x00FF00FF00FF00FFull); Result = ((Result << 8) | Result) & static_cast<glm::uint32>(0x00FF00FF00FF00FFull);
Result = ((Result << 4) | Result) & glm::uint32(0x0F0F0F0F0F0F0F0Full); Result = ((Result << 4) | Result) & static_cast<glm::uint32>(0x0F0F0F0F0F0F0F0Full);
Result = ((Result << 2) | Result) & glm::uint32(0x3333333333333333ull); Result = ((Result << 2) | Result) & static_cast<glm::uint32>(0x3333333333333333ull);
Result = ((Result << 1) | Result) & glm::uint32(0x5555555555555555ull); Result = ((Result << 1) | Result) & static_cast<glm::uint32>(0x5555555555555555ull);
return static_cast<glm::uint32>((Result & 0x00000000FFFFFFFFull) | (Result >> 31)); return static_cast<glm::uint32>((Result & 0x00000000FFFFFFFFull) | (Result >> 31));
} }

View File

@ -2,14 +2,16 @@
int test_epsilon() int test_epsilon()
{ {
int Error(0); int Error = 0;
{ {
float Test = glm::epsilon<float>(); float Test = glm::epsilon<float>();
Error += Test > 0.0f ? 0 : 1;
} }
{ {
double Test = glm::epsilon<double>(); double Test = glm::epsilon<double>();
Error += Test > 0.0 ? 0 : 1;
} }
return Error; return Error;

View File

@ -271,7 +271,7 @@ int test_RGBM()
for(std::size_t i = 0; i < 1024; ++i) for(std::size_t i = 0; i < 1024; ++i)
{ {
glm::vec3 const Color(i); glm::vec3 const Color(static_cast<float>(i));
glm::vec4 const RGBM = glm::packRGBM(Color); glm::vec4 const RGBM = glm::packRGBM(Color);
glm::vec3 const Result= glm::unpackRGBM(RGBM); glm::vec3 const Result= glm::unpackRGBM(RGBM);

View File

@ -107,7 +107,7 @@ int test_quat_normalize()
int test_quat_euler() int test_quat_euler()
{ {
int Error(0); int Error = 0;
{ {
glm::quat q(1.0f, 0.0f, 0.0f, 1.0f); glm::quat q(1.0f, 0.0f, 0.0f, 1.0f);
@ -115,6 +115,7 @@ int test_quat_euler()
float Pitch = glm::pitch(q); float Pitch = glm::pitch(q);
float Yaw = glm::yaw(q); float Yaw = glm::yaw(q);
glm::vec3 Angles = glm::eulerAngles(q); glm::vec3 Angles = glm::eulerAngles(q);
Error += glm::all(glm::epsilonEqual(Angles, glm::vec3(Pitch, Yaw, Roll), 0.000001f)) ? 0 : 1;
} }
{ {
@ -123,6 +124,7 @@ int test_quat_euler()
double Pitch = glm::pitch(q); double Pitch = glm::pitch(q);
double Yaw = glm::yaw(q); double Yaw = glm::yaw(q);
glm::dvec3 Angles = glm::eulerAngles(q); glm::dvec3 Angles = glm::eulerAngles(q);
Error += glm::all(glm::epsilonEqual(Angles, glm::dvec3(Pitch, Yaw, Roll), 0.000001)) ? 0 : 1;
} }
return Error; return Error;
@ -130,7 +132,7 @@ int test_quat_euler()
int test_quat_slerp() int test_quat_slerp()
{ {
int Error(0); int Error = 0;
float const Epsilon = 0.0001f;//glm::epsilon<float>(); float const Epsilon = 0.0001f;//glm::epsilon<float>();
@ -236,14 +238,6 @@ int test_quat_two_axis_ctr()
return Error; return Error;
} }
int test_quat_type()
{
glm::quat A;
glm::dquat B;
return 0;
}
int test_quat_mul_vec() int test_quat_mul_vec()
{ {
int Error(0); int Error(0);
@ -310,7 +304,6 @@ int main()
Error += test_quat_two_axis_ctr(); Error += test_quat_two_axis_ctr();
Error += test_quat_mul(); Error += test_quat_mul();
Error += test_quat_precision(); Error += test_quat_precision();
Error += test_quat_type();
Error += test_quat_angle(); Error += test_quat_angle();
Error += test_quat_angleAxis(); Error += test_quat_angleAxis();
Error += test_quat_mix(); Error += test_quat_mix();

View File

@ -130,17 +130,6 @@ int main()
{ {
int Error = 0; int Error = 0;
my_vec4_aligned GNA;
my_dvec4_aligned GNI;
std::size_t A0 = sizeof(my_dvec4_aligned);
std::size_t B0 = sizeof(my_dvec4_packed);
std::size_t C0 = sizeof(glm::aligned_dvec4);
std::size_t A1 = sizeof(my_vec4_aligned);
std::size_t B1 = sizeof(my_vec4_packed);
std::size_t C1 = sizeof(glm::aligned_vec4);
Error += test_ctor(); Error += test_ctor();
Error += test_copy(); Error += test_copy();

View File

@ -106,13 +106,22 @@ namespace fmod_
int test_isdenormal() int test_isdenormal()
{ {
int Error(0); int Error = 0;
bool A = glm::isdenormal(1.0f); bool A = glm::isdenormal(1.0f);
Error += !A ? 0 : 1;
glm::bvec1 B = glm::isdenormal(glm::vec1(1.0f)); glm::bvec1 B = glm::isdenormal(glm::vec1(1.0f));
Error += !glm::any(B) ? 0 : 1;
glm::bvec2 C = glm::isdenormal(glm::vec2(1.0f)); glm::bvec2 C = glm::isdenormal(glm::vec2(1.0f));
Error += !glm::any(C) ? 0 : 1;
glm::bvec3 D = glm::isdenormal(glm::vec3(1.0f)); glm::bvec3 D = glm::isdenormal(glm::vec3(1.0f));
Error += !glm::any(D) ? 0 : 1;
glm::bvec4 E = glm::isdenormal(glm::vec4(1.0f)); glm::bvec4 E = glm::isdenormal(glm::vec4(1.0f));
Error += !glm::any(E) ? 0 : 1;
return Error; return Error;
} }

View File

@ -8,7 +8,6 @@ int test_axisAngle()
{ {
int Error = 0; int Error = 0;
float p = 0.171654f;
glm::mat4 m1(-0.9946f, 0.0f, -0.104531f, 0.0f, glm::mat4 m1(-0.9946f, 0.0f, -0.104531f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
0.104531f, 0.0f, -0.9946f, 0.0f, 0.104531f, 0.0f, -0.9946f, 0.0f,

View File

@ -43,21 +43,24 @@ int test_quat_shortMix()
int test_orientation() int test_orientation()
{ {
int Error(0); int Error = 0;
{ {
glm::quat q(1.0f, 0.0f, 0.0f, 1.0f); glm::quat q(1.0f, 0.0f, 0.0f, 1.0f);
float p = glm::roll(q); float p = glm::roll(q);
Error += glm::epsilonEqual(p, glm::pi<float>() * 0.5f, 0.0001f) ? 0 : 1;
} }
{ {
glm::quat q(1.0f, 0.0f, 0.0f, 1.0f); glm::quat q(1.0f, 0.0f, 0.0f, 1.0f);
float p = glm::pitch(q); float p = glm::pitch(q);
Error += glm::epsilonEqual(p, 0.f, 0.0001f) ? 0 : 1;
} }
{ {
glm::quat q(1.0f, 0.0f, 0.0f, 1.0f); glm::quat q(1.0f, 0.0f, 0.0f, 1.0f);
float p = glm::yaw(q); float p = glm::yaw(q);
Error += glm::epsilonEqual(p, 0.f, 0.0001f) ? 0 : 1;
} }
return Error; return Error;
@ -113,6 +116,7 @@ int main()
Error += test_log(); Error += test_log();
Error += test_rotation(); Error += test_rotation();
Error += test_orientation();
Error += test_quat_fastMix(); Error += test_quat_fastMix();
Error += test_quat_shortMix(); Error += test_quat_shortMix();
Error += test_quat_lookAt(); Error += test_quat_lookAt();

View File

@ -6,40 +6,68 @@
#include <glm/gtx/range.hpp> #include <glm/gtx/range.hpp>
int testVec() int test_vec()
{ {
int Error(0); int Error = 0;
glm::vec3 v(1, 2, 3);
{
glm::ivec3 const v(1, 2, 3);
int count = 0; int count = 0;
for(float x : v){ count++; } glm::ivec3 Result(0);
for(int x : v)
{
Result[count] = x;
count++;
}
Error += count == 3 ? 0 : 1; Error += count == 3 ? 0 : 1;
Error += v == Result ? 0 : 1;
}
{
glm::ivec3 v(1, 2, 3);
for(int& x : v)
x = 0;
Error += glm::all(glm::equal(v, glm::ivec3(0))) ? 0 : 1;
}
for(float& x : v){ x = 0; }
Error += glm::all(glm::equal(v, glm::vec3(0, 0, 0))) ? 0 : 1;
return Error; return Error;
} }
int testMat() int test_mat()
{ {
int Error(0); int Error = 0;
glm::mat4x3 m(1);
{
glm::mat4x3 m(1.0f);
int count = 0; int count = 0;
for(float x : m){ count++; } float Sum = 0.0f;
for(float x : m)
{
count++;
Sum += x;
}
Error += count == 12 ? 0 : 1; Error += count == 12 ? 0 : 1;
Error += glm::epsilonEqual(Sum, 3.0f, 0.001f) ? 0 : 1;
}
for(float& x : m){ x = 0; } {
glm::mat4x3 m(1.0f);
for (float& x : m) { x = 0; }
glm::vec4 v(1, 1, 1, 1); glm::vec4 v(1, 1, 1, 1);
Error += glm::all(glm::equal(m*v, glm::vec3(0, 0, 0))) ? 0 : 1; Error += glm::all(glm::equal(m*v, glm::vec3(0, 0, 0))) ? 0 : 1;
}
return Error; return Error;
} }
int main() int main()
{ {
int Error(0); int Error = 0;
Error += testVec(); Error += test_vec();
Error += testMat(); Error += test_mat();
return Error; return Error;
} }