diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a2195d0..f0933dae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,14 +2,13 @@ name: ci run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 on: [push] jobs: - Pure: - runs-on: ${{ matrix.os}} + windows-latest: + runs-on: windows-latest strategy: fail-fast: false matrix: - std: [98, 11, 14, 17, 20] config: [Debug, Release] - os: [ubuntu-latest, macos-latest, windows-latest] + steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" @@ -22,10 +21,140 @@ jobs: run: | ls ${{ github.workspace }} - run: echo "🍏 This job's status is ${{ job.status }}." - #- run: cmake -S. -B ./build_98_pure -D GLM_TEST_ENABLE_CXX_98=ON -DGLM_TEST_FORCE_PURE=ON -DCMAKE_BUILD_TYPE=${{matrix.config}} - - run: cmake -S. -B ./build_auto -DCMAKE_BUILD_TYPE=${{matrix.config}} - - run: cmake --build ./build_auto --parallel --config ${{matrix.config}} - - run: ctest --parallel 4 --verbose -C ${{matrix.config}} --test-dir ./build_auto + - name: CMake Version + run: cmake --version + - run: cmake -S. -B ./build_pure_98_std -DGLM_TEST_FORCE_PURE=ON -DGLM_TEST_ENABLE_CXX_98=ON + - run: cmake -S. -B ./build_pure_98_ext -DGLM_TEST_FORCE_PURE=ON -DGLM_TEST_ENABLE_CXX_98=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON + - run: cmake -S. -B ./build_sse2_98_std -DGLM_TEST_ENABLE_SIMD_SSE2=ON -DGLM_TEST_ENABLE_CXX_98=ON + - run: cmake -S. -B ./build_sse2_98_ext -DGLM_TEST_ENABLE_SIMD_SSE2=ON -DGLM_TEST_ENABLE_CXX_98=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON + - run: cmake -S. -B ./build_pure_11_std -DGLM_TEST_FORCE_PURE=ON -DGLM_TEST_ENABLE_CXX_11=ON + - run: cmake -S. -B ./build_pure_11_ext -DGLM_TEST_FORCE_PURE=ON -DGLM_TEST_ENABLE_CXX_11=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON + - run: cmake -S. -B ./build_sse2_11_std -DGLM_TEST_ENABLE_SIMD_SSE2=ON -DGLM_TEST_ENABLE_CXX_11=ON + - run: cmake -S. -B ./build_sse2_11_ext -DGLM_TEST_ENABLE_SIMD_SSE2=ON -DGLM_TEST_ENABLE_CXX_11=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON + #- run: cmake -S. -B ./build_avx2_std -DGLM_TEST_ENABLE_SIMD_AVX=ON + #- run: cmake -S. -B ./build_avx2_ext -DGLM_TEST_ENABLE_SIMD_AVX=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON + - run: cmake --build ./build_pure_98_std --config ${{matrix.config}} + - run: cmake --build ./build_pure_98_ext --config ${{matrix.config}} + - run: cmake --build ./build_sse2_98_std --config ${{matrix.config}} + - run: cmake --build ./build_sse2_98_ext --config ${{matrix.config}} + - run: cmake --build ./build_pure_11_std --config ${{matrix.config}} + - run: cmake --build ./build_pure_11_ext --config ${{matrix.config}} + - run: cmake --build ./build_sse2_11_std --config ${{matrix.config}} + - run: cmake --build ./build_sse2_11_ext --config ${{matrix.config}} + #- run: cmake --build ./build_avx2_std --config ${{matrix.config}} + #- run: cmake --build ./build_avx2_ext --config ${{matrix.config}} + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_pure_98_std + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_pure_98_ext + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_sse2_98_std + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_sse2_98_ext + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_pure_11_std + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_pure_11_ext + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_sse2_11_std + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_sse2_11_ext + #- run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_avx2_std + #- run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_avx2_ext + ubuntu-latest: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + config: [Debug, Release] + + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Check out repository code + uses: actions/checkout@v4 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ github.workspace }} + - run: echo "🍏 This job's status is ${{ job.status }}." + - name: GCC Version + run: gcc --version + - name: CMake Version + run: cmake --version + - run: cmake -S. -B ./build_pure_98_std -DGLM_TEST_FORCE_PURE=ON -DGLM_TEST_ENABLE_CXX_98=ON + - run: cmake -S. -B ./build_pure_98_ext -DGLM_TEST_FORCE_PURE=ON -DGLM_TEST_ENABLE_CXX_98=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON + - run: cmake -S. -B ./build_sse2_98_std -DGLM_TEST_ENABLE_SIMD_SSE2=ON -DGLM_TEST_ENABLE_CXX_98=ON + - run: cmake -S. -B ./build_sse2_98_ext -DGLM_TEST_ENABLE_SIMD_SSE2=ON -DGLM_TEST_ENABLE_CXX_98=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON + - run: cmake -S. -B ./build_pure_11_std -DGLM_TEST_FORCE_PURE=ON -DGLM_TEST_ENABLE_CXX_11=ON + - run: cmake -S. -B ./build_pure_11_ext -DGLM_TEST_FORCE_PURE=ON -DGLM_TEST_ENABLE_CXX_11=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON + - run: cmake -S. -B ./build_sse2_11_std -DGLM_TEST_ENABLE_SIMD_SSE2=ON -DGLM_TEST_ENABLE_CXX_11=ON + - run: cmake -S. -B ./build_sse2_11_ext -DGLM_TEST_ENABLE_SIMD_SSE2=ON -DGLM_TEST_ENABLE_CXX_11=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON + #- run: cmake -S. -B ./build_avx2_std -DGLM_TEST_ENABLE_SIMD_AVX=ON + #- run: cmake -S. -B ./build_avx2_ext -DGLM_TEST_ENABLE_SIMD_AVX=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON + - run: cmake --build ./build_pure_98_std --config ${{matrix.config}} + - run: cmake --build ./build_pure_98_ext --config ${{matrix.config}} + - run: cmake --build ./build_sse2_98_std --config ${{matrix.config}} + - run: cmake --build ./build_sse2_98_ext --config ${{matrix.config}} + - run: cmake --build ./build_pure_11_std --config ${{matrix.config}} + - run: cmake --build ./build_pure_11_ext --config ${{matrix.config}} + - run: cmake --build ./build_sse2_11_std --config ${{matrix.config}} + - run: cmake --build ./build_sse2_11_ext --config ${{matrix.config}} + #- run: cmake --build ./build_avx2_std --config ${{matrix.config}} + #- run: cmake --build ./build_avx2_ext --config ${{matrix.config}} + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_pure_98_std + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_pure_98_ext + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_sse2_98_std + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_sse2_98_ext + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_pure_11_std + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_pure_11_ext + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_sse2_11_std + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_sse2_11_ext + macos-latest: + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + config: [Debug, Release] + + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Check out repository code + uses: actions/checkout@v4 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ github.workspace }} + - run: echo "🍏 This job's status is ${{ job.status }}." + - name: CMake Version + run: cmake --version + - name: Clang Version + run: clang --version + - run: cmake -S. -B ./build_pure_98_std -DGLM_TEST_FORCE_PURE=ON -DGLM_TEST_ENABLE_CXX_98=ON + - run: cmake -S. -B ./build_pure_98_ext -DGLM_TEST_FORCE_PURE=ON -DGLM_TEST_ENABLE_CXX_98=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON + - run: cmake -S. -B ./build_sse2_98_std -DGLM_TEST_ENABLE_SIMD_SSE2=ON -DGLM_TEST_ENABLE_CXX_98=ON + - run: cmake -S. -B ./build_sse2_98_ext -DGLM_TEST_ENABLE_SIMD_SSE2=ON -DGLM_TEST_ENABLE_CXX_98=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON + - run: cmake -S. -B ./build_pure_11_std -DGLM_TEST_FORCE_PURE=ON -DGLM_TEST_ENABLE_CXX_11=ON + - run: cmake -S. -B ./build_pure_11_ext -DGLM_TEST_FORCE_PURE=ON -DGLM_TEST_ENABLE_CXX_11=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON + - run: cmake -S. -B ./build_sse2_11_std -DGLM_TEST_ENABLE_SIMD_SSE2=ON -DGLM_TEST_ENABLE_CXX_11=ON + - run: cmake -S. -B ./build_sse2_11_ext -DGLM_TEST_ENABLE_SIMD_SSE2=ON -DGLM_TEST_ENABLE_CXX_11=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON + #- run: cmake -S. -B ./build_avx2_std -DGLM_TEST_ENABLE_SIMD_AVX=ON + #- run: cmake -S. -B ./build_avx2_ext -DGLM_TEST_ENABLE_SIMD_AVX=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON + - run: cmake --build ./build_pure_98_std --config ${{matrix.config}} + - run: cmake --build ./build_pure_98_ext --config ${{matrix.config}} + - run: cmake --build ./build_sse2_98_std --config ${{matrix.config}} + - run: cmake --build ./build_sse2_98_ext --config ${{matrix.config}} + - run: cmake --build ./build_pure_11_std --config ${{matrix.config}} + - run: cmake --build ./build_pure_11_ext --config ${{matrix.config}} + - run: cmake --build ./build_sse2_11_std --config ${{matrix.config}} + - run: cmake --build ./build_sse2_11_ext --config ${{matrix.config}} + #- run: cmake --build ./build_avx2_std --config ${{matrix.config}} + #- run: cmake --build ./build_avx2_ext --config ${{matrix.config}} + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_pure_98_std + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_pure_98_ext + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_sse2_98_std + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_sse2_98_ext + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_pure_11_std + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_pure_11_ext + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_sse2_11_std + - run: ctest --verbose -C ${{matrix.config}} --test-dir ./build_sse2_11_ext #name: GLM Unit Tests diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index fcd92f6f..d45555c3 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -82,8 +82,8 @@ #if (defined(GLM_FORCE_CXX_UNKNOWN)) # define GLM_LANG 0 -#elif defined(GLM_FORCE_CXX2A) -# define GLM_LANG (GLM_LANG_CXX2A | GLM_LANG_EXT) +#elif defined(GLM_FORCE_CXX20) +# define GLM_LANG (GLM_LANG_CXX20 | GLM_LANG_EXT) # define GLM_LANG_STL11_FORCED #elif defined(GLM_FORCE_CXX17) # define GLM_LANG (GLM_LANG_CXX17 | GLM_LANG_EXT) diff --git a/glm/detail/type_vec4_simd.inl b/glm/detail/type_vec4_simd.inl index 4b26f503..15218763 100644 --- a/glm/detail/type_vec4_simd.inl +++ b/glm/detail/type_vec4_simd.inl @@ -54,7 +54,7 @@ namespace detail GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& a, vec<4, float, Q> const& b) { vec<4, float, Q> Result; - Result.data = _mm_add_ps((glm_f32vec4)a.data, (glm_f32vec4)b.data); + Result.data = _mm_add_ps(a.data, b.data); return Result; } }; @@ -78,7 +78,7 @@ namespace detail GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& a, vec<4, float, Q> const& b) { vec<4, float, Q> Result; - Result.data = _mm_sub_ps((glm_f32vec4)a.data, (glm_f32vec4)b.data); + Result.data = _mm_sub_ps(a.data, b.data); return Result; } }; @@ -90,7 +90,7 @@ namespace detail GLM_FUNC_QUALIFIER static vec<4, double, Q> call(vec<4, double, Q> const& a, vec<4, double, Q> const& b) { vec<4, double, Q> Result; - Result.data = _mm256_sub_pd((glm_f64vec4)a.data, (glm_f64vec4)b.data); + Result.data = _mm256_sub_pd(a.data, b.data); return Result; } }; @@ -102,7 +102,7 @@ namespace detail GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& a, vec<4, float, Q> const& b) { vec<4, float, Q> Result; - Result.data = _mm_mul_ps((glm_f32vec4)a.data, (glm_f32vec4)b.data); + Result.data = _mm_mul_ps(a.data, b.data); return Result; } }; @@ -114,7 +114,7 @@ namespace detail GLM_FUNC_QUALIFIER static vec<4, double, Q> call(vec<4, double, Q> const& a, vec<4, double, Q> const& b) { vec<4, double, Q> Result; - Result.data = _mm256_mul_pd((glm_f64vec4)a.data, (glm_f64vec4)b.data); + Result.data = _mm256_mul_pd(a.data, b.data); return Result; } }; @@ -126,19 +126,19 @@ namespace detail GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& a, vec<4, float, Q> const& b) { vec<4, float, Q> Result; - Result.data = _mm_div_ps((glm_f32vec4)a.data, (glm_f32vec4)b.data); + Result.data = _mm_div_ps(a.data, b.data); return Result; } }; - # if GLM_ARCH & GLM_ARCH_AVX_BIT +# if GLM_ARCH & GLM_ARCH_AVX_BIT template struct compute_vec4_div { GLM_FUNC_QUALIFIER static vec<4, double, Q> call(vec<4, double, Q> const& a, vec<4, double, Q> const& b) { vec<4, double, Q> Result; - Result.data = _mm256_div_pd((glm_f64vec4)a.data, (glm_f64vec4)b.data); + Result.data = _mm256_div_pd(a.data, b.data); return Result; } }; @@ -150,150 +150,282 @@ namespace detail GLM_FUNC_QUALIFIER static vec<4, float, aligned_lowp> call(vec<4, float, aligned_lowp> const& a, vec<4, float, aligned_lowp> const& b) { vec<4, float, aligned_lowp> Result; - Result.data = _mm_mul_ps((glm_f32vec4)a.data, _mm_rcp_ps(b.data)); + Result.data = _mm_mul_ps(a.data, _mm_rcp_ps(b.data)); return Result; } }; - template - struct compute_vec4_and + template + struct compute_vec4_and { - GLM_FUNC_QUALIFIER static vec<4, T, Q> call(vec<4, T, Q> const& a, vec<4, T, Q> const& b) + GLM_FUNC_QUALIFIER static vec<4, int, Q> call(vec<4, int, Q> const& a, vec<4, int, Q> const& b) { - vec<4, T, Q> Result; - Result.data = _mm_and_si128((glm_f32vec4)a.data, (glm_f32vec4)b.data); + vec<4, int, Q> Result; + Result.data = _mm_and_si128(a.data, b.data); + return Result; + } + }; + + template + struct compute_vec4_and + { + GLM_FUNC_QUALIFIER static vec<4, uint, Q> call(vec<4, uint, Q> const& a, vec<4, int, Q> const& b) + { + vec<4, uint, Q> Result; + Result.data = _mm_and_si128(a.data, b.data); return Result; } }; # if GLM_ARCH & GLM_ARCH_AVX2_BIT - template - struct compute_vec4_and + template + struct compute_vec4_and { - GLM_FUNC_QUALIFIER static vec<4, T, Q> call(vec<4, T, Q> const& a, vec<4, T, Q> const& b) + GLM_FUNC_QUALIFIER static vec<4, int64, Q> call(vec<4, int64, Q> const& a, vec<4, int64, Q> const& b) { - vec<4, T, Q> Result; - Result.data = _mm256_and_si256((glm_f32vec4)a.data, (glm_f32vec4)b.data); + vec<4, int64, Q> Result; + Result.data = _mm256_and_si256(a.data, b.data); + return Result; + } + }; + + template + struct compute_vec4_and + { + GLM_FUNC_QUALIFIER static vec<4, uint64, Q> call(vec<4, uint64, Q> const& a, vec<4, uint64, Q> const& b) + { + vec<4, uint64, Q> Result; + Result.data = _mm256_and_si256(a.data, b.data); return Result; } }; # endif - template - struct compute_vec4_or + template + struct compute_vec4_or { - GLM_FUNC_QUALIFIER static vec<4, T, Q> call(vec<4, T, Q> const& a, vec<4, T, Q> const& b) + GLM_FUNC_QUALIFIER static vec<4, int, Q> call(vec<4, int, Q> const& a, vec<4, int, Q> const& b) { - vec<4, T, Q> Result; - Result.data = _mm_or_si128((glm_f32vec4)a.data, (glm_f32vec4)b.data); + vec<4, int, Q> Result; + Result.data = _mm_or_si128(a.data, b.data); + return Result; + } + }; + + template + struct compute_vec4_or + { + GLM_FUNC_QUALIFIER static vec<4, uint, Q> call(vec<4, uint, Q> const& a, vec<4, uint, Q> const& b) + { + vec<4, uint, Q> Result; + Result.data = _mm_or_si128(a.data, b.data); return Result; } }; # if GLM_ARCH & GLM_ARCH_AVX2_BIT - template - struct compute_vec4_or + template + struct compute_vec4_or { - GLM_FUNC_QUALIFIER static vec<4, T, Q> call(vec<4, T, Q> const& a, vec<4, T, Q> const& b) + GLM_FUNC_QUALIFIER static vec<4, int64, Q> call(vec<4, int64, Q> const& a, vec<4, int64, Q> const& b) { - vec<4, T, Q> Result; - Result.data = _mm256_or_si256((glm_f32vec4)a.data, (glm_f32vec4)b.data); + vec<4, int64, Q> Result; + Result.data = _mm256_or_si256(a.data, b.data); + return Result; + } + }; + + template + struct compute_vec4_or + { + GLM_FUNC_QUALIFIER static vec<4, uint64, Q> call(vec<4, uint64, Q> const& a, vec<4, uint64, Q> const& b) + { + vec<4, uint64, Q> Result; + Result.data = _mm256_or_si256(a.data, b.data); return Result; } }; # endif - template - struct compute_vec4_xor + template + struct compute_vec4_xor { - GLM_FUNC_QUALIFIER static vec<4, T, Q> call(vec<4, T, Q> const& a, vec<4, T, Q> const& b) + GLM_FUNC_QUALIFIER static vec<4, int, Q> call(vec<4, int, Q> const& a, vec<4, int, Q> const& b) { - vec<4, T, Q> Result; - Result.data = _mm_xor_si128((glm_f32vec4)a.data, (glm_f32vec4)b.data); + vec<4, int, Q> Result; + Result.data = _mm_xor_si128(a.data, b.data); + return Result; + } + }; + + template + struct compute_vec4_xor + { + GLM_FUNC_QUALIFIER static vec<4, uint, Q> call(vec<4, uint, Q> const& a, vec<4, uint, Q> const& b) + { + vec<4, uint, Q> Result; + Result.data = _mm_xor_si128(a.data, b.data); return Result; } }; # if GLM_ARCH & GLM_ARCH_AVX2_BIT - template - struct compute_vec4_xor + template + struct compute_vec4_xor { - GLM_FUNC_QUALIFIER static vec<4, T, Q> call(vec<4, T, Q> const& a, vec<4, T, Q> const& b) + GLM_FUNC_QUALIFIER static vec<4, int64, Q> call(vec<4, int64, Q> const& a, vec<4, int64, Q> const& b) { - vec<4, T, Q> Result; - Result.data = _mm256_xor_si256((glm_f32vec4)a.data, (glm_f32vec4)b.data); + vec<4, int64, Q> Result; + Result.data = _mm256_xor_si256(a.data, b.data); + return Result; + } + }; + + template + struct compute_vec4_xor + { + GLM_FUNC_QUALIFIER static vec<4, uint64, Q> call(vec<4, uint64, Q> const& a, vec<4, uint64, Q> const& b) + { + vec<4, uint64, Q> Result; + Result.data = _mm256_xor_si256(a.data, b.data); return Result; } }; # endif - template - struct compute_vec4_shift_left + template + struct compute_vec4_shift_left { - GLM_FUNC_QUALIFIER static vec<4, T, Q> call(vec<4, T, Q> const& a, vec<4, T, Q> const& b) + GLM_FUNC_QUALIFIER static vec<4, int, Q> call(vec<4, int, Q> const& a, vec<4, int, Q> const& b) { - vec<4, T, Q> Result; - Result.data = _mm_sll_epi32((glm_f32vec4)a.data, (glm_f32vec4)b.data); + vec<4, int, Q> Result; + Result.data = _mm_sll_epi32(a.data, b.data); + return Result; + } + }; + + template + struct compute_vec4_shift_left + { + GLM_FUNC_QUALIFIER static vec<4, uint, Q> call(vec<4, uint, Q> const& a, vec<4, uint, Q> const& b) + { + vec<4, uint, Q> Result; + Result.data = _mm_sll_epi32(a.data, b.data); return Result; } }; # if GLM_ARCH & GLM_ARCH_AVX2_BIT - template - struct compute_vec4_shift_left + template + struct compute_vec4_shift_left { - GLM_FUNC_QUALIFIER static vec<4, T, Q> call(vec<4, T, Q> const& a, vec<4, T, Q> const& b) + GLM_FUNC_QUALIFIER static vec<4, int64, Q> call(vec<4, int64, Q> const& a, vec<4, int64, Q> const& b) { - vec<4, T, Q> Result; - Result.data = _mm256_sll_epi64((glm_f32vec4)a.data, (glm_f32vec4)b.data); + vec<4, int64, Q> Result; + Result.data = _mm256_sll_epi64(a.data, b.data); + return Result; + } + }; + + template + struct compute_vec4_shift_left + { + GLM_FUNC_QUALIFIER static vec<4, uint64, Q> call(vec<4, uint64, Q> const& a, vec<4, uint64, Q> const& b) + { + vec<4, uint64, Q> Result; + Result.data = _mm256_sll_epi64(a.data, b.data); return Result; } }; # endif - template - struct compute_vec4_shift_right + template + struct compute_vec4_shift_right { - GLM_FUNC_QUALIFIER static vec<4, T, Q> call(vec<4, T, Q> const& a, vec<4, T, Q> const& b) + GLM_FUNC_QUALIFIER static vec<4, int, Q> call(vec<4, int, Q> const& a, vec<4, int, Q> const& b) { - vec<4, T, Q> Result; - Result.data = _mm_srl_epi32((glm_f32vec4)a.data, (glm_f32vec4)b.data); + vec<4, int, Q> Result; + Result.data = _mm_srl_epi32(a.data, b.data); + return Result; + } + }; + + template + struct compute_vec4_shift_right + { + GLM_FUNC_QUALIFIER static vec<4, uint, Q> call(vec<4, uint, Q> const& a, vec<4, uint, Q> const& b) + { + vec<4, uint, Q> Result; + Result.data = _mm_srl_epi32(a.data, b.data); return Result; } }; # if GLM_ARCH & GLM_ARCH_AVX2_BIT - template - struct compute_vec4_shift_right + template + struct compute_vec4_shift_right { - GLM_FUNC_QUALIFIER static vec<4, T, Q> call(vec<4, T, Q> const& a, vec<4, T, Q> const& b) + GLM_FUNC_QUALIFIER static vec<4, int64, Q> call(vec<4, int64, Q> const& a, vec<4, int64, Q> const& b) { - vec<4, T, Q> Result; - Result.data = _mm256_srl_epi64((glm_f32vec4)a.data, (glm_f32vec4)b.data); + vec<4, int64, Q> Result; + Result.data = _mm256_srl_epi64(a.data, b.data); + return Result; + } + }; + + template + struct compute_vec4_shift_right + { + GLM_FUNC_QUALIFIER static vec<4, uint64, Q> call(vec<4, uint64, Q> const& a, vec<4, uint64, Q> const& b) + { + vec<4, uint64, Q> Result; + Result.data = _mm256_srl_epi64(a.data, b.data); return Result; } }; # endif - template - struct compute_vec4_bitwise_not + template + struct compute_vec4_bitwise_not { - GLM_FUNC_QUALIFIER static vec<4, T, Q> call(vec<4, T, Q> const& v) + GLM_FUNC_QUALIFIER static vec<4, int, Q> call(vec<4, int, Q> const& v) { - vec<4, T, Q> Result; - Result.data = _mm_xor_si128((glm_f32vec4)v.data, _mm_set1_epi32(-1)); + vec<4, int, Q> Result; + Result.data = _mm_xor_si128(v.data, _mm_set1_epi32(-1)); + return Result; + } + }; + + template + struct compute_vec4_bitwise_not + { + GLM_FUNC_QUALIFIER static vec<4, uint, Q> call(vec<4, uint, Q> const& v) + { + vec<4, uint, Q> Result; + Result.data = _mm_xor_si128(v.data, _mm_set1_epi32(-1)); return Result; } }; # if GLM_ARCH & GLM_ARCH_AVX2_BIT - template - struct compute_vec4_bitwise_not + template + struct compute_vec4_bitwise_not { - GLM_FUNC_QUALIFIER static vec<4, T, Q> call(vec<4, T, Q> const& v) + GLM_FUNC_QUALIFIER static vec<4, int64, Q> call(vec<4, int64, Q> const& v) { - vec<4, T, Q> Result; - Result.data = _mm256_xor_si256((glm_f32vec4)v.data, _mm_set1_epi32(-1)); + vec<4, int64, Q> Result; + Result.data = _mm256_xor_si256(v.data, _mm_set1_epi32(-1)); + return Result; + } + }; + + template + struct compute_vec4_bitwise_not + { + GLM_FUNC_QUALIFIER static vec<4, uint64, Q> call(vec<4, uint64, Q> const& v) + { + vec<4, uint64, Q> Result; + Result.data = _mm256_xor_si256(v.data, _mm_set1_epi32(-1)); return Result; } }; @@ -304,7 +436,7 @@ namespace detail { GLM_FUNC_QUALIFIER static bool call(vec<4, float, Q> const& v1, vec<4, float, Q> const& v2) { - return _mm_movemask_ps(_mm_cmpneq_ps((glm_f32vec4)v1.data, (glm_f32vec4)v2.data)) == 0; + return _mm_movemask_ps(_mm_cmpneq_ps(v1.data, v2.data)) == 0; } }; @@ -315,7 +447,7 @@ namespace detail GLM_FUNC_QUALIFIER static bool call(vec<4, int, Q> const& v1, vec<4, int, Q> const& v2) { //return _mm_movemask_epi8(_mm_cmpeq_epi32(v1.data, v2.data)) != 0; - __m128i neq = _mm_xor_si128((glm_f32vec4)v1.data, (glm_f32vec4)v2.data); + __m128i neq = _mm_xor_si128(v1.data, v2.data); return _mm_test_all_zeros(neq, neq) == 0; } }; @@ -326,7 +458,7 @@ namespace detail { GLM_FUNC_QUALIFIER static bool call(vec<4, float, Q> const& v1, vec<4, float, Q> const& v2) { - return _mm_movemask_ps(_mm_cmpneq_ps((glm_f32vec4)v1.data, (glm_f32vec4)v2.data)) != 0; + return _mm_movemask_ps(_mm_cmpneq_ps(v1.data, v2.data)) != 0; } }; @@ -337,7 +469,7 @@ namespace detail GLM_FUNC_QUALIFIER static bool call(vec<4, int, Q> const& v1, vec<4, int, Q> const& v2) { //return _mm_movemask_epi8(_mm_cmpneq_epi32(v1.data, v2.data)) != 0; - __m128i neq = _mm_xor_si128((glm_f32vec4)v1.data, (glm_f32vec4)v2.data); + __m128i neq = _mm_xor_si128(v1.data, v2.data); return _mm_test_all_zeros(neq, neq) != 0; } }; diff --git a/glm/gtx/hash.hpp b/glm/gtx/hash.hpp index 8201796b..2d42ded7 100644 --- a/glm/gtx/hash.hpp +++ b/glm/gtx/hash.hpp @@ -20,8 +20,6 @@ # endif #endif -#include - #include "../vec2.hpp" #include "../vec3.hpp" #include "../vec4.hpp" @@ -43,100 +41,106 @@ #include "../mat4x4.hpp" #if !GLM_HAS_CXX11_STL -# error "GLM_GTX_hash requires C++11 standard library support" +#pragma message("GLM_GTX_hash requires C++11 standard library support") #endif +#if 0 && GLM_LANG & GLM_LANG_CXX11 +#define GLM_GTX_hash 1 +#include + namespace std { template - struct hash > + struct hash > { GLM_FUNC_DECL size_t operator()(glm::vec<1, T, Q> const& v) const GLM_NOEXCEPT; }; template - struct hash > + struct hash > { GLM_FUNC_DECL size_t operator()(glm::vec<2, T, Q> const& v) const GLM_NOEXCEPT; }; template - struct hash > + struct hash > { GLM_FUNC_DECL size_t operator()(glm::vec<3, T, Q> const& v) const GLM_NOEXCEPT; }; template - struct hash > + struct hash > { GLM_FUNC_DECL size_t operator()(glm::vec<4, T, Q> const& v) const GLM_NOEXCEPT; }; template - struct hash> + struct hash > { GLM_FUNC_DECL size_t operator()(glm::qua const& q) const GLM_NOEXCEPT; }; template - struct hash > + struct hash > { GLM_FUNC_DECL size_t operator()(glm::tdualquat const& q) const GLM_NOEXCEPT; }; template - struct hash > + struct hash > { GLM_FUNC_DECL size_t operator()(glm::mat<2, 2, T,Q> const& m) const GLM_NOEXCEPT; }; template - struct hash > + struct hash > { GLM_FUNC_DECL size_t operator()(glm::mat<2, 3, T,Q> const& m) const GLM_NOEXCEPT; }; template - struct hash > + struct hash > { GLM_FUNC_DECL size_t operator()(glm::mat<2, 4, T,Q> const& m) const GLM_NOEXCEPT; }; template - struct hash > + struct hash > { GLM_FUNC_DECL size_t operator()(glm::mat<3, 2, T,Q> const& m) const GLM_NOEXCEPT; }; template - struct hash > + struct hash > { GLM_FUNC_DECL size_t operator()(glm::mat<3, 3, T,Q> const& m) const GLM_NOEXCEPT; }; template - struct hash > + struct hash > { GLM_FUNC_DECL size_t operator()(glm::mat<3, 4, T,Q> const& m) const GLM_NOEXCEPT; }; template - struct hash > + struct hash > { GLM_FUNC_DECL size_t operator()(glm::mat<4, 2, T,Q> const& m) const GLM_NOEXCEPT; }; template - struct hash > + struct hash > { GLM_FUNC_DECL size_t operator()(glm::mat<4, 3, T,Q> const& m) const GLM_NOEXCEPT; }; template - struct hash > + struct hash > { GLM_FUNC_DECL size_t operator()(glm::mat<4, 4, T,Q> const& m) const GLM_NOEXCEPT; }; } // namespace std #include "hash.inl" + +#endif //GLM_LANG & GLM_LANG_CXX11 diff --git a/glm/gtx/hash.inl b/glm/gtx/hash.inl index fc822d3e..200dfa39 100644 --- a/glm/gtx/hash.inl +++ b/glm/gtx/hash.inl @@ -13,14 +13,14 @@ namespace detail namespace std { template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::vec<1, T, Q> const& v) const GLM_NOEXCEPT + GLM_FUNC_QUALIFIER size_t hash >::operator()(glm::vec<1, T, Q> const& v) const GLM_NOEXCEPT { hash hasher; return hasher(v.x); } template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::vec<2, T, Q> const& v) const GLM_NOEXCEPT + GLM_FUNC_QUALIFIER size_t hash >::operator()(glm::vec<2, T, Q> const& v) const GLM_NOEXCEPT { size_t seed = 0; hash hasher; @@ -30,7 +30,7 @@ namespace std } template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::vec<3, T, Q> const& v) const GLM_NOEXCEPT + GLM_FUNC_QUALIFIER size_t hash >::operator()(glm::vec<3, T, Q> const& v) const GLM_NOEXCEPT { size_t seed = 0; hash hasher; @@ -41,7 +41,7 @@ namespace std } template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::vec<4, T, Q> const& v) const GLM_NOEXCEPT + GLM_FUNC_QUALIFIER size_t hash >::operator()(glm::vec<4, T, Q> const& v) const GLM_NOEXCEPT { size_t seed = 0; hash hasher; @@ -53,7 +53,7 @@ namespace std } template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::qua const& q) const GLM_NOEXCEPT + GLM_FUNC_QUALIFIER size_t hash >::operator()(glm::qua const& q) const GLM_NOEXCEPT { size_t seed = 0; hash hasher; @@ -65,7 +65,7 @@ namespace std } template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::tdualquat const& q) const GLM_NOEXCEPT + GLM_FUNC_QUALIFIER size_t hash >::operator()(glm::tdualquat const& q) const GLM_NOEXCEPT { size_t seed = 0; hash> hasher; @@ -75,7 +75,7 @@ namespace std } template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::mat<2, 2, T, Q> const& m) const GLM_NOEXCEPT + GLM_FUNC_QUALIFIER size_t hash >::operator()(glm::mat<2, 2, T, Q> const& m) const GLM_NOEXCEPT { size_t seed = 0; hash> hasher; @@ -85,7 +85,7 @@ namespace std } template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::mat<2, 3, T, Q> const& m) const GLM_NOEXCEPT + GLM_FUNC_QUALIFIER size_t hash >::operator()(glm::mat<2, 3, T, Q> const& m) const GLM_NOEXCEPT { size_t seed = 0; hash> hasher; @@ -95,7 +95,7 @@ namespace std } template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::mat<2, 4, T, Q> const& m) const GLM_NOEXCEPT + GLM_FUNC_QUALIFIER size_t hash >::operator()(glm::mat<2, 4, T, Q> const& m) const GLM_NOEXCEPT { size_t seed = 0; hash> hasher; @@ -105,7 +105,7 @@ namespace std } template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::mat<3, 2, T, Q> const& m) const GLM_NOEXCEPT + GLM_FUNC_QUALIFIER size_t hash >::operator()(glm::mat<3, 2, T, Q> const& m) const GLM_NOEXCEPT { size_t seed = 0; hash> hasher; @@ -116,7 +116,7 @@ namespace std } template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::mat<3, 3, T, Q> const& m) const GLM_NOEXCEPT + GLM_FUNC_QUALIFIER size_t hash >::operator()(glm::mat<3, 3, T, Q> const& m) const GLM_NOEXCEPT { size_t seed = 0; hash> hasher; @@ -127,7 +127,7 @@ namespace std } template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::mat<3, 4, T, Q> const& m) const GLM_NOEXCEPT + GLM_FUNC_QUALIFIER size_t hash >::operator()(glm::mat<3, 4, T, Q> const& m) const GLM_NOEXCEPT { size_t seed = 0; hash> hasher; @@ -138,7 +138,7 @@ namespace std } template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::mat<4, 2, T,Q> const& m) const GLM_NOEXCEPT + GLM_FUNC_QUALIFIER size_t hash >::operator()(glm::mat<4, 2, T,Q> const& m) const GLM_NOEXCEPT { size_t seed = 0; hash> hasher; @@ -150,7 +150,7 @@ namespace std } template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::mat<4, 3, T,Q> const& m) const GLM_NOEXCEPT + GLM_FUNC_QUALIFIER size_t hash >::operator()(glm::mat<4, 3, T,Q> const& m) const GLM_NOEXCEPT { size_t seed = 0; hash> hasher; @@ -162,7 +162,7 @@ namespace std } template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::mat<4, 4, T, Q> const& m) const GLM_NOEXCEPT + GLM_FUNC_QUALIFIER size_t hash >::operator()(glm::mat<4, 4, T, Q> const& m) const GLM_NOEXCEPT { size_t seed = 0; hash> hasher; diff --git a/glm/gtx/matrix_decompose.inl b/glm/gtx/matrix_decompose.inl index ee42351d..a4304df8 100644 --- a/glm/gtx/matrix_decompose.inl +++ b/glm/gtx/matrix_decompose.inl @@ -209,20 +209,20 @@ namespace detail m *= glm::translate(translation); m *= glm::mat4_cast(orientation); - if (skew.x) { - glm::mat4 tmp { 1.f }; + if (abs(skew.x) > static_cast(0)) { + glm::mat4 tmp(1.f); tmp[2][1] = skew.x; m *= tmp; } - if (skew.y) { - glm::mat4 tmp { 1.f }; + if (abs(skew.y) > static_cast(0)) { + glm::mat4 tmp(1.f); tmp[2][0] = skew.y; m *= tmp; } - if (skew.z) { - glm::mat4 tmp { 1.f }; + if (abs(skew.z) > static_cast(0)) { + glm::mat4 tmp(1.f); tmp[1][0] = skew.z; m *= tmp; } diff --git a/glm/gtx/string_cast.inl b/glm/gtx/string_cast.inl index f67751d4..0b2d4b6a 100644 --- a/glm/gtx/string_cast.inl +++ b/glm/gtx/string_cast.inl @@ -31,7 +31,7 @@ namespace detail # if (GLM_COMPILER & GLM_COMPILER_VC) vsprintf_s(text, STRING_BUFFER, msg, list); # else// - std::vsprintf(text, msg, list); + std::vsnprintf(text, STRING_BUFFER, msg, list); # endif// va_end(list); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 04ddbf8f..1e327afe 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -11,7 +11,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) if(GLM_TEST_ENABLE_CXX_20) set(CMAKE_CXX_STANDARD 20) - add_definitions(-DGLM_FORCE_CXX2A) + add_definitions(-DGLM_FORCE_CXX20) if(NOT GLM_QUIET) message(STATUS "GLM: Build with C++20 features") endif() diff --git a/test/ext/ext_matrix_common.cpp b/test/ext/ext_matrix_common.cpp index 8895892a..2cf1da26 100644 --- a/test/ext/ext_matrix_common.cpp +++ b/test/ext/ext_matrix_common.cpp @@ -70,7 +70,7 @@ static int test_abs() glm::bvec4 const col2 = glm::equal(D[1], A[1]); glm::bvec4 const col3 = glm::equal(D[2], A[2]); glm::bvec4 const col4 = glm::equal(D[3], A[3]); - Error += glm::all(glm::bvec4{glm::all(col1), glm::all(col2), glm::all(col3), glm::all(col4)}) ? 0 : 1; + Error += glm::all(glm::bvec4(glm::all(col1), glm::all(col2), glm::all(col3), glm::all(col4))) ? 0 : 1; } { glm::mat4x3 A( @@ -91,7 +91,7 @@ static int test_abs() glm::bvec3 const col2 = glm::equal(D[1], A[1]); glm::bvec3 const col3 = glm::equal(D[2], A[2]); glm::bvec3 const col4 = glm::equal(D[3], A[3]); - Error += glm::all(glm::bvec4{glm::all(col1), glm::all(col2), glm::all(col3), glm::all(col4)}) ? 0 : 1; + Error += glm::all(glm::bvec4(glm::all(col1), glm::all(col2), glm::all(col3), glm::all(col4))) ? 0 : 1; } { glm::mat4x2 A( @@ -112,7 +112,7 @@ static int test_abs() glm::bvec2 const col2 = glm::equal(D[1], A[1]); glm::bvec2 const col3 = glm::equal(D[2], A[2]); glm::bvec2 const col4 = glm::equal(D[3], A[3]); - Error += glm::all(glm::bvec4{glm::all(col1), glm::all(col2), glm::all(col3), glm::all(col4)}) ? 0 : 1; + Error += glm::all(glm::bvec4(glm::all(col1), glm::all(col2), glm::all(col3), glm::all(col4))) ? 0 : 1; } // -------------------- // @@ -134,7 +134,7 @@ static int test_abs() glm::bvec4 const col1 = glm::equal(D[0], A[0]); glm::bvec4 const col2 = glm::equal(D[1], A[1]); glm::bvec4 const col3 = glm::equal(D[2], A[2]); - Error += glm::all(glm::bvec3{glm::all(col1), glm::all(col2), glm::all(col3)}) ? 0 : 1; + Error += glm::all(glm::bvec3(glm::all(col1), glm::all(col2), glm::all(col3))) ? 0 : 1; } { glm::mat3 A( @@ -152,7 +152,7 @@ static int test_abs() glm::bvec3 const col1 = glm::equal(D[0], A[0]); glm::bvec3 const col2 = glm::equal(D[1], A[1]); glm::bvec3 const col3 = glm::equal(D[2], A[2]); - Error += glm::all(glm::bvec3{glm::all(col1), glm::all(col2), glm::all(col3)}) ? 0 : 1; + Error += glm::all(glm::bvec3(glm::all(col1), glm::all(col2), glm::all(col3))) ? 0 : 1; } { glm::mat3x2 A( @@ -170,7 +170,7 @@ static int test_abs() glm::bvec2 const col1 = glm::equal(D[0], A[0]); glm::bvec2 const col2 = glm::equal(D[1], A[1]); glm::bvec2 const col3 = glm::equal(D[2], A[2]); - Error += glm::all(glm::bvec3{glm::all(col1), glm::all(col2), glm::all(col3)}) ? 0 : 1; + Error += glm::all(glm::bvec3(glm::all(col1), glm::all(col2), glm::all(col3))) ? 0 : 1; } // -------------------- // @@ -189,7 +189,7 @@ static int test_abs() glm::mat2x4 D = glm::abs(C); glm::bvec4 const col1 = glm::equal(D[0], A[0]); glm::bvec4 const col2 = glm::equal(D[1], A[1]); - Error += glm::all(glm::bvec2{glm::all(col1), glm::all(col2)}) ? 0 : 1; + Error += glm::all(glm::bvec2(glm::all(col1), glm::all(col2))) ? 0 : 1; } { glm::mat2x3 A( @@ -204,7 +204,7 @@ static int test_abs() glm::mat2x3 D = glm::abs(C); glm::bvec3 const col1 = glm::equal(D[0], A[0]); glm::bvec3 const col2 = glm::equal(D[1], A[1]); - Error += glm::all(glm::bvec2{glm::all(col1), glm::all(col2)}) ? 0 : 1; + Error += glm::all(glm::bvec2(glm::all(col1), glm::all(col2))) ? 0 : 1; } { glm::mat2 A( @@ -219,7 +219,7 @@ static int test_abs() glm::mat2 D = glm::abs(C); glm::bvec2 const col1 = glm::equal(D[0], A[0]); glm::bvec2 const col2 = glm::equal(D[1], A[1]); - Error += glm::all(glm::bvec2{glm::all(col1), glm::all(col2)}) ? 0 : 1; + Error += glm::all(glm::bvec2(glm::all(col1), glm::all(col2))) ? 0 : 1; } return Error; diff --git a/test/gtx/gtx_hash.cpp b/test/gtx/gtx_hash.cpp index 4eb2b701..b6f1ca81 100644 --- a/test/gtx/gtx_hash.cpp +++ b/test/gtx/gtx_hash.cpp @@ -1,5 +1,7 @@ #define GLM_ENABLE_EXPERIMENTAL #include + +#if defined(GLM_GTX_hash) && GLM_LANG & GLM_LANG_CXX11 #include int test_compile() @@ -42,15 +44,18 @@ int test_compile() std::unordered_map map_mat4x4; Error += ++map_mat4x4[glm::mat4x4(0.0f)]; - return Error > 0 ? 0 : 1; + return Error > 0 ? 0 : 1; } +#endif//GLM_LANG& GLM_LANG_CXX11 int main() { - int Error = 0; + int Error = 0; - Error += test_compile(); +#if defined(GLM_GTX_hash) + Error += test_compile(); +#endif// - return Error; + return Error; }