diff options
author | Brecht Van Lommel <brecht@blender.org> | 2019-05-10 22:39:58 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2020-05-15 21:25:24 +0300 |
commit | d9773edaa394f61393f9c8b80275e62f74306097 (patch) | |
tree | 232b771b341e98a5403af16791bdcca133cb1edd /source/blender/makesrna/intern/rna_render.c | |
parent | 3ff8ca60e94db2584ca76e323a54c738e677d5f8 (diff) |
Cycles: code refactor to bake using regular render session and tiles
There should be no user visible change from this, except that tile size
now affects performance. The goal here is to simplify bake denoising in
D3099, letting it reuse more denoising tiles and pass code.
A lot of code is now shared with regular rendering, with the two main
differences being that we read some render result passes from the bake API
when starting to render a tile, and call the bake kernel instead of the
path trace kernel.
With this kind of design where Cycles asks for tiles from the bake API,
it should eventually be easier to reduce memory usage, show tiles as
they are baked, or bake multiple passes at once, though there's still
quite some work needed for that.
Reviewers: #cycles
Subscribers: monio, wmatyjewicz, lukasstockner97, michaelknubben
Differential Revision: https://developer.blender.org/D3108
Diffstat (limited to 'source/blender/makesrna/intern/rna_render.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_render.c | 96 |
1 files changed, 6 insertions, 90 deletions
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 8322c7ad5f4..6c21e4ad01b 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -181,11 +181,8 @@ static void engine_bake(RenderEngine *engine, struct Object *object, const int pass_type, const int pass_filter, - const int object_id, - const struct BakePixel *pixel_array, - const int num_pixels, - const int depth, - void *result) + const int width, + const int height) { extern FunctionRNA rna_RenderEngine_bake_func; PointerRNA ptr; @@ -200,11 +197,8 @@ static void engine_bake(RenderEngine *engine, RNA_parameter_set_lookup(&list, "object", &object); RNA_parameter_set_lookup(&list, "pass_type", &pass_type); RNA_parameter_set_lookup(&list, "pass_filter", &pass_filter); - RNA_parameter_set_lookup(&list, "object_id", &object_id); - RNA_parameter_set_lookup(&list, "pixel_array", &pixel_array); - RNA_parameter_set_lookup(&list, "num_pixels", &num_pixels); - RNA_parameter_set_lookup(&list, "depth", &depth); - RNA_parameter_set_lookup(&list, "result", &result); + RNA_parameter_set_lookup(&list, "width", &width); + RNA_parameter_set_lookup(&list, "height", &height); engine->type->rna_ext.call(NULL, &ptr, func, &list); RNA_parameter_list_free(&list); @@ -461,12 +455,6 @@ void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values) memcpy(rpass->rect, values, sizeof(float) * rpass->rectx * rpass->recty * rpass->channels); } -static PointerRNA rna_BakePixel_next_get(PointerRNA *ptr) -{ - BakePixel *bp = ptr->data; - return rna_pointer_inherit_refine(ptr, &RNA_BakePixel, bp + 1); -} - static RenderPass *rna_RenderPass_find_by_type(RenderLayer *rl, int passtype, const char *view) { return RE_pass_find_by_type(rl, passtype, view); @@ -535,33 +523,9 @@ static void rna_def_render_engine(BlenderRNA *brna) 0, INT_MAX); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - parm = RNA_def_int(func, - "object_id", - 0, - 0, - INT_MAX, - "Object Id", - "Id of the current object being baked in relation to the others", - 0, - INT_MAX); - RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - parm = RNA_def_pointer(func, "pixel_array", "BakePixel", "", ""); - RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - parm = RNA_def_int(func, - "num_pixels", - 0, - 0, - INT_MAX, - "Number of Pixels", - "Size of the baking batch", - 0, - INT_MAX); - RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - parm = RNA_def_int( - func, "depth", 0, 0, INT_MAX, "Pixels depth", "Number of channels", 1, INT_MAX); + parm = RNA_def_int(func, "width", 0, 0, INT_MAX, "Width", "Image width", 0, INT_MAX); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); - /* TODO, see how array size of 0 works, this shouldnt be used */ - parm = RNA_def_pointer(func, "result", "AnyType", "", ""); + parm = RNA_def_int(func, "height", 0, 0, INT_MAX, "Height", "Image height", 0, INT_MAX); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* viewport render callbacks */ @@ -1119,53 +1083,6 @@ static void rna_def_render_pass(BlenderRNA *brna) RNA_define_verify_sdna(1); } -static void rna_def_render_bake_pixel(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - - srna = RNA_def_struct(brna, "BakePixel", NULL); - RNA_def_struct_ui_text(srna, "Bake Pixel", ""); - - RNA_define_verify_sdna(0); - - prop = RNA_def_property(srna, "primitive_id", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "primitive_id"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - - prop = RNA_def_property(srna, "object_id", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "object_id"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - - prop = RNA_def_property(srna, "uv", PROP_FLOAT, PROP_NONE); - RNA_def_property_array(prop, 2); - RNA_def_property_float_sdna(prop, NULL, "uv"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - - prop = RNA_def_property(srna, "du_dx", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "du_dx"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - - prop = RNA_def_property(srna, "du_dy", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "du_dy"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - - prop = RNA_def_property(srna, "dv_dx", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "dv_dx"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - - prop = RNA_def_property(srna, "dv_dy", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "dv_dy"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - - prop = RNA_def_property(srna, "next", PROP_POINTER, PROP_NONE); - RNA_def_property_struct_type(prop, "BakePixel"); - RNA_def_property_pointer_funcs(prop, "rna_BakePixel_next_get", NULL, NULL, NULL); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - - RNA_define_verify_sdna(1); -} - void RNA_def_render(BlenderRNA *brna) { rna_def_render_engine(brna); @@ -1173,7 +1090,6 @@ void RNA_def_render(BlenderRNA *brna) rna_def_render_view(brna); rna_def_render_layer(brna); rna_def_render_pass(brna); - rna_def_render_bake_pixel(brna); } #endif /* RNA_RUNTIME */ |