Fix OpenImageIO thread pool not following -t command line option

We do this for the OpenEXR thread pool as well. Needed until OIIO fully
switches over to TBB.

Pull Request: https://projects.blender.org/blender/blender/pulls/110501
This commit is contained in:
Brecht Van Lommel
2023-08-07 18:19:33 +02:00
committed by Brecht Van Lommel
parent f5e567b4a8
commit 803b541307
3 changed files with 22 additions and 0 deletions

View File

@@ -239,6 +239,8 @@ void imb_filetypes_init()
{
const ImFileType *type;
OIIO_init();
for (type = IMB_FILE_TYPES; type < IMB_FILE_TYPES_LAST; type++) {
if (type->init) {
type->init();

View File

@@ -7,12 +7,24 @@
*/
#include "openimageio_api.h"
#include <OpenImageIO/imageio.h>
#include "BLI_threads.h"
OIIO_NAMESPACE_USING
extern "C" {
void OIIO_init()
{
/* Make OIIO thread pool follow Blender number of threads override. */
const int threads_override = BLI_system_num_threads_override_get();
if (threads_override) {
OIIO::attribute("threads", threads_override);
}
}
int OIIO_getVersionHex()
{
return openimageio_version();

View File

@@ -12,6 +12,14 @@
extern "C" {
#endif
/*
* Initialize OpenImageIO on startup.
*/
void OIIO_init(void);
/*
* Get OpenImageIO version.
*/
int OIIO_getVersionHex(void);
#ifdef __cplusplus