From e1d9b095e4f55022e579d246997b48ec2dd409e0 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Fri, 5 Mar 2021 15:35:43 +0100 Subject: Cleanup: Use enum class for eChunkExecutionState. --- source/blender/compositor/COM_compositor.h | 6 ++--- .../compositor/intern/COM_ExecutionGroup.cpp | 26 +++++++++++----------- .../blender/compositor/intern/COM_ExecutionGroup.h | 18 +++++++-------- 3 files changed, 25 insertions(+), 25 deletions(-) (limited to 'source/blender') diff --git a/source/blender/compositor/COM_compositor.h b/source/blender/compositor/COM_compositor.h index ba66d7f0dfe..4aae5471858 100644 --- a/source/blender/compositor/COM_compositor.h +++ b/source/blender/compositor/COM_compositor.h @@ -113,11 +113,11 @@ extern "C" { * * When the chunk-order is determined, the first few chunks will be checked if they can be scheduled. * Chunks can have three states: - * - [@ref ChunkExecutionState.COM_ES_NOT_SCHEDULED]: + * - [@ref eChunkExecutionState.NOT_SCHEDULED]: * Chunk is not yet scheduled, or dependencies are not met. - * - [@ref ChunkExecutionState.COM_ES_SCHEDULED]: + * - [@ref eChunkExecutionState.SCHEDULED]: * All dependencies are met, chunk is scheduled, but not finished. - * - [@ref ChunkExecutionState.COM_ES_EXECUTED]: + * - [@ref eChunkExecutionState.EXECUTED]: * Chunk is finished. * * \see ExecutionGroup.execute diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp index dc12248899d..b8cacd7138d 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp +++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp @@ -129,10 +129,10 @@ void ExecutionGroup::initExecution() this->m_chunkExecutionStates = nullptr; if (this->m_numberOfChunks != 0) { - this->m_chunkExecutionStates = (ChunkExecutionState *)MEM_mallocN( - sizeof(ChunkExecutionState) * this->m_numberOfChunks, __func__); + this->m_chunkExecutionStates = (eChunkExecutionState *)MEM_mallocN( + sizeof(eChunkExecutionState) * this->m_numberOfChunks, __func__); for (index = 0; index < this->m_numberOfChunks; index++) { - this->m_chunkExecutionStates[index] = COM_ES_NOT_SCHEDULED; + this->m_chunkExecutionStates[index] = eChunkExecutionState::NOT_SCHEDULED; } } @@ -338,8 +338,8 @@ void ExecutionGroup::execute(ExecutionSystem *graph) chunkNumber = chunkOrder[index]; int yChunk = chunkNumber / this->m_numberOfXChunks; int xChunk = chunkNumber - (yChunk * this->m_numberOfXChunks); - const ChunkExecutionState state = this->m_chunkExecutionStates[chunkNumber]; - if (state == COM_ES_NOT_SCHEDULED) { + const eChunkExecutionState state = this->m_chunkExecutionStates[chunkNumber]; + if (state == eChunkExecutionState::NOT_SCHEDULED) { scheduleChunkWhenPossible(graph, xChunk, yChunk); finished = false; startEvaluated = true; @@ -349,12 +349,12 @@ void ExecutionGroup::execute(ExecutionSystem *graph) bTree->update_draw(bTree->udh); } } - else if (state == COM_ES_SCHEDULED) { + else if (state == eChunkExecutionState::SCHEDULED) { finished = false; startEvaluated = true; numberEvaluated++; } - else if (state == COM_ES_EXECUTED && !startEvaluated) { + else if (state == eChunkExecutionState::EXECUTED && !startEvaluated) { startIndex = index + 1; } } @@ -405,8 +405,8 @@ MemoryBuffer *ExecutionGroup::constructConsolidatedMemoryBuffer(MemoryProxy *mem void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memoryBuffers) { - if (this->m_chunkExecutionStates[chunkNumber] == COM_ES_SCHEDULED) { - this->m_chunkExecutionStates[chunkNumber] = COM_ES_EXECUTED; + if (this->m_chunkExecutionStates[chunkNumber] == eChunkExecutionState::SCHEDULED) { + this->m_chunkExecutionStates[chunkNumber] = eChunkExecutionState::EXECUTED; } atomic_add_and_fetch_u(&this->m_chunksFinished, 1); @@ -517,8 +517,8 @@ bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area bool ExecutionGroup::scheduleChunk(unsigned int chunkNumber) { - if (this->m_chunkExecutionStates[chunkNumber] == COM_ES_NOT_SCHEDULED) { - this->m_chunkExecutionStates[chunkNumber] = COM_ES_SCHEDULED; + if (this->m_chunkExecutionStates[chunkNumber] == eChunkExecutionState::NOT_SCHEDULED) { + this->m_chunkExecutionStates[chunkNumber] = eChunkExecutionState::SCHEDULED; WorkScheduler::schedule(this, chunkNumber); return true; } @@ -535,12 +535,12 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph, int xChun } int chunkNumber = yChunk * this->m_numberOfXChunks + xChunk; // chunk is already executed - if (this->m_chunkExecutionStates[chunkNumber] == COM_ES_EXECUTED) { + if (this->m_chunkExecutionStates[chunkNumber] == eChunkExecutionState::EXECUTED) { return true; } // chunk is scheduled, but not executed - if (this->m_chunkExecutionStates[chunkNumber] == COM_ES_SCHEDULED) { + if (this->m_chunkExecutionStates[chunkNumber] == eChunkExecutionState::SCHEDULED) { return false; } diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.h b/source/blender/compositor/intern/COM_ExecutionGroup.h index a311d2681d4..bfd745d8320 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.h +++ b/source/blender/compositor/intern/COM_ExecutionGroup.h @@ -39,20 +39,20 @@ class Device; * \brief the execution state of a chunk in an ExecutionGroup * \ingroup Execution */ -typedef enum ChunkExecutionState { +enum class eChunkExecutionState { /** * \brief chunk is not yet scheduled */ - COM_ES_NOT_SCHEDULED = 0, + NOT_SCHEDULED = 0, /** * \brief chunk is scheduled, but not yet executed */ - COM_ES_SCHEDULED = 1, + SCHEDULED = 1, /** * \brief chunk is executed. */ - COM_ES_EXECUTED = 2, -} ChunkExecutionState; + EXECUTED = 2, +}; /** * \brief Class ExecutionGroup is a group of Operations that are executed as one. @@ -150,11 +150,11 @@ class ExecutionGroup { /** * \brief the chunkExecutionStates holds per chunk the execution state. this state can be - * - COM_ES_NOT_SCHEDULED: not scheduled - * - COM_ES_SCHEDULED: scheduled - * - COM_ES_EXECUTED: executed + * - eChunkExecutionState::NOT_SCHEDULED: not scheduled + * - eChunkExecutionState::SCHEDULED: scheduled + * - eChunkExecutionState::EXECUTED: executed */ - ChunkExecutionState *m_chunkExecutionStates; + eChunkExecutionState *m_chunkExecutionStates; /** * \brief indicator when this ExecutionGroup has valid Operations in its vector for Execution -- cgit v1.2.3