update chroma key GetShaderCode sig

This commit is contained in:
itsmattkc
2022-05-07 13:55:05 -07:00
parent fdc2d76406
commit b4bf57ad50
4 changed files with 12 additions and 6 deletions
+3 -2
View File
@@ -94,9 +94,9 @@ void ChromaKeyNode::InputValueChangedEvent(const QString &input, int element)
GenerateProcessor();
}
ShaderCode ChromaKeyNode::GetShaderCode(const QString &) const
ShaderCode ChromaKeyNode::GetShaderCode(const ShaderRequest &request) const
{
return ShaderCode(FileFunctions::ReadFileAsString(QStringLiteral(":/shaders/chromakey.frag")));
return ShaderCode(FileFunctions::ReadFileAsString(QStringLiteral(":/shaders/chromakey.frag")).arg(request.stub));
}
void ChromaKeyNode::GenerateProcessor()
@@ -122,6 +122,7 @@ void ChromaKeyNode::Value(const NodeValueRow &value, const NodeGlobals &globals,
job.SetInputTexture(value[kTextureInput].data().value<TexturePtr>());
job.SetNeedsCustomShader(this);
job.SetFunctionName(QStringLiteral("SceneLinearToCIEXYZ_d65"));
job.SetOverrideID(id());
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
}
+1 -1
View File
@@ -37,7 +37,7 @@ class ChromaKeyNode : public OCIOBaseNode {
virtual void InputValueChangedEvent(const QString& input, int element) override;
virtual ShaderCode GetShaderCode(const QString &shader_id) const override;
virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override;
virtual void Value(const NodeValueRow& value, const NodeGlobals& globals, NodeValueTable* table) const override;
virtual void ConfigChanged() override;
+6
View File
@@ -672,6 +672,12 @@ public:
id = shader_id;
}
ShaderRequest(const QString &shader_id, const QString &shader_stub)
{
id = shader_id;
stub = shader_stub;
}
QString id;
QString stub;
};
+2 -3
View File
@@ -123,14 +123,13 @@ bool Renderer::GetColorContext(const ColorTransformJob &color_job, Renderer::Col
ShaderCode code;
if (const Node *shader_src = color_job.CustomShaderSource()) {
// Use shader code from associated node
code = shader_src->GetShaderCode(color_job.CustomShaderID());
code = shader_src->GetShaderCode({color_job.CustomShaderID(), shader_desc->getShaderText()});
} else {
// Generate shader code using OCIO stub and our auto-generated name
code = FileFunctions::ReadFileAsString(QStringLiteral(":shaders/colormanage.frag"));
code.set_frag_code(code.frag_code().arg(shader_desc->getShaderText()));
}
code.set_frag_code(code.frag_code().arg(shader_desc->getShaderText()));
// Try to compile shader
color_ctx.compiled_shader = CreateNativeShader(code);