Skip to content

Commit

Permalink
Revert OpenEXR to 2.5.10
Browse files Browse the repository at this point in the history
  • Loading branch information
AlienCowEatCake committed Sep 8, 2024
1 parent fd58236 commit 3d78a71
Show file tree
Hide file tree
Showing 2,399 changed files with 343,719 additions and 385,282 deletions.
8 changes: 1 addition & 7 deletions src/Features.pri
Original file line number Diff line number Diff line change
Expand Up @@ -657,13 +657,7 @@ disable_cxx11 : !system_libheif {
disable_zlib : !system_openexr {
CONFIG *= disable_openexr
}
*msvc* : !system_openexr : lessThan(MSVC_VERSION, 2017) {
CONFIG *= disable_openexr
}
win32 : *g++* : !*clang* : !system_openexr : lessThan(GCC_VERSION_NUMERIC, 80100) { # FIXME: Find exact version
CONFIG *= disable_openexr
}
disable_cxx14 : !system_openexr {
*msvc* : !system_openexr : lessThan(MSVC_VERSION, 2013) {
CONFIG *= disable_openexr
}

Expand Down
23 changes: 23 additions & 0 deletions src/ThirdParty/OpenEXR/IlmThreadQt/IlmThread/IlmThread.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "IlmThread.h"

#include <QString>

ILMTHREAD_INTERNAL_NAMESPACE_SOURCE_ENTER

bool supportsThreads()
{
return true;
}

Thread::Thread()
{
setObjectName(QString::fromLatin1("IlmThreadQt"));
}

Thread::~Thread()
{
if(isRunning())
wait();
}

ILMTHREAD_INTERNAL_NAMESPACE_SOURCE_EXIT
24 changes: 24 additions & 0 deletions src/ThirdParty/OpenEXR/IlmThreadQt/IlmThread/IlmThread.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#if !defined(ILM_QT_THREAD_H_INCLUDED)
#define ILM_QT_THREAD_H_INCLUDED

#include <QThread>

#include "IlmBaseConfig.h"
#include "IlmThreadNamespace.h"

ILMTHREAD_INTERNAL_NAMESPACE_HEADER_ENTER

bool supportsThreads();

class Thread : public QThread
{
Q_DISABLE_COPY(Thread)

public:
Thread();
~Thread();
};

ILMTHREAD_INTERNAL_NAMESPACE_HEADER_EXIT

#endif // ILM_QT_THREAD_H_INCLUDED
18 changes: 18 additions & 0 deletions src/ThirdParty/OpenEXR/IlmThreadQt/IlmThread/IlmThreadForward.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#if !defined(ILM_QT_THREAD_FORWARD_H_INCLUDED)
#define ILM_QT_THREAD_FORWARD_H_INCLUDED

#include "IlmThreadNamespace.h"

ILMTHREAD_INTERNAL_NAMESPACE_HEADER_ENTER

class Thread;
class Mutex;
class Lock;
class ThreadPool;
class Task;
class TaskGroup;
class Semaphore;

ILMTHREAD_INTERNAL_NAMESPACE_HEADER_EXIT

#endif // ILM_QT_THREAD_FORWARD_H_INCLUDED
42 changes: 42 additions & 0 deletions src/ThirdParty/OpenEXR/IlmThreadQt/IlmThread/IlmThreadMutex.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include "IlmThreadMutex.h"

ILMTHREAD_INTERNAL_NAMESPACE_SOURCE_ENTER

Mutex::Mutex()
{}

Mutex::~Mutex()
{}

Lock::Lock(const Mutex &m, bool autoLock)
: m_mutex(const_cast<Mutex&>(m))
, m_locked(false)
{
if(autoLock)
acquire();
}

Lock::~Lock()
{
if(m_locked)
m_mutex.unlock();
}

void Lock::acquire()
{
m_mutex.lock();
m_locked = true;
}

void Lock::release()
{
m_mutex.unlock();
m_locked = false;
}

bool Lock::locked() const
{
return m_locked;
}

ILMTHREAD_INTERNAL_NAMESPACE_SOURCE_EXIT
39 changes: 39 additions & 0 deletions src/ThirdParty/OpenEXR/IlmThreadQt/IlmThread/IlmThreadMutex.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#if !defined(ILM_QT_THREAD_MUTEX_H_INCLUDED)
#define ILM_QT_THREAD_MUTEX_H_INCLUDED

#include <QMutex>

#include "IlmBaseConfig.h"
#include "IlmThreadNamespace.h"

ILMTHREAD_INTERNAL_NAMESPACE_HEADER_ENTER

class Mutex : public QMutex
{
Q_DISABLE_COPY(Mutex)

public:
Mutex();
~Mutex();
};

class Lock
{
Q_DISABLE_COPY(Lock)

public:
Lock(const Mutex &m, bool autoLock = true);
~Lock();

void acquire();
void release();
bool locked() const;

private:
Mutex &m_mutex;
bool m_locked;
};

ILMTHREAD_INTERNAL_NAMESPACE_HEADER_EXIT

#endif // ILM_QT_THREAD_MUTEX_H_INCLUDED
25 changes: 25 additions & 0 deletions src/ThirdParty/OpenEXR/IlmThreadQt/IlmThread/IlmThreadNamespace.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#if !defined(ILM_QT_THREAD_NAMESPACE_H_INCLUDED)
#define ILM_QT_THREAD_NAMESPACE_H_INCLUDED

#include "IlmBaseConfig.h"

#ifndef ILMTHREAD_NAMESPACE
#define ILMTHREAD_NAMESPACE IlmThread
#endif

#ifndef ILMTHREAD_INTERNAL_NAMESPACE
#define ILMTHREAD_INTERNAL_NAMESPACE ILMTHREAD_NAMESPACE
#endif

namespace ILMTHREAD_INTERNAL_NAMESPACE {}
namespace ILMTHREAD_NAMESPACE {
using namespace ILMTHREAD_INTERNAL_NAMESPACE;
}

#define ILMTHREAD_INTERNAL_NAMESPACE_HEADER_ENTER namespace ILMTHREAD_INTERNAL_NAMESPACE {
#define ILMTHREAD_INTERNAL_NAMESPACE_HEADER_EXIT }

#define ILMTHREAD_INTERNAL_NAMESPACE_SOURCE_ENTER namespace ILMTHREAD_INTERNAL_NAMESPACE {
#define ILMTHREAD_INTERNAL_NAMESPACE_SOURCE_EXIT }

#endif // ILM_QT_THREAD_NAMESPACE_H_INCLUDED
119 changes: 119 additions & 0 deletions src/ThirdParty/OpenEXR/IlmThreadQt/IlmThread/IlmThreadPool.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#include "IlmThreadPool.h"

#include <QDebug>

ILMTHREAD_INTERNAL_NAMESPACE_SOURCE_ENTER

TaskGroup::TaskGroup()
: m_counter(0)
{}

TaskGroup::~TaskGroup()
{
m_mutex.lock();
while(m_counter > 0)
m_cond.wait(&m_mutex);
m_mutex.unlock();
}

void TaskGroup::incrementCounter()
{
m_mutex.lock();
m_counter++;
m_mutex.unlock();
}

void TaskGroup::decrementCounter()
{
m_mutex.lock();
m_counter--;
m_mutex.unlock();
m_cond.wakeAll();
}

Task::Task(TaskGroup *g)
: m_runnable(new TaskImpl(this))
, m_group(g)
{
m_group->incrementCounter();
}

Task::~Task()
{
m_group->decrementCounter();
}

TaskGroup *Task::group()
{
return m_group;
}

QRunnable *Task::runnable()
{
return m_runnable;
}

Task::TaskImpl::TaskImpl(Task *task)
: m_task(task)
{}

Task::TaskImpl::~TaskImpl()
{
delete m_task;
}

void Task::TaskImpl::run()
{
m_task->execute();
}

ThreadPool::ThreadPool(unsigned numThreads)
: m_threadPool(new QThreadPool)
, m_isExternal(false)
{
setNumThreads(static_cast<int>(numThreads));
}

ThreadPool::ThreadPool(QThreadPool *pool)
: m_threadPool(pool)
, m_isExternal(true)
{}

ThreadPool::~ThreadPool()
{
if(m_isExternal)
return;
m_threadPool->waitForDone();
m_threadPool->deleteLater();
}

int ThreadPool::numThreads() const
{
return m_threadPool->maxThreadCount();
}

void ThreadPool::setNumThreads(int count)
{
if(m_threadPool != QThreadPool::globalInstance())
m_threadPool->setMaxThreadCount(count);
else
qWarning() << "ThreadPool::setNumThreads() is not allowed for global thread pool";
}

void ThreadPool::addTask(Task *task)
{
m_threadPool->start(task->runnable());
}

ThreadPool &ThreadPool::globalThreadPool()
{
static ThreadPool globalPool(QThreadPool::globalInstance());
return globalPool;
}

void ThreadPool::addGlobalTask(Task *task)
{
globalThreadPool().addTask(task);
}

ILMTHREAD_INTERNAL_NAMESPACE_SOURCE_EXIT
Loading

0 comments on commit 3d78a71

Please sign in to comment.