Fixed GCC 4.5 and older build #566

This commit is contained in:
Christophe Riccio 2016-12-01 23:05:43 +01:00
parent 57091f8553
commit 2dda5af72c
11 changed files with 53 additions and 27 deletions

View File

@ -451,6 +451,11 @@
((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA70)))) ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA70))))
#endif #endif
#define GLM_HAS_ONLY_XYZW ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER < GLM_COMPILER_GCC46))
#if GLM_HAS_ONLY_XYZW
# pragma message("GLM: GCC older than 4.6 has a bug presenting the use of rgba and stpq components")
#endif
// //
#if GLM_LANG & GLM_LANG_CXX11_FLAG #if GLM_LANG & GLM_LANG_CXX11_FLAG
# define GLM_HAS_ASSIGNABLE 1 # define GLM_HAS_ASSIGNABLE 1

View File

@ -27,7 +27,10 @@ namespace glm
// -- Data -- // -- Data --
# if GLM_HAS_ALIGNED_TYPE # if GLM_HAS_ONLY_XYZW
T x;
# elif GLM_HAS_ALIGNED_TYPE
# if GLM_COMPILER & GLM_COMPILER_GCC # if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push # pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic" # pragma GCC diagnostic ignored "-Wpedantic"

View File

@ -26,7 +26,10 @@ namespace glm
// -- Data -- // -- Data --
# if GLM_HAS_ALIGNED_TYPE # if GLM_HAS_ONLY_XYZW
T x, y;
# elif GLM_HAS_ALIGNED_TYPE
# if GLM_COMPILER & GLM_COMPILER_GCC # if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push # pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic" # pragma GCC diagnostic ignored "-Wpedantic"

View File

@ -26,7 +26,10 @@ namespace glm
// -- Data -- // -- Data --
# if GLM_HAS_ALIGNED_TYPE # if GLM_HAS_ONLY_XYZW
T x, y, z;
# elif GLM_HAS_ALIGNED_TYPE
# if GLM_COMPILER & GLM_COMPILER_GCC # if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push # pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic" # pragma GCC diagnostic ignored "-Wpedantic"

View File

@ -26,7 +26,10 @@ namespace glm
// -- Data -- // -- Data --
# if GLM_HAS_ALIGNED_TYPE # if GLM_HAS_ONLY_XYZW
T x, y, z, w;
# elif GLM_HAS_ALIGNED_TYPE
# if GLM_COMPILER & GLM_COMPILER_GCC # if GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic push # pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wpedantic" # pragma GCC diagnostic ignored "-Wpedantic"

View File

@ -23,7 +23,7 @@ namespace detail
{ {
GLM_FUNC_QUALIFIER static tvec4<T, P> call(tvec4<T, P> const& ColorRGB, T GammaCorrection) GLM_FUNC_QUALIFIER static tvec4<T, P> call(tvec4<T, P> const& ColorRGB, T GammaCorrection)
{ {
return tvec4<T, P>(compute_rgbToSrgb<T, P, tvec3>::call(tvec3<T, P>(ColorRGB), GammaCorrection), ColorRGB.a); return tvec4<T, P>(compute_rgbToSrgb<T, P, tvec3>::call(tvec3<T, P>(ColorRGB), GammaCorrection), ColorRGB.w);
} }
}; };
@ -44,7 +44,7 @@ namespace detail
{ {
GLM_FUNC_QUALIFIER static tvec4<T, P> call(tvec4<T, P> const& ColorSRGB, T Gamma) GLM_FUNC_QUALIFIER static tvec4<T, P> call(tvec4<T, P> const& ColorSRGB, T Gamma)
{ {
return tvec4<T, P>(compute_srgbToRgb<T, P, tvec3>::call(tvec3<T, P>(ColorSRGB), Gamma), ColorSRGB.a); return tvec4<T, P>(compute_srgbToRgb<T, P, tvec3>::call(tvec3<T, P>(ColorSRGB), Gamma), ColorSRGB.w);
} }
}; };
}//namespace detail }//namespace detail

View File

@ -105,20 +105,18 @@ namespace glm
{ {
tvec3<T, defaultp> rgbw = tvec3<T, defaultp>(T(0.2126), T(0.7152), T(0.0722)); tvec3<T, defaultp> rgbw = tvec3<T, defaultp>(T(0.2126), T(0.7152), T(0.0722));
T col0 = (T(1) - s) * rgbw.r; tvec3<T, defaultp> const col((T(1) - s) * rgbw);
T col1 = (T(1) - s) * rgbw.g;
T col2 = (T(1) - s) * rgbw.b;
tmat4x4<T, defaultp> result(T(1)); tmat4x4<T, defaultp> result(T(1));
result[0][0] = col0 + s; result[0][0] = col.x + s;
result[0][1] = col0; result[0][1] = col.x;
result[0][2] = col0; result[0][2] = col.x;
result[1][0] = col1; result[1][0] = col.y;
result[1][1] = col1 + s; result[1][1] = col.y + s;
result[1][2] = col1; result[1][2] = col.y;
result[2][0] = col2; result[2][0] = col.z;
result[2][1] = col2; result[2][1] = col.z;
result[2][2] = col2 + s; result[2][2] = col.z + s;
return result; return result;
} }

View File

@ -58,6 +58,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
- Fixed intersectRayPlane returns true in parallel case #578 - Fixed intersectRayPlane returns true in parallel case #578
- Fixed GCC 6.2 compiler warnings #580 - Fixed GCC 6.2 compiler warnings #580
- Fixed GTX_matrix_decompose decompose #582 #448 - Fixed GTX_matrix_decompose decompose #582 #448
- Fixed GCC 4.5 and older build #566
#### [GLM 0.9.8.3](https://github.com/g-truc/glm/releases/tag/0.9.8.3) - 2016-11-12 #### [GLM 0.9.8.3](https://github.com/g-truc/glm/releases/tag/0.9.8.3) - 2016-11-12
##### Improvements: ##### Improvements:

View File

@ -2,6 +2,8 @@
#define GLM_FORCE_SWIZZLE #define GLM_FORCE_SWIZZLE
#include <glm/glm.hpp> #include <glm/glm.hpp>
#if !GLM_HAS_ONLY_XYZW
int test_ivec2_swizzle() int test_ivec2_swizzle()
{ {
int Error = 0; int Error = 0;
@ -60,16 +62,19 @@ int test_vec4_swizzle()
return Error; return Error;
} }
#endif//!GLM_HAS_ONLY_XYZW
int main() int main()
{ {
int Error = 0; int Error = 0;
# if !GLM_HAS_ONLY_XYZW
Error += test_ivec2_swizzle(); Error += test_ivec2_swizzle();
Error += test_ivec3_swizzle(); Error += test_ivec3_swizzle();
Error += test_ivec4_swizzle(); Error += test_ivec4_swizzle();
Error += test_vec4_swizzle(); Error += test_vec4_swizzle();
# endif//!GLM_HAS_ONLY_XYZW
return Error; return Error;
} }

View File

@ -226,7 +226,7 @@ int test_instruction_set()
int test_cpp_version() int test_cpp_version()
{ {
std::printf("__cplusplus: %lld\n", __cplusplus); std::printf("__cplusplus: %d\n", static_cast<int>(__cplusplus));
return 0; return 0;
} }

View File

@ -334,6 +334,7 @@ int test_vec3_swizzle3_3()
return Error; return Error;
} }
#if !GLM_HAS_ONLY_XYZW
int test_vec3_swizzle_operators() int test_vec3_swizzle_operators()
{ {
int Error = 0; int Error = 0;
@ -440,6 +441,7 @@ int test_vec3_swizzle_partial()
return Error; return Error;
} }
#endif//!GLM_HAS_ONLY_XYZW
int test_operator_increment() int test_operator_increment()
{ {
@ -480,10 +482,13 @@ int main()
Error += test_vec3_size(); Error += test_vec3_size();
Error += test_vec3_swizzle3_2(); Error += test_vec3_swizzle3_2();
Error += test_vec3_swizzle3_3(); Error += test_vec3_swizzle3_3();
Error += test_operator_increment();
# if !GLM_HAS_ONLY_XYZW
Error += test_vec3_swizzle_partial(); Error += test_vec3_swizzle_partial();
Error += test_vec3_swizzle_operators(); Error += test_vec3_swizzle_operators();
Error += test_vec3_swizzle_functions(); Error += test_vec3_swizzle_functions();
Error += test_operator_increment(); # endif//!GLM_HAS_ONLY_XYZW
return Error; return Error;
} }