From 636a5558470ba0e0a4db1ca23dc72d96dfabeccf Mon Sep 17 00:00:00 2001
From: Daniel Opitz <daniel.opitz@intel.com>
Date: Mon, 13 May 2024 10:17:51 +0200
Subject: [PATCH] Apply an upstream patch for clang19 build

Original patch: https://github.com/RenderKit/embree/commit/cda4cf1919bb2a748e78915fbd6e421a1056638d

"fix output operator, issue #486"

Change-Id: I274b48d4d5110ecdf9e219d07fdaad4a153cf794
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
---
 src/3rdparty/embree/kernels/geometry/pointi.h |  4 +-
 .../embree/kernels/subdiv/bezier_curve.h      |  2 +-
 .../0003-fix-output-operator-issue-486.patch  | 43 +++++++++++++++++++
 3 files changed, 46 insertions(+), 3 deletions(-)
 create mode 100644 src/3rdparty/embree/patches/0003-fix-output-operator-issue-486.patch

diff --git a/src/3rdparty/embree/kernels/geometry/pointi.h b/src/3rdparty/embree/kernels/geometry/pointi.h
index bed04116b..f33169223 100644
--- a/src/3rdparty/embree/kernels/geometry/pointi.h
+++ b/src/3rdparty/embree/kernels/geometry/pointi.h
@@ -210,9 +210,9 @@ namespace embree
     };
 
     /*! output operator */
-    friend __forceinline embree_ostream operator<<(embree_ostream cout, const PointMi& line)
+    friend __forceinline embree_ostream operator<<(embree_ostream cout, const PointMi& point)
     {
-      return cout << "Line" << M << "i {" << line.v0 << ", " << line.geomID() << ", " << line.primID() << "}";
+      return cout << "Point" << M << "i {" << point.geomID() << ", " << point.primID() << "}";
     }
 
    public:
diff --git a/src/3rdparty/embree/kernels/subdiv/bezier_curve.h b/src/3rdparty/embree/kernels/subdiv/bezier_curve.h
index a5adad5cc..4f20a5abb 100644
--- a/src/3rdparty/embree/kernels/subdiv/bezier_curve.h
+++ b/src/3rdparty/embree/kernels/subdiv/bezier_curve.h
@@ -135,7 +135,7 @@ namespace embree
       }
       
       friend embree_ostream operator<<(embree_ostream cout, const QuadraticBezierCurve& a) {
-        return cout << "QuadraticBezierCurve ( (" << a.u.lower << ", " << a.u.upper << "), " << a.v0 << ", " << a.v1 << ", " << a.v2 << ")";
+        return cout << "QuadraticBezierCurve (" << a.v0 << ", " << a.v1 << ", " << a.v2 << ")";
       }
     };
   
diff --git a/src/3rdparty/embree/patches/0003-fix-output-operator-issue-486.patch b/src/3rdparty/embree/patches/0003-fix-output-operator-issue-486.patch
new file mode 100644
index 000000000..7e3d8a856
--- /dev/null
+++ b/src/3rdparty/embree/patches/0003-fix-output-operator-issue-486.patch
@@ -0,0 +1,43 @@
+From a0c8e7c5f7249f6179553058b8ac72f3ebf72996 Mon Sep 17 00:00:00 2001
+From: Daniel Opitz <daniel.opitz@intel.com>
+Date: Mon, 13 May 2024 10:17:51 +0200
+Subject: [PATCH] fix output operator, issue #486
+
+Change-Id: I274b48d4d5110ecdf9e219d07fdaad4a153cf794
+---
+ src/3rdparty/embree/kernels/geometry/pointi.h     | 4 ++--
+ src/3rdparty/embree/kernels/subdiv/bezier_curve.h | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/3rdparty/embree/kernels/geometry/pointi.h b/src/3rdparty/embree/kernels/geometry/pointi.h
+index bed04116b..f33169223 100644
+--- a/src/3rdparty/embree/kernels/geometry/pointi.h
++++ b/src/3rdparty/embree/kernels/geometry/pointi.h
+@@ -210,9 +210,9 @@ namespace embree
+     };
+ 
+     /*! output operator */
+-    friend __forceinline embree_ostream operator<<(embree_ostream cout, const PointMi& line)
++    friend __forceinline embree_ostream operator<<(embree_ostream cout, const PointMi& point)
+     {
+-      return cout << "Line" << M << "i {" << line.v0 << ", " << line.geomID() << ", " << line.primID() << "}";
++      return cout << "Point" << M << "i {" << point.geomID() << ", " << point.primID() << "}";
+     }
+ 
+    public:
+diff --git a/src/3rdparty/embree/kernels/subdiv/bezier_curve.h b/src/3rdparty/embree/kernels/subdiv/bezier_curve.h
+index a5adad5cc..4f20a5abb 100644
+--- a/src/3rdparty/embree/kernels/subdiv/bezier_curve.h
++++ b/src/3rdparty/embree/kernels/subdiv/bezier_curve.h
+@@ -135,7 +135,7 @@ namespace embree
+       }
+       
+       friend embree_ostream operator<<(embree_ostream cout, const QuadraticBezierCurve& a) {
+-        return cout << "QuadraticBezierCurve ( (" << a.u.lower << ", " << a.u.upper << "), " << a.v0 << ", " << a.v1 << ", " << a.v2 << ")";
++        return cout << "QuadraticBezierCurve (" << a.v0 << ", " << a.v1 << ", " << a.v2 << ")";
+       }
+     };
+   
+-- 
+2.45.2
+
-- 
GitLab

