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
diff options
context:
space:
mode:
-rw-r--r--intern/cycles/device/device_cpu.cpp8
-rw-r--r--intern/cycles/kernel/osl/osl_services.h1
-rw-r--r--intern/cycles/util/util_task.cpp2
-rw-r--r--intern/cycles/util/util_task.h2
-rw-r--r--source/blender/blenkernel/BKE_geometry_set.hh6
-rw-r--r--source/blender/blenkernel/intern/attribute_access.cc8
-rw-r--r--source/blender/blenlib/BLI_task.h6
-rw-r--r--source/blender/blenlib/intern/task_pool.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_point_scale.cc3
9 files changed, 26 insertions, 14 deletions
diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp
index bd00d4db775..fdfd3f83be6 100644
--- a/intern/cycles/device/device_cpu.cpp
+++ b/intern/cycles/device/device_cpu.cpp
@@ -951,7 +951,7 @@ class CPUDevice : public Device {
SIMD_SET_FLUSH_TO_ZERO;
for (int sample = start_sample; sample < end_sample; sample++) {
- if (task.get_cancel() || task_pool.canceled()) {
+ if (task.get_cancel() || TaskPool::canceled()) {
if (task.need_finish_queue == false)
break;
}
@@ -1249,7 +1249,7 @@ class CPUDevice : public Device {
void thread_render(DeviceTask &task)
{
- if (task_pool.canceled()) {
+ if (TaskPool::canceled()) {
if (task.need_finish_queue == false)
return;
}
@@ -1319,7 +1319,7 @@ class CPUDevice : public Device {
task.release_tile(tile);
- if (task_pool.canceled()) {
+ if (TaskPool::canceled()) {
if (task.need_finish_queue == false)
break;
}
@@ -1416,7 +1416,7 @@ class CPUDevice : public Device {
task.offset,
sample);
- if (task.get_cancel() || task_pool.canceled())
+ if (task.get_cancel() || TaskPool::canceled())
break;
task.update_progress(NULL);
diff --git a/intern/cycles/kernel/osl/osl_services.h b/intern/cycles/kernel/osl/osl_services.h
index 894d6e471ba..d8b29e3bc1c 100644
--- a/intern/cycles/kernel/osl/osl_services.h
+++ b/intern/cycles/kernel/osl/osl_services.h
@@ -27,6 +27,7 @@
#include <OSL/oslclosure.h>
#include <OSL/oslexec.h>
+#include <OSL/rendererservices.h>
#ifdef WITH_PTEX
class PtexCache;
diff --git a/intern/cycles/util/util_task.cpp b/intern/cycles/util/util_task.cpp
index 50c236ac968..949ba0a7b4d 100644
--- a/intern/cycles/util/util_task.cpp
+++ b/intern/cycles/util/util_task.cpp
@@ -62,7 +62,7 @@ void TaskPool::cancel()
bool TaskPool::canceled()
{
- return tbb_group.is_canceling();
+ return tbb::is_current_task_group_canceling();
}
/* Task Scheduler */
diff --git a/intern/cycles/util/util_task.h b/intern/cycles/util/util_task.h
index f2718600f30..7c39ed675b5 100644
--- a/intern/cycles/util/util_task.h
+++ b/intern/cycles/util/util_task.h
@@ -61,7 +61,7 @@ class TaskPool {
void wait_work(Summary *stats = NULL); /* work and wait until all tasks are done */
void cancel(); /* cancel all tasks and wait until they are no longer executing */
- bool canceled(); /* for worker threads, test if canceled */
+ static bool canceled(); /* For worker threads, test if current task pool canceled. */
protected:
tbb::task_group tbb_group;
diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh
index 57fad6bcdf6..391bd243edf 100644
--- a/source/blender/blenkernel/BKE_geometry_set.hh
+++ b/source/blender/blenkernel/BKE_geometry_set.hh
@@ -242,7 +242,8 @@ class GeometryComponent {
/**
* If an attribute with the given params exist, it is returned.
- * If no attribute with the given name exists, it is created and returned.
+ * If no attribute with the given name exists, create it and
+ * fill it with the default value if it is provided.
* If an attribute with the given name but different domain or type exists, a temporary attribute
* is created that has to be saved after the output has been computed. This avoids deleting
* another attribute, before a computation is finished.
@@ -251,7 +252,8 @@ class GeometryComponent {
*/
OutputAttributePtr attribute_try_get_for_output(const blender::StringRef attribute_name,
const AttributeDomain domain,
- const CustomDataType data_type);
+ const CustomDataType data_type,
+ const void *default_value = nullptr);
};
template<typename T>
diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc
index b9ccee0dd4a..95a6628b1ae 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -825,7 +825,8 @@ blender::bke::ReadAttributePtr GeometryComponent::attribute_get_constant_for_rea
OutputAttributePtr GeometryComponent::attribute_try_get_for_output(const StringRef attribute_name,
const AttributeDomain domain,
- const CustomDataType data_type)
+ const CustomDataType data_type,
+ const void *default_value)
{
BLI_assert(this->attribute_domain_with_type_supported(domain, data_type));
@@ -838,6 +839,11 @@ OutputAttributePtr GeometryComponent::attribute_try_get_for_output(const StringR
if (!attribute) {
this->attribute_try_create(attribute_name, domain, data_type);
attribute = this->attribute_try_get_for_write(attribute_name);
+ if (default_value != nullptr) {
+ void *data = attribute->get_span_for_write_only().data();
+ cpp_type->fill_initialized(default_value, data, attribute->size());
+ attribute->apply_span();
+ }
return OutputAttributePtr(std::move(attribute));
}
diff --git a/source/blender/blenlib/BLI_task.h b/source/blender/blenlib/BLI_task.h
index a3805f71316..9e61686b37a 100644
--- a/source/blender/blenlib/BLI_task.h
+++ b/source/blender/blenlib/BLI_task.h
@@ -105,8 +105,10 @@ void BLI_task_pool_work_and_wait(TaskPool *pool);
/* cancel all tasks, keep worker threads running */
void BLI_task_pool_cancel(TaskPool *pool);
-/* for worker threads, test if canceled */
-bool BLI_task_pool_canceled(TaskPool *pool);
+/* for worker threads, test if current task pool canceled. this function may
+ * only be called from worker threads and pool must be the task pool that the
+ * thread is currently executing a task from. */
+bool BLI_task_pool_current_canceled(TaskPool *pool);
/* optional userdata pointer to pass along to run function */
void *BLI_task_pool_user_data(TaskPool *pool);
diff --git a/source/blender/blenlib/intern/task_pool.cc b/source/blender/blenlib/intern/task_pool.cc
index dfed24da2d9..4b545c5647e 100644
--- a/source/blender/blenlib/intern/task_pool.cc
+++ b/source/blender/blenlib/intern/task_pool.cc
@@ -268,7 +268,7 @@ static bool tbb_task_pool_canceled(TaskPool *pool)
{
#ifdef WITH_TBB
if (pool->use_threads) {
- return pool->tbb_group.is_canceling();
+ return tbb::is_current_task_group_canceling();
}
#else
UNUSED_VARS(pool);
@@ -520,7 +520,7 @@ void BLI_task_pool_cancel(TaskPool *pool)
}
}
-bool BLI_task_pool_canceled(TaskPool *pool)
+bool BLI_task_pool_current_canceled(TaskPool *pool)
{
switch (pool->type) {
case TASK_POOL_TBB:
diff --git a/source/blender/nodes/geometry/nodes/node_geo_point_scale.cc b/source/blender/nodes/geometry/nodes/node_geo_point_scale.cc
index e5cbe27768d..47fca93d2ab 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_point_scale.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_point_scale.cc
@@ -34,8 +34,9 @@ namespace blender::nodes {
static void execute_on_component(GeoNodeExecParams params, GeometryComponent &component)
{
+ static const float3 scale_default = float3(1.0f);
OutputAttributePtr scale_attribute = component.attribute_try_get_for_output(
- "scale", ATTR_DOMAIN_POINT, CD_PROP_FLOAT3);
+ "scale", ATTR_DOMAIN_POINT, CD_PROP_FLOAT3, &scale_default);
ReadAttributePtr attribute = params.get_input_attribute(
"Factor", component, ATTR_DOMAIN_POINT, CD_PROP_FLOAT3, nullptr);
if (!attribute) {