Added float unit tests

master
Christophe Riccio ago%!(EXTRA string=14 years)
parent 22a2cd5332
commit ee56c3a449
  1. 4
      glm/core/type_float.hpp
  2. 22
      test/core/core_type_float.cpp

@ -46,7 +46,7 @@ namespace glm
//! There is no guarantee on the actual precision. //! There is no guarantee on the actual precision.
//! From GLSL 1.30.8 specification //! From GLSL 1.30.8 specification
//! \ingroup core_precision //! \ingroup core_precision
typedef mediump_float_t mediump_float; typedef mediump_float_t mediump_float;
//! High precision floating-point numbers. //! High precision floating-point numbers.
//! There is no guarantee on the actual precision. //! There is no guarantee on the actual precision.
//! From GLSL 1.30.8 specification //! From GLSL 1.30.8 specification
@ -58,7 +58,7 @@ namespace glm
#if(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT)) #if(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
typedef precision::mediump_float float_t; typedef precision::mediump_float float_t;
#elif(defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT)) #elif(defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
typedef precision::highp_float float_t; typedef precision::highp_float float_t;
#elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT)) #elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
typedef precision::mediump_float float_t; typedef precision::mediump_float float_t;
#elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && defined(GLM_PRECISION_LOWP_FLOAT)) #elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && defined(GLM_PRECISION_LOWP_FLOAT))

@ -9,9 +9,29 @@
#include <glm/glm.hpp> #include <glm/glm.hpp>
int test_float_size()
{
return
sizeof(glm::float_t) != sizeof(glm::lowp_float) &&
sizeof(glm::float_t) != sizeof(glm::mediump_float) &&
sizeof(glm::float_t) != sizeof(glm::highp_float);
}
int test_float_precision()
{
return (
sizeof(glm::lowp_float) <= sizeof(glm::mediump_float) &&
sizeof(glm::mediump_float) <= sizeof(glm::highp_float)) ? 0 : 1;
}
int main() int main()
{ {
return -1; int Error = 0;
Error += test_float_size();
Error += test_float_precision();
return Error;
} }

Loading…
Cancel
Save