nodes: rework so that jobs can be completely deferred

Big optimization requiring a lot of refactoring.
This commit is contained in:
itsmattkc
2022-09-24 18:44:59 -07:00
parent 658fe9da7e
commit c0d8ff403f
57 changed files with 593 additions and 588 deletions
+5 -7
View File
@@ -76,21 +76,19 @@ ShaderCode MergeNode::GetShaderCode(const ShaderRequest &request) const
void MergeNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
{
ShaderJob job;
job.Insert(value);
TexturePtr base_tex = job.Get(kBaseIn).toTexture();
TexturePtr blend_tex = job.Get(kBlendIn).toTexture();
TexturePtr base_tex = value[kBaseIn].toTexture();
TexturePtr blend_tex = value[kBlendIn].toTexture();
if (base_tex || blend_tex) {
if (!base_tex || (blend_tex && blend_tex->channel_count() < VideoParams::kRGBAChannelCount)) {
// We only have a blend texture or the blend texture is RGB only, no need to alpha over
table->Push(job.Get(kBlendIn));
table->Push(value[kBlendIn]);
} else if (!blend_tex) {
// We only have a base texture, no need to alpha over
table->Push(job.Get(kBaseIn));
table->Push(value[kBaseIn]);
} else {
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
table->Push(NodeValue::kTexture, base_tex->toJob(ShaderJob(value)), this);
}
}
}