Fixes for tests build

This commit is contained in:
Christophe 2023-12-19 20:06:43 +01:00
parent 2834400335
commit e516c13a06
10 changed files with 407 additions and 137 deletions

View File

@ -2,14 +2,13 @@ name: ci
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on: [push] on: [push]
jobs: jobs:
Pure: windows-latest:
runs-on: ${{ matrix.os}} runs-on: windows-latest
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
std: [98, 11, 14, 17, 20]
config: [Debug, Release] config: [Debug, Release]
os: [ubuntu-latest, macos-latest, windows-latest]
steps: steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - 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 "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
@ -22,10 +21,140 @@ jobs:
run: | run: |
ls ${{ github.workspace }} ls ${{ github.workspace }}
- run: echo "🍏 This job's status is ${{ job.status }}." - 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}} - name: CMake Version
- run: cmake -S. -B ./build_auto -DCMAKE_BUILD_TYPE=${{matrix.config}} run: cmake --version
- run: cmake --build ./build_auto --parallel --config ${{matrix.config}} - run: cmake -S. -B ./build_pure_98_std -DGLM_TEST_FORCE_PURE=ON -DGLM_TEST_ENABLE_CXX_98=ON
- run: ctest --parallel 4 --verbose -C ${{matrix.config}} --test-dir ./build_auto - 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 #name: GLM Unit Tests

View File

@ -82,8 +82,8 @@
#if (defined(GLM_FORCE_CXX_UNKNOWN)) #if (defined(GLM_FORCE_CXX_UNKNOWN))
# define GLM_LANG 0 # define GLM_LANG 0
#elif defined(GLM_FORCE_CXX2A) #elif defined(GLM_FORCE_CXX20)
# define GLM_LANG (GLM_LANG_CXX2A | GLM_LANG_EXT) # define GLM_LANG (GLM_LANG_CXX20 | GLM_LANG_EXT)
# define GLM_LANG_STL11_FORCED # define GLM_LANG_STL11_FORCED
#elif defined(GLM_FORCE_CXX17) #elif defined(GLM_FORCE_CXX17)
# define GLM_LANG (GLM_LANG_CXX17 | GLM_LANG_EXT) # define GLM_LANG (GLM_LANG_CXX17 | GLM_LANG_EXT)

View File

@ -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) 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; 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; 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) 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; 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; 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) 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; 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; 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) 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; 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; 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) 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; 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; 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) 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; 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; return Result;
} }
}; };
# if GLM_ARCH & GLM_ARCH_AVX_BIT # if GLM_ARCH & GLM_ARCH_AVX_BIT
template<qualifier Q> template<qualifier Q>
struct compute_vec4_div<double, Q, true> struct compute_vec4_div<double, Q, true>
{ {
GLM_FUNC_QUALIFIER static vec<4, double, Q> call(vec<4, double, Q> const& a, vec<4, double, Q> const& b) 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; 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; 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) 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; 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; return Result;
} }
}; };
template<typename T, qualifier Q> template<qualifier Q>
struct compute_vec4_and<T, Q, true, 32, true> struct compute_vec4_and<int, Q, true, 32, true>
{ {
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; vec<4, int, Q> Result;
Result.data = _mm_and_si128((glm_f32vec4)a.data, (glm_f32vec4)b.data); Result.data = _mm_and_si128(a.data, b.data);
return Result;
}
};
template<qualifier Q>
struct compute_vec4_and<uint, Q, true, 32, true>
{
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; return Result;
} }
}; };
# if GLM_ARCH & GLM_ARCH_AVX2_BIT # if GLM_ARCH & GLM_ARCH_AVX2_BIT
template<typename T, qualifier Q> template<qualifier Q>
struct compute_vec4_and<T, Q, true, 64, true> struct compute_vec4_and<int64, Q, true, 64, true>
{ {
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; vec<4, int64, Q> Result;
Result.data = _mm256_and_si256((glm_f32vec4)a.data, (glm_f32vec4)b.data); Result.data = _mm256_and_si256(a.data, b.data);
return Result;
}
};
template<qualifier Q>
struct compute_vec4_and<uint64, Q, true, 64, true>
{
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; return Result;
} }
}; };
# endif # endif
template<typename T, qualifier Q> template<qualifier Q>
struct compute_vec4_or<T, Q, true, 32, true> struct compute_vec4_or<int, Q, true, 32, true>
{ {
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; vec<4, int, Q> Result;
Result.data = _mm_or_si128((glm_f32vec4)a.data, (glm_f32vec4)b.data); Result.data = _mm_or_si128(a.data, b.data);
return Result;
}
};
template<qualifier Q>
struct compute_vec4_or<uint, Q, true, 32, true>
{
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; return Result;
} }
}; };
# if GLM_ARCH & GLM_ARCH_AVX2_BIT # if GLM_ARCH & GLM_ARCH_AVX2_BIT
template<typename T, qualifier Q> template<qualifier Q>
struct compute_vec4_or<T, Q, true, 64, true> struct compute_vec4_or<int64, Q, true, 64, true>
{ {
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; vec<4, int64, Q> Result;
Result.data = _mm256_or_si256((glm_f32vec4)a.data, (glm_f32vec4)b.data); Result.data = _mm256_or_si256(a.data, b.data);
return Result;
}
};
template<qualifier Q>
struct compute_vec4_or<uint64, Q, true, 64, true>
{
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; return Result;
} }
}; };
# endif # endif
template<typename T, qualifier Q> template<qualifier Q>
struct compute_vec4_xor<T, Q, true, 32, true> struct compute_vec4_xor<int, Q, true, 32, true>
{ {
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; vec<4, int, Q> Result;
Result.data = _mm_xor_si128((glm_f32vec4)a.data, (glm_f32vec4)b.data); Result.data = _mm_xor_si128(a.data, b.data);
return Result;
}
};
template<qualifier Q>
struct compute_vec4_xor<uint, Q, true, 32, true>
{
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; return Result;
} }
}; };
# if GLM_ARCH & GLM_ARCH_AVX2_BIT # if GLM_ARCH & GLM_ARCH_AVX2_BIT
template<typename T, qualifier Q> template<qualifier Q>
struct compute_vec4_xor<T, Q, true, 64, true> struct compute_vec4_xor<int64, Q, true, 64, true>
{ {
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; vec<4, int64, Q> Result;
Result.data = _mm256_xor_si256((glm_f32vec4)a.data, (glm_f32vec4)b.data); Result.data = _mm256_xor_si256(a.data, b.data);
return Result;
}
};
template<qualifier Q>
struct compute_vec4_xor<uint64, Q, true, 64, true>
{
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; return Result;
} }
}; };
# endif # endif
template<typename T, qualifier Q> template<qualifier Q>
struct compute_vec4_shift_left<T, Q, true, 32, true> struct compute_vec4_shift_left<int, Q, true, 32, true>
{ {
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; vec<4, int, Q> Result;
Result.data = _mm_sll_epi32((glm_f32vec4)a.data, (glm_f32vec4)b.data); Result.data = _mm_sll_epi32(a.data, b.data);
return Result;
}
};
template<qualifier Q>
struct compute_vec4_shift_left<uint, Q, true, 32, true>
{
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; return Result;
} }
}; };
# if GLM_ARCH & GLM_ARCH_AVX2_BIT # if GLM_ARCH & GLM_ARCH_AVX2_BIT
template<typename T, qualifier Q> template<qualifier Q>
struct compute_vec4_shift_left<T, Q, true, 64, true> struct compute_vec4_shift_left<int64, Q, true, 64, true>
{ {
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; vec<4, int64, Q> Result;
Result.data = _mm256_sll_epi64((glm_f32vec4)a.data, (glm_f32vec4)b.data); Result.data = _mm256_sll_epi64(a.data, b.data);
return Result;
}
};
template<qualifier Q>
struct compute_vec4_shift_left<uint64, Q, true, 64, true>
{
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; return Result;
} }
}; };
# endif # endif
template<typename T, qualifier Q> template<qualifier Q>
struct compute_vec4_shift_right<T, Q, true, 32, true> struct compute_vec4_shift_right<int, Q, true, 32, true>
{ {
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; vec<4, int, Q> Result;
Result.data = _mm_srl_epi32((glm_f32vec4)a.data, (glm_f32vec4)b.data); Result.data = _mm_srl_epi32(a.data, b.data);
return Result;
}
};
template<qualifier Q>
struct compute_vec4_shift_right<uint, Q, true, 32, true>
{
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; return Result;
} }
}; };
# if GLM_ARCH & GLM_ARCH_AVX2_BIT # if GLM_ARCH & GLM_ARCH_AVX2_BIT
template<typename T, qualifier Q> template<qualifier Q>
struct compute_vec4_shift_right<T, Q, true, 64, true> struct compute_vec4_shift_right<int64, Q, true, 64, true>
{ {
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; vec<4, int64, Q> Result;
Result.data = _mm256_srl_epi64((glm_f32vec4)a.data, (glm_f32vec4)b.data); Result.data = _mm256_srl_epi64(a.data, b.data);
return Result;
}
};
template<qualifier Q>
struct compute_vec4_shift_right<uint64, Q, true, 64, true>
{
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; return Result;
} }
}; };
# endif # endif
template<typename T, qualifier Q> template<qualifier Q>
struct compute_vec4_bitwise_not<T, Q, true, 32, true> struct compute_vec4_bitwise_not<int, Q, true, 32, true>
{ {
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; vec<4, int, Q> Result;
Result.data = _mm_xor_si128((glm_f32vec4)v.data, _mm_set1_epi32(-1)); Result.data = _mm_xor_si128(v.data, _mm_set1_epi32(-1));
return Result;
}
};
template<qualifier Q>
struct compute_vec4_bitwise_not<uint, Q, true, 32, true>
{
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; return Result;
} }
}; };
# if GLM_ARCH & GLM_ARCH_AVX2_BIT # if GLM_ARCH & GLM_ARCH_AVX2_BIT
template<typename T, qualifier Q> template<qualifier Q>
struct compute_vec4_bitwise_not<T, Q, true, 64, true> struct compute_vec4_bitwise_not<int64, Q, true, 64, true>
{ {
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; vec<4, int64, Q> Result;
Result.data = _mm256_xor_si256((glm_f32vec4)v.data, _mm_set1_epi32(-1)); Result.data = _mm256_xor_si256(v.data, _mm_set1_epi32(-1));
return Result;
}
};
template<qualifier Q>
struct compute_vec4_bitwise_not<uint64, Q, true, 64, true>
{
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; 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) 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) 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; //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; 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) 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) 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; //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; return _mm_test_all_zeros(neq, neq) != 0;
} }
}; };

View File

@ -20,8 +20,6 @@
# endif # endif
#endif #endif
#include <functional>
#include "../vec2.hpp" #include "../vec2.hpp"
#include "../vec3.hpp" #include "../vec3.hpp"
#include "../vec4.hpp" #include "../vec4.hpp"
@ -43,100 +41,106 @@
#include "../mat4x4.hpp" #include "../mat4x4.hpp"
#if !GLM_HAS_CXX11_STL #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 #endif
#if 0 && GLM_LANG & GLM_LANG_CXX11
#define GLM_GTX_hash 1
#include <functional>
namespace std namespace std
{ {
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::vec<1, T,Q> > struct hash<glm::vec<1, T, Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::vec<1, T, Q> const& v) const GLM_NOEXCEPT; GLM_FUNC_DECL size_t operator()(glm::vec<1, T, Q> const& v) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::vec<2, T,Q> > struct hash<glm::vec<2, T, Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::vec<2, T, Q> const& v) const GLM_NOEXCEPT; GLM_FUNC_DECL size_t operator()(glm::vec<2, T, Q> const& v) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::vec<3, T,Q> > struct hash<glm::vec<3, T, Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::vec<3, T, Q> const& v) const GLM_NOEXCEPT; GLM_FUNC_DECL size_t operator()(glm::vec<3, T, Q> const& v) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::vec<4, T,Q> > struct hash<glm::vec<4, T, Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::vec<4, T, Q> const& v) const GLM_NOEXCEPT; GLM_FUNC_DECL size_t operator()(glm::vec<4, T, Q> const& v) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::qua<T,Q>> struct hash<glm::qua<T, Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::qua<T, Q> const& q) const GLM_NOEXCEPT; GLM_FUNC_DECL size_t operator()(glm::qua<T, Q> const& q) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::tdualquat<T,Q> > struct hash<glm::tdualquat<T, Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::tdualquat<T,Q> const& q) const GLM_NOEXCEPT; GLM_FUNC_DECL size_t operator()(glm::tdualquat<T,Q> const& q) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::mat<2, 2, T,Q> > struct hash<glm::mat<2, 2, T, Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::mat<2, 2, T,Q> const& m) const GLM_NOEXCEPT; GLM_FUNC_DECL size_t operator()(glm::mat<2, 2, T,Q> const& m) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::mat<2, 3, T,Q> > struct hash<glm::mat<2, 3, T, Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::mat<2, 3, T,Q> const& m) const GLM_NOEXCEPT; GLM_FUNC_DECL size_t operator()(glm::mat<2, 3, T,Q> const& m) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::mat<2, 4, T,Q> > struct hash<glm::mat<2, 4, T, Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::mat<2, 4, T,Q> const& m) const GLM_NOEXCEPT; GLM_FUNC_DECL size_t operator()(glm::mat<2, 4, T,Q> const& m) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::mat<3, 2, T,Q> > struct hash<glm::mat<3, 2, T, Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::mat<3, 2, T,Q> const& m) const GLM_NOEXCEPT; GLM_FUNC_DECL size_t operator()(glm::mat<3, 2, T,Q> const& m) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::mat<3, 3, T,Q> > struct hash<glm::mat<3, 3, T, Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::mat<3, 3, T,Q> const& m) const GLM_NOEXCEPT; GLM_FUNC_DECL size_t operator()(glm::mat<3, 3, T,Q> const& m) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::mat<3, 4, T,Q> > struct hash<glm::mat<3, 4, T, Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::mat<3, 4, T,Q> const& m) const GLM_NOEXCEPT; GLM_FUNC_DECL size_t operator()(glm::mat<3, 4, T,Q> const& m) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::mat<4, 2, T,Q> > struct hash<glm::mat<4, 2, T, Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::mat<4, 2, T,Q> const& m) const GLM_NOEXCEPT; GLM_FUNC_DECL size_t operator()(glm::mat<4, 2, T,Q> const& m) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::mat<4, 3, T,Q> > struct hash<glm::mat<4, 3, T, Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::mat<4, 3, T,Q> const& m) const GLM_NOEXCEPT; GLM_FUNC_DECL size_t operator()(glm::mat<4, 3, T,Q> const& m) const GLM_NOEXCEPT;
}; };
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
struct hash<glm::mat<4, 4, T,Q> > struct hash<glm::mat<4, 4, T, Q> >
{ {
GLM_FUNC_DECL size_t operator()(glm::mat<4, 4, T,Q> const& m) const GLM_NOEXCEPT; GLM_FUNC_DECL size_t operator()(glm::mat<4, 4, T,Q> const& m) const GLM_NOEXCEPT;
}; };
} // namespace std } // namespace std
#include "hash.inl" #include "hash.inl"
#endif //GLM_LANG & GLM_LANG_CXX11

View File

@ -13,14 +13,14 @@ namespace detail
namespace std namespace std
{ {
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
GLM_FUNC_QUALIFIER size_t hash<glm::vec<1, T, Q>>::operator()(glm::vec<1, T, Q> const& v) const GLM_NOEXCEPT GLM_FUNC_QUALIFIER size_t hash<glm::vec<1, T, Q> >::operator()(glm::vec<1, T, Q> const& v) const GLM_NOEXCEPT
{ {
hash<T> hasher; hash<T> hasher;
return hasher(v.x); return hasher(v.x);
} }
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
GLM_FUNC_QUALIFIER size_t hash<glm::vec<2, T, Q>>::operator()(glm::vec<2, T, Q> const& v) const GLM_NOEXCEPT GLM_FUNC_QUALIFIER size_t hash<glm::vec<2, T, Q> >::operator()(glm::vec<2, T, Q> const& v) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<T> hasher; hash<T> hasher;
@ -30,7 +30,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
GLM_FUNC_QUALIFIER size_t hash<glm::vec<3, T, Q>>::operator()(glm::vec<3, T, Q> const& v) const GLM_NOEXCEPT GLM_FUNC_QUALIFIER size_t hash<glm::vec<3, T, Q> >::operator()(glm::vec<3, T, Q> const& v) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<T> hasher; hash<T> hasher;
@ -41,7 +41,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
GLM_FUNC_QUALIFIER size_t hash<glm::vec<4, T, Q>>::operator()(glm::vec<4, T, Q> const& v) const GLM_NOEXCEPT GLM_FUNC_QUALIFIER size_t hash<glm::vec<4, T, Q> >::operator()(glm::vec<4, T, Q> const& v) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<T> hasher; hash<T> hasher;
@ -53,7 +53,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
GLM_FUNC_QUALIFIER size_t hash<glm::qua<T, Q>>::operator()(glm::qua<T,Q> const& q) const GLM_NOEXCEPT GLM_FUNC_QUALIFIER size_t hash<glm::qua<T, Q> >::operator()(glm::qua<T,Q> const& q) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<T> hasher; hash<T> hasher;
@ -65,7 +65,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
GLM_FUNC_QUALIFIER size_t hash<glm::tdualquat<T, Q>>::operator()(glm::tdualquat<T, Q> const& q) const GLM_NOEXCEPT GLM_FUNC_QUALIFIER size_t hash<glm::tdualquat<T, Q> >::operator()(glm::tdualquat<T, Q> const& q) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<glm::qua<T, Q>> hasher; hash<glm::qua<T, Q>> hasher;
@ -75,7 +75,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
GLM_FUNC_QUALIFIER size_t hash<glm::mat<2, 2, T, Q>>::operator()(glm::mat<2, 2, T, Q> const& m) const GLM_NOEXCEPT GLM_FUNC_QUALIFIER size_t hash<glm::mat<2, 2, T, Q> >::operator()(glm::mat<2, 2, T, Q> const& m) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<glm::vec<2, T, Q>> hasher; hash<glm::vec<2, T, Q>> hasher;
@ -85,7 +85,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
GLM_FUNC_QUALIFIER size_t hash<glm::mat<2, 3, T, Q>>::operator()(glm::mat<2, 3, T, Q> const& m) const GLM_NOEXCEPT GLM_FUNC_QUALIFIER size_t hash<glm::mat<2, 3, T, Q> >::operator()(glm::mat<2, 3, T, Q> const& m) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<glm::vec<3, T, Q>> hasher; hash<glm::vec<3, T, Q>> hasher;
@ -95,7 +95,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
GLM_FUNC_QUALIFIER size_t hash<glm::mat<2, 4, T, Q>>::operator()(glm::mat<2, 4, T, Q> const& m) const GLM_NOEXCEPT GLM_FUNC_QUALIFIER size_t hash<glm::mat<2, 4, T, Q> >::operator()(glm::mat<2, 4, T, Q> const& m) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<glm::vec<4, T, Q>> hasher; hash<glm::vec<4, T, Q>> hasher;
@ -105,7 +105,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
GLM_FUNC_QUALIFIER size_t hash<glm::mat<3, 2, T, Q>>::operator()(glm::mat<3, 2, T, Q> const& m) const GLM_NOEXCEPT GLM_FUNC_QUALIFIER size_t hash<glm::mat<3, 2, T, Q> >::operator()(glm::mat<3, 2, T, Q> const& m) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<glm::vec<2, T, Q>> hasher; hash<glm::vec<2, T, Q>> hasher;
@ -116,7 +116,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
GLM_FUNC_QUALIFIER size_t hash<glm::mat<3, 3, T, Q>>::operator()(glm::mat<3, 3, T, Q> const& m) const GLM_NOEXCEPT GLM_FUNC_QUALIFIER size_t hash<glm::mat<3, 3, T, Q> >::operator()(glm::mat<3, 3, T, Q> const& m) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<glm::vec<3, T, Q>> hasher; hash<glm::vec<3, T, Q>> hasher;
@ -127,7 +127,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
GLM_FUNC_QUALIFIER size_t hash<glm::mat<3, 4, T, Q>>::operator()(glm::mat<3, 4, T, Q> const& m) const GLM_NOEXCEPT GLM_FUNC_QUALIFIER size_t hash<glm::mat<3, 4, T, Q> >::operator()(glm::mat<3, 4, T, Q> const& m) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<glm::vec<4, T, Q>> hasher; hash<glm::vec<4, T, Q>> hasher;
@ -138,7 +138,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
GLM_FUNC_QUALIFIER size_t hash<glm::mat<4, 2, T,Q>>::operator()(glm::mat<4, 2, T,Q> const& m) const GLM_NOEXCEPT GLM_FUNC_QUALIFIER size_t hash<glm::mat<4, 2, T,Q> >::operator()(glm::mat<4, 2, T,Q> const& m) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<glm::vec<2, T, Q>> hasher; hash<glm::vec<2, T, Q>> hasher;
@ -150,7 +150,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
GLM_FUNC_QUALIFIER size_t hash<glm::mat<4, 3, T,Q>>::operator()(glm::mat<4, 3, T,Q> const& m) const GLM_NOEXCEPT GLM_FUNC_QUALIFIER size_t hash<glm::mat<4, 3, T,Q> >::operator()(glm::mat<4, 3, T,Q> const& m) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<glm::vec<3, T, Q>> hasher; hash<glm::vec<3, T, Q>> hasher;
@ -162,7 +162,7 @@ namespace std
} }
template<typename T, glm::qualifier Q> template<typename T, glm::qualifier Q>
GLM_FUNC_QUALIFIER size_t hash<glm::mat<4, 4, T,Q>>::operator()(glm::mat<4, 4, T, Q> const& m) const GLM_NOEXCEPT GLM_FUNC_QUALIFIER size_t hash<glm::mat<4, 4, T,Q> >::operator()(glm::mat<4, 4, T, Q> const& m) const GLM_NOEXCEPT
{ {
size_t seed = 0; size_t seed = 0;
hash<glm::vec<4, T, Q>> hasher; hash<glm::vec<4, T, Q>> hasher;

View File

@ -209,20 +209,20 @@ namespace detail
m *= glm::translate(translation); m *= glm::translate(translation);
m *= glm::mat4_cast(orientation); m *= glm::mat4_cast(orientation);
if (skew.x) { if (abs(skew.x) > static_cast<T>(0)) {
glm::mat4 tmp { 1.f }; glm::mat4 tmp(1.f);
tmp[2][1] = skew.x; tmp[2][1] = skew.x;
m *= tmp; m *= tmp;
} }
if (skew.y) { if (abs(skew.y) > static_cast<T>(0)) {
glm::mat4 tmp { 1.f }; glm::mat4 tmp(1.f);
tmp[2][0] = skew.y; tmp[2][0] = skew.y;
m *= tmp; m *= tmp;
} }
if (skew.z) { if (abs(skew.z) > static_cast<T>(0)) {
glm::mat4 tmp { 1.f }; glm::mat4 tmp(1.f);
tmp[1][0] = skew.z; tmp[1][0] = skew.z;
m *= tmp; m *= tmp;
} }

View File

@ -31,7 +31,7 @@ namespace detail
# if (GLM_COMPILER & GLM_COMPILER_VC) # if (GLM_COMPILER & GLM_COMPILER_VC)
vsprintf_s(text, STRING_BUFFER, msg, list); vsprintf_s(text, STRING_BUFFER, msg, list);
# else// # else//
std::vsprintf(text, msg, list); std::vsnprintf(text, STRING_BUFFER, msg, list);
# endif// # endif//
va_end(list); va_end(list);

View File

@ -11,7 +11,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(GLM_TEST_ENABLE_CXX_20) if(GLM_TEST_ENABLE_CXX_20)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
add_definitions(-DGLM_FORCE_CXX2A) add_definitions(-DGLM_FORCE_CXX20)
if(NOT GLM_QUIET) if(NOT GLM_QUIET)
message(STATUS "GLM: Build with C++20 features") message(STATUS "GLM: Build with C++20 features")
endif() endif()

View File

@ -70,7 +70,7 @@ static int test_abs()
glm::bvec4 const col2 = glm::equal(D[1], A[1]); glm::bvec4 const col2 = glm::equal(D[1], A[1]);
glm::bvec4 const col3 = glm::equal(D[2], A[2]); glm::bvec4 const col3 = glm::equal(D[2], A[2]);
glm::bvec4 const col4 = glm::equal(D[3], A[3]); 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( glm::mat4x3 A(
@ -91,7 +91,7 @@ static int test_abs()
glm::bvec3 const col2 = glm::equal(D[1], A[1]); glm::bvec3 const col2 = glm::equal(D[1], A[1]);
glm::bvec3 const col3 = glm::equal(D[2], A[2]); glm::bvec3 const col3 = glm::equal(D[2], A[2]);
glm::bvec3 const col4 = glm::equal(D[3], A[3]); 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( glm::mat4x2 A(
@ -112,7 +112,7 @@ static int test_abs()
glm::bvec2 const col2 = glm::equal(D[1], A[1]); glm::bvec2 const col2 = glm::equal(D[1], A[1]);
glm::bvec2 const col3 = glm::equal(D[2], A[2]); glm::bvec2 const col3 = glm::equal(D[2], A[2]);
glm::bvec2 const col4 = glm::equal(D[3], A[3]); 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 col1 = glm::equal(D[0], A[0]);
glm::bvec4 const col2 = glm::equal(D[1], A[1]); glm::bvec4 const col2 = glm::equal(D[1], A[1]);
glm::bvec4 const col3 = glm::equal(D[2], A[2]); 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( glm::mat3 A(
@ -152,7 +152,7 @@ static int test_abs()
glm::bvec3 const col1 = glm::equal(D[0], A[0]); glm::bvec3 const col1 = glm::equal(D[0], A[0]);
glm::bvec3 const col2 = glm::equal(D[1], A[1]); glm::bvec3 const col2 = glm::equal(D[1], A[1]);
glm::bvec3 const col3 = glm::equal(D[2], A[2]); 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( glm::mat3x2 A(
@ -170,7 +170,7 @@ static int test_abs()
glm::bvec2 const col1 = glm::equal(D[0], A[0]); glm::bvec2 const col1 = glm::equal(D[0], A[0]);
glm::bvec2 const col2 = glm::equal(D[1], A[1]); glm::bvec2 const col2 = glm::equal(D[1], A[1]);
glm::bvec2 const col3 = glm::equal(D[2], A[2]); 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::mat2x4 D = glm::abs(C);
glm::bvec4 const col1 = glm::equal(D[0], A[0]); glm::bvec4 const col1 = glm::equal(D[0], A[0]);
glm::bvec4 const col2 = glm::equal(D[1], A[1]); 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( glm::mat2x3 A(
@ -204,7 +204,7 @@ static int test_abs()
glm::mat2x3 D = glm::abs(C); glm::mat2x3 D = glm::abs(C);
glm::bvec3 const col1 = glm::equal(D[0], A[0]); glm::bvec3 const col1 = glm::equal(D[0], A[0]);
glm::bvec3 const col2 = glm::equal(D[1], A[1]); 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( glm::mat2 A(
@ -219,7 +219,7 @@ static int test_abs()
glm::mat2 D = glm::abs(C); glm::mat2 D = glm::abs(C);
glm::bvec2 const col1 = glm::equal(D[0], A[0]); glm::bvec2 const col1 = glm::equal(D[0], A[0]);
glm::bvec2 const col2 = glm::equal(D[1], A[1]); 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; return Error;

View File

@ -1,5 +1,7 @@
#define GLM_ENABLE_EXPERIMENTAL #define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/hash.hpp> #include <glm/gtx/hash.hpp>
#if defined(GLM_GTX_hash) && GLM_LANG & GLM_LANG_CXX11
#include <unordered_map> #include <unordered_map>
int test_compile() int test_compile()
@ -44,12 +46,15 @@ int test_compile()
return Error > 0 ? 0 : 1; return Error > 0 ? 0 : 1;
} }
#endif//GLM_LANG& GLM_LANG_CXX11
int main() int main()
{ {
int Error = 0; int Error = 0;
#if defined(GLM_GTX_hash)
Error += test_compile(); Error += test_compile();
#endif//
return Error; return Error;
} }