summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2022-08-23 10:54:27 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2022-08-23 10:54:27 +0200
commit5020a545d1ddd3224b904ad13e605ed14c3caaa0 (patch)
tree79246d8f1bdc19a13a9dc11b6c4b2d204fbec96a
parentb9919fd87dbac180f2d3ade766a8d074d4224dfe (diff)
Patch glslang to avoid build errors on certain platforms
-rw-r--r--thirdparty/README.md1
-rw-r--r--thirdparty/glslang/glslang/OSDependent/Unix/ossource.cpp37
-rw-r--r--thirdparty/glslang/glslang/OSDependent/osinclude.h2
-rw-r--r--thirdparty/glslang/patches/unused_cleanup.diff61
4 files changed, 62 insertions, 39 deletions
diff --git a/thirdparty/README.md b/thirdparty/README.md
index 664401fca6..9f6e6e8ec5 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -195,6 +195,7 @@ Files extracted from upstream source:
to `glslang/build_info.h`
- `LICENSE.txt`
- Unnecessary files like `CMakeLists.txt`, `*.m4` and `updateGrammar` removed.
+- Patch in `patches/unused_cleanup.diff` must be applied.
## graphite
diff --git a/thirdparty/glslang/glslang/OSDependent/Unix/ossource.cpp b/thirdparty/glslang/glslang/OSDependent/Unix/ossource.cpp
index 81da99c2c4..1cbd616e98 100644
--- a/thirdparty/glslang/glslang/OSDependent/Unix/ossource.cpp
+++ b/thirdparty/glslang/glslang/OSDependent/Unix/ossource.cpp
@@ -66,43 +66,6 @@ static void DetachThreadLinux(void *)
}
//
-// Registers cleanup handler, sets cancel type and state, and executes the thread specific
-// cleanup handler. This function will be called in the Standalone.cpp for regression
-// testing. When OpenGL applications are run with the driver code, Linux OS does the
-// thread cleanup.
-//
-void OS_CleanupThreadData(void)
-{
-#if defined(__ANDROID__) || defined(__Fuchsia__)
- DetachThreadLinux(NULL);
-#else
- int old_cancel_state, old_cancel_type;
- void *cleanupArg = NULL;
-
- //
- // Set thread cancel state and push cleanup handler.
- //
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &old_cancel_state);
- pthread_cleanup_push(DetachThreadLinux, (void *) cleanupArg);
-
- //
- // Put the thread in deferred cancellation mode.
- //
- pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &old_cancel_type);
-
- //
- // Pop cleanup handler and execute it prior to unregistering the cleanup handler.
- //
- pthread_cleanup_pop(1);
-
- //
- // Restore the thread's previous cancellation mode.
- //
- pthread_setcanceltype(old_cancel_state, NULL);
-#endif
-}
-
-//
// Thread Local Storage Operations
//
inline OS_TLSIndex PthreadKeyToTLSIndex(pthread_key_t key)
diff --git a/thirdparty/glslang/glslang/OSDependent/osinclude.h b/thirdparty/glslang/glslang/OSDependent/osinclude.h
index 218abe4f23..fcfeff2cc4 100644
--- a/thirdparty/glslang/glslang/OSDependent/osinclude.h
+++ b/thirdparty/glslang/glslang/OSDependent/osinclude.h
@@ -54,8 +54,6 @@ void ReleaseGlobalLock();
typedef unsigned int (*TThreadEntrypoint)(void*);
-void OS_CleanupThreadData(void);
-
void OS_DumpMemoryCounters();
} // end namespace glslang
diff --git a/thirdparty/glslang/patches/unused_cleanup.diff b/thirdparty/glslang/patches/unused_cleanup.diff
new file mode 100644
index 0000000000..3e9a9c23f9
--- /dev/null
+++ b/thirdparty/glslang/patches/unused_cleanup.diff
@@ -0,0 +1,61 @@
+diff --git a/thirdparty/glslang/glslang/OSDependent/Unix/ossource.cpp b/thirdparty/glslang/glslang/OSDependent/Unix/ossource.cpp
+index 81da99c2c4..1cbd616e98 100644
+--- a/thirdparty/glslang/glslang/OSDependent/Unix/ossource.cpp
++++ b/thirdparty/glslang/glslang/OSDependent/Unix/ossource.cpp
+@@ -65,43 +65,6 @@ static void DetachThreadLinux(void *)
+ DetachThread();
+ }
+
+-//
+-// Registers cleanup handler, sets cancel type and state, and executes the thread specific
+-// cleanup handler. This function will be called in the Standalone.cpp for regression
+-// testing. When OpenGL applications are run with the driver code, Linux OS does the
+-// thread cleanup.
+-//
+-void OS_CleanupThreadData(void)
+-{
+-#if defined(__ANDROID__) || defined(__Fuchsia__)
+- DetachThreadLinux(NULL);
+-#else
+- int old_cancel_state, old_cancel_type;
+- void *cleanupArg = NULL;
+-
+- //
+- // Set thread cancel state and push cleanup handler.
+- //
+- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &old_cancel_state);
+- pthread_cleanup_push(DetachThreadLinux, (void *) cleanupArg);
+-
+- //
+- // Put the thread in deferred cancellation mode.
+- //
+- pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &old_cancel_type);
+-
+- //
+- // Pop cleanup handler and execute it prior to unregistering the cleanup handler.
+- //
+- pthread_cleanup_pop(1);
+-
+- //
+- // Restore the thread's previous cancellation mode.
+- //
+- pthread_setcanceltype(old_cancel_state, NULL);
+-#endif
+-}
+-
+ //
+ // Thread Local Storage Operations
+ //
+diff --git a/thirdparty/glslang/glslang/OSDependent/osinclude.h b/thirdparty/glslang/glslang/OSDependent/osinclude.h
+index 218abe4f23..fcfeff2cc4 100644
+--- a/thirdparty/glslang/glslang/OSDependent/osinclude.h
++++ b/thirdparty/glslang/glslang/OSDependent/osinclude.h
+@@ -54,8 +54,6 @@ void ReleaseGlobalLock();
+
+ typedef unsigned int (*TThreadEntrypoint)(void*);
+
+-void OS_CleanupThreadData(void);
+-
+ void OS_DumpMemoryCounters();
+
+ } // end namespace glslang