Refactor configuration macros

This commit is contained in:
Groove
2018-07-31 23:05:48 +02:00
parent 3b938d55b9
commit fbf3f2016f
50 changed files with 323 additions and 333 deletions

View File

@@ -1,6 +1,6 @@
#include <glm/glm.hpp>
#if GLM_USE_ANONYMOUS_STRUCT == GLM_ENABLE
#if GLM_CONFIG_ANONYMOUS_STRUCT == GLM_ENABLE
struct vec2;
struct _swizzle

View File

@@ -1,6 +1,6 @@
#include <glm/glm.hpp>
#if GLM_USE_CONSTEXP == GLM_ENABLE
#if GLM_CONFIG_CONSTEXP == GLM_ENABLE
#include <glm/gtc/constants.hpp>
#include <glm/gtc/quaternion.hpp>
@@ -663,20 +663,20 @@ static int test_mat2x2()
return Error;
}
#endif//GLM_USE_CONSTEXP == GLM_ENABLE
#endif//GLM_CONFIG_CONSTEXP == GLM_ENABLE
int main()
{
int Error = 0;
# if GLM_USE_CONSTEXP == GLM_ENABLE
# if GLM_CONFIG_CONSTEXP == GLM_ENABLE
Error += test_vec1();
Error += test_vec2();
Error += test_vec3();
Error += test_vec4();
Error += test_quat();
Error += test_mat2x2();
# endif//GLM_USE_CONSTEXP == GLM_ENABLE
# endif//GLM_CONFIG_CONSTEXP == GLM_ENABLE
return Error;
}

View File

@@ -1,6 +1,6 @@
#include <glm/glm.hpp>
#if GLM_USE_DEFAULTED_FUNCTIONS == GLM_ENABLE
#if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_ENABLE
#include <glm/gtc/constants.hpp>
#include <glm/gtc/quaternion.hpp>
@@ -127,17 +127,17 @@ static int test_quat_memcpy()
return Error;
}
#endif//GLM_USE_DEFAULTED_FUNCTIONS == GLM_ENABLE
#endif//GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_ENABLE
int main()
{
int Error = 0;
# if GLM_USE_DEFAULTED_FUNCTIONS == GLM_ENABLE
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_ENABLE
Error += test_vec_memcpy();
Error += test_mat_memcpy();
Error += test_quat_memcpy();
# endif//GLM_USE_DEFAULTED_FUNCTIONS == GLM_ENABLE
# endif//GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_ENABLE
return Error;
}

View File

@@ -51,7 +51,7 @@ int test_vec4_ctor()
}
#endif
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
{
glm::ivec4 A = glm::vec4(1.0f, 2.0f, 3.0f, 4.0f);
glm::ivec4 B = A.xyzw;
@@ -82,7 +82,7 @@ int test_vec4_ctor()
}
# endif
# if GLM_SWIZZLE
# if GLM_CONFIG_SWIZZLE
{
glm::ivec4 A = glm::vec4(1.0f, 2.0f, 3.0f, 4.0f);
glm::ivec4 B = A.xyzw();
@@ -111,7 +111,7 @@ int test_vec4_ctor()
Error += glm::all(glm::equal(A, L)) ? 0 : 1;
Error += glm::all(glm::equal(A, M)) ? 0 : 1;
}
# endif//GLM_SWIZZLE
# endif//GLM_CONFIG_SWIZZLE
{
glm::ivec4 A(1);
@@ -343,7 +343,7 @@ int test_vec4_swizzle_partial()
glm::vec4 A(1, 2, 3, 4);
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
{
glm::vec4 B(A.xy, A.zw);
Error += A == B ? 0 : 1;

View File

@@ -6,7 +6,7 @@ static int test_ivec2_swizzle()
{
int Error = 0;
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
{
glm::ivec2 A(1, 2);
glm::ivec2 B = A.yx();
@@ -15,9 +15,9 @@ static int test_ivec2_swizzle()
Error += A != B ? 0 : 1;
Error += A == C ? 0 : 1;
}
# endif//GLM_SWIZZLE
# endif//GLM_CONFIG_SWIZZLE
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
{
glm::ivec2 A(1, 2);
glm::ivec2 B = A.yx;
@@ -38,7 +38,7 @@ static int test_ivec2_swizzle()
glm::ivec2 E = A.yx;
Error += E == D ? 0 : 1;
}
# endif//GLM_SWIZZLE
# endif//GLM_CONFIG_SWIZZLE
return Error;
}
@@ -47,7 +47,7 @@ int test_ivec3_swizzle()
{
int Error = 0;
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
{
glm::ivec3 A(1, 2, 3);
glm::ivec3 B = A.zyx();
@@ -58,7 +58,7 @@ int test_ivec3_swizzle()
}
# endif
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
{
glm::ivec3 const A(1, 2, 3);
glm::ivec2 B = A.yx;
@@ -112,7 +112,7 @@ int test_ivec4_swizzle()
{
int Error = 0;
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
{
glm::ivec4 A(1, 2, 3, 4);
glm::ivec4 B = A.wzyx();
@@ -130,7 +130,7 @@ int test_vec4_swizzle()
{
int Error = 0;
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
{
glm::vec4 A(1, 2, 3, 4);
glm::vec4 B = A.wzyx();

View File

@@ -8,7 +8,7 @@ static int test_vec1_ctor()
{
int Error = 0;
# if GLM_USE_DEFAULTED_FUNCTIONS == GLM_ENABLE
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_ENABLE
{
union pack
{
@@ -22,7 +22,7 @@ static int test_vec1_ctor()
B.f = glm::vec1(1);
Error += glm::all(glm::equal(B.i, glm::ivec1(1065353216))) ? 0 : 1;
}
# endif//GLM_USE_DEFAULTED_FUNCTIONS == GLM_ENABLE
# endif//GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_ENABLE
return Error;
}
@@ -31,7 +31,7 @@ static int test_vec2_ctor()
{
int Error = 0;
# if GLM_USE_DEFAULTED_FUNCTIONS == GLM_ENABLE
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_ENABLE
{
union pack
{
@@ -54,7 +54,7 @@ static int test_vec3_ctor()
{
int Error = 0;
# if GLM_USE_DEFAULTED_FUNCTIONS == GLM_ENABLE
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_ENABLE
{
union pack
{
@@ -77,7 +77,7 @@ static int test_vec4_ctor()
{
int Error = 0;
# if GLM_USE_DEFAULTED_FUNCTIONS == GLM_ENABLE
# if GLM_CONFIG_DEFAULTED_FUNCTIONS == GLM_ENABLE
{
union pack
{

View File

@@ -130,7 +130,7 @@ static int test_swizzle()
{
int Error = 0;
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
{
glm::vec1 A = glm::vec1(1.0f);
//glm::vec1 B = A.x;
@@ -139,7 +139,7 @@ static int test_swizzle()
//Error += glm::all(glm::equal(A, B)) ? 0 : 1;
Error += glm::all(glm::equal(A, C, glm::epsilon<float>())) ? 0 : 1;
}
# endif//GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# endif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
return Error;
}

View File

@@ -349,7 +349,7 @@ static int test_swizzle()
{
int Error = 0;
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
{
glm::vec2 A = glm::vec2(1.0f, 2.0f);
glm::vec2 B = A.xy;
@@ -360,9 +360,9 @@ static int test_swizzle()
Error += glm::all(glm::equal(A, C, 0.0001f)) ? 0 : 1;
Error += glm::all(glm::equal(A, D, 0.0001f)) ? 0 : 1;
}
# endif//GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# endif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
{
glm::vec2 A = glm::vec2(1.0f, 2.0f);
glm::vec2 B = A.xy();
@@ -371,7 +371,7 @@ static int test_swizzle()
Error += glm::all(glm::equal(A, B, 0.0001f)) ? 0 : 1;
Error += glm::all(glm::equal(A, C, 0.0001f)) ? 0 : 1;
}
# endif//GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
# endif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
return Error;
}

View File

@@ -319,7 +319,7 @@ int test_vec3_swizzle3_2()
{
int Error = 0;
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
{
glm::ivec3 v(1, 2, 3);
glm::ivec2 u;
@@ -374,7 +374,7 @@ int test_vec3_swizzle3_2()
v.zy = u; Error += (v.x == 2 && v.y == 2 && v.z == 1) ? 0 : 1;
//v.zz = u; //Illegal
}
# endif//GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# endif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
return Error;
}
@@ -383,7 +383,7 @@ int test_vec3_swizzle3_3()
{
int Error = 0;
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
{
glm::ivec3 v(1, 2, 3);
glm::ivec3 u;
@@ -414,7 +414,7 @@ int test_vec3_swizzle_operators()
glm::ivec3 const u = glm::ivec3(1, 2, 3);
glm::ivec3 const v = glm::ivec3(10, 20, 30);
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
{
glm::ivec3 q;
@@ -453,7 +453,7 @@ int test_vec3_swizzle_functions()
{
int Error = 0;
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
{
// NOTE: template functions cannot pick up the implicit conversion from
// a swizzle to the unswizzled type, therefore the operator() must be
@@ -487,7 +487,7 @@ int test_vec3_swizzle_functions()
r = glm::dot(s.xyzw(), t.xyzw()); Error += (int(r) == 300) ? 0 : 1;
r = glm::dot(s.xyz(), t.xyz()); Error += (int(r) == 140) ? 0 : 1;
}
# endif//GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
# endif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
return Error;
}
@@ -496,7 +496,7 @@ int test_vec3_swizzle_partial()
{
int Error = 0;
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
{
glm::vec3 const A(1, 2, 3);
glm::vec3 B(A.xy, 3);
@@ -514,7 +514,7 @@ int test_vec3_swizzle_partial()
glm::ivec3 const B(A.xyz);
Error += A == B ? 0 : 1;
}
# endif//GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# endif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
return Error;
}
@@ -550,7 +550,7 @@ static int test_swizzle()
{
int Error = 0;
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
{
glm::vec3 A = glm::vec3(1.0f, 2.0f, 3.0f);
glm::vec3 B = A.xyz;
@@ -569,9 +569,9 @@ static int test_swizzle()
Error += glm::all(glm::equal(A, G, glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(A, H, glm::epsilon<float>())) ? 0 : 1;
}
# endif//GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# endif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
{
glm::vec3 A = glm::vec3(1.0f, 2.0f, 3.0f);
glm::vec3 B = A.xyz();
@@ -590,7 +590,7 @@ static int test_swizzle()
Error += glm::all(glm::equal(A, G, glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(A, H, glm::epsilon<float>())) ? 0 : 1;
}
# endif//GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
# endif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
return Error;
}

View File

@@ -486,7 +486,7 @@ static int test_swizzle_partial()
glm::vec4 const A(1, 2, 3, 4);
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
{
glm::vec4 B(A.xy, A.zw);
Error += glm::all(glm::equal(A, B, glm::epsilon<float>())) ? 0 : 1;
@@ -512,7 +512,7 @@ static int test_swizzle_partial()
glm::vec4 B(1.0f, A.yzw);
Error += glm::all(glm::equal(A, B, glm::epsilon<float>())) ? 0 : 1;
}
# endif//GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
# endif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
return Error;
}
@@ -521,7 +521,7 @@ static int test_swizzle()
{
int Error = 0;
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
{
glm::ivec4 A = glm::ivec4(1.0f, 2.0f, 3.0f, 4.0f);
glm::ivec4 B = A.xyzw;
@@ -550,9 +550,9 @@ static int test_swizzle()
Error += glm::all(glm::equal(A, L)) ? 0 : 1;
Error += glm::all(glm::equal(A, M)) ? 0 : 1;
}
# endif//GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR
# endif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR
# if GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
# if GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
{
glm::vec4 A = glm::vec4(1.0f, 2.0f, 3.0f, 4.0f);
glm::vec4 B = A.xyzw();
@@ -581,7 +581,7 @@ static int test_swizzle()
Error += glm::all(glm::equal(A, L, glm::epsilon<float>())) ? 0 : 1;
Error += glm::all(glm::equal(A, M, glm::epsilon<float>())) ? 0 : 1;
}
# endif//GLM_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_SWIZZLE == GLM_SWIZZLE_FUNCTION
# endif//GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_OPERATOR || GLM_CONFIG_SWIZZLE == GLM_SWIZZLE_FUNCTION
return Error;
}

View File

@@ -1,7 +1,7 @@
#define GLM_FORCE_ALIGNED_GENTYPES
#include <glm/glm.hpp>
#if GLM_USE_ALIGNED_GENTYPES == GLM_ENABLE
#if GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE
#include <glm/gtc/type_aligned.hpp>
#include <glm/ext/vector_relational.hpp>
@@ -177,4 +177,4 @@ int main()
return 0;
}
#endif//GLM_USE_ANONYMOUS_STRUCT
#endif//GLM_CONFIG_ANONYMOUS_STRUCT

View File

@@ -20,7 +20,7 @@ namespace
case glm::highp: os << "uhi"; break;
case glm::mediump: os << "umd"; break;
case glm::lowp: os << "ulo"; break;
# if GLM_USE_ALIGNED_GENTYPES == GLM_ENABLE
# if GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE
case glm::aligned_highp: os << "ahi"; break;
case glm::aligned_mediump: os << "amd"; break;
case glm::aligned_lowp: os << "alo"; break;

View File

@@ -7,7 +7,7 @@
#include <glm/ext/vector_relational.hpp>
#include <glm/glm.hpp>
/*
#if GLM_USE_SIMD == GLM_ENABLE && GLM_USE_ALIGNED_GENTYPES == GLM_ENABLE
#if GLM_CONFIG_SIMD == GLM_ENABLE && GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE
namespace glm
{
@@ -116,7 +116,7 @@ int main()
{
int Error = 0;
/*
# if GLM_USE_SIMD == GLM_ENABLE && GLM_USE_ALIGNED_GENTYPES == GLM_ENABLE
# if GLM_CONFIG_SIMD == GLM_ENABLE && GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE
Error += test_vec4_load();
# endif
*/