Compositor: Switch CPU compositor to Full-Frame #118010

Merged
Omar Emara merged 3 commits from Sergey/blender:compositor_fullframe_default into main 2024-02-14 14:24:00 +01:00
14 changed files with 38 additions and 128 deletions

View File

@ -262,7 +262,6 @@ url_manual_mapping = (
("bpy.types.clothsettings.compression_stiffness_max*", "physics/cloth/settings/property_weights.html#bpy-types-clothsettings-compression-stiffness-max"),
("bpy.types.colormanagedsequencercolorspacesettings*", "render/color_management.html#bpy-types-colormanagedsequencercolorspacesettings"),
("bpy.types.colormanagedviewsettings.view_transform*", "render/color_management.html#bpy-types-colormanagedviewsettings-view-transform"),
("bpy.types.compositornodetree.use_groupnode_buffer*", "compositing/sidebar.html#bpy-types-compositornodetree-use-groupnode-buffer"),
("bpy.types.cyclesmaterialsettings.volume_step_rate*", "render/cycles/material_settings.html#bpy-types-cyclesmaterialsettings-volume-step-rate"),
("bpy.types.cyclesobjectsettings.is_caustics_caster*", "render/cycles/object_settings/object_data.html#bpy-types-cyclesobjectsettings-is-caustics-caster"),
("bpy.types.cyclesrendersettings.adaptive_threshold*", "render/cycles/render_settings/sampling.html#bpy-types-cyclesrendersettings-adaptive-threshold"),
@ -1023,7 +1022,6 @@ url_manual_mapping = (
("bpy.types.compositornodecolorcorrection*", "compositing/types/color/adjust/color_correction.html#bpy-types-compositornodecolorcorrection"),
("bpy.types.compositornodemoviedistortion*", "compositing/types/transform/movie_distortion.html#bpy-types-compositornodemoviedistortion"),
("bpy.types.compositornodetree.chunk_size*", "compositing/sidebar.html#bpy-types-compositornodetree-chunk-size"),
("bpy.types.compositornodetree.use_opencl*", "compositing/sidebar.html#bpy-types-compositornodetree-use-opencl"),
("bpy.types.cyclesrendersettings.caustics*", "render/cycles/render_settings/light_paths.html#bpy-types-cyclesrendersettings-caustics"),
("bpy.types.cyclesrendersettings.denoiser*", "render/cycles/render_settings/sampling.html#bpy-types-cyclesrendersettings-denoiser"),
("bpy.types.editbone.use_inherit_rotation*", "animation/armatures/bones/properties/relations.html#bpy-types-editbone-use-inherit-rotation"),

View File

@ -818,12 +818,9 @@ class NODE_PT_quality(bpy.types.Panel):
col.active = not use_realtime
col.prop(tree, "render_quality", text="Render")
col.prop(tree, "edit_quality", text="Edit")
col.prop(tree, "chunk_size")
col = layout.column()
col.active = not use_realtime
col.prop(tree, "use_opencl")
col.prop(tree, "use_groupnode_buffer")
col.prop(tree, "use_two_pass")
col.prop(tree, "use_viewer_border")

View File

@ -29,7 +29,7 @@ extern "C" {
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 2
#define BLENDER_FILE_SUBVERSION 3
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and cancel loading the file, showing a warning to

View File

@ -1733,14 +1733,6 @@ void blo_do_versions_260(FileData *fd, Library * /*lib*/, Main *bmain)
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 263, 10)) {
{
/* composite redesign */
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
if (scene->nodetree) {
if (scene->nodetree->chunksize == 0) {
scene->nodetree->chunksize = 256;
}
}
}
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
if (ntree->type == NTREE_COMPOSIT) {
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {

View File

@ -2926,6 +2926,26 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
}
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 402, 3)) {
constexpr int NTREE_EXECUTION_MODE_FULL_FRAME = 1;
constexpr int NTREE_COM_GROUPNODE_BUFFER = 1 << 3;
constexpr int NTREE_COM_OPENCL = 1 << 1;
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
if (ntree->type != NTREE_COMPOSIT) {
continue;
}
ntree->flag &= ~(NTREE_COM_GROUPNODE_BUFFER | NTREE_COM_OPENCL);
if (ntree->execution_mode == NTREE_EXECUTION_MODE_FULL_FRAME) {
ntree->execution_mode = NTREE_EXECUTION_MODE_CPU;
}
}
FOREACH_NODETREE_END;
}
/**
* Always bump subversion in BKE_blender_version.h when adding versioning
* code here, and wrap it inside a MAIN_VERSION_FILE_ATLEAST check.

View File

@ -30,18 +30,7 @@ Size2f CompositorContext::get_render_size() const
eExecutionModel CompositorContext::get_execution_model() const
{
if (U.experimental.use_full_frame_compositor) {
BLI_assert(bnodetree_ != nullptr);
switch (bnodetree_->execution_mode) {
case 1:
return eExecutionModel::FullFrame;
case 0:
return eExecutionModel::Tiled;
default:
BLI_assert_msg(0, "Invalid execution mode");
}
}
return eExecutionModel::Tiled;
return eExecutionModel::FullFrame;
}
} // namespace blender::compositor

View File

@ -236,7 +236,7 @@ class CompositorContext {
int get_chunksize() const
{
return this->get_bnodetree()->chunksize;
return 256;
}
void set_fast_calculation(bool fast_calculation)
@ -249,7 +249,7 @@ class CompositorContext {
}
bool is_groupnode_buffer_enabled() const
{
return (this->get_bnodetree()->flag & NTREE_COM_GROUPNODE_BUFFER) != 0;
return false;
}
/**

View File

@ -44,8 +44,7 @@ ExecutionSystem::ExecutionSystem(RenderData *rd,
context_.set_quality((eCompositorQuality)editingtree->edit_quality);
}
context_.set_rendering(rendering);
context_.setHasActiveOpenCLDevices(WorkScheduler::has_gpu_devices() &&
(editingtree->flag & NTREE_COM_OPENCL));
context_.setHasActiveOpenCLDevices(WorkScheduler::has_gpu_devices() && false);
context_.set_render_data(rd);

View File

@ -79,19 +79,17 @@ void COM_execute(Render *render,
compositor_reset_node_tree_status(node_tree);
if (U.experimental.use_full_frame_compositor &&
node_tree->execution_mode == NTREE_EXECUTION_MODE_REALTIME)
node_tree->execution_mode == NTREE_EXECUTION_MODE_GPU)
{
/* Realtime GPU compositor. */
/* GPU compositor. */
RE_compositor_execute(
*render, *scene, *render_data, *node_tree, rendering, view_name, render_context);
}
else {
/* Tiled and Full Frame compositors. */
/* CPU compositor. */
/* Initialize workscheduler. */
const bool use_opencl = (node_tree->flag & NTREE_COM_OPENCL) != 0;
blender::compositor::WorkScheduler::initialize(use_opencl,
BKE_render_num_threads(render_data));
blender::compositor::WorkScheduler::initialize(false, BKE_render_num_threads(render_data));
/* Execute. */
const bool twopass = (node_tree->flag & NTREE_TWO_PASS) && !rendering;

View File

@ -4198,7 +4198,7 @@ static bool realtime_compositor_is_in_use(const bContext &context)
}
if (U.experimental.use_full_frame_compositor &&
scene->nodetree->execution_mode == NTREE_EXECUTION_MODE_REALTIME)
scene->nodetree->execution_mode == NTREE_EXECUTION_MODE_GPU)
{
return true;
}

View File

@ -363,7 +363,7 @@ static bool is_compositing_possible(const bContext *C)
Scene *scene = CTX_data_scene(C);
/* CPU compositor can always run. */
if (!U.experimental.use_full_frame_compositor ||
scene->nodetree->execution_mode != NTREE_EXECUTION_MODE_REALTIME)
scene->nodetree->execution_mode != NTREE_EXECUTION_MODE_GPU)
{
return true;
}
@ -639,7 +639,6 @@ void ED_node_composit_default(const bContext *C, Scene *sce)
sce->nodetree = blender::bke::ntreeAddTreeEmbedded(
nullptr, &sce->id, "Compositing Nodetree", ntreeType_Composite->idname);
sce->nodetree->chunksize = 256;
sce->nodetree->edit_quality = NTREE_QUALITY_HIGH;
sce->nodetree->render_quality = NTREE_QUALITY_HIGH;

View File

@ -618,16 +618,6 @@ enum {
NTREE_QUALITY_LOW = 2,
};
/** #bNodeTree::chunksize */
enum {
NTREE_CHUNKSIZE_32 = 32,
NTREE_CHUNKSIZE_64 = 64,
NTREE_CHUNKSIZE_128 = 128,
NTREE_CHUNKSIZE_256 = 256,
NTREE_CHUNKSIZE_512 = 512,
NTREE_CHUNKSIZE_1024 = 1024,
};
typedef struct bNestedNodePath {
/** ID of the node that is or contains the nested node. */
int32_t node_id;
@ -688,15 +678,11 @@ typedef struct bNodeTree {
short edit_quality;
/** Quality setting when rendering. */
short render_quality;
/** Tile size for compositor engine. */
int chunksize;
/** Execution mode to use for compositor engine. */
int execution_mode;
/** Execution mode to use for compositor engine. */
int precision;
char _pad[4];
rctf viewer_border;
/**
@ -841,12 +827,8 @@ enum {
enum {
/** For animation editors. */
NTREE_DS_EXPAND = 1 << 0,
/** Use OPENCL. */
NTREE_COM_OPENCL = 1 << 1,
/** Two pass. */
NTREE_TWO_PASS = 1 << 2,
/** Use group-node buffers. */
NTREE_COM_GROUPNODE_BUFFER = 1 << 3,
/** Use a border for viewer nodes. */
NTREE_VIEWER_BORDER = 1 << 4,
/**
@ -858,9 +840,8 @@ enum {
/* tree->execution_mode */
typedef enum eNodeTreeExecutionMode {
NTREE_EXECUTION_MODE_TILED = 0,
NTREE_EXECUTION_MODE_FULL_FRAME = 1,
NTREE_EXECUTION_MODE_REALTIME = 2,
NTREE_EXECUTION_MODE_CPU = 0,
NTREE_EXECUTION_MODE_GPU = 2,
} eNodeTreeExecutionMode;
/* tree->precision */

View File

@ -96,58 +96,11 @@ static const EnumPropertyItem node_quality_items[] = {
{NTREE_QUALITY_LOW, "LOW", 0, "Low", "Low quality"},
{0, nullptr, 0, nullptr, nullptr},
};
static const EnumPropertyItem node_chunksize_items[] = {
{NTREE_CHUNKSIZE_32,
"32",
0,
"32" BLI_STR_UTF8_MULTIPLICATION_SIGN "32",
"Chunksize of 32" BLI_STR_UTF8_MULTIPLICATION_SIGN "32"},
{NTREE_CHUNKSIZE_64,
"64",
0,
"64" BLI_STR_UTF8_MULTIPLICATION_SIGN "64",
"Chunksize of 64" BLI_STR_UTF8_MULTIPLICATION_SIGN "64"},
{NTREE_CHUNKSIZE_128,
"128",
0,
"128" BLI_STR_UTF8_MULTIPLICATION_SIGN "128",
"Chunksize of 128" BLI_STR_UTF8_MULTIPLICATION_SIGN "128"},
{NTREE_CHUNKSIZE_256,
"256",
0,
"256" BLI_STR_UTF8_MULTIPLICATION_SIGN "256",
"Chunksize of 256" BLI_STR_UTF8_MULTIPLICATION_SIGN "256"},
{NTREE_CHUNKSIZE_512,
"512",
0,
"512" BLI_STR_UTF8_MULTIPLICATION_SIGN "512",
"Chunksize of 512" BLI_STR_UTF8_MULTIPLICATION_SIGN "512"},
{NTREE_CHUNKSIZE_1024,
"1024",
0,
"1024" BLI_STR_UTF8_MULTIPLICATION_SIGN "1024",
"Chunksize of 1024" BLI_STR_UTF8_MULTIPLICATION_SIGN "1024"},
{0, nullptr, 0, nullptr, nullptr},
};
#endif
static const EnumPropertyItem rna_enum_execution_mode_items[] = {
{NTREE_EXECUTION_MODE_TILED,
"TILED",
0,
"Tiled",
"Compositing is tiled, having as priority to display first tiles as fast as possible"},
{NTREE_EXECUTION_MODE_FULL_FRAME,
"FULL_FRAME",
0,
"Full Frame",
"Composites full image result as fast as possible"},
{NTREE_EXECUTION_MODE_REALTIME,
"REALTIME",
0,
"GPU",
"Use GPU accelerated compositing with more limited functionality"},
{NTREE_EXECUTION_MODE_CPU, "CPU", 0, "CPU", ""},
{NTREE_EXECUTION_MODE_GPU, "GPU", 0, "GPU", ""},
{0, nullptr, 0, nullptr, nullptr},
};
@ -10610,22 +10563,6 @@ static void rna_def_composite_nodetree(BlenderRNA *brna)
RNA_def_property_enum_items(prop, node_quality_items);
RNA_def_property_ui_text(prop, "Edit Quality", "Quality when editing");
prop = RNA_def_property(srna, "chunk_size", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, nullptr, "chunksize");
RNA_def_property_enum_items(prop, node_chunksize_items);
RNA_def_property_ui_text(prop,
"Chunksize",
"Max size of a tile (smaller values gives better distribution "
"of multiple threads, but more overhead)");
prop = RNA_def_property(srna, "use_opencl", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", NTREE_COM_OPENCL);
RNA_def_property_ui_text(prop, "OpenCL", "Enable GPU calculations");
prop = RNA_def_property(srna, "use_groupnode_buffer", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", NTREE_COM_GROUPNODE_BUFFER);
RNA_def_property_ui_text(prop, "Buffer Groups", "Enable buffering of group nodes");
prop = RNA_def_property(srna, "use_two_pass", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "flag", NTREE_TWO_PASS);
RNA_def_property_ui_text(prop,

View File

@ -667,10 +667,10 @@ void RE_FreeUnusedGPUResources()
break;
}
/* Detect if scene is using realtime compositing, and if either a node editor is
/* Detect if scene is using GPU compositing, and if either a node editor is
* showing the nodes, or an image editor is showing the render result or viewer. */
if (!(scene->use_nodes && scene->nodetree &&
scene->nodetree->execution_mode == NTREE_EXECUTION_MODE_REALTIME))
scene->nodetree->execution_mode == NTREE_EXECUTION_MODE_GPU))
{
continue;
}
@ -1679,7 +1679,7 @@ static bool is_compositing_possible_on_gpu(Scene *scene, ReportList *reports)
{
/* CPU compositor can always run. */
if (!U.experimental.use_full_frame_compositor ||
scene->nodetree->execution_mode != NTREE_EXECUTION_MODE_REALTIME)
scene->nodetree->execution_mode != NTREE_EXECUTION_MODE_GPU)
{
return true;
}