Refactoring of integer and float details, use of C++11 integer types when available.

This commit is contained in:
Christophe Riccio 2013-01-31 18:02:47 +01:00
parent b5607d0018
commit d52a388000
9 changed files with 244 additions and 209 deletions

View File

@ -31,6 +31,7 @@
#include "setup.hpp"
#include <cassert>
//#if((GLM_LANG & GLM_LANG_CXX0X) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)))
#if(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
#include <cstdint>
#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<bool C>
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<int8>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<int16>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<int32>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<int64>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<uint8>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<uint16>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<uint32>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<uint64>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<float16>
{
enum{ID = float_or_int_value::GLM_FLOAT};
};
template <>
struct float_or_int_trait<float32>
{
enum{ID = float_or_int_value::GLM_FLOAT};
};
template <>
struct float_or_int_trait<float64>
{
enum{ID = float_or_int_value::GLM_FLOAT};
};
}//namespace detail
}//namespace glm

View File

@ -52,7 +52,7 @@ namespace glm
//!
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm2x16.xml">GLSL packUnorm2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
detail::uint32 packUnorm2x16(detail::tvec2<detail::float32> const & v);
uint32 packUnorm2x16(detail::tvec2<float32> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm2x16.xml">GLSL packSnorm2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
detail::uint32 packSnorm2x16(detail::tvec2<detail::float32> const & v);
uint32 packSnorm2x16(detail::tvec2<float32> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
detail::uint32 packUnorm4x8(detail::tvec4<detail::float32> const & v);
uint32 packUnorm4x8(detail::tvec4<float32> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
detail::uint32 packSnorm4x8(detail::tvec4<detail::float32> const & v);
uint32 packSnorm4x8(detail::tvec4<float32> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
detail::tvec2<detail::float32> unpackUnorm2x16(detail::uint32 const & p);
detail::tvec2<float32> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm2x16.xml">GLSL unpackSnorm2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
detail::tvec2<detail::float32> unpackSnorm2x16(detail::uint32 const & p);
detail::tvec2<float32> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
detail::tvec4<detail::float32> unpackUnorm4x8(detail::uint32 const & p);
detail::tvec4<float32> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
detail::tvec4<detail::float32> unpackSnorm4x8(detail::uint32 const & p);
detail::tvec4<float32> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packDouble2x32.xml">GLSL packDouble2x32 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
double packDouble2x32(detail::tvec2<detail::uint32> const & v);
double packDouble2x32(detail::tvec2<uint32> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackDouble2x32.xml">GLSL unpackDouble2x32 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
detail::tvec2<detail::uint32> unpackDouble2x32(double const & v);
detail::tvec2<uint32> 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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
vec2 unpackHalf2x16(uint const & v);
vec2 unpackHalf2x16(uint32 const & v);
/// @}
}//namespace glm

View File

@ -28,118 +28,118 @@
namespace glm
{
GLM_FUNC_QUALIFIER detail::uint32 packUnorm2x16(detail::tvec2<detail::float32> const & v)
GLM_FUNC_QUALIFIER uint32 packUnorm2x16(detail::tvec2<float32> 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<detail::float32> unpackUnorm2x16(detail::uint32 const & p)
GLM_FUNC_QUALIFIER detail::tvec2<float32> 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<detail::float32>(
uint32 Mask16((1 << 16) - 1);
uint32 A((p >> 0) & Mask16);
uint32 B((p >> 16) & Mask16);
return detail::tvec2<float32>(
A * 1.0f / 65535.0f,
B * 1.0f / 65535.0f);
}
GLM_FUNC_QUALIFIER detail::uint32 packSnorm2x16(detail::tvec2<detail::float32> const & v)
GLM_FUNC_QUALIFIER uint32 packSnorm2x16(detail::tvec2<float32> const & v)
{
union iu
{
detail::int16 i;
detail::uint16 u;
int16 i;
uint16 u;
} A, B;
detail::tvec2<detail::float32> Unpack = clamp(v ,-1.0f, 1.0f) * 32767.0f;
detail::tvec2<float32> 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<detail::float32> unpackSnorm2x16(detail::uint32 const & p)
GLM_FUNC_QUALIFIER detail::tvec2<float32> 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<detail::float32> Pack(A.i, B.i);
uint32 Mask16((1 << 16) - 1);
A.u = uint16((p >> 0) & Mask16);
B.u = uint16((p >> 16) & Mask16);
detail::tvec2<float32> Pack(A.i, B.i);
return clamp(Pack * 1.0f / 32767.0f, -1.0f, 1.0f);
}
GLM_FUNC_QUALIFIER detail::uint32 packUnorm4x8(detail::tvec4<detail::float32> const & v)
GLM_FUNC_QUALIFIER uint32 packUnorm4x8(detail::tvec4<float32> 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<detail::float32> unpackUnorm4x8(detail::uint32 const & p)
GLM_FUNC_QUALIFIER detail::tvec4<float32> 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<detail::float32>(
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<float32>(
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<detail::float32> const & v)
GLM_FUNC_QUALIFIER uint32 packSnorm4x8(detail::tvec4<float32> const & v)
{
union iu
{
detail::int8 i;
detail::uint8 u;
int8 i;
uint8 u;
} A, B, C, D;
detail::tvec4<detail::float32> 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<float32> 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<detail::float32> unpackSnorm4x8(detail::uint32 const & p)
GLM_FUNC_QUALIFIER detail::tvec4<float32> 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<detail::float32> 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<float32> 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<detail::uint32> const & v)
GLM_FUNC_QUALIFIER double packDouble2x32(detail::tvec2<uint32> 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

View File

@ -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<float16>
{
enum{ID = float_or_int_value::GLM_FLOAT};
};
template <>
struct float_or_int_trait<float32>
{
enum{ID = float_or_int_value::GLM_FLOAT};
};
template <>
struct float_or_int_trait<float64>
{
enum{ID = float_or_int_value::GLM_FLOAT};
};
}//namespace detail
}//namespace glm
#endif//glm_core_type_float

View File

@ -30,6 +30,7 @@
#define glm_core_type_half
#include <cstdlib>
#include "_detail.hpp"
namespace glm{
namespace detail

View File

@ -30,8 +30,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#include "_detail.hpp"
namespace glm{
namespace detail
{

View File

@ -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<int8>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<int16>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<int32>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<int64>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<uint8>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<uint16>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<uint32>
{
enum{ID = float_or_int_value::GLM_INT};
};
template <>
struct float_or_int_trait<uint64>
{
enum{ID = float_or_int_value::GLM_INT};
};
}//namespace detail
}//namespace glm
#endif//glm_core_type_int

View File

@ -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

View File

@ -9,6 +9,7 @@
namespace gli
{
/*
inline texture2D generateMipmaps
(
texture2D const & Image,
@ -64,5 +65,5 @@ namespace gli
return Result;
}
*/
}//namespace gli