2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2011 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2012-06-13 12:34:56 +00:00
|
|
|
|
2018-08-08 11:49:51 +10:00
|
|
|
#pragma once
|
2020-08-07 09:50:34 +02:00
|
|
|
|
2012-06-13 12:34:56 +00:00
|
|
|
#include "COM_NodeOperation.h"
|
|
|
|
|
|
2021-03-23 17:12:27 +01:00
|
|
|
namespace blender::compositor {
|
|
|
|
|
|
2014-04-15 16:06:12 +02:00
|
|
|
class SingleThreadedOperation : public NodeOperation {
|
2012-06-13 12:34:56 +00:00
|
|
|
private:
|
2021-10-13 23:01:15 +02:00
|
|
|
MemoryBuffer *cached_instance_;
|
2018-06-17 17:05:29 +02:00
|
|
|
|
2012-06-13 12:34:56 +00:00
|
|
|
protected:
|
2021-10-13 23:01:15 +02:00
|
|
|
inline bool is_cached()
|
2012-06-13 12:34:56 +00:00
|
|
|
{
|
2021-10-13 23:01:15 +02:00
|
|
|
return cached_instance_ != nullptr;
|
2012-06-13 12:34:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public:
|
2014-04-15 16:06:12 +02:00
|
|
|
SingleThreadedOperation();
|
2018-06-17 17:05:29 +02:00
|
|
|
|
2012-06-13 12:34:56 +00:00
|
|
|
/**
|
2021-01-05 15:44:09 +01:00
|
|
|
* The inner loop of this operation.
|
2012-06-13 23:31:47 +00:00
|
|
|
*/
|
2021-10-13 23:01:15 +02:00
|
|
|
void execute_pixel(float output[4], int x, int y, void *data) override;
|
2018-06-17 17:05:29 +02:00
|
|
|
|
2012-06-13 12:34:56 +00:00
|
|
|
/**
|
2012-06-13 23:31:47 +00:00
|
|
|
* Initialize the execution
|
|
|
|
|
*/
|
2021-10-13 23:01:15 +02:00
|
|
|
void init_execution() override;
|
2018-06-17 17:05:29 +02:00
|
|
|
|
2012-06-13 12:34:56 +00:00
|
|
|
/**
|
2012-06-13 23:31:47 +00:00
|
|
|
* Deinitialize the execution
|
|
|
|
|
*/
|
2021-10-13 23:01:15 +02:00
|
|
|
void deinit_execution() override;
|
2012-06-13 12:34:56 +00:00
|
|
|
|
2021-10-13 23:01:15 +02:00
|
|
|
void *initialize_tile_data(rcti *rect) override;
|
2012-06-13 12:34:56 +00:00
|
|
|
|
2021-10-13 23:01:15 +02:00
|
|
|
virtual MemoryBuffer *create_memory_buffer(rcti *rect) = 0;
|
2012-06-13 12:34:56 +00:00
|
|
|
};
|
2021-03-23 17:12:27 +01:00
|
|
|
|
|
|
|
|
} // namespace blender::compositor
|