renderer: fixed bug that would render frames even after hash matching

Also enables the -Wshadow GCC warning to warn against the code bug that
caused this issue (and has caused other issues like it in the past).
This commit is contained in:
itsmattkc
2020-06-19 20:25:05 +10:00
parent b2a3cede2c
commit 65ccac1dfe
11 changed files with 48 additions and 44 deletions
+12 -12
View File
@@ -276,21 +276,21 @@ QVariant OpenGLProxy::RunNodeAccelerated(const Node *node,
shader->bind();
NodeValueMap::const_iterator i;
for (i=job.GetValues().constBegin(); i!=job.GetValues().constEnd(); i++) {
NodeValueMap::const_iterator it;
for (it=job.GetValues().constBegin(); it!=job.GetValues().constEnd(); it++) {
// See if the shader has takes this parameter as an input
int variable_location = shader->uniformLocation(i.key()->id());
int variable_location = shader->uniformLocation(it.key()->id());
if (variable_location == -1) {
continue;
}
// This variable is used in the shader, let's set it
const QVariant& value = i.value().data();
const QVariant& value = it.value().data();
const NodeParam::DataType& data_type = (i.value().type() != NodeParam::kNone)
? i.value().type()
: i.key()->data_type();
const NodeParam::DataType& data_type = (it.value().type() != NodeParam::kNone)
? it.value().type()
: it.key()->data_type();
switch (data_type) {
case NodeInput::kInt:
@@ -300,7 +300,7 @@ QVariant OpenGLProxy::RunNodeAccelerated(const Node *node,
shader->setUniformValue(variable_location, value.toFloat());
break;
case NodeInput::kVec2:
if (i.key()->IsArray()) {
if (it.key()->IsArray()) {
QVector<NodeValue> nv = value.value< QVector<NodeValue> >();
QVector<QVector2D> a(nv.size());
@@ -310,7 +310,7 @@ QVariant OpenGLProxy::RunNodeAccelerated(const Node *node,
shader->setUniformValueArray(variable_location, a.constData(), a.size());
int count_location = shader->uniformLocation(QStringLiteral("%1_count").arg(i.key()->id()));
int count_location = shader->uniformLocation(QStringLiteral("%1_count").arg(it.key()->id()));
if (count_location > -1) {
shader->setUniformValue(count_location, a.size());
}
@@ -354,7 +354,7 @@ QVariant OpenGLProxy::RunNodeAccelerated(const Node *node,
shader->setUniformValue(variable_location, textures_to_bind.size());
// If this texture binding is the iterative input, set it here
if (i.key() == job.GetIterativeInput()) {
if (it.key() == job.GetIterativeInput()) {
iterative_input = textures_to_bind.size();
}
@@ -362,7 +362,7 @@ QVariant OpenGLProxy::RunNodeAccelerated(const Node *node,
textures_to_bind.append(tex_id);
// Set enable flag if shader wants it
int enable_param_location = shader->uniformLocation(QStringLiteral("%1_enabled").arg(i.key()->id()));
int enable_param_location = shader->uniformLocation(QStringLiteral("%1_enabled").arg(it.key()->id()));
if (enable_param_location > -1) {
shader->setUniformValue(enable_param_location,
tex_id > 0);
@@ -370,7 +370,7 @@ QVariant OpenGLProxy::RunNodeAccelerated(const Node *node,
if (tex_id > 0) {
// Set texture resolution if shader wants it
int res_param_location = shader->uniformLocation(QStringLiteral("%1_resolution").arg(i.key()->id()));
int res_param_location = shader->uniformLocation(QStringLiteral("%1_resolution").arg(it.key()->id()));
if (res_param_location > -1) {
shader->setUniformValue(res_param_location,
static_cast<GLfloat>(texture->texture()->width() * texture->texture()->divider()),
+3 -3
View File
@@ -115,13 +115,13 @@ void RenderBackend::ClearVideoQueue()
QFuture<QVector<QByteArray> > RenderBackend::Hash(const QVector<rational> &times)
{
return QtConcurrent::run(&pool_, [this](const QVector<rational> &times){
QVector<QByteArray> hashes(times.size());
return QtConcurrent::run(&pool_, [this](const QVector<rational> &t){
QVector<QByteArray> hashes(t.size());
for (int i=0;i<hashes.size();i++) {
hashes[i] = HashNode(copied_viewer_node_->texture_input()->get_connected_node(),
video_params_,
times.at(i));
t.at(i));
}
return hashes;