summaryrefslogtreecommitdiff
path: root/games-strategy/0ad/files/0ad-0.0.24b_alpha-fix-hang-on-quit-without-nvtt.patch
blob: fe054eccac5198d5a1c82965d2b120837b72eb1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Nils Freydank <holgersson@posteo.de> (2021-06-17)
Apply the patch from upstream with minor adoption.

Gentoo bug: https://bugs.gentoo.org/779757
Upstream Bug: https://trac.wildfiregames.com/ticket/6107
Upstream Patch: https://trac.wildfiregames.com/changeset/25766

--- a/source/graphics/TextureConverter.cpp	(revision 25765)
+++ b/source/graphics/TextureConverter.cpp	(revision 25766)
@@ -294,9 +294,8 @@
 	m_VFS(vfs), m_HighQuality(highQuality), m_Shutdown(false)
 {
+#if CONFIG2_NVTT
 	// Verify that we are running with at least the version we were compiled with,
 	// to avoid bugs caused by ABI changes
-#if CONFIG2_NVTT
 	ENSURE(nvtt::version() >= NVTT_VERSION);
-#endif
 
 	m_WorkerThread = std::thread(Threading::HandleExceptions<RunThread>::Wrapper, this);
@@ -304,8 +303,10 @@
 	// Maybe we should share some centralised pool of worker threads?
 	// For now we'll just stick with a single thread for this specific use.
+#endif // CONFIG2_NVTT
 }
 
 CTextureConverter::~CTextureConverter()
 {
+#if CONFIG2_NVTT
 	// Tell the thread to shut down
 	{
@@ -327,4 +328,5 @@
 	// Wait for it to shut down cleanly
 	m_WorkerThread.join();
+#endif // CONFIG2_NVTT
 }
 
@@ -477,8 +479,8 @@
 	return true;
 
-#else
+#else // CONFIG2_NVTT
 	LOGERROR("Failed to convert texture \"%s\" (NVTT not available)", src.string8());
 	return false;
-#endif
+#endif // !CONFIG2_NVTT
 }
 
@@ -529,22 +531,24 @@
 	return true;
 
-#else // #if CONFIG2_NVTT
+#else // CONFIG2_NVTT
 	return false;
-#endif
+#endif // !CONFIG2_NVTT
 }
 
 bool CTextureConverter::IsBusy()
 {
+#if CONFIG2_NVTT
 	std::lock_guard<std::mutex> lock(m_WorkerMutex);
 	return !m_RequestQueue.empty();
+#else // CONFIG2_NVTT
+	return false;
+#endif // !CONFIG2_NVTT
 }
 
 void CTextureConverter::RunThread(CTextureConverter* textureConverter)
 {
+#if CONFIG2_NVTT
 	debug_SetThreadName("TextureConverter");
 	g_Profiler2.RegisterCurrentThread("texconv");
-
-#if CONFIG2_NVTT
-
 	// Wait until the main thread wakes us up
 	while (true)
@@ -596,4 +600,4 @@
 	std::lock_guard<std::mutex> wait_lock(textureConverter->m_WorkerMutex);
 	textureConverter->m_Shutdown = false;
-#endif
-}
+#endif // CONFIG2_NVTT
+}

--- a/source/graphics/TextureConverter.h	(revision 25765)
+++ b/source/graphics/TextureConverter.h	(revision 25766)
@@ -208,7 +208,9 @@
 	bool m_HighQuality;
 
+#if CONFIG2_NVTT
 	std::thread m_WorkerThread;
 	std::mutex m_WorkerMutex;
 	std::condition_variable m_WorkerCV;
+#endif // CONFIG2_NVTT
 
 	struct ConversionRequest;