Files
glm/glm-1.0.1-fix-tests-big-endian.patch
Atri Bhattacharya e33433b9df - Update to version 1.0.1
* Features:
    + Added C++17 [[nodiscard]] support
  * Improvements:
    + Enables only warnings as errors while building unit tests
    + Added aligned_*vec3 simd support
  * Fixes:
    + Fixed C++ language auto detection build, disable C++98 warnings
      with Clang [gh#g-truc/glm#1235] [gh#g-truc/glm#1231]
    + Fixed GTX_color_space missing <glm/ext/scalar_constants.hpp>
      include [gh#g-truc/glm#1233]
    + Fixed EXT_matrix_transform shear implementation
    + Fixed smoothstep SIMD implementation [gh#g-truc/glm#1222]
- Changes from version 1.0.0
  * Features:
    + Added GLM_EXT_scalar_reciprocal with tests
    + Added GLM_EXT_vector_reciprocal with tests
    + Added glm::iround and glm::uround to GLM_EXT_scalar_common
      and GLM_EXT_vector_common
    + Added GLM_EXT_matrix_integer with tests
    + Added Github Actions
    + Added GLM_FORCE_UNRESTRICTED_FLOAT to prevent static asserts
      when using other scalar types with function expecting floats.
  * Improvements:
    + Added constexpr qualifier for cross product
    + Added constexpr qualifier for dot product
  * Fixes:
    + Fixed incorrect assertion for glm::min and glm::max
    + Fixed quaternion orientation in glm::decompose
    + Fixed singularity in quaternion to euler angle roll conversion
    + Fixed quat glm::pow handling of small magnitude quaternions
    + Fixed glm::fastNormalize build error
    + Fixed glm::isMultiple build error
    + Fixed glm::adjugate calculation
    + Fixed glm::angle discards the sign of result for angles in
      range (2pi-1, 2pi)
    + Removed ban on using glm::string_cast with CUDA host code
- Removed patches
  * glm-0.9.9.8-install.patch, now included upstream
- Added patches
  * glm-1.0.1-fix-install-cmake-files.patch
  * glm-1.0.1-noarch.patch
  * glm-1.0.1-without-werror.patch
- Updated patches
  * glm-0.9.9.8-pkgconfig.patch updated to
    glm-1.0.1-pkgconfig.patch
  * glm-0.9.9.8-fix_tests_big-endian.patch updated to
    glm-1.0.1-fix-tests-big-endian.patch
- Spec file changes
  * Set BuildArch to noarch for devel package as it is a header only
    package
  * Use cmake_build instead of make_jobs

OBS-URL: https://build.opensuse.org/package/show/science/glm?expand=0&rev=16
2025-05-15 17:03:08 +00:00

180 lines
3.2 KiB
Diff

From 06ce42e72324b32b1f4c37c646e99950c2bd5f6b Mon Sep 17 00:00:00 2001
From: Max Rees <maxcrees@me.com>
From: Matthias Fehring <buschmann23@opensuse.org>
Date: Wed, 14 May 2025 17:26:00 +0200
Subject: [PATCH] Fix test suite on big endian platforms
Upstream: submitted (https://github.com/g-truc/glm/pull/1001)
---
glm/gtc/packing.inl | 55 +++++++++++++++++++++++++++++++++++++++++++++++
test/gtc/gtc_packing.cpp | 3 +-
2 files changed, 57 insertions(+), 1 deletion(-)
--- a/glm/gtc/packing.inl 2024-02-27 18:19:47.000000000 +0100
+++ b/glm/gtc/packing.inl 2025-05-14 17:06:09.608767071 +0200
@@ -9,6 +9,9 @@
#include "../detail/type_half.hpp"
#include <cstring>
#include <limits>
+extern "C" {
+#include <endian.h>
+}
namespace glm{
namespace detail
@@ -190,9 +193,15 @@
{
struct Data
{
+#if BYTE_ORDER == LITTLE_ENDIAN
uint x : 3;
uint y : 3;
uint z : 2;
+#else
+ uint z : 2;
+ uint y : 3;
+ uint x : 3;
+#endif
} data;
uint8 pack;
};
@@ -201,8 +210,13 @@
{
struct Data
{
+#if BYTE_ORDER == LITTLE_ENDIAN
uint x : 4;
uint y : 4;
+#else
+ uint y : 4;
+ uint x : 4;
+#endif
} data;
uint8 pack;
};
@@ -211,10 +225,17 @@
{
struct Data
{
+#if BYTE_ORDER == LITTLE_ENDIAN
uint x : 4;
uint y : 4;
uint z : 4;
uint w : 4;
+#else
+ uint w : 4;
+ uint z : 4;
+ uint y : 4;
+ uint x : 4;
+#endif
} data;
uint16 pack;
};
@@ -223,9 +244,15 @@
{
struct Data
{
+#if BYTE_ORDER == LITTLE_ENDIAN
uint x : 5;
uint y : 6;
uint z : 5;
+#else
+ uint z : 5;
+ uint y : 6;
+ uint x : 5;
+#endif
} data;
uint16 pack;
};
@@ -234,10 +261,17 @@
{
struct Data
{
+#if BYTE_ORDER == LITTLE_ENDIAN
uint x : 5;
uint y : 5;
uint z : 5;
uint w : 1;
+#else
+ uint w : 1;
+ uint z : 5;
+ uint y : 5;
+ uint x : 5;
+#endif
} data;
uint16 pack;
};
@@ -252,10 +286,17 @@
{
struct Data
{
+#if BYTE_ORDER == LITTLE_ENDIAN
uint x : 10;
uint y : 10;
uint z : 10;
uint w : 2;
+#else
+ uint w : 2;
+ uint z : 10;
+ uint y : 10;
+ uint x : 10;
+#endif
} data;
uint32 pack;
};
@@ -264,10 +305,17 @@
{
struct Data
{
+#if BYTE_ORDER == LITTLE_ENDIAN
int x : 10;
int y : 10;
int z : 10;
int w : 2;
+#else
+ int w : 2;
+ int z : 10;
+ int y : 10;
+ int x : 10;
+#endif
} data;
uint32 pack;
};
@@ -276,10 +324,17 @@
{
struct Data
{
+#if BYTE_ORDER == LITTLE_ENDIAN
uint x : 9;
uint y : 9;
uint z : 9;
uint w : 5;
+#else
+ uint w : 5;
+ uint z : 9;
+ uint y : 9;
+ uint x : 9;
+#endif
} data;
uint32 pack;
};
--- a/test/gtc/gtc_packing.cpp 2024-02-27 18:19:47.000000000 +0100
+++ b/test/gtc/gtc_packing.cpp 2025-05-14 17:07:45.510351543 +0200
@@ -4,6 +4,7 @@
#include <glm/ext/vector_relational.hpp>
#include <cstdio>
#include <vector>
+#include <arpa/inet.h>
/*
static void print_bits(float const& s)
@@ -157,7 +158,7 @@
glm::u8vec4 const v0(0xff, 0x77, 0x0, 0x33);
glm::uint32 const p0 = *reinterpret_cast<glm::uint32 const*>(&v0[0]);
- glm::uint32 const r0 = 0x330077ff;
+ glm::uint32 const r0 = htonl(0xff770033);
Error += p0 == r0 ? 0 : 1;