Compositor: Make GPU compositor an official feature

Effectively, make GPU compositor available without need to enable
an experimental feature set.

The compositor device is now exposed in the Performance panel of
Render Buttons. It is also still available in the compositor's
N-panel, together with some other options which are more about how
editing works, and not exactly related to render performance.

Pull Request: https://projects.blender.org/blender/blender/pulls/121398
This commit is contained in:
Sergey Sharybin 2024-05-14 15:49:20 +02:00 committed by Sergey Sharybin
parent 5d7e785fdd
commit 727a90a0f1
11 changed files with 37 additions and 29 deletions

View File

@ -12,7 +12,7 @@ from bl_ui.utils import PresetPanel
from bpy.types import Panel, Menu
from bl_ui.properties_grease_pencil_common import GreasePencilSimplifyPanel
from bl_ui.properties_render import draw_curves_settings
from bl_ui.properties_render import draw_curves_settings, CompositorPerformanceButtonsPanel
from bl_ui.properties_view_layer import ViewLayerCryptomattePanel, ViewLayerAOVPanel, ViewLayerLightgroupsPanel
@ -769,6 +769,11 @@ class CYCLES_RENDER_PT_performance(CyclesButtonsPanel, Panel):
pass
class CYCLES_RENDER_PT_performance_compositor(CyclesButtonsPanel, CompositorPerformanceButtonsPanel, Panel):
bl_parent_id = "CYCLES_RENDER_PT_performance"
bl_options = {'DEFAULT_CLOSED'}
class CYCLES_RENDER_PT_performance_threads(CyclesButtonsPanel, Panel):
bl_label = "Threads"
bl_parent_id = "CYCLES_RENDER_PT_performance"
@ -2559,6 +2564,7 @@ classes = (
CYCLES_RENDER_PT_film_pixel_filter,
CYCLES_RENDER_PT_film_transparency,
CYCLES_RENDER_PT_performance,
CYCLES_RENDER_PT_performance_compositor,
CYCLES_RENDER_PT_performance_threads,
CYCLES_RENDER_PT_performance_memory,
CYCLES_RENDER_PT_performance_acceleration_structure,

View File

@ -1067,6 +1067,29 @@ class RENDER_PT_eevee_performance(RenderButtonsPanel, Panel):
layout.prop(rd, "use_high_quality_normals")
class CompositorPerformanceButtonsPanel:
bl_label = "Compositor"
def draw(self, context):
layout = self.layout
scene = context.scene
rd = scene.render
layout.use_property_split = True
layout.use_property_decorate = False
col = layout.column()
row = col.row()
row.prop(rd, "compositor_device", text="Device", expand=True)
col.prop(rd, "compositor_precision", text="Precision")
class RENDER_PT_eevee_performance_compositor(RenderButtonsPanel, CompositorPerformanceButtonsPanel, Panel):
bl_options = {'DEFAULT_CLOSED'}
bl_parent_id = "RENDER_PT_eevee_performance"
COMPAT_ENGINES = {'BLENDER_EEVEE', 'BLENDER_EEVEE_NEXT', 'BLENDER_WORKBENCH'}
class RENDER_PT_eevee_performance_memory(RenderButtonsPanel, Panel):
bl_label = "Memory"
bl_parent_id = "RENDER_PT_eevee_performance"
@ -1359,6 +1382,7 @@ classes = (
RENDER_PT_eevee_performance,
RENDER_PT_eevee_performance_memory,
RENDER_PT_eevee_performance_viewport,
RENDER_PT_eevee_performance_compositor,
RENDER_PT_gpencil,

View File

@ -835,11 +835,9 @@ class NODE_PT_quality(bpy.types.Panel):
snode = context.space_data
tree = snode.node_tree
prefs = bpy.context.preferences
col = layout.column()
if prefs.experimental.use_experimental_compositors:
col.prop(rd, "compositor_device", text="Device")
col.prop(rd, "compositor_device", text="Device")
col.prop(rd, "compositor_precision", text="Precision")
col = layout.column()

View File

@ -2717,7 +2717,6 @@ class USERPREF_PT_experimental_prototypes(ExperimentalPanel, Panel):
({"property": "use_new_curves_tools"}, ("blender/blender/issues/68981", "#68981")),
({"property": "use_new_point_cloud_type"}, ("blender/blender/issues/75717", "#75717")),
({"property": "use_sculpt_texture_paint"}, ("blender/blender/issues/96225", "#96225")),
({"property": "use_experimental_compositors"}, ("blender/blender/issues/88150", "#88150")),
({"property": "use_grease_pencil_version3"}, ("blender/blender/projects/6", "Grease Pencil 3.0")),
({"property": "use_grease_pencil_version3_convert_on_load"}, ("blender/blender/projects/6", "Grease Pencil 3.0")),
({"property": "enable_overlay_next"}, ("blender/blender/issues/102179", "#102179")),

View File

@ -77,9 +77,7 @@ void COM_execute(Render *render,
compositor_init_node_previews(render_data, node_tree);
compositor_reset_node_tree_status(node_tree);
if (U.experimental.use_full_frame_compositor &&
scene->r.compositor_device == SCE_COMPOSITOR_DEVICE_GPU)
{
if (scene->r.compositor_device == SCE_COMPOSITOR_DEVICE_GPU) {
/* GPU compositor. */
RE_compositor_execute(*render, *scene, *render_data, *node_tree, view_name, render_context);
}

View File

@ -4459,9 +4459,7 @@ static bool realtime_compositor_is_in_use(const bContext &context)
return false;
}
if (U.experimental.use_full_frame_compositor &&
scene->r.compositor_device == SCE_COMPOSITOR_DEVICE_GPU)
{
if (scene->r.compositor_device == SCE_COMPOSITOR_DEVICE_GPU) {
return true;
}

View File

@ -348,9 +348,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->r.compositor_device != SCE_COMPOSITOR_DEVICE_GPU)
{
if (scene->r.compositor_device != SCE_COMPOSITOR_DEVICE_GPU) {
return true;
}

View File

@ -725,7 +725,6 @@ typedef struct UserDef_Experimental {
* when the release cycle is not alpha. */
char use_new_curves_tools;
char use_new_point_cloud_type;
char use_full_frame_compositor;
char use_sculpt_tools_tilt;
char use_extended_asset_browser;
char use_sculpt_texture_paint;
@ -737,7 +736,7 @@ typedef struct UserDef_Experimental {
char use_extension_utils;
char use_grease_pencil_version3_convert_on_load;
char use_animation_baklava;
char _pad[1];
char _pad[2];
/** `makesdna` does not allow empty structs. */
} UserDef_Experimental;

View File

@ -7156,15 +7156,6 @@ static void rna_def_userdef_experimental(BlenderRNA *brna)
RNA_def_property_ui_text(
prop, "New Point Cloud Type", "Enable the new point cloud type in the ui");
prop = RNA_def_property(srna, "use_experimental_compositors", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "use_full_frame_compositor", 1);
RNA_def_property_ui_text(
prop,
"Experimental Compositors",
"Enable compositor full frame and realtime GPU execution mode options (no tiling, "
"reduces execution time and memory usage)");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "use_new_curves_tools", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, nullptr, "use_new_curves_tools", 1);
RNA_def_property_ui_text(

View File

@ -1691,9 +1691,7 @@ static int check_compositor_output(Scene *scene)
static bool is_compositing_possible_on_gpu(Scene *scene, ReportList *reports)
{
/* CPU compositor can always run. */
if (!U.experimental.use_full_frame_compositor ||
scene->r.compositor_device != SCE_COMPOSITOR_DEVICE_GPU)
{
if (scene->r.compositor_device != SCE_COMPOSITOR_DEVICE_GPU) {
return true;
}

View File

@ -16,7 +16,6 @@ except ImportError:
inside_blender = False
ENABLE_REALTIME_COMPOSITOR_SCRIPT = "import bpy; " \
"bpy.context.preferences.experimental.use_experimental_compositors = True; " \
"bpy.data.scenes[0].render.compositor_device = 'GPU'"