summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--user/glslang/APKBUILD7
-rw-r--r--user/glslang/remap-endian.patch46
2 files changed, 51 insertions, 2 deletions
diff --git a/user/glslang/APKBUILD b/user/glslang/APKBUILD
index f4e911e9e..afe29113f 100644
--- a/user/glslang/APKBUILD
+++ b/user/glslang/APKBUILD
@@ -10,7 +10,9 @@ license="BSD-3-Clause AND MIT AND BSD-2-Clause AND GPL-3.0+ WITH Bison-2.2-excep
depends="spirv-tools"
makedepends="cmake python3 spirv-tools-dev"
subpackages="$pkgname-dev"
-source="glslang-$pkgver.tar.gz::https://github.com/KhronosGroup/glslang/archive/$pkgver.tar.gz"
+source="glslang-$pkgver.tar.gz::https://github.com/KhronosGroup/glslang/archive/$pkgver.tar.gz
+ remap-endian.patch
+ "
build() {
if [ "$CBUILD" != "$CHOST" ]; then
@@ -37,4 +39,5 @@ package() {
make DESTDIR="$pkgdir" install
}
-sha512sums="ce6d09cc4d98b01d162ec5a196eec017c4a5f25eaf98c6612695d911f8d136c2f7193ff8f2c07931b2e94182d2c654833adc3b645f0c225e1d07c4e6e7abfd76 glslang-14.3.0.tar.gz"
+sha512sums="ce6d09cc4d98b01d162ec5a196eec017c4a5f25eaf98c6612695d911f8d136c2f7193ff8f2c07931b2e94182d2c654833adc3b645f0c225e1d07c4e6e7abfd76 glslang-14.3.0.tar.gz
+4745982dac709fc106f50e4f51800cefef07f11f609dfdaa234c3d61fab5f7bd2350720a294a686e88eb92916d1ccdfa203993419d697eb780ee741395bde8c2 remap-endian.patch"
diff --git a/user/glslang/remap-endian.patch b/user/glslang/remap-endian.patch
new file mode 100644
index 000000000..4c1fc78ff
--- /dev/null
+++ b/user/glslang/remap-endian.patch
@@ -0,0 +1,46 @@
+Issue: https://github.com/KhronosGroup/glslang/issues/3799
+
+--- glslang-14.3.0/StandAlone/spirv-remap.cpp.old 2024-06-25 17:42:43.000000000 -0500
++++ glslang-14.3.0/StandAlone/spirv-remap.cpp 2024-11-22 15:27:02.655869572 -0600
+@@ -38,6 +38,7 @@
+ #include <cstring>
+ #include <stdexcept>
+ #include <filesystem>
++#include <byteswap.h>
+
+ //
+ // Include remapper
+@@ -48,6 +49,8 @@
+
+ typedef unsigned int SpvWord;
+
++ static const SpvWord MagicNumber = 0x07230203;
++
+ // Poor man's basename: given a complete path, return file portion.
+ // E.g:
+ // Linux: /foo/bar/test -> test
+@@ -82,6 +85,7 @@
+ void read(std::vector<SpvWord>& spv, const std::string& inFilename, int verbosity)
+ {
+ std::ifstream fp;
++ bool isNativeEndian = true;
+
+ if (verbosity > 0)
+ logHandler(std::string(" reading: ") + inFilename);
+@@ -97,11 +101,16 @@
+ spv.reserve(size_t(fp.tellg()) / sizeof(SpvWord));
+ fp.seekg(0, fp.beg);
+
++ char begin = fp.peek();
++ char native_begin = reinterpret_cast<const char*>(&MagicNumber)[0];
++ if (begin != native_begin) isNativeEndian = false;
++
+ while (!fp.eof()) {
+ SpvWord inWord;
+ fp.read((char *)&inWord, sizeof(inWord));
+
+ if (!fp.eof()) {
++ if (!isNativeEndian) inWord = __bswap_32(inWord);
+ spv.push_back(inWord);
+ if (fp.fail())
+ errHandler(std::string("error reading file: ") + inFilename);