Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/scene/svm.cpp
| Show First 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | void SVMShaderManager::device_update_specific(Device *device, | ||||
| int4 *svm_nodes = dscene->svm_nodes.alloc(svm_nodes_size); | int4 *svm_nodes = dscene->svm_nodes.alloc(svm_nodes_size); | ||||
| int node_offset = num_shaders; | int node_offset = num_shaders; | ||||
| for (int i = 0; i < num_shaders; i++) { | for (int i = 0; i < num_shaders; i++) { | ||||
| Shader *shader = scene->shaders[i]; | Shader *shader = scene->shaders[i]; | ||||
| shader->clear_modified(); | shader->clear_modified(); | ||||
| if (shader->get_use_mis() && shader->has_surface_emission) { | if (shader->emission_sampling != EMISSION_SAMPLING_NONE) { | ||||
| scene->light_manager->tag_update(scene, LightManager::SHADER_COMPILED); | scene->light_manager->tag_update(scene, LightManager::SHADER_COMPILED); | ||||
| } | } | ||||
| /* Update the global jump table. | /* Update the global jump table. | ||||
| * Each compiled shader starts with a jump node that has offsets local | * Each compiled shader starts with a jump node that has offsets local | ||||
| * to the shader, so copy those and add the offset into the global node list. */ | * to the shader, so copy those and add the offset into the global node list. */ | ||||
| int4 &global_jump_node = svm_nodes[shader->id]; | int4 &global_jump_node = svm_nodes[shader->id]; | ||||
| int4 &local_jump_node = shader_svm_nodes[i][0]; | int4 &local_jump_node = shader_svm_nodes[i][0]; | ||||
| ▲ Show 20 Lines • Show All 390 Lines • ▼ Show 20 Lines | else | ||||
| mix_weight_offset = SVM_STACK_INVALID; | mix_weight_offset = SVM_STACK_INVALID; | ||||
| /* compile closure itself */ | /* compile closure itself */ | ||||
| generate_node(node, state->nodes_done); | generate_node(node, state->nodes_done); | ||||
| mix_weight_offset = SVM_STACK_INVALID; | mix_weight_offset = SVM_STACK_INVALID; | ||||
| if (current_type == SHADER_TYPE_SURFACE) { | if (current_type == SHADER_TYPE_SURFACE) { | ||||
| if (node->has_surface_emission()) | |||||
| current_shader->has_surface_emission = true; | |||||
| if (node->has_surface_transparent()) | if (node->has_surface_transparent()) | ||||
| current_shader->has_surface_transparent = true; | current_shader->has_surface_transparent = true; | ||||
| if (node->has_surface_bssrdf()) { | if (node->has_surface_bssrdf()) { | ||||
| current_shader->has_surface_bssrdf = true; | current_shader->has_surface_bssrdf = true; | ||||
| if (node->has_bssrdf_bump()) | if (node->has_bssrdf_bump()) | ||||
| current_shader->has_bssrdf_bump = true; | current_shader->has_bssrdf_bump = true; | ||||
| } | } | ||||
| if (node->has_bump()) { | if (node->has_bump()) { | ||||
| ▲ Show 20 Lines • Show All 339 Lines • ▼ Show 20 Lines | shader->graph->finalize(scene, | ||||
| has_bump, | has_bump, | ||||
| shader->has_integrator_dependency, | shader->has_integrator_dependency, | ||||
| shader->get_displacement_method() == DISPLACE_BOTH); | shader->get_displacement_method() == DISPLACE_BOTH); | ||||
| } | } | ||||
| current_shader = shader; | current_shader = shader; | ||||
| shader->has_surface = false; | shader->has_surface = false; | ||||
| shader->has_surface_emission = false; | |||||
| shader->has_surface_transparent = false; | shader->has_surface_transparent = false; | ||||
| shader->has_surface_raytrace = false; | shader->has_surface_raytrace = false; | ||||
| shader->has_surface_bssrdf = false; | shader->has_surface_bssrdf = false; | ||||
| shader->has_bump = has_bump; | shader->has_bump = has_bump; | ||||
| shader->has_bssrdf_bump = has_bump; | shader->has_bssrdf_bump = has_bump; | ||||
| shader->has_volume = false; | shader->has_volume = false; | ||||
| shader->has_displacement = false; | shader->has_displacement = false; | ||||
| shader->has_surface_spatial_varying = false; | shader->has_surface_spatial_varying = false; | ||||
| Show All 38 Lines | void SVMCompiler::compile(Shader *shader, array<int4> &svm_nodes, int index, Summary *summary) | ||||
| } | } | ||||
| /* Fill in summary information. */ | /* Fill in summary information. */ | ||||
| if (summary != NULL) { | if (summary != NULL) { | ||||
| summary->time_total = time_dt() - time_start; | summary->time_total = time_dt() - time_start; | ||||
| summary->peak_stack_usage = max_stack_use; | summary->peak_stack_usage = max_stack_use; | ||||
| summary->num_svm_nodes = svm_nodes.size() - start_num_svm_nodes; | summary->num_svm_nodes = svm_nodes.size() - start_num_svm_nodes; | ||||
| } | } | ||||
| /* Estimate emission for MIS. */ | |||||
| shader->estimate_emission(); | |||||
| } | } | ||||
| /* Compiler summary implementation. */ | /* Compiler summary implementation. */ | ||||
| SVMCompiler::Summary::Summary() | SVMCompiler::Summary::Summary() | ||||
| : num_svm_nodes(0), | : num_svm_nodes(0), | ||||
| peak_stack_usage(0), | peak_stack_usage(0), | ||||
| time_finalize(0.0), | time_finalize(0.0), | ||||
| ▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines | |||||