Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/geometry.cpp
| Show First 20 Lines • Show All 209 Lines • ▼ Show 20 Lines | void Geometry::compute_bvh( | ||||
| if (need_build_bvh(bvh_layout)) { | if (need_build_bvh(bvh_layout)) { | ||||
| string msg = "Updating Geometry BVH "; | string msg = "Updating Geometry BVH "; | ||||
| if (name.empty()) | if (name.empty()) | ||||
| msg += string_printf("%u/%u", (uint)(n + 1), (uint)total); | msg += string_printf("%u/%u", (uint)(n + 1), (uint)total); | ||||
| else | else | ||||
| msg += string_printf("%s %u/%u", name.c_str(), (uint)(n + 1), (uint)total); | msg += string_printf("%s %u/%u", name.c_str(), (uint)(n + 1), (uint)total); | ||||
| Object object; | Object object; | ||||
| /* Ensure all visibility bits are set at the geometry level BVH. In | |||||
| * the object level BVH is where actual visibility is tested. */ | |||||
| object.set_is_shadow_catcher(true); | |||||
| object.set_visibility(~0); | |||||
| object.set_geometry(this); | object.set_geometry(this); | ||||
| vector<Geometry *> geometry; | vector<Geometry *> geometry; | ||||
| geometry.push_back(this); | geometry.push_back(this); | ||||
| vector<Object *> objects; | vector<Object *> objects; | ||||
| objects.push_back(&object); | objects.push_back(&object); | ||||
| if (bvh && !need_update_rebuild) { | if (bvh && !need_update_rebuild) { | ||||
| ▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| void GeometryManager::update_osl_attributes(Device *device, | void GeometryManager::update_osl_attributes(Device *device, | ||||
| Scene *scene, | Scene *scene, | ||||
| vector<AttributeRequestSet> &geom_attributes) | vector<AttributeRequestSet> &geom_attributes) | ||||
| { | { | ||||
| #ifdef WITH_OSL | #ifdef WITH_OSL | ||||
| /* for OSL, a hash map is used to lookup the attribute by name. */ | /* for OSL, a hash map is used to lookup the attribute by name. */ | ||||
| OSLGlobals *og = (OSLGlobals *)device->osl_memory(); | OSLGlobals *og = (OSLGlobals *)device->get_cpu_osl_memory(); | ||||
| og->object_name_map.clear(); | og->object_name_map.clear(); | ||||
| og->attribute_map.clear(); | og->attribute_map.clear(); | ||||
| og->object_names.clear(); | og->object_names.clear(); | ||||
| og->attribute_map.resize(scene->objects.size() * ATTR_PRIM_TYPES); | og->attribute_map.resize(scene->objects.size() * ATTR_PRIM_TYPES); | ||||
| for (size_t i = 0; i < scene->objects.size(); i++) { | for (size_t i = 0; i < scene->objects.size(); i++) { | ||||
| ▲ Show 20 Lines • Show All 1,523 Lines • ▼ Show 20 Lines | if (total_tess_needed) { | ||||
| scoped_callback_timer timer([scene](double time) { | scoped_callback_timer timer([scene](double time) { | ||||
| if (scene->update_stats) { | if (scene->update_stats) { | ||||
| scene->update_stats->geometry.times.add_entry( | scene->update_stats->geometry.times.add_entry( | ||||
| {"device_update (adaptive subdivision)", time}); | {"device_update (adaptive subdivision)", time}); | ||||
| } | } | ||||
| }); | }); | ||||
| Camera *dicing_camera = scene->dicing_camera; | Camera *dicing_camera = scene->dicing_camera; | ||||
| dicing_camera->set_screen_size_and_resolution( | dicing_camera->set_screen_size(dicing_camera->get_full_width(), | ||||
| dicing_camera->get_full_width(), dicing_camera->get_full_height(), 1); | dicing_camera->get_full_height()); | ||||
| dicing_camera->update(scene); | dicing_camera->update(scene); | ||||
| size_t i = 0; | size_t i = 0; | ||||
| foreach (Geometry *geom, scene->geometry) { | foreach (Geometry *geom, scene->geometry) { | ||||
| if (!(geom->is_modified() && geom->is_mesh())) { | if (!(geom->is_modified() && geom->is_mesh())) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 284 Lines • ▼ Show 20 Lines | void GeometryManager::device_free(Device *device, DeviceScene *dscene, bool force_free) | ||||
| dscene->attributes_float2.free_if_need_realloc(force_free); | dscene->attributes_float2.free_if_need_realloc(force_free); | ||||
| dscene->attributes_float3.free_if_need_realloc(force_free); | dscene->attributes_float3.free_if_need_realloc(force_free); | ||||
| dscene->attributes_uchar4.free_if_need_realloc(force_free); | dscene->attributes_uchar4.free_if_need_realloc(force_free); | ||||
| /* Signal for shaders like displacement not to do ray tracing. */ | /* Signal for shaders like displacement not to do ray tracing. */ | ||||
| dscene->data.bvh.bvh_layout = BVH_LAYOUT_NONE; | dscene->data.bvh.bvh_layout = BVH_LAYOUT_NONE; | ||||
| #ifdef WITH_OSL | #ifdef WITH_OSL | ||||
| OSLGlobals *og = (OSLGlobals *)device->osl_memory(); | OSLGlobals *og = (OSLGlobals *)device->get_cpu_osl_memory(); | ||||
| if (og) { | if (og) { | ||||
| og->object_name_map.clear(); | og->object_name_map.clear(); | ||||
| og->attribute_map.clear(); | og->attribute_map.clear(); | ||||
| og->object_names.clear(); | og->object_names.clear(); | ||||
| } | } | ||||
| #else | #else | ||||
| (void)device; | (void)device; | ||||
| Show All 27 Lines | |||||