Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@stuvel.eu>2017-04-07 18:28:22 +0300
committerSybren A. Stüvel <sybren@stuvel.eu>2017-04-07 18:28:22 +0300
commit063bae4fcc079d0ba7b7f86d327179df36a95146 (patch)
treef484ae3d53406ecc01f90189665defb4b1f73b13 /intern
parent711ac03fa14a0087d72e2429140357f6748b6972 (diff)
parent43a910abce50963d12c0ccde596347459d921b9a (diff)
Merge branch 'master' into blender2.8
# Conflicts: # source/blender/alembic/intern/abc_exporter.h # source/blender/alembic/intern/abc_util.cc
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/blender/blender_mesh.cpp34
-rw-r--r--intern/cycles/device/device_cpu.cpp2
-rw-r--r--intern/cycles/device/device_split_kernel.cpp9
-rw-r--r--intern/cycles/device/opencl/opencl_util.cpp1
-rw-r--r--intern/cycles/kernel/kernel_shadow.h4
-rw-r--r--intern/cycles/kernel/kernel_types.h8
-rw-r--r--intern/locale/msgfmt.cc12
7 files changed, 37 insertions, 33 deletions
diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp
index e0e89cec65c..54571b1fea1 100644
--- a/intern/cycles/blender/blender_mesh.cpp
+++ b/intern/cycles/blender/blender_mesh.cpp
@@ -560,6 +560,9 @@ static void attr_create_pointiness(Scene *scene,
return;
}
const int num_verts = b_mesh.vertices.length();
+ if(num_verts == 0) {
+ return;
+ }
/* STEP 1: Find out duplicated vertices and point duplicates to a single
* original vertex.
*/
@@ -1164,8 +1167,8 @@ void BlenderSync::sync_mesh_motion(BL::Object& b_ob,
}
/* skip empty meshes */
- size_t numverts = mesh->verts.size();
- size_t numkeys = mesh->curve_keys.size();
+ const size_t numverts = mesh->verts.size();
+ const size_t numkeys = mesh->curve_keys.size();
if(!numverts && !numkeys)
return;
@@ -1223,13 +1226,12 @@ void BlenderSync::sync_mesh_motion(BL::Object& b_ob,
/* TODO(sergey): Perform preliminary check for number of verticies. */
if(numverts) {
- /* find attributes */
+ /* Find attributes. */
Attribute *attr_mP = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
Attribute *attr_mN = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_NORMAL);
Attribute *attr_N = mesh->attributes.find(ATTR_STD_VERTEX_NORMAL);
bool new_attribute = false;
-
- /* add new attributes if they don't exist already */
+ /* Add new attributes if they don't exist already. */
if(!attr_mP) {
attr_mP = mesh->attributes.add(ATTR_STD_MOTION_VERTEX_POSITION);
if(attr_N)
@@ -1237,22 +1239,21 @@ void BlenderSync::sync_mesh_motion(BL::Object& b_ob,
new_attribute = true;
}
-
- /* load vertex data from mesh */
+ /* Load vertex data from mesh. */
float3 *mP = attr_mP->data_float3() + time_index*numverts;
float3 *mN = (attr_mN)? attr_mN->data_float3() + time_index*numverts: NULL;
-
+ /* NOTE: We don't copy more that existing amount of vertices to prevent
+ * possible memory corruption.
+ */
BL::Mesh::vertices_iterator v;
int i = 0;
-
for(b_mesh.vertices.begin(v); v != b_mesh.vertices.end() && i < numverts; ++v, ++i) {
mP[i] = get_float3(v->co());
if(mN)
mN[i] = get_float3(v->normal());
}
-
- /* in case of new attribute, we verify if there really was any motion */
if(new_attribute) {
+ /* In case of new attribute, we verify if there really was any motion. */
if(b_mesh.vertices.length() != numverts ||
memcmp(mP, &mesh->verts[0], sizeof(float3)*numverts) == 0)
{
@@ -1275,7 +1276,6 @@ void BlenderSync::sync_mesh_motion(BL::Object& b_ob,
* they had no motion, but we need them anyway now */
float3 *P = &mesh->verts[0];
float3 *N = (attr_N)? attr_N->data_float3(): NULL;
-
for(int step = 0; step < time_index; step++) {
memcpy(attr_mP->data_float3() + step*numverts, P, sizeof(float3)*numverts);
if(attr_mN)
@@ -1283,6 +1283,16 @@ void BlenderSync::sync_mesh_motion(BL::Object& b_ob,
}
}
}
+ else {
+ if(b_mesh.vertices.length() != numverts) {
+ VLOG(1) << "Topology differs, discarding motion blur for object "
+ << b_ob.name() << " at time " << time_index;
+ memcpy(mP, &mesh->verts[0], sizeof(float3)*numverts);
+ if(mN != NULL) {
+ memcpy(mN, attr_N->data_float3(), sizeof(float3)*numverts);
+ }
+ }
+ }
}
/* hair motion */
diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp
index 2761d9488ca..3c481bb2b39 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -856,7 +856,7 @@ int2 CPUSplitKernel::split_kernel_local_size()
}
int2 CPUSplitKernel::split_kernel_global_size(device_memory& /*kg*/, device_memory& /*data*/, DeviceTask * /*task*/) {
- return make_int2(64, 1);
+ return make_int2(1, 1);
}
uint64_t CPUSplitKernel::state_buffer_size(device_memory& kernel_globals, device_memory& /*data*/, size_t num_threads) {
diff --git a/intern/cycles/device/device_split_kernel.cpp b/intern/cycles/device/device_split_kernel.cpp
index ae462a560b7..fa641161c05 100644
--- a/intern/cycles/device/device_split_kernel.cpp
+++ b/intern/cycles/device/device_split_kernel.cpp
@@ -151,7 +151,8 @@ bool DeviceSplitKernel::path_trace(DeviceTask *task,
/* Calculate max groups */
/* Denotes the maximum work groups possible w.r.t. current requested tile size. */
- unsigned int max_work_groups = num_global_elements / WORK_POOL_SIZE + 1;
+ unsigned int work_pool_size = (device->info.type == DEVICE_CPU) ? WORK_POOL_SIZE_CPU : WORK_POOL_SIZE_GPU;
+ unsigned int max_work_groups = num_global_elements / work_pool_size + 1;
/* Allocate work_pool_wgs memory. */
work_pool_wgs.resize(max_work_groups * sizeof(unsigned int));
@@ -256,10 +257,8 @@ bool DeviceSplitKernel::path_trace(DeviceTask *task,
activeRaysAvailable = false;
for(int rayStateIter = 0; rayStateIter < global_size[0] * global_size[1]; ++rayStateIter) {
- int8_t state = ray_state.get_data()[rayStateIter];
-
- if(state != RAY_INACTIVE) {
- if(state == RAY_INVALID) {
+ if(!IS_STATE(ray_state.get_data(), rayStateIter, RAY_INACTIVE)) {
+ if(IS_STATE(ray_state.get_data(), rayStateIter, RAY_INVALID)) {
/* Something went wrong, abort to avoid looping endlessly. */
device->set_error("Split kernel error: invalid ray state");
return false;
diff --git a/intern/cycles/device/opencl/opencl_util.cpp b/intern/cycles/device/opencl/opencl_util.cpp
index 8128fcee09b..6dca642f3f3 100644
--- a/intern/cycles/device/opencl/opencl_util.cpp
+++ b/intern/cycles/device/opencl/opencl_util.cpp
@@ -281,6 +281,7 @@ void OpenCLDeviceBase::OpenCLProgram::add_log(string msg, bool debug)
}
else if(!debug) {
printf("%s\n", msg.c_str());
+ fflush(stdout);
}
else {
VLOG(2) << msg;
diff --git a/intern/cycles/kernel/kernel_shadow.h b/intern/cycles/kernel/kernel_shadow.h
index 0426e0a62c9..db6f839d9ed 100644
--- a/intern/cycles/kernel/kernel_shadow.h
+++ b/intern/cycles/kernel/kernel_shadow.h
@@ -422,9 +422,9 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg,
return false;
}
#ifdef __SHADOW_TRICKS__
- const int skip_object = state->catcher_object;
+ const int skip_object = state->catcher_object;
#else
- const int skip_object = OBJECT_NONE;
+ const int skip_object = OBJECT_NONE;
#endif
/* Do actual shadow shading. */
/* First of all, we check if integrator requires transparent shadows.
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index 19c91248922..623f3728c69 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -56,7 +56,13 @@ CCL_NAMESPACE_BEGIN
#define VOLUME_STACK_SIZE 16
-#define WORK_POOL_SIZE 64
+#define WORK_POOL_SIZE_GPU 64
+#define WORK_POOL_SIZE_CPU 1
+#ifdef __KERNEL_GPU__
+# define WORK_POOL_SIZE WORK_POOL_SIZE_GPU
+#else
+# define WORK_POOL_SIZE WORK_POOL_SIZE_CPU
+#endif
/* device capabilities */
#ifdef __KERNEL_CPU__
diff --git a/intern/locale/msgfmt.cc b/intern/locale/msgfmt.cc
index 6ee1ee14781..02c58ebc5bc 100644
--- a/intern/locale/msgfmt.cc
+++ b/intern/locale/msgfmt.cc
@@ -42,18 +42,6 @@ bool starts_with(const std::string &str,
}
}
-std::string ltrim(const std::string &str) {
- std::string result = str;
- result.erase(0, result.find_first_not_of(" \t\r\n"));
- return result;
-}
-
-std::string rtrim(const std::string &str) {
- std::string result = str;
- result.erase(result.find_last_not_of(" \t\r\n") + 1);
- return result;
-}
-
std::string trim(const std::string &str) {
std::string result = str;
result.erase(0, result.find_first_not_of(" \t\r\n"));