Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package graphene for openSUSE:Factory checked in at 2022-03-23 20:16:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/graphene (Old) and /work/SRC/openSUSE:Factory/.graphene.new.25692 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "graphene" Wed Mar 23 20:16:33 2022 rev:15 rq:963611 version:1.10.8 Changes: -------- --- /work/SRC/openSUSE:Factory/graphene/graphene.changes 2021-04-18 21:45:02.096714181 +0200 +++ /work/SRC/openSUSE:Factory/.graphene.new.25692/graphene.changes 2022-03-23 20:17:23.578429310 +0100 @@ -1,0 +2,17 @@ +Fri Mar 18 17:29:48 UTC 2022 - Bj??rn Lie <[email protected]> + +- Update to version 1.10.8: + + ray: + - simplify NaN checking. + - Improve intersection + + Build fixes. + + SIMD: + - Make reciprocal operations 0-safe. + - Add simplified scalar reciprocal. + + tests: + - Fix installed introspection test. + - Add ray intersection unit. + + Fix detection of AArch64. + + Documentation fixes. + +------------------------------------------------------------------- Old: ---- graphene-1.10.6.tar.xz New: ---- graphene-1.10.8.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ graphene.spec ++++++ --- /var/tmp/diff_new_pack.cJkqMW/_old 2022-03-23 20:17:24.106429609 +0100 +++ /var/tmp/diff_new_pack.cJkqMW/_new 2022-03-23 20:17:24.122429619 +0100 @@ -1,7 +1,7 @@ # # spec file for package graphene # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: graphene -Version: 1.10.6 +Version: 1.10.8 Release: 0 Summary: Thin type layer for graphic libraries License: MIT ++++++ graphene-1.10.6.tar.xz -> graphene-1.10.8.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.6/.gitmodules new/graphene-1.10.8/.gitmodules --- old/graphene-1.10.6/.gitmodules 1970-01-01 01:00:00.000000000 +0100 +++ new/graphene-1.10.8/.gitmodules 2022-03-18 17:51:39.000000000 +0100 @@ -0,0 +1,3 @@ +[submodule "subprojects/mutest"] + path = subprojects/mutest + url = https://github.com/ebassi/mutest.git diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.6/doc/.gitignore new/graphene-1.10.8/doc/.gitignore --- old/graphene-1.10.6/doc/.gitignore 2021-04-06 15:31:34.376345200 +0200 +++ new/graphene-1.10.8/doc/.gitignore 1970-01-01 01:00:00.000000000 +0100 @@ -1,22 +0,0 @@ -/.libs -/html -/xml -/*.stamp -/graphene-decl-list.txt -/graphene-decl-list.txt.bak -/graphene-decl.txt -/graphene-decl.txt.bak -/graphene-undeclared.txt -/graphene-undocumented.txt -/graphene-unused.txt -/graphene.args -/graphene.hierarchy -/graphene.interfaces -/graphene.prerequisites -/graphene.signals -/graphene.types -/gtkdoc-check.log -/gtkdoc-check.test -/gtkdoc-check.trs -/test-suite.log - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.6/graphene.doap new/graphene-1.10.8/graphene.doap --- old/graphene-1.10.6/graphene.doap 2021-04-06 15:31:34.377345000 +0200 +++ new/graphene-1.10.8/graphene.doap 1970-01-01 01:00:00.000000000 +0100 @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Project xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" - xmlns:foaf="http://xmlns.com/foaf/0.1/" - xmlns:gnome="http://api.gnome.org/doap-extensions#" - xmlns="http://usefulinc.com/ns/doap#"> - <name>Graphene</name> - <shortname>graphene</shortname> - <shortdesc>A thin layer of types for graphic libraries</shortdesc> - <description>Graphene provides a small set of mathematical types needed to implement graphic libraries that deal with 2D and 3D transformations and projections.</description> - - <homepage rdf:resource="https://ebassi.github.io/graphene"/> - <bug-database rdf:resource="https://github.com/ebassi/graphene/issues"/> - <license rdf:resource="http://usefulinc.com/doap/licenses/mit"/> - <category rdf:resource="http://api.gnome.org/doap-extensions#development"/> - - <programming-language>C</programming-language> - - <maintainer> - <foaf:Person> - <foaf:name>Emmanuele Bassi</foaf:name> - <foaf:mbox rdf:resource="mailto:[email protected]"/> - <gnome:userid>ebassi</gnome:userid> - </foaf:Person> - </maintainer> - - <author> - <foaf:Person> - <foaf:name>Emmanuele Bassi</foaf:name> - <foaf:mbox rdf:resource="mailto:[email protected]"/> - <gnome:userid>ebassi</gnome:userid> - </foaf:Person> - </author> - -</Project> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.6/include/graphene-config.h.meson new/graphene-1.10.8/include/graphene-config.h.meson --- old/graphene-1.10.6/include/graphene-config.h.meson 2021-04-06 15:31:34.378345300 +0200 +++ new/graphene-1.10.8/include/graphene-config.h.meson 2022-03-18 17:51:39.000000000 +0100 @@ -19,11 +19,11 @@ #mesondefine GRAPHENE_HAS_SSE # endif -# if defined(__ARM_NEON__) || defined (_M_ARM64) +# if defined(__ARM_NEON__) || defined (_M_ARM64) || defined (__aarch64__) #mesondefine GRAPHENE_HAS_ARM_NEON # endif -# if defined(__GNUC__) && (__GNUC__ >= 4 && __GNUC_MINOR__ >= 9) && !defined(__arm__) +# if defined(__GNUC__) && (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)) && !defined(__arm__) #mesondefine GRAPHENE_HAS_GCC # endif @@ -63,7 +63,11 @@ # endif typedef __m128 graphene_simd4f_t; # elif defined(GRAPHENE_USE_ARM_NEON) -# include <arm_neon.h> +# if defined (_MSC_VER) && (_MSC_VER < 1920) && defined (_M_ARM64) +# include <arm64_neon.h> +# else +# include <arm_neon.h> +# endif typedef float32x4_t graphene_simd4f_t; # elif defined(GRAPHENE_USE_GCC) typedef float graphene_simd4f_t __attribute__((vector_size(16))); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.6/include/graphene-simd4f.h new/graphene-1.10.8/include/graphene-simd4f.h --- old/graphene-1.10.6/include/graphene-simd4f.h 2021-04-06 15:31:34.379345200 +0200 +++ new/graphene-1.10.8/include/graphene-simd4f.h 2022-03-18 17:51:39.000000000 +0100 @@ -292,9 +292,13 @@ # define graphene_simd4f_reciprocal(v) \ (__extension__ ({ \ + const graphene_simd4f_t __zero = graphene_simd4f_init (0.0f, 0.0f, 0.0f, 0.0f); \ const graphene_simd4f_t __two = graphene_simd4f_init (2.0f, 2.0f, 2.0f, 2.0f); \ - graphene_simd4f_t __s = _mm_rcp_ps ((v)); \ - graphene_simd4f_mul (__s, graphene_simd4f_sub (__two, graphene_simd4f_mul ((v), __s))); \ + const graphene_simd4f_t __s = _mm_rcp_ps ((v)); \ + const graphene_simd4f_t __m = graphene_simd4f_mul ((v), \ + _mm_andnot_ps (_mm_cmpeq_ps ((v), __zero), \ + __s)); \ + graphene_simd4f_mul (__s, graphene_simd4f_sub (__two, __m)); \ })) # define graphene_simd4f_rsqrt(v) \ @@ -556,11 +560,13 @@ static inline graphene_simd4f_t _simd4f_reciprocal(const graphene_simd4f_t v) { + const graphene_simd4f_t __zero = graphene_simd4f_init (0.0f, 0.0f, 0.0f, 0.0f); const graphene_simd4f_t __two = graphene_simd4f_init (2.0f, 2.0f, 2.0f, 2.0f); - graphene_simd4f_t __s = _mm_rcp_ps (v); - return graphene_simd4f_mul (__s, - graphene_simd4f_sub (__two, - graphene_simd4f_mul (v, __s))); + const graphene_simd4f_t __s = _mm_rcp_ps (v); + const graphene_simd4f_t __m = graphene_simd4f_mul (v, + _mm_andnot_ps (_mm_cmpeq_ps (v, __zero), + __s)); + return graphene_simd4f_mul (__s, graphene_simd4f_sub (__two, __m)); } #define graphene_simd4f_rsqrt(v) _simd4f_rsqrt(v) @@ -857,10 +863,10 @@ # define graphene_simd4f_reciprocal(v) \ (__extension__ ({ \ (graphene_simd4f_t) { \ - (v)[0] != 0.f ? 1.f / (v)[0] : 0.f, \ - (v)[1] != 0.f ? 1.f / (v)[1] : 0.f, \ - (v)[2] != 0.f ? 1.f / (v)[2] : 0.f, \ - (v)[3] != 0.f ? 1.f / (v)[3] : 0.f, \ + fabsf ((v)[0]) > FLT_EPSILON ? 1.f / (v)[0] : copysignf (INFINITY, (v)[0]), \ + fabsf ((v)[1]) > FLT_EPSILON ? 1.f / (v)[1] : copysignf (INFINITY, (v)[1]), \ + fabsf ((v)[2]) > FLT_EPSILON ? 1.f / (v)[2] : copysignf (INFINITY, (v)[2]), \ + fabsf ((v)[3]) > FLT_EPSILON ? 1.f / (v)[3] : copysignf (INFINITY, (v)[3]), \ }; \ })) @@ -876,12 +882,16 @@ # define graphene_simd4f_rsqrt(v) \ (__extension__ ({ \ - (graphene_simd4f_t) { \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wfloat-equal\"") \ + const graphene_simd4f_t __val = (graphene_simd4f_t) { \ (v)[0] != 0.f ? 1.f / sqrtf ((v)[0]) : 0.f, \ (v)[1] != 0.f ? 1.f / sqrtf ((v)[1]) : 0.f, \ (v)[2] != 0.f ? 1.f / sqrtf ((v)[2]) : 0.f, \ (v)[3] != 0.f ? 1.f / sqrtf ((v)[3]) : 0.f, \ }; \ + _Pragma ("GCC diagnostic pop") \ + __val; \ })) # define graphene_simd4f_add(a,b) (__extension__ ({ (graphene_simd4f_t) ((a) + (b)); })) @@ -891,19 +901,19 @@ # define graphene_simd4f_cross3(a,b) \ (__extension__ ({ \ - const graphene_simd4f_t __a = (a); \ - const graphene_simd4f_t __b = (b); \ - graphene_simd4f_init (__a[1] * __b[2] - __a[2] * __b[1], \ - __a[2] * __b[0] - __a[0] * __b[2], \ - __a[0] * __b[1] - __a[1] * __b[0], \ + const graphene_simd4f_t __cross_a = (a); \ + const graphene_simd4f_t __cross_b = (b); \ + graphene_simd4f_init (__cross_a[1] * __cross_b[2] - __cross_a[2] * __cross_b[1], \ + __cross_a[2] * __cross_b[0] - __cross_a[0] * __cross_b[2], \ + __cross_a[0] * __cross_b[1] - __cross_a[1] * __cross_b[0], \ 0.f); \ })) # define graphene_simd4f_dot3(a,b) \ (__extension__ ({ \ - const graphene_simd4f_t __a = (a); \ - const graphene_simd4f_t __b = (b); \ - const float __res = __a[0] * __b[0] + __a[1] * __b[1] + __a[2] * __b[2]; \ + const graphene_simd4f_t __dot_a = (a); \ + const graphene_simd4f_t __dot_b = (b); \ + const float __res = __dot_a[0] * __dot_b[0] + __dot_a[1] * __dot_b[1] + __dot_a[2] * __dot_b[2]; \ graphene_simd4f_init (__res, __res, __res, __res); \ })) @@ -994,49 +1004,69 @@ # define graphene_simd4f_cmp_eq(a,b) \ (__extension__ ({ \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wfloat-equal\"") \ const graphene_simd4i_t __res = (a) == (b); \ - (bool) (__res[0] != 0 && \ + const bool __val = (bool) (__res[0] != 0 && \ __res[1] != 0 && \ __res[2] != 0 && \ __res[3] != 0); \ + _Pragma ("GCC diagnostic pop") \ + __val; \ })) # define graphene_simd4f_cmp_neq(a,b) (!graphene_simd4f_cmp_eq (a,b)) # define graphene_simd4f_cmp_lt(a,b) \ (__extension__ ({ \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wfloat-equal\"") \ const graphene_simd4i_t __res = (a) < (b); \ - (bool) (__res[0] != 0 && \ + const bool __val = (bool) (__res[0] != 0 && \ __res[1] != 0 && \ __res[2] != 0 && \ __res[3] != 0); \ + _Pragma ("GCC diagnostic pop") \ + __val; \ })) # define graphene_simd4f_cmp_le(a,b) \ (__extension__ ({ \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wfloat-equal\"") \ const graphene_simd4i_t __res = (a) <= (b); \ - (bool) (__res[0] != 0 && \ + const bool __val = (bool) (__res[0] != 0 && \ __res[1] != 0 && \ __res[2] != 0 && \ __res[3] != 0); \ + _Pragma ("GCC diagnostic pop") \ + __val; \ })) # define graphene_simd4f_cmp_ge(a,b) \ (__extension__ ({ \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wfloat-equal\"") \ const graphene_simd4i_t __res = (a) >= (b); \ - (bool) (__res[0] != 0 && \ + const bool __val = (bool) (__res[0] != 0 && \ __res[1] != 0 && \ __res[2] != 0 && \ __res[3] != 0); \ + _Pragma ("GCC diagnostic pop") \ + __val; \ })) # define graphene_simd4f_cmp_gt(a,b) \ (__extension__ ({ \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wfloat-equal\"") \ const graphene_simd4i_t __res = (a) > (b); \ - (bool) (__res[0] != 0 && \ + const bool __val = (bool) (__res[0] != 0 && \ __res[1] != 0 && \ __res[2] != 0 && \ __res[3] != 0); \ + _Pragma ("GCC diagnostic pop") \ + __val; \ })) # define graphene_simd4f_neg(s) \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.6/meson.build new/graphene-1.10.8/meson.build --- old/graphene-1.10.6/meson.build 2021-04-06 15:31:34.380345000 +0200 +++ new/graphene-1.10.8/meson.build 2022-03-18 17:51:39.000000000 +0100 @@ -1,7 +1,7 @@ project('graphene', 'c', - version: '1.10.6', + version: '1.10.8', license: 'MIT', - meson_version: '>= 0.50.1', + meson_version: '>= 0.55.3', default_options: [ 'buildtype=debugoptimized', 'c_std=c99', @@ -10,6 +10,7 @@ cc = meson.get_compiler('c') host_system = host_machine.system() +host_cpu_family = host_machine.cpu_family() add_project_arguments([ '-D_GNU_SOURCE' ], language: 'c') @@ -260,6 +261,28 @@ ) endif +# Check for IEEE 754 floating-point division compilance +float_division_prog = ''' +#include <math.h> +int main() { + if (isinf(1.f / 0.f) != 1) + return 1; + if (isinf(1.f / -0.f) != -1) + return 2; + return 0; +} +''' +if meson.is_cross_build() + ieee754_float_div = meson.get_external_property('ieee754_float_div', cc.get_id() in ['gcc', 'clang']) + message('Cross-building, assuming IEEE 754 division:', ieee754_float_div) +else + ieee754_float_div = cc.run(float_division_prog, name: 'IEEE 754 floating-point division').returncode() == 0 +endif +conf.set('HAVE_IEEE_754_FLOAT_DIVISION', + ieee754_float_div, + description: 'Define if floating-point division is compliant with IEEE 754', +) + # Configuration for our installed config header graphene_conf = configuration_data() @@ -311,7 +334,7 @@ # error "GCC vector intrinsics are disabled on GCC prior to 4.9" # elif defined(__arm__) # error "GCC vector intrinsics are disabled on ARM" -# elif !defined(__x86_64__) +# elif (__SIZEOF_POINTER__ < 8) # error "GCC vector intrinsics are disabled on 32bit" # endif #else @@ -336,14 +359,20 @@ if get_option('arm_neon') neon_prog = ''' #if !defined (_MSC_VER) || defined (__clang__) -# ifndef __ARM_EABI__ -# error "EABI is required (to be sure that calling conventions are compatible)" -# endif -# ifndef __ARM_NEON__ -# error "No ARM NEON instructions available" +# if !defined (_M_ARM64) && !defined (__aarch64__) +# ifndef __ARM_EABI__ +# error "EABI is required (to be sure that calling conventions are compatible)" +# endif +# ifndef __ARM_NEON__ +# error "No ARM NEON instructions available" +# endif # endif #endif -#include <arm_neon.h> +#if defined (_MSC_VER) && (_MSC_VER < 1920) && defined (_M_ARM64) +# include <arm64_neon.h> +#else +# include <arm_neon.h> +#endif int main () { const float32_t __v[4] = { 1, 2, 3, 4 }; \ const unsigned int __umask[4] = { \ @@ -360,7 +389,7 @@ test_neon_cflags = [] - if cc.get_id() != 'msvc' + if cc.get_id() != 'msvc' and host_cpu_family != 'aarch64' test_neon_cflags += ['-mfpu=neon'] endif @@ -399,3 +428,38 @@ if get_option('gtk_doc') subdir('doc') endif + +summary({ + 'prefix': get_option('prefix'), + 'libdir': get_option('libdir'), + 'includedir': get_option('includedir'), + }, + section: 'Directories', +) + +summary({ + 'SSE': graphene_simd.contains('sse2'), + 'GCC vector': graphene_simd.contains('gcc'), + 'ARM NEON': graphene_simd.contains('neon'), + }, + section: 'SIMD', + bool_yn: true, +) + +summary({ + 'GObject types': build_gobject, + 'Introspection': build_gir, + }, + section: 'Features', + bool_yn: true, +) + +summary({ + 'Documentation': get_option('gtk_doc'), + 'Tests': get_option('tests'), + 'Installed tests': get_option('installed_tests'), + }, + section: 'Build', + bool_yn: true, +) + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.6/src/graphene-gobject.c new/graphene-1.10.8/src/graphene-gobject.c --- old/graphene-1.10.6/src/graphene-gobject.c 2021-04-06 15:31:34.381345300 +0200 +++ new/graphene-1.10.8/src/graphene-gobject.c 2022-03-18 17:51:39.000000000 +0100 @@ -110,7 +110,7 @@ GType \ type_name ## _get_type (void) \ { \ - static volatile gsize graphene_define_id__volatile = 0; \ + static gsize graphene_define_id__volatile = 0; \ if (g_once_init_enter (&graphene_define_id__volatile)) \ { \ static const GEnumValue v[] = { \ @@ -140,7 +140,7 @@ GType \ type_name ## _get_type (void) \ { \ - static volatile gsize graphene_define_id__volatile = 0; \ + static gsize graphene_define_id__volatile = 0; \ if (g_once_init_enter (&graphene_define_id__volatile)) \ { \ GType graphene_define_id = \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.6/src/graphene-matrix.c new/graphene-1.10.8/src/graphene-matrix.c --- old/graphene-1.10.6/src/graphene-matrix.c 2021-04-06 15:31:34.381345300 +0200 +++ new/graphene-1.10.8/src/graphene-matrix.c 2022-03-18 17:51:39.000000000 +0100 @@ -2053,7 +2053,7 @@ * [CSS3 Transforms specification](http://dev.w3.org/csswg/css-transforms/); * specifically, the decomposition code is based on the equivalent code * published in "Graphics Gems II", edited by Jim Arvo, and - * [available online](http://tog.acm.org/resources/GraphicsGems/gemsii/unmatrix.c). + * [available online](http://web.archive.org/web/20150512160205/http://tog.acm.org/resources/GraphicsGems/gemsii/unmatrix.c). * * Returns: `true` if the matrix could be decomposed */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.6/src/graphene-private.h new/graphene-1.10.8/src/graphene-private.h --- old/graphene-1.10.6/src/graphene-private.h 2021-04-06 15:31:34.381345300 +0200 +++ new/graphene-1.10.8/src/graphene-private.h 2022-03-18 17:51:39.000000000 +0100 @@ -105,6 +105,14 @@ #endif /* __GNUC__ */ +#if defined(_M_X64) && ! defined(isnanf) +# define graphene_isnan(x) _isnanf(x) +#elif defined(HAVE_ISNANF) +# define graphene_isnan(x) isnanf(x) +#else +# define graphene_isnan(x) isnan(x) +#endif + static inline bool graphene_approx_val (float a, float b) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.6/src/graphene-ray.c new/graphene-1.10.8/src/graphene-ray.c --- old/graphene-1.10.6/src/graphene-ray.c 2021-04-06 15:31:34.382345200 +0200 +++ new/graphene-1.10.8/src/graphene-ray.c 2022-03-18 17:51:39.000000000 +0100 @@ -52,11 +52,6 @@ #include <math.h> #include <float.h> -#if defined(_M_X64) && ! defined(isnanf) -# define isnanf(x) _isnanf(x) -# define HAVE_ISNANF -#endif - /** * graphene_ray_alloc: (constructor) * @@ -467,22 +462,6 @@ return graphene_ray_intersect_sphere (r, s, NULL) != GRAPHENE_RAY_INTERSECTION_KIND_NONE; } -static inline float -nudge_off_axis (float v) -{ - if (graphene_approx_val (v, 0.f)) - { - if (v < 0.f) - return -2 * FLT_EPSILON; - else - return 2 * FLT_EPSILON; - } - else - { - return v; - } -} - /** * graphene_ray_intersect_box: * @r: a #graphene_ray_t @@ -501,18 +480,10 @@ const graphene_box_t *b, float *t_out) { - graphene_vec3_t safe_direction; graphene_vec3_t inv_dir; - float d[3]; - - graphene_vec3_to_float (&r->direction, d); - graphene_vec3_init (&safe_direction, - nudge_off_axis (d[0]), - nudge_off_axis (d[1]), - nudge_off_axis (d[2])); /* FIXME: Needs a graphene_vec3_reciprocal() */ - inv_dir.value = graphene_simd4f_reciprocal (safe_direction.value); + inv_dir.value = graphene_simd4f_reciprocal (r->direction.value); graphene_vec3_t inv_min; graphene_vec3_subtract (&(b->min), &r->origin, &inv_min); @@ -555,17 +526,10 @@ /* These lines also handle the case where tx_min or tx_max is NaN * (result of 0 * INFINITY): NaN != NaN */ -#ifdef HAVE_ISNANF - if (ty_min > tx_min || isnanf (tx_min)) + if (ty_min > tx_min || graphene_isnan (tx_min)) tx_min = ty_min; - if (ty_max < tx_max || isnanf (tx_max)) + if (ty_max < tx_max || graphene_isnan (tx_max)) tx_max = ty_max; -#else - if (ty_min > tx_min || fpclassify (tx_min) == FP_NAN) - tx_min = ty_min; - if (ty_max > tx_max || fpclassify (tx_max) == FP_NAN) - tx_max = ty_max; -#endif float tz_min, tz_max; if (graphene_vec3_get_z (&inv_dir) >= 0.f) @@ -582,17 +546,10 @@ if ((tx_min > tz_max) || (tz_min > tx_max)) return GRAPHENE_RAY_INTERSECTION_KIND_NONE; -#ifdef HAVE_ISNANF - if (tz_min > tx_min || isnanf (tx_min)) - tx_min = tz_min; - if (tz_max < tx_max || isnanf (tx_max)) - tx_max = tz_max; -#else - if (tz_min > tx_min || fpclassify (tx_min) == FP_NAN) + if (tz_min > tx_min || graphene_isnan (tx_min)) tx_min = tz_min; - if (tz_max < tx_max || fpclassify (tx_max) == FP_NAN) + if (tz_max < tx_max || graphene_isnan (tx_max)) tx_max = tz_max; -#endif /* return the point closest to the ray (positive side) */ if (tx_max < 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.6/src/graphene-simd4f.c new/graphene-1.10.8/src/graphene-simd4f.c --- old/graphene-1.10.6/src/graphene-simd4f.c 2021-04-06 15:31:34.383345400 +0200 +++ new/graphene-1.10.8/src/graphene-simd4f.c 2022-03-18 17:51:39.000000000 +0100 @@ -436,6 +436,8 @@ * @s: a #graphene_simd4f_t * * Computes the reciprocal of every component of @s. + * The reciprocals of positive and negative 0 are defined + * as positive and negative infinity, respectively. * * |[<!-- language="plain" --> * { @@ -1178,10 +1180,17 @@ (graphene_simd4f_reciprocal) (graphene_simd4f_t v) { graphene_simd4f_t s = { - fabsf (v.x) > FLT_EPSILON ? 1.0f / v.x : 0.f, - fabsf (v.y) > FLT_EPSILON ? 1.0f / v.y : 0.f, - fabsf (v.z) > FLT_EPSILON ? 1.0f / v.z : 0.f, - fabsf (v.w) > FLT_EPSILON ? 1.0f / v.w : 0.f +#if defined (HAVE_IEEE_754_FLOAT_DIVISION) + 1.0f / v.x, + 1.0f / v.y, + 1.0f / v.z, + 1.0f / v.w +#else + fabsf (v.x) > FLT_EPSILON ? 1.0f / v.x : copysignf (INFINITY, v.x), + fabsf (v.y) > FLT_EPSILON ? 1.0f / v.y : copysignf (INFINITY, v.y), + fabsf (v.z) > FLT_EPSILON ? 1.0f / v.z : copysignf (INFINITY, v.z), + fabsf (v.w) > FLT_EPSILON ? 1.0f / v.w : copysignf (INFINITY, v.w) +#endif }; return s; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.6/src/meson.build new/graphene-1.10.8/src/meson.build --- old/graphene-1.10.6/src/meson.build 2021-04-06 15:31:34.384345300 +0200 +++ new/graphene-1.10.8/src/meson.build 2022-03-18 17:51:39.000000000 +0100 @@ -101,7 +101,7 @@ identfilter_py = join_paths(meson.current_source_dir(), 'identfilter.py') gir_extra_args = [ - '--identifier-filter-cmd=@0@ @1@'.format(python.path(), identfilter_py), + '--identifier-filter-cmd=@0@ @1@'.format(python.full_path(), identfilter_py), '--accept-unprefixed', '--quiet', '--warn-all', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.6/tests/.gitignore new/graphene-1.10.8/tests/.gitignore --- old/graphene-1.10.6/tests/.gitignore 2021-04-06 15:31:34.384345300 +0200 +++ new/graphene-1.10.8/tests/.gitignore 1970-01-01 01:00:00.000000000 +0100 @@ -1,25 +0,0 @@ -/.deps -/.libs -/*.o -/*.log -/*.trs -/*.gcda -/*.gcno -/box -/euler -/frustum -/matrix -/plane -/point -/point3d -/quad -/quaternion -/ray -/rect -/simd -/size -/sphere -/triangle -/vec2 -/vec3 -/vec4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.6/tests/meson.build new/graphene-1.10.8/tests/meson.build --- old/graphene-1.10.6/tests/meson.build 2021-04-06 15:31:34.385345200 +0200 +++ new/graphene-1.10.8/tests/meson.build 2022-03-18 17:51:39.000000000 +0100 @@ -65,6 +65,8 @@ if build_gir and host_system == 'linux' and not meson.is_cross_build() foreach unit: ['introspection.py'] + install_data(unit, install_dir: installed_test_bindir) + wrapper = '@[email protected]'.format(unit) custom_target(wrapper, output: wrapper, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.6/tests/ray.c new/graphene-1.10.8/tests/ray.c --- old/graphene-1.10.6/tests/ray.c 2021-04-06 15:31:34.385345200 +0200 +++ new/graphene-1.10.8/tests/ray.c 2022-03-18 17:51:39.000000000 +0100 @@ -232,6 +232,110 @@ NULL); } +/* Adapted from Mutter/Clutter */ +static void +setup_ray_for_coordinates (graphene_matrix_t *view, + float x, + float y, + graphene_ray_t *ray) +{ + graphene_point3d_t camera_position; + graphene_point3d_t p; + graphene_vec3_t direction; + graphene_vec3_t cv; + graphene_vec3_t v; + + camera_position = GRAPHENE_POINT3D_INIT_ZERO; + graphene_vec3_init (&cv, + camera_position.x, + camera_position.y, + camera_position.z); + + p = GRAPHENE_POINT3D_INIT (x, y, 0.f); + graphene_matrix_transform_point3d (view, &p, &p); + + graphene_vec3_init (&v, p.x, p.y, p.z); + graphene_vec3_subtract (&v, &cv, &direction); + graphene_vec3_normalize (&direction, &direction); + + graphene_ray_init (ray, &camera_position, &direction); +} + +static void +ray_picking (void) +{ + graphene_matrix_t view; + graphene_point3d_t box_min; + graphene_point3d_t box_max; + graphene_box_t box; + graphene_box_t transformed_box; + graphene_ray_t ray; + float x; + float y; + const float view_array[] = { 0.053852f, 0, 0, 0, + 0, 0.053852f, 0, 0, + 0, 0.053852f, 0, 0, + -51.698082f, 29.080172f, -50.368336f, 1 }; + + graphene_matrix_init_from_float (&view, view_array); + + graphene_point3d_init (&box_min, 700, 400, 0); + graphene_point3d_init (&box_max, 1200, 800, 0); + graphene_box_init (&box, &box_min, &box_max); + graphene_matrix_transform_box (&view, &box, &transformed_box); + + /* Left of the box */ + + x = box_min.x - 50.0f; + y = box_min.y + 50.0f; + setup_ray_for_coordinates (&view, x, y, &ray); + mutest_expect ("picking left of the box should not be in the box", + mutest_int_value (graphene_ray_intersects_box (&ray, &transformed_box)), + mutest_to_be_false, + NULL); + + /* Right of the box */ + + x = box_max.x + 50.0f; + y = box_min.y + 50.0f; + setup_ray_for_coordinates (&view, x, y, &ray); + mutest_expect ("picking right of the box should not be in the box", + mutest_int_value (graphene_ray_intersects_box (&ray, &transformed_box)), + mutest_to_be_false, + NULL); + + + /* Above the box */ + + x = box_min.x + 50.0f; + y = box_min.y - 50.0f; + setup_ray_for_coordinates (&view, x, y, &ray); + mutest_expect ("picking above the box should not be in the box", + mutest_int_value (graphene_ray_intersects_box (&ray, &transformed_box)), + mutest_to_be_false, + NULL); + + /* Below the box */ + + x = box_min.x + 50.0f; + y = box_max.y + 50.0f; + setup_ray_for_coordinates (&view, x, y, &ray); + mutest_expect ("picking below the box should not be in the box", + mutest_int_value (graphene_ray_intersects_box (&ray, &transformed_box)), + mutest_to_be_false, + NULL); + + /* In the box */ + + x = box_min.x + 50.0f; + y = box_min.y + 50.0f; + setup_ray_for_coordinates (&view, x, y, &ray); + mutest_expect ("picking in the box should be a hit", + mutest_int_value (graphene_ray_intersects_box (&ray, &transformed_box)), + mutest_to_be_true, + NULL); +} + static void ray_suite (void) { @@ -242,6 +346,7 @@ mutest_it ("can be transformed", ray_matrix_transform); mutest_it ("can intersect triangles", ray_intersect_triangle); mutest_it ("can intersect on axis", ray_intersects_box); + mutest_it ("can be used for picking", ray_picking); } MUTEST_MAIN ( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.6/tests/rect.c new/graphene-1.10.8/tests/rect.c --- old/graphene-1.10.6/tests/rect.c 2021-04-06 15:31:34.385345200 +0200 +++ new/graphene-1.10.8/tests/rect.c 2022-03-18 17:51:39.000000000 +0100 @@ -134,6 +134,38 @@ mutest_bool_value (graphene_rect_contains_point (&r, &p)), mutest_to_be_false, NULL); + + const struct { + graphene_point_t point; + const char *label; + } points[] = { + { + .point = GRAPHENE_POINT_INIT (250, 150), + .label = "a rectangle to not contain a point outside its boundaries (right)", + }, + { + .point = GRAPHENE_POINT_INIT (150, 50), + .label = "a rectangle to not contain a point outside its boundaries (below)", + }, + { + .point = GRAPHENE_POINT_INIT (50, 150), + .label = "a rectangle to not contain a point outside its boundaries (left)", + }, + { + .point = GRAPHENE_POINT_INIT (150, 250), + .label = "a rectangle to not contain a point outside its boundaries (above)", + }, + }; + const unsigned n_points = sizeof (points) / sizeof (points[0]); + + graphene_rect_init (&r, 100, 100, 100, 100); + for (unsigned i = 0; i < n_points; i++) + { + mutest_expect (points[i].label, + mutest_bool_value (graphene_rect_contains_point (&r, &(points[i].point))), + mutest_to_be, false, + NULL); + } } static void diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/graphene-1.10.6/tests/simd.c new/graphene-1.10.8/tests/simd.c --- old/graphene-1.10.6/tests/simd.c 2021-04-06 15:31:34.385345200 +0200 +++ new/graphene-1.10.8/tests/simd.c 2022-03-18 17:51:39.000000000 +0100 @@ -263,6 +263,64 @@ } static void +simd_operators_reciprocal (void) +{ + graphene_simd4f_t a, b; + + a = graphene_simd4f_init (1.f, -1.f, -8.f, 0.5f); + + b = graphene_simd4f_reciprocal (a); + mutest_expect ("reciprocal() to return the reciprocal of the X component", + mutest_float_value (graphene_simd4f_get_x (b)), + mutest_to_be_close_to, 1.f, FLT_EPSILON, + NULL); + mutest_expect ("reciprocal() to return the reciprocal of the Y component", + mutest_float_value (graphene_simd4f_get_y (b)), + mutest_to_be_close_to, -1.f, FLT_EPSILON, + NULL); + mutest_expect ("reciprocal() to return the reciprocal of the Z component", + mutest_float_value (graphene_simd4f_get_z (b)), + mutest_to_be_close_to, -0.125f, FLT_EPSILON, + NULL); + mutest_expect ("reciprocal() to return the reciprocal of the W component", + mutest_float_value (graphene_simd4f_get_w (b)), + mutest_to_be_close_to, 2.f, FLT_EPSILON, + NULL); + + a = graphene_simd4f_init (.1234f, -1234.f, -0.4321f, 4321.f); + + b = graphene_simd4f_reciprocal (a); + mutest_expect ("reciprocal() to return the approximate reciprocal of the X component", + mutest_float_value (graphene_simd4f_get_x (b)), + mutest_to_be_close_to, 8.103727714749, 0.000001, + NULL); + mutest_expect ("reciprocal() to return the approximate reciprocal of the Y component", + mutest_float_value (graphene_simd4f_get_y (b)), + mutest_to_be_close_to, -0.000810372771, 0.000001, + NULL); + mutest_expect ("reciprocal() to return the approximate reciprocal of the Z component", + mutest_float_value (graphene_simd4f_get_z (b)), + mutest_to_be_close_to, -2.31427910206, 0.000001, + NULL); + mutest_expect ("reciprocal() to return the approximate reciprocal of the W component", + mutest_float_value (graphene_simd4f_get_w (b)), + mutest_to_be_close_to, 0.00023142791, 0.000001, + NULL); + + a = graphene_simd4f_init (0.f, -0.f, 5.f, -10.f); + + b = graphene_simd4f_reciprocal (a); + mutest_expect ("reciprocal() to return positive infinity in the X component", + mutest_float_value (graphene_simd4f_get_x (b)), + mutest_to_be_positive_infinity, + NULL); + mutest_expect ("reciprocal() to return negative infinity in the Y component", + mutest_float_value (graphene_simd4f_get_y (b)), + mutest_to_be_negative_infinity, + NULL); +} + +static void simd_suite (void) { mutest_it ("can copy 4 components", simd_dup_4f); @@ -279,6 +337,8 @@ mutest_it ("can compute the minimum vector and scalar", simd_operators_min); mutest_it ("can compute the maximum vector and scalar", simd_operators_max); + + mutest_it ("can compute the reciprocal of vector", simd_operators_reciprocal); } MUTEST_MAIN (
