accleratedjob: simplified function calls

This commit is contained in:
itsmattkc
2022-05-09 15:16:46 -07:00
parent 6c7dbc8521
commit b88e15b8cf
33 changed files with 149 additions and 149 deletions
@@ -58,7 +58,7 @@ ShaderCode DipToColorTransition::GetShaderCode(const ShaderRequest &request) con
void DipToColorTransition::ShaderJobEvent(const NodeValueRow &value, ShaderJob &job) const void DipToColorTransition::ShaderJobEvent(const NodeValueRow &value, ShaderJob &job) const
{ {
job.InsertValue(kColorInput, value); job.Insert(kColorInput, value);
} }
} }
+6 -6
View File
@@ -162,15 +162,15 @@ double TransitionBlock::GetInternalTransitionTime(const double &time) const
void TransitionBlock::InsertTransitionTimes(AcceleratedJob *job, const double &time) const void TransitionBlock::InsertTransitionTimes(AcceleratedJob *job, const double &time) const
{ {
// Provides total transition progress from 0.0 (start) - 1.0 (end) // Provides total transition progress from 0.0 (start) - 1.0 (end)
job->InsertValue(QStringLiteral("ove_tprog_all"), job->Insert(QStringLiteral("ove_tprog_all"),
NodeValue(NodeValue::kFloat, GetTotalProgress(time), this)); NodeValue(NodeValue::kFloat, GetTotalProgress(time), this));
// Provides progress of out section from 1.0 (start) - 0.0 (end) // Provides progress of out section from 1.0 (start) - 0.0 (end)
job->InsertValue(QStringLiteral("ove_tprog_out"), job->Insert(QStringLiteral("ove_tprog_out"),
NodeValue(NodeValue::kFloat, GetOutProgress(time), this)); NodeValue(NodeValue::kFloat, GetOutProgress(time), this));
// Provides progress of in section from 0.0 (start) - 1.0 (end) // Provides progress of in section from 0.0 (start) - 1.0 (end)
job->InsertValue(QStringLiteral("ove_tprog_in"), job->Insert(QStringLiteral("ove_tprog_in"),
NodeValue(NodeValue::kFloat, GetInProgress(time), this)); NodeValue(NodeValue::kFloat, GetInProgress(time), this));
} }
@@ -188,14 +188,14 @@ void TransitionBlock::Value(const NodeValueRow &value, const NodeGlobals &global
ShaderJob job; ShaderJob job;
if (out_buffer.type() != NodeValue::kNone) { if (out_buffer.type() != NodeValue::kNone) {
job.InsertValue(kOutBlockInput, out_buffer); job.Insert(kOutBlockInput, out_buffer);
} }
if (in_buffer.type() != NodeValue::kNone) { if (in_buffer.type() != NodeValue::kNone) {
job.InsertValue(kInBlockInput, in_buffer); job.Insert(kInBlockInput, in_buffer);
} }
job.InsertValue(kCurveInput, value); job.Insert(kCurveInput, value);
double time = globals.time().in().toDouble(); double time = globals.time().in().toDouble();
InsertTransitionTimes(&job, time); InsertTransitionTimes(&job, time);
@@ -161,7 +161,7 @@ void OCIOGradingTransformLinearNode::Value(const NodeValueRow &value, const Node
job.SetColorProcessor(processor()); job.SetColorProcessor(processor());
job.SetInputTexture(value[kTextureInput].toTexture()); job.SetInputTexture(value[kTextureInput].toTexture());
job.InsertValue(value); job.Insert(value);
const int MASTER_CHANNEL = 0; const int MASTER_CHANNEL = 0;
const int RED_CHANNEL = 1; const int RED_CHANNEL = 1;
@@ -176,26 +176,26 @@ void OCIOGradingTransformLinearNode::Value(const NodeValueRow &value, const Node
offset[RED_CHANNEL] += offset[MASTER_CHANNEL]; offset[RED_CHANNEL] += offset[MASTER_CHANNEL];
offset[GREEN_CHANNEL] += offset[MASTER_CHANNEL]; offset[GREEN_CHANNEL] += offset[MASTER_CHANNEL];
offset[BLUE_CHANNEL] += offset[MASTER_CHANNEL]; offset[BLUE_CHANNEL] += offset[MASTER_CHANNEL];
job.InsertValue(kOffsetInput, NodeValue(NodeValue::kVec3, QVector3D(offset[RED_CHANNEL], offset[GREEN_CHANNEL], offset[BLUE_CHANNEL]))); job.Insert(kOffsetInput, NodeValue(NodeValue::kVec3, QVector3D(offset[RED_CHANNEL], offset[GREEN_CHANNEL], offset[BLUE_CHANNEL])));
QVector4D exposure = value[kExposureInput].toVec4(); QVector4D exposure = value[kExposureInput].toVec4();
exposure[RED_CHANNEL] = std::pow(2.0f, exposure[MASTER_CHANNEL] + exposure[RED_CHANNEL]); exposure[RED_CHANNEL] = std::pow(2.0f, exposure[MASTER_CHANNEL] + exposure[RED_CHANNEL]);
exposure[GREEN_CHANNEL] = std::pow(2.0f, exposure[MASTER_CHANNEL] + exposure[GREEN_CHANNEL]); exposure[GREEN_CHANNEL] = std::pow(2.0f, exposure[MASTER_CHANNEL] + exposure[GREEN_CHANNEL]);
exposure[BLUE_CHANNEL] = std::pow(2.0f, exposure[MASTER_CHANNEL] + exposure[BLUE_CHANNEL]); exposure[BLUE_CHANNEL] = std::pow(2.0f, exposure[MASTER_CHANNEL] + exposure[BLUE_CHANNEL]);
job.InsertValue(kExposureInput, NodeValue(NodeValue::kVec3, QVector3D(exposure[RED_CHANNEL], exposure[GREEN_CHANNEL], exposure[BLUE_CHANNEL]))); job.Insert(kExposureInput, NodeValue(NodeValue::kVec3, QVector3D(exposure[RED_CHANNEL], exposure[GREEN_CHANNEL], exposure[BLUE_CHANNEL])));
QVector4D contrast = value[kContrastInput].toVec4(); QVector4D contrast = value[kContrastInput].toVec4();
contrast[RED_CHANNEL] *= contrast[MASTER_CHANNEL]; contrast[RED_CHANNEL] *= contrast[MASTER_CHANNEL];
contrast[GREEN_CHANNEL] *= contrast[MASTER_CHANNEL]; contrast[GREEN_CHANNEL] *= contrast[MASTER_CHANNEL];
contrast[BLUE_CHANNEL] *= contrast[MASTER_CHANNEL]; contrast[BLUE_CHANNEL] *= contrast[MASTER_CHANNEL];
job.InsertValue(kContrastInput, NodeValue(NodeValue::kVec3, QVector3D(contrast[RED_CHANNEL], contrast[GREEN_CHANNEL], contrast[BLUE_CHANNEL]))); job.Insert(kContrastInput, NodeValue(NodeValue::kVec3, QVector3D(contrast[RED_CHANNEL], contrast[GREEN_CHANNEL], contrast[BLUE_CHANNEL])));
if (!value[kClampBlackEnableInput].toBool()) { if (!value[kClampBlackEnableInput].toBool()) {
job.InsertValue(kClampBlackInput, NodeValue(NodeValue::kFloat, OCIO::GradingPrimary::NoClampBlack())); job.Insert(kClampBlackInput, NodeValue(NodeValue::kFloat, OCIO::GradingPrimary::NoClampBlack()));
} }
if (!value[kClampWhiteEnableInput].toBool()) { if (!value[kClampWhiteEnableInput].toBool()) {
job.InsertValue(kClampWhiteInput, NodeValue(NodeValue::kFloat, OCIO::GradingPrimary::NoClampWhite())); job.Insert(kClampWhiteInput, NodeValue(NodeValue::kFloat, OCIO::GradingPrimary::NoClampWhite()));
} }
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this); table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
@@ -70,9 +70,9 @@ void CornerPinDistortNode::Retranslate()
void CornerPinDistortNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const void CornerPinDistortNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
{ {
ShaderJob job; ShaderJob job;
job.InsertValue(value); job.Insert(value);
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn); job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
job.InsertValue(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this)); job.Insert(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this));
// Convert slider values to their pixel values and then convert to clip space (-1.0 ... 1.0) for overriding the // Convert slider values to their pixel values and then convert to clip space (-1.0 ... 1.0) for overriding the
// vertex coordinates. // vertex coordinates.
@@ -94,16 +94,16 @@ void CornerPinDistortNode::Value(const NodeValueRow &value, const NodeGlobals &g
job.SetVertexCoordinates(adjusted_vertices); job.SetVertexCoordinates(adjusted_vertices);
// If no texture do nothing // If no texture do nothing
if (job.GetValue(kTextureInput).toTexture()) { if (job.Get(kTextureInput).toTexture()) {
// In the special case that all sliders are in their default position just // In the special case that all sliders are in their default position just
// push the texture. // push the texture.
if (!(job.GetValue(kTopLeftInput).toVec2().isNull() if (!(job.Get(kTopLeftInput).toVec2().isNull()
&& job.GetValue(kTopRightInput).toVec2().isNull() && && job.Get(kTopRightInput).toVec2().isNull() &&
job.GetValue(kBottomRightInput).toVec2().isNull() && job.Get(kBottomRightInput).toVec2().isNull() &&
job.GetValue(kBottomLeftInput).toVec2().isNull())) { job.Get(kBottomLeftInput).toVec2().isNull())) {
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this); table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
} else { } else {
table->Push(job.GetValue(kTextureInput)); table->Push(job.Get(kTextureInput));
} }
} }
} }
+8 -8
View File
@@ -78,18 +78,18 @@ void CropDistortNode::Retranslate()
void CropDistortNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const void CropDistortNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
{ {
ShaderJob job; ShaderJob job;
job.InsertValue(value); job.Insert(value);
job.InsertValue(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this)); job.Insert(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this));
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn); job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
if (job.GetValue(kTextureInput).toTexture()) { if (job.Get(kTextureInput).toTexture()) {
if (!qIsNull(job.GetValue(kLeftInput).toDouble()) if (!qIsNull(job.Get(kLeftInput).toDouble())
|| !qIsNull(job.GetValue(kRightInput).toDouble()) || !qIsNull(job.Get(kRightInput).toDouble())
|| !qIsNull(job.GetValue(kTopInput).toDouble()) || !qIsNull(job.Get(kTopInput).toDouble())
|| !qIsNull(job.GetValue(kBottomInput).toDouble())) { || !qIsNull(job.Get(kBottomInput).toDouble())) {
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this); table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
} else { } else {
table->Push(job.GetValue(kTextureInput)); table->Push(job.Get(kTextureInput));
} }
} }
} }
+4 -4
View File
@@ -79,16 +79,16 @@ void FlipDistortNode::Value(const NodeValueRow &value, const NodeGlobals &global
{ {
ShaderJob job; ShaderJob job;
job.InsertValue(value); job.Insert(value);
// 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).toTexture()) { if (job.Get(kTextureInput).toTexture()) {
// 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).toBool() || job.GetValue(kVerticalInput).toBool()) { if (job.Get(kHorizontalInput).toBool() || job.Get(kVerticalInput).toBool()) {
table->Push(NodeValue::kTexture, 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.Get(kTextureInput));
} }
} }
+10 -10
View File
@@ -65,26 +65,26 @@ void MaskDistortNode::Value(const NodeValueRow &value, const NodeGlobals &global
ShaderJob merge; ShaderJob merge;
merge.SetShaderID(QStringLiteral("mrg")); merge.SetShaderID(QStringLiteral("mrg"));
merge.InsertValue(QStringLiteral("tex_a"), value[kBaseInput]); merge.Insert(QStringLiteral("tex_a"), value[kBaseInput]);
if (value[kFeatherInput].toDouble() > 0.0) { if (value[kFeatherInput].toDouble() > 0.0) {
// Nest a blur shader in there too // Nest a blur shader in there too
ShaderJob feather; ShaderJob feather;
feather.SetShaderID(QStringLiteral("feather")); feather.SetShaderID(QStringLiteral("feather"));
feather.InsertValue(BlurFilterNode::kTextureInput, NodeValue(NodeValue::kTexture, job, this)); feather.Insert(BlurFilterNode::kTextureInput, NodeValue(NodeValue::kTexture, job, this));
feather.InsertValue(BlurFilterNode::kMethodInput, NodeValue(NodeValue::kInt, int(BlurFilterNode::kGaussian), this)); feather.Insert(BlurFilterNode::kMethodInput, NodeValue(NodeValue::kInt, int(BlurFilterNode::kGaussian), this));
feather.InsertValue(BlurFilterNode::kHorizInput, NodeValue(NodeValue::kBoolean, true, this)); feather.Insert(BlurFilterNode::kHorizInput, NodeValue(NodeValue::kBoolean, true, this));
feather.InsertValue(BlurFilterNode::kVertInput, NodeValue(NodeValue::kBoolean, true, this)); feather.Insert(BlurFilterNode::kVertInput, NodeValue(NodeValue::kBoolean, true, this));
feather.InsertValue(BlurFilterNode::kRepeatEdgePixelsInput, NodeValue(NodeValue::kBoolean, true, this)); feather.Insert(BlurFilterNode::kRepeatEdgePixelsInput, NodeValue(NodeValue::kBoolean, true, this));
feather.InsertValue(BlurFilterNode::kRadiusInput, NodeValue(NodeValue::kFloat, value[kFeatherInput].toDouble(), this)); feather.Insert(BlurFilterNode::kRadiusInput, NodeValue(NodeValue::kFloat, value[kFeatherInput].toDouble(), this));
feather.SetIterations(2, BlurFilterNode::kTextureInput); feather.SetIterations(2, BlurFilterNode::kTextureInput);
feather.InsertValue(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this)); feather.Insert(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this));
feather.SetAlphaChannelRequired(ShaderJob::kAlphaForceOn); feather.SetAlphaChannelRequired(ShaderJob::kAlphaForceOn);
merge.InsertValue(QStringLiteral("tex_b"), NodeValue(NodeValue::kTexture, feather, this)); merge.Insert(QStringLiteral("tex_b"), NodeValue(NodeValue::kTexture, feather, this));
} else { } else {
merge.InsertValue(QStringLiteral("tex_b"), NodeValue(NodeValue::kTexture, job, this)); merge.Insert(QStringLiteral("tex_b"), NodeValue(NodeValue::kTexture, job, this));
} }
table->Push(NodeValue::kTexture, QVariant::fromValue(merge), this); table->Push(NodeValue::kTexture, QVariant::fromValue(merge), this);
@@ -99,8 +99,8 @@ void TransformDistortNode::Value(const NodeValueRow &value, const NodeGlobals &g
if (!real_matrix.isIdentity()) { if (!real_matrix.isIdentity()) {
// The matrix will transform things // The matrix will transform things
ShaderJob job; ShaderJob job;
job.InsertValue(QStringLiteral("ove_maintex"), NodeValue(NodeValue::kTexture, QVariant::fromValue(texture), this)); job.Insert(QStringLiteral("ove_maintex"), NodeValue(NodeValue::kTexture, QVariant::fromValue(texture), this));
job.InsertValue(QStringLiteral("ove_mvpmat"), NodeValue(NodeValue::kMatrix, real_matrix, this)); job.Insert(QStringLiteral("ove_mvpmat"), NodeValue(NodeValue::kMatrix, real_matrix, this));
job.SetInterpolation(QStringLiteral("ove_maintex"), static_cast<Texture::Interpolation>(value[kInterpolationInput].toInt())); job.SetInterpolation(QStringLiteral("ove_maintex"), static_cast<Texture::Interpolation>(value[kInterpolationInput].toInt()));
// FIXME: This should be optimized, we can use matrix math to determine if this operation will // FIXME: This should be optimized, we can use matrix math to determine if this operation will
+4 -4
View File
@@ -47,16 +47,16 @@ void OpacityEffect::Value(const NodeValueRow &value, const NodeGlobals &globals,
{ {
ShaderJob job; ShaderJob job;
job.InsertValue(value); job.Insert(value);
// 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).toTexture()) { if (job.Get(kTextureInput).toTexture()) {
if (!qFuzzyCompare(job.GetValue(kValueInput).toDouble(), 1.0)) { if (!qFuzzyCompare(job.Get(kValueInput).toDouble(), 1.0)) {
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn); job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
table->Push(NodeValue::kTexture, 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.Get(kTextureInput));
} }
} }
} }
+9 -9
View File
@@ -121,25 +121,25 @@ void BlurFilterNode::Value(const NodeValueRow &value, const NodeGlobals &globals
{ {
ShaderJob job; ShaderJob job;
job.InsertValue(value); job.Insert(value);
job.InsertValue(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this)); job.Insert(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this));
Method method = static_cast<Method>(job.GetValue(kMethodInput).toInt()); Method method = static_cast<Method>(job.Get(kMethodInput).toInt());
// 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).toTexture()) { if (job.Get(kTextureInput).toTexture()) {
bool can_push_job = true; bool can_push_job = true;
// Check if radius is > 0 // Check if radius is > 0
if (job.GetValue(kRadiusInput).toDouble() > 0.0) { if (job.Get(kRadiusInput).toDouble() > 0.0) {
// Method-specific considerations // Method-specific considerations
switch (method) { switch (method) {
case kBox: case kBox:
case kGaussian: case kGaussian:
{ {
bool horiz = job.GetValue(kHorizInput).toBool(); bool horiz = job.Get(kHorizInput).toBool();
bool vert = job.GetValue(kVertInput).toBool(); bool vert = job.Get(kVertInput).toBool();
if (!horiz && !vert) { if (!horiz && !vert) {
// Disable job if horiz and vert are unchecked // Disable job if horiz and vert are unchecked
@@ -160,14 +160,14 @@ void BlurFilterNode::Value(const NodeValueRow &value, const NodeGlobals &globals
if (can_push_job) { if (can_push_job) {
// If we're not repeating pixels, expect an alpha channel to appear // If we're not repeating pixels, expect an alpha channel to appear
if (!job.GetValue(kRepeatEdgePixelsInput).toBool()) { if (!job.Get(kRepeatEdgePixelsInput).toBool()) {
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn); job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
} }
table->Push(NodeValue::kTexture, 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
table->Push(job.GetValue(kTextureInput)); table->Push(job.Get(kTextureInput));
} }
} }
+6 -6
View File
@@ -55,20 +55,20 @@ void MosaicFilterNode::Value(const NodeValueRow &value, const NodeGlobals &globa
{ {
ShaderJob job; ShaderJob job;
job.InsertValue(value); job.Insert(value);
// Mipmapping makes this look weird, so we just use bilinear for finding the color of each block // Mipmapping makes this look weird, so we just use bilinear for finding the color of each block
job.SetInterpolation(kTextureInput, Texture::kLinear); job.SetInterpolation(kTextureInput, Texture::kLinear);
if (job.GetValue(kTextureInput).toTexture()) { if (job.Get(kTextureInput).toTexture()) {
TexturePtr texture = job.GetValue(kTextureInput).toTexture(); TexturePtr texture = job.Get(kTextureInput).toTexture();
if (texture if (texture
&& job.GetValue(kHorizInput).toInt() != texture->width() && job.Get(kHorizInput).toInt() != texture->width()
&& job.GetValue(kVertInput).toInt() != texture->height()) { && job.Get(kVertInput).toInt() != texture->height()) {
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this); table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
} else { } else {
table->Push(job.GetValue(kTextureInput)); table->Push(job.Get(kTextureInput));
} }
} }
} }
+6 -6
View File
@@ -88,15 +88,15 @@ void StrokeFilterNode::Value(const NodeValueRow &value, const NodeGlobals &globa
{ {
ShaderJob job; ShaderJob job;
job.InsertValue(value); job.Insert(value);
job.InsertValue(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this)); job.Insert(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this));
if (job.GetValue(kTextureInput).toTexture()) { if (job.Get(kTextureInput).toTexture()) {
if (job.GetValue(kRadiusInput).toDouble() > 0.0 if (job.Get(kRadiusInput).toDouble() > 0.0
&& job.GetValue(kOpacityInput).toDouble() > 0.0) { && job.Get(kOpacityInput).toDouble() > 0.0) {
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this); table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
} else { } else {
table->Push(job.GetValue(kTextureInput)); table->Push(job.Get(kTextureInput));
} }
} }
} }
+2 -2
View File
@@ -82,8 +82,8 @@ void NoiseGeneratorNode::Value(const NodeValueRow &value, const NodeGlobals &glo
{ {
ShaderJob job; ShaderJob job;
job.InsertValue(value); job.Insert(value);
job.InsertValue(QStringLiteral("time_in"), NodeValue(NodeValue::kFloat, globals.time().in().toDouble(), this)); job.Insert(QStringLiteral("time_in"), NodeValue(NodeValue::kFloat, globals.time().in().toDouble(), this));
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this); table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
} }
+3 -3
View File
@@ -93,7 +93,7 @@ GenerateJob PolygonGenerator::GetGenerateJob(const NodeValueRow &value) const
{ {
GenerateJob job; GenerateJob job;
job.InsertValue(value); job.Insert(value);
job.SetRequestedFormat(VideoParams::kFormatFloat32); job.SetRequestedFormat(VideoParams::kFormatFloat32);
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn); job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
@@ -116,7 +116,7 @@ void PolygonGenerator::GenerateFrame(FramePtr frame, const GenerateJob &job) con
QImage img(frame->width(), frame->height(), QImage::Format_Grayscale8); QImage img(frame->width(), frame->height(), QImage::Format_Grayscale8);
img.fill(Qt::transparent); img.fill(Qt::transparent);
QVector<NodeValue> points = job.GetValue(kPointsInput).value< QVector<NodeValue> >(); QVector<NodeValue> points = job.Get(kPointsInput).value< QVector<NodeValue> >();
QPainterPath path = GeneratePath(points); QPainterPath path = GeneratePath(points);
@@ -130,7 +130,7 @@ void PolygonGenerator::GenerateFrame(FramePtr frame, const GenerateJob &job) con
p.drawPath(path); p.drawPath(path);
// Transplant alpha channel to frame // Transplant alpha channel to frame
Color rgba = job.GetValue(kColorInput).toColor(); Color rgba = job.Get(kColorInput).toColor();
#if defined(Q_PROCESSOR_X86) || defined(Q_PROCESSOR_ARM) #if defined(Q_PROCESSOR_X86) || defined(Q_PROCESSOR_ARM)
__m128 sse_color = _mm_loadu_ps(rgba.data()); __m128 sse_color = _mm_loadu_ps(rgba.data());
#endif #endif
@@ -58,8 +58,8 @@ void GeneratorWithMerge::PushMergableJob(const NodeValueRow &value, const QVaria
ShaderJob merge; ShaderJob merge;
merge.SetShaderID(QStringLiteral("mrg")); merge.SetShaderID(QStringLiteral("mrg"));
merge.InsertValue(MergeNode::kBaseIn, value[kBaseInput]); merge.Insert(MergeNode::kBaseIn, value[kBaseInput]);
merge.InsertValue(MergeNode::kBlendIn, NodeValue(NodeValue::kTexture, job, this)); merge.Insert(MergeNode::kBlendIn, NodeValue(NodeValue::kTexture, job, this));
table->Push(NodeValue::kTexture, QVariant::fromValue(merge), this); table->Push(NodeValue::kTexture, QVariant::fromValue(merge), this);
} else { } else {
+2 -2
View File
@@ -74,8 +74,8 @@ void ShapeNode::Value(const NodeValueRow &value, const NodeGlobals &globals, Nod
{ {
ShaderJob job; ShaderJob job;
job.InsertValue(value); job.Insert(value);
job.InsertValue(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this)); job.Insert(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this));
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn); job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
job.SetShaderID(QStringLiteral("shape")); job.SetShaderID(QStringLiteral("shape"));
+1 -1
View File
@@ -64,7 +64,7 @@ void SolidGenerator::Retranslate()
void SolidGenerator::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const void SolidGenerator::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
{ {
ShaderJob job; ShaderJob job;
job.InsertValue(value); job.Insert(value);
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this); table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
} }
+8 -8
View File
@@ -93,10 +93,10 @@ void TextGeneratorV1::Retranslate()
void TextGeneratorV1::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const void TextGeneratorV1::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
{ {
GenerateJob job; GenerateJob job;
job.InsertValue(value); job.Insert(value);
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn); job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
if (!job.GetValue(kTextInput).toString().isEmpty()) { if (!job.Get(kTextInput).toString().isEmpty()) {
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this); table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
} }
} }
@@ -114,15 +114,15 @@ void TextGeneratorV1::GenerateFrame(FramePtr frame, const GenerateJob& job) cons
// Set default font // Set default font
QFont default_font; QFont default_font;
default_font.setFamily(job.GetValue(kFontInput).toString()); default_font.setFamily(job.Get(kFontInput).toString());
default_font.setPointSizeF(job.GetValue(kFontSizeInput).toDouble()); default_font.setPointSizeF(job.Get(kFontSizeInput).toDouble());
text_doc.setDefaultFont(default_font); text_doc.setDefaultFont(default_font);
// Center by default // Center by default
text_doc.setDefaultTextOption(QTextOption(Qt::AlignCenter)); text_doc.setDefaultTextOption(QTextOption(Qt::AlignCenter));
QString html = job.GetValue(kTextInput).toString(); QString html = job.Get(kTextInput).toString();
if (job.GetValue(kHtmlInput).toBool()) { if (job.Get(kHtmlInput).toBool()) {
html.replace('\n', QStringLiteral("<br>")); html.replace('\n', QStringLiteral("<br>"));
text_doc.setHtml(html); text_doc.setHtml(html);
} else { } else {
@@ -140,7 +140,7 @@ void TextGeneratorV1::GenerateFrame(FramePtr frame, const GenerateJob& job) cons
// Push 10% inwards to compensate for title safe area // Push 10% inwards to compensate for title safe area
p.translate(tenth_of_width, 0); p.translate(tenth_of_width, 0);
TextVerticalAlign valign = static_cast<TextVerticalAlign>(job.GetValue(kVAlignInput).toInt()); TextVerticalAlign valign = static_cast<TextVerticalAlign>(job.Get(kVAlignInput).toInt());
int doc_height = text_doc.size().height(); int doc_height = text_doc.size().height();
switch (valign) { switch (valign) {
@@ -163,7 +163,7 @@ void TextGeneratorV1::GenerateFrame(FramePtr frame, const GenerateJob& job) cons
text_doc.documentLayout()->draw(&p, ctx); text_doc.documentLayout()->draw(&p, ctx);
// Transplant alpha channel to frame // Transplant alpha channel to frame
Color rgb = job.GetValue(kColorInput).toColor(); Color rgb = job.Get(kColorInput).toColor();
for (int x=0; x<frame->width(); x++) { for (int x=0; x<frame->width(); x++) {
for (int y=0; y<frame->height(); y++) { for (int y=0; y<frame->height(); y++) {
uchar src_alpha = img.bits()[img.bytesPerLine() * y + x]; uchar src_alpha = img.bits()[img.bytesPerLine() * y + x];
+10 -10
View File
@@ -96,11 +96,11 @@ void TextGeneratorV2::Retranslate()
void TextGeneratorV2::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const void TextGeneratorV2::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
{ {
GenerateJob job; GenerateJob job;
job.InsertValue(value); job.Insert(value);
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn); job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
job.SetRequestedFormat(VideoParams::kFormatFloat32); job.SetRequestedFormat(VideoParams::kFormatFloat32);
if (!job.GetValue(kTextInput).toString().isEmpty()) { if (!job.Get(kTextInput).toString().isEmpty()) {
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this); table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
} }
} }
@@ -124,19 +124,19 @@ void TextGeneratorV2::GenerateFrame(FramePtr frame, const GenerateJob& job) cons
// Set default font // Set default font
QFont default_font; QFont default_font;
default_font.setFamily(job.GetValue(kFontInput).toString()); default_font.setFamily(job.Get(kFontInput).toString());
default_font.setPointSizeF(job.GetValue(kFontSizeInput).toDouble()); default_font.setPointSizeF(job.Get(kFontSizeInput).toDouble());
text_doc.setDefaultFont(default_font); text_doc.setDefaultFont(default_font);
QString html = job.GetValue(kTextInput).toString(); QString html = job.Get(kTextInput).toString();
if (job.GetValue(kHtmlInput).toBool()) { if (job.Get(kHtmlInput).toBool()) {
html.replace('\n', QStringLiteral("<br>")); html.replace('\n', QStringLiteral("<br>"));
text_doc.setHtml(html); text_doc.setHtml(html);
} else { } else {
text_doc.setPlainText(html); text_doc.setPlainText(html);
} }
QVector2D size = job.GetValue(kSizeInput).toVec2(); QVector2D size = job.Get(kSizeInput).toVec2();
text_doc.setTextWidth(size.x()); text_doc.setTextWidth(size.x());
// Draw rich text onto image // Draw rich text onto image
@@ -144,12 +144,12 @@ void TextGeneratorV2::GenerateFrame(FramePtr frame, const GenerateJob& job) cons
p.scale(1.0 / frame->video_params().divider(), 1.0 / frame->video_params().divider()); p.scale(1.0 / frame->video_params().divider(), 1.0 / frame->video_params().divider());
QVector2D pos = job.GetValue(kPositionInput).toVec2(); QVector2D pos = job.Get(kPositionInput).toVec2();
p.translate(pos.x() - size.x()/2, pos.y() - size.y()/2); p.translate(pos.x() - size.x()/2, pos.y() - size.y()/2);
p.translate(frame->video_params().width()/2, frame->video_params().height()/2); p.translate(frame->video_params().width()/2, frame->video_params().height()/2);
p.setClipRect(0, 0, size.x(), size.y()); p.setClipRect(0, 0, size.x(), size.y());
TextVerticalAlign valign = static_cast<TextVerticalAlign>(job.GetValue(kVAlignInput).toInt()); TextVerticalAlign valign = static_cast<TextVerticalAlign>(job.Get(kVAlignInput).toInt());
int doc_height = text_doc.size().height(); int doc_height = text_doc.size().height();
switch (valign) { switch (valign) {
@@ -171,7 +171,7 @@ void TextGeneratorV2::GenerateFrame(FramePtr frame, const GenerateJob& job) cons
text_doc.documentLayout()->draw(&p, ctx); text_doc.documentLayout()->draw(&p, ctx);
// Transplant alpha channel to frame // Transplant alpha channel to frame
Color rgba = job.GetValue(kColorInput).toColor(); Color rgba = job.Get(kColorInput).toColor();
#if defined(Q_PROCESSOR_X86) || defined(Q_PROCESSOR_ARM) #if defined(Q_PROCESSOR_X86) || defined(Q_PROCESSOR_ARM)
__m128 sse_color = _mm_loadu_ps(rgba.data()); __m128 sse_color = _mm_loadu_ps(rgba.data());
#endif #endif
+5 -5
View File
@@ -81,14 +81,14 @@ void TextGeneratorV3::Retranslate()
void TextGeneratorV3::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const void TextGeneratorV3::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
{ {
GenerateJob job; GenerateJob job;
job.InsertValue(value); job.Insert(value);
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn); job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
job.SetRequestedFormat(VideoParams::kFormatUnsigned8); job.SetRequestedFormat(VideoParams::kFormatUnsigned8);
// FIXME: Provide user override for this // FIXME: Provide user override for this
job.SetColorspace(project()->color_manager()->GetDefaultInputColorSpace()); job.SetColorspace(project()->color_manager()->GetDefaultInputColorSpace());
if (!job.GetValue(kTextInput).toString().isEmpty()) { if (!job.Get(kTextInput).toString().isEmpty()) {
PushMergableJob(value, QVariant::fromValue(job), table); PushMergableJob(value, QVariant::fromValue(job), table);
} else if (value[kBaseInput].toTexture()) { } else if (value[kBaseInput].toTexture()) {
table->Push(value[kBaseInput]); table->Push(value[kBaseInput]);
@@ -108,17 +108,17 @@ void TextGeneratorV3::GenerateFrame(FramePtr frame, const GenerateJob& job) cons
QTextDocument text_doc; QTextDocument text_doc;
text_doc.documentLayout()->setPaintDevice(&img); text_doc.documentLayout()->setPaintDevice(&img);
QString html = job.GetValue(kTextInput).toString(); QString html = job.Get(kTextInput).toString();
Html::HtmlToDoc(&text_doc, html); Html::HtmlToDoc(&text_doc, html);
QVector2D size = job.GetValue(kSizeInput).toVec2(); QVector2D size = job.Get(kSizeInput).toVec2();
text_doc.setTextWidth(size.x()); text_doc.setTextWidth(size.x());
// Draw rich text onto image // Draw rich text onto image
QPainter p(&img); QPainter p(&img);
p.scale(1.0 / frame->video_params().divider(), 1.0 / frame->video_params().divider()); p.scale(1.0 / frame->video_params().divider(), 1.0 / frame->video_params().divider());
QVector2D pos = job.GetValue(kPositionInput).toVec2(); QVector2D pos = job.Get(kPositionInput).toVec2();
p.translate(pos.x() - size.x()/2, pos.y() - size.y()/2); p.translate(pos.x() - size.x()/2, pos.y() - size.y()/2);
p.translate(frame->video_params().width()/2, frame->video_params().height()/2); p.translate(frame->video_params().width()/2, frame->video_params().height()/2);
p.setClipRect(0, 0, size.x(), size.y()); p.setClipRect(0, 0, size.x(), size.y());
+1 -1
View File
@@ -131,7 +131,7 @@ void ChromaKeyNode::Value(const NodeValueRow &value, const NodeGlobals &globals,
if (value[kTextureInput].toTexture() && processor()) { if (value[kTextureInput].toTexture() && processor()) {
ColorTransformJob job; ColorTransformJob job;
job.InsertValue(value); job.Insert(value);
job.SetAlphaChannelRequired(ColorTransformJob::kAlphaForceOn); job.SetAlphaChannelRequired(ColorTransformJob::kAlphaForceOn);
job.SetColorProcessor(processor()); job.SetColorProcessor(processor());
job.SetInputTexture(value[kTextureInput].toTexture()); job.SetInputTexture(value[kTextureInput].toTexture());
@@ -94,11 +94,11 @@ ShaderCode ColorDifferenceKeyNode::GetShaderCode(const ShaderRequest &request) c
void ColorDifferenceKeyNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const void ColorDifferenceKeyNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
{ {
ShaderJob job; ShaderJob job;
job.InsertValue(value); job.Insert(value);
job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn); job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn);
// 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).toTexture()) { if (job.Get(kTextureInput).toTexture()) {
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this); table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
} }
} }
+3 -3
View File
@@ -82,16 +82,16 @@ ShaderCode DespillNode::GetShaderCode(const ShaderRequest &request) const {
void DespillNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const { void DespillNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const {
ShaderJob job; ShaderJob job;
job.InsertValue(value); job.Insert(value);
// Set luma coefficients // Set luma coefficients
double luma_coeffs[3] = {0.0f, 0.0f, 0.0f}; double luma_coeffs[3] = {0.0f, 0.0f, 0.0f};
project()->color_manager()->GetDefaultLumaCoefs(luma_coeffs); project()->color_manager()->GetDefaultLumaCoefs(luma_coeffs);
job.InsertValue(QStringLiteral("luma_coeffs"), job.Insert(QStringLiteral("luma_coeffs"),
NodeValue(NodeValue::kVec3, QVector3D(luma_coeffs[0], luma_coeffs[1], luma_coeffs[2]))); NodeValue(NodeValue::kVec3, QVector3D(luma_coeffs[0], luma_coeffs[1], luma_coeffs[2])));
// 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).toTexture()) { if (job.Get(kTextureInput).toTexture()) {
table->Push(NodeValue::kTexture, QVariant::fromValue(job), this); table->Push(NodeValue::kTexture, QVariant::fromValue(job), this);
} }
} }
+4 -4
View File
@@ -341,8 +341,8 @@ void MathNodeBase::ValueInternal(Operation operation, Pairing pairing, const QSt
QString::number(val_a.type()), QString::number(val_a.type()),
QString::number(val_b.type()))); QString::number(val_b.type())));
job.InsertValue(param_a_in, val_a); job.Insert(param_a_in, val_a);
job.InsertValue(param_b_in, val_b); job.Insert(param_b_in, val_b);
bool operation_is_noop = false; bool operation_is_noop = false;
@@ -370,7 +370,7 @@ void MathNodeBase::ValueInternal(Operation operation, Pairing pairing, const QSt
operation_is_noop = true; operation_is_noop = true;
} else { } else {
// Replace with adjusted matrix // Replace with adjusted matrix
job.InsertValue(val_a.type() == NodeValue::kTexture ? param_b_in : param_a_in, job.Insert(val_a.type() == NodeValue::kTexture ? param_b_in : param_a_in,
NodeValue(NodeValue::kMatrix, adjusted_matrix, this)); NodeValue(NodeValue::kMatrix, adjusted_matrix, this));
// It's likely an alpha channel will result from this operation // It's likely an alpha channel will result from this operation
@@ -414,7 +414,7 @@ void MathNodeBase::ValueInternal(Operation operation, Pairing pairing, const QSt
output->Push(NodeValue::kSamples, QVariant::fromValue(buffer), this); output->Push(NodeValue::kSamples, QVariant::fromValue(buffer), this);
} else { } else {
SampleJob job(val_a.type() == NodeValue::kSamples ? val_a : val_b); SampleJob job(val_a.type() == NodeValue::kSamples ? val_a : val_b);
job.InsertValue(number_param, NodeValue(NodeValue::kFloat, number, this)); job.Insert(number_param, NodeValue(NodeValue::kFloat, number, this));
output->Push(NodeValue::kSamples, QVariant::fromValue(job), this); output->Push(NodeValue::kSamples, QVariant::fromValue(job), this);
} }
} }
+5 -5
View File
@@ -77,18 +77,18 @@ ShaderCode MergeNode::GetShaderCode(const ShaderRequest &request) const
void MergeNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const void MergeNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const
{ {
ShaderJob job; ShaderJob job;
job.InsertValue(value); job.Insert(value);
TexturePtr base_tex = job.GetValue(kBaseIn).toTexture(); TexturePtr base_tex = job.Get(kBaseIn).toTexture();
TexturePtr blend_tex = job.GetValue(kBlendIn).toTexture(); TexturePtr blend_tex = job.Get(kBlendIn).toTexture();
if (base_tex || blend_tex) { if (base_tex || blend_tex) {
if (!base_tex || (blend_tex && blend_tex->channel_count() < VideoParams::kRGBAChannelCount)) { 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 // We only have a blend texture or the blend texture is RGB only, no need to alpha over
table->Push(job.GetValue(kBlendIn)); table->Push(job.Get(kBlendIn));
} else if (!blend_tex) { } else if (!blend_tex) {
// We only have a base texture, no need to alpha over // We only have a base texture, no need to alpha over
table->Push(job.GetValue(kBaseIn)); table->Push(job.Get(kBaseIn));
} else { } else {
// We have both textures, push the job // We have both textures, push the job
if (base_tex->channel_count() < VideoParams::kRGBAChannelCount) { if (base_tex->channel_count() < VideoParams::kRGBAChannelCount) {
+4 -4
View File
@@ -30,22 +30,22 @@ class AcceleratedJob {
public: public:
AcceleratedJob() = default; AcceleratedJob() = default;
NodeValue GetValue(const QString& input) const NodeValue Get(const QString& input) const
{ {
return value_map_.value(input); return value_map_.value(input);
} }
void InsertValue(const QString &input, const NodeValueRow &row) void Insert(const QString &input, const NodeValueRow &row)
{ {
value_map_.insert(input, row.value(input)); value_map_.insert(input, row.value(input));
} }
void InsertValue(const QString& input, const NodeValue& value) void Insert(const QString& input, const NodeValue& value)
{ {
value_map_.insert(input, value); value_map_.insert(input, value);
} }
void InsertValue(const NodeValueRow &row) void Insert(const NodeValueRow &row)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
value_map_.insert(row); value_map_.insert(row);
+1 -1
View File
@@ -552,7 +552,7 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, Video
// Ensure matrix is set, at least to identity // Ensure matrix is set, at least to identity
GLint mvpmat_location = functions_->glGetUniformLocation(shader, "ove_mvpmat"); GLint mvpmat_location = functions_->glGetUniformLocation(shader, "ove_mvpmat");
if (mvpmat_location > -1) { if (mvpmat_location > -1) {
functions_->glUniformMatrix4fv(mvpmat_location, 1, false, job.GetValue(QStringLiteral("ove_mvpmat")).toMatrix().constData()); functions_->glUniformMatrix4fv(mvpmat_location, 1, false, job.Get(QStringLiteral("ove_mvpmat")).toMatrix().constData());
} }
// Set the viewport to the "physical" resolution of the destination // Set the viewport to the "physical" resolution of the destination
+10 -10
View File
@@ -61,9 +61,9 @@ TexturePtr Renderer::InterlaceTexture(TexturePtr top, TexturePtr bottom, const V
color_cache_mutex_.unlock(); color_cache_mutex_.unlock();
ShaderJob job; ShaderJob job;
job.InsertValue(QStringLiteral("top_tex_in"), NodeValue(NodeValue::kTexture, QVariant::fromValue(top))); job.Insert(QStringLiteral("top_tex_in"), NodeValue(NodeValue::kTexture, QVariant::fromValue(top)));
job.InsertValue(QStringLiteral("bottom_tex_in"), NodeValue(NodeValue::kTexture, QVariant::fromValue(bottom))); job.Insert(QStringLiteral("bottom_tex_in"), NodeValue(NodeValue::kTexture, QVariant::fromValue(bottom)));
job.InsertValue(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, QVector2D(params.effective_width(), params.effective_height()))); job.Insert(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, QVector2D(params.effective_width(), params.effective_height())));
TexturePtr output = CreateTexture(params); TexturePtr output = CreateTexture(params);
@@ -213,19 +213,19 @@ void Renderer::BlitColorManaged(const ColorTransformJob &color_job, Texture *des
} }
ShaderJob job; ShaderJob job;
job.InsertValue(QStringLiteral("ove_maintex"), NodeValue(NodeValue::kTexture, QVariant::fromValue(color_job.GetInputTexture()))); job.Insert(QStringLiteral("ove_maintex"), NodeValue(NodeValue::kTexture, QVariant::fromValue(color_job.GetInputTexture())));
job.InsertValue(QStringLiteral("ove_mvpmat"), NodeValue(NodeValue::kMatrix, color_job.GetTransformMatrix())); job.Insert(QStringLiteral("ove_mvpmat"), NodeValue(NodeValue::kMatrix, color_job.GetTransformMatrix()));
job.InsertValue(QStringLiteral("ove_cropmatrix"), NodeValue(NodeValue::kMatrix, color_job.GetCropMatrix().inverted())); job.Insert(QStringLiteral("ove_cropmatrix"), NodeValue(NodeValue::kMatrix, color_job.GetCropMatrix().inverted()));
job.InsertValue(QStringLiteral("ove_maintex_alpha"), NodeValue(NodeValue::kInt, int(color_job.GetInputAlphaAssociation()))); job.Insert(QStringLiteral("ove_maintex_alpha"), NodeValue(NodeValue::kInt, int(color_job.GetInputAlphaAssociation())));
job.InsertValue(color_job.GetValues()); job.Insert(color_job.GetValues());
job.SetAlphaChannelRequired(color_job.GetAlphaChannelRequired()); job.SetAlphaChannelRequired(color_job.GetAlphaChannelRequired());
foreach (const ColorContext::LUT& l, color_ctx.lut3d_textures) { foreach (const ColorContext::LUT& l, color_ctx.lut3d_textures) {
job.InsertValue(l.name, NodeValue(NodeValue::kTexture, QVariant::fromValue(l.texture))); job.Insert(l.name, NodeValue(NodeValue::kTexture, QVariant::fromValue(l.texture)));
job.SetInterpolation(l.name, l.interpolation); job.SetInterpolation(l.name, l.interpolation);
} }
foreach (const ColorContext::LUT& l, color_ctx.lut1d_textures) { foreach (const ColorContext::LUT& l, color_ctx.lut1d_textures) {
job.InsertValue(l.name, NodeValue(NodeValue::kTexture, QVariant::fromValue(l.texture))); job.Insert(l.name, NodeValue(NodeValue::kTexture, QVariant::fromValue(l.texture)));
job.SetInterpolation(l.name, l.interpolation); job.SetInterpolation(l.name, l.interpolation);
} }
+2 -2
View File
@@ -114,8 +114,8 @@ FramePtr RenderProcessor::GenerateFrame(TexturePtr texture, const rational& time
} else { } else {
// No color transform, just blit // No color transform, just blit
ShaderJob job; ShaderJob job;
job.InsertValue(QStringLiteral("ove_maintex"), NodeValue(NodeValue::kTexture, QVariant::fromValue(texture))); job.Insert(QStringLiteral("ove_maintex"), NodeValue(NodeValue::kTexture, QVariant::fromValue(texture)));
job.InsertValue(QStringLiteral("ove_mvpmat"), NodeValue(NodeValue::kMatrix, matrix)); job.Insert(QStringLiteral("ove_mvpmat"), NodeValue(NodeValue::kMatrix, matrix));
render_ctx_->BlitToTexture(default_shader_, job, blit_tex.get()); render_ctx_->BlitToTexture(default_shader_, job, blit_tex.get());
} }
+5 -5
View File
@@ -70,9 +70,9 @@ void HistogramScope::DrawScope(TexturePtr managed_tex, QVariant pipeline)
ShaderJob shader_job; ShaderJob shader_job;
shader_job.InsertValue(QStringLiteral("viewport"), NodeValue(NodeValue::kVec2, QVector2D(width(), height()))); shader_job.Insert(QStringLiteral("viewport"), NodeValue(NodeValue::kVec2, QVector2D(width(), height())));
shader_job.InsertValue(QStringLiteral("histogram_scale"), NodeValue(NodeValue::kFloat, histogram_scale)); shader_job.Insert(QStringLiteral("histogram_scale"), NodeValue(NodeValue::kFloat, histogram_scale));
shader_job.InsertValue(QStringLiteral("histogram_power"), NodeValue(NodeValue::kFloat, histogram_power)); shader_job.Insert(QStringLiteral("histogram_power"), NodeValue(NodeValue::kFloat, histogram_power));
if (!texture_row_sums_ if (!texture_row_sums_
|| texture_row_sums_->width() != this->width() || texture_row_sums_->width() != this->width()
@@ -83,11 +83,11 @@ void HistogramScope::DrawScope(TexturePtr managed_tex, QVariant pipeline)
} }
// Draw managed texture to a sums texture // Draw managed texture to a sums texture
shader_job.InsertValue(QStringLiteral("ove_maintex"), NodeValue(NodeValue::kTexture, QVariant::fromValue(managed_tex))); shader_job.Insert(QStringLiteral("ove_maintex"), NodeValue(NodeValue::kTexture, QVariant::fromValue(managed_tex)));
renderer()->BlitToTexture(pipeline, shader_job, texture_row_sums_.get()); renderer()->BlitToTexture(pipeline, shader_job, texture_row_sums_.get());
// Draw sums into a histogram // Draw sums into a histogram
shader_job.InsertValue(QStringLiteral("ove_maintex"), NodeValue(NodeValue::kTexture, QVariant::fromValue(texture_row_sums_))); shader_job.Insert(QStringLiteral("ove_maintex"), NodeValue(NodeValue::kTexture, QVariant::fromValue(texture_row_sums_)));
renderer()->Blit(pipeline_secondary_, shader_job, texture_row_sums_->params()); renderer()->Blit(pipeline_secondary_, shader_job, texture_row_sums_->params());
// Draw line overlays // Draw line overlays
+1 -1
View File
@@ -50,7 +50,7 @@ void ScopeBase::DrawScope(TexturePtr managed_tex, QVariant pipeline)
{ {
ShaderJob job; ShaderJob job;
job.InsertValue(QStringLiteral("ove_maintex"), NodeValue(NodeValue::kTexture, QVariant::fromValue(managed_tex))); job.Insert(QStringLiteral("ove_maintex"), NodeValue(NodeValue::kTexture, QVariant::fromValue(managed_tex)));
renderer()->Blit(pipeline, job, VideoParams(width(), height(), renderer()->Blit(pipeline, job, VideoParams(width(), height(),
static_cast<VideoParams::Format>(OLIVE_CONFIG("OfflinePixelFormat").toInt()), static_cast<VideoParams::Format>(OLIVE_CONFIG("OfflinePixelFormat").toInt()),
+4 -4
View File
@@ -54,22 +54,22 @@ void WaveformScope::DrawScope(TexturePtr managed_tex, QVariant pipeline)
ShaderJob job; ShaderJob job;
// Set viewport size // Set viewport size
job.InsertValue(QStringLiteral("viewport"), job.Insert(QStringLiteral("viewport"),
NodeValue(NodeValue::kVec2, QVector2D(width(), height()))); NodeValue(NodeValue::kVec2, QVector2D(width(), height())));
// Set luma coefficients // Set luma coefficients
double luma_coeffs[3] = {0.0f, 0.0f, 0.0f}; double luma_coeffs[3] = {0.0f, 0.0f, 0.0f};
color_manager()->GetDefaultLumaCoefs(luma_coeffs); color_manager()->GetDefaultLumaCoefs(luma_coeffs);
job.InsertValue(QStringLiteral("luma_coeffs"), job.Insert(QStringLiteral("luma_coeffs"),
NodeValue(NodeValue::kVec3, QVector3D(luma_coeffs[0], luma_coeffs[1], luma_coeffs[2]))); NodeValue(NodeValue::kVec3, QVector3D(luma_coeffs[0], luma_coeffs[1], luma_coeffs[2])));
// Scale of the waveform relative to the viewport surface. // Scale of the waveform relative to the viewport surface.
job.InsertValue(QStringLiteral("waveform_scale"), job.Insert(QStringLiteral("waveform_scale"),
NodeValue(NodeValue::kFloat, waveform_scale)); NodeValue(NodeValue::kFloat, waveform_scale));
// Insert source texture // Insert source texture
job.InsertValue(QStringLiteral("ove_maintex"), job.Insert(QStringLiteral("ove_maintex"),
NodeValue(NodeValue::kTexture, QVariant::fromValue(managed_tex))); NodeValue(NodeValue::kTexture, QVariant::fromValue(managed_tex)));
renderer()->Blit(pipeline, job, VideoParams(width(), height(), renderer()->Blit(pipeline, job, VideoParams(width(), height(),
+4 -4
View File
@@ -456,8 +456,8 @@ void ViewerDisplayWidget::OnPaint()
} }
ShaderJob job; ShaderJob job;
job.InsertValue(QStringLiteral("ove_mvpmat"), NodeValue(NodeValue::kMatrix, combined_matrix_flipped_)); job.Insert(QStringLiteral("ove_mvpmat"), NodeValue(NodeValue::kMatrix, combined_matrix_flipped_));
job.InsertValue(QStringLiteral("ove_cropmatrix"), NodeValue(NodeValue::kMatrix, crop_matrix_)); job.Insert(QStringLiteral("ove_cropmatrix"), NodeValue(NodeValue::kMatrix, crop_matrix_));
renderer()->Blit(blank_shader_, job, device_params, false); renderer()->Blit(blank_shader_, job, device_params, false);
} else if (color_service()) { } else if (color_service()) {
@@ -496,8 +496,8 @@ void ViewerDisplayWidget::OnPaint()
} }
ShaderJob job; ShaderJob job;
job.InsertValue(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, QVector2D(texture_to_draw->width(), texture_to_draw->height()))); job.Insert(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, QVector2D(texture_to_draw->width(), texture_to_draw->height())));
job.InsertValue(QStringLiteral("ove_maintex"), NodeValue(NodeValue::kTexture, QVariant::fromValue(texture_to_draw))); job.Insert(QStringLiteral("ove_maintex"), NodeValue(NodeValue::kTexture, QVariant::fromValue(texture_to_draw)));
renderer()->BlitToTexture(deinterlace_shader_, job, deinterlace_texture_.get()); renderer()->BlitToTexture(deinterlace_shader_, job, deinterlace_texture_.get());