summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-04-05 11:12:03 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-04-05 11:12:03 +0200
commit594d165f640132bc04006c5cdebabf5e1c1a6fd7 (patch)
treec27054d060cd7a0eaa7881c5ce55d5364e3fe982
parentf6a78f83aa4b74aa5cb80ca2e3419448b1998e4f (diff)
downloadredot-engine-594d165f640132bc04006c5cdebabf5e1c1a6fd7.tar.gz
squish: Clean up patches, add LICENSE.txt
Confirmed that there's no changes in upstream r110 worth including compared to our r104 tagged version.
-rw-r--r--thirdparty/README.md8
-rw-r--r--thirdparty/squish/LICENSE.txt20
-rw-r--r--thirdparty/squish/godot-changes.patch211
-rw-r--r--thirdparty/squish/patches/config_sse.patch31
-rw-r--r--thirdparty/squish/patches/decompress_bc4_bc5.patch85
5 files changed, 141 insertions, 214 deletions
diff --git a/thirdparty/README.md b/thirdparty/README.md
index be386a3920..c47abed261 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -838,11 +838,13 @@ folder.
Files extracted from upstream source:
+- `LICENSE.txt`
- All `.cpp`, `.h` and `.inl` files
-Important: Some files have Godot-made changes.
-They are marked with `// -- GODOT start --` and `// -- GODOT end --`
-comments and a patch is provided in the squish/ folder.
+Some downstream changes have been made and are identified by
+`// -- GODOT begin --` and `// -- GODOT end --` comments.
+They can be reapplied using the patches included in the `patches`
+folder.
## tinyexr
diff --git a/thirdparty/squish/LICENSE.txt b/thirdparty/squish/LICENSE.txt
new file mode 100644
index 0000000000..e491e36226
--- /dev/null
+++ b/thirdparty/squish/LICENSE.txt
@@ -0,0 +1,20 @@
+Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
+
+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.
diff --git a/thirdparty/squish/godot-changes.patch b/thirdparty/squish/godot-changes.patch
deleted file mode 100644
index 555fbc51d0..0000000000
--- a/thirdparty/squish/godot-changes.patch
+++ /dev/null
@@ -1,211 +0,0 @@
-diff --git a/thirdparty/squish/colourblock.cpp b/thirdparty/squish/colourblock.cpp
-index af8b98036..3d87adaa7 100644
---- a/thirdparty/squish/colourblock.cpp
-+++ b/thirdparty/squish/colourblock.cpp
-@@ -24,6 +24,9 @@
- -------------------------------------------------------------------------- */
-
- #include "colourblock.h"
-+// -- Godot start --
-+#include "alpha.h"
-+// -- Godot end --
-
- namespace squish {
-
-@@ -211,4 +214,23 @@ void DecompressColour( u8* rgba, void const* block, bool isDxt1 )
- }
- }
-
-+// -- Godot start --
-+void DecompressColourBc5( u8* rgba, void const* block)
-+{
-+ void const* rblock = block;
-+ void const* gblock = reinterpret_cast< u8 const* >( block ) + 8;
-+ DecompressAlphaDxt5(rgba,rblock);
-+ for ( int i = 0; i < 16; ++i ) {
-+ rgba[i*4] = rgba[i*4 + 3];
-+ }
-+ DecompressAlphaDxt5(rgba,gblock);
-+ for ( int i = 0; i < 16; ++i ) {
-+ rgba[i*4+1] = rgba[i*4 + 3];
-+ rgba[i*4 + 2] = 0;
-+ rgba[i*4 + 3] = 255;
-+ }
-+}
-+// -- GODOT end --
-+
-+
- } // namespace squish
-diff --git a/thirdparty/squish/colourblock.h b/thirdparty/squish/colourblock.h
-index fee2cd7c5..3cb9b7e3b 100644
---- a/thirdparty/squish/colourblock.h
-+++ b/thirdparty/squish/colourblock.h
-@@ -35,6 +35,9 @@ void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void*
- void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block );
-
- void DecompressColour( u8* rgba, void const* block, bool isDxt1 );
-+// -- GODOT start --
-+void DecompressColourBc5( u8* rgba, void const* block );
-+// -- GODOT end --
-
- } // namespace squish
-
-diff --git a/thirdparty/squish/config.h b/thirdparty/squish/config.h
-index 92edefe96..05f8d7259 100644
---- a/thirdparty/squish/config.h
-+++ b/thirdparty/squish/config.h
-@@ -32,6 +32,26 @@
- #endif
-
- // Set to 1 or 2 when building squish to use SSE or SSE2 instructions.
-+// -- GODOT start --
-+#ifdef _MSC_VER
-+ #if defined(_M_IX86_FP)
-+ #if _M_IX86_FP >= 2
-+ #define SQUISH_USE_SSE 2
-+ #elif _M_IX86_FP >= 1
-+ #define SQUISH_USE_SSE 1
-+ #endif
-+ #elif defined(_M_X64)
-+ #define SQUISH_USE_SSE 2
-+ #endif
-+#else
-+ #if defined(__SSE2__)
-+ #define SQUISH_USE_SSE 2
-+ #elif defined(__SSE__)
-+ #define SQUISH_USE_SSE 1
-+ #endif
-+#endif
-+// -- GODOT end --
-+
- #ifndef SQUISH_USE_SSE
- #define SQUISH_USE_SSE 0
- #endif
-diff --git a/thirdparty/squish/squish.cpp b/thirdparty/squish/squish.cpp
-index 1d22a64ad..fd11a147d 100644
---- a/thirdparty/squish/squish.cpp
-+++ b/thirdparty/squish/squish.cpp
-@@ -135,7 +135,13 @@ void Decompress( u8* rgba, void const* block, int flags )
- colourBlock = reinterpret_cast< u8 const* >( block ) + 8;
-
- // decompress colour
-- DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 );
-+ // -- GODOT start --
-+ //DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 );
-+ if(( flags & ( kBc5 ) ) != 0)
-+ DecompressColourBc5( rgba, colourBlock);
-+ else
-+ DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 );
-+ // -- GODOT end --
-
- // decompress alpha separately if necessary
- if( ( flags & kDxt3 ) != 0 )
-
-diff --git a/thirdparty/squish/colourblock.cpp b/thirdparty/squish/colourblock.cpp
-index 49401358bc..f14c9362bd 100644
---- a/thirdparty/squish/colourblock.cpp
-+++ b/thirdparty/squish/colourblock.cpp
-@@ -24,9 +24,9 @@
- -------------------------------------------------------------------------- */
-
- #include "colourblock.h"
--// -- Godot start --
-+// -- GODOT start --
- #include "alpha.h"
--// -- Godot end --
-+// -- GODOT end --
-
- namespace squish {
-
-diff --git a/thirdparty/squish/godot-changes.patch b/thirdparty/squish/godot-changes.patch
-index ef7bafb4b4..655a8cffc2 100644
---- a/thirdparty/squish/godot-changes.patch
-+++ b/thirdparty/squish/godot-changes.patch
-@@ -1,22 +1,33 @@
- diff --git a/thirdparty/squish/colourblock.cpp b/thirdparty/squish/colourblock.cpp
--index af8b98036..3d87adaa7 100644
-+index af8b980365..f14c9362bd 100644
- --- a/thirdparty/squish/colourblock.cpp
- +++ b/thirdparty/squish/colourblock.cpp
- @@ -24,6 +24,9 @@
- -------------------------------------------------------------------------- */
-
- #include "colourblock.h"
--+// -- Godot start --
-++// -- GODOT start --
- +#include "alpha.h"
--+// -- Godot end --
-++// -- GODOT end --
-
- namespace squish {
-
--@@ -211,4 +214,23 @@ void DecompressColour( u8* rgba, void const* block, bool isDxt1 )
-+@@ -211,4 +214,34 @@ void DecompressColour( u8* rgba, void const* block, bool isDxt1 )
- }
- }
-
--+// -- Godot start --
-++// -- GODOT start --
-++void DecompressColourBc4( u8* rgba, void const* block)
-++{
-++ DecompressAlphaDxt5(rgba,block);
-++ for ( int i = 0; i < 16; ++i ) {
-++ rgba[i*4] = rgba[i*4 + 3];
-++ rgba[i*4 + 1] = 0;
-++ rgba[i*4 + 2] = 0;
-++ rgba[i*4 + 3] = 255;
-++ }
-++}
-++
- +void DecompressColourBc5( u8* rgba, void const* block)
- +{
- + void const* rblock = block;
-@@ -37,21 +48,22 @@ index af8b98036..3d87adaa7 100644
- +
- } // namespace squish
- diff --git a/thirdparty/squish/colourblock.h b/thirdparty/squish/colourblock.h
--index fee2cd7c5..3cb9b7e3b 100644
-+index fee2cd7c5d..e1eb9e4917 100644
- --- a/thirdparty/squish/colourblock.h
- +++ b/thirdparty/squish/colourblock.h
--@@ -35,6 +35,9 @@ void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void*
-+@@ -35,6 +35,10 @@ void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void*
- void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block );
-
- void DecompressColour( u8* rgba, void const* block, bool isDxt1 );
- +// -- GODOT start --
-++void DecompressColourBc4( u8* rgba, void const* block );
- +void DecompressColourBc5( u8* rgba, void const* block );
- +// -- GODOT end --
-
- } // namespace squish
-
- diff --git a/thirdparty/squish/config.h b/thirdparty/squish/config.h
--index 92edefe96..05f8d7259 100644
-+index 92edefe966..05f8d72598 100644
- --- a/thirdparty/squish/config.h
- +++ b/thirdparty/squish/config.h
- @@ -32,6 +32,26 @@
-@@ -82,17 +94,19 @@ index 92edefe96..05f8d7259 100644
- #define SQUISH_USE_SSE 0
- #endif
- diff --git a/thirdparty/squish/squish.cpp b/thirdparty/squish/squish.cpp
--index 1d22a64ad..fd11a147d 100644
-+index 1d22a64ad6..086ba11cd0 100644
- --- a/thirdparty/squish/squish.cpp
- +++ b/thirdparty/squish/squish.cpp
--@@ -135,7 +135,13 @@ void Decompress( u8* rgba, void const* block, int flags )
-+@@ -135,7 +135,15 @@ void Decompress( u8* rgba, void const* block, int flags )
- colourBlock = reinterpret_cast< u8 const* >( block ) + 8;
-
- // decompress colour
- - DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 );
- + // -- GODOT start --
- + //DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 );
--+ if(( flags & ( kBc5 ) ) != 0)
-++ if(( flags & ( kBc4 ) ) != 0)
-++ DecompressColourBc4( rgba, colourBlock);
-++ else if(( flags & ( kBc5 ) ) != 0)
- + DecompressColourBc5( rgba, colourBlock);
- + else
- + DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 ); \ No newline at end of file
diff --git a/thirdparty/squish/patches/config_sse.patch b/thirdparty/squish/patches/config_sse.patch
new file mode 100644
index 0000000000..047701ee32
--- /dev/null
+++ b/thirdparty/squish/patches/config_sse.patch
@@ -0,0 +1,31 @@
+diff --git a/thirdparty/squish/config.h b/thirdparty/squish/config.h
+index 92edefe966..05f8d72598 100644
+--- a/thirdparty/squish/config.h
++++ b/thirdparty/squish/config.h
+@@ -32,6 +32,26 @@
+ #endif
+
+ // Set to 1 or 2 when building squish to use SSE or SSE2 instructions.
++// -- GODOT start --
++#ifdef _MSC_VER
++ #if defined(_M_IX86_FP)
++ #if _M_IX86_FP >= 2
++ #define SQUISH_USE_SSE 2
++ #elif _M_IX86_FP >= 1
++ #define SQUISH_USE_SSE 1
++ #endif
++ #elif defined(_M_X64)
++ #define SQUISH_USE_SSE 2
++ #endif
++#else
++ #if defined(__SSE2__)
++ #define SQUISH_USE_SSE 2
++ #elif defined(__SSE__)
++ #define SQUISH_USE_SSE 1
++ #endif
++#endif
++// -- GODOT end --
++
+ #ifndef SQUISH_USE_SSE
+ #define SQUISH_USE_SSE 0
+ #endif
diff --git a/thirdparty/squish/patches/decompress_bc4_bc5.patch b/thirdparty/squish/patches/decompress_bc4_bc5.patch
new file mode 100644
index 0000000000..949375560c
--- /dev/null
+++ b/thirdparty/squish/patches/decompress_bc4_bc5.patch
@@ -0,0 +1,85 @@
+diff --git a/thirdparty/squish/colourblock.cpp b/thirdparty/squish/colourblock.cpp
+index af8b980365..f14c9362bd 100644
+--- a/thirdparty/squish/colourblock.cpp
++++ b/thirdparty/squish/colourblock.cpp
+@@ -24,6 +24,9 @@
+ -------------------------------------------------------------------------- */
+
+ #include "colourblock.h"
++// -- GODOT start --
++#include "alpha.h"
++// -- GODOT end --
+
+ namespace squish {
+
+@@ -211,4 +214,34 @@ void DecompressColour( u8* rgba, void const* block, bool isDxt1 )
+ }
+ }
+
++// -- GODOT start --
++void DecompressColourBc4( u8* rgba, void const* block)
++{
++ DecompressAlphaDxt5(rgba,block);
++ for ( int i = 0; i < 16; ++i ) {
++ rgba[i*4] = rgba[i*4 + 3];
++ rgba[i*4 + 1] = 0;
++ rgba[i*4 + 2] = 0;
++ rgba[i*4 + 3] = 255;
++ }
++}
++
++void DecompressColourBc5( u8* rgba, void const* block)
++{
++ void const* rblock = block;
++ void const* gblock = reinterpret_cast< u8 const* >( block ) + 8;
++ DecompressAlphaDxt5(rgba,rblock);
++ for ( int i = 0; i < 16; ++i ) {
++ rgba[i*4] = rgba[i*4 + 3];
++ }
++ DecompressAlphaDxt5(rgba,gblock);
++ for ( int i = 0; i < 16; ++i ) {
++ rgba[i*4+1] = rgba[i*4 + 3];
++ rgba[i*4 + 2] = 0;
++ rgba[i*4 + 3] = 255;
++ }
++}
++// -- GODOT end --
++
++
+ } // namespace squish
+diff --git a/thirdparty/squish/colourblock.h b/thirdparty/squish/colourblock.h
+index fee2cd7c5d..e1eb9e4917 100644
+--- a/thirdparty/squish/colourblock.h
++++ b/thirdparty/squish/colourblock.h
+@@ -35,6 +35,10 @@ void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void*
+ void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block );
+
+ void DecompressColour( u8* rgba, void const* block, bool isDxt1 );
++// -- GODOT start --
++void DecompressColourBc4( u8* rgba, void const* block );
++void DecompressColourBc5( u8* rgba, void const* block );
++// -- GODOT end --
+
+ } // namespace squish
+
+diff --git a/thirdparty/squish/squish.cpp b/thirdparty/squish/squish.cpp
+index 1d22a64ad6..086ba11cd0 100644
+--- a/thirdparty/squish/squish.cpp
++++ b/thirdparty/squish/squish.cpp
+@@ -135,7 +135,15 @@ void Decompress( u8* rgba, void const* block, int flags )
+ colourBlock = reinterpret_cast< u8 const* >( block ) + 8;
+
+ // decompress colour
+- DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 );
++ // -- GODOT start --
++ //DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 );
++ if(( flags & ( kBc4 ) ) != 0)
++ DecompressColourBc4( rgba, colourBlock);
++ else if(( flags & ( kBc5 ) ) != 0)
++ DecompressColourBc5( rgba, colourBlock);
++ else
++ DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 );
++ // -- GODOT end --
+
+ // decompress alpha separately if necessary
+ if( ( flags & kDxt3 ) != 0 )