Improved GTC_type_precision and added issues regarding SIMD and constexpr interaction #653

This commit is contained in:
Christophe Riccio 2017-08-16 22:35:29 +02:00
parent cdb28edcaa
commit 22fe828159
5 changed files with 413 additions and 113 deletions

View File

@ -30,206 +30,372 @@ namespace glm
// -- *vec1 --
typedef vec<1, float, aligned_highp> aligned_highp_vec1;
/// 1 component vector aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
typedef vec<1, float, aligned_highp> aligned_highp_vec1;
/// 1 component vector aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
typedef vec<1, float, aligned_mediump> aligned_mediump_vec1;
/// 1 component vector aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
typedef vec<1, float, aligned_lowp> aligned_lowp_vec1;
/// 1 component vector aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.
typedef vec<1, double, aligned_highp> aligned_highp_dvec1;
/// 1 component vector aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
typedef vec<1, double, aligned_mediump> aligned_mediump_dvec1;
typedef vec<1, double, aligned_lowp> aligned_lowp_dvec1;
/// 1 component vector aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
typedef vec<1, double, aligned_lowp> aligned_lowp_dvec1;
/// 1 component vector aligned in memory of signed integer numbers.
typedef vec<1, int, aligned_highp> aligned_highp_ivec1;
typedef vec<1, int, aligned_mediump> aligned_mediump_ivec1;
/// 1 component vector aligned in memory of signed integer numbers.
typedef vec<1, int, aligned_mediump> aligned_mediump_ivec1;
/// 1 component vector aligned in memory of signed integer numbers.
typedef vec<1, int, aligned_lowp> aligned_lowp_ivec1;
/// 1 component vector aligned in memory of unsigned integer numbers.
typedef vec<1, uint, aligned_highp> aligned_highp_uvec1;
/// 1 component vector aligned in memory of unsigned integer numbers.
typedef vec<1, uint, aligned_mediump> aligned_mediump_uvec1;
/// 1 component vector aligned in memory of unsigned integer numbers.
typedef vec<1, uint, aligned_lowp> aligned_lowp_uvec1;
/// 1 component vector aligned in memory of bool values.
typedef vec<1, bool, aligned_highp> aligned_highp_bvec1;
/// 1 component vector aligned in memory of bool values.
typedef vec<1, bool, aligned_mediump> aligned_mediump_bvec1;
/// 1 component vector aligned in memory of bool values.
typedef vec<1, bool, aligned_lowp> aligned_lowp_bvec1;
/// 1 component vector tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
typedef vec<1, float, packed_highp> packed_highp_vec1;
/// 1 component vector tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
typedef vec<1, float, packed_mediump> packed_mediump_vec1;
/// 1 component vector tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
typedef vec<1, float, packed_lowp> packed_lowp_vec1;
typedef vec<1, double, packed_highp> packed_highp_dvec1;
/// 1 component vector tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.
typedef vec<1, double, packed_highp> packed_highp_dvec1;
/// 1 component vector tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
typedef vec<1, double, packed_mediump> packed_mediump_dvec1;
/// 1 component vector tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
typedef vec<1, double, packed_lowp> packed_lowp_dvec1;
/// 1 component vector tightly packed in memory of signed integer numbers.
typedef vec<1, int, packed_highp> packed_highp_ivec1;
/// 1 component vector tightly packed in memory of signed integer numbers.
typedef vec<1, int, packed_mediump> packed_mediump_ivec1;
typedef vec<1, int, packed_lowp> packed_lowp_ivec1;
/// 1 component vector tightly packed in memory of signed integer numbers.
typedef vec<1, int, packed_lowp> packed_lowp_ivec1;
/// 1 component vector tightly packed in memory of unsigned integer numbers.
typedef vec<1, uint, packed_highp> packed_highp_uvec1;
typedef vec<1, uint, packed_mediump> packed_mediump_uvec1;
/// 1 component vector tightly packed in memory of unsigned integer numbers.
typedef vec<1, uint, packed_mediump> packed_mediump_uvec1;
/// 1 component vector tightly packed in memory of unsigned integer numbers.
typedef vec<1, uint, packed_lowp> packed_lowp_uvec1;
/// 1 component vector tightly packed in memory of bool values.
typedef vec<1, bool, packed_highp> packed_highp_bvec1;
typedef vec<1, bool, packed_mediump> packed_mediump_bvec1;
/// 1 component vector tightly packed in memory of bool values.
typedef vec<1, bool, packed_mediump> packed_mediump_bvec1;
/// 1 component vector tightly packed in memory of bool values.
typedef vec<1, bool, packed_lowp> packed_lowp_bvec1;
// -- *vec2 --
/// 2 components vector of high single-qualifier floating-point numbers.
/// There is no guarantee on the actual qualifier.
typedef vec<2, float, aligned_highp> aligned_highp_vec2;
/// 2 components vector aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
typedef vec<2, float, aligned_highp> aligned_highp_vec2;
/// 2 components vector of medium single-qualifier floating-point numbers.
/// There is no guarantee on the actual qualifier.
/// 2 components vector aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
typedef vec<2, float, aligned_mediump> aligned_mediump_vec2;
/// 2 components vector of low single-qualifier floating-point numbers.
/// There is no guarantee on the actual qualifier.
/// 2 components vector aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
typedef vec<2, float, aligned_lowp> aligned_lowp_vec2;
/// 2 components vector of high double-qualifier floating-point numbers.
/// There is no guarantee on the actual qualifier.
/// 2 components vector aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.
typedef vec<2, double, aligned_highp> aligned_highp_dvec2;
/// 2 components vector of medium double-qualifier floating-point numbers.
/// There is no guarantee on the actual qualifier.
/// 2 components vector aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
typedef vec<2, double, aligned_mediump> aligned_mediump_dvec2;
/// 2 components vector of low double-qualifier floating-point numbers.
/// There is no guarantee on the actual qualifier.
typedef vec<2, double, aligned_lowp> aligned_lowp_dvec2;
/// 2 components vector aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
typedef vec<2, double, aligned_lowp> aligned_lowp_dvec2;
/// 2 components vector of high qualifier signed integer numbers.
/// There is no guarantee on the actual qualifier.
/// 2 components vector aligned in memory of signed integer numbers.
typedef vec<2, int, aligned_highp> aligned_highp_ivec2;
/// 2 components vector of medium qualifier signed integer numbers.
/// There is no guarantee on the actual qualifier.
typedef vec<2, int, aligned_mediump> aligned_mediump_ivec2;
/// 2 components vector aligned in memory of signed integer numbers.
typedef vec<2, int, aligned_mediump> aligned_mediump_ivec2;
/// 2 components vector of low qualifier signed integer numbers.
/// There is no guarantee on the actual qualifier.
/// 2 components vector aligned in memory of signed integer numbers.
typedef vec<2, int, aligned_lowp> aligned_lowp_ivec2;
/// 2 components vector of high qualifier unsigned integer numbers.
/// There is no guarantee on the actual qualifier.
/// 2 components vector aligned in memory of unsigned integer numbers.
typedef vec<2, uint, aligned_highp> aligned_highp_uvec2;
/// 2 components vector of medium qualifier unsigned integer numbers.
/// There is no guarantee on the actual qualifier.
/// 2 components vector aligned in memory of unsigned integer numbers.
typedef vec<2, uint, aligned_mediump> aligned_mediump_uvec2;
/// 2 components vector of low qualifier unsigned integer numbers.
/// There is no guarantee on the actual qualifier.
/// 2 components vector aligned in memory of unsigned integer numbers.
typedef vec<2, uint, aligned_lowp> aligned_lowp_uvec2;
/// 2 components vector of high qualifier bool numbers.
/// There is no guarantee on the actual qualifier.
/// 2 components vector aligned in memory of bool values.
typedef vec<2, bool, aligned_highp> aligned_highp_bvec2;
/// 2 components vector of medium qualifier bool numbers.
/// There is no guarantee on the actual qualifier.
/// 2 components vector aligned in memory of bool values.
typedef vec<2, bool, aligned_mediump> aligned_mediump_bvec2;
/// 2 components vector of low qualifier bool numbers.
/// There is no guarantee on the actual qualifier.
/// 2 components vector aligned in memory of bool values.
typedef vec<2, bool, aligned_lowp> aligned_lowp_bvec2;
/// 2 components vector tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
typedef vec<2, float, packed_highp> packed_highp_vec2;
/// 2 components vector tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
typedef vec<2, float, packed_mediump> packed_mediump_vec2;
/// 2 components vector tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
typedef vec<2, float, packed_lowp> packed_lowp_vec2;
/// 2 components vector tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.
typedef vec<2, double, packed_highp> packed_highp_dvec2;
/// 2 components vector tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
typedef vec<2, double, packed_mediump> packed_mediump_dvec2;
/// 2 components vector tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
typedef vec<2, double, packed_lowp> packed_lowp_dvec2;
/// 2 components vector tightly packed in memory of signed integer numbers.
typedef vec<2, int, packed_highp> packed_highp_ivec2;
/// 2 components vector tightly packed in memory of signed integer numbers.
typedef vec<2, int, packed_mediump> packed_mediump_ivec2;
/// 2 components vector tightly packed in memory of signed integer numbers.
typedef vec<2, int, packed_lowp> packed_lowp_ivec2;
/// 2 components vector tightly packed in memory of unsigned integer numbers.
typedef vec<2, uint, packed_highp> packed_highp_uvec2;
/// 2 components vector tightly packed in memory of unsigned integer numbers.
typedef vec<2, uint, packed_mediump> packed_mediump_uvec2;
/// 2 components vector tightly packed in memory of unsigned integer numbers.
typedef vec<2, uint, packed_lowp> packed_lowp_uvec2;
/// 2 components vector tightly packed in memory of bool values.
typedef vec<2, bool, packed_highp> packed_highp_bvec2;
/// 2 components vector tightly packed in memory of bool values.
typedef vec<2, bool, packed_mediump> packed_mediump_bvec2;
/// 2 components vector tightly packed in memory of bool values.
typedef vec<2, bool, packed_lowp> packed_lowp_bvec2;
// -- *vec3 --
/// 3 components vector of high single-qualifier floating-point numbers.
/// There is no guarantee on the actual qualifier.
typedef vec<3, float, aligned_highp> aligned_highp_vec3;
/// 3 components vector aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
typedef vec<3, float, aligned_highp> aligned_highp_vec3;
/// 3 components vector of medium single-qualifier floating-point numbers.
/// There is no guarantee on the actual qualifier.
/// 3 components vector aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
typedef vec<3, float, aligned_mediump> aligned_mediump_vec3;
/// 3 components vector of low single-qualifier floating-point numbers.
/// There is no guarantee on the actual qualifier.
/// 3 components vector aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
typedef vec<3, float, aligned_lowp> aligned_lowp_vec3;
/// 3 components vector of high double-qualifier floating-point numbers.
/// There is no guarantee on the actual qualifier.
/// 3 components vector aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.
typedef vec<3, double, aligned_highp> aligned_highp_dvec3;
/// 3 components vector of medium double-qualifier floating-point numbers.
/// There is no guarantee on the actual qualifier.
/// 3 components vector aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
typedef vec<3, double, aligned_mediump> aligned_mediump_dvec3;
/// 3 components vector of low double-qualifier floating-point numbers.
/// There is no guarantee on the actual qualifier.
typedef vec<3, double, aligned_lowp> aligned_lowp_dvec3;
/// 3 components vector aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
typedef vec<3, double, aligned_lowp> aligned_lowp_dvec3;
/// 3 components vector of high qualifier signed integer numbers.
/// There is no guarantee on the actual qualifier.
/// 3 components vector aligned in memory of signed integer numbers.
typedef vec<3, int, aligned_highp> aligned_highp_ivec3;
/// 3 components vector of medium qualifier signed integer numbers.
/// There is no guarantee on the actual qualifier.
typedef vec<3, int, aligned_mediump> aligned_mediump_ivec3;
/// 3 components vector aligned in memory of signed integer numbers.
typedef vec<3, int, aligned_mediump> aligned_mediump_ivec3;
/// 3 components vector of low qualifier signed integer numbers.
/// There is no guarantee on the actual qualifier.
/// 3 components vector aligned in memory of signed integer numbers.
typedef vec<3, int, aligned_lowp> aligned_lowp_ivec3;
/// 3 components vector of high qualifier unsigned integer numbers.
/// There is no guarantee on the actual qualifier.
/// 3 components vector aligned in memory of unsigned integer numbers.
typedef vec<3, uint, aligned_highp> aligned_highp_uvec3;
/// 3 components vector of medium qualifier unsigned integer numbers.
/// There is no guarantee on the actual qualifier.
/// 3 components vector aligned in memory of unsigned integer numbers.
typedef vec<3, uint, aligned_mediump> aligned_mediump_uvec3;
/// 3 components vector of low qualifier unsigned integer numbers.
/// There is no guarantee on the actual qualifier.
/// 3 components vector aligned in memory of unsigned integer numbers.
typedef vec<3, uint, aligned_lowp> aligned_lowp_uvec3;
/// 3 components vector of high qualifier bool numbers.
/// 3 components vector aligned in memory of bool values.
typedef vec<3, bool, aligned_highp> aligned_highp_bvec3;
/// 3 components vector of medium qualifier bool numbers.
/// 3 components vector aligned in memory of bool values.
typedef vec<3, bool, aligned_mediump> aligned_mediump_bvec3;
/// 3 components vector of low qualifier bool numbers.
/// 3 components vector aligned in memory of bool values.
typedef vec<3, bool, aligned_lowp> aligned_lowp_bvec3;
/// 3 components vector tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
typedef vec<3, float, packed_highp> packed_highp_vec3;
/// 3 components vector tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
typedef vec<3, float, packed_mediump> packed_mediump_vec3;
/// 3 components vector tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
typedef vec<3, float, packed_lowp> packed_lowp_vec3;
/// 3 components vector tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.
typedef vec<3, double, packed_highp> packed_highp_dvec3;
/// 3 components vector tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
typedef vec<3, double, packed_mediump> packed_mediump_dvec3;
/// 3 components vector tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
typedef vec<3, double, packed_lowp> packed_lowp_dvec3;
/// 3 components vector tightly packed in memory of signed integer numbers.
typedef vec<3, int, packed_highp> packed_highp_ivec3;
/// 3 components vector tightly packed in memory of signed integer numbers.
typedef vec<3, int, packed_mediump> packed_mediump_ivec3;
/// 3 components vector tightly packed in memory of signed integer numbers.
typedef vec<3, int, packed_lowp> packed_lowp_ivec3;
/// 3 components vector tightly packed in memory of unsigned integer numbers.
typedef vec<3, uint, packed_highp> packed_highp_uvec3;
/// 3 components vector tightly packed in memory of unsigned integer numbers.
typedef vec<3, uint, packed_mediump> packed_mediump_uvec3;
/// 3 components vector tightly packed in memory of unsigned integer numbers.
typedef vec<3, uint, packed_lowp> packed_lowp_uvec3;
/// 3 components vector tightly packed in memory of bool values.
typedef vec<3, bool, packed_highp> packed_highp_bvec3;
/// 3 components vector tightly packed in memory of bool values.
typedef vec<3, bool, packed_mediump> packed_mediump_bvec3;
/// 3 components vector tightly packed in memory of bool values.
typedef vec<3, bool, packed_lowp> packed_lowp_bvec3;
// -- *vec4 --
/// 4 components vector of high single-qualifier floating-point numbers.
typedef vec<4, float, aligned_highp> aligned_highp_vec4;
/// 4 components vector aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
typedef vec<4, float, aligned_highp> aligned_highp_vec4;
/// 4 components vector of medium single-qualifier floating-point numbers.
/// 4 components vector aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
typedef vec<4, float, aligned_mediump> aligned_mediump_vec4;
/// 4 components vector of low single-qualifier floating-point numbers.
/// 4 components vector aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
typedef vec<4, float, aligned_lowp> aligned_lowp_vec4;
/// 4 components vector of high double-qualifier floating-point numbers.
/// 4 components vector aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.
typedef vec<4, double, aligned_highp> aligned_highp_dvec4;
/// 4 components vector of medium double-qualifier floating-point numbers.
/// 4 components vector aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
typedef vec<4, double, aligned_mediump> aligned_mediump_dvec4;
/// 4 components vector of low double-qualifier floating-point numbers.
typedef vec<4, double, aligned_lowp> aligned_lowp_dvec4;
/// 4 components vector aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
typedef vec<4, double, aligned_lowp> aligned_lowp_dvec4;
/// 4 components vector of high qualifier signed integer numbers.
/// 4 components vector aligned in memory of signed integer numbers.
typedef vec<4, int, aligned_highp> aligned_highp_ivec4;
/// 4 components vector of medium qualifier signed integer numbers.
typedef vec<4, int, aligned_mediump> aligned_mediump_ivec4;
/// 4 components vector aligned in memory of signed integer numbers.
typedef vec<4, int, aligned_mediump> aligned_mediump_ivec4;
/// 4 components vector of low qualifier signed integer numbers.
/// 4 components vector aligned in memory of signed integer numbers.
typedef vec<4, int, aligned_lowp> aligned_lowp_ivec4;
/// 4 components vector of high qualifier unsigned integer numbers.
/// 4 components vector aligned in memory of unsigned integer numbers.
typedef vec<4, uint, aligned_highp> aligned_highp_uvec4;
/// 4 components vector of medium qualifier unsigned integer numbers.
/// 4 components vector aligned in memory of unsigned integer numbers.
typedef vec<4, uint, aligned_mediump> aligned_mediump_uvec4;
/// 4 components vector of low qualifier unsigned integer numbers.
/// 4 components vector aligned in memory of unsigned integer numbers.
typedef vec<4, uint, aligned_lowp> aligned_lowp_uvec4;
/// 4 components vector of high qualifier bool numbers.
/// 4 components vector aligned in memory of bool values.
typedef vec<4, bool, aligned_highp> aligned_highp_bvec4;
/// 4 components vector of medium qualifier bool numbers.
/// 4 components vector aligned in memory of bool values.
typedef vec<4, bool, aligned_mediump> aligned_mediump_bvec4;
/// 4 components vector of low qualifier bool numbers.
/// 4 components vector aligned in memory of bool values.
typedef vec<4, bool, aligned_lowp> aligned_lowp_bvec4;
/// 4 components vector tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
typedef vec<4, float, packed_highp> packed_highp_vec4;
/// 4 components vector tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
typedef vec<4, float, packed_mediump> packed_mediump_vec4;
/// 4 components vector tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
typedef vec<4, float, packed_lowp> packed_lowp_vec4;
/// 4 components vector tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.
typedef vec<4, double, packed_highp> packed_highp_dvec4;
/// 4 components vector tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
typedef vec<4, double, packed_mediump> packed_mediump_dvec4;
/// 4 components vector tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
typedef vec<4, double, packed_lowp> packed_lowp_dvec4;
/// 4 components vector tightly packed in memory of signed integer numbers.
typedef vec<4, int, packed_highp> packed_highp_ivec4;
/// 4 components vector tightly packed in memory of signed integer numbers.
typedef vec<4, int, packed_mediump> packed_mediump_ivec4;
/// 4 components vector tightly packed in memory of signed integer numbers.
typedef vec<4, int, packed_lowp> packed_lowp_ivec4;
/// 4 components vector tightly packed in memory of unsigned integer numbers.
typedef vec<4, uint, packed_highp> packed_highp_uvec4;
/// 4 components vector tightly packed in memory of unsigned integer numbers.
typedef vec<4, uint, packed_mediump> packed_mediump_uvec4;
/// 4 components vector tightly packed in memory of unsigned integer numbers.
typedef vec<4, uint, packed_lowp> packed_lowp_uvec4;
/// 4 components vector tightly packed in memory of bool values.
typedef vec<4, bool, packed_highp> packed_highp_bvec4;
/// 4 components vector tightly packed in memory of bool values.
typedef vec<4, bool, packed_mediump> packed_mediump_bvec4;
/// 4 components vector tightly packed in memory of bool values.
typedef vec<4, bool, packed_lowp> packed_lowp_bvec4;
// -- default --
#if(defined(GLM_PRECISION_LOWP_FLOAT))
@ -237,23 +403,43 @@ namespace glm
typedef aligned_lowp_vec2 aligned_vec2;
typedef aligned_lowp_vec3 aligned_vec3;
typedef aligned_lowp_vec4 aligned_vec4;
typedef packed_lowp_vec1 packed_vec1;
typedef packed_lowp_vec2 packed_vec2;
typedef packed_lowp_vec3 packed_vec3;
typedef packed_lowp_vec4 packed_vec4;
#elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))
typedef aligned_mediump_vec1 aligned_vec1;
typedef aligned_mediump_vec2 aligned_vec2;
typedef aligned_mediump_vec3 aligned_vec3;
typedef aligned_mediump_vec4 aligned_vec4;
typedef packed_mediump_vec1 packed_vec1;
typedef packed_mediump_vec2 packed_vec2;
typedef packed_mediump_vec3 packed_vec3;
typedef packed_mediump_vec4 packed_vec4;
#else //defined(GLM_PRECISION_HIGHP_FLOAT)
/// 1 component vector of floating-point numbers.
/// 1 component vector aligned in memory of single-precision floating-point numbers.
typedef aligned_highp_vec1 aligned_vec1;
/// 2 components vector of floating-point numbers.
/// 2 components vector aligned in memory of single-precision floating-point numbers.
typedef aligned_highp_vec2 aligned_vec2;
/// 3 components vector of floating-point numbers.
/// 3 components vector aligned in memory of single-precision floating-point numbers.
typedef aligned_highp_vec3 aligned_vec3;
/// 4 components vector of floating-point numbers.
/// 4 components vector aligned in memory of single-precision floating-point numbers.
typedef aligned_highp_vec4 aligned_vec4;
/// 1 component vector tightly packed in memory of single-precision floating-point numbers.
typedef packed_highp_vec1 packed_vec1;
/// 2 components vector tightly packed in memory of single-precision floating-point numbers.
typedef packed_highp_vec2 packed_vec2;
/// 3 components vector tightly packed in memory of single-precision floating-point numbers.
typedef packed_highp_vec3 packed_vec3;
/// 4 components vector tightly packed in memory of single-precision floating-point numbers.
typedef packed_highp_vec4 packed_vec4;
#endif//GLM_PRECISION
#if(defined(GLM_PRECISION_LOWP_DOUBLE))
@ -261,23 +447,43 @@ namespace glm
typedef aligned_lowp_dvec2 aligned_dvec2;
typedef aligned_lowp_dvec3 aligned_dvec3;
typedef aligned_lowp_dvec4 aligned_dvec4;
typedef packed_lowp_dvec1 packed_dvec1;
typedef packed_lowp_dvec2 packed_dvec2;
typedef packed_lowp_dvec3 packed_dvec3;
typedef packed_lowp_dvec4 packed_dvec4;
#elif(defined(GLM_PRECISION_MEDIUMP_DOUBLE))
typedef aligned_mediump_dvec1 aligned_dvec1;
typedef aligned_mediump_dvec2 aligned_dvec2;
typedef aligned_mediump_dvec3 aligned_dvec3;
typedef aligned_mediump_dvec4 aligned_dvec4;
typedef packed_mediump_dvec1 packed_dvec1;
typedef packed_mediump_dvec2 packed_dvec2;
typedef packed_mediump_dvec3 packed_dvec3;
typedef packed_mediump_dvec4 packed_dvec4;
#else //defined(GLM_PRECISION_HIGHP_DOUBLE)
/// 1 component vector of double-qualifier floating-point numbers.
/// 1 component vector aligned in memory of double-precision floating-point numbers.
typedef aligned_highp_dvec1 aligned_dvec1;
/// 2 components vector of double-qualifier floating-point numbers.
/// 2 components vector aligned in memory of double-precision floating-point numbers.
typedef aligned_highp_dvec2 aligned_dvec2;
/// 3 components vector of double-qualifier floating-point numbers.
/// 3 components vector aligned in memory of double-precision floating-point numbers.
typedef aligned_highp_dvec3 aligned_dvec3;
/// 4 components vector of double-qualifier floating-point numbers.
/// 4 components vector aligned in memory of double-precision floating-point numbers.
typedef aligned_highp_dvec4 aligned_dvec4;
/// 1 component vector tightly packed in memory of double-precision floating-point numbers.
typedef packed_highp_dvec1 packed_dvec1;
/// 2 components vector tightly packed in memory of double-precision floating-point numbers.
typedef packed_highp_dvec2 packed_dvec2;
/// 3 components vector tightly packed in memory of double-precision floating-point numbers.
typedef packed_highp_dvec3 packed_dvec3;
/// 4 components vector tightly packed in memory of double-precision floating-point numbers.
typedef packed_highp_dvec4 packed_dvec4;
#endif//GLM_PRECISION
#if(defined(GLM_PRECISION_LOWP_INT))
@ -291,17 +497,30 @@ namespace glm
typedef aligned_mediump_ivec3 aligned_ivec3;
typedef aligned_mediump_ivec4 aligned_ivec4;
#else //defined(GLM_PRECISION_HIGHP_INT)
/// 1 component vector of signed integer numbers.
/// 1 component vector aligned in memory of signed integer numbers.
typedef aligned_highp_ivec1 aligned_ivec1;
/// 2 components vector of signed integer numbers.
/// 2 components vector aligned in memory of signed integer numbers.
typedef aligned_highp_ivec2 aligned_ivec2;
/// 3 components vector of signed integer numbers.
/// 3 components vector aligned in memory of signed integer numbers.
typedef aligned_highp_ivec3 aligned_ivec3;
/// 4 components vector of signed integer numbers.
/// 4 components vector aligned in memory of signed integer numbers.
typedef aligned_highp_ivec4 aligned_ivec4;
/// 1 component vector tightly packed in memory of signed integer numbers.
typedef packed_highp_ivec1 packed_ivec1;
/// 2 components vector tightly packed in memory of signed integer numbers.
typedef packed_highp_ivec2 packed_ivec2;
/// 3 components vector tightly packed in memory of signed integer numbers.
typedef packed_highp_ivec3 packed_ivec3;
/// 4 components vector tightly packed in memory of signed integer numbers.
typedef packed_highp_ivec4 packed_ivec4;
#endif//GLM_PRECISION
// -- Unsigned integer definition --
@ -317,17 +536,29 @@ namespace glm
typedef aligned_mediump_uvec3 aligned_uvec3;
typedef aligned_mediump_uvec4 aligned_uvec4;
#else //defined(GLM_PRECISION_HIGHP_UINT)
/// 1 component vector of unsigned integer numbers.
/// 1 component vector aligned in memory of unsigned integer numbers.
typedef aligned_highp_uvec1 aligned_uvec1;
/// 2 components vector of unsigned integer numbers.
/// 2 components vector aligned in memory of unsigned integer numbers.
typedef aligned_highp_uvec2 aligned_uvec2;
/// 3 components vector of unsigned integer numbers.
/// 3 components vector aligned in memory of unsigned integer numbers.
typedef aligned_highp_uvec3 aligned_uvec3;
/// 4 components vector of unsigned integer numbers.
/// 4 components vector aligned in memory of unsigned integer numbers.
typedef aligned_highp_uvec4 aligned_uvec4;
/// 1 component vector tightly packed in memory of unsigned integer numbers.
typedef packed_highp_uvec1 packed_uvec1;
/// 2 components vector tightly packed in memory of unsigned integer numbers.
typedef packed_highp_uvec2 packed_uvec2;
/// 3 components vector tightly packed in memory of unsigned integer numbers.
typedef packed_highp_uvec3 packed_uvec3;
/// 4 components vector tightly packed in memory of unsigned integer numbers.
typedef packed_highp_uvec4 packed_uvec4;
#endif//GLM_PRECISION
#if(defined(GLM_PRECISION_LOWP_BOOL))
@ -341,17 +572,29 @@ namespace glm
typedef aligned_mediump_bvec3 aligned_bvec3;
typedef aligned_mediump_bvec4 aligned_bvec4;
#else //defined(GLM_PRECISION_HIGHP_BOOL)
/// 1 component vector of boolean.
/// 1 component vector aligned in memory of bool values.
typedef aligned_highp_bvec1 aligned_bvec1;
/// 2 components vector of boolean.
/// 2 components vector aligned in memory of bool values.
typedef aligned_highp_bvec2 aligned_bvec2;
/// 3 components vector of boolean.
/// 3 components vector aligned in memory of bool values.
typedef aligned_highp_bvec3 aligned_bvec3;
/// 4 components vector of boolean.
/// 4 components vector aligned in memory of bool values.
typedef aligned_highp_bvec4 aligned_bvec4;
/// 1 components vector tightly packed in memory of bool values.
typedef packed_highp_bvec1 packed_bvec1;
/// 2 components vector tightly packed in memory of bool values.
typedef packed_highp_bvec2 packed_bvec2;
/// 3 components vector tightly packed in memory of bool values.
typedef packed_highp_bvec3 packed_bvec3;
/// 4 components vector tightly packed in memory of bool values.
typedef packed_highp_bvec4 packed_bvec4;
#endif//GLM_PRECISION
/// @}

View File

@ -842,7 +842,6 @@ namespace glm
/// @see gtc_type_precision
typedef mat<4, 4, f64, defaultp> f64mat4x4;
//////////////////////////
// Quaternion types

View File

@ -65,6 +65,7 @@
+ [7.10. Why some GLM functions can crash because of division by zero?](#section7_10)
+ [7.11. What unit for angles us used in GLM?](#section7_11)
+ [7.12. Windows headers cause build errors...](#section7_12)
+ [7.13. Constant expressions support](#section7_13)
+ [8. Code samples](#section8)
+ [8.1. Compute a triangle normal](#section8_1)
+ [8.2. Matrix transform](#section8_2)
@ -1092,6 +1093,11 @@ Some Windows headers define min and max as macros which may cause compatibility
It is highly recommended to [define NOMINMAX](http://stackoverflow.com/questions/4913922/possible-problems-with-nominmax-on-visual-c) before including Windows headers to workaround this issue.
To workaround the incompatibility with these macros, GLM will systematically undef these macros if they are defined.
### <a name="section7_13"></a> 7.13. Constant expressions support
GLM has some C++ <a href="http://en.cppreference.com/w/cpp/language/constexpr">constant expressions</a> support. However, GLM automatically detects the use of SIMD instruction sets through compiler arguments to populate its implementation with SIMD intrinsics.
Unfortunately, GCC and Clang doesn't support SIMD instrinsics as constant expressions. To allow constant expressions on all vectors and matrices types, define GLM\_FORCE\_PURE before including GLM headers.
---
## <a name="section8"></a> 8. Code samples

View File

@ -104,6 +104,17 @@ static int test_vec4_ctor()
}
#endif// GLM_HAS_UNRESTRICTED_UNIONS && defined(GLM_FORCE_SWIZZLE)
# if GLM_HAS_CONSTEXPR && GLM_ARCH == GLM_ARCH_PURE
{
constexpr glm::ivec4 v(1);
Error += v.x == 1 ? 0 : 1;
Error += v.y == 1 ? 0 : 1;
Error += v.z == 1 ? 0 : 1;
Error += v.w == 1 ? 0 : 1;
}
# endif
{
glm::vec4 A(1);
glm::vec4 B(1, 1, 1, 1);
@ -577,11 +588,14 @@ int main()
*/
# ifdef NDEBUG
std::size_t const Size(1000000);
Error += test_vec4_perf_AoS(Size);
Error += test_vec4_perf_SoA(Size);
std::size_t const Size(1000000);
# else
std::size_t const Size(1);
# endif//NDEBUG
Error += test_vec4_perf_AoS(Size);
Error += test_vec4_perf_SoA(Size);
Error += test_vec4_ctor();
Error += test_bvec4_ctor();
Error += test_vec4_size();

View File

@ -60,7 +60,7 @@ struct my_u8vec4_packed
};
GLM_STATIC_ASSERT(sizeof(my_u8vec4_packed) == sizeof(glm::uint32) + sizeof(glm::u8vec4), "glm::u8vec4 packed is not correct");
int test_copy()
static int test_copy()
{
int Error = 0;
@ -90,6 +90,42 @@ int test_copy()
return Error;
}
static int test_ctor()
{
int Error = 0;
# if GLM_HAS_CONSTEXPR && GLM_ARCH == GLM_ARCH_PURE
{
constexpr glm::aligned_ivec4 v(1);
Error += v.x == 1 ? 0 : 1;
Error += v.y == 1 ? 0 : 1;
Error += v.z == 1 ? 0 : 1;
Error += v.w == 1 ? 0 : 1;
}
{
constexpr glm::packed_ivec4 v(1);
Error += v.x == 1 ? 0 : 1;
Error += v.y == 1 ? 0 : 1;
Error += v.z == 1 ? 0 : 1;
Error += v.w == 1 ? 0 : 1;
}
{
constexpr glm::ivec4 v(1);
Error += v.x == 1 ? 0 : 1;
Error += v.y == 1 ? 0 : 1;
Error += v.z == 1 ? 0 : 1;
Error += v.w == 1 ? 0 : 1;
}
# endif
return Error;
}
int main()
{
int Error = 0;
@ -105,6 +141,8 @@ int main()
std::size_t B1 = sizeof(my_vec4_packed);
std::size_t C1 = sizeof(glm::aligned_vec4);
Error += test_ctor();
return Error;
}