vulkan: android: vk_instance_init failed on android after e6392fcf
Error from the logcat:
07-29 12:46:19.025 2268 2290 F dEQP : vk.createInstance(pCreateInfo, pAllocator, &object): VK_ERROR_INITIALIZATION_FAILED at vkRefUtilImpl.inl:192
Current main (df242a2c) is affected as well.
After restoring mtx_init from e6392fcf it starts working.
diff --git a/src/c11/impl/threads_posix.c b/src/c11/impl/threads_posix.c
index 736fc587be245..7b7559f060667 100644
--- a/src/c11/impl/threads_posix.c
+++ b/src/c11/impl/threads_posix.c
@@ -171,30 +171,6 @@ __attribute__((weak))
int pthread_mutexattr_destroy(pthread_mutexattr_t *attr);
#endif
-// 7.25.4.2
-int
-mtx_init(mtx_t *mtx, int type)
-{
- pthread_mutexattr_t attr;
- assert(mtx != NULL);
- if (type != mtx_plain && type != mtx_timed && type != mtx_try
- && type != (mtx_plain|mtx_recursive)
- && type != (mtx_timed|mtx_recursive)
- && type != (mtx_try|mtx_recursive))
- return thrd_error;
-
- if ((type & mtx_recursive) == 0) {
- pthread_mutex_init(mtx, NULL);
- return thrd_success;
- }
-
- pthread_mutexattr_init(&attr);
- pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
- pthread_mutex_init(mtx, &attr);
- pthread_mutexattr_destroy(&attr);
- return thrd_success;
-}
-
// 7.25.4.3
int
mtx_lock(mtx_t *mtx)
diff --git a/src/c11/threads.h b/src/c11/threads.h
index 43dc243a9b88c..1cd4b97ac9dd2 100644
--- a/src/c11/threads.h
+++ b/src/c11/threads.h
@@ -36,6 +36,7 @@
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
+#include <assert.h>
#if defined(_WIN32) && !defined(__CYGWIN__)
# include <io.h> /* close */
@@ -154,7 +155,30 @@ int cnd_timedwait(cnd_t *__restrict, mtx_t *__restrict __mtx,
const struct timespec *__restrict);
int cnd_wait(cnd_t *, mtx_t *__mtx);
void mtx_destroy(mtx_t *__mtx);
-int mtx_init(mtx_t *__mtx, int);
+
+static inline int
+mtx_init(mtx_t *mtx, int type)
+{
+ pthread_mutexattr_t attr;
+ assert(mtx != NULL);
+ if (type != mtx_plain && type != mtx_timed && type != mtx_try
+ && type != (mtx_plain|mtx_recursive)
+ && type != (mtx_timed|mtx_recursive)
+ && type != (mtx_try|mtx_recursive))
+ return thrd_error;
+
+ if ((type & mtx_recursive) == 0) {
+ pthread_mutex_init(mtx, NULL);
+ return thrd_success;
+ }
+
+ pthread_mutexattr_init(&attr);
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init(mtx, &attr);
+ pthread_mutexattr_destroy(&attr);
+ return thrd_success;
+}
+
int mtx_lock(mtx_t *__mtx);
int mtx_timedlock(mtx_t *__restrict __mtx,
const struct timespec *__restrict);
Edited by Roman Stratiienko