mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-31 23:34:36 +00:00
Merge pull request #3194 from orbea/aliasing
glm: Use aliasing patch from opensuse to silence warnings
This commit is contained in:
commit
599385de87
12
deps/glm/detail/func_common.inl
vendored
12
deps/glm/detail/func_common.inl
vendored
@ -850,18 +850,24 @@ 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>
|
||||
GLM_FUNC_QUALIFIER vecType<int, P> floatBitsToInt(vecType<float, P> const & v)
|
||||
{
|
||||
return reinterpret_cast<vecType<int, P>&>(const_cast<vecType<float, P>&>(v));
|
||||
int Bits;
|
||||
std::memcpy(&Bits, &v, sizeof(Bits));
|
||||
return Bits;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint floatBitsToUint(float const & v)
|
||||
{
|
||||
return reinterpret_cast<uint&>(const_cast<float&>(v));
|
||||
float Float;
|
||||
std::memcpy(&Float, &v, sizeof(Float));
|
||||
return Float;
|
||||
}
|
||||
|
||||
template <template <typename, precision> class vecType, precision P>
|
||||
|
12
deps/glm/detail/func_integer.inl
vendored
12
deps/glm/detail/func_integer.inl
vendored
@ -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 <>
|
||||
|
48
deps/glm/detail/func_packing.inl
vendored
48
deps/glm/detail/func_packing.inl
vendored
@ -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),
|
||||
|
1
deps/glm/detail/setup.hpp
vendored
1
deps/glm/detail/setup.hpp
vendored
@ -30,6 +30,7 @@
|
||||
#define GLM_SETUP_INCLUDED
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Version
|
||||
|
80
deps/glm/gtc/packing.inl
vendored
80
deps/glm/gtc/packing.inl
vendored
@ -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);
|
||||
uint Topack;
|
||||
std::memcpy(&Topack, &x, sizeof(Topack));
|
||||
return float2packed11(Topack);
|
||||
}
|
||||
|
||||
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
|
||||
uint16 Packed;
|
||||
std::memcpy(&Packed, &Topack, sizeof(Packed));
|
||||
return Packed;
|
||||
}
|
||||
|
||||
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,8 +298,9 @@ 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)
|
||||
@ -298,8 +312,9 @@ namespace detail
|
||||
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 +328,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 +365,15 @@ namespace detail
|
||||
detail::toFloat16(v.z),
|
||||
detail::toFloat16(v.w));
|
||||
|
||||
uint64* Packed = reinterpret_cast<uint64*>(&Unpack);
|
||||
return *Packed;
|
||||
int16 Unpack;
|
||||
std::memcpy(&Unpack, &v, sizeof(Unpack));
|
||||
return detail::toFloat32(Unpack);
|
||||
}
|
||||
|
||||
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),
|
||||
|
Loading…
Reference in New Issue
Block a user