godot-changes.patch 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 )