core_setup_precision.cpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. ///////////////////////////////////////////////////////////////////////////////////////////////////
  2. // OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
  3. ///////////////////////////////////////////////////////////////////////////////////////////////////
  4. // Created : 2011-05-31
  5. // Updated : 2011-05-31
  6. // Licence : This source is under MIT License
  7. // File : test/core/setup_precision_highp.cpp
  8. ///////////////////////////////////////////////////////////////////////////////////////////////////
  9. #define GLM_FORCE_INLINE
  10. #define GLM_PRECISION_HIGHP_FLOAT
  11. #include <glm/glm.hpp>
  12. #include <glm/ext.hpp>
  13. static int test_mat()
  14. {
  15. int Error = 0;
  16. Error += sizeof(glm::mat2) == sizeof(glm::highp_mat2) ? 0 : 1;
  17. Error += sizeof(glm::mat3) == sizeof(glm::highp_mat3) ? 0 : 1;
  18. Error += sizeof(glm::mat4) == sizeof(glm::highp_mat4) ? 0 : 1;
  19. Error += sizeof(glm::mat2x2) == sizeof(glm::highp_mat2x2) ? 0 : 1;
  20. Error += sizeof(glm::mat2x3) == sizeof(glm::highp_mat2x3) ? 0 : 1;
  21. Error += sizeof(glm::mat2x4) == sizeof(glm::highp_mat2x4) ? 0 : 1;
  22. Error += sizeof(glm::mat3x2) == sizeof(glm::highp_mat3x2) ? 0 : 1;
  23. Error += sizeof(glm::mat3x3) == sizeof(glm::highp_mat3x3) ? 0 : 1;
  24. Error += sizeof(glm::mat3x4) == sizeof(glm::highp_mat3x4) ? 0 : 1;
  25. Error += sizeof(glm::mat4x2) == sizeof(glm::highp_mat4x2) ? 0 : 1;
  26. Error += sizeof(glm::mat4x3) == sizeof(glm::highp_mat4x3) ? 0 : 1;
  27. Error += sizeof(glm::mat4x4) == sizeof(glm::highp_mat4x4) ? 0 : 1;
  28. return Error;
  29. }
  30. static int test_vec()
  31. {
  32. int Error = 0;
  33. Error += sizeof(glm::vec2) == sizeof(glm::highp_vec2) ? 0 : 1;
  34. Error += sizeof(glm::vec3) == sizeof(glm::highp_vec3) ? 0 : 1;
  35. Error += sizeof(glm::vec4) == sizeof(glm::highp_vec4) ? 0 : 1;
  36. return Error;
  37. }
  38. static int test_dvec()
  39. {
  40. int Error = 0;
  41. Error += sizeof(glm::dvec2) == sizeof(glm::highp_dvec2) ? 0 : 1;
  42. Error += sizeof(glm::dvec3) == sizeof(glm::highp_dvec3) ? 0 : 1;
  43. Error += sizeof(glm::dvec4) == sizeof(glm::highp_dvec4) ? 0 : 1;
  44. return Error;
  45. }
  46. int main()
  47. {
  48. int Error = 0;
  49. Error += test_mat();
  50. Error += test_vec();
  51. Error += test_dvec();
  52. return Error;
  53. }