From 0dddfc12dbcbf1d12966755189ccfe4a4ddfbfa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 19 Apr 2019 12:57:39 +0200 Subject: [PATCH 1/2] thekla_atlas: Drop potentially GPL'ed nvmath/Rand48 code We don't use it anyway. Fixes #28182. --- thirdparty/README.md | 3 +- thirdparty/thekla_atlas/nvmath/Random.cpp | 6 - thirdparty/thekla_atlas/nvmath/Random.h | 88 ------------- .../thekla_atlas/remove-gpl-rand48.patch | 116 ++++++++++++++++++ 4 files changed, 118 insertions(+), 95 deletions(-) create mode 100644 thirdparty/thekla_atlas/remove-gpl-rand48.patch diff --git a/thirdparty/README.md b/thirdparty/README.md index 38b26ef8ab3..0f964fc1e5b 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -443,7 +443,8 @@ Files extracted from the upstream source: - License.txt Important: Some files have Godot-made changes, those -changes are marked with `// -- GODOT --` comments. +changes are marked with `// -- GODOT --` comments and patches +are provided to reapply them. ## tinyexr diff --git a/thirdparty/thekla_atlas/nvmath/Random.cpp b/thirdparty/thekla_atlas/nvmath/Random.cpp index 1a60e7f5e79..bb7a1df6fab 100644 --- a/thirdparty/thekla_atlas/nvmath/Random.cpp +++ b/thirdparty/thekla_atlas/nvmath/Random.cpp @@ -5,12 +5,6 @@ using namespace nv; -// Statics -const uint16 Rand48::a0 = 0xE66D; -const uint16 Rand48::a1 = 0xDEEC; -const uint16 Rand48::a2 = 0x0005; -const uint16 Rand48::c0 = 0x000B; - /// Get a random seed based on the current time. uint Rand::randomSeed() diff --git a/thirdparty/thekla_atlas/nvmath/Random.h b/thirdparty/thekla_atlas/nvmath/Random.h index 223292706aa..37bffb70b59 100644 --- a/thirdparty/thekla_atlas/nvmath/Random.h +++ b/thirdparty/thekla_atlas/nvmath/Random.h @@ -283,94 +283,6 @@ namespace nv }; - - /** Random number implementation from the GNU Sci. Lib. (GSL). - * Adapted from Nicholas Chapman version: - * - * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough - * This is the Unix rand48() generator. The generator returns the - * upper 32 bits from each term of the sequence, - * - * x_{n+1} = (a x_n + c) mod m - * - * using 48-bit unsigned arithmetic, with a = 0x5DEECE66D , c = 0xB - * and m = 2^48. The seed specifies the upper 32 bits of the initial - * value, x_1, with the lower 16 bits set to 0x330E. - * - * The theoretical value of x_{10001} is 244131582646046. - * - * The period of this generator is ? FIXME (probably around 2^48). - */ - class Rand48 : public Rand - { - public: - - Rand48( time_e ) - { - seed(randomSeed()); - } - - Rand48( uint s = 0x1234ABCD ) - { - seed(s); - } - - - /** Set the given seed. */ - virtual void seed( uint s ) { - vstate.x0 = 0x330E; - vstate.x1 = uint16(s & 0xFFFF); - vstate.x2 = uint16((s >> 16) & 0xFFFF); - } - - /** Get a random number. */ - virtual uint get() { - - advance(); - - uint x1 = vstate.x1; - uint x2 = vstate.x2; - return (x2 << 16) + x1; - } - - - private: - - void advance() - { - /* work with unsigned long ints throughout to get correct integer - promotions of any unsigned short ints */ - const uint32 x0 = vstate.x0; - const uint32 x1 = vstate.x1; - const uint32 x2 = vstate.x2; - - uint32 a; - a = a0 * x0 + c0; - - vstate.x0 = uint16(a & 0xFFFF); - a >>= 16; - - /* although the next line may overflow we only need the top 16 bits - in the following stage, so it does not matter */ - - a += a0 * x1 + a1 * x0; - vstate.x1 = uint16(a & 0xFFFF); - - a >>= 16; - a += a0 * x2 + a1 * x1 + a2 * x0; - vstate.x2 = uint16(a & 0xFFFF); - } - - - private: - NVMATH_API static const uint16 a0, a1, a2, c0; - - struct rand48_state_t { - uint16 x0, x1, x2; - } vstate; - - }; - } // nv namespace #endif // NV_MATH_RANDOM_H diff --git a/thirdparty/thekla_atlas/remove-gpl-rand48.patch b/thirdparty/thekla_atlas/remove-gpl-rand48.patch new file mode 100644 index 00000000000..0d996839e3d --- /dev/null +++ b/thirdparty/thekla_atlas/remove-gpl-rand48.patch @@ -0,0 +1,116 @@ +diff --git a/thirdparty/thekla_atlas/nvmath/Random.cpp b/thirdparty/thekla_atlas/nvmath/Random.cpp +index 1a60e7f5e..bb7a1df6f 100644 +--- a/thirdparty/thekla_atlas/nvmath/Random.cpp ++++ b/thirdparty/thekla_atlas/nvmath/Random.cpp +@@ -5,12 +5,6 @@ + + using namespace nv; + +-// Statics +-const uint16 Rand48::a0 = 0xE66D; +-const uint16 Rand48::a1 = 0xDEEC; +-const uint16 Rand48::a2 = 0x0005; +-const uint16 Rand48::c0 = 0x000B; +- + + /// Get a random seed based on the current time. + uint Rand::randomSeed() +diff --git a/thirdparty/thekla_atlas/nvmath/Random.h b/thirdparty/thekla_atlas/nvmath/Random.h +index 223292706..37bffb70b 100644 +--- a/thirdparty/thekla_atlas/nvmath/Random.h ++++ b/thirdparty/thekla_atlas/nvmath/Random.h +@@ -283,94 +283,6 @@ namespace nv + + }; + +- +- /** Random number implementation from the GNU Sci. Lib. (GSL). +- * Adapted from Nicholas Chapman version: +- * +- * Copyright (C) 1996, 1997, 1998, 1999, 2000 James Theiler, Brian Gough +- * This is the Unix rand48() generator. The generator returns the +- * upper 32 bits from each term of the sequence, +- * +- * x_{n+1} = (a x_n + c) mod m +- * +- * using 48-bit unsigned arithmetic, with a = 0x5DEECE66D , c = 0xB +- * and m = 2^48. The seed specifies the upper 32 bits of the initial +- * value, x_1, with the lower 16 bits set to 0x330E. +- * +- * The theoretical value of x_{10001} is 244131582646046. +- * +- * The period of this generator is ? FIXME (probably around 2^48). +- */ +- class Rand48 : public Rand +- { +- public: +- +- Rand48( time_e ) +- { +- seed(randomSeed()); +- } +- +- Rand48( uint s = 0x1234ABCD ) +- { +- seed(s); +- } +- +- +- /** Set the given seed. */ +- virtual void seed( uint s ) { +- vstate.x0 = 0x330E; +- vstate.x1 = uint16(s & 0xFFFF); +- vstate.x2 = uint16((s >> 16) & 0xFFFF); +- } +- +- /** Get a random number. */ +- virtual uint get() { +- +- advance(); +- +- uint x1 = vstate.x1; +- uint x2 = vstate.x2; +- return (x2 << 16) + x1; +- } +- +- +- private: +- +- void advance() +- { +- /* work with unsigned long ints throughout to get correct integer +- promotions of any unsigned short ints */ +- const uint32 x0 = vstate.x0; +- const uint32 x1 = vstate.x1; +- const uint32 x2 = vstate.x2; +- +- uint32 a; +- a = a0 * x0 + c0; +- +- vstate.x0 = uint16(a & 0xFFFF); +- a >>= 16; +- +- /* although the next line may overflow we only need the top 16 bits +- in the following stage, so it does not matter */ +- +- a += a0 * x1 + a1 * x0; +- vstate.x1 = uint16(a & 0xFFFF); +- +- a >>= 16; +- a += a0 * x2 + a1 * x1 + a2 * x0; +- vstate.x2 = uint16(a & 0xFFFF); +- } +- +- +- private: +- NVMATH_API static const uint16 a0, a1, a2, c0; +- +- struct rand48_state_t { +- uint16 x0, x1, x2; +- } vstate; +- +- }; +- + } // nv namespace + + #endif // NV_MATH_RANDOM_H From dcdb707decc33fb5196965727b533ee5108da0fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 19 Apr 2019 13:17:46 +0200 Subject: [PATCH 2/2] thekla_atlas: Clarify licensing for nvmesh and poshlib Fixes #28180. --- COPYRIGHT.txt | 5 +- thirdparty/README.md | 2 +- thirdparty/thekla_atlas/ATTRIBUTION | 79 +++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 thirdparty/thekla_atlas/ATTRIBUTION diff --git a/COPYRIGHT.txt b/COPYRIGHT.txt index 537e4540908..8178a812a60 100644 --- a/COPYRIGHT.txt +++ b/COPYRIGHT.txt @@ -346,7 +346,10 @@ License: Expat Files: ./thirdparty/thekla_atlas/ Comment: Thekla Atlas Copyright: 2013, Thekla, Inc -License: Expat + 2009-2017, Ignacio Castaño + 2007-2009, NVIDIA Corporation + 2004, Brian Hook +License: Expat and BSD-3-clause Files: ./thirdparty/tinyexr/ Comment: TinyEXR diff --git a/thirdparty/README.md b/thirdparty/README.md index 0f964fc1e5b..d048d3977a1 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -440,7 +440,7 @@ comments and a patch is provided in the squish/ folder. Files extracted from the upstream source: - Relevant sources from src/ -- License.txt +- `LICENSE`, `ATTRIBUTION` Important: Some files have Godot-made changes, those changes are marked with `// -- GODOT --` comments and patches diff --git a/thirdparty/thekla_atlas/ATTRIBUTION b/thirdparty/thekla_atlas/ATTRIBUTION new file mode 100644 index 00000000000..cd0f946fe41 --- /dev/null +++ b/thirdparty/thekla_atlas/ATTRIBUTION @@ -0,0 +1,79 @@ + +Thekla-Atlas is based on a fork of the NVIDIA Mesh and Texture Tools: + + https://github.com/castano/nvidia-mesh-tools + https://github.com/castano/nvidia-texture-tools + +which are both licensed under the MIT license: + +Copyright (c) 2009-2017 Ignacio Castaño +Copyright (c) 2007-2009 NVIDIA Corporation + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +------------------------------------------------------------------------------------ + +poshlib version 1.3.001 + +Copyright (c) 2004, Brian Hook +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * The names of this package'ss contributors contributors may not + be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------------ + +The example/test code also uses: + +Copyright 2012-2015, Syoyo Fujita. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------------ \ No newline at end of file