Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/film.cpp
| Show First 20 Lines • Show All 179 Lines • ▼ Show 20 Lines | void Film::device_update(Device *device, DeviceScene *dscene, Scene *scene) | ||||
| kfilm->display_pass_offset = PASS_UNUSED; | kfilm->display_pass_offset = PASS_UNUSED; | ||||
| kfilm->display_pass_denoised_offset = PASS_UNUSED; | kfilm->display_pass_denoised_offset = PASS_UNUSED; | ||||
| kfilm->show_active_pixels = show_active_pixels; | kfilm->show_active_pixels = show_active_pixels; | ||||
| kfilm->use_approximate_shadow_catcher = get_use_approximate_shadow_catcher(); | kfilm->use_approximate_shadow_catcher = get_use_approximate_shadow_catcher(); | ||||
| kfilm->light_pass_flag = 0; | kfilm->light_pass_flag = 0; | ||||
| kfilm->pass_stride = 0; | kfilm->pass_stride = 0; | ||||
| kfilm->use_light_pass = use_light_visibility; | kfilm->use_light_pass = use_light_visibility; | ||||
| kfilm->pass_aov_value_num = 0; | |||||
| kfilm->pass_aov_color_num = 0; | |||||
| /* Mark with PASS_UNUSED to avoid mask test in the kernel. */ | /* Mark with PASS_UNUSED to avoid mask test in the kernel. */ | ||||
| kfilm->pass_background = PASS_UNUSED; | kfilm->pass_background = PASS_UNUSED; | ||||
| kfilm->pass_emission = PASS_UNUSED; | kfilm->pass_emission = PASS_UNUSED; | ||||
| kfilm->pass_ao = PASS_UNUSED; | kfilm->pass_ao = PASS_UNUSED; | ||||
| kfilm->pass_diffuse_direct = PASS_UNUSED; | kfilm->pass_diffuse_direct = PASS_UNUSED; | ||||
| kfilm->pass_diffuse_indirect = PASS_UNUSED; | kfilm->pass_diffuse_indirect = PASS_UNUSED; | ||||
| kfilm->pass_glossy_direct = PASS_UNUSED; | kfilm->pass_glossy_direct = PASS_UNUSED; | ||||
| Show All 10 Lines | void Film::device_update(Device *device, DeviceScene *dscene, Scene *scene) | ||||
| kfilm->pass_denoising_normal = PASS_UNUSED; | kfilm->pass_denoising_normal = PASS_UNUSED; | ||||
| kfilm->pass_denoising_albedo = PASS_UNUSED; | kfilm->pass_denoising_albedo = PASS_UNUSED; | ||||
| kfilm->pass_sample_count = PASS_UNUSED; | kfilm->pass_sample_count = PASS_UNUSED; | ||||
| kfilm->pass_adaptive_aux_buffer = PASS_UNUSED; | kfilm->pass_adaptive_aux_buffer = PASS_UNUSED; | ||||
| kfilm->pass_shadow_catcher = PASS_UNUSED; | kfilm->pass_shadow_catcher = PASS_UNUSED; | ||||
| kfilm->pass_shadow_catcher_matte = PASS_UNUSED; | kfilm->pass_shadow_catcher_matte = PASS_UNUSED; | ||||
| bool have_cryptomatte = false; | bool have_cryptomatte = false; | ||||
| bool have_aov_color = false; | |||||
| bool have_aov_value = false; | |||||
| for (size_t i = 0; i < scene->passes.size(); i++) { | for (size_t i = 0; i < scene->passes.size(); i++) { | ||||
| Pass &pass = scene->passes[i]; | Pass &pass = scene->passes[i]; | ||||
| if (pass.type == PASS_NONE || !pass.is_written()) { | if (pass.type == PASS_NONE || !pass.is_written()) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | switch (pass.type) { | ||||
| case PASS_ADAPTIVE_AUX_BUFFER: | case PASS_ADAPTIVE_AUX_BUFFER: | ||||
| kfilm->pass_adaptive_aux_buffer = kfilm->pass_stride; | kfilm->pass_adaptive_aux_buffer = kfilm->pass_stride; | ||||
| break; | break; | ||||
| case PASS_SAMPLE_COUNT: | case PASS_SAMPLE_COUNT: | ||||
| kfilm->pass_sample_count = kfilm->pass_stride; | kfilm->pass_sample_count = kfilm->pass_stride; | ||||
| break; | break; | ||||
| case PASS_AOV_COLOR: | case PASS_AOV_COLOR: | ||||
| if (kfilm->pass_aov_color_num == 0) { | if (!have_aov_color) { | ||||
| kfilm->pass_aov_color = kfilm->pass_stride; | kfilm->pass_aov_color = kfilm->pass_stride; | ||||
| have_aov_color = true; | |||||
| } | } | ||||
| kfilm->pass_aov_color_num++; | |||||
| break; | break; | ||||
| case PASS_AOV_VALUE: | case PASS_AOV_VALUE: | ||||
| if (kfilm->pass_aov_value_num == 0) { | if (!have_aov_value) { | ||||
| kfilm->pass_aov_value = kfilm->pass_stride; | kfilm->pass_aov_value = kfilm->pass_stride; | ||||
| have_aov_value = true; | |||||
| } | } | ||||
| kfilm->pass_aov_value_num++; | |||||
| break; | break; | ||||
| default: | default: | ||||
| assert(false); | assert(false); | ||||
| break; | break; | ||||
| } | } | ||||
| if (&pass == display_pass) { | if (&pass == display_pass) { | ||||
| kfilm->display_pass_offset = kfilm->pass_stride; | kfilm->display_pass_offset = kfilm->pass_stride; | ||||
| } | } | ||||
| kfilm->pass_stride += pass.get_info().num_components; | kfilm->pass_stride += pass.get_info().num_components; | ||||
| } | } | ||||
| kfilm->pass_stride = align_up(kfilm->pass_stride, 4); | |||||
| /* When displaying the normal/uv pass in the viewport we need to disable | /* When displaying the normal/uv pass in the viewport we need to disable | ||||
| * transparency. | * transparency. | ||||
| * | * | ||||
| * We also don't need to perform light accumulations. Later we want to optimize this to suppress | * We also don't need to perform light accumulations. Later we want to optimize this to suppress | ||||
| * light calculations. */ | * light calculations. */ | ||||
| if (display_pass->type == PASS_NORMAL || display_pass->type == PASS_UV || | if (display_pass->type == PASS_NORMAL || display_pass->type == PASS_UV || | ||||
| display_pass->type == PASS_ROUGHNESS) { | display_pass->type == PASS_ROUGHNESS) { | ||||
| kfilm->use_light_pass = 0; | kfilm->use_light_pass = 0; | ||||
| Show All 39 Lines | else if (Pass::contains(scene->passes, PASS_AO) != Pass::contains(passes, PASS_AO)) { | ||||
| scene->integrator->tag_update(scene, Integrator::AO_PASS_MODIFIED); | scene->integrator->tag_update(scene, Integrator::AO_PASS_MODIFIED); | ||||
| } | } | ||||
| scene->passes = passes; | scene->passes = passes; | ||||
| } | } | ||||
| int Film::get_aov_offset(Scene *scene, string name, bool &is_color) | int Film::get_aov_offset(Scene *scene, string name, bool &is_color) | ||||
| { | { | ||||
| int num_color = 0, num_value = 0; | int offset_color = 0, offset_value = 0; | ||||
| foreach (const Pass &pass, scene->passes) { | foreach (const Pass &pass, scene->passes) { | ||||
| if (pass.type == PASS_AOV_COLOR) { | if (pass.name == name) { | ||||
| num_color++; | if (pass.type == PASS_AOV_VALUE) { | ||||
| is_color = false; | |||||
| return offset_value; | |||||
| } | } | ||||
| else if (pass.type == PASS_AOV_VALUE) { | else if (pass.type == PASS_AOV_COLOR) { | ||||
| num_value++; | is_color = true; | ||||
| return offset_color; | |||||
| } | } | ||||
| else { | |||||
| continue; | |||||
| } | } | ||||
| if (pass.name == name) { | if (pass.type == PASS_AOV_VALUE) { | ||||
| is_color = (pass.type == PASS_AOV_COLOR); | offset_value += pass.get_info().num_components; | ||||
| return (is_color ? num_color : num_value) - 1; | } | ||||
| else if (pass.type == PASS_AOV_COLOR) { | |||||
| offset_color += pass.get_info().num_components; | |||||
| } | } | ||||
| } | } | ||||
| return -1; | return -1; | ||||
| } | } | ||||
| const Pass *Film::get_actual_display_pass(Scene *scene, PassType pass_type, PassMode pass_mode) | const Pass *Film::get_actual_display_pass(Scene *scene, PassType pass_type, PassMode pass_mode) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines | |||||