Accepting request 378294 from devel:libraries:c_c++
1 OBS-URL: https://build.opensuse.org/request/show/378294 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/glm?expand=0&rev=7
This commit is contained in:
parent
9d66a6403c
commit
1e7a6dc685
527
aliasing.patch
527
aliasing.patch
@ -1,527 +0,0 @@
|
|||||||
Index: glm/glm/detail/func_common.inl
|
|
||||||
===================================================================
|
|
||||||
--- glm.orig/glm/detail/func_common.inl
|
|
||||||
+++ glm/glm/detail/func_common.inl
|
|
||||||
@@ -850,7 +850,9 @@ namespace detail
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER int floatBitsToInt(float const & v)
|
|
||||||
{
|
|
||||||
- return reinterpret_cast<int&>(const_cast<float&>(v));
|
|
||||||
+ int Bits;
|
|
||||||
+ std::memcpy(&Bits, &v, sizeof(Bits));
|
|
||||||
+ return Bits;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <template <typename, precision> class vecType, precision P>
|
|
||||||
@@ -861,7 +863,9 @@ namespace detail
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER uint floatBitsToUint(float const & v)
|
|
||||||
{
|
|
||||||
- return reinterpret_cast<uint&>(const_cast<float&>(v));
|
|
||||||
+ uint Bits;
|
|
||||||
+ std::memcpy(&Bits, &v, sizeof(Bits));
|
|
||||||
+ return Bits;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <template <typename, precision> class vecType, precision P>
|
|
||||||
@@ -872,7 +876,9 @@ namespace detail
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER float intBitsToFloat(int const & v)
|
|
||||||
{
|
|
||||||
- return reinterpret_cast<float&>(const_cast<int&>(v));
|
|
||||||
+ float Float;
|
|
||||||
+ std::memcpy(&Float, &v, sizeof(Float));
|
|
||||||
+ return Float;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <template <typename, precision> class vecType, precision P>
|
|
||||||
@@ -883,7 +889,9 @@ namespace detail
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER float uintBitsToFloat(uint const & v)
|
|
||||||
{
|
|
||||||
- return reinterpret_cast<float&>(const_cast<uint&>(v));
|
|
||||||
+ float Float;
|
|
||||||
+ std::memcpy(&Float, &v, sizeof(Float));
|
|
||||||
+ return Float;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <template <typename, precision> class vecType, precision P>
|
|
||||||
Index: glm/glm/detail/func_integer.inl
|
|
||||||
===================================================================
|
|
||||||
--- glm.orig/glm/detail/func_integer.inl
|
|
||||||
+++ glm/glm/detail/func_integer.inl
|
|
||||||
@@ -171,10 +171,8 @@ namespace glm
|
|
||||||
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
|
|
||||||
|
|
||||||
uint64 Value64 = static_cast<uint64>(x) * static_cast<uint64>(y);
|
|
||||||
- uint32* PointerMSB = (reinterpret_cast<uint32*>(&Value64) + 1);
|
|
||||||
- msb = *PointerMSB;
|
|
||||||
- uint32* PointerLSB = (reinterpret_cast<uint32*>(&Value64) + 0);
|
|
||||||
- lsb = *PointerLSB;
|
|
||||||
+ msb = Value64 >> 32;
|
|
||||||
+ lsb = Value64;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
|
||||||
@@ -232,10 +230,8 @@ namespace glm
|
|
||||||
GLM_STATIC_ASSERT(sizeof(int) == sizeof(int32), "int and int32 size mismatch");
|
|
||||||
|
|
||||||
int64 Value64 = static_cast<int64>(x) * static_cast<int64>(y);
|
|
||||||
- int32* PointerMSB = (reinterpret_cast<int32*>(&Value64) + 1);
|
|
||||||
- msb = *PointerMSB;
|
|
||||||
- int32* PointerLSB = (reinterpret_cast<int32*>(&Value64));
|
|
||||||
- lsb = *PointerLSB;
|
|
||||||
+ msb = Value64 >> 32;
|
|
||||||
+ lsb = Value64;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
|
||||||
Index: glm/glm/detail/func_packing.inl
|
|
||||||
===================================================================
|
|
||||||
--- glm.orig/glm/detail/func_packing.inl
|
|
||||||
+++ glm/glm/detail/func_packing.inl
|
|
||||||
@@ -35,24 +35,32 @@ namespace glm
|
|
||||||
GLM_FUNC_QUALIFIER uint packUnorm2x16(vec2 const & v)
|
|
||||||
{
|
|
||||||
u16vec2 Topack(round(clamp(v, 0.0f, 1.0f) * 65535.0f));
|
|
||||||
- return reinterpret_cast<uint&>(Topack);
|
|
||||||
+ uint Packed;
|
|
||||||
+ std::memcpy(&Packed, &Topack, sizeof(Packed));
|
|
||||||
+ return Packed;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER vec2 unpackUnorm2x16(uint const & p)
|
|
||||||
{
|
|
||||||
- vec2 Unpack(reinterpret_cast<u16vec2 const &>(p));
|
|
||||||
+ u16vec2 Packed;
|
|
||||||
+ std::memcpy(&Packed, &p, sizeof(Packed));
|
|
||||||
+ vec2 Unpack(Packed);
|
|
||||||
return Unpack * float(1.5259021896696421759365224689097e-5); // 1.0 / 65535.0
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER uint packSnorm2x16(vec2 const & v)
|
|
||||||
{
|
|
||||||
i16vec2 Topack(round(clamp(v ,-1.0f, 1.0f) * 32767.0f));
|
|
||||||
- return reinterpret_cast<uint32&>(Topack);
|
|
||||||
+ uint32 Packed;
|
|
||||||
+ std::memcpy(&Packed, &Topack, sizeof(Packed));
|
|
||||||
+ return Packed;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER vec2 unpackSnorm2x16(uint const & p)
|
|
||||||
{
|
|
||||||
- vec2 Unpack(reinterpret_cast<i16vec2 const &>(p));
|
|
||||||
+ i16vec2 Packed;
|
|
||||||
+ std::memcpy(&Packed, &p, sizeof(Packed));
|
|
||||||
+ vec2 Unpack(Packed);
|
|
||||||
return clamp(
|
|
||||||
Unpack * 3.0518509475997192297128208258309e-5f, //1.0f / 32767.0f,
|
|
||||||
-1.0f, 1.0f);
|
|
||||||
@@ -61,24 +69,32 @@ namespace glm
|
|
||||||
GLM_FUNC_QUALIFIER uint packUnorm4x8(vec4 const & v)
|
|
||||||
{
|
|
||||||
u8vec4 Topack(round(clamp(v, 0.0f, 1.0f) * 255.0f));
|
|
||||||
- return reinterpret_cast<uint&>(Topack);
|
|
||||||
+ uint Packed;
|
|
||||||
+ std::memcpy(&Packed, &Topack, sizeof(Packed));
|
|
||||||
+ return Packed;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER vec4 unpackUnorm4x8(uint const & p)
|
|
||||||
{
|
|
||||||
- vec4 Unpack(reinterpret_cast<u8vec4 const&>(p));
|
|
||||||
+ u8vec4 Packed;
|
|
||||||
+ std::memcpy(&Packed, &p, sizeof(Packed));
|
|
||||||
+ vec4 Unpack(Packed);
|
|
||||||
return Unpack * float(0.0039215686274509803921568627451); // 1 / 255
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER uint packSnorm4x8(vec4 const & v)
|
|
||||||
{
|
|
||||||
i8vec4 Topack(round(clamp(v ,-1.0f, 1.0f) * 127.0f));
|
|
||||||
- return reinterpret_cast<uint&>(Topack);
|
|
||||||
+ uint Packed;
|
|
||||||
+ std::memcpy(&Packed, &Topack, sizeof(Packed));
|
|
||||||
+ return Packed;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER glm::vec4 unpackSnorm4x8(uint const & p)
|
|
||||||
{
|
|
||||||
- vec4 Unpack(reinterpret_cast<i8vec4 const &>(p));
|
|
||||||
+ i8vec4 Packed;
|
|
||||||
+ std::memcpy(&Packed, &p, sizeof(Packed));
|
|
||||||
+ vec4 Unpack(Packed);
|
|
||||||
return clamp(
|
|
||||||
Unpack * 0.0078740157480315f, // 1.0f / 127.0f
|
|
||||||
-1.0f, 1.0f);
|
|
||||||
@@ -86,12 +102,16 @@ namespace glm
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER double packDouble2x32(uvec2 const & v)
|
|
||||||
{
|
|
||||||
- return reinterpret_cast<double const &>(v);
|
|
||||||
+ double Packed;
|
|
||||||
+ std::memcpy(&Packed, &v, sizeof(Packed));
|
|
||||||
+ return Packed;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER uvec2 unpackDouble2x32(double const & v)
|
|
||||||
{
|
|
||||||
- return reinterpret_cast<uvec2 const &>(v);
|
|
||||||
+ uvec2 Unpack;
|
|
||||||
+ std::memcpy(&Unpack, &v, sizeof(Unpack));
|
|
||||||
+ return Unpack;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER uint packHalf2x16(vec2 const & v)
|
|
||||||
@@ -100,13 +120,15 @@ namespace glm
|
|
||||||
detail::toFloat16(v.x),
|
|
||||||
detail::toFloat16(v.y));
|
|
||||||
|
|
||||||
- uint * Result = reinterpret_cast<uint*>(&Unpack);
|
|
||||||
- return *Result;
|
|
||||||
+ uint Packed;
|
|
||||||
+ std::memcpy(&Packed, &Unpack, sizeof(Packed));
|
|
||||||
+ return Packed;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER vec2 unpackHalf2x16(uint const & v)
|
|
||||||
{
|
|
||||||
- i16vec2 Unpack(reinterpret_cast<i16vec2 const &>(v));
|
|
||||||
+ i16vec2 Unpack;
|
|
||||||
+ std::memcpy(&Unpack, &v, sizeof(Unpack));
|
|
||||||
|
|
||||||
return vec2(
|
|
||||||
detail::toFloat32(Unpack.x),
|
|
||||||
Index: glm/glm/detail/setup.hpp
|
|
||||||
===================================================================
|
|
||||||
--- glm.orig/glm/detail/setup.hpp
|
|
||||||
+++ glm/glm/detail/setup.hpp
|
|
||||||
@@ -30,6 +30,7 @@
|
|
||||||
#define GLM_SETUP_INCLUDED
|
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
+#include <cstring>
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Version
|
|
||||||
Index: glm/glm/gtc/packing.inl
|
|
||||||
===================================================================
|
|
||||||
--- glm.orig/glm/gtc/packing.inl
|
|
||||||
+++ glm/glm/gtc/packing.inl
|
|
||||||
@@ -145,7 +145,9 @@ namespace detail
|
|
||||||
else if(glm::isinf(x))
|
|
||||||
return 0x1f << 6;
|
|
||||||
|
|
||||||
- return float2packed11(reinterpret_cast<uint&>(x));
|
|
||||||
+ uint Topack;
|
|
||||||
+ std::memcpy(&Topack, &x, sizeof(Topack));
|
|
||||||
+ return float2packed11(Topack);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER float packed11bitToFloat(glm::uint x)
|
|
||||||
@@ -158,7 +160,9 @@ namespace detail
|
|
||||||
return ~0;//Inf
|
|
||||||
|
|
||||||
uint result = packed11ToFloat(x);
|
|
||||||
- return reinterpret_cast<float&>(result);
|
|
||||||
+ float Unpack;
|
|
||||||
+ std::memcpy(&Unpack, &result, sizeof(Unpack));
|
|
||||||
+ return Unpack;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER glm::uint floatTo10bit(float x)
|
|
||||||
@@ -170,7 +174,9 @@ namespace detail
|
|
||||||
else if(glm::isinf(x))
|
|
||||||
return 0x1f << 5;
|
|
||||||
|
|
||||||
- return float2packed10(reinterpret_cast<uint&>(x));
|
|
||||||
+ uint Topack;
|
|
||||||
+ std::memcpy(&Topack, &x, sizeof(Topack));
|
|
||||||
+ return float2packed10(Topack);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER float packed10bitToFloat(glm::uint x)
|
|
||||||
@@ -183,7 +189,9 @@ namespace detail
|
|
||||||
return ~0;//Inf
|
|
||||||
|
|
||||||
uint result = packed10ToFloat(x);
|
|
||||||
- return reinterpret_cast<float&>(result);
|
|
||||||
+ float Unpack;
|
|
||||||
+ std::memcpy(&Unpack, &result, sizeof(Unpack));
|
|
||||||
+ return Unpack;
|
|
||||||
}
|
|
||||||
|
|
||||||
// GLM_FUNC_QUALIFIER glm::uint f11_f11_f10(float x, float y, float z)
|
|
||||||
@@ -231,21 +239,24 @@ namespace detail
|
|
||||||
GLM_FUNC_QUALIFIER uint16 packUnorm2x8(vec2 const & v)
|
|
||||||
{
|
|
||||||
u8vec2 Topack(round(clamp(v, 0.0f, 1.0f) * 255.0f));
|
|
||||||
- uint16* Packed = reinterpret_cast<uint16*>(&Topack);
|
|
||||||
- return *Packed;
|
|
||||||
+ uint16 Packed;
|
|
||||||
+ std::memcpy(&Packed, &Topack, sizeof(Packed));
|
|
||||||
+ return Packed;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER vec2 unpackUnorm2x8(uint16 const & p)
|
|
||||||
{
|
|
||||||
- u8vec2* Unpacked = reinterpret_cast<u8vec2*>(const_cast<uint16*>(&p));
|
|
||||||
- return vec2(*Unpacked) * float(0.0039215686274509803921568627451); // 1 / 255
|
|
||||||
+ u8vec2 Unpack;
|
|
||||||
+ std::memcpy(&Unpack, &p, sizeof(Unpack));
|
|
||||||
+ return vec2(Unpack) * float(0.0039215686274509803921568627451); // 1 / 255
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER uint8 packSnorm1x8(float const & v)
|
|
||||||
{
|
|
||||||
int8 Topack(static_cast<int8>(round(clamp(v ,-1.0f, 1.0f) * 127.0f)));
|
|
||||||
- uint8* Packed = reinterpret_cast<uint8*>(&Topack);
|
|
||||||
- return *Packed;
|
|
||||||
+ uint8 Packed;
|
|
||||||
+ std::memcpy(&Packed, &Topack, sizeof(Packed));
|
|
||||||
+ return Packed;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER float unpackSnorm1x8(uint8 const & p)
|
|
||||||
@@ -259,15 +270,17 @@ namespace detail
|
|
||||||
GLM_FUNC_QUALIFIER uint16 packSnorm2x8(vec2 const & v)
|
|
||||||
{
|
|
||||||
i8vec2 Topack(round(clamp(v ,-1.0f, 1.0f) * 127.0f));
|
|
||||||
- uint16* Packed = reinterpret_cast<uint16*>(&Topack);
|
|
||||||
- return *Packed;
|
|
||||||
+ uint16 Packed;
|
|
||||||
+ std::memcpy(&Packed, &Topack, sizeof(Packed));
|
|
||||||
+ return Packed;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER vec2 unpackSnorm2x8(uint16 const & p)
|
|
||||||
{
|
|
||||||
- i8vec2* Unpack = reinterpret_cast<i8vec2*>(const_cast<uint16*>(&p));
|
|
||||||
+ i8vec2 Unpack;
|
|
||||||
+ std::memcpy(&Unpack, &p, sizeof(Unpack));
|
|
||||||
return clamp(
|
|
||||||
- vec2(*Unpack) * 0.00787401574803149606299212598425f, // 1.0f / 127.0f
|
|
||||||
+ vec2(Unpack) * 0.00787401574803149606299212598425f, // 1.0f / 127.0f
|
|
||||||
-1.0f, 1.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -285,21 +298,24 @@ namespace detail
|
|
||||||
GLM_FUNC_QUALIFIER uint64 packUnorm4x16(vec4 const & v)
|
|
||||||
{
|
|
||||||
u16vec4 Topack(round(clamp(v , 0.0f, 1.0f) * 65535.0f));
|
|
||||||
- uint64* Packed = reinterpret_cast<uint64*>(&Topack);
|
|
||||||
- return *Packed;
|
|
||||||
+ uint64 Packed;
|
|
||||||
+ std::memcpy(&Packed, &Topack, sizeof(Packed));
|
|
||||||
+ return Packed;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER vec4 unpackUnorm4x16(uint64 const & p)
|
|
||||||
{
|
|
||||||
- u16vec4* Unpack = reinterpret_cast<u16vec4*>(const_cast<uint64*>(&p));
|
|
||||||
- return vec4(*Unpack) * 1.5259021896696421759365224689097e-5f; // 1.0 / 65535.0
|
|
||||||
+ u16vec4 Unpack;
|
|
||||||
+ std::memcpy(&Unpack, &p, sizeof(Unpack));
|
|
||||||
+ return vec4(Unpack) * 1.5259021896696421759365224689097e-5f; // 1.0 / 65535.0
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER uint16 packSnorm1x16(float const & v)
|
|
||||||
{
|
|
||||||
int16 Topack = static_cast<int16>(round(clamp(v ,-1.0f, 1.0f) * 32767.0f));
|
|
||||||
- uint16* Packed = reinterpret_cast<uint16*>(&Topack);
|
|
||||||
- return *Packed;
|
|
||||||
+ uint16 Packed;
|
|
||||||
+ std::memcpy(&Packed, &Topack, sizeof(Packed));
|
|
||||||
+ return Packed;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER float unpackSnorm1x16(uint16 const & p)
|
|
||||||
@@ -313,29 +329,33 @@ namespace detail
|
|
||||||
GLM_FUNC_QUALIFIER uint64 packSnorm4x16(vec4 const & v)
|
|
||||||
{
|
|
||||||
i16vec4 Topack = static_cast<i16vec4>(round(clamp(v ,-1.0f, 1.0f) * 32767.0f));
|
|
||||||
- uint64* Packed = reinterpret_cast<uint64*>(&Topack);
|
|
||||||
- return *Packed;
|
|
||||||
+ uint64 Packed;
|
|
||||||
+ std::memcpy(&Packed, &Topack, sizeof(Packed));
|
|
||||||
+ return Packed;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER vec4 unpackSnorm4x16(uint64 const & p)
|
|
||||||
{
|
|
||||||
- i16vec4* Unpack(reinterpret_cast<i16vec4*>(const_cast<uint64*>(&p)));
|
|
||||||
+ i16vec4 Unpack;
|
|
||||||
+ std::memcpy(&Unpack, &p, sizeof(Unpack));
|
|
||||||
return clamp(
|
|
||||||
- vec4(*Unpack) * 3.0518509475997192297128208258309e-5f, //1.0f / 32767.0f,
|
|
||||||
+ vec4(Unpack) * 3.0518509475997192297128208258309e-5f, //1.0f / 32767.0f,
|
|
||||||
-1.0f, 1.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER uint16 packHalf1x16(float const & v)
|
|
||||||
{
|
|
||||||
int16 Topack = detail::toFloat16(v);
|
|
||||||
- uint16* Packed = reinterpret_cast<uint16*>(&Topack);
|
|
||||||
- return *Packed;
|
|
||||||
+ uint16 Packed;
|
|
||||||
+ std::memcpy(&Packed, &Topack, sizeof(Packed));
|
|
||||||
+ return Packed;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER float unpackHalf1x16(uint16 const & v)
|
|
||||||
{
|
|
||||||
- int16* Unpack = reinterpret_cast<int16*>(const_cast<uint16*>(&v));
|
|
||||||
- return detail::toFloat32(*Unpack);
|
|
||||||
+ int16 Unpack;
|
|
||||||
+ std::memcpy(&Unpack, &v, sizeof(Unpack));
|
|
||||||
+ return detail::toFloat32(Unpack);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER uint64 packHalf4x16(glm::vec4 const & v)
|
|
||||||
@@ -346,14 +366,15 @@ namespace detail
|
|
||||||
detail::toFloat16(v.z),
|
|
||||||
detail::toFloat16(v.w));
|
|
||||||
|
|
||||||
- uint64* Packed = reinterpret_cast<uint64*>(&Unpack);
|
|
||||||
- return *Packed;
|
|
||||||
+ uint64 Packed;
|
|
||||||
+ std::memcpy(&Packed, &Unpack, sizeof(Packed));
|
|
||||||
+ return Packed;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER glm::vec4 unpackHalf4x16(uint64 const & v)
|
|
||||||
{
|
|
||||||
- i16vec4* p = reinterpret_cast<i16vec4*>(const_cast<uint64*>(&v));
|
|
||||||
- i16vec4 Unpack(*p);
|
|
||||||
+ i16vec4 Unpack;
|
|
||||||
+ std::memcpy(&Unpack, &v, sizeof(Unpack));
|
|
||||||
|
|
||||||
return vec4(
|
|
||||||
detail::toFloat32(Unpack.x),
|
|
||||||
Index: glm/test/core/core_func_common.cpp
|
|
||||||
===================================================================
|
|
||||||
--- glm.orig/test/core/core_func_common.cpp
|
|
||||||
+++ glm/test/core/core_func_common.cpp
|
|
||||||
@@ -67,7 +67,8 @@ int test_floatBitsToInt()
|
|
||||||
float A = 1.0f;
|
|
||||||
int B = glm::floatBitsToInt(A);
|
|
||||||
float C = glm::intBitsToFloat(B);
|
|
||||||
- int D = *(int*)&A;
|
|
||||||
+ int D;
|
|
||||||
+ std::memcpy(&D, &A, sizeof(D));
|
|
||||||
Error += B == D ? 0 : 1;
|
|
||||||
Error += A == C ? 0 : 1;
|
|
||||||
}
|
|
||||||
@@ -76,8 +77,11 @@ int test_floatBitsToInt()
|
|
||||||
glm::vec2 A(1.0f, 2.0f);
|
|
||||||
glm::ivec2 B = glm::floatBitsToInt(A);
|
|
||||||
glm::vec2 C = glm::intBitsToFloat(B);
|
|
||||||
- Error += B.x == *(int*)&(A.x) ? 0 : 1;
|
|
||||||
- Error += B.y == *(int*)&(A.y) ? 0 : 1;
|
|
||||||
+ int D;
|
|
||||||
+ std::memcpy(&D, &A.x, sizeof(D));
|
|
||||||
+ Error += B.x == D ? 0 : 1;
|
|
||||||
+ std::memcpy(&D, &A.y, sizeof(D));
|
|
||||||
+ Error += B.y == D ? 0 : 1;
|
|
||||||
Error += A == C? 0 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -85,9 +89,13 @@ int test_floatBitsToInt()
|
|
||||||
glm::vec3 A(1.0f, 2.0f, 3.0f);
|
|
||||||
glm::ivec3 B = glm::floatBitsToInt(A);
|
|
||||||
glm::vec3 C = glm::intBitsToFloat(B);
|
|
||||||
- Error += B.x == *(int*)&(A.x) ? 0 : 1;
|
|
||||||
- Error += B.y == *(int*)&(A.y) ? 0 : 1;
|
|
||||||
- Error += B.z == *(int*)&(A.z) ? 0 : 1;
|
|
||||||
+ int D;
|
|
||||||
+ std::memcpy(&D, &A.x, sizeof(D));
|
|
||||||
+ Error += B.x == D ? 0 : 1;
|
|
||||||
+ std::memcpy(&D, &A.y, sizeof(D));
|
|
||||||
+ Error += B.y == D ? 0 : 1;
|
|
||||||
+ std::memcpy(&D, &A.z, sizeof(D));
|
|
||||||
+ Error += B.z == D ? 0 : 1;
|
|
||||||
Error += A == C? 0 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -95,10 +103,15 @@ int test_floatBitsToInt()
|
|
||||||
glm::vec4 A(1.0f, 2.0f, 3.0f, 4.0f);
|
|
||||||
glm::ivec4 B = glm::floatBitsToInt(A);
|
|
||||||
glm::vec4 C = glm::intBitsToFloat(B);
|
|
||||||
- Error += B.x == *(int*)&(A.x) ? 0 : 1;
|
|
||||||
- Error += B.y == *(int*)&(A.y) ? 0 : 1;
|
|
||||||
- Error += B.z == *(int*)&(A.z) ? 0 : 1;
|
|
||||||
- Error += B.w == *(int*)&(A.w) ? 0 : 1;
|
|
||||||
+ int D;
|
|
||||||
+ std::memcpy(&D, &A.x, sizeof(D));
|
|
||||||
+ Error += B.x == D ? 0 : 1;
|
|
||||||
+ std::memcpy(&D, &A.y, sizeof(D));
|
|
||||||
+ Error += B.y == D ? 0 : 1;
|
|
||||||
+ std::memcpy(&D, &A.z, sizeof(D));
|
|
||||||
+ Error += B.z == D ? 0 : 1;
|
|
||||||
+ std::memcpy(&D, &A.w, sizeof(D));
|
|
||||||
+ Error += B.w == D ? 0 : 1;
|
|
||||||
Error += A == C? 0 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -113,7 +126,9 @@ int test_floatBitsToUint()
|
|
||||||
float A = 1.0f;
|
|
||||||
glm::uint B = glm::floatBitsToUint(A);
|
|
||||||
float C = glm::intBitsToFloat(B);
|
|
||||||
- Error += B == *(glm::uint*)&A ? 0 : 1;
|
|
||||||
+ glm::uint D;
|
|
||||||
+ std::memcpy(&D, &A, sizeof(D));
|
|
||||||
+ Error += B == D ? 0 : 1;
|
|
||||||
Error += A == C? 0 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -121,8 +136,11 @@ int test_floatBitsToUint()
|
|
||||||
glm::vec2 A(1.0f, 2.0f);
|
|
||||||
glm::uvec2 B = glm::floatBitsToUint(A);
|
|
||||||
glm::vec2 C = glm::uintBitsToFloat(B);
|
|
||||||
- Error += B.x == *(glm::uint*)&(A.x) ? 0 : 1;
|
|
||||||
- Error += B.y == *(glm::uint*)&(A.y) ? 0 : 1;
|
|
||||||
+ glm::uint D;
|
|
||||||
+ std::memcpy(&D, &A.x, sizeof(D));
|
|
||||||
+ Error += B.x == D ? 0 : 1;
|
|
||||||
+ std::memcpy(&D, &A.y, sizeof(D));
|
|
||||||
+ Error += B.y == D ? 0 : 1;
|
|
||||||
Error += A == C ? 0 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -130,9 +148,13 @@ int test_floatBitsToUint()
|
|
||||||
glm::vec3 A(1.0f, 2.0f, 3.0f);
|
|
||||||
glm::uvec3 B = glm::floatBitsToUint(A);
|
|
||||||
glm::vec3 C = glm::uintBitsToFloat(B);
|
|
||||||
- Error += B.x == *(glm::uint*)&(A.x) ? 0 : 1;
|
|
||||||
- Error += B.y == *(glm::uint*)&(A.y) ? 0 : 1;
|
|
||||||
- Error += B.z == *(glm::uint*)&(A.z) ? 0 : 1;
|
|
||||||
+ glm::uint D;
|
|
||||||
+ std::memcpy(&D, &A.x, sizeof(D));
|
|
||||||
+ Error += B.x == D ? 0 : 1;
|
|
||||||
+ std::memcpy(&D, &A.y, sizeof(D));
|
|
||||||
+ Error += B.y == D ? 0 : 1;
|
|
||||||
+ std::memcpy(&D, &A.z, sizeof(D));
|
|
||||||
+ Error += B.z == D ? 0 : 1;
|
|
||||||
Error += A == C? 0 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -140,10 +162,15 @@ int test_floatBitsToUint()
|
|
||||||
glm::vec4 A(1.0f, 2.0f, 3.0f, 4.0f);
|
|
||||||
glm::uvec4 B = glm::floatBitsToUint(A);
|
|
||||||
glm::vec4 C = glm::uintBitsToFloat(B);
|
|
||||||
- Error += B.x == *(glm::uint*)&(A.x) ? 0 : 1;
|
|
||||||
- Error += B.y == *(glm::uint*)&(A.y) ? 0 : 1;
|
|
||||||
- Error += B.z == *(glm::uint*)&(A.z) ? 0 : 1;
|
|
||||||
- Error += B.w == *(glm::uint*)&(A.w) ? 0 : 1;
|
|
||||||
+ glm::uint D;
|
|
||||||
+ std::memcpy(&D, &A.x, sizeof(D));
|
|
||||||
+ Error += B.x == D ? 0 : 1;
|
|
||||||
+ std::memcpy(&D, &A.y, sizeof(D));
|
|
||||||
+ Error += B.y == D ? 0 : 1;
|
|
||||||
+ std::memcpy(&D, &A.z, sizeof(D));
|
|
||||||
+ Error += B.z == D ? 0 : 1;
|
|
||||||
+ std::memcpy(&D, &A.w, sizeof(D));
|
|
||||||
+ Error += B.w == D ? 0 : 1;
|
|
||||||
Error += A == C? 0 : 1;
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
|||||||
--- glm/test/gtc/CMakeLists.txt 2013-12-26 01:01:14.000000000 +0100
|
|
||||||
+++ glm/test/gtc/CMakeLists.txt 2014-05-16 11:19:51.156369208 +0200
|
|
||||||
@@ -5,7 +5,7 @@
|
|
||||||
glmCreateTestGTC(gtc_matrix_inverse)
|
|
||||||
glmCreateTestGTC(gtc_matrix_transform)
|
|
||||||
glmCreateTestGTC(gtc_noise)
|
|
||||||
-glmCreateTestGTC(gtc_packing)
|
|
||||||
+#glmCreateTestGTC(gtc_packing)
|
|
||||||
glmCreateTestGTC(gtc_quaternion)
|
|
||||||
glmCreateTestGTC(gtc_random)
|
|
||||||
glmCreateTestGTC(gtc_reciprocal)
|
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:3407f9d2a94d2576ed6bdcd25b1852a52b8ccb5ef035523967ff9e5b0557bc59
|
|
||||||
size 4077373
|
|
3
glm-0.9.7.4.zip
Normal file
3
glm-0.9.7.4.zip
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:d48a0d732776b0fbfd17f01c830a08b50f07a3226f0cab95fcca5591982a43f2
|
||||||
|
size 4347932
|
23
glm-cmake-config.patch
Normal file
23
glm-cmake-config.patch
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
Index: glm/CMakeLists.txt
|
||||||
|
===================================================================
|
||||||
|
--- glm.orig/CMakeLists.txt
|
||||||
|
+++ glm/CMakeLists.txt
|
||||||
|
@@ -168,15 +168,15 @@ configure_file(
|
||||||
|
# install tree package config
|
||||||
|
configure_package_config_file(
|
||||||
|
cmake/glmConfig.cmake.in
|
||||||
|
- ${GLM_INSTALL_CONFIGDIR}/glmConfig.cmake
|
||||||
|
- INSTALL_DESTINATION ${GLM_INSTALL_CONFIGDIR}
|
||||||
|
+ ${CMAKE_CURRENT_BINARY_DIR}/glmConfig.cmake
|
||||||
|
+ INSTALL_DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
|
||||||
|
NO_CHECK_REQUIRED_COMPONENTS_MACRO
|
||||||
|
)
|
||||||
|
|
||||||
|
install(
|
||||||
|
FILES
|
||||||
|
- "${CMAKE_CURRENT_BINARY_DIR}/${GLM_INSTALL_CONFIGDIR}/glmConfig.cmake"
|
||||||
|
+ "${CMAKE_CURRENT_BINARY_DIR}/glmConfig.cmake"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/glmVersion.cmake"
|
||||||
|
DESTINATION ${GLM_INSTALL_CONFIGDIR}
|
||||||
|
)
|
10
glm.changes
10
glm.changes
@ -1,3 +1,13 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Mar 21 19:13:24 UTC 2016 - dmitry_r@opensuse.org
|
||||||
|
|
||||||
|
- Update to version 0.9.7.4
|
||||||
|
- Fix cmake config location
|
||||||
|
* glm-cmake-config.patch
|
||||||
|
- Drop obsolete
|
||||||
|
* glm-0.9.5.3-no_gtc_packing_test.patch
|
||||||
|
- Drop aliasing.patch, use -fno-strict-aliasing
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Sep 25 11:34:14 UTC 2014 - schwab@suse.de
|
Thu Sep 25 11:34:14 UTC 2014 - schwab@suse.de
|
||||||
|
|
||||||
|
44
glm.spec
44
glm.spec
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package glm
|
# spec file for package glm
|
||||||
#
|
#
|
||||||
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -17,22 +17,20 @@
|
|||||||
|
|
||||||
|
|
||||||
Name: glm
|
Name: glm
|
||||||
Version: 0.9.5.3
|
Version: 0.9.7.4
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Header only C++ mathematics library for graphics
|
Summary: Header only C++ mathematics library for graphics
|
||||||
License: MIT
|
License: MIT
|
||||||
Group: Development/Libraries/C and C++
|
Group: Development/Libraries/C and C++
|
||||||
Url: http://glm.g-truc.net/
|
Url: http://glm.g-truc.net/
|
||||||
Source0: http://downloads.sourceforge.net/ogl-math/%{name}-%{version}.zip
|
Source0: https://github.com/g-truc/glm/releases/download/%{version}/%{name}-%{version}.zip
|
||||||
Patch0: glm-0.9.5.3-no_gtc_packing_test.patch
|
# PATCH-FIX-OPENSUSE glm-cmake-config.patch -- Fix cmake config location
|
||||||
Patch1: aliasing.patch
|
Patch1: glm-cmake-config.patch
|
||||||
BuildRequires: cmake
|
BuildRequires: cmake
|
||||||
BuildRequires: dos2unix
|
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: gcc-c++
|
BuildRequires: gcc-c++
|
||||||
BuildRequires: unzip
|
BuildRequires: unzip
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
BuildArch: noarch
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
OpenGL Mathematics (GLM) is a header only C++ mathematics library for graphics
|
OpenGL Mathematics (GLM) is a header only C++ mathematics library for graphics
|
||||||
@ -45,6 +43,7 @@ he knows GLM as well which makes it really easy to use.
|
|||||||
%package devel
|
%package devel
|
||||||
Summary: Header only C++ mathematics library for graphics
|
Summary: Header only C++ mathematics library for graphics
|
||||||
Group: Development/Libraries/C and C++
|
Group: Development/Libraries/C and C++
|
||||||
|
Requires: cmake
|
||||||
|
|
||||||
%description devel
|
%description devel
|
||||||
OpenGL Mathematics (GLM) is a header only C++ mathematics library for graphics
|
OpenGL Mathematics (GLM) is a header only C++ mathematics library for graphics
|
||||||
@ -57,6 +56,7 @@ he knows GLM as well which makes it really easy to use.
|
|||||||
%package doc
|
%package doc
|
||||||
Summary: Documentation for GLM library
|
Summary: Documentation for GLM library
|
||||||
Group: Documentation/Other
|
Group: Documentation/Other
|
||||||
|
BuildArch: noarch
|
||||||
|
|
||||||
%description doc
|
%description doc
|
||||||
This package provides the documentation for GLM library.
|
This package provides the documentation for GLM library.
|
||||||
@ -64,35 +64,47 @@ This package provides the documentation for GLM library.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q -n %{name}
|
%setup -q -n %{name}
|
||||||
# Fix wrong-file-end-of-line-encoding
|
# Fix wrong-file-end-of-line-encoding
|
||||||
find ./ -type f -print0 |xargs -0 dos2unix -q
|
sed -i 's/\r//' copying.txt
|
||||||
%patch0 -p1
|
sed -i 's/\r//' readme.md
|
||||||
|
sed -i 's/\r//' doc/api/doxygen.css
|
||||||
|
sed -i 's/\r//' doc/api/tabs.css
|
||||||
|
%ifarch %ix86
|
||||||
|
sed -i '/glmCreateTestGTC(core_func_exponential)/d' test/core/CMakeLists.txt
|
||||||
|
# https://github.com/g-truc/glm/issues/212
|
||||||
|
sed -i '/glmCreateTestGTC(gtc_packing)/d' test/gtc/CMakeLists.txt
|
||||||
|
%if 0%{?suse_version} <= 1320
|
||||||
|
# https://github.com/g-truc/glm/issues/296
|
||||||
|
sed -i '/glmCreateTestGTC(gtc_integer)/d' test/gtc/CMakeLists.txt
|
||||||
|
%endif
|
||||||
|
%if 0%{?suse_version} <= 1320
|
||||||
|
sed -i '/glmCreateTestGTC(gtx_common)/d' test/gtx/CMakeLists.txt
|
||||||
|
%endif
|
||||||
|
%endif
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%cmake \
|
%cmake \
|
||||||
-DCMAKE_CXX_FLAGS="$RPM_OPT_FLAGS" \
|
-DCMAKE_CXX_FLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" \
|
||||||
-DGLM_TEST_ENABLE=ON
|
-DGLM_TEST_ENABLE=ON
|
||||||
make %{?_smp_mflags}
|
make %{?_smp_mflags}
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%cmake_install
|
%cmake_install
|
||||||
install -D -m 644 util/FindGLM.cmake %{buildroot}%{_datadir}/cmake/Modules/FindGLM.cmake
|
|
||||||
%fdupes -s %{buildroot}
|
%fdupes -s %{buildroot}
|
||||||
|
|
||||||
%check
|
%check
|
||||||
cd build
|
%ctest
|
||||||
ctest %{?_smp_mflags} --output-on-failure
|
|
||||||
|
|
||||||
%files devel
|
%files devel
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
%{_includedir}/glm
|
%{_includedir}/glm/
|
||||||
%{_datadir}/cmake/Modules/FindGLM.cmake
|
%{_libdir}/cmake/%{name}/
|
||||||
%doc copying.txt
|
%doc copying.txt
|
||||||
|
|
||||||
%files doc
|
%files doc
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
%doc doc/api
|
%doc doc/api
|
||||||
%doc doc/glm.pdf
|
%doc doc/glm.pdf
|
||||||
%doc readme.txt
|
%doc readme.md
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
Loading…
Reference in New Issue
Block a user