Add Yield function to global namespace

In order to develop a threadsafe texture compression function, we will need
to preempt threads in order to not kill performance while we initialzie everything...
This commit is contained in:
Pavel Krajcevski 2013-03-06 17:29:22 -05:00
parent 2deb71eec9
commit 8ebdc30394
2 changed files with 9 additions and 0 deletions

View File

@ -121,4 +121,8 @@ typedef void (* CompressionFuncWithStats)(
// compressed image and a raw image. // compressed image and a raw image.
extern double ComputePSNR(const CompressedImage &ci, const ImageFile &file); extern double ComputePSNR(const CompressedImage &ci, const ImageFile &file);
// This is a multi-platform yield function that preempts the current thread
// based on the threading library that we're using.
extern void YieldThread();
#endif //_TEX_COMP_H_ #endif //_TEX_COMP_H_

View File

@ -49,6 +49,7 @@
#include <assert.h> #include <assert.h>
#include "BC7Compressor.h" #include "BC7Compressor.h"
#include "Thread.h"
#include "WorkerQueue.h" #include "WorkerQueue.h"
#include "ThreadGroup.h" #include "ThreadGroup.h"
@ -322,3 +323,7 @@ bool CompressImageData(
return true; return true;
} }
void YieldThread() {
TCThread::Yield();
}