Skip to content

Commit a8e7688

Browse files
committed
Merge pull request godotengine#90251 from akien-mga/squish-cleanup
squish: Clean up patches, add LICENSE.txt
2 parents 1765f08 + 594d165 commit a8e7688

File tree

5 files changed

+141
-214
lines changed

5 files changed

+141
-214
lines changed

thirdparty/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -838,11 +838,13 @@ folder.
838838

839839
Files extracted from upstream source:
840840

841+
- `LICENSE.txt`
841842
- All `.cpp`, `.h` and `.inl` files
842843

843-
Important: Some files have Godot-made changes.
844-
They are marked with `// -- GODOT start --` and `// -- GODOT end --`
845-
comments and a patch is provided in the squish/ folder.
844+
Some downstream changes have been made and are identified by
845+
`// -- GODOT begin --` and `// -- GODOT end --` comments.
846+
They can be reapplied using the patches included in the `patches`
847+
folder.
846848

847849

848850
## tinyexr

thirdparty/squish/LICENSE.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2006 Simon Brown [email protected]
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included
12+
in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

thirdparty/squish/godot-changes.patch

Lines changed: 0 additions & 211 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
diff --git a/thirdparty/squish/config.h b/thirdparty/squish/config.h
2+
index 92edefe966..05f8d72598 100644
3+
--- a/thirdparty/squish/config.h
4+
+++ b/thirdparty/squish/config.h
5+
@@ -32,6 +32,26 @@
6+
#endif
7+
8+
// Set to 1 or 2 when building squish to use SSE or SSE2 instructions.
9+
+// -- GODOT start --
10+
+#ifdef _MSC_VER
11+
+ #if defined(_M_IX86_FP)
12+
+ #if _M_IX86_FP >= 2
13+
+ #define SQUISH_USE_SSE 2
14+
+ #elif _M_IX86_FP >= 1
15+
+ #define SQUISH_USE_SSE 1
16+
+ #endif
17+
+ #elif defined(_M_X64)
18+
+ #define SQUISH_USE_SSE 2
19+
+ #endif
20+
+#else
21+
+ #if defined(__SSE2__)
22+
+ #define SQUISH_USE_SSE 2
23+
+ #elif defined(__SSE__)
24+
+ #define SQUISH_USE_SSE 1
25+
+ #endif
26+
+#endif
27+
+// -- GODOT end --
28+
+
29+
#ifndef SQUISH_USE_SSE
30+
#define SQUISH_USE_SSE 0
31+
#endif
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
diff --git a/thirdparty/squish/colourblock.cpp b/thirdparty/squish/colourblock.cpp
2+
index af8b980365..f14c9362bd 100644
3+
--- a/thirdparty/squish/colourblock.cpp
4+
+++ b/thirdparty/squish/colourblock.cpp
5+
@@ -24,6 +24,9 @@
6+
-------------------------------------------------------------------------- */
7+
8+
#include "colourblock.h"
9+
+// -- GODOT start --
10+
+#include "alpha.h"
11+
+// -- GODOT end --
12+
13+
namespace squish {
14+
15+
@@ -211,4 +214,34 @@ void DecompressColour( u8* rgba, void const* block, bool isDxt1 )
16+
}
17+
}
18+
19+
+// -- GODOT start --
20+
+void DecompressColourBc4( u8* rgba, void const* block)
21+
+{
22+
+ DecompressAlphaDxt5(rgba,block);
23+
+ for ( int i = 0; i < 16; ++i ) {
24+
+ rgba[i*4] = rgba[i*4 + 3];
25+
+ rgba[i*4 + 1] = 0;
26+
+ rgba[i*4 + 2] = 0;
27+
+ rgba[i*4 + 3] = 255;
28+
+ }
29+
+}
30+
+
31+
+void DecompressColourBc5( u8* rgba, void const* block)
32+
+{
33+
+ void const* rblock = block;
34+
+ void const* gblock = reinterpret_cast< u8 const* >( block ) + 8;
35+
+ DecompressAlphaDxt5(rgba,rblock);
36+
+ for ( int i = 0; i < 16; ++i ) {
37+
+ rgba[i*4] = rgba[i*4 + 3];
38+
+ }
39+
+ DecompressAlphaDxt5(rgba,gblock);
40+
+ for ( int i = 0; i < 16; ++i ) {
41+
+ rgba[i*4+1] = rgba[i*4 + 3];
42+
+ rgba[i*4 + 2] = 0;
43+
+ rgba[i*4 + 3] = 255;
44+
+ }
45+
+}
46+
+// -- GODOT end --
47+
+
48+
+
49+
} // namespace squish
50+
diff --git a/thirdparty/squish/colourblock.h b/thirdparty/squish/colourblock.h
51+
index fee2cd7c5d..e1eb9e4917 100644
52+
--- a/thirdparty/squish/colourblock.h
53+
+++ b/thirdparty/squish/colourblock.h
54+
@@ -35,6 +35,10 @@ void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void*
55+
void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block );
56+
57+
void DecompressColour( u8* rgba, void const* block, bool isDxt1 );
58+
+// -- GODOT start --
59+
+void DecompressColourBc4( u8* rgba, void const* block );
60+
+void DecompressColourBc5( u8* rgba, void const* block );
61+
+// -- GODOT end --
62+
63+
} // namespace squish
64+
65+
diff --git a/thirdparty/squish/squish.cpp b/thirdparty/squish/squish.cpp
66+
index 1d22a64ad6..086ba11cd0 100644
67+
--- a/thirdparty/squish/squish.cpp
68+
+++ b/thirdparty/squish/squish.cpp
69+
@@ -135,7 +135,15 @@ void Decompress( u8* rgba, void const* block, int flags )
70+
colourBlock = reinterpret_cast< u8 const* >( block ) + 8;
71+
72+
// decompress colour
73+
- DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 );
74+
+ // -- GODOT start --
75+
+ //DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 );
76+
+ if(( flags & ( kBc4 ) ) != 0)
77+
+ DecompressColourBc4( rgba, colourBlock);
78+
+ else if(( flags & ( kBc5 ) ) != 0)
79+
+ DecompressColourBc5( rgba, colourBlock);
80+
+ else
81+
+ DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 );
82+
+ // -- GODOT end --
83+
84+
// decompress alpha separately if necessary
85+
if( ( flags & kDxt3 ) != 0 )

0 commit comments

Comments
 (0)