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:
Diffstat (limited to 'source/blender/compositor/intern/COM_WorkScheduler.cpp')
-rw-r--r--source/blender/compositor/intern/COM_WorkScheduler.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp
index c49ac24e018..c7544be1bb4 100644
--- a/source/blender/compositor/intern/COM_WorkScheduler.cpp
+++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp
@@ -30,6 +30,7 @@
#include "COM_OpenCLDevice.h"
#include "COM_OpenCLKernels.cl.h"
#include "OCL_opencl.h"
+#include "COM_WriteBufferOperation.h"
#include "PIL_time.h"
#include "BLI_threads.h"
@@ -65,6 +66,55 @@ static bool g_openclActive = false;
#endif
#endif
+#define MAX_HIGHLIGHT 8
+extern "C" {
+int g_highlightIndex;
+void ** g_highlightedNodes;
+void ** g_highlightedNodesRead;
+
+#define HIGHLIGHT(wp) \
+{ \
+ ExecutionGroup* group = wp->getExecutionGroup(); \
+ if (group->isComplex()) { \
+ NodeOperation* operation = group->getOutputNodeOperation(); \
+ if (operation->isWriteBufferOperation()) {\
+ WriteBufferOperation *writeOperation = (WriteBufferOperation*)operation;\
+ NodeOperation *complexOperation = writeOperation->getInput(); \
+ bNode *node = complexOperation->getbNode(); \
+ if (node) { \
+ if (node->original) { \
+ node = node->original;\
+ }\
+ if (g_highlightIndex < MAX_HIGHLIGHT) {\
+ g_highlightedNodes[g_highlightIndex++] = node;\
+ }\
+ } \
+ } \
+ } \
+}
+void COM_startReadHighlights() {
+ if (g_highlightedNodesRead) {
+ delete g_highlightedNodesRead;
+ }
+
+ g_highlightedNodesRead = g_highlightedNodes;
+ g_highlightedNodes = new void*[MAX_HIGHLIGHT];
+ g_highlightIndex = 0;
+ for (int i = 0 ; i < MAX_HIGHLIGHT; i++) {
+ g_highlightedNodes[i] = 0;
+ }
+}
+
+int COM_isHighlightedbNode(bNode* bnode) {
+ if (!g_highlightedNodesRead) return false;
+ for (int i = 0 ; i < MAX_HIGHLIGHT; i++) {
+ void* p = g_highlightedNodesRead[i];
+ if (!p) return false;
+ if (p == bnode) return true;
+ }
+ return false;
+}
+} // end extern "C"
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
void *WorkScheduler::thread_execute_cpu(void *data)
@@ -73,6 +123,7 @@ void *WorkScheduler::thread_execute_cpu(void *data)
WorkPackage *work;
while ((work = (WorkPackage *)BLI_thread_queue_pop(g_cpuqueue))) {
+ HIGHLIGHT(work);
device->execute(work);
delete work;
}
@@ -86,6 +137,7 @@ void *WorkScheduler::thread_execute_gpu(void *data)
WorkPackage *work;
while ((work = (WorkPackage *)BLI_thread_queue_pop(g_gpuqueue))) {
+ HIGHLIGHT(work);
device->execute(work);
delete work;
}
@@ -197,6 +249,9 @@ extern void clContextError(const char *errinfo, const void *private_info, size_t
void WorkScheduler::initialize()
{
+ g_highlightedNodesRead = 0;
+ g_highlightedNodes = 0;
+ COM_startReadHighlights();
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
int numberOfCPUThreads = BLI_system_thread_count();
@@ -291,3 +346,4 @@ void WorkScheduler::deinitialize()
#endif
#endif
}
+