Commit bfad7296 authored by Philip Trettner's avatar Philip Trettner

Updated glm

parent 5c1f035e
...@@ -33,50 +33,158 @@ ...@@ -33,50 +33,158 @@
#define GLM_MESSAGES #define GLM_MESSAGES
#include "../glm.hpp" #include "../glm.hpp"
#include <limits> #include <limits>
/*
#if(GLM_ARCH & GLM_ARCH_SSE2)
struct float4
{
union
{
struct {float r, g, b, a;};
struct {float s, t, p, q;};
struct {float x, y, z, w;};
__m128 data;
};
};
int test_simd() struct material
{ {
float4 f; glm::vec4 emission; // Ecm
glm::vec4 ambient; // Acm
glm::vec4 diffuse; // Dcm
glm::vec4 specular; // Scm
float shininess; // Srm
};
struct light
{
glm::vec4 ambient; // Acli
glm::vec4 diffuse; // Dcli
glm::vec4 specular; // Scli
glm::vec4 position; // Ppli
glm::vec4 halfVector; // Derived: Hi
glm::vec3 spotDirection; // Sdli
float spotExponent; // Srli
float spotCutoff; // Crli
// (range: [0.0,90.0], 180.0)
float spotCosCutoff; // Derived: cos(Crli)
// (range: [1.0,0.0],-1.0)
float constantAttenuation; // K0
float linearAttenuation; // K1
float quadraticAttenuation;// K2
};
// Sample 1
#include <glm/vec3.hpp>// glm::vec3
#include <glm/geometric.hpp>// glm::cross, glm::normalize
return 0; glm::vec3 computeNormal
(
glm::vec3 const & a,
glm::vec3 const & b,
glm::vec3 const & c
)
{
return glm::normalize(glm::cross(c - a, b - a));
} }
#endif//GLM_ARCH typedef unsigned int GLuint;
*/ #define GL_FALSE 0
void glUniformMatrix4fv(GLuint, int, int, float*){}
template <class T = int> // Sample 2
class C; #include <glm/vec3.hpp> // glm::vec3
#include <glm/vec4.hpp> // glm::vec4, glm::ivec4
#include <glm/mat4x4.hpp> // glm::mat4
#include <glm/gtc/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale, glm::perspective
#include <glm/gtc/type_ptr.hpp> // glm::value_ptr
void func(GLuint LocationMVP, float Translate, glm::vec2 const & Rotate)
{
glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.f);
glm::mat4 ViewTranslate = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -Translate));
glm::mat4 ViewRotateX = glm::rotate(ViewTranslate, Rotate.y, glm::vec3(-1.0f, 0.0f, 0.0f));
glm::mat4 View = glm::rotate(ViewRotateX, Rotate.x, glm::vec3(0.0f, 1.0f, 0.0f));
glm::mat4 Model = glm::scale(glm::mat4(1.0f), glm::vec3(0.5f));
glm::mat4 MVP = Projection * View * Model;
glUniformMatrix4fv(LocationMVP, 1, GL_FALSE, glm::value_ptr(MVP));
}
template <class T> // Sample 3
class C #include <glm/vec2.hpp>// glm::vec2
#include <glm/packing.hpp>// glm::packUnorm2x16
#include <glm/integer.hpp>// glm::uint
#include <glm/gtc/type_precision.hpp>// glm::i8vec2, glm::i32vec2
std::size_t const VertexCount = 4;
// Float quad geometry
std::size_t const PositionSizeF32 = VertexCount * sizeof(glm::vec2);
glm::vec2 const PositionDataF32[VertexCount] =
{
glm::vec2(-1.0f,-1.0f),
glm::vec2( 1.0f,-1.0f),
glm::vec2( 1.0f, 1.0f),
glm::vec2(-1.0f, 1.0f)
};
// Half-float quad geometry
std::size_t const PositionSizeF16 = VertexCount * sizeof(glm::uint);
glm::uint const PositionDataF16[VertexCount] =
{ {
public: glm::uint(glm::packUnorm2x16(glm::vec2(-1.0f, -1.0f))),
T value; glm::uint(glm::packUnorm2x16(glm::vec2( 1.0f, -1.0f))),
glm::uint(glm::packUnorm2x16(glm::vec2( 1.0f, 1.0f))),
glm::uint(glm::packUnorm2x16(glm::vec2(-1.0f, 1.0f)))
};
// 8 bits signed integer quad geometry
std::size_t const PositionSizeI8 = VertexCount * sizeof(glm::i8vec2);
glm::i8vec2 const PositionDataI8[VertexCount] =
{
glm::i8vec2(-1,-1),
glm::i8vec2( 1,-1),
glm::i8vec2( 1, 1),
glm::i8vec2(-1, 1)
};
// 32 bits signed integer quad geometry
std::size_t const PositionSizeI32 = VertexCount * sizeof(glm::i32vec2);
glm::i32vec2 const PositionDataI32[VertexCount] =
{
glm::i32vec2 (-1,-1),
glm::i32vec2 ( 1,-1),
glm::i32vec2 ( 1, 1),
glm::i32vec2 (-1, 1)
}; };
int main() struct intersection
{ {
/* glm::vec4 position;
# if(GLM_ARCH & GLM_ARCH_SSE2) glm::vec3 normal;
test_simd(); };
# endif
*/
C<> c; /*
// Sample 4
#include <glm/vec3.hpp>// glm::vec3
#include <glm/geometric.hpp>// glm::normalize, glm::dot, glm::reflect
#include <glm/exponential.hpp>// glm::pow
#include <glm/gtc/random.hpp>// glm::vecRand3
glm::vec3 lighting
(
intersection const & Intersection,
material const & Material,
light const & Light,
glm::vec3 const & View
)
{
glm::vec3 Color(0.0f);
glm::vec3 LightVertor(glm::normalize(
Light.position - Intersection.position +
glm::vecRand3(0.0f, Light.inaccuracy));
if(!shadow(Intersection.position, Light.position, LightVertor))
{
float Diffuse = glm::dot(Intersection.normal, LightVector);
if(Diffuse <= 0.0f)
return Color;
if(Material.isDiffuse())
Color += Light.color() * Material.diffuse * Diffuse;
if(Material.isSpecular())
{
glm::vec3 Reflect(glm::reflect(
glm::normalize(-LightVector),
glm::normalize(Intersection.normal)));
float Dot = glm::dot(Reflect, View);
float Base = Dot > 0.0f ? Dot : 0.0f;
float Specular = glm::pow(Base, Material.exponent);
Color += Material.specular * Specular;
}
}
return Color;
}
*/
int main()
{
return 0; return 0;
} }
......
...@@ -45,7 +45,7 @@ namespace detail ...@@ -45,7 +45,7 @@ namespace detail
struct compute_log2<true> struct compute_log2<true>
{ {
template <typename T> template <typename T>
T operator() (T const & Value) const GLM_FUNC_QUALIFIER T operator() (T const & Value) const
{ {
return static_cast<T>(::std::log(Value)) * static_cast<T>(1.4426950408889634073599246810019); return static_cast<T>(::std::log(Value)) * static_cast<T>(1.4426950408889634073599246810019);
} }
...@@ -54,7 +54,7 @@ namespace detail ...@@ -54,7 +54,7 @@ namespace detail
template <template <class, precision> class vecType, typename T, precision P> template <template <class, precision> class vecType, typename T, precision P>
struct compute_inversesqrt struct compute_inversesqrt
{ {
static vecType<T, P> call(vecType<T, P> const & x) GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
{ {
return static_cast<T>(1) / sqrt(x); return static_cast<T>(1) / sqrt(x);
} }
...@@ -63,7 +63,7 @@ namespace detail ...@@ -63,7 +63,7 @@ namespace detail
template <template <class, precision> class vecType> template <template <class, precision> class vecType>
struct compute_inversesqrt<vecType, float, lowp> struct compute_inversesqrt<vecType, float, lowp>
{ {
static vecType<float, lowp> call(vecType<float, lowp> const & x) GLM_FUNC_QUALIFIER static vecType<float, lowp> call(vecType<float, lowp> const & x)
{ {
vecType<float, lowp> tmp(x); vecType<float, lowp> tmp(x);
vecType<float, lowp> xhalf(tmp * 0.5f); vecType<float, lowp> xhalf(tmp * 0.5f);
...@@ -160,7 +160,7 @@ namespace detail ...@@ -160,7 +160,7 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
struct compute_sqrt<detail::tvec1, T, P> struct compute_sqrt<detail::tvec1, T, P>
{ {
static detail::tvec1<T, P> call(detail::tvec1<T, P> const & x) GLM_FUNC_QUALIFIER static detail::tvec1<T, P> call(detail::tvec1<T, P> const & x)
{ {
return detail::tvec1<T, P>(std::sqrt(x.x)); return detail::tvec1<T, P>(std::sqrt(x.x));
} }
...@@ -169,7 +169,7 @@ namespace detail ...@@ -169,7 +169,7 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
struct compute_sqrt<detail::tvec2, T, P> struct compute_sqrt<detail::tvec2, T, P>
{ {
static detail::tvec2<T, P> call(detail::tvec2<T, P> const & x) GLM_FUNC_QUALIFIER static detail::tvec2<T, P> call(detail::tvec2<T, P> const & x)
{ {
return detail::tvec2<T, P>(std::sqrt(x.x), std::sqrt(x.y)); return detail::tvec2<T, P>(std::sqrt(x.x), std::sqrt(x.y));
} }
...@@ -178,7 +178,7 @@ namespace detail ...@@ -178,7 +178,7 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
struct compute_sqrt<detail::tvec3, T, P> struct compute_sqrt<detail::tvec3, T, P>
{ {
static detail::tvec3<T, P> call(detail::tvec3<T, P> const & x) GLM_FUNC_QUALIFIER static detail::tvec3<T, P> call(detail::tvec3<T, P> const & x)
{ {
return detail::tvec3<T, P>(std::sqrt(x.x), std::sqrt(x.y), std::sqrt(x.z)); return detail::tvec3<T, P>(std::sqrt(x.x), std::sqrt(x.y), std::sqrt(x.z));
} }
...@@ -187,7 +187,7 @@ namespace detail ...@@ -187,7 +187,7 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
struct compute_sqrt<detail::tvec4, T, P> struct compute_sqrt<detail::tvec4, T, P>
{ {
static detail::tvec4<T, P> call(detail::tvec4<T, P> const & x) GLM_FUNC_QUALIFIER static detail::tvec4<T, P> call(detail::tvec4<T, P> const & x)
{ {
return detail::tvec4<T, P>(std::sqrt(x.x), std::sqrt(x.y), std::sqrt(x.z), std::sqrt(x.w)); return detail::tvec4<T, P>(std::sqrt(x.x), std::sqrt(x.y), std::sqrt(x.z), std::sqrt(x.w));
} }
...@@ -197,12 +197,22 @@ namespace detail ...@@ -197,12 +197,22 @@ namespace detail
// sqrt // sqrt
GLM_FUNC_QUALIFIER float sqrt(float x) GLM_FUNC_QUALIFIER float sqrt(float x)
{ {
return detail::compute_sqrt<detail::tvec1, float, highp>::call(x).x; # ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6
detail::tvec1<float, highp> tmp(detail::compute_sqrt<detail::tvec1, float, highp>::call(x));
return tmp.x;
# else
return detail::compute_sqrt<detail::tvec1, float, highp>::call(x).x;
# endif
} }
GLM_FUNC_QUALIFIER double sqrt(double x) GLM_FUNC_QUALIFIER double sqrt(double x)
{ {
return detail::compute_sqrt<detail::tvec1, double, highp>::call(x).x; # ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6
detail::tvec1<double, highp> tmp(detail::compute_sqrt<detail::tvec1, double, highp>::call(x));
return tmp.x;
# else
return detail::compute_sqrt<detail::tvec1, double, highp>::call(x).x;
# endif
} }
template <typename T, precision P, template <typename, precision> class vecType> template <typename T, precision P, template <typename, precision> class vecType>
......
...@@ -41,16 +41,21 @@ namespace detail ...@@ -41,16 +41,21 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
struct compute_dot<detail::tvec1, T, P> struct compute_dot<detail::tvec1, T, P>
{ {
static T call(detail::tvec1<T, P> const & x, detail::tvec1<T, P> const & y) GLM_FUNC_QUALIFIER static T call(detail::tvec1<T, P> const & x, detail::tvec1<T, P> const & y)
{ {
return detail::tvec1<T, P>(x * y).x; # ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6
detail::tvec1<T, P> tmp(x * y);
return tmp.x;
# else
return detail::tvec1<T, P>(x * y).x;
# endif
} }
}; };
template <typename T, precision P> template <typename T, precision P>
struct compute_dot<detail::tvec2, T, P> struct compute_dot<detail::tvec2, T, P>
{ {
static T call(detail::tvec2<T, P> const & x, detail::tvec2<T, P> const & y) GLM_FUNC_QUALIFIER static T call(detail::tvec2<T, P> const & x, detail::tvec2<T, P> const & y)
{ {
detail::tvec2<T, P> tmp(x * y); detail::tvec2<T, P> tmp(x * y);
return tmp.x + tmp.y; return tmp.x + tmp.y;
...@@ -60,7 +65,7 @@ namespace detail ...@@ -60,7 +65,7 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
struct compute_dot<detail::tvec3, T, P> struct compute_dot<detail::tvec3, T, P>
{ {
static T call(detail::tvec3<T, P> const & x, detail::tvec3<T, P> const & y) GLM_FUNC_QUALIFIER static T call(detail::tvec3<T, P> const & x, detail::tvec3<T, P> const & y)
{ {
detail::tvec3<T, P> tmp(x * y); detail::tvec3<T, P> tmp(x * y);
return tmp.x + tmp.y + tmp.z; return tmp.x + tmp.y + tmp.z;
...@@ -70,7 +75,7 @@ namespace detail ...@@ -70,7 +75,7 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
struct compute_dot<detail::tvec4, T, P> struct compute_dot<detail::tvec4, T, P>
{ {
static T call(detail::tvec4<T, P> const & x, detail::tvec4<T, P> const & y) GLM_FUNC_QUALIFIER static T call(detail::tvec4<T, P> const & x, detail::tvec4<T, P> const & y)
{ {
detail::tvec4<T, P> tmp(x * y); detail::tvec4<T, P> tmp(x * y);
return (tmp.x + tmp.y) + (tmp.z + tmp.w); return (tmp.x + tmp.y) + (tmp.z + tmp.w);
......
...@@ -110,10 +110,10 @@ namespace glm ...@@ -110,10 +110,10 @@ namespace glm
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch"); GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
Borrow = x >= y ? static_cast<uint32>(0) : static_cast<uint32>(1); Borrow = x >= y ? static_cast<uint32>(0) : static_cast<uint32>(1);
if(x > y) if(y >= x)
return static_cast<uint32>(static_cast<int64>(x) -static_cast<int64>(y)); return y - x;
else else
return static_cast<uint32>((static_cast<int64>(1) << static_cast<int64>(32)) + static_cast<int64>(x) - static_cast<int64>(y)); return static_cast<uint32>((static_cast<int64>(1) << static_cast<int64>(32)) + (static_cast<int64>(y) - static_cast<int64>(x)));
} }
template <> template <>
...@@ -171,8 +171,10 @@ namespace glm ...@@ -171,8 +171,10 @@ namespace glm
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch"); GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
uint64 Value64 = static_cast<uint64>(x) * static_cast<uint64>(y); uint64 Value64 = static_cast<uint64>(x) * static_cast<uint64>(y);
msb = *(reinterpret_cast<uint32*>(&Value64) + 1); uint32* PointerMSB = (reinterpret_cast<uint32*>(&Value64) + 1);
lsb = reinterpret_cast<uint32&>(Value64); msb = *PointerMSB;
uint32* PointerLSB = (reinterpret_cast<uint32*>(&Value64) + 0);
lsb = *PointerLSB;
} }
template <> template <>
...@@ -230,8 +232,10 @@ namespace glm ...@@ -230,8 +232,10 @@ namespace glm
GLM_STATIC_ASSERT(sizeof(int) == sizeof(int32), "int and int32 size mismatch"); GLM_STATIC_ASSERT(sizeof(int) == sizeof(int32), "int and int32 size mismatch");
int64 Value64 = static_cast<int64>(x) * static_cast<int64>(y); int64 Value64 = static_cast<int64>(x) * static_cast<int64>(y);
msb = *(reinterpret_cast<int32*>(&Value64) + 1); int32* PointerMSB = (reinterpret_cast<int32*>(&Value64) + 1);
lsb = reinterpret_cast<int32&>(Value64); msb = *PointerMSB;
int32* PointerLSB = (reinterpret_cast<int32*>(&Value64));
lsb = *PointerLSB;
} }
template <> template <>
......
...@@ -48,7 +48,7 @@ GLM_FUNC_QUALIFIER __m128 sse_dst_ps(__m128 p0, __m128 p1) ...@@ -48,7 +48,7 @@ GLM_FUNC_QUALIFIER __m128 sse_dst_ps(__m128 p0, __m128 p1)
//dot //dot
GLM_FUNC_QUALIFIER __m128 sse_dot_ps(__m128 v1, __m128 v2) GLM_FUNC_QUALIFIER __m128 sse_dot_ps(__m128 v1, __m128 v2)
{ {
# if((GLM_ARCH & GLM_ARCH_SSE4) == GLM_ARCH_SSE4) # if((GLM_ARCH & GLM_ARCH_AVX) == GLM_ARCH_AVX)
return _mm_dp_ps(v1, v2, 0xff); return _mm_dp_ps(v1, v2, 0xff);
# else # else
__m128 mul0 = _mm_mul_ps(v1, v2); __m128 mul0 = _mm_mul_ps(v1, v2);
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#define GLM_VERSION_MAJOR 0 #define GLM_VERSION_MAJOR 0
#define GLM_VERSION_MINOR 9 #define GLM_VERSION_MINOR 9
#define GLM_VERSION_PATCH 5 #define GLM_VERSION_PATCH 5
#define GLM_VERSION_REVISION 2 #define GLM_VERSION_REVISION 3
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
// Platform // Platform
...@@ -211,6 +211,9 @@ ...@@ -211,6 +211,9 @@
// CUDA // CUDA
#elif defined(__CUDACC__) #elif defined(__CUDACC__)
# if !defined(CUDA_VERSION) && !defined(GLM_FORCE_CUDA)
# include <cuda.h> // make sure version is defined since nvcc does not define it itself!
# endif
# if CUDA_VERSION < 3000 # if CUDA_VERSION < 3000
# error "GLM requires CUDA 3.0 or higher" # error "GLM requires CUDA 3.0 or higher"
# else # else
...@@ -550,9 +553,8 @@ ...@@ -550,9 +553,8 @@
#define GLM_ARCH_PURE 0x0000 #define GLM_ARCH_PURE 0x0000
#define GLM_ARCH_SSE2 0x0001 #define GLM_ARCH_SSE2 0x0001
#define GLM_ARCH_SSE3 0x0002// | GLM_ARCH_SSE2 #define GLM_ARCH_SSE3 0x0002// | GLM_ARCH_SSE2
#define GLM_ARCH_SSE4 0x0004// | GLM_ARCH_SSE3 | GLM_ARCH_SSE2 #define GLM_ARCH_AVX 0x0008// | GLM_ARCH_SSE3 | GLM_ARCH_SSE2
#define GLM_ARCH_AVX 0x0008// | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2 #define GLM_ARCH_AVX2 0x0010// | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2
#define GLM_ARCH_AVX2 0x0010// | GLM_ARCH_AVX | GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2
#if(defined(GLM_FORCE_PURE)) #if(defined(GLM_FORCE_PURE))
# define GLM_ARCH GLM_ARCH_PURE # define GLM_ARCH GLM_ARCH_PURE
...@@ -560,51 +562,32 @@ ...@@ -560,51 +562,32 @@
# define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
#elif(defined(GLM_FORCE_AVX)) #elif(defined(GLM_FORCE_AVX))
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
#elif(defined(GLM_FORCE_SSE4))
# define GLM_ARCH (GLM_ARCH_SSE4 | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
#elif(defined(GLM_FORCE_SSE3)) #elif(defined(GLM_FORCE_SSE3))
# define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2) # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
#elif(defined(GLM_FORCE_SSE2)) #elif(defined(GLM_FORCE_SSE2))
# define GLM_ARCH (GLM_ARCH_SSE2) # define GLM_ARCH (GLM_ARCH_SSE2)
#elif((GLM_COMPILER & GLM_COMPILER_VC) && (defined(_M_IX86) || defined(_M_X64))) #elif(GLM_COMPILER & GLM_COMPILER_VC)
# if(GLM_PLATFORM == GLM_PLATFORM_WINCE) # if _M_IX86_FP == 2 && defined(__AVX__)
# define GLM_ARCH GLM_ARCH_PURE
# elif(defined(_M_CEE_PURE))
# define GLM_ARCH GLM_ARCH_PURE
/* TODO: Explore auto detection of instruction set support
# elif(defined(_M_IX86_FP))
# if(_M_IX86_FP >= 3)
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif(_M_IX86_FP >= 2)
# define GLM_ARCH (GLM_ARCH_SSE2)
# else
# define GLM_ARCH GLM_ARCH_PURE
# endif
*/
# elif(GLM_COMPILER >= GLM_COMPILER_VC11)
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2) # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif(GLM_COMPILER >= GLM_COMPILER_VC10) # elif _M_IX86_FP == 2
# if(_MSC_FULL_VER >= 160031118) //160031118: VC2010 SP1 beta full version # define GLM_ARCH (GLM_ARCH_SSE2)
# define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)//GLM_ARCH_AVX (Require SP1)
# else
# define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# endif
# elif(GLM_COMPILER >= GLM_COMPILER_VC9)
# define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif(GLM_COMPILER >= GLM_COMPILER_VC8)
# define GLM_ARCH GLM_ARCH_SSE2
# else # else
# define GLM_ARCH GLM_ARCH_PURE # define GLM_ARCH (GLM_ARCH_PURE)
# endif # endif
#elif((GLM_PLATFORM & GLM_PLATFORM_APPLE) && (GLM_COMPILER & GLM_COMPILER_GCC)) #elif((GLM_PLATFORM & GLM_PLATFORM_APPLE) && (GLM_COMPILER & GLM_COMPILER_GCC))
# define GLM_ARCH GLM_ARCH_PURE # define GLM_ARCH GLM_ARCH_PURE
#elif(((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))) || (GLM_COMPILER & GLM_COMPILER_LLVM_GCC)) #elif(((GLM_COMPILER & GLM_COMPILER_GCC) && (defined(__i386__) || defined(__x86_64__))) || (GLM_COMPILER & GLM_COMPILER_LLVM_GCC))
# define GLM_ARCH (GLM_ARCH_PURE \ # if defined(__AVX2__)
| (defined(__AVX2__) ? GLM_ARCH_AVX2 : 0) \ # define GLM_ARCH (GLM_ARCH_AVX2 | GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
| (defined(__AVX__) ? GLM_ARCH_AVX : 0) \ # elif defined(__AVX__)
| (defined(__SSE4__) ? GLM_ARCH_SSE4 : 0) \ # define GLM_ARCH (GLM_ARCH_AVX | GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
| (defined(__SSE3__) ? GLM_ARCH_SSE3 : 0) \ # elif defined(__SSE3__)
| (defined(__SSE2__) ? GLM_ARCH_SSE2 : 0)) # define GLM_ARCH (GLM_ARCH_SSE3 | GLM_ARCH_SSE2)
# elif defined(__SSE2__)
# define GLM_ARCH (GLM_ARCH_SSE2)
# else
# define GLM_ARCH (GLM_ARCH_PURE)
# endif
#else #else
# define GLM_ARCH GLM_ARCH_PURE # define GLM_ARCH GLM_ARCH_PURE
#endif #endif
......
...@@ -137,7 +137,7 @@ namespace detail ...@@ -137,7 +137,7 @@ namespace detail
T const & s); T const & s);
template <typename T, precision P> template <typename T, precision P>
tmat2x3<T, P> operator+ ( GLM_FUNC_DECL tmat2x3<T, P> operator+ (
tmat2x3<T, P> const & m1, tmat2x3<T, P> const & m1,
tmat2x3<T, P> const & m2); tmat2x3<T, P> const & m2);
......
...@@ -120,7 +120,9 @@ ...@@ -120,7 +120,9 @@
#include "./gtx/rotate_vector.hpp" #include "./gtx/rotate_vector.hpp"
#include "./gtx/spline.hpp" #include "./gtx/spline.hpp"
#include "./gtx/std_based_type.hpp" #include "./gtx/std_based_type.hpp"
#include "./gtx/string_cast.hpp" #if(!(GLM_COMPILER & GLM_COMPILER_CUDA))
# include "./gtx/string_cast.hpp"
#endif
#include "./gtx/transform.hpp" #include "./gtx/transform.hpp"
#include "./gtx/transform2.hpp" #include "./gtx/transform2.hpp"
#include "./gtx/vec1.hpp" #include "./gtx/vec1.hpp"
......
...@@ -52,14 +52,14 @@ namespace glm ...@@ -52,14 +52,14 @@ namespace glm
/// Get a specific row of a matrix. /// Get a specific row of a matrix.
/// @see gtc_matrix_access /// @see gtc_matrix_access
template <typename genType> template <typename genType>
typename genType::row_type row( GLM_FUNC_DECL typename genType::row_type row(
genType const & m, genType const & m,
length_t const & index); length_t const & index);
/// Set a specific row to a matrix. /// Set a specific row to a matrix.
/// @see gtc_matrix_access /// @see gtc_matrix_access
template <typename genType> template <typename genType>
genType row( GLM_FUNC_DECL genType row(
genType const & m, genType const & m,
length_t const & index, length_t const & index,
typename genType::row_type const & x); typename genType::row_type const & x);
...@@ -67,14 +67,14 @@ namespace glm ...@@ -67,14 +67,14 @@ namespace glm
/// Get a specific column of a matrix. /// Get a specific column of a matrix.
/// @see gtc_matrix_access /// @see gtc_matrix_access
template <typename genType> template <typename genType>
typename genType::col_type column( GLM_FUNC_DECL typename genType::col_type column(
genType const & m, genType const & m,
length_t const & index); length_t const & index);
/// Set a specific column to a matrix. /// Set a specific column to a matrix.
/// @see gtc_matrix_access /// @see gtc_matrix_access
template <typename genType> template <typename genType>
genType column( GLM_FUNC_DECL genType column(
genType const & m, genType const & m,
length_t const & index, length_t const & index,
typename genType::col_type const & x); typename genType::col_type const & x);
......
...@@ -55,7 +55,7 @@ namespace glm ...@@ -55,7 +55,7 @@ namespace glm
/// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-precision floating point value is highly innacurate. /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-precision floating point value is highly innacurate.
/// @see gtc_matrix_inverse /// @see gtc_matrix_inverse
template <typename genType> template <typename genType>
GLM_FUNC_QUALIFIER genType affineInverse(genType const & m); GLM_FUNC_DECL genType affineInverse(genType const & m);
/// Compute the inverse transpose of a matrix. /// Compute the inverse transpose of a matrix.
/// ///
...@@ -63,7 +63,7 @@ namespace glm ...@@ -63,7 +63,7 @@ namespace glm
/// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-precision floating point value is highly innacurate. /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-precision floating point value is highly innacurate.