You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
2.5 KiB
99 lines
2.5 KiB
3 years ago
|
# 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;
|