nodes: minor overhaul to functionality

The nodes now have more control over how their accelerated shaders/sample
functions are run, as well as how items are popped off the value tables.
This allows for various optimizations that we didn't have access to before.
This commit is contained in:
itsmattkc
2020-06-12 00:54:15 +10:00
parent 663cf4a020
commit dd7af0e6bd
44 changed files with 1051 additions and 697 deletions
@@ -88,6 +88,8 @@ void NodeParamViewWidgetBridge::CreateWidgets()
case NodeParam::kString:
case NodeParam::kBuffer:
case NodeParam::kVector:
case NodeParam::kShaderJob:
case NodeParam::kSampleJob:
break;
case NodeParam::kInt:
{
@@ -262,6 +264,8 @@ void NodeParamViewWidgetBridge::WidgetCallback()
case NodeParam::kString:
case NodeParam::kVector:
case NodeParam::kBuffer:
case NodeParam::kShaderJob:
case NodeParam::kSampleJob:
break;
case NodeParam::kInt:
{
@@ -392,6 +396,8 @@ void NodeParamViewWidgetBridge::UpdateWidgetValues()
case NodeParam::kNumber:
case NodeParam::kString:
case NodeParam::kBuffer:
case NodeParam::kShaderJob:
case NodeParam::kSampleJob:
case NodeParam::kVector:
break;
case NodeParam::kInt:
+13 -17
View File
@@ -22,26 +22,22 @@
OLIVE_NAMESPACE_ENTER
void GizmoTraverser::ProcessNodeEvent(const Node *node, const TimeRange &range, NodeValueDatabase &input_params_in, NodeValueTable &output_params)
QVariant GizmoTraverser::ProcessVideoFootage(StreamPtr stream, const rational &input_time)
{
// Convert footage to image/sample buffers
QList<NodeInput*> inputs = node->GetInputsIncludingArrays();
foreach (NodeInput* input, inputs) {
if (input->data_type() == NodeParam::kFootage) {
StreamPtr stream = ResolveStreamFromInput(input);
Q_UNUSED(input_time)
if (stream
&& (stream->type() == Stream::kVideo || stream->type() == Stream::kImage)) {
ImageStreamPtr image_stream = std::static_pointer_cast<ImageStream>(stream);
ImageStreamPtr image_stream = std::static_pointer_cast<ImageStream>(stream);
output_params.Push(NodeParam::kTexture,
QSize(image_stream->width(), image_stream->height()),
node);
} else if (stream->type() == Stream::kAudio) {
// FIXME: Do something...
}
}
}
return QSize(image_stream->width(), image_stream->height());
}
QVariant GizmoTraverser::ProcessShader(const Node *node, const TimeRange &range, const ShaderJob &job)
{
Q_UNUSED(node)
Q_UNUSED(range)
Q_UNUSED(job)
return size_;
}
OLIVE_NAMESPACE_EXIT
+12 -2
View File
@@ -28,10 +28,20 @@ OLIVE_NAMESPACE_ENTER
class GizmoTraverser : public NodeTraverser
{
public:
GizmoTraverser() = default;
GizmoTraverser(const QSize& sequence_resolution) :
size_(sequence_resolution)
{
}
protected:
virtual void ProcessNodeEvent(const Node *node, const TimeRange &range, NodeValueDatabase &input_params_in, NodeValueTable &output_params) override;
virtual QVariant ProcessVideoFootage(StreamPtr stream, const rational &input_time);
virtual QVariant ProcessShader(const Node *node, const TimeRange &range, const ShaderJob& job);
// FIXME: Do something about audio?
private:
QSize size_;
};
+1 -1
View File
@@ -241,7 +241,7 @@ void ViewerDisplayWidget::paintGL()
// Draw gizmos if we have any
if (gizmos_) {
GizmoTraverser gt;
GizmoTraverser gt(QSize(gizmo_params_.width(), gizmo_params_.height()));
rational node_time = GetGizmoTime();