attempts at folding opencl support in

This commit is contained in:
itsmattkc
2019-10-28 18:21:20 +11:00
parent 3fb53586d4
commit 401aff52a8
22 changed files with 399 additions and 0 deletions
+2
View File
@@ -24,6 +24,8 @@ add_subdirectory(output)
set(OLIVE_SOURCES
${OLIVE_SOURCES}
node/code.h
node/code.cpp
node/dependency.h
node/dependency.cpp
node/edge.h
+16
View File
@@ -45,6 +45,22 @@ QString AlphaOverBlend::Description()
return tr("A blending node that composites one texture over another using its alpha channel.");
}
NodeCode AlphaOverBlend::Code(NodeOutput *output)
{
if (output == texture_output()) {
return NodeCode("AlphaOver",
"void AlphaOver(const pixel *base_in, const pixel *blend_in, pixel *tex_out) {"
" int i = get_global_id(0);"
" tex_out[i].r = base_in.r - blend_in.a + blend_in.r;"
" tex_out[i].g = base_in.g - blend_in.a + blend_in.g;"
" tex_out[i].b = base_in.b - blend_in.a + blend_in.b;"
" tex_out[i].a = base_in.a - blend_in.a + blend_in.a;"
"}");
}
return Node::Code(output);
}
void AlphaOverBlend::Release()
{
}
+2
View File
@@ -33,6 +33,8 @@ public:
virtual QString id() override;
virtual QString Description() override;
virtual NodeCode Code(NodeOutput* output) override;
virtual void Release() override;
protected:
+27
View File
@@ -0,0 +1,27 @@
#include "nodecode.h"
NodeCode::NodeCode()
{
}
NodeCode::NodeCode(const QString &function_name, const QString &code) :
function_name_(function_name),
code_(code)
{
}
bool NodeCode::IsValid()
{
return (!function_name_.isEmpty() && !code_.isEmpty());
}
const QString &NodeCode::function_name()
{
return function_name_;
}
const QString &NodeCode::code()
{
return code_;
}
+23
View File
@@ -0,0 +1,23 @@
#ifndef NODECODE_H
#define NODECODE_H
#include <QString>
class NodeCode
{
public:
NodeCode();
NodeCode(const QString& function_name, const QString& code);
bool IsValid();
const QString& function_name();
const QString& code();
private:
QString function_name_;
QString code_;
};
#endif // NODECODE_H
+2
View File
@@ -18,6 +18,8 @@ public:
virtual QString Category() override;
virtual QString Description() override;
virtual QString Code() override;
virtual void Release() override;
NodeInput* matrix_input();
+7
View File
@@ -278,6 +278,13 @@ QList<Node *> Node::GetImmediateDependencies()
return node_list;
}
NodeCode Node::Code(NodeOutput *output)
{
Q_UNUSED(output)
return NodeCode();
}
QList<NodeDependency> Node::RunDependencies(NodeOutput *output, const rational &time)
{
Q_UNUSED(output)
+6
View File
@@ -26,6 +26,7 @@
#include <QObject>
#include "common/rational.h"
#include "node/code.h"
#include "node/dependency.h"
#include "node/input.h"
#include "node/output.h"
@@ -124,6 +125,11 @@ public:
*/
QList<Node*> GetImmediateDependencies();
/**
* @brief Generate OpenCL hardware accelerated code for this Node
*/
virtual NodeCode Code(NodeOutput* output);
/**
* @brief Wrapper for Process()
*
+1
View File
@@ -111,6 +111,7 @@ private:
private slots:
void UpdateTotalLength();
};
#endif // TRACKLIST_H
+2
View File
@@ -174,6 +174,8 @@ private:
NodeOutput* track_output_;
NodeOutput* block_list_output_;
TrackType track_type_;
int block_invalidate_cache_stack_;
+3
View File
@@ -87,6 +87,9 @@ public:
/// Resolves to `Block*`
kBlock,
/// Resolves to `QList<Block*>`
kBlockList,
/// Resolves to `Footage*`
kFootage,