diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/kernel/filter/filter_reconstruction.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_ies.h | 2 | ||||
-rw-r--r-- | intern/cycles/render/graph.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/render/osl.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/render/session.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/render/svm.cpp | 106 | ||||
-rw-r--r-- | intern/cycles/render/svm.h | 5 | ||||
-rw-r--r-- | intern/elbeem/intern/isosurface.h | 4 | ||||
-rw-r--r-- | intern/elbeem/intern/ntl_vector3dim.h | 4 | ||||
-rw-r--r-- | intern/elbeem/intern/solver_init.cpp | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.cpp | 6 | ||||
-rw-r--r-- | intern/libmv/intern/reconstruction.cc | 23 | ||||
-rw-r--r-- | intern/libmv/intern/track_region.cc | 2 |
13 files changed, 90 insertions, 72 deletions
diff --git a/intern/cycles/kernel/filter/filter_reconstruction.h b/intern/cycles/kernel/filter/filter_reconstruction.h index a69397bc6a6..17941689ad5 100644 --- a/intern/cycles/kernel/filter/filter_reconstruction.h +++ b/intern/cycles/kernel/filter/filter_reconstruction.h @@ -108,7 +108,7 @@ ccl_device_inline void kernel_filter_finalize(int x, /* The weighted average of pixel colors (essentially, the NLM-filtered image). * In case the solution of the linear model fails due to numerical issues or - * returns non-sensical negative values, fall back to this value. */ + * returns nonsensical negative values, fall back to this value. */ float3 mean_color = XtWY[0] / XtWX[0]; math_trimatrix_vec3_solve(XtWX, XtWY, (*rank) + 1, stride); diff --git a/intern/cycles/kernel/svm/svm_ies.h b/intern/cycles/kernel/svm/svm_ies.h index f13527c03db..e57e54ef123 100644 --- a/intern/cycles/kernel/svm/svm_ies.h +++ b/intern/cycles/kernel/svm/svm_ies.h @@ -25,7 +25,7 @@ ccl_device_inline float interpolate_ies_vertical( * of v (corresponding to the north pole) would result in artifacts. The proper way of dealing * with this would be to lookup the corresponding value on the other side of the pole, but since * the horizontal coordinates might be nonuniform, this would require yet another interpolation. - * Therefore, the assumtion is made that the light is going to be symmetrical, which means that + * Therefore, the assumption is made that the light is going to be symmetrical, which means that * we can just take the corresponding value at the current horizontal coordinate. */ #define IES_LOOKUP(v) kernel_tex_fetch(__ies, ofs + h * v_num + (v)) diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp index a56871779cf..501d1e33a9b 100644 --- a/intern/cycles/render/graph.cpp +++ b/intern/cycles/render/graph.cpp @@ -978,7 +978,7 @@ void ShaderGraph::bump_from_displacement(bool use_object_space) foreach (NodePair &pair, nodes_dy) pair.second->bump = SHADER_BUMP_DY; - /* add set normal node and connect the bump normal ouput to the set normal + /* add set normal node and connect the bump normal output to the set normal * output, so it can finally set the shader normal, note we are only doing * this for bump from displacement, this will be the only bump allowed to * overwrite the shader normal */ diff --git a/intern/cycles/render/osl.cpp b/intern/cycles/render/osl.cpp index 6f927bd5c42..19d27a7ef46 100644 --- a/intern/cycles/render/osl.cpp +++ b/intern/cycles/render/osl.cpp @@ -152,7 +152,7 @@ void OSLShaderManager::device_update(Device *device, { /* Perform greedyjit optimization. * - * This might waste time on optimizing gorups which are never actually + * This might waste time on optimizing groups which are never actually * used, but this prevents OSL from allocating data on TLS at render * time. * diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp index da2be0b147b..157bb6d63d3 100644 --- a/intern/cycles/render/session.cpp +++ b/intern/cycles/render/session.cpp @@ -985,7 +985,7 @@ void Session::update_status_time(bool show_pause, bool show_done) substatus += string_printf(", Prefiltered %d tiles", progress.get_denoised_tiles()); } } - else if (tile_manager.num_samples == INT_MAX) + else if (tile_manager.num_samples == Integrator::MAX_SAMPLES) substatus = string_printf("Path Tracing Sample %d", progressive_sample + 1); else substatus = string_printf("Path Tracing Sample %d/%d", progressive_sample + 1, num_samples); diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp index 040aa074f28..f69c89b1fd4 100644 --- a/intern/cycles/render/svm.cpp +++ b/intern/cycles/render/svm.cpp @@ -47,46 +47,23 @@ void SVMShaderManager::reset(Scene * /*scene*/) void SVMShaderManager::device_update_shader(Scene *scene, Shader *shader, Progress *progress, - array<int4> *global_svm_nodes) + array<int4> *svm_nodes) { if (progress->get_cancel()) { return; } assert(shader->graph); - array<int4> svm_nodes; - svm_nodes.push_back_slow(make_int4(NODE_SHADER_JUMP, 0, 0, 0)); + svm_nodes->push_back_slow(make_int4(NODE_SHADER_JUMP, 0, 0, 0)); SVMCompiler::Summary summary; SVMCompiler compiler(scene->shader_manager, scene->image_manager, scene->light_manager); compiler.background = (shader == scene->default_background); - compiler.compile(scene, shader, svm_nodes, 0, &summary); + compiler.compile(scene, shader, *svm_nodes, 0, &summary); VLOG(2) << "Compilation summary:\n" << "Shader name: " << shader->name << "\n" << summary.full_report(); - - nodes_lock_.lock(); - if (shader->use_mis && shader->has_surface_emission) { - scene->light_manager->need_update = true; - } - - /* The copy needs to be done inside the lock, if another thread resizes the array - * while memcpy is running, it'll be copying into possibly invalid/freed ram. - */ - size_t global_nodes_size = global_svm_nodes->size(); - global_svm_nodes->resize(global_nodes_size + svm_nodes.size()); - - /* Offset local SVM nodes to a global address space. */ - int4 &jump_node = (*global_svm_nodes)[shader->id]; - jump_node.y = svm_nodes[0].y + global_nodes_size - 1; - jump_node.z = svm_nodes[0].z + global_nodes_size - 1; - jump_node.w = svm_nodes[0].w + global_nodes_size - 1; - /* Copy new nodes to global storage. */ - memcpy(&(*global_svm_nodes)[global_nodes_size], - &svm_nodes[1], - sizeof(int4) * (svm_nodes.size() - 1)); - nodes_lock_.unlock(); } void SVMShaderManager::device_update(Device *device, @@ -97,7 +74,9 @@ void SVMShaderManager::device_update(Device *device, if (!need_update) return; - VLOG(1) << "Total " << scene->shaders.size() << " shaders."; + const int num_shaders = scene->shaders.size(); + + VLOG(1) << "Total " << num_shaders << " shaders."; double start_time = time_dt(); @@ -107,20 +86,17 @@ void SVMShaderManager::device_update(Device *device, /* determine which shaders are in use */ device_update_shaders_used(scene); - /* svm_nodes */ - array<int4> svm_nodes; - size_t i; - - for (i = 0; i < scene->shaders.size(); i++) { - svm_nodes.push_back_slow(make_int4(NODE_SHADER_JUMP, 0, 0, 0)); - } - + /* Build all shaders. */ TaskPool task_pool; - foreach (Shader *shader, scene->shaders) { - task_pool.push( - function_bind( - &SVMShaderManager::device_update_shader, this, scene, shader, &progress, &svm_nodes), - false); + vector<array<int4>> shader_svm_nodes(num_shaders); + for (int i = 0; i < num_shaders; i++) { + task_pool.push(function_bind(&SVMShaderManager::device_update_shader, + this, + scene, + scene->shaders[i], + &progress, + &shader_svm_nodes[i]), + false); } task_pool.wait_work(); @@ -128,20 +104,60 @@ void SVMShaderManager::device_update(Device *device, return; } - dscene->svm_nodes.steal_data(svm_nodes); - dscene->svm_nodes.copy_to_device(); + /* The global node list contains a jump table (one node per shader) + * followed by the nodes of all shaders. */ + int svm_nodes_size = num_shaders; + for (int i = 0; i < num_shaders; i++) { + /* Since we're not copying the local jump node, the size ends up being one node lower. */ + svm_nodes_size += shader_svm_nodes[i].size() - 1; + } + + int4 *svm_nodes = dscene->svm_nodes.alloc(svm_nodes_size); - for (i = 0; i < scene->shaders.size(); i++) { + int node_offset = num_shaders; + for (int i = 0; i < num_shaders; i++) { Shader *shader = scene->shaders[i]; + shader->need_update = false; + if (shader->use_mis && shader->has_surface_emission) { + scene->light_manager->need_update = true; + } + + /* Update the global jump table. + * 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. */ + int4 &global_jump_node = svm_nodes[shader->id]; + int4 &local_jump_node = shader_svm_nodes[i][0]; + + global_jump_node.x = NODE_SHADER_JUMP; + global_jump_node.y = local_jump_node.y - 1 + node_offset; + global_jump_node.z = local_jump_node.z - 1 + node_offset; + global_jump_node.w = local_jump_node.w - 1 + node_offset; + + node_offset += shader_svm_nodes[i].size() - 1; + } + + /* Copy the nodes of each shader into the correct location. */ + svm_nodes += num_shaders; + for (int i = 0; i < num_shaders; i++) { + int shader_size = shader_svm_nodes[i].size() - 1; + + memcpy(svm_nodes, &shader_svm_nodes[i][1], sizeof(int4) * shader_size); + svm_nodes += shader_size; } + if (progress.get_cancel()) { + return; + } + + dscene->svm_nodes.copy_to_device(); + device_update_common(device, dscene, scene, progress); need_update = false; - VLOG(1) << "Shader manager updated " << scene->shaders.size() << " shaders in " - << time_dt() - start_time << " seconds."; + VLOG(1) << "Shader manager updated " << num_shaders << " shaders in " << time_dt() - start_time + << " seconds."; } void SVMShaderManager::device_free(Device *device, DeviceScene *dscene, Scene *scene) diff --git a/intern/cycles/render/svm.h b/intern/cycles/render/svm.h index d6964fb158b..7eac3e19bb3 100644 --- a/intern/cycles/render/svm.h +++ b/intern/cycles/render/svm.h @@ -50,13 +50,10 @@ class SVMShaderManager : public ShaderManager { void device_free(Device *device, DeviceScene *dscene, Scene *scene); protected: - /* Lock used to synchronize threaded nodes compilation. */ - thread_spin_lock nodes_lock_; - void device_update_shader(Scene *scene, Shader *shader, Progress *progress, - array<int4> *global_svm_nodes); + array<int4> *svm_nodes); }; /* Graph Compiler */ diff --git a/intern/elbeem/intern/isosurface.h b/intern/elbeem/intern/isosurface.h index 10da57ae75e..93ea5ecb108 100644 --- a/intern/elbeem/intern/isosurface.h +++ b/intern/elbeem/intern/isosurface.h @@ -125,9 +125,9 @@ class IsoSurface : //! cutoff border area int mCutoff; - //! cutoff heigh values + //! cutoff height values int *mCutArray; - //! particle pointer + //! particle pointer ParticleTracer *mpIsoParts; //! particle size float mPartSize; diff --git a/intern/elbeem/intern/ntl_vector3dim.h b/intern/elbeem/intern/ntl_vector3dim.h index 89360342864..51e03e30dc8 100644 --- a/intern/elbeem/intern/ntl_vector3dim.h +++ b/intern/elbeem/intern/ntl_vector3dim.h @@ -14,7 +14,7 @@ // this serves as the main include file // for all kinds of stuff that might be required -// under windos there seem to be strange +// under windows there seem to be strange // errors when including the STL header too // late... @@ -87,7 +87,7 @@ using std::string; #endif // WIN32 #endif // __APPLE_CC__ -// windos, hardcoded limits for now... +// windows, hardcoded limits for now... // for e.g. MSVC compiler... // some of these defines can be needed // for linux systems as well (e.g. FLT_MAX) diff --git a/intern/elbeem/intern/solver_init.cpp b/intern/elbeem/intern/solver_init.cpp index 664b1f2555e..5f28b4da41a 100644 --- a/intern/elbeem/intern/solver_init.cpp +++ b/intern/elbeem/intern/solver_init.cpp @@ -707,7 +707,7 @@ bool LbmFsgrSolver::initializeSolverMemory() noLimit = true; } - // restrict max. chunk of 1 mem block to 1GB for windos + // restrict max. chunk of 1 mem block to 1GB for windows bool memBlockAllocProblem = false; double maxDefaultMemChunk = 2.*1024.*1024.*1024.; //std::cerr<<" memEstFine "<< memEstFine <<" maxWin:" <<maxWinMemChunk <<" maxMac:" <<maxMacMemChunk ; // DEBUG diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 0cc1b36f369..9073ed9944b 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -1435,7 +1435,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, //////////////////////////////////////////////////////////////////////// case WM_NCMOUSEMOVE: /* The WM_NCMOUSEMOVE message is posted to a window when the cursor is moved - * within the nonclient area of the window. This message is posted to the window that + * within the non-client area of the window. This message is posted to the window that * contains the cursor. If a window has captured the mouse, this message is not posted. */ case WM_NCHITTEST: @@ -1602,7 +1602,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, /* An application sends the WM_NCPAINT message to a window * when its frame must be painted. */ case WM_NCACTIVATE: - /* The WM_NCACTIVATE message is sent to a window when its nonclient area needs to be + /* The WM_NCACTIVATE message is sent to a window when its non-client area needs to be * changed to indicate an active or inactive state. */ case WM_DESTROY: /* The WM_DESTROY message is sent when a window is being destroyed. It is sent to the @@ -1611,7 +1611,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, * windows (if any) as they are destroyed. During the processing of the message, it can * be assumed that all child windows still exist. */ case WM_NCDESTROY: - /* The WM_NCDESTROY message informs a window that its nonclient area is being + /* The WM_NCDESTROY message informs a window that its non-client area is being * destroyed. The DestroyWindow function sends the WM_NCDESTROY message to the window * following the WM_DESTROY message. WM_DESTROY is used to free the allocated memory * object associated with the window. diff --git a/intern/libmv/intern/reconstruction.cc b/intern/libmv/intern/reconstruction.cc index e271d663c4a..64f00b19df0 100644 --- a/intern/libmv/intern/reconstruction.cc +++ b/intern/libmv/intern/reconstruction.cc @@ -264,15 +264,15 @@ libmv_Reconstruction *libmv_solveReconstruction( update_callback.invoke(0, "Selecting keyframes"); - selectTwoKeyframesBasedOnGRICAndVariance(tracks, + if (selectTwoKeyframesBasedOnGRICAndVariance(tracks, normalized_tracks, *camera_intrinsics, keyframe1, - keyframe2); - - /* so keyframes in the interface would be updated */ - libmv_reconstruction_options->keyframe1 = keyframe1; - libmv_reconstruction_options->keyframe2 = keyframe2; + keyframe2)) { + /* so keyframes in the interface would be updated */ + libmv_reconstruction_options->keyframe1 = keyframe1; + libmv_reconstruction_options->keyframe2 = keyframe2; + } } /* Actual reconstruction. */ @@ -283,7 +283,7 @@ libmv_Reconstruction *libmv_solveReconstruction( LG << "number of markers for init: " << keyframe_markers.size(); - if (keyframe_markers.size() < 8) { + if (keyframe_markers.size() < 16) { LG << "No enough markers to initialize from"; libmv_reconstruction->is_valid = false; return libmv_reconstruction; @@ -291,13 +291,18 @@ libmv_Reconstruction *libmv_solveReconstruction( update_callback.invoke(0, "Initial reconstruction"); - EuclideanReconstructTwoFrames(keyframe_markers, &reconstruction); + if (!EuclideanReconstructTwoFrames(keyframe_markers, &reconstruction)) { + LG << "Failed to initialize reconstruction"; + libmv_reconstruction->is_valid = false; + return libmv_reconstruction; + } + EuclideanBundle(normalized_tracks, &reconstruction); EuclideanCompleteReconstruction(normalized_tracks, &reconstruction, &update_callback); - /* Refinement/ */ + /* Refinement. */ if (libmv_reconstruction_options->refine_intrinsics) { libmv_solveRefineIntrinsics( tracks, diff --git a/intern/libmv/intern/track_region.cc b/intern/libmv/intern/track_region.cc index 565d9ac1af7..2a3909c0ced 100644 --- a/intern/libmv/intern/track_region.cc +++ b/intern/libmv/intern/track_region.cc @@ -28,7 +28,7 @@ #undef DUMP_FAILURE /* define this to generate PNG images with content of search areas - on every itteration of tracking */ + on every iteration of tracking */ #undef DUMP_ALWAYS using libmv::FloatImage; |