godot-changes.patch 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. diff --git a/thirdparty/squish/colourblock.cpp b/thirdparty/squish/colourblock.cpp
  2. index af8b98036..3d87adaa7 100644
  3. --- a/thirdparty/squish/colourblock.cpp
  4. +++ b/thirdparty/squish/colourblock.cpp
  5. @@ -24,6 +24,9 @@
  6. -------------------------------------------------------------------------- */
  7. #include "colourblock.h"
  8. +// -- Godot start --
  9. +#include "alpha.h"
  10. +// -- Godot end --
  11. namespace squish {
  12. @@ -211,4 +214,23 @@ void DecompressColour( u8* rgba, void const* block, bool isDxt1 )
  13. }
  14. }
  15. +// -- Godot start --
  16. +void DecompressColourBc5( u8* rgba, void const* block)
  17. +{
  18. + void const* rblock = block;
  19. + void const* gblock = reinterpret_cast< u8 const* >( block ) + 8;
  20. + DecompressAlphaDxt5(rgba,rblock);
  21. + for ( int i = 0; i < 16; ++i ) {
  22. + rgba[i*4] = rgba[i*4 + 3];
  23. + }
  24. + DecompressAlphaDxt5(rgba,gblock);
  25. + for ( int i = 0; i < 16; ++i ) {
  26. + rgba[i*4+1] = rgba[i*4 + 3];
  27. + rgba[i*4 + 2] = 0;
  28. + rgba[i*4 + 3] = 255;
  29. + }
  30. +}
  31. +// -- GODOT end --
  32. +
  33. +
  34. } // namespace squish
  35. diff --git a/thirdparty/squish/colourblock.h b/thirdparty/squish/colourblock.h
  36. index fee2cd7c5..3cb9b7e3b 100644
  37. --- a/thirdparty/squish/colourblock.h
  38. +++ b/thirdparty/squish/colourblock.h
  39. @@ -35,6 +35,9 @@ void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void*
  40. void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block );
  41. void DecompressColour( u8* rgba, void const* block, bool isDxt1 );
  42. +// -- GODOT start --
  43. +void DecompressColourBc5( u8* rgba, void const* block );
  44. +// -- GODOT end --
  45. } // namespace squish
  46. diff --git a/thirdparty/squish/config.h b/thirdparty/squish/config.h
  47. index 92edefe96..05f8d7259 100644
  48. --- a/thirdparty/squish/config.h
  49. +++ b/thirdparty/squish/config.h
  50. @@ -32,6 +32,26 @@
  51. #endif
  52. // Set to 1 or 2 when building squish to use SSE or SSE2 instructions.
  53. +// -- GODOT start --
  54. +#ifdef _MSC_VER
  55. + #if defined(_M_IX86_FP)
  56. + #if _M_IX86_FP >= 2
  57. + #define SQUISH_USE_SSE 2
  58. + #elif _M_IX86_FP >= 1
  59. + #define SQUISH_USE_SSE 1
  60. + #endif
  61. + #elif defined(_M_X64)
  62. + #define SQUISH_USE_SSE 2
  63. + #endif
  64. +#else
  65. + #if defined(__SSE2__)
  66. + #define SQUISH_USE_SSE 2
  67. + #elif defined(__SSE__)
  68. + #define SQUISH_USE_SSE 1
  69. + #endif
  70. +#endif
  71. +// -- GODOT end --
  72. +
  73. #ifndef SQUISH_USE_SSE
  74. #define SQUISH_USE_SSE 0
  75. #endif
  76. diff --git a/thirdparty/squish/squish.cpp b/thirdparty/squish/squish.cpp
  77. index 1d22a64ad..fd11a147d 100644
  78. --- a/thirdparty/squish/squish.cpp
  79. +++ b/thirdparty/squish/squish.cpp
  80. @@ -135,7 +135,13 @@ void Decompress( u8* rgba, void const* block, int flags )
  81. colourBlock = reinterpret_cast< u8 const* >( block ) + 8;
  82. // decompress colour
  83. - DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 );
  84. + // -- GODOT start --
  85. + //DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 );
  86. + if(( flags & ( kBc5 ) ) != 0)
  87. + DecompressColourBc5( rgba, colourBlock);
  88. + else
  89. + DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 );
  90. + // -- GODOT end --
  91. // decompress alpha separately if necessary
  92. if( ( flags & kDxt3 ) != 0 )
  93. diff --git a/thirdparty/squish/colourblock.cpp b/thirdparty/squish/colourblock.cpp
  94. index 49401358bc..f14c9362bd 100644
  95. --- a/thirdparty/squish/colourblock.cpp
  96. +++ b/thirdparty/squish/colourblock.cpp
  97. @@ -24,9 +24,9 @@
  98. -------------------------------------------------------------------------- */
  99. #include "colourblock.h"
  100. -// -- Godot start --
  101. +// -- GODOT start --
  102. #include "alpha.h"
  103. -// -- Godot end --
  104. +// -- GODOT end --
  105. namespace squish {
  106. diff --git a/thirdparty/squish/godot-changes.patch b/thirdparty/squish/godot-changes.patch
  107. index ef7bafb4b4..655a8cffc2 100644
  108. --- a/thirdparty/squish/godot-changes.patch
  109. +++ b/thirdparty/squish/godot-changes.patch
  110. @@ -1,22 +1,33 @@
  111. diff --git a/thirdparty/squish/colourblock.cpp b/thirdparty/squish/colourblock.cpp
  112. -index af8b98036..3d87adaa7 100644
  113. +index af8b980365..f14c9362bd 100644
  114. --- a/thirdparty/squish/colourblock.cpp
  115. +++ b/thirdparty/squish/colourblock.cpp
  116. @@ -24,6 +24,9 @@
  117. -------------------------------------------------------------------------- */
  118. #include "colourblock.h"
  119. -+// -- Godot start --
  120. ++// -- GODOT start --
  121. +#include "alpha.h"
  122. -+// -- Godot end --
  123. ++// -- GODOT end --
  124. namespace squish {
  125. -@@ -211,4 +214,23 @@ void DecompressColour( u8* rgba, void const* block, bool isDxt1 )
  126. +@@ -211,4 +214,34 @@ void DecompressColour( u8* rgba, void const* block, bool isDxt1 )
  127. }
  128. }
  129. -+// -- Godot start --
  130. ++// -- GODOT start --
  131. ++void DecompressColourBc4( u8* rgba, void const* block)
  132. ++{
  133. ++ DecompressAlphaDxt5(rgba,block);
  134. ++ for ( int i = 0; i < 16; ++i ) {
  135. ++ rgba[i*4] = rgba[i*4 + 3];
  136. ++ rgba[i*4 + 1] = 0;
  137. ++ rgba[i*4 + 2] = 0;
  138. ++ rgba[i*4 + 3] = 255;
  139. ++ }
  140. ++}
  141. ++
  142. +void DecompressColourBc5( u8* rgba, void const* block)
  143. +{
  144. + void const* rblock = block;
  145. @@ -37,21 +48,22 @@ index af8b98036..3d87adaa7 100644
  146. +
  147. } // namespace squish
  148. diff --git a/thirdparty/squish/colourblock.h b/thirdparty/squish/colourblock.h
  149. -index fee2cd7c5..3cb9b7e3b 100644
  150. +index fee2cd7c5d..e1eb9e4917 100644
  151. --- a/thirdparty/squish/colourblock.h
  152. +++ b/thirdparty/squish/colourblock.h
  153. -@@ -35,6 +35,9 @@ void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void*
  154. +@@ -35,6 +35,10 @@ void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void*
  155. void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block );
  156. void DecompressColour( u8* rgba, void const* block, bool isDxt1 );
  157. +// -- GODOT start --
  158. ++void DecompressColourBc4( u8* rgba, void const* block );
  159. +void DecompressColourBc5( u8* rgba, void const* block );
  160. +// -- GODOT end --
  161. } // namespace squish
  162. diff --git a/thirdparty/squish/config.h b/thirdparty/squish/config.h
  163. -index 92edefe96..05f8d7259 100644
  164. +index 92edefe966..05f8d72598 100644
  165. --- a/thirdparty/squish/config.h
  166. +++ b/thirdparty/squish/config.h
  167. @@ -32,6 +32,26 @@
  168. @@ -82,17 +94,19 @@ index 92edefe96..05f8d7259 100644
  169. #define SQUISH_USE_SSE 0
  170. #endif
  171. diff --git a/thirdparty/squish/squish.cpp b/thirdparty/squish/squish.cpp
  172. -index 1d22a64ad..fd11a147d 100644
  173. +index 1d22a64ad6..086ba11cd0 100644
  174. --- a/thirdparty/squish/squish.cpp
  175. +++ b/thirdparty/squish/squish.cpp
  176. -@@ -135,7 +135,13 @@ void Decompress( u8* rgba, void const* block, int flags )
  177. +@@ -135,7 +135,15 @@ void Decompress( u8* rgba, void const* block, int flags )
  178. colourBlock = reinterpret_cast< u8 const* >( block ) + 8;
  179. // decompress colour
  180. - DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 );
  181. + // -- GODOT start --
  182. + //DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 );
  183. -+ if(( flags & ( kBc5 ) ) != 0)
  184. ++ if(( flags & ( kBc4 ) ) != 0)
  185. ++ DecompressColourBc4( rgba, colourBlock);
  186. ++ else if(( flags & ( kBc5 ) ) != 0)
  187. + DecompressColourBc5( rgba, colourBlock);
  188. + else
  189. + DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 );