From d52a3880009237388fac010cdef288480d5d6a81 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 31 Jan 2013 18:02:47 +0100 Subject: [PATCH] Refactoring of integer and float details, use of C++11 integer types when available. --- glm/core/_detail.hpp | 144 ++++++-------------- glm/core/func_packing.hpp | 22 +-- glm/core/func_packing.inl | 114 ++++++++-------- glm/core/type_float.hpp | 48 ++++++- glm/core/type_half.hpp | 1 + glm/core/type_half.inl | 2 - glm/core/type_int.hpp | 101 ++++++++++++-- glm/glm.hpp | 18 --- test/external/gli/core/generate_mipmaps.inl | 3 +- 9 files changed, 244 insertions(+), 209 deletions(-) diff --git a/glm/core/_detail.hpp b/glm/core/_detail.hpp index ad8f19e3..6126dd9a 100644 --- a/glm/core/_detail.hpp +++ b/glm/core/_detail.hpp @@ -31,6 +31,7 @@ #include "setup.hpp" #include +//#if((GLM_LANG & GLM_LANG_CXX0X) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))) #if(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) #include #endif @@ -38,24 +39,44 @@ namespace glm{ namespace detail { - class half; +# if((GLM_LANG & GLM_LANG_CXX0X) == GLM_LANG_CXX0X) + typedef std::int8_t int8; + typedef std::int16_t int16; + typedef std::int32_t int32; + typedef std::int64_t int64; + + typedef std::uint8_t uint8; + typedef std::uint16_t uint16; + typedef std::uint32_t uint32; + typedef std::uint64_t uint64; +# else +# if(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) // C99 detected, 64 bit types available + typedef int64_t sint64; + typedef uint64_t uint64; +# elif(GLM_COMPILER & GLM_COMPILER_VC) + typedef signed __int64 sint64; + typedef unsigned __int64 uint64; +# elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_LLVM_GCC | GLM_COMPILER_CLANG)) + __extension__ typedef signed long long sint64; + __extension__ typedef unsigned long long uint64; +# elif(GLM_COMPILER & GLM_COMPILER_BC) + typedef Int64 sint64; + typedef Uint64 uint64; +# else//unknown compiler + typedef signed long long sint64; + typedef unsigned long long uint64; +# endif//GLM_COMPILER -#if(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) // C99 detected, 64 bit types available - typedef int64_t sint64; - typedef uint64_t uint64; -#elif(GLM_COMPILER & GLM_COMPILER_VC) - typedef signed __int64 sint64; - typedef unsigned __int64 uint64; -#elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_LLVM_GCC | GLM_COMPILER_CLANG)) - __extension__ typedef signed long long sint64; - __extension__ typedef unsigned long long uint64; -#elif(GLM_COMPILER & GLM_COMPILER_BC) - typedef Int64 sint64; - typedef Uint64 uint64; -#else//unknown compiler - typedef signed long long sint64; - typedef unsigned long long uint64; -#endif//GLM_COMPILER + typedef signed char int8; + typedef signed short int16; + typedef signed int int32; + typedef sint64 int64; + + typedef unsigned char uint8; + typedef unsigned short uint16; + typedef unsigned int uint32; + typedef uint64 uint64; +#endif// template struct If @@ -242,11 +263,6 @@ namespace detail }; \ } - GLM_DETAIL_IS_FLOAT(detail::half); - GLM_DETAIL_IS_FLOAT(float); - GLM_DETAIL_IS_FLOAT(double); - GLM_DETAIL_IS_FLOAT(long double); - ////////////////// // bool @@ -333,23 +349,6 @@ namespace detail }; }; - ////////////////// - // type - - typedef signed char int8; - typedef signed short int16; - typedef signed int int32; - typedef detail::sint64 int64; - - typedef unsigned char uint8; - typedef unsigned short uint16; - typedef unsigned int uint32; - typedef detail::uint64 uint64; - - typedef detail::half float16; - typedef float float32; - typedef double float64; - ////////////////// // float_or_int_trait @@ -368,73 +367,6 @@ namespace detail { enum{ID = float_or_int_value::GLM_ERROR}; }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_INT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_FLOAT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_FLOAT}; - }; - - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_FLOAT}; - }; - }//namespace detail }//namespace glm diff --git a/glm/core/func_packing.hpp b/glm/core/func_packing.hpp index e4f26dcb..4dbd24e6 100644 --- a/glm/core/func_packing.hpp +++ b/glm/core/func_packing.hpp @@ -52,7 +52,7 @@ namespace glm //! /// @see GLSL packUnorm2x16 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - detail::uint32 packUnorm2x16(detail::tvec2 const & v); + uint32 packUnorm2x16(detail::tvec2 const & v); //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. //! Then, the results are packed into the returned 32-bit unsigned integer. @@ -65,7 +65,7 @@ namespace glm //! /// @see GLSL packSnorm2x16 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - detail::uint32 packSnorm2x16(detail::tvec2 const & v); + uint32 packSnorm2x16(detail::tvec2 const & v); //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. //! Then, the results are packed into the returned 32-bit unsigned integer. @@ -78,7 +78,7 @@ namespace glm //! /// @see GLSL packUnorm4x8 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - detail::uint32 packUnorm4x8(detail::tvec4 const & v); + uint32 packUnorm4x8(detail::tvec4 const & v); //! First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values. //! Then, the results are packed into the returned 32-bit unsigned integer. @@ -91,7 +91,7 @@ namespace glm //! /// @see GLSL packSnorm4x8 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - detail::uint32 packSnorm4x8(detail::tvec4 const & v); + uint32 packSnorm4x8(detail::tvec4 const & v); //! First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. //! Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. @@ -104,7 +104,7 @@ namespace glm //! /// @see GLSL unpackUnorm2x16 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - detail::tvec2 unpackUnorm2x16(detail::uint32 const & p); + detail::tvec2 unpackUnorm2x16(uint32 const & p); //! First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. //! Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. @@ -117,7 +117,7 @@ namespace glm //! /// @see GLSL unpackSnorm2x16 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - detail::tvec2 unpackSnorm2x16(detail::uint32 const & p); + detail::tvec2 unpackSnorm2x16(uint32 const & p); /// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. /// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. @@ -130,7 +130,7 @@ namespace glm /// /// @see GLSL unpackUnorm4x8 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - detail::tvec4 unpackUnorm4x8(detail::uint32 const & p); + detail::tvec4 unpackUnorm4x8(uint32 const & p); /// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers. /// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector. @@ -143,7 +143,7 @@ namespace glm /// /// @see GLSL unpackSnorm4x8 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - detail::tvec4 unpackSnorm4x8(detail::uint32 const & p); + detail::tvec4 unpackSnorm4x8(uint32 const & p); /// Returns a double-precision value obtained by packing the components of v into a 64-bit value. /// If an IEEE 754 Inf or NaN is created, it will not signal, and the resulting floating point value is unspecified. @@ -153,7 +153,7 @@ namespace glm /// /// @see GLSL packDouble2x32 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - double packDouble2x32(detail::tvec2 const & v); + double packDouble2x32(detail::tvec2 const & v); /// Returns a two-component unsigned integer vector representation of v. /// The bit-level representation of v is preserved. @@ -162,7 +162,7 @@ namespace glm /// /// @see GLSL unpackDouble2x32 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - detail::tvec2 unpackDouble2x32(double const & v); + detail::tvec2 unpackDouble2x32(double const & v); /// Returns an unsigned integer obtained by converting the components of a two-component floating-point vector /// to the 16-bit floating-point representation found in the OpenGL Specification, @@ -182,7 +182,7 @@ namespace glm /// /// @see GLSL unpackHalf2x16 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - vec2 unpackHalf2x16(uint const & v); + vec2 unpackHalf2x16(uint32 const & v); /// @} }//namespace glm diff --git a/glm/core/func_packing.inl b/glm/core/func_packing.inl index 6cdecf64..9934d416 100644 --- a/glm/core/func_packing.inl +++ b/glm/core/func_packing.inl @@ -28,118 +28,118 @@ namespace glm { - GLM_FUNC_QUALIFIER detail::uint32 packUnorm2x16(detail::tvec2 const & v) + GLM_FUNC_QUALIFIER uint32 packUnorm2x16(detail::tvec2 const & v) { - detail::uint16 A(detail::uint16(round(clamp(v.x, 0.0f, 1.0f) * 65535.0f))); - detail::uint16 B(detail::uint16(round(clamp(v.y, 0.0f, 1.0f) * 65535.0f))); - return detail::uint32((B << 16) | A); + uint16 A(uint16(round(clamp(v.x, 0.0f, 1.0f) * 65535.0f))); + uint16 B(uint16(round(clamp(v.y, 0.0f, 1.0f) * 65535.0f))); + return uint32((B << 16) | A); } - GLM_FUNC_QUALIFIER detail::tvec2 unpackUnorm2x16(detail::uint32 const & p) + GLM_FUNC_QUALIFIER detail::tvec2 unpackUnorm2x16(uint32 const & p) { - detail::uint32 Mask16((1 << 16) - 1); - detail::uint32 A((p >> 0) & Mask16); - detail::uint32 B((p >> 16) & Mask16); - return detail::tvec2( + uint32 Mask16((1 << 16) - 1); + uint32 A((p >> 0) & Mask16); + uint32 B((p >> 16) & Mask16); + return detail::tvec2( A * 1.0f / 65535.0f, B * 1.0f / 65535.0f); } - GLM_FUNC_QUALIFIER detail::uint32 packSnorm2x16(detail::tvec2 const & v) + GLM_FUNC_QUALIFIER uint32 packSnorm2x16(detail::tvec2 const & v) { union iu { - detail::int16 i; - detail::uint16 u; + int16 i; + uint16 u; } A, B; - detail::tvec2 Unpack = clamp(v ,-1.0f, 1.0f) * 32767.0f; + detail::tvec2 Unpack = clamp(v ,-1.0f, 1.0f) * 32767.0f; A.i = detail::int16(round(Unpack.x)); B.i = detail::int16(round(Unpack.y)); - detail::uint32 Pack = (detail::uint32(B.u) << 16) | (detail::uint32(A.u) << 0); + uint32 Pack = (uint32(B.u) << 16) | (uint32(A.u) << 0); return Pack; } - GLM_FUNC_QUALIFIER detail::tvec2 unpackSnorm2x16(detail::uint32 const & p) + GLM_FUNC_QUALIFIER detail::tvec2 unpackSnorm2x16(uint32 const & p) { union iu { - detail::int16 i; - detail::uint16 u; + int16 i; + uint16 u; } A, B; - detail::uint32 Mask16((1 << 16) - 1); - A.u = detail::uint16((p >> 0) & Mask16); - B.u = detail::uint16((p >> 16) & Mask16); - detail::tvec2 Pack(A.i, B.i); + uint32 Mask16((1 << 16) - 1); + A.u = uint16((p >> 0) & Mask16); + B.u = uint16((p >> 16) & Mask16); + detail::tvec2 Pack(A.i, B.i); return clamp(Pack * 1.0f / 32767.0f, -1.0f, 1.0f); } - GLM_FUNC_QUALIFIER detail::uint32 packUnorm4x8(detail::tvec4 const & v) + GLM_FUNC_QUALIFIER uint32 packUnorm4x8(detail::tvec4 const & v) { - detail::uint8 A((detail::uint8)round(clamp(v.x, 0.0f, 1.0f) * 255.0f)); - detail::uint8 B((detail::uint8)round(clamp(v.y, 0.0f, 1.0f) * 255.0f)); - detail::uint8 C((detail::uint8)round(clamp(v.z, 0.0f, 1.0f) * 255.0f)); - detail::uint8 D((detail::uint8)round(clamp(v.w, 0.0f, 1.0f) * 255.0f)); - return detail::uint32((D << 24) | (C << 16) | (B << 8) | A); + uint8 A((uint8)round(clamp(v.x, 0.0f, 1.0f) * 255.0f)); + uint8 B((uint8)round(clamp(v.y, 0.0f, 1.0f) * 255.0f)); + uint8 C((uint8)round(clamp(v.z, 0.0f, 1.0f) * 255.0f)); + uint8 D((uint8)round(clamp(v.w, 0.0f, 1.0f) * 255.0f)); + return uint32((D << 24) | (C << 16) | (B << 8) | A); } - GLM_FUNC_QUALIFIER detail::tvec4 unpackUnorm4x8(detail::uint32 const & p) + GLM_FUNC_QUALIFIER detail::tvec4 unpackUnorm4x8(uint32 const & p) { - detail::uint32 Mask8((1 << 8) - 1); - detail::uint32 A((p >> 0) & Mask8); - detail::uint32 B((p >> 8) & Mask8); - detail::uint32 C((p >> 16) & Mask8); - detail::uint32 D((p >> 24) & Mask8); - return detail::tvec4( + uint32 Mask8((1 << 8) - 1); + uint32 A((p >> 0) & Mask8); + uint32 B((p >> 8) & Mask8); + uint32 C((p >> 16) & Mask8); + uint32 D((p >> 24) & Mask8); + return detail::tvec4( A * 1.0f / 255.0f, B * 1.0f / 255.0f, C * 1.0f / 255.0f, D * 1.0f / 255.0f); } - GLM_FUNC_QUALIFIER detail::uint32 packSnorm4x8(detail::tvec4 const & v) + GLM_FUNC_QUALIFIER uint32 packSnorm4x8(detail::tvec4 const & v) { union iu { - detail::int8 i; - detail::uint8 u; + int8 i; + uint8 u; } A, B, C, D; - detail::tvec4 Unpack = clamp(v ,-1.0f, 1.0f) * 127.0f; - A.i = detail::int8(round(Unpack.x)); - B.i = detail::int8(round(Unpack.y)); - C.i = detail::int8(round(Unpack.z)); - D.i = detail::int8(round(Unpack.w)); - detail::uint32 Pack = (detail::uint32(D.u) << 24) | (detail::uint32(C.u) << 16) | (detail::uint32(B.u) << 8) | (detail::uint32(A.u) << 0); + detail::tvec4 Unpack = clamp(v ,-1.0f, 1.0f) * 127.0f; + A.i = int8(round(Unpack.x)); + B.i = int8(round(Unpack.y)); + C.i = int8(round(Unpack.z)); + D.i = int8(round(Unpack.w)); + uint32 Pack = (uint32(D.u) << 24) | (uint32(C.u) << 16) | (uint32(B.u) << 8) | (uint32(A.u) << 0); return Pack; } - GLM_FUNC_QUALIFIER detail::tvec4 unpackSnorm4x8(detail::uint32 const & p) + GLM_FUNC_QUALIFIER detail::tvec4 unpackSnorm4x8(uint32 const & p) { union iu { - detail::int8 i; - detail::uint8 u; + int8 i; + uint8 u; } A, B, C, D; - detail::uint32 Mask8((1 << 8) - 1); - A.u = detail::uint8((p >> 0) & Mask8); - B.u = detail::uint8((p >> 8) & Mask8); - C.u = detail::uint8((p >> 16) & Mask8); - D.u = detail::uint8((p >> 24) & Mask8); - detail::tvec4 Pack(A.i, B.i, C.i, D.i); + uint32 Mask8((1 << 8) - 1); + A.u = uint8((p >> 0) & Mask8); + B.u = uint8((p >> 8) & Mask8); + C.u = uint8((p >> 16) & Mask8); + D.u = uint8((p >> 24) & Mask8); + detail::tvec4 Pack(A.i, B.i, C.i, D.i); return clamp(Pack * 1.0f / 127.0f, -1.0f, 1.0f); } - GLM_FUNC_QUALIFIER double packDouble2x32(detail::tvec2 const & v) + GLM_FUNC_QUALIFIER double packDouble2x32(detail::tvec2 const & v) { struct uint32_pair { - detail::uint32 x; - detail::uint32 y; + uint32 x; + uint32 y; }; union helper @@ -159,8 +159,8 @@ namespace glm { struct uint32_pair { - detail::uint32 x; - detail::uint32 y; + uint32 x; + uint32 y; }; union helper diff --git a/glm/core/type_float.hpp b/glm/core/type_float.hpp index 06fd71fc..a2cb658b 100644 --- a/glm/core/type_float.hpp +++ b/glm/core/type_float.hpp @@ -32,8 +32,14 @@ #include "type_half.hpp" #include "setup.hpp" -namespace glm +namespace glm{ +namespace detail { + typedef detail::half float16; + typedef float float32; + typedef double float64; +}//namespace detail + #ifdef GLM_USE_HALF_SCALAR typedef detail::half lowp_float_t; #else//GLM_USE_HALF_SCALAR @@ -78,7 +84,47 @@ namespace glm # error "GLM error: multiple default precision requested for floating-point types" #endif + typedef detail::half float16; + typedef float float32; + typedef double float64; + /// @} + +//////////////////// +// check type sizes +#ifndef GLM_STATIC_ASSERT_NULL + GLM_STATIC_ASSERT(sizeof(glm::float16) == 2, "float16 size isn't 2 bytes on this platform"); + GLM_STATIC_ASSERT(sizeof(glm::float32) == 4, "float32 size isn't 4 bytes on this platform"); + GLM_STATIC_ASSERT(sizeof(glm::float64) == 8, "float64 size isn't 8 bytes on this platform"); +#endif//GLM_STATIC_ASSERT_NULL + +namespace detail +{ + //////////////////// + // Mark half to be flaot + GLM_DETAIL_IS_FLOAT(detail::half); + GLM_DETAIL_IS_FLOAT(float); + GLM_DETAIL_IS_FLOAT(double); + GLM_DETAIL_IS_FLOAT(long double); + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_FLOAT}; + }; + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_FLOAT}; + }; + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_FLOAT}; + }; +}//namespace detail }//namespace glm #endif//glm_core_type_float diff --git a/glm/core/type_half.hpp b/glm/core/type_half.hpp index 015c701a..53551644 100644 --- a/glm/core/type_half.hpp +++ b/glm/core/type_half.hpp @@ -30,6 +30,7 @@ #define glm_core_type_half #include +#include "_detail.hpp" namespace glm{ namespace detail diff --git a/glm/core/type_half.inl b/glm/core/type_half.inl index 27c49ee6..458764b9 100644 --- a/glm/core/type_half.inl +++ b/glm/core/type_half.inl @@ -30,8 +30,6 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// -#include "_detail.hpp" - namespace glm{ namespace detail { diff --git a/glm/core/type_int.hpp b/glm/core/type_int.hpp index fcf844a2..69586e2e 100644 --- a/glm/core/type_int.hpp +++ b/glm/core/type_int.hpp @@ -37,25 +37,23 @@ namespace detail { typedef signed short lowp_int_t; typedef signed int mediump_int_t; - typedef sint64 highp_int_t; + typedef int64 highp_int_t; typedef unsigned short lowp_uint_t; typedef unsigned int mediump_uint_t; typedef uint64 highp_uint_t; - - GLM_DETAIL_IS_INT(signed char); - GLM_DETAIL_IS_INT(signed short); - GLM_DETAIL_IS_INT(signed int); - GLM_DETAIL_IS_INT(signed long); - GLM_DETAIL_IS_INT(highp_int_t); - - GLM_DETAIL_IS_UINT(unsigned char); - GLM_DETAIL_IS_UINT(unsigned short); - GLM_DETAIL_IS_UINT(unsigned int); - GLM_DETAIL_IS_UINT(unsigned long); - GLM_DETAIL_IS_UINT(highp_uint_t); }//namespace detail + typedef detail::int8 int8; + typedef detail::int16 int16; + typedef detail::int32 int32; + typedef detail::int64 int64; + + typedef detail::uint8 uint8; + typedef detail::uint16 uint16; + typedef detail::uint32 uint32; + typedef detail::uint64 uint64; + /// @addtogroup core_precision /// @{ @@ -131,6 +129,83 @@ namespace detail typedef uint_t uint; /// @} + +//////////////////// +// check type sizes +#ifndef GLM_STATIC_ASSERT_NULL + GLM_STATIC_ASSERT(sizeof(glm::int8) == 1, "int8 size isn't 1 byte on this platform"); + GLM_STATIC_ASSERT(sizeof(glm::int16) == 2, "int16 size isn't 2 bytes on this platform"); + GLM_STATIC_ASSERT(sizeof(glm::int32) == 4, "int32 size isn't 4 bytes on this platform"); + GLM_STATIC_ASSERT(sizeof(glm::int64) == 8, "int64 size isn't 8 bytes on this platform"); + + GLM_STATIC_ASSERT(sizeof(glm::uint8) == 1, "uint8 size isn't 1 byte on this platform"); + GLM_STATIC_ASSERT(sizeof(glm::uint16) == 2, "uint16 size isn't 2 bytes on this platform"); + GLM_STATIC_ASSERT(sizeof(glm::uint32) == 4, "uint32 size isn't 4 bytes on this platform"); + GLM_STATIC_ASSERT(sizeof(glm::uint64) == 8, "uint64 size isn't 8 bytes on this platform"); +#endif//GLM_STATIC_ASSERT_NULL + +namespace detail +{ + GLM_DETAIL_IS_INT(signed char); + GLM_DETAIL_IS_INT(signed short); + GLM_DETAIL_IS_INT(signed int); + GLM_DETAIL_IS_INT(signed long); + GLM_DETAIL_IS_INT(highp_int_t); + + GLM_DETAIL_IS_UINT(unsigned char); + GLM_DETAIL_IS_UINT(unsigned short); + GLM_DETAIL_IS_UINT(unsigned int); + GLM_DETAIL_IS_UINT(unsigned long); + GLM_DETAIL_IS_UINT(highp_uint_t); + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_INT}; + }; + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_INT}; + }; + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_INT}; + }; + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_INT}; + }; + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_INT}; + }; + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_INT}; + }; + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_INT}; + }; + + template <> + struct float_or_int_trait + { + enum{ID = float_or_int_value::GLM_INT}; + }; +}//namespace detail }//namespace glm #endif//glm_core_type_int diff --git a/glm/glm.hpp b/glm/glm.hpp index c35f63b4..240a7cc0 100644 --- a/glm/glm.hpp +++ b/glm/glm.hpp @@ -108,22 +108,4 @@ #include "./core/func_noise.hpp" #include "./core/_swizzle.hpp" -//////////////////// -// check type sizes -#ifndef GLM_STATIC_ASSERT_NULL - GLM_STATIC_ASSERT(sizeof(glm::detail::int8) == 1, "int8 size isn't 1 byte on this platform"); - GLM_STATIC_ASSERT(sizeof(glm::detail::int16) == 2, "int16 size isn't 2 bytes on this platform"); - GLM_STATIC_ASSERT(sizeof(glm::detail::int32) == 4, "int32 size isn't 4 bytes on this platform"); - GLM_STATIC_ASSERT(sizeof(glm::detail::int64) == 8, "int64 size isn't 8 bytes on this platform"); - - GLM_STATIC_ASSERT(sizeof(glm::detail::uint8) == 1, "uint8 size isn't 1 byte on this platform"); - GLM_STATIC_ASSERT(sizeof(glm::detail::uint16) == 2, "uint16 size isn't 2 bytes on this platform"); - GLM_STATIC_ASSERT(sizeof(glm::detail::uint32) == 4, "uint32 size isn't 4 bytes on this platform"); - GLM_STATIC_ASSERT(sizeof(glm::detail::uint64) == 8, "uint64 size isn't 8 bytes on this platform"); - - GLM_STATIC_ASSERT(sizeof(glm::detail::float16) == 2, "float16 size isn't 2 bytes on this platform"); - GLM_STATIC_ASSERT(sizeof(glm::detail::float32) == 4, "float32 size isn't 4 bytes on this platform"); - GLM_STATIC_ASSERT(sizeof(glm::detail::float64) == 8, "float64 size isn't 8 bytes on this platform"); -#endif//GLM_STATIC_ASSERT_NULL - #endif//glm_glm diff --git a/test/external/gli/core/generate_mipmaps.inl b/test/external/gli/core/generate_mipmaps.inl index b504a991..bbc6e4c4 100644 --- a/test/external/gli/core/generate_mipmaps.inl +++ b/test/external/gli/core/generate_mipmaps.inl @@ -9,6 +9,7 @@ namespace gli { +/* inline texture2D generateMipmaps ( texture2D const & Image, @@ -64,5 +65,5 @@ namespace gli return Result; } - +*/ }//namespace gli