nodes: optimize job infrastructure
Rework traversing so that jobs are only resolved when they are used. This should provide moderate optimize to the traversing process.
This commit is contained in:
@@ -95,11 +95,7 @@ void PanNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (push_job) {
|
table->Push(NodeValue::kSamples, push_job ? QVariant::fromValue(job) : QVariant::fromValue(job.samples()), this);
|
||||||
table->Push(NodeValue::kSampleJob, QVariant::fromValue(job), this);
|
|
||||||
} else {
|
|
||||||
table->Push(NodeValue::kSamples, QVariant::fromValue(job.samples()), this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ ClipBlock::ClipBlock() :
|
|||||||
AddInput(kMaintainAudioPitchInput, NodeValue::kBoolean, false, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
AddInput(kMaintainAudioPitchInput, NodeValue::kBoolean, false, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable));
|
||||||
|
|
||||||
PrependInput(kBufferIn, NodeValue::kNone, InputFlags(kInputFlagNotKeyframable));
|
PrependInput(kBufferIn, NodeValue::kNone, InputFlags(kInputFlagNotKeyframable));
|
||||||
SetValueHintForInput(kBufferIn, ValueHint(NodeValue::kBuffer));
|
//SetValueHintForInput(kBufferIn, ValueHint(NodeValue::kBuffer));
|
||||||
|
|
||||||
SetEffectInput(kBufferIn);
|
SetEffectInput(kBufferIn);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ void TransitionBlock::Value(const NodeValueRow &value, const NodeGlobals &global
|
|||||||
|
|
||||||
ShaderJobEvent(value, job);
|
ShaderJobEvent(value, job);
|
||||||
|
|
||||||
job_type = NodeValue::kShaderJob;
|
job_type = NodeValue::kTexture;
|
||||||
push_job = QVariant::fromValue(job);
|
push_job = QVariant::fromValue(job);
|
||||||
} else if (data_type == NodeValue::kSamples) {
|
} else if (data_type == NodeValue::kSamples) {
|
||||||
// This must be an audio transition
|
// This must be an audio transition
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ void CornerPinDistortNode::Value(const NodeValueRow &value, const NodeGlobals &g
|
|||||||
&& job.GetValue(kTopRightInput).data().value<QVector2D>().isNull() &&
|
&& job.GetValue(kTopRightInput).data().value<QVector2D>().isNull() &&
|
||||||
job.GetValue(kBottomRightInput).data().value<QVector2D>().isNull() &&
|
job.GetValue(kBottomRightInput).data().value<QVector2D>().isNull() &&
|
||||||
job.GetValue(kBottomLeftInput).data().value<QVector2D>().isNull())) {
|
job.GetValue(kBottomLeftInput).data().value<QVector2D>().isNull())) {
|
||||||
table->Push(NodeValue::kShaderJob, QVariant::fromValue(job), this);
|
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||||
} else {
|
} else {
|
||||||
table->Push(NodeValue::kTexture, job.GetValue(kTextureInput).data(), this);
|
table->Push(NodeValue::kTexture, job.GetValue(kTextureInput).data(), this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ void CropDistortNode::Value(const NodeValueRow &value, const NodeGlobals &global
|
|||||||
|| !qIsNull(job.GetValue(kRightInput).data().toDouble())
|
|| !qIsNull(job.GetValue(kRightInput).data().toDouble())
|
||||||
|| !qIsNull(job.GetValue(kTopInput).data().toDouble())
|
|| !qIsNull(job.GetValue(kTopInput).data().toDouble())
|
||||||
|| !qIsNull(job.GetValue(kBottomInput).data().toDouble())) {
|
|| !qIsNull(job.GetValue(kBottomInput).data().toDouble())) {
|
||||||
table->Push(NodeValue::kShaderJob, QVariant::fromValue(job), this);
|
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||||
} else {
|
} else {
|
||||||
table->Push(NodeValue::kTexture, job.GetValue(kTextureInput).data(), this);
|
table->Push(NodeValue::kTexture, job.GetValue(kTextureInput).data(), this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ void FlipDistortNode::Value(const NodeValueRow &value, const NodeGlobals &global
|
|||||||
if (!job.GetValue(kTextureInput).data().isNull()) {
|
if (!job.GetValue(kTextureInput).data().isNull()) {
|
||||||
// Only run shader if at least one of flip or flop are selected
|
// Only run shader if at least one of flip or flop are selected
|
||||||
if (job.GetValue(kHorizontalInput).data().toBool() || job.GetValue(kVerticalInput).data().toBool()) {
|
if (job.GetValue(kHorizontalInput).data().toBool() || job.GetValue(kVerticalInput).data().toBool()) {
|
||||||
table->Push(NodeValue::kShaderJob, QVariant::fromValue(job), this);
|
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||||
} else {
|
} else {
|
||||||
// If we're not flipping or flopping just push the texture
|
// If we're not flipping or flopping just push the texture
|
||||||
table->Push(job.GetValue(kTextureInput));
|
table->Push(job.GetValue(kTextureInput));
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ void TransformDistortNode::Value(const NodeValueRow &value, const NodeGlobals &g
|
|||||||
// end up with gaps in the screen that will require an alpha channel.
|
// end up with gaps in the screen that will require an alpha channel.
|
||||||
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
|
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
|
||||||
|
|
||||||
table->Push(NodeValue::kShaderJob, QVariant::fromValue(job), this);
|
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||||
|
|
||||||
pushed_job = true;
|
pushed_job = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ void OpacityEffect::Value(const NodeValueRow &value, const NodeGlobals &globals,
|
|||||||
if (!job.GetValue(kTextureInput).data().isNull()) {
|
if (!job.GetValue(kTextureInput).data().isNull()) {
|
||||||
if (!qFuzzyCompare(job.GetValue(kValueInput).data().toDouble(), 1.0)) {
|
if (!qFuzzyCompare(job.GetValue(kValueInput).data().toDouble(), 1.0)) {
|
||||||
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
|
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
|
||||||
table->Push(NodeValue::kShaderJob, QVariant::fromValue(job), this);
|
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||||
} else {
|
} else {
|
||||||
// 1.0 float is a no-op, so just push the texture
|
// 1.0 float is a no-op, so just push the texture
|
||||||
table->Push(job.GetValue(kTextureInput));
|
table->Push(job.GetValue(kTextureInput));
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ BlurFilterNode::BlurFilterNode()
|
|||||||
{
|
{
|
||||||
AddInput(kTextureInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
|
AddInput(kTextureInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable));
|
||||||
|
|
||||||
AddInput(kMethodInput, NodeValue::kCombo, 0);
|
AddInput(kMethodInput, NodeValue::kCombo, 1); // Default to gaussian
|
||||||
|
|
||||||
AddInput(kRadiusInput, NodeValue::kFloat, 10.0);
|
AddInput(kRadiusInput, NodeValue::kFloat, 10.0);
|
||||||
SetInputProperty(kRadiusInput, QStringLiteral("min"), 0.0);
|
SetInputProperty(kRadiusInput, QStringLiteral("min"), 0.0);
|
||||||
@@ -118,7 +118,7 @@ void BlurFilterNode::Value(const NodeValueRow &value, const NodeGlobals &globals
|
|||||||
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
|
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
table->Push(NodeValue::kShaderJob, QVariant::fromValue(job), this);
|
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// If we're not performing the blur job, just push the texture
|
// If we're not performing the blur job, just push the texture
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ void MosaicFilterNode::Value(const NodeValueRow &value, const NodeGlobals &globa
|
|||||||
if (texture
|
if (texture
|
||||||
&& job.GetValue(kHorizInput).data().toInt() != texture->width()
|
&& job.GetValue(kHorizInput).data().toInt() != texture->width()
|
||||||
&& job.GetValue(kVertInput).data().toInt() != texture->height()) {
|
&& job.GetValue(kVertInput).data().toInt() != texture->height()) {
|
||||||
table->Push(NodeValue::kShaderJob, QVariant::fromValue(job), this);
|
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||||
} else {
|
} else {
|
||||||
table->Push(job.GetValue(kTextureInput));
|
table->Push(job.GetValue(kTextureInput));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ void StrokeFilterNode::Value(const NodeValueRow &value, const NodeGlobals &globa
|
|||||||
if (!job.GetValue(kTextureInput).data().isNull()) {
|
if (!job.GetValue(kTextureInput).data().isNull()) {
|
||||||
if (job.GetValue(kRadiusInput).data().toDouble() > 0.0
|
if (job.GetValue(kRadiusInput).data().toDouble() > 0.0
|
||||||
&& job.GetValue(kOpacityInput).data().toDouble() > 0.0) {
|
&& job.GetValue(kOpacityInput).data().toDouble() > 0.0) {
|
||||||
table->Push(NodeValue::kShaderJob, QVariant::fromValue(job), this);
|
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||||
} else {
|
} else {
|
||||||
table->Push(job.GetValue(kTextureInput));
|
table->Push(job.GetValue(kTextureInput));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ void NoiseGeneratorNode::Value(const NodeValueRow &value, const NodeGlobals &glo
|
|||||||
job.InsertValue(QStringLiteral("time_in"), NodeValue(NodeValue::kFloat, globals.time().in().toDouble(), this));
|
job.InsertValue(QStringLiteral("time_in"), NodeValue(NodeValue::kFloat, globals.time().in().toDouble(), this));
|
||||||
|
|
||||||
|
|
||||||
table->Push(NodeValue::kShaderJob, QVariant::fromValue(job), this);
|
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ void PolygonGenerator::Value(const NodeValueRow &value, const NodeGlobals &globa
|
|||||||
job.SetRequestedFormat(VideoParams::kFormatFloat32);
|
job.SetRequestedFormat(VideoParams::kFormatFloat32);
|
||||||
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
|
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
|
||||||
|
|
||||||
table->Push(NodeValue::kGenerateJob, QVariant::fromValue(job), this);
|
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolygonGenerator::GenerateFrame(FramePtr frame, const GenerateJob &job) const
|
void PolygonGenerator::GenerateFrame(FramePtr frame, const GenerateJob &job) const
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ void ShapeNode::Value(const NodeValueRow &value, const NodeGlobals &globals, Nod
|
|||||||
job.InsertValue(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this));
|
job.InsertValue(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this));
|
||||||
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
|
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
|
||||||
|
|
||||||
table->Push(NodeValue::kShaderJob, QVariant::fromValue(job), this);
|
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ void SolidGenerator::Value(const NodeValueRow &value, const NodeGlobals &globals
|
|||||||
{
|
{
|
||||||
ShaderJob job;
|
ShaderJob job;
|
||||||
job.InsertValue(value);
|
job.InsertValue(value);
|
||||||
table->Push(NodeValue::kShaderJob, QVariant::fromValue(job), this);
|
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderCode SolidGenerator::GetShaderCode(const QString &shader_id) const
|
ShaderCode SolidGenerator::GetShaderCode(const QString &shader_id) const
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ void TextGeneratorV1::Value(const NodeValueRow &value, const NodeGlobals &global
|
|||||||
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
|
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
|
||||||
|
|
||||||
if (!job.GetValue(kTextInput).data().toString().isEmpty()) {
|
if (!job.GetValue(kTextInput).data().toString().isEmpty()) {
|
||||||
table->Push(NodeValue::kGenerateJob, QVariant::fromValue(job), this);
|
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ void TextGeneratorV2::Value(const NodeValueRow &value, const NodeGlobals &global
|
|||||||
job.SetRequestedFormat(VideoParams::kFormatFloat32);
|
job.SetRequestedFormat(VideoParams::kFormatFloat32);
|
||||||
|
|
||||||
if (!job.GetValue(kTextInput).data().toString().isEmpty()) {
|
if (!job.GetValue(kTextInput).data().toString().isEmpty()) {
|
||||||
table->Push(NodeValue::kGenerateJob, QVariant::fromValue(job), this);
|
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ void ColorDifferenceKeyNode::Value(const NodeValueRow &value, const NodeGlobals
|
|||||||
|
|
||||||
// If there's no texture, no need to run an operation
|
// If there's no texture, no need to run an operation
|
||||||
if (!job.GetValue(kTextureInput).data().isNull()) {
|
if (!job.GetValue(kTextureInput).data().isNull()) {
|
||||||
table->Push(NodeValue::kShaderJob, QVariant::fromValue(job), this);
|
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ void DespillNode::Value(const NodeValueRow &value, const NodeGlobals &globals, N
|
|||||||
|
|
||||||
// If there's no texture, no need to run an operation
|
// If there's no texture, no need to run an operation
|
||||||
if (!job.GetValue(kTextureInput).data().isNull()) {
|
if (!job.GetValue(kTextureInput).data().isNull()) {
|
||||||
table->Push(NodeValue::kShaderJob, QVariant::fromValue(job), this);
|
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -382,7 +382,7 @@ void MathNodeBase::ValueInternal(Operation operation, Pairing pairing, const QSt
|
|||||||
output->Push(texture_val);
|
output->Push(texture_val);
|
||||||
} else {
|
} else {
|
||||||
// Push shader job
|
// Push shader job
|
||||||
output->Push(NodeValue::kShaderJob, QVariant::fromValue(job), this);
|
output->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -413,10 +413,10 @@ void MathNodeBase::ValueInternal(Operation operation, Pairing pairing, const QSt
|
|||||||
|
|
||||||
output->Push(NodeValue::kSamples, QVariant::fromValue(job.samples()), this);
|
output->Push(NodeValue::kSamples, QVariant::fromValue(job.samples()), this);
|
||||||
} else {
|
} else {
|
||||||
output->Push(NodeValue::kSampleJob, QVariant::fromValue(job), this);
|
output->Push(NodeValue::kSamples, QVariant::fromValue(job), this);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
output->Push(NodeValue::kSampleJob, QVariant::fromValue(job), this);
|
output->Push(NodeValue::kSamples, QVariant::fromValue(job), this);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ void MergeNode::Value(const NodeValueRow &value, const NodeGlobals &globals, Nod
|
|||||||
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOff);
|
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOff);
|
||||||
}
|
}
|
||||||
|
|
||||||
table->Push(NodeValue::kShaderJob, QVariant::fromValue(job), this);
|
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -341,6 +341,8 @@ void Footage::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeV
|
|||||||
Track::Reference ref = GetReferenceFromRealIndex(i);
|
Track::Reference ref = GetReferenceFromRealIndex(i);
|
||||||
FootageJob job(decoder_, filename(), ref.type(), GetLength(), loop_mode);
|
FootageJob job(decoder_, filename(), ref.type(), GetLength(), loop_mode);
|
||||||
|
|
||||||
|
NodeValue::Type type;
|
||||||
|
|
||||||
if (ref.type() == Track::kVideo) {
|
if (ref.type() == Track::kVideo) {
|
||||||
VideoParams vp = GetVideoParams(ref.index());
|
VideoParams vp = GetVideoParams(ref.index());
|
||||||
|
|
||||||
@@ -348,13 +350,17 @@ void Footage::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeV
|
|||||||
vp.set_colorspace(GetColorspaceToUse(vp));
|
vp.set_colorspace(GetColorspaceToUse(vp));
|
||||||
|
|
||||||
job.set_video_params(vp);
|
job.set_video_params(vp);
|
||||||
|
|
||||||
|
type = NodeValue::kTexture;
|
||||||
} else {
|
} else {
|
||||||
AudioParams ap = GetAudioParams(ref.index());
|
AudioParams ap = GetAudioParams(ref.index());
|
||||||
job.set_audio_params(ap);
|
job.set_audio_params(ap);
|
||||||
job.set_cache_path(project()->cache_path());
|
job.set_cache_path(project()->cache_path());
|
||||||
|
|
||||||
|
type = NodeValue::kSamples;
|
||||||
}
|
}
|
||||||
|
|
||||||
table->Push(NodeValue::kFootageJob, QVariant::fromValue(job), this, false, ref.ToString());
|
table->Push(type, QVariant::fromValue(job), this, false, ref.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+36
-66
@@ -52,6 +52,8 @@ NodeValueRow NodeTraverser::GenerateRow(NodeValueDatabase *database, const Node
|
|||||||
row.insert(it.key(), value);
|
row.insert(it.key(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PreProcessRow(node, range, row);
|
||||||
|
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,7 +260,6 @@ NodeValueTable NodeTraverser::GenerateTable(const Node *n, const Node::ValueHint
|
|||||||
|
|
||||||
if (is_enabled) {
|
if (is_enabled) {
|
||||||
NodeValueRow row = GenerateRow(&database, n, range);
|
NodeValueRow row = GenerateRow(&database, n, range);
|
||||||
//qDebug() << "FIXME: Implement pre-process of row";
|
|
||||||
|
|
||||||
// Generate output table
|
// Generate output table
|
||||||
NodeValueTable table = database.Merge();
|
NodeValueTable table = database.Merge();
|
||||||
@@ -266,9 +267,6 @@ NodeValueTable NodeTraverser::GenerateTable(const Node *n, const Node::ValueHint
|
|||||||
// By this point, the node should have all the inputs it needs to render correctly
|
// By this point, the node should have all the inputs it needs to render correctly
|
||||||
n->Value(row, GenerateGlobals(video_params_, range), &table);
|
n->Value(row, GenerateGlobals(video_params_, range), &table);
|
||||||
|
|
||||||
// Post-process table
|
|
||||||
PostProcessTable(n, hint, range, table);
|
|
||||||
|
|
||||||
return table;
|
return table;
|
||||||
} else {
|
} else {
|
||||||
return database.Merge();
|
return database.Merge();
|
||||||
@@ -355,9 +353,8 @@ QVector2D NodeTraverser::GenerateResolution() const
|
|||||||
return QVector2D(video_params_.square_pixel_width(), video_params_.height());
|
return QVector2D(video_params_.square_pixel_width(), video_params_.height());
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeTraverser::PostProcessTable(const Node *node, const Node::ValueHint &hint, const TimeRange &range, NodeValueTable &output_params)
|
void NodeTraverser::PreProcessRow(const Node *node, const TimeRange &range, NodeValueRow &row)
|
||||||
{
|
{
|
||||||
bool got_cached_frame = false;
|
|
||||||
QByteArray cached_node_hash;
|
QByteArray cached_node_hash;
|
||||||
|
|
||||||
// Convert footage to image/sample buffers
|
// Convert footage to image/sample buffers
|
||||||
@@ -374,80 +371,53 @@ void NodeTraverser::PostProcessTable(const Node *node, const Node::ValueHint &hi
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
// Strip out any jobs or footage
|
// Resolve any jobs
|
||||||
QList<NodeValue> footage_jobs_to_run;
|
for (auto it=row.begin(); it!=row.end(); it++) {
|
||||||
QList<NodeValue> shader_jobs_to_run;
|
// Jobs will almost always be submitted with one of these types
|
||||||
QList<NodeValue> sample_jobs_to_run;
|
NodeValue &val = it.value();
|
||||||
QList<NodeValue> generate_jobs_to_run;
|
|
||||||
|
|
||||||
for (int i=0; i<output_params.Count(); i++) {
|
if (val.type() == NodeValue::kTexture || val.type() == NodeValue::kSamples) {
|
||||||
const NodeValue& v = output_params.at(i);
|
const QVariant &v = val.data();
|
||||||
QList<NodeValue>* take_this_value_list = nullptr;
|
|
||||||
|
|
||||||
if (v.type() == NodeValue::kFootageJob) {
|
if (v.canConvert<ShaderJob>()) {
|
||||||
take_this_value_list = &footage_jobs_to_run;
|
|
||||||
} else if (v.type() == NodeValue::kShaderJob) {
|
|
||||||
take_this_value_list = &shader_jobs_to_run;
|
|
||||||
} else if (v.type() == NodeValue::kSampleJob) {
|
|
||||||
take_this_value_list = &sample_jobs_to_run;
|
|
||||||
} else if (v.type() == NodeValue::kGenerateJob) {
|
|
||||||
take_this_value_list = &generate_jobs_to_run;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (take_this_value_list) {
|
qDebug() << "Running shader for" << val.source();
|
||||||
take_this_value_list->append(output_params.TakeAt(i));
|
val.set_data(QVariant::fromValue(ProcessShader(val.source(), range, v.value<ShaderJob>())));
|
||||||
i--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!got_cached_frame) {
|
} else if (v.canConvert<GenerateJob>()) {
|
||||||
// Retrieve video frames
|
|
||||||
foreach (const NodeValue& v, footage_jobs_to_run) {
|
|
||||||
// Assume this is a VideoStream, we did a type check earlier in the function
|
|
||||||
FootageJob job = v.data().value<FootageJob>();
|
|
||||||
|
|
||||||
if (job.type() == Track::kVideo) {
|
val.set_data(QVariant::fromValue(ProcessFrameGeneration(val.source(), v.value<GenerateJob>())));
|
||||||
rational footage_time = Footage::AdjustTimeByLoopMode(range.in(), job.loop_mode(), job.length(), job.video_params().video_type(), job.video_params().frame_rate_as_time_base());
|
|
||||||
|
|
||||||
if (footage_time.isNaN()) {
|
} else if (v.canConvert<FootageJob>()) {
|
||||||
// Push dummy texture
|
|
||||||
output_params.Push(NodeValue::kTexture, QVariant::fromValue(CreateDummyTexture(job.video_params())), node, v.array(), v.tag());
|
FootageJob job = v.value<FootageJob>();
|
||||||
} else {
|
|
||||||
output_params.Push(NodeValue::kTexture, QVariant::fromValue(ProcessVideoFootage(job, footage_time)), node, v.array(), v.tag());
|
if (job.type() == Track::kVideo) {
|
||||||
|
rational footage_time = Footage::AdjustTimeByLoopMode(range.in(), job.loop_mode(), job.length(), job.video_params().video_type(), job.video_params().frame_rate_as_time_base());
|
||||||
|
|
||||||
|
if (footage_time.isNaN()) {
|
||||||
|
// Push dummy texture
|
||||||
|
val.set_data(QVariant::fromValue(CreateDummyTexture(job.video_params())));
|
||||||
|
} else {
|
||||||
|
val.set_data(QVariant::fromValue(ProcessVideoFootage(job, footage_time)));
|
||||||
|
}
|
||||||
|
} else if (job.type() == Track::kAudio) {
|
||||||
|
val.set_data(QVariant::fromValue(ProcessAudioFootage(job, range)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (v.canConvert<SampleJob>()) {
|
||||||
|
|
||||||
|
val.set_data(QVariant::fromValue(ProcessSamples(node, range, v.value<SampleJob>())));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Run shaders
|
|
||||||
foreach (const NodeValue& v, shader_jobs_to_run) {
|
|
||||||
output_params.Push(NodeValue::kTexture, QVariant::fromValue(ProcessShader(node, range, v.data().value<ShaderJob>())), node, v.array(), v.tag());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run generate jobs
|
|
||||||
foreach (const NodeValue& v, generate_jobs_to_run) {
|
|
||||||
output_params.Push(NodeValue::kTexture, QVariant::fromValue(ProcessFrameGeneration(node, v.data().value<GenerateJob>())), node, v.array(), v.tag());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve audio samples
|
/*if (CanCacheFrames() && node->GetCacheTextures() && !got_cached_frame) {
|
||||||
foreach (const NodeValue& v, footage_jobs_to_run) {
|
|
||||||
// Assume this is an AudioStream, we did a type check earlier in the function
|
|
||||||
FootageJob job = v.data().value<FootageJob>();
|
|
||||||
|
|
||||||
if (job.type() == Track::kAudio) {
|
|
||||||
output_params.Push(NodeValue::kSamples, QVariant::fromValue(ProcessAudioFootage(job, range)), node, v.array(), v.tag());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run any accelerated shader jobs
|
|
||||||
foreach (const NodeValue& v, sample_jobs_to_run) {
|
|
||||||
output_params.Push(NodeValue::kSamples, QVariant::fromValue(ProcessSamples(node, range, v.data().value<SampleJob>())), node, v.array(), v.tag());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CanCacheFrames() && node->GetCacheTextures() && !got_cached_frame) {
|
|
||||||
// Save cached texture
|
// Save cached texture
|
||||||
SaveCachedTexture(cached_node_hash, output_params.Get(NodeValue::kTexture).value<TexturePtr>());
|
SaveCachedTexture(cached_node_hash, output_params.Get(NodeValue::kTexture).value<TexturePtr>());
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
TexturePtr NodeTraverser::CreateDummyTexture(const VideoParams &p)
|
TexturePtr NodeTraverser::CreateDummyTexture(const VideoParams &p)
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void PostProcessTable(const Node *node, const Node::ValueHint &hint, const TimeRange &range, NodeValueTable &output_params);
|
void PreProcessRow(const Node *node, const TimeRange &range, NodeValueRow &row);
|
||||||
|
|
||||||
TexturePtr CreateDummyTexture(const VideoParams &p);
|
TexturePtr CreateDummyTexture(const VideoParams &p);
|
||||||
|
|
||||||
|
|||||||
@@ -135,12 +135,8 @@ QByteArray NodeValue::ValueToBytes(NodeValue::Type type, const QVariant &value)
|
|||||||
|
|
||||||
// These types have no persistent input
|
// These types have no persistent input
|
||||||
case kNone:
|
case kNone:
|
||||||
case kFootageJob:
|
|
||||||
case kTexture:
|
case kTexture:
|
||||||
case kSamples:
|
case kSamples:
|
||||||
case kShaderJob:
|
|
||||||
case kSampleJob:
|
|
||||||
case kGenerateJob:
|
|
||||||
case kDataTypeCount:
|
case kDataTypeCount:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -354,10 +350,6 @@ QString NodeValue::GetPrettyDataTypeName(Type type)
|
|||||||
case kAudioParams:
|
case kAudioParams:
|
||||||
return QCoreApplication::translate("NodeValue", "Audio Parameters");
|
return QCoreApplication::translate("NodeValue", "Audio Parameters");
|
||||||
|
|
||||||
case kFootageJob:
|
|
||||||
case kShaderJob:
|
|
||||||
case kSampleJob:
|
|
||||||
case kGenerateJob:
|
|
||||||
case kDataTypeCount:
|
case kDataTypeCount:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -406,10 +398,6 @@ QString NodeValue::GetDataTypeName(Type type)
|
|||||||
return QStringLiteral("vparam");
|
return QStringLiteral("vparam");
|
||||||
case kAudioParams:
|
case kAudioParams:
|
||||||
return QStringLiteral("aparam");
|
return QStringLiteral("aparam");
|
||||||
case kFootageJob:
|
|
||||||
case kShaderJob:
|
|
||||||
case kSampleJob:
|
|
||||||
case kGenerateJob:
|
|
||||||
case kDataTypeCount:
|
case kDataTypeCount:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-36
@@ -172,42 +172,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
kAudioParams,
|
kAudioParams,
|
||||||
|
|
||||||
/**
|
|
||||||
* Job type
|
|
||||||
*
|
|
||||||
* An internal type used to indicate to the renderer that a footage job needs to
|
|
||||||
* run. This value will usually be taken from a table and a kTexture or kSamples value will be
|
|
||||||
* pushed to take its place.
|
|
||||||
*/
|
|
||||||
kFootageJob,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Job type
|
|
||||||
*
|
|
||||||
* An internal type used to indicate to the renderer that an accelerated shader job needs to
|
|
||||||
* run. This value will usually be taken from a table and a kTexture value will be pushed to
|
|
||||||
* take its place.
|
|
||||||
*/
|
|
||||||
kShaderJob,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Job type
|
|
||||||
*
|
|
||||||
* An internal type used to indicate to the renderer that an accelerated sample job needs to
|
|
||||||
* take place. This value will usually be taken from a table and a kSamples value will be
|
|
||||||
* pushed to take its place.
|
|
||||||
*/
|
|
||||||
kSampleJob,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Job type
|
|
||||||
*
|
|
||||||
* An internal type used to indicate to the renderer that an accelerated sample job needs to
|
|
||||||
* take place. This value will usually be taken from a table and a kSamples value will be
|
|
||||||
* pushed to take its place.
|
|
||||||
*/
|
|
||||||
kGenerateJob,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End of list
|
* End of list
|
||||||
*/
|
*/
|
||||||
@@ -244,6 +208,11 @@ public:
|
|||||||
return data_;
|
return data_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_data(const QVariant& data)
|
||||||
|
{
|
||||||
|
data_ = data;
|
||||||
|
}
|
||||||
|
|
||||||
const QString& tag() const
|
const QString& tag() const
|
||||||
{
|
{
|
||||||
return tag_;
|
return tag_;
|
||||||
|
|||||||
@@ -518,10 +518,6 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, Video
|
|||||||
case NodeValue::kFile:
|
case NodeValue::kFile:
|
||||||
case NodeValue::kVideoParams:
|
case NodeValue::kVideoParams:
|
||||||
case NodeValue::kAudioParams:
|
case NodeValue::kAudioParams:
|
||||||
case NodeValue::kShaderJob:
|
|
||||||
case NodeValue::kSampleJob:
|
|
||||||
case NodeValue::kGenerateJob:
|
|
||||||
case NodeValue::kFootageJob:
|
|
||||||
case NodeValue::kBezier:
|
case NodeValue::kBezier:
|
||||||
case NodeValue::kNone:
|
case NodeValue::kNone:
|
||||||
case NodeValue::kDataTypeCount:
|
case NodeValue::kDataTypeCount:
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ NodeParamView::NodeParamView(bool create_keyframe_view, QWidget *parent) :
|
|||||||
super(true, false, parent),
|
super(true, false, parent),
|
||||||
last_scroll_val_(0),
|
last_scroll_val_(0),
|
||||||
focused_node_(nullptr),
|
focused_node_(nullptr),
|
||||||
time_target_(nullptr)
|
time_target_(nullptr),
|
||||||
|
show_all_nodes_(true)
|
||||||
{
|
{
|
||||||
// Create horizontal layout to place scroll area in (and keyframe editing eventually)
|
// Create horizontal layout to place scroll area in (and keyframe editing eventually)
|
||||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||||
@@ -453,7 +454,7 @@ void NodeParamView::RemoveContext(Node *ctx)
|
|||||||
|
|
||||||
void NodeParamView::AddNode(Node *n, Node *ctx, NodeParamViewContext *context)
|
void NodeParamView::AddNode(Node *n, Node *ctx, NodeParamViewContext *context)
|
||||||
{
|
{
|
||||||
if ((n->GetFlags() & Node::kDontShowInParamView) && !IsGroupMode()) {
|
if ((n->GetFlags() & Node::kDontShowInParamView) && !IsGroupMode() && !show_all_nodes_) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -143,6 +143,8 @@ private:
|
|||||||
QVector<Node*> contexts_;
|
QVector<Node*> contexts_;
|
||||||
QVector<Node*> current_contexts_;
|
QVector<Node*> current_contexts_;
|
||||||
|
|
||||||
|
bool show_all_nodes_;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void UpdateGlobalScrollBar();
|
void UpdateGlobalScrollBar();
|
||||||
|
|
||||||
|
|||||||
@@ -87,10 +87,6 @@ void NodeParamViewWidgetBridge::CreateWidgets()
|
|||||||
case NodeValue::kTexture:
|
case NodeValue::kTexture:
|
||||||
case NodeValue::kMatrix:
|
case NodeValue::kMatrix:
|
||||||
case NodeValue::kSamples:
|
case NodeValue::kSamples:
|
||||||
case NodeValue::kFootageJob:
|
|
||||||
case NodeValue::kShaderJob:
|
|
||||||
case NodeValue::kSampleJob:
|
|
||||||
case NodeValue::kGenerateJob:
|
|
||||||
case NodeValue::kVideoParams:
|
case NodeValue::kVideoParams:
|
||||||
case NodeValue::kAudioParams:
|
case NodeValue::kAudioParams:
|
||||||
case NodeValue::kDataTypeCount:
|
case NodeValue::kDataTypeCount:
|
||||||
@@ -241,10 +237,6 @@ void NodeParamViewWidgetBridge::WidgetCallback()
|
|||||||
case NodeValue::kTexture:
|
case NodeValue::kTexture:
|
||||||
case NodeValue::kMatrix:
|
case NodeValue::kMatrix:
|
||||||
case NodeValue::kSamples:
|
case NodeValue::kSamples:
|
||||||
case NodeValue::kFootageJob:
|
|
||||||
case NodeValue::kShaderJob:
|
|
||||||
case NodeValue::kSampleJob:
|
|
||||||
case NodeValue::kGenerateJob:
|
|
||||||
case NodeValue::kVideoParams:
|
case NodeValue::kVideoParams:
|
||||||
case NodeValue::kAudioParams:
|
case NodeValue::kAudioParams:
|
||||||
case NodeValue::kDataTypeCount:
|
case NodeValue::kDataTypeCount:
|
||||||
@@ -422,10 +414,6 @@ void NodeParamViewWidgetBridge::UpdateWidgetValues()
|
|||||||
case NodeValue::kTexture:
|
case NodeValue::kTexture:
|
||||||
case NodeValue::kMatrix:
|
case NodeValue::kMatrix:
|
||||||
case NodeValue::kSamples:
|
case NodeValue::kSamples:
|
||||||
case NodeValue::kFootageJob:
|
|
||||||
case NodeValue::kShaderJob:
|
|
||||||
case NodeValue::kSampleJob:
|
|
||||||
case NodeValue::kGenerateJob:
|
|
||||||
case NodeValue::kVideoParams:
|
case NodeValue::kVideoParams:
|
||||||
case NodeValue::kAudioParams:
|
case NodeValue::kAudioParams:
|
||||||
case NodeValue::kDataTypeCount:
|
case NodeValue::kDataTypeCount:
|
||||||
|
|||||||
@@ -139,10 +139,6 @@ void NodeTableView::SetTime(const rational &time)
|
|||||||
switch (value.type()) {
|
switch (value.type()) {
|
||||||
case NodeValue::kVideoParams:
|
case NodeValue::kVideoParams:
|
||||||
case NodeValue::kAudioParams:
|
case NodeValue::kAudioParams:
|
||||||
case NodeValue::kFootageJob:
|
|
||||||
case NodeValue::kShaderJob:
|
|
||||||
case NodeValue::kSampleJob:
|
|
||||||
case NodeValue::kGenerateJob:
|
|
||||||
// These types have no string representation
|
// These types have no string representation
|
||||||
break;
|
break;
|
||||||
case NodeValue::kTexture:
|
case NodeValue::kTexture:
|
||||||
|
|||||||
Reference in New Issue
Block a user