diff options
Diffstat (limited to 'source/blender/compositor/intern')
28 files changed, 672 insertions, 677 deletions
diff --git a/source/blender/compositor/intern/COM_CPUDevice.cc b/source/blender/compositor/intern/COM_CPUDevice.cc index dbf813a61b4..89aea47f4a6 100644 --- a/source/blender/compositor/intern/COM_CPUDevice.cc +++ b/source/blender/compositor/intern/COM_CPUDevice.cc @@ -23,7 +23,7 @@ namespace blender::compositor { -CPUDevice::CPUDevice(int thread_id) : m_thread_id(thread_id) +CPUDevice::CPUDevice(int thread_id) : thread_id_(thread_id) { } diff --git a/source/blender/compositor/intern/COM_CPUDevice.h b/source/blender/compositor/intern/COM_CPUDevice.h index 99629890b30..b5d1fd1fff1 100644 --- a/source/blender/compositor/intern/COM_CPUDevice.h +++ b/source/blender/compositor/intern/COM_CPUDevice.h @@ -39,11 +39,11 @@ class CPUDevice : public Device { int thread_id() { - return m_thread_id; + return thread_id_; } protected: - int m_thread_id; + int thread_id_; }; } // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_CompositorContext.cc b/source/blender/compositor/intern/COM_CompositorContext.cc index 81043f1f163..5e2e5ea295b 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.cc +++ b/source/blender/compositor/intern/COM_CompositorContext.cc @@ -22,20 +22,20 @@ namespace blender::compositor { CompositorContext::CompositorContext() { - m_scene = nullptr; - m_rd = nullptr; - m_quality = eCompositorQuality::High; - m_hasActiveOpenCLDevices = false; - m_fastCalculation = false; - m_viewSettings = nullptr; - m_displaySettings = nullptr; - m_bnodetree = nullptr; + scene_ = nullptr; + rd_ = nullptr; + quality_ = eCompositorQuality::High; + hasActiveOpenCLDevices_ = false; + fastCalculation_ = false; + viewSettings_ = nullptr; + displaySettings_ = nullptr; + bnodetree_ = nullptr; } int CompositorContext::getFramenumber() const { - BLI_assert(m_rd); - return m_rd->cfra; + BLI_assert(rd_); + return rd_->cfra; } Size2f CompositorContext::get_render_size() const @@ -47,8 +47,8 @@ Size2f CompositorContext::get_render_size() const eExecutionModel CompositorContext::get_execution_model() const { if (U.experimental.use_full_frame_compositor) { - BLI_assert(m_bnodetree != nullptr); - switch (m_bnodetree->execution_mode) { + BLI_assert(bnodetree_ != nullptr); + switch (bnodetree_->execution_mode) { case 1: return eExecutionModel::FullFrame; case 0: diff --git a/source/blender/compositor/intern/COM_CompositorContext.h b/source/blender/compositor/intern/COM_CompositorContext.h index 835d565fc91..9354551d66a 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.h +++ b/source/blender/compositor/intern/COM_CompositorContext.h @@ -38,55 +38,55 @@ class CompositorContext { * editor) This field is initialized in ExecutionSystem and must only be read from that point * on. \see ExecutionSystem */ - bool m_rendering; + bool rendering_; /** * \brief The quality of the composite. * This field is initialized in ExecutionSystem and must only be read from that point on. * \see ExecutionSystem */ - eCompositorQuality m_quality; + eCompositorQuality quality_; - Scene *m_scene; + Scene *scene_; /** * \brief Reference to the render data that is being composited. * This field is initialized in ExecutionSystem and must only be read from that point on. * \see ExecutionSystem */ - RenderData *m_rd; + RenderData *rd_; /** * \brief reference to the bNodeTree * This field is initialized in ExecutionSystem and must only be read from that point on. * \see ExecutionSystem */ - bNodeTree *m_bnodetree; + bNodeTree *bnodetree_; /** * \brief Preview image hash table * This field is initialized in ExecutionSystem and must only be read from that point on. */ - bNodeInstanceHash *m_previews; + bNodeInstanceHash *previews_; /** * \brief does this system have active opencl devices? */ - bool m_hasActiveOpenCLDevices; + bool hasActiveOpenCLDevices_; /** * \brief Skip slow nodes */ - bool m_fastCalculation; + bool fastCalculation_; /* \brief color management settings */ - const ColorManagedViewSettings *m_viewSettings; - const ColorManagedDisplaySettings *m_displaySettings; + const ColorManagedViewSettings *viewSettings_; + const ColorManagedDisplaySettings *displaySettings_; /** * \brief active rendering view name */ - const char *m_viewName; + const char *viewName_; public: /** @@ -99,7 +99,7 @@ class CompositorContext { */ void setRendering(bool rendering) { - m_rendering = rendering; + rendering_ = rendering; } /** @@ -107,7 +107,7 @@ class CompositorContext { */ bool isRendering() const { - return m_rendering; + return rendering_; } /** @@ -115,7 +115,7 @@ class CompositorContext { */ void setRenderData(RenderData *rd) { - m_rd = rd; + rd_ = rd; } /** @@ -123,7 +123,7 @@ class CompositorContext { */ void setbNodeTree(bNodeTree *bnodetree) { - m_bnodetree = bnodetree; + bnodetree_ = bnodetree; } /** @@ -131,7 +131,7 @@ class CompositorContext { */ const bNodeTree *getbNodeTree() const { - return m_bnodetree; + return bnodetree_; } /** @@ -139,16 +139,16 @@ class CompositorContext { */ const RenderData *getRenderData() const { - return m_rd; + return rd_; } void setScene(Scene *scene) { - m_scene = scene; + scene_ = scene; } Scene *getScene() const { - return m_scene; + return scene_; } /** @@ -156,7 +156,7 @@ class CompositorContext { */ void setPreviewHash(bNodeInstanceHash *previews) { - m_previews = previews; + previews_ = previews; } /** @@ -164,7 +164,7 @@ class CompositorContext { */ bNodeInstanceHash *getPreviewHash() const { - return m_previews; + return previews_; } /** @@ -172,7 +172,7 @@ class CompositorContext { */ void setViewSettings(const ColorManagedViewSettings *viewSettings) { - m_viewSettings = viewSettings; + viewSettings_ = viewSettings; } /** @@ -180,7 +180,7 @@ class CompositorContext { */ const ColorManagedViewSettings *getViewSettings() const { - return m_viewSettings; + return viewSettings_; } /** @@ -188,7 +188,7 @@ class CompositorContext { */ void setDisplaySettings(const ColorManagedDisplaySettings *displaySettings) { - m_displaySettings = displaySettings; + displaySettings_ = displaySettings; } /** @@ -196,7 +196,7 @@ class CompositorContext { */ const ColorManagedDisplaySettings *getDisplaySettings() const { - return m_displaySettings; + return displaySettings_; } /** @@ -204,7 +204,7 @@ class CompositorContext { */ void setQuality(eCompositorQuality quality) { - m_quality = quality; + quality_ = quality; } /** @@ -212,7 +212,7 @@ class CompositorContext { */ eCompositorQuality getQuality() const { - return m_quality; + return quality_; } /** @@ -225,7 +225,7 @@ class CompositorContext { */ bool getHasActiveOpenCLDevices() const { - return m_hasActiveOpenCLDevices; + return hasActiveOpenCLDevices_; } /** @@ -233,13 +233,13 @@ class CompositorContext { */ void setHasActiveOpenCLDevices(bool hasAvtiveOpenCLDevices) { - m_hasActiveOpenCLDevices = hasAvtiveOpenCLDevices; + hasActiveOpenCLDevices_ = hasAvtiveOpenCLDevices; } /** Whether it has a view with a specific name and not the default one. */ bool has_explicit_view() const { - return m_viewName && m_viewName[0] != '\0'; + return viewName_ && viewName_[0] != '\0'; } /** @@ -247,7 +247,7 @@ class CompositorContext { */ const char *getViewName() const { - return m_viewName; + return viewName_; } /** @@ -255,7 +255,7 @@ class CompositorContext { */ void setViewName(const char *viewName) { - m_viewName = viewName; + viewName_ = viewName; } int getChunksize() const @@ -265,11 +265,11 @@ class CompositorContext { void setFastCalculation(bool fastCalculation) { - m_fastCalculation = fastCalculation; + fastCalculation_ = fastCalculation; } bool isFastCalculation() const { - return m_fastCalculation; + return fastCalculation_; } bool isGroupnodeBufferEnabled() const { @@ -282,7 +282,7 @@ class CompositorContext { */ float getRenderPercentageAsFactor() const { - return m_rd->size * 0.01f; + return rd_->size * 0.01f; } Size2f get_render_size() const; diff --git a/source/blender/compositor/intern/COM_Debug.cc b/source/blender/compositor/intern/COM_Debug.cc index d0c8311ef6e..023db368ac9 100644 --- a/source/blender/compositor/intern/COM_Debug.cc +++ b/source/blender/compositor/intern/COM_Debug.cc @@ -35,12 +35,12 @@ extern "C" { namespace blender::compositor { -int DebugInfo::m_file_index = 0; -DebugInfo::NodeNameMap DebugInfo::m_node_names; -DebugInfo::OpNameMap DebugInfo::m_op_names; -std::string DebugInfo::m_current_node_name; -std::string DebugInfo::m_current_op_name; -DebugInfo::GroupStateMap DebugInfo::m_group_states; +int DebugInfo::file_index_ = 0; +DebugInfo::NodeNameMap DebugInfo::node_names_; +DebugInfo::OpNameMap DebugInfo::op_names_; +std::string DebugInfo::current_node_name_; +std::string DebugInfo::current_op_name_; +DebugInfo::GroupStateMap DebugInfo::group_states_; static std::string operation_class_name(const NodeOperation *op) { @@ -53,8 +53,8 @@ static std::string operation_class_name(const NodeOperation *op) std::string DebugInfo::node_name(const Node *node) { - NodeNameMap::const_iterator it = m_node_names.find(node); - if (it != m_node_names.end()) { + NodeNameMap::const_iterator it = node_names_.find(node); + if (it != node_names_.end()) { return it->second; } return ""; @@ -62,8 +62,8 @@ std::string DebugInfo::node_name(const Node *node) std::string DebugInfo::operation_name(const NodeOperation *op) { - OpNameMap::const_iterator it = m_op_names.find(op); - if (it != m_op_names.end()) { + OpNameMap::const_iterator it = op_names_.find(op); + if (it != op_names_.end()) { return it->second; } return ""; @@ -300,25 +300,25 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma std::map<NodeOperation *, std::vector<std::string>> op_groups; int index = 0; - for (const ExecutionGroup *group : system->m_groups) { + for (const ExecutionGroup *group : system->groups_) { len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "// GROUP: %d\r\n", index); len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "subgraph cluster_%d{\r\n", index); /* used as a check for executing group */ - if (m_group_states[group] == EG_WAIT) { + if (group_states_[group] == EG_WAIT) { len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "style=dashed\r\n"); } - else if (m_group_states[group] == EG_RUNNING) { + else if (group_states_[group] == EG_RUNNING) { len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "style=filled\r\n"); len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "color=black\r\n"); len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "fillcolor=firebrick1\r\n"); } - else if (m_group_states[group] == EG_FINISHED) { + else if (group_states_[group] == EG_FINISHED) { len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "style=filled\r\n"); len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "color=black\r\n"); len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "fillcolor=chartreuse4\r\n"); } - for (NodeOperation *operation : group->m_operations) { + for (NodeOperation *operation : group->operations_) { sprintf(strbuf, "_%p", group); op_groups[operation].push_back(std::string(strbuf)); @@ -332,7 +332,7 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma } /* operations not included in any group */ - for (NodeOperation *operation : system->m_operations) { + for (NodeOperation *operation : system->operations_) { if (op_groups.find(operation) != op_groups.end()) { continue; } @@ -343,7 +343,7 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma system, operation, nullptr, str + len, maxlen > len ? maxlen - len : 0); } - for (NodeOperation *operation : system->m_operations) { + for (NodeOperation *operation : system->operations_) { if (operation->get_flags().is_read_buffer_operation) { ReadBufferOperation *read = (ReadBufferOperation *)operation; WriteBufferOperation *write = read->getMemoryProxy()->getWriteBufferOperation(); @@ -364,8 +364,8 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma } } - for (NodeOperation *op : system->m_operations) { - for (NodeOperationInput &to : op->m_inputs) { + for (NodeOperation *op : system->operations_) { + for (NodeOperationInput &to : op->inputs_) { NodeOperationOutput *from = to.getLink(); if (!from) { @@ -418,7 +418,7 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma const bool has_execution_groups = system->getContext().get_execution_model() == eExecutionModel::Tiled && - system->m_groups.size() > 0; + system->groups_.size() > 0; len += graphviz_legend(str + len, maxlen > len ? maxlen - len : 0, has_execution_groups); len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "}\r\n"); @@ -437,13 +437,13 @@ void DebugInfo::graphviz(const ExecutionSystem *system, StringRefNull name) char filename[FILE_MAX]; if (name.is_empty()) { - BLI_snprintf(basename, sizeof(basename), "compositor_%d.dot", m_file_index); + BLI_snprintf(basename, sizeof(basename), "compositor_%d.dot", file_index_); } else { BLI_strncpy(basename, (name + ".dot").c_str(), sizeof(basename)); } BLI_join_dirfile(filename, sizeof(filename), BKE_tempdir_session(), basename); - m_file_index++; + file_index_++; std::cout << "Writing compositor debug to: " << filename << "\n"; diff --git a/source/blender/compositor/intern/COM_Debug.h b/source/blender/compositor/intern/COM_Debug.h index 689cd4029f1..f1edd3ea15f 100644 --- a/source/blender/compositor/intern/COM_Debug.h +++ b/source/blender/compositor/intern/COM_Debug.h @@ -52,33 +52,33 @@ class DebugInfo { static std::string operation_name(const NodeOperation *op); private: - static int m_file_index; + static int file_index_; /** Map nodes to usable names for debug output. */ - static NodeNameMap m_node_names; + static NodeNameMap node_names_; /** Map operations to usable names for debug output. */ - static OpNameMap m_op_names; + static OpNameMap op_names_; /** Base name for all operations added by a node. */ - static std::string m_current_node_name; + static std::string current_node_name_; /** Base name for automatic sub-operations. */ - static std::string m_current_op_name; + static std::string current_op_name_; /** For visualizing group states. */ - static GroupStateMap m_group_states; + static GroupStateMap group_states_; public: static void convert_started() { if (COM_EXPORT_GRAPHVIZ) { - m_op_names.clear(); + op_names_.clear(); } } static void execute_started(const ExecutionSystem *system) { if (COM_EXPORT_GRAPHVIZ) { - m_file_index = 1; - m_group_states.clear(); - for (ExecutionGroup *execution_group : system->m_groups) { - m_group_states[execution_group] = EG_WAIT; + file_index_ = 1; + group_states_.clear(); + for (ExecutionGroup *execution_group : system->groups_) { + group_states_[execution_group] = EG_WAIT; } } if (COM_EXPORT_OPERATION_BUFFERS) { @@ -89,41 +89,41 @@ class DebugInfo { static void node_added(const Node *node) { if (COM_EXPORT_GRAPHVIZ) { - m_node_names[node] = std::string(node->getbNode() ? node->getbNode()->name : ""); + node_names_[node] = std::string(node->getbNode() ? node->getbNode()->name : ""); } } static void node_to_operations(const Node *node) { if (COM_EXPORT_GRAPHVIZ) { - m_current_node_name = m_node_names[node]; + current_node_name_ = node_names_[node]; } } static void operation_added(const NodeOperation *operation) { if (COM_EXPORT_GRAPHVIZ) { - m_op_names[operation] = m_current_node_name; + op_names_[operation] = current_node_name_; } }; static void operation_read_write_buffer(const NodeOperation *operation) { if (COM_EXPORT_GRAPHVIZ) { - m_current_op_name = m_op_names[operation]; + current_op_name_ = op_names_[operation]; } }; static void execution_group_started(const ExecutionGroup *group) { if (COM_EXPORT_GRAPHVIZ) { - m_group_states[group] = EG_RUNNING; + group_states_[group] = EG_RUNNING; } }; static void execution_group_finished(const ExecutionGroup *group) { if (COM_EXPORT_GRAPHVIZ) { - m_group_states[group] = EG_FINISHED; + group_states_[group] = EG_FINISHED; } }; diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cc b/source/blender/compositor/intern/COM_ExecutionGroup.cc index 8841f44ea48..a38a1cd0a6c 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.cc +++ b/source/blender/compositor/intern/COM_ExecutionGroup.cc @@ -55,17 +55,17 @@ std::ostream &operator<<(std::ostream &os, const ExecutionGroupFlags &flags) ExecutionGroup::ExecutionGroup(int id) { - m_id = id; - m_bTree = nullptr; - m_height = 0; - m_width = 0; - m_max_read_buffer_offset = 0; - m_x_chunks_len = 0; - m_y_chunks_len = 0; - m_chunks_len = 0; - m_chunks_finished = 0; - BLI_rcti_init(&m_viewerBorder, 0, 0, 0, 0); - m_executionStartTime = 0; + id_ = id; + bTree_ = nullptr; + height_ = 0; + width_ = 0; + max_read_buffer_offset_ = 0; + x_chunks_len_ = 0; + y_chunks_len_ = 0; + chunks_len_ = 0; + chunks_finished_ = 0; + BLI_rcti_init(&viewerBorder_, 0, 0, 0, 0); + executionStartTime_ = 0; } std::ostream &operator<<(std::ostream &os, const ExecutionGroup &execution_group) @@ -84,7 +84,7 @@ eCompositorPriority ExecutionGroup::getRenderPriority() bool ExecutionGroup::can_contain(NodeOperation &operation) { - if (!m_flags.initialized) { + if (!flags_.initialized) { return true; } @@ -99,7 +99,7 @@ bool ExecutionGroup::can_contain(NodeOperation &operation) } /* complex groups don't allow further ops (except read buffer and values, see above) */ - if (m_flags.complex) { + if (flags_.complex) { return false; } /* complex ops can't be added to other groups (except their own, which they initialize, see @@ -119,13 +119,13 @@ bool ExecutionGroup::addOperation(NodeOperation *operation) if (!operation->get_flags().is_read_buffer_operation && !operation->get_flags().is_write_buffer_operation) { - m_flags.complex = operation->get_flags().complex; - m_flags.open_cl = operation->get_flags().open_cl; - m_flags.single_threaded = operation->get_flags().single_threaded; - m_flags.initialized = true; + flags_.complex = operation->get_flags().complex; + flags_.open_cl = operation->get_flags().open_cl; + flags_.single_threaded = operation->get_flags().single_threaded; + flags_.initialized = true; } - m_operations.append(operation); + operations_.append(operation); return true; } @@ -133,20 +133,20 @@ bool ExecutionGroup::addOperation(NodeOperation *operation) NodeOperation *ExecutionGroup::getOutputOperation() const { return this - ->m_operations[0]; /* the first operation of the group is always the output operation. */ + ->operations_[0]; /* the first operation of the group is always the output operation. */ } void ExecutionGroup::init_work_packages() { - m_work_packages.clear(); - if (m_chunks_len != 0) { - m_work_packages.resize(m_chunks_len); - for (unsigned int index = 0; index < m_chunks_len; index++) { - m_work_packages[index].type = eWorkPackageType::Tile; - m_work_packages[index].state = eWorkPackageState::NotScheduled; - m_work_packages[index].execution_group = this; - m_work_packages[index].chunk_number = index; - determineChunkRect(&m_work_packages[index].rect, index); + work_packages_.clear(); + if (chunks_len_ != 0) { + work_packages_.resize(chunks_len_); + for (unsigned int index = 0; index < chunks_len_; index++) { + work_packages_[index].type = eWorkPackageType::Tile; + work_packages_[index].state = eWorkPackageState::NotScheduled; + work_packages_[index].execution_group = this; + work_packages_[index].chunk_number = index; + determineChunkRect(&work_packages_[index].rect, index); } } } @@ -154,15 +154,15 @@ void ExecutionGroup::init_work_packages() void ExecutionGroup::init_read_buffer_operations() { unsigned int max_offset = 0; - for (NodeOperation *operation : m_operations) { + for (NodeOperation *operation : operations_) { if (operation->get_flags().is_read_buffer_operation) { ReadBufferOperation *readOperation = static_cast<ReadBufferOperation *>(operation); - m_read_operations.append(readOperation); + read_operations_.append(readOperation); max_offset = MAX2(max_offset, readOperation->getOffset()); } } max_offset++; - m_max_read_buffer_offset = max_offset; + max_read_buffer_offset_ = max_offset; } void ExecutionGroup::initExecution() @@ -174,12 +174,12 @@ void ExecutionGroup::initExecution() void ExecutionGroup::deinitExecution() { - m_work_packages.clear(); - m_chunks_len = 0; - m_x_chunks_len = 0; - m_y_chunks_len = 0; - m_read_operations.clear(); - m_bTree = nullptr; + work_packages_.clear(); + chunks_len_ = 0; + x_chunks_len_ = 0; + y_chunks_len_ = 0; + read_operations_.clear(); + bTree_ = nullptr; } void ExecutionGroup::determineResolution(unsigned int resolution[2]) @@ -188,30 +188,30 @@ void ExecutionGroup::determineResolution(unsigned int resolution[2]) resolution[0] = operation->getWidth(); resolution[1] = operation->getHeight(); this->setResolution(resolution); - BLI_rcti_init(&m_viewerBorder, 0, m_width, 0, m_height); + BLI_rcti_init(&viewerBorder_, 0, width_, 0, height_); } void ExecutionGroup::init_number_of_chunks() { - if (m_flags.single_threaded) { - m_x_chunks_len = 1; - m_y_chunks_len = 1; - m_chunks_len = 1; + if (flags_.single_threaded) { + x_chunks_len_ = 1; + y_chunks_len_ = 1; + chunks_len_ = 1; } else { - const float chunkSizef = m_chunkSize; - const int border_width = BLI_rcti_size_x(&m_viewerBorder); - const int border_height = BLI_rcti_size_y(&m_viewerBorder); - m_x_chunks_len = ceil(border_width / chunkSizef); - m_y_chunks_len = ceil(border_height / chunkSizef); - m_chunks_len = m_x_chunks_len * m_y_chunks_len; + const float chunkSizef = chunkSize_; + const int border_width = BLI_rcti_size_x(&viewerBorder_); + const int border_height = BLI_rcti_size_y(&viewerBorder_); + x_chunks_len_ = ceil(border_width / chunkSizef); + y_chunks_len_ = ceil(border_height / chunkSizef); + chunks_len_ = x_chunks_len_ * y_chunks_len_; } } blender::Array<unsigned int> ExecutionGroup::get_execution_order() const { - blender::Array<unsigned int> chunk_order(m_chunks_len); - for (int chunk_index = 0; chunk_index < m_chunks_len; chunk_index++) { + blender::Array<unsigned int> chunk_order(chunks_len_); + for (int chunk_index = 0; chunk_index < chunks_len_; chunk_index++) { chunk_order[chunk_index] = chunk_index; } @@ -227,8 +227,8 @@ blender::Array<unsigned int> ExecutionGroup::get_execution_order() const order_type = viewer->getChunkOrder(); } - const int border_width = BLI_rcti_size_x(&m_viewerBorder); - const int border_height = BLI_rcti_size_y(&m_viewerBorder); + const int border_width = BLI_rcti_size_x(&viewerBorder_); + const int border_height = BLI_rcti_size_y(&viewerBorder_); int index; switch (order_type) { case ChunkOrdering::Random: { @@ -241,17 +241,17 @@ blender::Array<unsigned int> ExecutionGroup::get_execution_order() const } case ChunkOrdering::CenterOut: { ChunkOrderHotspot hotspot(border_width * centerX, border_height * centerY, 0.0f); - blender::Array<ChunkOrder> chunk_orders(m_chunks_len); - for (index = 0; index < m_chunks_len; index++) { - const WorkPackage &work_package = m_work_packages[index]; + blender::Array<ChunkOrder> chunk_orders(chunks_len_); + for (index = 0; index < chunks_len_; index++) { + const WorkPackage &work_package = work_packages_[index]; chunk_orders[index].index = index; - chunk_orders[index].x = work_package.rect.xmin - m_viewerBorder.xmin; - chunk_orders[index].y = work_package.rect.ymin - m_viewerBorder.ymin; + chunk_orders[index].x = work_package.rect.xmin - viewerBorder_.xmin; + chunk_orders[index].y = work_package.rect.ymin - viewerBorder_.ymin; chunk_orders[index].update_distance(&hotspot, 1); } - std::sort(&chunk_orders[0], &chunk_orders[m_chunks_len - 1]); - for (index = 0; index < m_chunks_len; index++) { + std::sort(&chunk_orders[0], &chunk_orders[chunks_len_ - 1]); + for (index = 0; index < chunks_len_; index++) { chunk_order[index] = chunk_orders[index].index; } @@ -264,7 +264,7 @@ blender::Array<unsigned int> ExecutionGroup::get_execution_order() const unsigned int my = border_height / 2; unsigned int bx = mx + 2 * tx; unsigned int by = my + 2 * ty; - float addition = m_chunks_len / COM_RULE_OF_THIRDS_DIVIDER; + float addition = chunks_len_ / COM_RULE_OF_THIRDS_DIVIDER; ChunkOrderHotspot hotspots[9]{ ChunkOrderHotspot(mx, my, addition * 0), @@ -278,18 +278,18 @@ blender::Array<unsigned int> ExecutionGroup::get_execution_order() const ChunkOrderHotspot(mx, by, addition * 8), }; - blender::Array<ChunkOrder> chunk_orders(m_chunks_len); - for (index = 0; index < m_chunks_len; index++) { - const WorkPackage &work_package = m_work_packages[index]; + blender::Array<ChunkOrder> chunk_orders(chunks_len_); + for (index = 0; index < chunks_len_; index++) { + const WorkPackage &work_package = work_packages_[index]; chunk_orders[index].index = index; - chunk_orders[index].x = work_package.rect.xmin - m_viewerBorder.xmin; - chunk_orders[index].y = work_package.rect.ymin - m_viewerBorder.ymin; + chunk_orders[index].x = work_package.rect.xmin - viewerBorder_.xmin; + chunk_orders[index].y = work_package.rect.ymin - viewerBorder_.ymin; chunk_orders[index].update_distance(hotspots, 9); } - std::sort(&chunk_orders[0], &chunk_orders[m_chunks_len]); + std::sort(&chunk_orders[0], &chunk_orders[chunks_len_]); - for (index = 0; index < m_chunks_len; index++) { + for (index = 0; index < chunks_len_; index++) { chunk_order[index] = chunk_orders[index].index; } @@ -310,21 +310,21 @@ void ExecutionGroup::execute(ExecutionSystem *graph) { const CompositorContext &context = graph->getContext(); const bNodeTree *bTree = context.getbNodeTree(); - if (m_width == 0 || m_height == 0) { + if (width_ == 0 || height_ == 0) { return; } /** \note Break out... no pixels to calculate. */ if (bTree->test_break && bTree->test_break(bTree->tbh)) { return; } /** \note Early break out for blur and preview nodes. */ - if (m_chunks_len == 0) { + if (chunks_len_ == 0) { return; } /** \note Early break out. */ unsigned int chunk_index; - m_executionStartTime = PIL_check_seconds_timer(); + executionStartTime_ = PIL_check_seconds_timer(); - m_chunks_finished = 0; - m_bTree = bTree; + chunks_finished_ = 0; + bTree_ = bTree; blender::Array<unsigned int> chunk_order = get_execution_order(); @@ -341,12 +341,12 @@ void ExecutionGroup::execute(ExecutionSystem *graph) finished = true; int numberEvaluated = 0; - for (int index = startIndex; index < m_chunks_len && numberEvaluated < maxNumberEvaluated; + for (int index = startIndex; index < chunks_len_ && numberEvaluated < maxNumberEvaluated; index++) { chunk_index = chunk_order[index]; - int yChunk = chunk_index / m_x_chunks_len; - int xChunk = chunk_index - (yChunk * m_x_chunks_len); - const WorkPackage &work_package = m_work_packages[chunk_index]; + int yChunk = chunk_index / x_chunks_len_; + int xChunk = chunk_index - (yChunk * x_chunks_len_); + const WorkPackage &work_package = work_packages_[chunk_index]; switch (work_package.state) { case eWorkPackageState::NotScheduled: { scheduleChunkWhenPossible(graph, xChunk, yChunk); @@ -385,12 +385,12 @@ void ExecutionGroup::execute(ExecutionSystem *graph) MemoryBuffer **ExecutionGroup::getInputBuffersOpenCL(int chunkNumber) { - WorkPackage &work_package = m_work_packages[chunkNumber]; + WorkPackage &work_package = work_packages_[chunkNumber]; MemoryBuffer **memoryBuffers = (MemoryBuffer **)MEM_callocN( - sizeof(MemoryBuffer *) * m_max_read_buffer_offset, __func__); + sizeof(MemoryBuffer *) * max_read_buffer_offset_, __func__); rcti output; - for (ReadBufferOperation *readOperation : m_read_operations) { + for (ReadBufferOperation *readOperation : read_operations_) { MemoryProxy *memoryProxy = readOperation->getMemoryProxy(); this->determineDependingAreaOfInterest(&work_package.rect, readOperation, &output); MemoryBuffer *memoryBuffer = memoryProxy->getExecutor()->constructConsolidatedMemoryBuffer( @@ -411,14 +411,14 @@ MemoryBuffer *ExecutionGroup::constructConsolidatedMemoryBuffer(MemoryProxy &mem void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memoryBuffers) { - WorkPackage &work_package = m_work_packages[chunkNumber]; + WorkPackage &work_package = work_packages_[chunkNumber]; if (work_package.state == eWorkPackageState::Scheduled) { work_package.state = eWorkPackageState::Executed; } - atomic_add_and_fetch_u(&m_chunks_finished, 1); + atomic_add_and_fetch_u(&chunks_finished_, 1); if (memoryBuffers) { - for (unsigned int index = 0; index < m_max_read_buffer_offset; index++) { + for (unsigned int index = 0; index < max_read_buffer_offset_; index++) { MemoryBuffer *buffer = memoryBuffers[index]; if (buffer) { if (buffer->isTemporarily()) { @@ -429,16 +429,16 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memo } MEM_freeN(memoryBuffers); } - if (m_bTree) { + if (bTree_) { /* Status report is only performed for top level Execution Groups. */ - float progress = m_chunks_finished; - progress /= m_chunks_len; - m_bTree->progress(m_bTree->prh, progress); + float progress = chunks_finished_; + progress /= chunks_len_; + bTree_->progress(bTree_->prh, progress); char buf[128]; BLI_snprintf( - buf, sizeof(buf), TIP_("Compositing | Tile %u-%u"), m_chunks_finished, m_chunks_len); - m_bTree->stats_draw(m_bTree->sdh, buf); + buf, sizeof(buf), TIP_("Compositing | Tile %u-%u"), chunks_finished_, chunks_len_); + bTree_->stats_draw(bTree_->sdh, buf); } } @@ -446,29 +446,29 @@ inline void ExecutionGroup::determineChunkRect(rcti *r_rect, const unsigned int xChunk, const unsigned int yChunk) const { - const int border_width = BLI_rcti_size_x(&m_viewerBorder); - const int border_height = BLI_rcti_size_y(&m_viewerBorder); + const int border_width = BLI_rcti_size_x(&viewerBorder_); + const int border_height = BLI_rcti_size_y(&viewerBorder_); - if (m_flags.single_threaded) { - BLI_rcti_init(r_rect, m_viewerBorder.xmin, border_width, m_viewerBorder.ymin, border_height); + if (flags_.single_threaded) { + BLI_rcti_init(r_rect, viewerBorder_.xmin, border_width, viewerBorder_.ymin, border_height); } else { - const unsigned int minx = xChunk * m_chunkSize + m_viewerBorder.xmin; - const unsigned int miny = yChunk * m_chunkSize + m_viewerBorder.ymin; - const unsigned int width = MIN2((unsigned int)m_viewerBorder.xmax, m_width); - const unsigned int height = MIN2((unsigned int)m_viewerBorder.ymax, m_height); + const unsigned int minx = xChunk * chunkSize_ + viewerBorder_.xmin; + const unsigned int miny = yChunk * chunkSize_ + viewerBorder_.ymin; + const unsigned int width = MIN2((unsigned int)viewerBorder_.xmax, width_); + const unsigned int height = MIN2((unsigned int)viewerBorder_.ymax, height_); BLI_rcti_init(r_rect, - MIN2(minx, m_width), - MIN2(minx + m_chunkSize, width), - MIN2(miny, m_height), - MIN2(miny + m_chunkSize, height)); + MIN2(minx, width_), + MIN2(minx + chunkSize_, width), + MIN2(miny, height_), + MIN2(miny + chunkSize_, height)); } } void ExecutionGroup::determineChunkRect(rcti *r_rect, const unsigned int chunkNumber) const { - const unsigned int yChunk = chunkNumber / m_x_chunks_len; - const unsigned int xChunk = chunkNumber - (yChunk * m_x_chunks_len); + const unsigned int yChunk = chunkNumber / x_chunks_len_; + const unsigned int xChunk = chunkNumber - (yChunk * x_chunks_len_); determineChunkRect(r_rect, xChunk, yChunk); } @@ -487,7 +487,7 @@ MemoryBuffer *ExecutionGroup::allocateOutputBuffer(rcti &rect) bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area) { - if (m_flags.single_threaded) { + if (flags_.single_threaded) { return scheduleChunkWhenPossible(graph, 0, 0); } /* Find all chunks inside the rect @@ -495,18 +495,18 @@ bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area * where x and y are chunk-numbers. */ int indexx, indexy; - int minx = max_ii(area->xmin - m_viewerBorder.xmin, 0); - int maxx = min_ii(area->xmax - m_viewerBorder.xmin, m_viewerBorder.xmax - m_viewerBorder.xmin); - int miny = max_ii(area->ymin - m_viewerBorder.ymin, 0); - int maxy = min_ii(area->ymax - m_viewerBorder.ymin, m_viewerBorder.ymax - m_viewerBorder.ymin); - int minxchunk = minx / (int)m_chunkSize; - int maxxchunk = (maxx + (int)m_chunkSize - 1) / (int)m_chunkSize; - int minychunk = miny / (int)m_chunkSize; - int maxychunk = (maxy + (int)m_chunkSize - 1) / (int)m_chunkSize; + int minx = max_ii(area->xmin - viewerBorder_.xmin, 0); + int maxx = min_ii(area->xmax - viewerBorder_.xmin, viewerBorder_.xmax - viewerBorder_.xmin); + int miny = max_ii(area->ymin - viewerBorder_.ymin, 0); + int maxy = min_ii(area->ymax - viewerBorder_.ymin, viewerBorder_.ymax - viewerBorder_.ymin); + int minxchunk = minx / (int)chunkSize_; + int maxxchunk = (maxx + (int)chunkSize_ - 1) / (int)chunkSize_; + int minychunk = miny / (int)chunkSize_; + int maxychunk = (maxy + (int)chunkSize_ - 1) / (int)chunkSize_; minxchunk = max_ii(minxchunk, 0); minychunk = max_ii(minychunk, 0); - maxxchunk = min_ii(maxxchunk, (int)m_x_chunks_len); - maxychunk = min_ii(maxychunk, (int)m_y_chunks_len); + maxxchunk = min_ii(maxxchunk, (int)x_chunks_len_); + maxychunk = min_ii(maxychunk, (int)y_chunks_len_); bool result = true; for (indexx = minxchunk; indexx < maxxchunk; indexx++) { @@ -522,7 +522,7 @@ bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area bool ExecutionGroup::scheduleChunk(unsigned int chunkNumber) { - WorkPackage &work_package = m_work_packages[chunkNumber]; + WorkPackage &work_package = work_packages_[chunkNumber]; if (work_package.state == eWorkPackageState::NotScheduled) { work_package.state = eWorkPackageState::Scheduled; WorkScheduler::schedule(&work_package); @@ -535,16 +535,16 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph, const int chunk_x, const int chunk_y) { - if (chunk_x < 0 || chunk_x >= (int)m_x_chunks_len) { + if (chunk_x < 0 || chunk_x >= (int)x_chunks_len_) { return true; } - if (chunk_y < 0 || chunk_y >= (int)m_y_chunks_len) { + if (chunk_y < 0 || chunk_y >= (int)y_chunks_len_) { return true; } /* Check if chunk is already executed or scheduled and not yet executed. */ - const int chunk_index = chunk_y * m_x_chunks_len + chunk_x; - WorkPackage &work_package = m_work_packages[chunk_index]; + const int chunk_index = chunk_y * x_chunks_len_ + chunk_x; + WorkPackage &work_package = work_packages_[chunk_index]; if (work_package.state == eWorkPackageState::Executed) { return true; } @@ -555,7 +555,7 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph, bool can_be_executed = true; rcti area; - for (ReadBufferOperation *read_operation : m_read_operations) { + for (ReadBufferOperation *read_operation : read_operations_) { BLI_rcti_init(&area, 0, 0, 0, 0); MemoryProxy *memory_proxy = read_operation->getMemoryProxy(); determineDependingAreaOfInterest(&work_package.rect, read_operation, &area); @@ -584,8 +584,7 @@ void ExecutionGroup::setViewerBorder(float xmin, float xmax, float ymin, float y { const NodeOperation &operation = *this->getOutputOperation(); if (operation.get_flags().use_viewer_border) { - BLI_rcti_init( - &m_viewerBorder, xmin * m_width, xmax * m_width, ymin * m_height, ymax * m_height); + BLI_rcti_init(&viewerBorder_, xmin * width_, xmax * width_, ymin * height_, ymax * height_); } } @@ -593,8 +592,7 @@ void ExecutionGroup::setRenderBorder(float xmin, float xmax, float ymin, float y { const NodeOperation &operation = *this->getOutputOperation(); if (operation.isOutputOperation(true) && operation.get_flags().use_render_border) { - BLI_rcti_init( - &m_viewerBorder, xmin * m_width, xmax * m_width, ymin * m_height, ymax * m_height); + BLI_rcti_init(&viewerBorder_, xmin * width_, xmax * width_, ymin * height_, ymax * height_); } } diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.h b/source/blender/compositor/intern/COM_ExecutionGroup.h index 2799bef80d4..c0737b2bc02 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.h +++ b/source/blender/compositor/intern/COM_ExecutionGroup.h @@ -86,84 +86,84 @@ class ExecutionGroup { /** * Id of the execution group. For debugging purposes. */ - int m_id; + int id_; /** * \brief list of operations in this ExecutionGroup */ - Vector<NodeOperation *> m_operations; + Vector<NodeOperation *> operations_; - ExecutionGroupFlags m_flags; + ExecutionGroupFlags flags_; /** * \brief Width of the output */ - unsigned int m_width; + unsigned int width_; /** * \brief Height of the output */ - unsigned int m_height; + unsigned int height_; /** * \brief size of a single chunk, being Width or of height * a chunk is always a square, except at the edges of the MemoryBuffer */ - unsigned int m_chunkSize; + unsigned int chunkSize_; /** * \brief number of chunks in the x-axis */ - unsigned int m_x_chunks_len; + unsigned int x_chunks_len_; /** * \brief number of chunks in the y-axis */ - unsigned int m_y_chunks_len; + unsigned int y_chunks_len_; /** * \brief total number of chunks */ - unsigned int m_chunks_len; + unsigned int chunks_len_; /** * \brief what is the maximum number field of all ReadBufferOperation in this ExecutionGroup. * \note this is used to construct the MemoryBuffers that will be passed during execution. */ - unsigned int m_max_read_buffer_offset; + unsigned int max_read_buffer_offset_; /** * \brief All read operations of this execution group. */ - Vector<ReadBufferOperation *> m_read_operations; + Vector<ReadBufferOperation *> read_operations_; /** * \brief reference to the original bNodeTree, * this field is only set for the 'top' execution group. * \note can only be used to call the callbacks for progress, status and break. */ - const bNodeTree *m_bTree; + const bNodeTree *bTree_; /** * \brief total number of chunks that have been calculated for this ExecutionGroup */ - unsigned int m_chunks_finished; + unsigned int chunks_finished_; /** - * \brief m_work_packages holds all unit of work. + * \brief work_packages_ holds all unit of work. */ - Vector<WorkPackage> m_work_packages; + Vector<WorkPackage> work_packages_; /** * \brief denotes boundary for border compositing * \note measured in pixel space */ - rcti m_viewerBorder; + rcti viewerBorder_; /** * \brief start time of execution */ - double m_executionStartTime; + double executionStartTime_; // methods /** @@ -241,12 +241,12 @@ class ExecutionGroup { int get_id() const { - return m_id; + return id_; } const ExecutionGroupFlags get_flags() const { - return m_flags; + return flags_; } // methods @@ -266,7 +266,7 @@ class ExecutionGroup { */ void setOutputExecutionGroup(bool is_output) { - m_flags.is_output = is_output; + flags_.is_output = is_output; } /** @@ -281,8 +281,8 @@ class ExecutionGroup { */ void setResolution(unsigned int resolution[2]) { - m_width = resolution[0]; - m_height = resolution[1]; + width_ = resolution[0]; + height_ = resolution[1]; } /** @@ -290,7 +290,7 @@ class ExecutionGroup { */ unsigned int getWidth() const { - return m_width; + return width_; } /** @@ -298,7 +298,7 @@ class ExecutionGroup { */ unsigned int getHeight() const { - return m_height; + return height_; } /** @@ -381,7 +381,7 @@ class ExecutionGroup { void setChunksize(int chunksize) { - m_chunkSize = chunksize; + chunkSize_ = chunksize; } /** diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cc b/source/blender/compositor/intern/COM_ExecutionSystem.cc index 510331f3294..880383853d6 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.cc +++ b/source/blender/compositor/intern/COM_ExecutionSystem.cc @@ -43,40 +43,40 @@ ExecutionSystem::ExecutionSystem(RenderData *rd, const char *viewName) { num_work_threads_ = WorkScheduler::get_num_cpu_threads(); - m_context.setViewName(viewName); - m_context.setScene(scene); - m_context.setbNodeTree(editingtree); - m_context.setPreviewHash(editingtree->previews); - m_context.setFastCalculation(fastcalculation); + context_.setViewName(viewName); + context_.setScene(scene); + context_.setbNodeTree(editingtree); + context_.setPreviewHash(editingtree->previews); + context_.setFastCalculation(fastcalculation); /* initialize the CompositorContext */ if (rendering) { - m_context.setQuality((eCompositorQuality)editingtree->render_quality); + context_.setQuality((eCompositorQuality)editingtree->render_quality); } else { - m_context.setQuality((eCompositorQuality)editingtree->edit_quality); + context_.setQuality((eCompositorQuality)editingtree->edit_quality); } - m_context.setRendering(rendering); - m_context.setHasActiveOpenCLDevices(WorkScheduler::has_gpu_devices() && - (editingtree->flag & NTREE_COM_OPENCL)); + context_.setRendering(rendering); + context_.setHasActiveOpenCLDevices(WorkScheduler::has_gpu_devices() && + (editingtree->flag & NTREE_COM_OPENCL)); - m_context.setRenderData(rd); - m_context.setViewSettings(viewSettings); - m_context.setDisplaySettings(displaySettings); + context_.setRenderData(rd); + context_.setViewSettings(viewSettings); + context_.setDisplaySettings(displaySettings); BLI_mutex_init(&work_mutex_); BLI_condition_init(&work_finished_cond_); { - NodeOperationBuilder builder(&m_context, editingtree, this); + NodeOperationBuilder builder(&context_, editingtree, this); builder.convertToOperations(this); } - switch (m_context.get_execution_model()) { + switch (context_.get_execution_model()) { case eExecutionModel::Tiled: - execution_model_ = new TiledExecutionModel(m_context, m_operations, m_groups); + execution_model_ = new TiledExecutionModel(context_, operations_, groups_); break; case eExecutionModel::FullFrame: - execution_model_ = new FullFrameExecutionModel(m_context, active_buffers_, m_operations); + execution_model_ = new FullFrameExecutionModel(context_, active_buffers_, operations_); break; default: BLI_assert_msg(0, "Non implemented execution model"); @@ -91,28 +91,28 @@ ExecutionSystem::~ExecutionSystem() delete execution_model_; - for (NodeOperation *operation : m_operations) { + for (NodeOperation *operation : operations_) { delete operation; } - m_operations.clear(); + operations_.clear(); - for (ExecutionGroup *group : m_groups) { + for (ExecutionGroup *group : groups_) { delete group; } - m_groups.clear(); + groups_.clear(); } void ExecutionSystem::set_operations(const Vector<NodeOperation *> &operations, const Vector<ExecutionGroup *> &groups) { - m_operations = operations; - m_groups = groups; + operations_ = operations; + groups_ = groups; } void ExecutionSystem::execute() { DebugInfo::execute_started(this); - for (NodeOperation *op : m_operations) { + for (NodeOperation *op : operations_) { op->init_data(); } execution_model_->execute(*this); @@ -184,7 +184,7 @@ void ExecutionSystem::execute_work(const rcti &work_rect, bool ExecutionSystem::is_breaked() const { - const bNodeTree *btree = m_context.getbNodeTree(); + const bNodeTree *btree = context_.getbNodeTree(); return btree->test_break(btree->tbh); } diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.h b/source/blender/compositor/intern/COM_ExecutionSystem.h index 303111b8b42..4a6a0f1bad8 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.h +++ b/source/blender/compositor/intern/COM_ExecutionSystem.h @@ -137,17 +137,17 @@ class ExecutionSystem { /** * \brief the context used during execution */ - CompositorContext m_context; + CompositorContext context_; /** * \brief vector of operations */ - Vector<NodeOperation *> m_operations; + Vector<NodeOperation *> operations_; /** * \brief vector of groups */ - Vector<ExecutionGroup *> m_groups; + Vector<ExecutionGroup *> groups_; /** * Active execution model implementation. @@ -200,7 +200,7 @@ class ExecutionSystem { */ const CompositorContext &getContext() const { - return m_context; + return context_; } SharedOperationBuffers &get_active_buffers() diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cc b/source/blender/compositor/intern/COM_MemoryBuffer.cc index 6851c3b5c5c..3aefe8a3e2f 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.cc +++ b/source/blender/compositor/intern/COM_MemoryBuffer.cc @@ -46,30 +46,30 @@ static rcti create_rect(const int width, const int height) MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, const rcti &rect, MemoryBufferState state) { - m_rect = rect; - m_is_a_single_elem = false; - m_memoryProxy = memoryProxy; - m_num_channels = COM_data_type_num_channels(memoryProxy->getDataType()); - m_buffer = (float *)MEM_mallocN_aligned( - sizeof(float) * buffer_len() * m_num_channels, 16, "COM_MemoryBuffer"); + rect_ = rect; + is_a_single_elem_ = false; + memoryProxy_ = memoryProxy; + num_channels_ = COM_data_type_num_channels(memoryProxy->getDataType()); + buffer_ = (float *)MEM_mallocN_aligned( + sizeof(float) * buffer_len() * num_channels_, 16, "COM_MemoryBuffer"); owns_data_ = true; - m_state = state; - m_datatype = memoryProxy->getDataType(); + state_ = state; + datatype_ = memoryProxy->getDataType(); set_strides(); } MemoryBuffer::MemoryBuffer(DataType dataType, const rcti &rect, bool is_a_single_elem) { - m_rect = rect; - m_is_a_single_elem = is_a_single_elem; - m_memoryProxy = nullptr; - m_num_channels = COM_data_type_num_channels(dataType); - m_buffer = (float *)MEM_mallocN_aligned( - sizeof(float) * buffer_len() * m_num_channels, 16, "COM_MemoryBuffer"); + rect_ = rect; + is_a_single_elem_ = is_a_single_elem; + memoryProxy_ = nullptr; + num_channels_ = COM_data_type_num_channels(dataType); + buffer_ = (float *)MEM_mallocN_aligned( + sizeof(float) * buffer_len() * num_channels_, 16, "COM_MemoryBuffer"); owns_data_ = true; - m_state = MemoryBufferState::Temporary; - m_datatype = dataType; + state_ = MemoryBufferState::Temporary; + datatype_ = dataType; set_strides(); } @@ -93,53 +93,52 @@ MemoryBuffer::MemoryBuffer(float *buffer, const rcti &rect, const bool is_a_single_elem) { - m_rect = rect; - m_is_a_single_elem = is_a_single_elem; - m_memoryProxy = nullptr; - m_num_channels = num_channels; - m_datatype = COM_num_channels_data_type(num_channels); - m_buffer = buffer; + rect_ = rect; + is_a_single_elem_ = is_a_single_elem; + memoryProxy_ = nullptr; + num_channels_ = num_channels; + datatype_ = COM_num_channels_data_type(num_channels); + buffer_ = buffer; owns_data_ = false; - m_state = MemoryBufferState::Temporary; + state_ = MemoryBufferState::Temporary; set_strides(); } -MemoryBuffer::MemoryBuffer(const MemoryBuffer &src) - : MemoryBuffer(src.m_datatype, src.m_rect, false) +MemoryBuffer::MemoryBuffer(const MemoryBuffer &src) : MemoryBuffer(src.datatype_, src.rect_, false) { - m_memoryProxy = src.m_memoryProxy; + memoryProxy_ = src.memoryProxy_; /* src may be single elem buffer */ fill_from(src); } void MemoryBuffer::set_strides() { - if (m_is_a_single_elem) { + if (is_a_single_elem_) { this->elem_stride = 0; this->row_stride = 0; } else { - this->elem_stride = m_num_channels; - this->row_stride = getWidth() * m_num_channels; + this->elem_stride = num_channels_; + this->row_stride = getWidth() * num_channels_; } - to_positive_x_stride_ = m_rect.xmin < 0 ? -m_rect.xmin + 1 : (m_rect.xmin == 0 ? 1 : 0); - to_positive_y_stride_ = m_rect.ymin < 0 ? -m_rect.ymin + 1 : (m_rect.ymin == 0 ? 1 : 0); + to_positive_x_stride_ = rect_.xmin < 0 ? -rect_.xmin + 1 : (rect_.xmin == 0 ? 1 : 0); + to_positive_y_stride_ = rect_.ymin < 0 ? -rect_.ymin + 1 : (rect_.ymin == 0 ? 1 : 0); } void MemoryBuffer::clear() { - memset(m_buffer, 0, buffer_len() * m_num_channels * sizeof(float)); + memset(buffer_, 0, buffer_len() * num_channels_ * sizeof(float)); } BuffersIterator<float> MemoryBuffer::iterate_with(Span<MemoryBuffer *> inputs) { - return iterate_with(inputs, m_rect); + return iterate_with(inputs, rect_); } BuffersIterator<float> MemoryBuffer::iterate_with(Span<MemoryBuffer *> inputs, const rcti &area) { - BuffersIteratorBuilder<float> builder(m_buffer, m_rect, area, elem_stride); + BuffersIteratorBuilder<float> builder(buffer_, rect_, area, elem_stride); for (MemoryBuffer *input : inputs) { builder.add_input(input->getBuffer(), input->get_rect(), input->elem_stride); } @@ -153,20 +152,20 @@ BuffersIterator<float> MemoryBuffer::iterate_with(Span<MemoryBuffer *> inputs, c MemoryBuffer *MemoryBuffer::inflate() const { BLI_assert(is_a_single_elem()); - MemoryBuffer *inflated = new MemoryBuffer(m_datatype, m_rect, false); - inflated->copy_from(this, m_rect); + MemoryBuffer *inflated = new MemoryBuffer(datatype_, rect_, false); + inflated->copy_from(this, rect_); return inflated; } float MemoryBuffer::get_max_value() const { - float result = m_buffer[0]; + float result = buffer_[0]; const unsigned int size = this->buffer_len(); unsigned int i; - const float *fp_src = m_buffer; + const float *fp_src = buffer_; - for (i = 0; i < size; i++, fp_src += m_num_channels) { + for (i = 0; i < size; i++, fp_src += num_channels_) { float value = *fp_src; if (value > result) { result = value; @@ -181,10 +180,10 @@ float MemoryBuffer::get_max_value(const rcti &rect) const rcti rect_clamp; /* first clamp the rect by the bounds or we get un-initialized values */ - BLI_rcti_isect(&rect, &m_rect, &rect_clamp); + BLI_rcti_isect(&rect, &rect_, &rect_clamp); if (!BLI_rcti_is_empty(&rect_clamp)) { - MemoryBuffer temp_buffer(m_datatype, rect_clamp); + MemoryBuffer temp_buffer(datatype_, rect_clamp); temp_buffer.fill_from(*this); return temp_buffer.get_max_value(); } @@ -195,9 +194,9 @@ float MemoryBuffer::get_max_value(const rcti &rect) const MemoryBuffer::~MemoryBuffer() { - if (m_buffer && owns_data_) { - MEM_freeN(m_buffer); - m_buffer = nullptr; + if (buffer_ && owns_data_) { + MEM_freeN(buffer_); + buffer_ = nullptr; } } @@ -398,28 +397,28 @@ void MemoryBuffer::fill(const rcti &area, void MemoryBuffer::fill_from(const MemoryBuffer &src) { rcti overlap; - overlap.xmin = MAX2(m_rect.xmin, src.m_rect.xmin); - overlap.xmax = MIN2(m_rect.xmax, src.m_rect.xmax); - overlap.ymin = MAX2(m_rect.ymin, src.m_rect.ymin); - overlap.ymax = MIN2(m_rect.ymax, src.m_rect.ymax); + overlap.xmin = MAX2(rect_.xmin, src.rect_.xmin); + overlap.xmax = MIN2(rect_.xmax, src.rect_.xmax); + overlap.ymin = MAX2(rect_.ymin, src.rect_.ymin); + overlap.ymax = MIN2(rect_.ymax, src.rect_.ymax); copy_from(&src, overlap); } void MemoryBuffer::writePixel(int x, int y, const float color[4]) { - if (x >= m_rect.xmin && x < m_rect.xmax && y >= m_rect.ymin && y < m_rect.ymax) { + if (x >= rect_.xmin && x < rect_.xmax && y >= rect_.ymin && y < rect_.ymax) { const int offset = get_coords_offset(x, y); - memcpy(&m_buffer[offset], color, sizeof(float) * m_num_channels); + memcpy(&buffer_[offset], color, sizeof(float) * num_channels_); } } void MemoryBuffer::addPixel(int x, int y, const float color[4]) { - if (x >= m_rect.xmin && x < m_rect.xmax && y >= m_rect.ymin && y < m_rect.ymax) { + if (x >= rect_.xmin && x < rect_.xmax && y >= rect_.ymin && y < rect_.ymax) { const int offset = get_coords_offset(x, y); - float *dst = &m_buffer[offset]; + float *dst = &buffer_[offset]; const float *src = color; - for (int i = 0; i < m_num_channels; i++, dst++, src++) { + for (int i = 0; i < num_channels_; i++, dst++, src++) { *dst += *src; } } @@ -434,7 +433,7 @@ static void read_ewa_elem(void *userdata, int x, int y, float result[4]) void MemoryBuffer::read_elem_filtered( const float x, const float y, float dx[2], float dy[2], float *out) const { - BLI_assert(m_datatype == DataType::Color); + BLI_assert(datatype_ == DataType::Color); const float deriv[2][2] = {{dx[0], dx[1]}, {dy[0], dy[1]}}; @@ -469,11 +468,11 @@ static void read_ewa_pixel_sampled(void *userdata, int x, int y, float result[4] /* TODO(manzanilla): to be removed with tiled implementation. */ void MemoryBuffer::readEWA(float *result, const float uv[2], const float derivatives[2][2]) { - if (m_is_a_single_elem) { - memcpy(result, m_buffer, sizeof(float) * m_num_channels); + if (is_a_single_elem_) { + memcpy(result, buffer_, sizeof(float) * num_channels_); } else { - BLI_assert(m_datatype == DataType::Color); + BLI_assert(datatype_ == DataType::Color); float inv_width = 1.0f / (float)this->getWidth(), inv_height = 1.0f / (float)this->getHeight(); /* TODO(sergey): Render pipeline uses normalized coordinates and derivatives, * but compositor uses pixel space. For now let's just divide the values and diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h index c0d086e5727..984db4acc2a 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.h +++ b/source/blender/compositor/intern/COM_MemoryBuffer.h @@ -77,38 +77,38 @@ class MemoryBuffer { /** * \brief proxy of the memory (same for all chunks in the same buffer) */ - MemoryProxy *m_memoryProxy; + MemoryProxy *memoryProxy_; /** * \brief the type of buffer DataType::Value, DataType::Vector, DataType::Color */ - DataType m_datatype; + DataType datatype_; /** * \brief region of this buffer inside relative to the MemoryProxy */ - rcti m_rect; + rcti rect_; /** * \brief state of the buffer */ - MemoryBufferState m_state; + MemoryBufferState state_; /** * \brief the actual float buffer/data */ - float *m_buffer; + float *buffer_; /** * \brief the number of channels of a single value in the buffer. * For value buffers this is 1, vector 3 and color 4 */ - uint8_t m_num_channels; + uint8_t num_channels_; /** * Whether buffer is a single element in memory. */ - bool m_is_a_single_elem; + bool is_a_single_elem_; /** * Whether MemoryBuffer owns buffer data. @@ -153,21 +153,21 @@ class MemoryBuffer { */ bool is_a_single_elem() const { - return m_is_a_single_elem; + return is_a_single_elem_; } float &operator[](int index) { - BLI_assert(m_is_a_single_elem ? index < m_num_channels : - index < get_coords_offset(getWidth(), getHeight())); - return m_buffer[index]; + BLI_assert(is_a_single_elem_ ? index < num_channels_ : + index < get_coords_offset(getWidth(), getHeight())); + return buffer_[index]; } const float &operator[](int index) const { - BLI_assert(m_is_a_single_elem ? index < m_num_channels : - index < get_coords_offset(getWidth(), getHeight())); - return m_buffer[index]; + BLI_assert(is_a_single_elem_ ? index < num_channels_ : + index < get_coords_offset(getWidth(), getHeight())); + return buffer_[index]; } /** @@ -175,7 +175,7 @@ class MemoryBuffer { */ intptr_t get_coords_offset(int x, int y) const { - return ((intptr_t)y - m_rect.ymin) * row_stride + ((intptr_t)x - m_rect.xmin) * elem_stride; + return ((intptr_t)y - rect_.ymin) * row_stride + ((intptr_t)x - rect_.xmin) * elem_stride; } /** @@ -184,7 +184,7 @@ class MemoryBuffer { float *get_elem(int x, int y) { BLI_assert(has_coords(x, y)); - return m_buffer + get_coords_offset(x, y); + return buffer_ + get_coords_offset(x, y); } /** @@ -193,7 +193,7 @@ class MemoryBuffer { const float *get_elem(int x, int y) const { BLI_assert(has_coords(x, y)); - return m_buffer + get_coords_offset(x, y); + return buffer_ + get_coords_offset(x, y); } void read_elem(int x, int y, float *out) const @@ -219,16 +219,14 @@ class MemoryBuffer { void read_elem_bilinear(float x, float y, float *out) const { /* Only clear past +/-1 borders to be able to smooth edges. */ - if (x <= m_rect.xmin - 1.0f || x >= m_rect.xmax || y <= m_rect.ymin - 1.0f || - y >= m_rect.ymax) { + if (x <= rect_.xmin - 1.0f || x >= rect_.xmax || y <= rect_.ymin - 1.0f || y >= rect_.ymax) { clear_elem(out); return; } - if (m_is_a_single_elem) { - if (x >= m_rect.xmin && x < m_rect.xmax - 1.0f && y >= m_rect.ymin && - y < m_rect.ymax - 1.0f) { - memcpy(out, m_buffer, get_elem_bytes_len()); + if (is_a_single_elem_) { + if (x >= rect_.xmin && x < rect_.xmax - 1.0f && y >= rect_.ymin && y < rect_.ymax - 1.0f) { + memcpy(out, buffer_, get_elem_bytes_len()); return; } @@ -253,15 +251,15 @@ class MemoryBuffer { single_y = rel_y - last_y; } - BLI_bilinear_interpolation_fl(m_buffer, out, 1, 1, m_num_channels, single_x, single_y); + BLI_bilinear_interpolation_fl(buffer_, out, 1, 1, num_channels_, single_x, single_y); return; } - BLI_bilinear_interpolation_fl(m_buffer, + BLI_bilinear_interpolation_fl(buffer_, out, getWidth(), getHeight(), - m_num_channels, + num_channels_, get_relative_x(x), get_relative_y(y)); } @@ -288,8 +286,8 @@ class MemoryBuffer { */ float &get_value(int x, int y, int channel) { - BLI_assert(has_coords(x, y) && channel >= 0 && channel < m_num_channels); - return m_buffer[get_coords_offset(x, y) + channel]; + BLI_assert(has_coords(x, y) && channel >= 0 && channel < num_channels_); + return buffer_[get_coords_offset(x, y) + channel]; } /** @@ -297,8 +295,8 @@ class MemoryBuffer { */ const float &get_value(int x, int y, int channel) const { - BLI_assert(has_coords(x, y) && channel >= 0 && channel < m_num_channels); - return m_buffer[get_coords_offset(x, y) + channel]; + BLI_assert(has_coords(x, y) && channel >= 0 && channel < num_channels_); + return buffer_[get_coords_offset(x, y) + channel]; } /** @@ -307,7 +305,7 @@ class MemoryBuffer { const float *get_row_end(int y) const { BLI_assert(has_y(y)); - return m_buffer + (is_a_single_elem() ? m_num_channels : get_coords_offset(getWidth(), y)); + return buffer_ + (is_a_single_elem() ? num_channels_ : get_coords_offset(getWidth(), y)); } /** @@ -330,12 +328,12 @@ class MemoryBuffer { uint8_t get_num_channels() const { - return m_num_channels; + return num_channels_; } uint8_t get_elem_bytes_len() const { - return m_num_channels * sizeof(float); + return num_channels_ * sizeof(float); } /** @@ -343,22 +341,22 @@ class MemoryBuffer { */ BufferRange<float> as_range() { - return BufferRange<float>(m_buffer, 0, buffer_len(), elem_stride); + return BufferRange<float>(buffer_, 0, buffer_len(), elem_stride); } BufferRange<const float> as_range() const { - return BufferRange<const float>(m_buffer, 0, buffer_len(), elem_stride); + return BufferRange<const float>(buffer_, 0, buffer_len(), elem_stride); } BufferArea<float> get_buffer_area(const rcti &area) { - return BufferArea<float>(m_buffer, getWidth(), area, elem_stride); + return BufferArea<float>(buffer_, getWidth(), area, elem_stride); } BufferArea<const float> get_buffer_area(const rcti &area) const { - return BufferArea<const float>(m_buffer, getWidth(), area, elem_stride); + return BufferArea<const float>(buffer_, getWidth(), area, elem_stride); } BuffersIterator<float> iterate_with(Span<MemoryBuffer *> inputs); @@ -370,13 +368,13 @@ class MemoryBuffer { */ float *getBuffer() { - return m_buffer; + return buffer_; } float *release_ownership_buffer() { owns_data_ = false; - return m_buffer; + return buffer_; } MemoryBuffer *inflate() const; @@ -385,8 +383,8 @@ class MemoryBuffer { { const int w = getWidth(); const int h = getHeight(); - x = x - m_rect.xmin; - y = y - m_rect.ymin; + x = x - rect_.xmin; + y = y - rect_.ymin; switch (extend_x) { case MemoryBufferExtend::Clip: @@ -426,8 +424,8 @@ class MemoryBuffer { break; } - x = x + m_rect.xmin; - y = y + m_rect.ymin; + x = x + rect_.xmin; + y = y + rect_.ymin; } inline void wrap_pixel(float &x, @@ -437,8 +435,8 @@ class MemoryBuffer { { const float w = (float)getWidth(); const float h = (float)getHeight(); - x = x - m_rect.xmin; - y = y - m_rect.ymin; + x = x - rect_.xmin; + y = y - rect_.ymin; switch (extend_x) { case MemoryBufferExtend::Clip: @@ -478,8 +476,8 @@ class MemoryBuffer { break; } - x = x + m_rect.xmin; - y = y + m_rect.ymin; + x = x + rect_.xmin; + y = y + rect_.ymin; } /* TODO(manzanilla): to be removed with tiled implementation. For applying #MemoryBufferExtend @@ -490,19 +488,19 @@ class MemoryBuffer { MemoryBufferExtend extend_x = MemoryBufferExtend::Clip, MemoryBufferExtend extend_y = MemoryBufferExtend::Clip) { - bool clip_x = (extend_x == MemoryBufferExtend::Clip && (x < m_rect.xmin || x >= m_rect.xmax)); - bool clip_y = (extend_y == MemoryBufferExtend::Clip && (y < m_rect.ymin || y >= m_rect.ymax)); + bool clip_x = (extend_x == MemoryBufferExtend::Clip && (x < rect_.xmin || x >= rect_.xmax)); + bool clip_y = (extend_y == MemoryBufferExtend::Clip && (y < rect_.ymin || y >= rect_.ymax)); if (clip_x || clip_y) { /* clip result outside rect is zero */ - memset(result, 0, m_num_channels * sizeof(float)); + memset(result, 0, num_channels_ * sizeof(float)); } else { int u = x; int v = y; this->wrap_pixel(u, v, extend_x, extend_y); const int offset = get_coords_offset(u, v); - float *buffer = &m_buffer[offset]; - memcpy(result, buffer, sizeof(float) * m_num_channels); + float *buffer = &buffer_[offset]; + memcpy(result, buffer, sizeof(float) * num_channels_); } } @@ -520,11 +518,11 @@ class MemoryBuffer { const int offset = get_coords_offset(u, v); BLI_assert(offset >= 0); - BLI_assert(offset < this->buffer_len() * m_num_channels); - BLI_assert(!(extend_x == MemoryBufferExtend::Clip && (u < m_rect.xmin || u >= m_rect.xmax)) && - !(extend_y == MemoryBufferExtend::Clip && (v < m_rect.ymin || v >= m_rect.ymax))); - float *buffer = &m_buffer[offset]; - memcpy(result, buffer, sizeof(float) * m_num_channels); + BLI_assert(offset < this->buffer_len() * num_channels_); + BLI_assert(!(extend_x == MemoryBufferExtend::Clip && (u < rect_.xmin || u >= rect_.xmax)) && + !(extend_y == MemoryBufferExtend::Clip && (v < rect_.ymin || v >= rect_.ymax))); + float *buffer = &buffer_[offset]; + memcpy(result, buffer, sizeof(float) * num_channels_); } void writePixel(int x, int y, const float color[4]); @@ -540,18 +538,18 @@ class MemoryBuffer { this->wrap_pixel(u, v, extend_x, extend_y); if ((extend_x != MemoryBufferExtend::Repeat && (u < 0.0f || u >= getWidth())) || (extend_y != MemoryBufferExtend::Repeat && (v < 0.0f || v >= getHeight()))) { - copy_vn_fl(result, m_num_channels, 0.0f); + copy_vn_fl(result, num_channels_, 0.0f); return; } - if (m_is_a_single_elem) { - memcpy(result, m_buffer, sizeof(float) * m_num_channels); + if (is_a_single_elem_) { + memcpy(result, buffer_, sizeof(float) * num_channels_); } else { - BLI_bilinear_interpolation_wrap_fl(m_buffer, + BLI_bilinear_interpolation_wrap_fl(buffer_, result, getWidth(), getHeight(), - m_num_channels, + num_channels_, u, v, extend_x == MemoryBufferExtend::Repeat, @@ -566,7 +564,7 @@ class MemoryBuffer { */ inline bool isTemporarily() const { - return m_state == MemoryBufferState::Temporary; + return state_ == MemoryBufferState::Temporary; } void copy_from(const MemoryBuffer *src, const rcti &area); @@ -632,7 +630,7 @@ class MemoryBuffer { */ const rcti &get_rect() const { - return m_rect; + return rect_; } /** @@ -640,7 +638,7 @@ class MemoryBuffer { */ const int getWidth() const { - return BLI_rcti_size_x(&m_rect); + return BLI_rcti_size_x(&rect_); } /** @@ -648,7 +646,7 @@ class MemoryBuffer { */ const int getHeight() const { - return BLI_rcti_size_y(&m_rect); + return BLI_rcti_size_y(&rect_); } /** @@ -668,17 +666,17 @@ class MemoryBuffer { void clear_elem(float *out) const { - memset(out, 0, m_num_channels * sizeof(float)); + memset(out, 0, num_channels_ * sizeof(float)); } template<typename T> T get_relative_x(T x) const { - return x - m_rect.xmin; + return x - rect_.xmin; } template<typename T> T get_relative_y(T y) const { - return y - m_rect.ymin; + return y - rect_.ymin; } template<typename T> bool has_coords(T x, T y) const @@ -688,12 +686,12 @@ class MemoryBuffer { template<typename T> bool has_x(T x) const { - return x >= m_rect.xmin && x < m_rect.xmax; + return x >= rect_.xmin && x < rect_.xmax; } template<typename T> bool has_y(T y) const { - return y >= m_rect.ymin && y < m_rect.ymax; + return y >= rect_.ymin && y < rect_.ymax; } /* Fast `floor(..)` functions. The caller should check result is within buffer bounds. diff --git a/source/blender/compositor/intern/COM_MemoryProxy.cc b/source/blender/compositor/intern/COM_MemoryProxy.cc index 6502a8f4b9a..507caa25655 100644 --- a/source/blender/compositor/intern/COM_MemoryProxy.cc +++ b/source/blender/compositor/intern/COM_MemoryProxy.cc @@ -23,9 +23,9 @@ namespace blender::compositor { MemoryProxy::MemoryProxy(DataType datatype) { - m_writeBufferOperation = nullptr; - m_executor = nullptr; - m_datatype = datatype; + writeBufferOperation_ = nullptr; + executor_ = nullptr; + datatype_ = datatype; } void MemoryProxy::allocate(unsigned int width, unsigned int height) @@ -36,14 +36,14 @@ void MemoryProxy::allocate(unsigned int width, unsigned int height) result.ymin = 0; result.ymax = height; - m_buffer = new MemoryBuffer(this, result, MemoryBufferState::Default); + buffer_ = new MemoryBuffer(this, result, MemoryBufferState::Default); } void MemoryProxy::free() { - if (m_buffer) { - delete m_buffer; - m_buffer = nullptr; + if (buffer_) { + delete buffer_; + buffer_ = nullptr; } } diff --git a/source/blender/compositor/intern/COM_MemoryProxy.h b/source/blender/compositor/intern/COM_MemoryProxy.h index cae52182f26..cf262d72649 100644 --- a/source/blender/compositor/intern/COM_MemoryProxy.h +++ b/source/blender/compositor/intern/COM_MemoryProxy.h @@ -42,22 +42,22 @@ class MemoryProxy { /** * \brief reference to the output operation of the executiongroup */ - WriteBufferOperation *m_writeBufferOperation; + WriteBufferOperation *writeBufferOperation_; /** * \brief reference to the executor. the Execution group that can fill a chunk */ - ExecutionGroup *m_executor; + ExecutionGroup *executor_; /** * \brief the allocated memory */ - MemoryBuffer *m_buffer; + MemoryBuffer *buffer_; /** * \brief datatype of this MemoryProxy */ - DataType m_datatype; + DataType datatype_; public: MemoryProxy(DataType type); @@ -68,7 +68,7 @@ class MemoryProxy { */ void setExecutor(ExecutionGroup *executor) { - m_executor = executor; + executor_ = executor; } /** @@ -76,7 +76,7 @@ class MemoryProxy { */ ExecutionGroup *getExecutor() const { - return m_executor; + return executor_; } /** @@ -85,7 +85,7 @@ class MemoryProxy { */ void setWriteBufferOperation(WriteBufferOperation *operation) { - m_writeBufferOperation = operation; + writeBufferOperation_ = operation; } /** @@ -94,7 +94,7 @@ class MemoryProxy { */ WriteBufferOperation *getWriteBufferOperation() const { - return m_writeBufferOperation; + return writeBufferOperation_; } /** @@ -112,12 +112,12 @@ class MemoryProxy { */ inline MemoryBuffer *getBuffer() { - return m_buffer; + return buffer_; } inline DataType getDataType() { - return m_datatype; + return datatype_; } #ifdef WITH_CXX_GUARDEDALLOC diff --git a/source/blender/compositor/intern/COM_Node.cc b/source/blender/compositor/intern/COM_Node.cc index 2cd56c1d7c1..7acf91df7d4 100644 --- a/source/blender/compositor/intern/COM_Node.cc +++ b/source/blender/compositor/intern/COM_Node.cc @@ -29,10 +29,10 @@ namespace blender::compositor { **************/ Node::Node(bNode *editorNode, bool create_sockets) - : m_editorNodeTree(nullptr), - m_editorNode(editorNode), - m_inActiveGroup(false), - m_instanceKey(NODE_INSTANCE_KEY_NONE) + : editorNodeTree_(nullptr), + editorNode_(editorNode), + inActiveGroup_(false), + instanceKey_(NODE_INSTANCE_KEY_NONE) { if (create_sockets) { bNodeSocket *input = (bNodeSocket *)editorNode->inputs.first; @@ -137,13 +137,13 @@ bNodeSocket *Node::getEditorOutputSocket(int editorNodeOutputSocketIndex) *******************/ NodeInput::NodeInput(Node *node, bNodeSocket *b_socket, DataType datatype) - : m_node(node), m_editorSocket(b_socket), m_datatype(datatype), m_link(nullptr) + : node_(node), editorSocket_(b_socket), datatype_(datatype), link_(nullptr) { } void NodeInput::setLink(NodeOutput *link) { - m_link = link; + link_ = link; } float NodeInput::getEditorValueFloat() const @@ -172,7 +172,7 @@ void NodeInput::getEditorValueVector(float *value) const ********************/ NodeOutput::NodeOutput(Node *node, bNodeSocket *b_socket, DataType datatype) - : m_node(node), m_editorSocket(b_socket), m_datatype(datatype) + : node_(node), editorSocket_(b_socket), datatype_(datatype) { } diff --git a/source/blender/compositor/intern/COM_Node.h b/source/blender/compositor/intern/COM_Node.h index 76eb03693ae..3d9c62aca67 100644 --- a/source/blender/compositor/intern/COM_Node.h +++ b/source/blender/compositor/intern/COM_Node.h @@ -41,22 +41,22 @@ class Node { /** * \brief stores the reference to the SDNA bNode struct */ - bNodeTree *m_editorNodeTree; + bNodeTree *editorNodeTree_; /** * \brief stores the reference to the SDNA bNode struct */ - bNode *m_editorNode; + bNode *editorNode_; /** * \brief Is this node part of the active group */ - bool m_inActiveGroup; + bool inActiveGroup_; /** * \brief Instance key to identify the node in an instance hash table */ - bNodeInstanceKey m_instanceKey; + bNodeInstanceKey instanceKey_; protected: /** @@ -78,7 +78,7 @@ class Node { */ bNode *getbNode() const { - return m_editorNode; + return editorNode_; } /** @@ -86,7 +86,7 @@ class Node { */ bNodeTree *getbNodeTree() const { - return m_editorNodeTree; + return editorNodeTree_; } /** @@ -97,7 +97,7 @@ class Node { */ void setbNode(bNode *node) { - m_editorNode = node; + editorNode_ = node; } /** @@ -106,7 +106,7 @@ class Node { */ void setbNodeTree(bNodeTree *nodetree) { - m_editorNodeTree = nodetree; + editorNodeTree_ = nodetree; } /** @@ -145,7 +145,7 @@ class Node { */ void setIsInActiveGroup(bool value) { - m_inActiveGroup = value; + inActiveGroup_ = value; } /** @@ -156,7 +156,7 @@ class Node { */ inline bool isInActiveGroup() const { - return m_inActiveGroup; + return inActiveGroup_; } /** @@ -172,11 +172,11 @@ class Node { void setInstanceKey(bNodeInstanceKey instance_key) { - m_instanceKey = instance_key; + instanceKey_ = instance_key; } bNodeInstanceKey getInstanceKey() const { - return m_instanceKey; + return instanceKey_; } protected: @@ -206,41 +206,41 @@ class Node { */ class NodeInput { private: - Node *m_node; - bNodeSocket *m_editorSocket; + Node *node_; + bNodeSocket *editorSocket_; - DataType m_datatype; + DataType datatype_; /** * \brief link connected to this NodeInput. * An input socket can only have a single link */ - NodeOutput *m_link; + NodeOutput *link_; public: NodeInput(Node *node, bNodeSocket *b_socket, DataType datatype); Node *getNode() const { - return m_node; + return node_; } DataType getDataType() const { - return m_datatype; + return datatype_; } bNodeSocket *getbNodeSocket() const { - return m_editorSocket; + return editorSocket_; } void setLink(NodeOutput *link); bool isLinked() const { - return m_link; + return link_; } NodeOutput *getLink() { - return m_link; + return link_; } float getEditorValueFloat() const; @@ -254,25 +254,25 @@ class NodeInput { */ class NodeOutput { private: - Node *m_node; - bNodeSocket *m_editorSocket; + Node *node_; + bNodeSocket *editorSocket_; - DataType m_datatype; + DataType datatype_; public: NodeOutput(Node *node, bNodeSocket *b_socket, DataType datatype); Node *getNode() const { - return m_node; + return node_; } DataType getDataType() const { - return m_datatype; + return datatype_; } bNodeSocket *getbNodeSocket() const { - return m_editorSocket; + return editorSocket_; } float getEditorValueFloat(); diff --git a/source/blender/compositor/intern/COM_NodeConverter.cc b/source/blender/compositor/intern/COM_NodeConverter.cc index 73f64c7cfd4..314b5e9572a 100644 --- a/source/blender/compositor/intern/COM_NodeConverter.cc +++ b/source/blender/compositor/intern/COM_NodeConverter.cc @@ -29,38 +29,38 @@ namespace blender::compositor { -NodeConverter::NodeConverter(NodeOperationBuilder *builder) : m_builder(builder) +NodeConverter::NodeConverter(NodeOperationBuilder *builder) : builder_(builder) { } void NodeConverter::addOperation(NodeOperation *operation) { - m_builder->addOperation(operation); + builder_->addOperation(operation); } void NodeConverter::mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket) { - m_builder->mapInputSocket(node_socket, operation_socket); + builder_->mapInputSocket(node_socket, operation_socket); } void NodeConverter::mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket) { - m_builder->mapOutputSocket(node_socket, operation_socket); + builder_->mapOutputSocket(node_socket, operation_socket); } void NodeConverter::addLink(NodeOperationOutput *from, NodeOperationInput *to) { - m_builder->addLink(from, to); + builder_->addLink(from, to); } void NodeConverter::addPreview(NodeOperationOutput *output) { - m_builder->addPreview(output); + builder_->addPreview(output); } void NodeConverter::addNodeInputPreview(NodeInput *input) { - m_builder->addNodeInputPreview(input); + builder_->addNodeInputPreview(input); } NodeOperation *NodeConverter::setInvalidOutput(NodeOutput *output) @@ -71,8 +71,8 @@ NodeOperation *NodeConverter::setInvalidOutput(NodeOutput *output) SetColorOperation *operation = new SetColorOperation(); operation->setChannels(warning_color); - m_builder->addOperation(operation); - m_builder->mapOutputSocket(output, operation->getOutputSocket()); + builder_->addOperation(operation); + builder_->mapOutputSocket(output, operation->getOutputSocket()); return operation; } @@ -80,9 +80,9 @@ NodeOperation *NodeConverter::setInvalidOutput(NodeOutput *output) NodeOperationOutput *NodeConverter::addInputProxy(NodeInput *input, bool use_conversion) { SocketProxyOperation *proxy = new SocketProxyOperation(input->getDataType(), use_conversion); - m_builder->addOperation(proxy); + builder_->addOperation(proxy); - m_builder->mapInputSocket(input, proxy->getInputSocket(0)); + builder_->mapInputSocket(input, proxy->getInputSocket(0)); return proxy->getOutputSocket(); } @@ -90,9 +90,9 @@ NodeOperationOutput *NodeConverter::addInputProxy(NodeInput *input, bool use_con NodeOperationInput *NodeConverter::addOutputProxy(NodeOutput *output, bool use_conversion) { SocketProxyOperation *proxy = new SocketProxyOperation(output->getDataType(), use_conversion); - m_builder->addOperation(proxy); + builder_->addOperation(proxy); - m_builder->mapOutputSocket(output, proxy->getOutputSocket()); + builder_->mapOutputSocket(output, proxy->getOutputSocket()); return proxy->getInputSocket(0); } @@ -102,8 +102,8 @@ void NodeConverter::addInputValue(NodeOperationInput *input, float value) SetValueOperation *operation = new SetValueOperation(); operation->setValue(value); - m_builder->addOperation(operation); - m_builder->addLink(operation->getOutputSocket(), input); + builder_->addOperation(operation); + builder_->addLink(operation->getOutputSocket(), input); } void NodeConverter::addInputColor(NodeOperationInput *input, const float value[4]) @@ -111,8 +111,8 @@ void NodeConverter::addInputColor(NodeOperationInput *input, const float value[4 SetColorOperation *operation = new SetColorOperation(); operation->setChannels(value); - m_builder->addOperation(operation); - m_builder->addLink(operation->getOutputSocket(), input); + builder_->addOperation(operation); + builder_->addLink(operation->getOutputSocket(), input); } void NodeConverter::addInputVector(NodeOperationInput *input, const float value[3]) @@ -120,8 +120,8 @@ void NodeConverter::addInputVector(NodeOperationInput *input, const float value[ SetVectorOperation *operation = new SetVectorOperation(); operation->setVector(value); - m_builder->addOperation(operation); - m_builder->addLink(operation->getOutputSocket(), input); + builder_->addOperation(operation); + builder_->addLink(operation->getOutputSocket(), input); } void NodeConverter::addOutputValue(NodeOutput *output, float value) @@ -129,8 +129,8 @@ void NodeConverter::addOutputValue(NodeOutput *output, float value) SetValueOperation *operation = new SetValueOperation(); operation->setValue(value); - m_builder->addOperation(operation); - m_builder->mapOutputSocket(output, operation->getOutputSocket()); + builder_->addOperation(operation); + builder_->mapOutputSocket(output, operation->getOutputSocket()); } void NodeConverter::addOutputColor(NodeOutput *output, const float value[4]) @@ -138,8 +138,8 @@ void NodeConverter::addOutputColor(NodeOutput *output, const float value[4]) SetColorOperation *operation = new SetColorOperation(); operation->setChannels(value); - m_builder->addOperation(operation); - m_builder->mapOutputSocket(output, operation->getOutputSocket()); + builder_->addOperation(operation); + builder_->mapOutputSocket(output, operation->getOutputSocket()); } void NodeConverter::addOutputVector(NodeOutput *output, const float value[3]) @@ -147,18 +147,18 @@ void NodeConverter::addOutputVector(NodeOutput *output, const float value[3]) SetVectorOperation *operation = new SetVectorOperation(); operation->setVector(value); - m_builder->addOperation(operation); - m_builder->mapOutputSocket(output, operation->getOutputSocket()); + builder_->addOperation(operation); + builder_->mapOutputSocket(output, operation->getOutputSocket()); } void NodeConverter::registerViewer(ViewerOperation *viewer) { - m_builder->registerViewer(viewer); + builder_->registerViewer(viewer); } ViewerOperation *NodeConverter::active_viewer() const { - return m_builder->active_viewer(); + return builder_->active_viewer(); } } // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_NodeConverter.h b/source/blender/compositor/intern/COM_NodeConverter.h index b3f03485249..afbd53fa67d 100644 --- a/source/blender/compositor/intern/COM_NodeConverter.h +++ b/source/blender/compositor/intern/COM_NodeConverter.h @@ -116,7 +116,7 @@ class NodeConverter { private: /** The internal builder for storing the results of the graph construction. */ - NodeOperationBuilder *m_builder; + NodeOperationBuilder *builder_; #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeCompiler") diff --git a/source/blender/compositor/intern/COM_NodeGraph.cc b/source/blender/compositor/intern/COM_NodeGraph.cc index 0c94dfce409..a06c9349bb7 100644 --- a/source/blender/compositor/intern/COM_NodeGraph.cc +++ b/source/blender/compositor/intern/COM_NodeGraph.cc @@ -36,8 +36,8 @@ namespace blender::compositor { NodeGraph::~NodeGraph() { - while (m_nodes.size()) { - delete m_nodes.pop_last(); + while (nodes_.size()) { + delete nodes_.pop_last(); } } @@ -75,14 +75,14 @@ void NodeGraph::add_node(Node *node, node->setInstanceKey(key); node->setIsInActiveGroup(is_active_group); - m_nodes.append(node); + nodes_.append(node); DebugInfo::node_added(node); } void NodeGraph::add_link(NodeOutput *fromSocket, NodeInput *toSocket) { - m_links.append(Link(fromSocket, toSocket)); + links_.append(Link(fromSocket, toSocket)); /* register with the input */ toSocket->setLink(fromSocket); @@ -104,7 +104,7 @@ void NodeGraph::add_bNodeTree(const CompositorContext &context, add_bNode(context, tree, node, key, is_active_group); } - NodeRange node_range(m_nodes.begin() + nodes_start, m_nodes.end()); + NodeRange node_range(nodes_.begin() + nodes_start, nodes_.end()); /* Add all node-links of the tree to the link list. */ for (bNodeLink *nodelink = (bNodeLink *)tree->links.first; nodelink; nodelink = nodelink->next) { add_bNodeLink(node_range, nodelink); @@ -285,7 +285,7 @@ void NodeGraph::add_proxies_group(const CompositorContext &context, } /* use node list size before adding proxies, so they can be connected in add_bNodeTree */ - int nodes_start = m_nodes.size(); + int nodes_start = nodes_.size(); /* create proxy nodes for group input/output nodes */ for (bNode *b_node_io = (bNode *)b_group_tree->nodes.first; b_node_io; diff --git a/source/blender/compositor/intern/COM_NodeGraph.h b/source/blender/compositor/intern/COM_NodeGraph.h index 12aca8f6069..cc628ebb724 100644 --- a/source/blender/compositor/intern/COM_NodeGraph.h +++ b/source/blender/compositor/intern/COM_NodeGraph.h @@ -47,19 +47,19 @@ class NodeGraph { }; private: - Vector<Node *> m_nodes; - Vector<Link> m_links; + Vector<Node *> nodes_; + Vector<Link> links_; public: ~NodeGraph(); const Vector<Node *> &nodes() const { - return m_nodes; + return nodes_; } const Vector<Link> &links() const { - return m_links; + return links_; } void from_bNodeTree(const CompositorContext &context, bNodeTree *tree); diff --git a/source/blender/compositor/intern/COM_NodeOperation.cc b/source/blender/compositor/intern/COM_NodeOperation.cc index 914842c816c..0bfc088e4bf 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.cc +++ b/source/blender/compositor/intern/COM_NodeOperation.cc @@ -34,20 +34,20 @@ NodeOperation::NodeOperation() { canvas_input_index_ = 0; canvas_ = COM_AREA_NONE; - m_btree = nullptr; + btree_ = nullptr; } /** Get constant value when operation is constant, otherwise return default_value. */ float NodeOperation::get_constant_value_default(float default_value) { - BLI_assert(m_outputs.size() > 0 && getOutputSocket()->getDataType() == DataType::Value); + BLI_assert(outputs_.size() > 0 && getOutputSocket()->getDataType() == DataType::Value); return *get_constant_elem_default(&default_value); } /** Get constant elem when operation is constant, otherwise return default_elem. */ const float *NodeOperation::get_constant_elem_default(const float *default_elem) { - BLI_assert(m_outputs.size() > 0); + BLI_assert(outputs_.size() > 0); if (get_flags().is_constant_operation) { return static_cast<ConstantOperation *>(this)->get_constant_elem(); } @@ -72,15 +72,15 @@ std::optional<NodeOperationHash> NodeOperation::generate_hash() } hash_params(canvas_.ymin, canvas_.ymax); - if (m_outputs.size() > 0) { - BLI_assert(m_outputs.size() == 1); + if (outputs_.size() > 0) { + BLI_assert(outputs_.size() == 1); hash_param(this->getOutputSocket()->getDataType()); } NodeOperationHash hash; hash.params_hash_ = params_hash_; hash.parents_hash_ = 0; - for (NodeOperationInput &socket : m_inputs) { + for (NodeOperationInput &socket : inputs_) { if (!socket.isConnected()) { continue; } @@ -108,29 +108,29 @@ std::optional<NodeOperationHash> NodeOperation::generate_hash() NodeOperationOutput *NodeOperation::getOutputSocket(unsigned int index) { - return &m_outputs[index]; + return &outputs_[index]; } NodeOperationInput *NodeOperation::getInputSocket(unsigned int index) { - return &m_inputs[index]; + return &inputs_[index]; } void NodeOperation::addInputSocket(DataType datatype, ResizeMode resize_mode) { - m_inputs.append(NodeOperationInput(this, datatype, resize_mode)); + inputs_.append(NodeOperationInput(this, datatype, resize_mode)); } void NodeOperation::addOutputSocket(DataType datatype) { - m_outputs.append(NodeOperationOutput(this, datatype)); + outputs_.append(NodeOperationOutput(this, datatype)); } void NodeOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) { unsigned int used_canvas_index = 0; if (canvas_input_index_ == RESOLUTION_INPUT_ANY) { - for (NodeOperationInput &input : m_inputs) { + for (NodeOperationInput &input : inputs_) { rcti any_area = COM_AREA_NONE; const bool determined = input.determine_canvas(preferred_area, any_area); if (determined) { @@ -140,8 +140,8 @@ void NodeOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) used_canvas_index += 1; } } - else if (canvas_input_index_ < m_inputs.size()) { - NodeOperationInput &input = m_inputs[canvas_input_index_]; + else if (canvas_input_index_ < inputs_.size()) { + NodeOperationInput &input = inputs_[canvas_input_index_]; input.determine_canvas(preferred_area, r_area); used_canvas_index = canvas_input_index_; } @@ -152,11 +152,11 @@ void NodeOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) rcti unused_area; const rcti &local_preferred_area = r_area; - for (unsigned int index = 0; index < m_inputs.size(); index++) { + for (unsigned int index = 0; index < inputs_.size(); index++) { if (index == used_canvas_index) { continue; } - NodeOperationInput &input = m_inputs[index]; + NodeOperationInput &input = inputs_[index]; if (input.isConnected()) { input.determine_canvas(local_preferred_area, unused_area); } @@ -179,22 +179,22 @@ void NodeOperation::initExecution() void NodeOperation::initMutex() { - BLI_mutex_init(&m_mutex); + BLI_mutex_init(&mutex_); } void NodeOperation::lockMutex() { - BLI_mutex_lock(&m_mutex); + BLI_mutex_lock(&mutex_); } void NodeOperation::unlockMutex() { - BLI_mutex_unlock(&m_mutex); + BLI_mutex_unlock(&mutex_); } void NodeOperation::deinitMutex() { - BLI_mutex_end(&m_mutex); + BLI_mutex_end(&mutex_); } void NodeOperation::deinitExecution() @@ -219,7 +219,7 @@ const rcti &NodeOperation::get_canvas() const */ void NodeOperation::unset_canvas() { - BLI_assert(m_inputs.size() == 0); + BLI_assert(inputs_.size() == 0); flags.is_canvas_set = false; } @@ -242,7 +242,7 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { - if (m_inputs.size() == 0) { + if (inputs_.size() == 0) { BLI_rcti_init(output, input->xmin, input->xmax, input->ymin, input->ymax); return false; } @@ -445,14 +445,14 @@ void NodeOperation::remove_buffers_and_restore_original_inputs( *****************/ NodeOperationInput::NodeOperationInput(NodeOperation *op, DataType datatype, ResizeMode resizeMode) - : m_operation(op), m_datatype(datatype), m_resizeMode(resizeMode), m_link(nullptr) + : operation_(op), datatype_(datatype), resizeMode_(resizeMode), link_(nullptr) { } SocketReader *NodeOperationInput::getReader() { if (isConnected()) { - return &m_link->getOperation(); + return &link_->getOperation(); } return nullptr; @@ -463,8 +463,8 @@ SocketReader *NodeOperationInput::getReader() */ bool NodeOperationInput::determine_canvas(const rcti &preferred_area, rcti &r_area) { - if (m_link) { - m_link->determine_canvas(preferred_area, r_area); + if (link_) { + link_->determine_canvas(preferred_area, r_area); return !BLI_rcti_is_empty(&r_area); } return false; @@ -475,7 +475,7 @@ bool NodeOperationInput::determine_canvas(const rcti &preferred_area, rcti &r_ar ******************/ NodeOperationOutput::NodeOperationOutput(NodeOperation *op, DataType datatype) - : m_operation(op), m_datatype(datatype) + : operation_(op), datatype_(datatype) { } diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h index 2bdc2bfeb0b..af9d62b4276 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.h +++ b/source/blender/compositor/intern/COM_NodeOperation.h @@ -83,18 +83,18 @@ enum class ResizeMode { class NodeOperationInput { private: - NodeOperation *m_operation; + NodeOperation *operation_; /** Datatype of this socket. Is used for automatically data transformation. * \section data-conversion */ - DataType m_datatype; + DataType datatype_; /** Resize mode of this socket */ - ResizeMode m_resizeMode; + ResizeMode resizeMode_; /** Connected output */ - NodeOperationOutput *m_link; + NodeOperationOutput *link_; public: NodeOperationInput(NodeOperation *op, @@ -103,33 +103,33 @@ class NodeOperationInput { NodeOperation &getOperation() const { - return *m_operation; + return *operation_; } DataType getDataType() const { - return m_datatype; + return datatype_; } void setLink(NodeOperationOutput *link) { - m_link = link; + link_ = link; } NodeOperationOutput *getLink() const { - return m_link; + return link_; } bool isConnected() const { - return m_link; + return link_; } void setResizeMode(ResizeMode resizeMode) { - m_resizeMode = resizeMode; + resizeMode_ = resizeMode; } ResizeMode getResizeMode() const { - return m_resizeMode; + return resizeMode_; } SocketReader *getReader(); @@ -143,23 +143,23 @@ class NodeOperationInput { class NodeOperationOutput { private: - NodeOperation *m_operation; + NodeOperation *operation_; /** Datatype of this socket. Is used for automatically data transformation. * \section data-conversion */ - DataType m_datatype; + DataType datatype_; public: NodeOperationOutput(NodeOperation *op, DataType datatype); NodeOperation &getOperation() const { - return *m_operation; + return *operation_; } DataType getDataType() const { - return m_datatype; + return datatype_; } void determine_canvas(const rcti &preferred_area, rcti &r_area); @@ -314,10 +314,10 @@ struct NodeOperationHash { */ class NodeOperation { private: - int m_id; - std::string m_name; - Vector<NodeOperationInput> m_inputs; - Vector<NodeOperationOutput> m_outputs; + int id_; + std::string name_; + Vector<NodeOperationInput> inputs_; + Vector<NodeOperationOutput> outputs_; size_t params_hash_; bool is_hash_output_params_implemented_; @@ -338,12 +338,12 @@ class NodeOperation { * \see NodeOperation.deinitMutex deinitializes this mutex * \see NodeOperation.getMutex retrieve a pointer to this mutex. */ - ThreadMutex m_mutex; + ThreadMutex mutex_; /** * \brief reference to the editing bNodeTree, used for break and update callback */ - const bNodeTree *m_btree; + const bNodeTree *btree_; protected: /** @@ -367,22 +367,22 @@ class NodeOperation { void set_name(const std::string name) { - m_name = name; + name_ = name; } const std::string get_name() const { - return m_name; + return name_; } void set_id(const int id) { - m_id = id; + id_ = id; } const int get_id() const { - return m_id; + return id_; } float get_constant_value_default(float default_value); @@ -397,11 +397,11 @@ class NodeOperation { unsigned int getNumberOfInputSockets() const { - return m_inputs.size(); + return inputs_.size(); } unsigned int getNumberOfOutputSockets() const { - return m_outputs.size(); + return outputs_.size(); } NodeOperationOutput *getOutputSocket(unsigned int index = 0); NodeOperationInput *getInputSocket(unsigned int index); @@ -442,7 +442,7 @@ class NodeOperation { void setbNodeTree(const bNodeTree *tree) { - m_btree = tree; + btree_ = tree; } void set_execution_system(ExecutionSystem *system) @@ -561,13 +561,13 @@ class NodeOperation { inline bool isBraked() const { - return m_btree->test_break(m_btree->tbh); + return btree_->test_break(btree_->tbh); } inline void updateDraw() { - if (m_btree->update_draw) { - m_btree->update_draw(m_btree->udh); + if (btree_->update_draw) { + btree_->update_draw(btree_->udh); } } diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc index 151356efb92..708bda30636 100644 --- a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc +++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc @@ -40,9 +40,9 @@ namespace blender::compositor { NodeOperationBuilder::NodeOperationBuilder(const CompositorContext *context, bNodeTree *b_nodetree, ExecutionSystem *system) - : m_context(context), exec_system_(system), m_current_node(nullptr), m_active_viewer(nullptr) + : context_(context), exec_system_(system), current_node_(nullptr), active_viewer_(nullptr) { - m_graph.from_bNodeTree(*context, b_nodetree); + graph_.from_bNodeTree(*context, b_nodetree); } void NodeOperationBuilder::convertToOperations(ExecutionSystem *system) @@ -50,29 +50,29 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system) /* interface handle for nodes */ NodeConverter converter(this); - for (Node *node : m_graph.nodes()) { - m_current_node = node; + for (Node *node : graph_.nodes()) { + current_node_ = node; DebugInfo::node_to_operations(node); - node->convertToOperations(converter, *m_context); + node->convertToOperations(converter, *context_); } - m_current_node = nullptr; + current_node_ = nullptr; /* The input map constructed by nodes maps operation inputs to node inputs. * Inverting yields a map of node inputs to all connected operation inputs, * so multiple operations can use the same node input. */ blender::MultiValueMap<NodeInput *, NodeOperationInput *> inverse_input_map; - for (Map<NodeOperationInput *, NodeInput *>::MutableItem item : m_input_map.items()) { + for (Map<NodeOperationInput *, NodeInput *>::MutableItem item : input_map_.items()) { inverse_input_map.add(item.value, item.key); } - for (const NodeGraph::Link &link : m_graph.links()) { + for (const NodeGraph::Link &link : graph_.links()) { NodeOutput *from = link.from; NodeInput *to = link.to; - NodeOperationOutput *op_from = m_output_map.lookup_default(from, nullptr); + NodeOperationOutput *op_from = output_map_.lookup_default(from, nullptr); const blender::Span<NodeOperationInput *> op_to_list = inverse_input_map.lookup(to); if (!op_from || op_to_list.is_empty()) { @@ -96,7 +96,7 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system) add_datatype_conversions(); - if (m_context->get_execution_model() == eExecutionModel::FullFrame) { + if (context_->get_execution_model() == eExecutionModel::FullFrame) { save_graphviz("compositor_prior_folding"); ConstantFolder folder(*this); folder.fold_operations(); @@ -107,37 +107,37 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system) save_graphviz("compositor_prior_merging"); merge_equal_operations(); - if (m_context->get_execution_model() == eExecutionModel::Tiled) { + if (context_->get_execution_model() == eExecutionModel::Tiled) { /* surround complex ops with read/write buffer */ add_complex_operation_buffers(); } /* links not available from here on */ - /* XXX make m_links a local variable to avoid confusion! */ - m_links.clear(); + /* XXX make links_ a local variable to avoid confusion! */ + links_.clear(); prune_operations(); /* ensure topological (link-based) order of nodes */ /*sort_operations();*/ /* not needed yet */ - if (m_context->get_execution_model() == eExecutionModel::Tiled) { + if (context_->get_execution_model() == eExecutionModel::Tiled) { /* create execution groups */ group_operations(); } /* transfer resulting operations to the system */ - system->set_operations(m_operations, m_groups); + system->set_operations(operations_, groups_); } void NodeOperationBuilder::addOperation(NodeOperation *operation) { - operation->set_id(m_operations.size()); - m_operations.append(operation); - if (m_current_node) { - operation->set_name(m_current_node->getbNode()->name); + operation->set_id(operations_.size()); + operations_.append(operation); + if (current_node_) { + operation->set_name(current_node_->getbNode()->name); } - operation->set_execution_model(m_context->get_execution_model()); + operation->set_execution_model(context_->get_execution_model()); operation->set_execution_system(exec_system_); } @@ -153,17 +153,17 @@ void NodeOperationBuilder::unlink_inputs_and_relink_outputs(NodeOperation *unlin NodeOperation *linked_op) { int i = 0; - while (i < m_links.size()) { - Link &link = m_links[i]; + while (i < links_.size()) { + Link &link = links_[i]; if (&link.to()->getOperation() == unlinked_op) { link.to()->setLink(nullptr); - m_links.remove(i); + links_.remove(i); continue; } if (&link.from()->getOperation() == unlinked_op) { link.to()->setLink(linked_op->getOutputSocket()); - m_links[i] = Link(linked_op->getOutputSocket(), link.to()); + links_[i] = Link(linked_op->getOutputSocket(), link.to()); } i++; } @@ -172,23 +172,23 @@ void NodeOperationBuilder::unlink_inputs_and_relink_outputs(NodeOperation *unlin void NodeOperationBuilder::mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket) { - BLI_assert(m_current_node); - BLI_assert(node_socket->getNode() == m_current_node); + BLI_assert(current_node_); + BLI_assert(node_socket->getNode() == current_node_); /* NOTE: this maps operation sockets to node sockets. * for resolving links the map will be inverted first in convertToOperations, * to get a list of links for each node input socket. */ - m_input_map.add_new(operation_socket, node_socket); + input_map_.add_new(operation_socket, node_socket); } void NodeOperationBuilder::mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket) { - BLI_assert(m_current_node); - BLI_assert(node_socket->getNode() == m_current_node); + BLI_assert(current_node_); + BLI_assert(node_socket->getNode() == current_node_); - m_output_map.add_new(node_socket, operation_socket); + output_map_.add_new(node_socket, operation_socket); } void NodeOperationBuilder::addLink(NodeOperationOutput *from, NodeOperationInput *to) @@ -197,7 +197,7 @@ void NodeOperationBuilder::addLink(NodeOperationOutput *from, NodeOperationInput return; } - m_links.append(Link(from, to)); + links_.append(Link(from, to)); /* register with the input */ to->setLink(from); @@ -206,12 +206,12 @@ void NodeOperationBuilder::addLink(NodeOperationOutput *from, NodeOperationInput void NodeOperationBuilder::removeInputLink(NodeOperationInput *to) { int index = 0; - for (Link &link : m_links) { + for (Link &link : links_) { if (link.to() == to) { /* unregister with the input */ to->setLink(nullptr); - m_links.remove(index); + links_.remove(index); return; } index++; @@ -220,28 +220,28 @@ void NodeOperationBuilder::removeInputLink(NodeOperationInput *to) PreviewOperation *NodeOperationBuilder::make_preview_operation() const { - BLI_assert(m_current_node); + BLI_assert(current_node_); - if (!(m_current_node->getbNode()->flag & NODE_PREVIEW)) { + if (!(current_node_->getbNode()->flag & NODE_PREVIEW)) { return nullptr; } /* previews only in the active group */ - if (!m_current_node->isInActiveGroup()) { + if (!current_node_->isInActiveGroup()) { return nullptr; } /* do not calculate previews of hidden nodes */ - if (m_current_node->getbNode()->flag & NODE_HIDDEN) { + if (current_node_->getbNode()->flag & NODE_HIDDEN) { return nullptr; } - bNodeInstanceHash *previews = m_context->getPreviewHash(); + bNodeInstanceHash *previews = context_->getPreviewHash(); if (previews) { - PreviewOperation *operation = new PreviewOperation(m_context->getViewSettings(), - m_context->getDisplaySettings(), - m_current_node->getbNode()->preview_xsize, - m_current_node->getbNode()->preview_ysize); - operation->setbNodeTree(m_context->getbNodeTree()); - operation->verifyPreview(previews, m_current_node->getInstanceKey()); + PreviewOperation *operation = new PreviewOperation(context_->getViewSettings(), + context_->getDisplaySettings(), + current_node_->getbNode()->preview_xsize, + current_node_->getbNode()->preview_ysize); + operation->setbNodeTree(context_->getbNodeTree()); + operation->verifyPreview(previews, current_node_->getInstanceKey()); return operation; } @@ -270,18 +270,18 @@ void NodeOperationBuilder::addNodeInputPreview(NodeInput *input) void NodeOperationBuilder::registerViewer(ViewerOperation *viewer) { - if (m_active_viewer) { - if (m_current_node->isInActiveGroup()) { + if (active_viewer_) { + if (current_node_->isInActiveGroup()) { /* deactivate previous viewer */ - m_active_viewer->setActive(false); + active_viewer_->setActive(false); - m_active_viewer = viewer; + active_viewer_ = viewer; viewer->setActive(true); } } else { - if (m_current_node->getbNodeTree() == m_context->getbNodeTree()) { - m_active_viewer = viewer; + if (current_node_->getbNodeTree() == context_->getbNodeTree()) { + active_viewer_ = viewer; viewer->setActive(true); } } @@ -294,7 +294,7 @@ void NodeOperationBuilder::registerViewer(ViewerOperation *viewer) void NodeOperationBuilder::add_datatype_conversions() { Vector<Link> convert_links; - for (const Link &link : m_links) { + for (const Link &link : links_) { /* proxy operations can skip data type conversion */ NodeOperation *from_op = &link.from()->getOperation(); NodeOperation *to_op = &link.to()->getOperation(); @@ -322,10 +322,10 @@ void NodeOperationBuilder::add_datatype_conversions() void NodeOperationBuilder::add_operation_input_constants() { /* NOTE: unconnected inputs cached first to avoid modifying - * m_operations while iterating over it + * operations_ while iterating over it */ Vector<NodeOperationInput *> pending_inputs; - for (NodeOperation *op : m_operations) { + for (NodeOperation *op : operations_) { for (int k = 0; k < op->getNumberOfInputSockets(); ++k) { NodeOperationInput *input = op->getInputSocket(k); if (!input->isConnected()) { @@ -334,7 +334,7 @@ void NodeOperationBuilder::add_operation_input_constants() } } for (NodeOperationInput *input : pending_inputs) { - add_input_constant_value(input, m_input_map.lookup_default(input, nullptr)); + add_input_constant_value(input, input_map_.lookup_default(input, nullptr)); } } @@ -393,7 +393,7 @@ void NodeOperationBuilder::add_input_constant_value(NodeOperationInput *input, void NodeOperationBuilder::resolve_proxies() { Vector<Link> proxy_links; - for (const Link &link : m_links) { + for (const Link &link : links_) { /* don't replace links from proxy to proxy, since we may need them for replacing others! */ if (link.from()->getOperation().get_flags().is_proxy_operation && !link.to()->getOperation().get_flags().is_proxy_operation) { @@ -423,16 +423,16 @@ void NodeOperationBuilder::determine_canvases() { /* Determine all canvas areas of the operations. */ const rcti &preferred_area = COM_AREA_NONE; - for (NodeOperation *op : m_operations) { - if (op->isOutputOperation(m_context->isRendering()) && !op->get_flags().is_preview_operation) { + for (NodeOperation *op : operations_) { + if (op->isOutputOperation(context_->isRendering()) && !op->get_flags().is_preview_operation) { rcti canvas = COM_AREA_NONE; op->determine_canvas(preferred_area, canvas); op->set_canvas(canvas); } } - for (NodeOperation *op : m_operations) { - if (op->isOutputOperation(m_context->isRendering()) && op->get_flags().is_preview_operation) { + for (NodeOperation *op : operations_) { + if (op->isOutputOperation(context_->isRendering()) && op->get_flags().is_preview_operation) { rcti canvas = COM_AREA_NONE; op->determine_canvas(preferred_area, canvas); op->set_canvas(canvas); @@ -442,7 +442,7 @@ void NodeOperationBuilder::determine_canvases() /* Convert operation canvases when needed. */ { Vector<Link> convert_links; - for (const Link &link : m_links) { + for (const Link &link : links_) { if (link.to()->getResizeMode() != ResizeMode::None) { const rcti &from_canvas = link.from()->getOperation().get_canvas(); const rcti &to_canvas = link.to()->getOperation().get_canvas(); @@ -485,7 +485,7 @@ void NodeOperationBuilder::merge_equal_operations() bool check_for_next_merge = true; while (check_for_next_merge) { /* Re-generate hashes with any change. */ - Vector<NodeOperationHash> hashes = generate_hashes(m_operations); + Vector<NodeOperationHash> hashes = generate_hashes(operations_); /* Make hashes be consecutive when they are equal. */ std::sort(hashes.begin(), hashes.end()); @@ -507,7 +507,7 @@ void NodeOperationBuilder::merge_equal_operations() void NodeOperationBuilder::merge_equal_operations(NodeOperation *from, NodeOperation *into) { unlink_inputs_and_relink_outputs(from, into); - m_operations.remove_first_occurrence_and_reorder(from); + operations_.remove_first_occurrence_and_reorder(from); delete from; } @@ -515,7 +515,7 @@ Vector<NodeOperationInput *> NodeOperationBuilder::cache_output_links( NodeOperationOutput *output) const { Vector<NodeOperationInput *> inputs; - for (const Link &link : m_links) { + for (const Link &link : links_) { if (link.from() == output) { inputs.append(link.to()); } @@ -526,7 +526,7 @@ Vector<NodeOperationInput *> NodeOperationBuilder::cache_output_links( WriteBufferOperation *NodeOperationBuilder::find_attached_write_buffer_operation( NodeOperationOutput *output) const { - for (const Link &link : m_links) { + for (const Link &link : links_) { if (link.from() == output) { NodeOperation &op = link.to()->getOperation(); if (op.get_flags().is_write_buffer_operation) { @@ -557,7 +557,7 @@ void NodeOperationBuilder::add_input_buffers(NodeOperation * /*operation*/, WriteBufferOperation *writeoperation = find_attached_write_buffer_operation(output); if (!writeoperation) { writeoperation = new WriteBufferOperation(output->getDataType()); - writeoperation->setbNodeTree(m_context->getbNodeTree()); + writeoperation->setbNodeTree(context_->getbNodeTree()); addOperation(writeoperation); addLink(output, writeoperation->getInputSocket(0)); @@ -600,7 +600,7 @@ void NodeOperationBuilder::add_output_buffers(NodeOperation *operation, /* if no write buffer operation exists yet, create a new one */ if (!writeOperation) { writeOperation = new WriteBufferOperation(operation->getOutputSocket()->getDataType()); - writeOperation->setbNodeTree(m_context->getbNodeTree()); + writeOperation->setbNodeTree(context_->getbNodeTree()); addOperation(writeOperation); addLink(output, writeOperation->getInputSocket(0)); @@ -628,10 +628,10 @@ void NodeOperationBuilder::add_output_buffers(NodeOperation *operation, void NodeOperationBuilder::add_complex_operation_buffers() { /* NOTE: complex ops and get cached here first, since adding operations - * will invalidate iterators over the main m_operations + * will invalidate iterators over the main operations_ */ Vector<NodeOperation *> complex_ops; - for (NodeOperation *operation : m_operations) { + for (NodeOperation *operation : operations_) { if (operation->get_flags().complex) { complex_ops.append(operation); } @@ -677,16 +677,16 @@ static void find_reachable_operations_recursive(Tags &reachable, NodeOperation * void NodeOperationBuilder::prune_operations() { Tags reachable; - for (NodeOperation *op : m_operations) { + for (NodeOperation *op : operations_) { /* output operations are primary executed operations */ - if (op->isOutputOperation(m_context->isRendering())) { + if (op->isOutputOperation(context_->isRendering())) { find_reachable_operations_recursive(reachable, op); } } /* delete unreachable operations */ Vector<NodeOperation *> reachable_ops; - for (NodeOperation *op : m_operations) { + for (NodeOperation *op : operations_) { if (reachable.find(op) != reachable.end()) { reachable_ops.append(op); } @@ -695,7 +695,7 @@ void NodeOperationBuilder::prune_operations() } } /* finally replace the operations list with the pruned list */ - m_operations = reachable_ops; + operations_ = reachable_ops; } /* topological (depth-first) sorting of operations */ @@ -721,14 +721,14 @@ static void sort_operations_recursive(Vector<NodeOperation *> &sorted, void NodeOperationBuilder::sort_operations() { Vector<NodeOperation *> sorted; - sorted.reserve(m_operations.size()); + sorted.reserve(operations_.size()); Tags visited; - for (NodeOperation *operation : m_operations) { + for (NodeOperation *operation : operations_) { sort_operations_recursive(sorted, visited, operation); } - m_operations = sorted; + operations_ = sorted; } static void add_group_operations_recursive(Tags &visited, NodeOperation *op, ExecutionGroup *group) @@ -753,8 +753,8 @@ static void add_group_operations_recursive(Tags &visited, NodeOperation *op, Exe ExecutionGroup *NodeOperationBuilder::make_group(NodeOperation *op) { - ExecutionGroup *group = new ExecutionGroup(m_groups.size()); - m_groups.append(group); + ExecutionGroup *group = new ExecutionGroup(groups_.size()); + groups_.append(group); Tags visited; add_group_operations_recursive(visited, op, group); @@ -764,8 +764,8 @@ ExecutionGroup *NodeOperationBuilder::make_group(NodeOperation *op) void NodeOperationBuilder::group_operations() { - for (NodeOperation *op : m_operations) { - if (op->isOutputOperation(m_context->isRendering())) { + for (NodeOperation *op : operations_) { + if (op->isOutputOperation(context_->isRendering())) { ExecutionGroup *group = make_group(op); group->setOutputExecutionGroup(true); } @@ -786,7 +786,7 @@ void NodeOperationBuilder::group_operations() void NodeOperationBuilder::save_graphviz(StringRefNull name) { if (COM_EXPORT_GRAPHVIZ) { - exec_system_->set_operations(m_operations, m_groups); + exec_system_->set_operations(operations_, groups_); DebugInfo::graphviz(exec_system_, name); } } diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.h b/source/blender/compositor/intern/COM_NodeOperationBuilder.h index a6a6201bbb5..21e2f4ce95d 100644 --- a/source/blender/compositor/intern/COM_NodeOperationBuilder.h +++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.h @@ -46,45 +46,45 @@ class NodeOperationBuilder { public: class Link { private: - NodeOperationOutput *m_from; - NodeOperationInput *m_to; + NodeOperationOutput *from_; + NodeOperationInput *to_; public: - Link(NodeOperationOutput *from, NodeOperationInput *to) : m_from(from), m_to(to) + Link(NodeOperationOutput *from, NodeOperationInput *to) : from_(from), to_(to) { } NodeOperationOutput *from() const { - return m_from; + return from_; } NodeOperationInput *to() const { - return m_to; + return to_; } }; private: - const CompositorContext *m_context; - NodeGraph m_graph; + const CompositorContext *context_; + NodeGraph graph_; ExecutionSystem *exec_system_; - Vector<NodeOperation *> m_operations; - Vector<Link> m_links; - Vector<ExecutionGroup *> m_groups; + Vector<NodeOperation *> operations_; + Vector<Link> links_; + Vector<ExecutionGroup *> groups_; /** Maps operation inputs to node inputs */ - Map<NodeOperationInput *, NodeInput *> m_input_map; + Map<NodeOperationInput *, NodeInput *> input_map_; /** Maps node outputs to operation outputs */ - Map<NodeOutput *, NodeOperationOutput *> m_output_map; + Map<NodeOutput *, NodeOperationOutput *> output_map_; - Node *m_current_node; + Node *current_node_; /** Operation that will be writing to the viewer image * Only one operation can occupy this place at a time, * to avoid race conditions */ - ViewerOperation *m_active_viewer; + ViewerOperation *active_viewer_; public: NodeOperationBuilder(const CompositorContext *context, @@ -93,7 +93,7 @@ class NodeOperationBuilder { const CompositorContext &context() const { - return *m_context; + return *context_; } void convertToOperations(ExecutionSystem *system); @@ -120,17 +120,17 @@ class NodeOperationBuilder { /** The currently active viewer output operation */ ViewerOperation *active_viewer() const { - return m_active_viewer; + return active_viewer_; } const Vector<NodeOperation *> &get_operations() const { - return m_operations; + return operations_; } const Vector<Link> &get_links() const { - return m_links; + return links_; } protected: diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cc b/source/blender/compositor/intern/COM_OpenCLDevice.cc index 0b52d92e92d..af55890cba7 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.cc +++ b/source/blender/compositor/intern/COM_OpenCLDevice.cc @@ -42,30 +42,30 @@ OpenCLDevice::OpenCLDevice(cl_context context, cl_program program, cl_int vendorId) { - m_device = device; - m_context = context; - m_program = program; - m_queue = nullptr; - m_vendorID = vendorId; + device_ = device; + context_ = context; + program_ = program; + queue_ = nullptr; + vendorID_ = vendorId; cl_int error; - m_queue = clCreateCommandQueue(m_context, m_device, 0, &error); + queue_ = clCreateCommandQueue(context_, device_, 0, &error); } OpenCLDevice::OpenCLDevice(OpenCLDevice &&other) noexcept - : m_context(other.m_context), - m_device(other.m_device), - m_program(other.m_program), - m_queue(other.m_queue), - m_vendorID(other.m_vendorID) + : context_(other.context_), + device_(other.device_), + program_(other.program_), + queue_(other.queue_), + vendorID_(other.vendorID_) { - other.m_queue = nullptr; + other.queue_ = nullptr; } OpenCLDevice::~OpenCLDevice() { - if (m_queue) { - clReleaseCommandQueue(m_queue); + if (queue_) { + clReleaseCommandQueue(queue_); } } @@ -131,7 +131,7 @@ cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, const cl_image_format *imageFormat = determineImageFormat(result); - cl_mem clBuffer = clCreateImage2D(m_context, + cl_mem clBuffer = clCreateImage2D(context_, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, imageFormat, result->getWidth(), @@ -206,7 +206,7 @@ void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemo (size_t)outputMemoryBuffer->getHeight(), }; - error = clEnqueueNDRangeKernel(m_queue, kernel, 2, nullptr, size, nullptr, 0, nullptr, nullptr); + error = clEnqueueNDRangeKernel(queue_, kernel, 2, nullptr, size, nullptr, 0, nullptr, nullptr); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } @@ -226,7 +226,7 @@ void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, size_t size[2]; cl_int2 offset; - if (m_vendorID == NVIDIA) { + if (vendorID_ == NVIDIA) { localSize = 32; } @@ -254,11 +254,11 @@ void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } error = clEnqueueNDRangeKernel( - m_queue, kernel, 2, nullptr, size, nullptr, 0, nullptr, nullptr); + queue_, kernel, 2, nullptr, size, nullptr, 0, nullptr, nullptr); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } - clFlush(m_queue); + clFlush(queue_); if (operation->isBraked()) { breaked = false; } @@ -270,7 +270,7 @@ cl_kernel OpenCLDevice::COM_clCreateKernel(const char *kernelname, std::list<cl_kernel> *clKernelsToCleanUp) { cl_int error; - cl_kernel kernel = clCreateKernel(m_program, kernelname, &error); + cl_kernel kernel = clCreateKernel(program_, kernelname, &error); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.h b/source/blender/compositor/intern/COM_OpenCLDevice.h index 9c72fa31d95..ca5a95f4a48 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.h +++ b/source/blender/compositor/intern/COM_OpenCLDevice.h @@ -43,27 +43,27 @@ class OpenCLDevice : public Device { /** * \brief opencl context */ - cl_context m_context; + cl_context context_; /** * \brief opencl device */ - cl_device_id m_device; + cl_device_id device_; /** * \brief opencl program */ - cl_program m_program; + cl_program program_; /** * \brief opencl command queue */ - cl_command_queue m_queue; + cl_command_queue queue_; /** * \brief opencl vendor ID */ - cl_int m_vendorID; + cl_int vendorID_; public: /** @@ -93,12 +93,12 @@ class OpenCLDevice : public Device { cl_context getContext() { - return m_context; + return context_; } cl_command_queue getQueue() { - return m_queue; + return queue_; } cl_mem COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, diff --git a/source/blender/compositor/intern/COM_SingleThreadedOperation.cc b/source/blender/compositor/intern/COM_SingleThreadedOperation.cc index 7d7ae0ab155..83e3f033b32 100644 --- a/source/blender/compositor/intern/COM_SingleThreadedOperation.cc +++ b/source/blender/compositor/intern/COM_SingleThreadedOperation.cc @@ -22,7 +22,7 @@ namespace blender::compositor { SingleThreadedOperation::SingleThreadedOperation() { - m_cachedInstance = nullptr; + cachedInstance_ = nullptr; flags.complex = true; flags.single_threaded = true; } @@ -34,30 +34,30 @@ void SingleThreadedOperation::initExecution() void SingleThreadedOperation::executePixel(float output[4], int x, int y, void * /*data*/) { - m_cachedInstance->readNoCheck(output, x, y); + cachedInstance_->readNoCheck(output, x, y); } void SingleThreadedOperation::deinitExecution() { deinitMutex(); - if (m_cachedInstance) { - delete m_cachedInstance; - m_cachedInstance = nullptr; + if (cachedInstance_) { + delete cachedInstance_; + cachedInstance_ = nullptr; } } void *SingleThreadedOperation::initializeTileData(rcti *rect) { - if (m_cachedInstance) { - return m_cachedInstance; + if (cachedInstance_) { + return cachedInstance_; } lockMutex(); - if (m_cachedInstance == nullptr) { + if (cachedInstance_ == nullptr) { // - m_cachedInstance = createMemoryBuffer(rect); + cachedInstance_ = createMemoryBuffer(rect); } unlockMutex(); - return m_cachedInstance; + return cachedInstance_; } } // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_SingleThreadedOperation.h b/source/blender/compositor/intern/COM_SingleThreadedOperation.h index ac81b495d6f..3f90ce96e00 100644 --- a/source/blender/compositor/intern/COM_SingleThreadedOperation.h +++ b/source/blender/compositor/intern/COM_SingleThreadedOperation.h @@ -24,12 +24,12 @@ namespace blender::compositor { class SingleThreadedOperation : public NodeOperation { private: - MemoryBuffer *m_cachedInstance; + MemoryBuffer *cachedInstance_; protected: inline bool isCached() { - return m_cachedInstance != nullptr; + return cachedInstance_ != nullptr; } public: |