git: 86ab24e19ebb - main - graphics/bgfx: correction for fix build on i386 with CPUTYPE=nehalem and newer

From: Vladimir Druzenko <vvd_at_FreeBSD.org>
Date: Sun, 19 May 2024 15:46:58 UTC
The branch main has been updated by vvd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=86ab24e19ebb6f64d34ef2fd10d5185e1c3c742a

commit 86ab24e19ebb6f64d34ef2fd10d5185e1c3c742a
Author:     Vladimir Druzenko <vvd@FreeBSD.org>
AuthorDate: 2024-05-19 15:37:58 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-05-19 15:37:58 +0000

    graphics/bgfx: correction for fix build on i386 with CPUTYPE=nehalem and newer
    
    Previous patch truncating the value to 32-bits before taking the popcount.
    Upstream made correct patch:
    https://github.com/ARM-software/astc-encoder/issues/468#issuecomment-2119169136
    This patch will be included in next release of the astc-encoder 4.9.
    Also we can apply this patch to misc/astc-encoder (4.7 in ports).
    
    PR:     278722
    Fixes:  656401a (fix build on i386 with CPUTYPE=nehalem and newer)
---
 ...mg_3rdparty_astc-encoder_source_astcenc__vecmathlib__sse__4.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/graphics/bgfx/files/patch-bimg_3rdparty_astc-encoder_source_astcenc__vecmathlib__sse__4.h b/graphics/bgfx/files/patch-bimg_3rdparty_astc-encoder_source_astcenc__vecmathlib__sse__4.h
index 1f80efad67d4..2ca0c47c7db0 100644
--- a/graphics/bgfx/files/patch-bimg_3rdparty_astc-encoder_source_astcenc__vecmathlib__sse__4.h
+++ b/graphics/bgfx/files/patch-bimg_3rdparty_astc-encoder_source_astcenc__vecmathlib__sse__4.h
@@ -1,10 +1,11 @@
 --- bimg/3rdparty/astc-encoder/source/astcenc_vecmathlib_sse_4.h.orig	2024-03-28 05:00:55 UTC
 +++ bimg/3rdparty/astc-encoder/source/astcenc_vecmathlib_sse_4.h
-@@ -1309,5 +1309,7 @@ ASTCENC_SIMD_INLINE int popcount(uint64_t v)
+@@ -1307,7 +1307,7 @@ ASTCENC_SIMD_INLINE vfloat4 dot3(vfloat4 a, vfloat4 b)
+  */
+ ASTCENC_SIMD_INLINE int popcount(uint64_t v)
  {
- #if defined(__MINGW32__)
+-#if defined(__MINGW32__)
++#if !defined(__x86_64__)
  	return static_cast<int>(__builtin_popcountll(v));
-+#elif defined(__FreeBSD__) && !defined(__x86_64__)
-+	return static_cast<int>(_mm_popcnt_u32(static_cast<uint32_t>(v)));
  #else
  	return static_cast<int>(_mm_popcnt_u64(v));