mirror of
https://github.com/g-truc/glm.git
synced 2024-11-26 10:14:35 +00:00
Improved aligned types support
This commit is contained in:
parent
ad1ae45066
commit
8c8c8367e3
@ -7,18 +7,23 @@ namespace glm
|
||||
{
|
||||
enum precision
|
||||
{
|
||||
aligned_highp,
|
||||
aligned_mediump,
|
||||
aligned_lowp,
|
||||
packed_highp,
|
||||
packed_mediump,
|
||||
packed_lowp,
|
||||
aligned = aligned_highp,
|
||||
packed = packed_highp,
|
||||
|
||||
# if GLM_HAS_ALIGNED_TYPE
|
||||
aligned_highp,
|
||||
aligned_mediump,
|
||||
aligned_lowp,
|
||||
aligned = aligned_highp,
|
||||
# endif
|
||||
|
||||
highp = packed_highp,
|
||||
mediump = packed_mediump,
|
||||
lowp = packed_lowp,
|
||||
# ifdef GLM_FORCE_ALIGNED
|
||||
packed = packed_highp,
|
||||
|
||||
# if GLM_HAS_ALIGNED_TYPE && defined(GLM_FORCE_ALIGNED)
|
||||
defaultp = aligned_highp
|
||||
# else
|
||||
defaultp = highp
|
||||
@ -33,22 +38,24 @@ namespace detail
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_aligned<glm::aligned_lowp>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
# if GLM_HAS_ALIGNED_TYPE
|
||||
template<>
|
||||
struct is_aligned<glm::aligned_lowp>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_aligned<glm::aligned_mediump>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
template<>
|
||||
struct is_aligned<glm::aligned_mediump>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_aligned<glm::aligned_highp>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
template<>
|
||||
struct is_aligned<glm::aligned_highp>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
# endif
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
@ -50,6 +50,9 @@
|
||||
#include "./gtc/type_ptr.hpp"
|
||||
#include "./gtc/ulp.hpp"
|
||||
#include "./gtc/vec1.hpp"
|
||||
#if GLM_HAS_ALIGNED_TYPE
|
||||
# include "./gtc/type_aligned.hpp"
|
||||
#endif
|
||||
|
||||
#include "./gtx/associated_min_max.hpp"
|
||||
#include "./gtx/bit.hpp"
|
||||
@ -95,7 +98,6 @@
|
||||
#endif
|
||||
#include "./gtx/transform.hpp"
|
||||
#include "./gtx/transform2.hpp"
|
||||
#include "./gtx/type_aligned.hpp"
|
||||
#include "./gtx/vector_angle.hpp"
|
||||
#include "./gtx/vector_query.hpp"
|
||||
#include "./gtx/wrap.hpp"
|
||||
|
@ -1,5 +1,21 @@
|
||||
/// @ref gtc_type_aligned
|
||||
/// @file glm/gtc/type_aligned.hpp
|
||||
///
|
||||
/// @see core (dependence)
|
||||
///
|
||||
/// @defgroup gtc_type_aligned GLM_GTC_type_aligned
|
||||
/// @ingroup gtc
|
||||
///
|
||||
/// @brief Aligned types.
|
||||
/// <glm/gtc/type_aligned.hpp> need to be included to use these features.
|
||||
|
||||
#if !GLM_HAS_ALIGNED_TYPE
|
||||
# error "GLM: Aligned types are not supported on this platform"
|
||||
#endif
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
|
||||
# pragma message("GLM: GLM_GTC_type_aligned extension included")
|
||||
#endif
|
||||
|
||||
#pragma once
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
#define GLM_MESSAGES
|
||||
#define GLM_FORCE_ALIGNED
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#if GLM_HAS_ALIGNED_TYPE
|
||||
#include <glm/gtc/type_aligned.hpp>
|
||||
|
||||
GLM_STATIC_ASSERT(glm::detail::is_aligned<glm::aligned_lowp>::value, "aligned_lowp is not aligned");
|
||||
@ -21,9 +23,7 @@ struct my_vec4_aligned
|
||||
glm::uint32 a;
|
||||
glm::aligned_vec4 b;
|
||||
};
|
||||
#if GLM_HAS_ALIGNED_TYPE
|
||||
GLM_STATIC_ASSERT(sizeof(my_vec4_aligned) == sizeof(glm::aligned_vec4) * 2, "glm::vec4 aligned is not correct");
|
||||
#endif
|
||||
GLM_STATIC_ASSERT(sizeof(my_vec4_aligned) == sizeof(glm::aligned_vec4) * 2, "glm::vec4 aligned is not correct");
|
||||
|
||||
struct my_dvec4_packed
|
||||
{
|
||||
@ -51,9 +51,7 @@ struct my_ivec4_aligned
|
||||
glm::uint32 a;
|
||||
glm::aligned_ivec4 b;
|
||||
};
|
||||
#if GLM_HAS_ALIGNED_TYPE
|
||||
GLM_STATIC_ASSERT(sizeof(my_ivec4_aligned) == sizeof(glm::aligned_ivec4) * 2, "glm::ivec4 aligned is not correct");
|
||||
#endif
|
||||
GLM_STATIC_ASSERT(sizeof(my_ivec4_aligned) == sizeof(glm::aligned_ivec4) * 2, "glm::ivec4 aligned is not correct");
|
||||
|
||||
struct my_u8vec4_packed
|
||||
{
|
||||
@ -92,7 +90,6 @@ int test_copy()
|
||||
return Error;
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
@ -110,3 +107,12 @@ int main()
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif//GLM_HAS_ALIGNED_TYPE
|
||||
|
Loading…
Reference in New Issue
Block a user