From 8c745d808527684836d04da9014ee33c7cf8b6f1 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 23 Jun 2016 10:37:03 +0200 Subject: QtQuick: clean up shader effect property connections - Don't use a signal mapper, but handle the mapping using a custom slot object and a lambda to do the dispatching ourselves. - Don't do meta-calls by property name, but by index. - Cache the meta-object. - Resolve the property indices by using the QML property cache. For a shader with 6 property connections, the time spent goes from 320k instructions to 80k instructions (valgrind on x86_64). Task-number: QTBUG-53901 Change-Id: I2809198cf62f9716b3683798222203fc3e97fbb3 Reviewed-by: Robin Burchell --- src/quick/items/qquickopenglshadereffectnode_p.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/quick/items/qquickopenglshadereffectnode_p.h') diff --git a/src/quick/items/qquickopenglshadereffectnode_p.h b/src/quick/items/qquickopenglshadereffectnode_p.h index adf5ef730b..5abe3ae3d0 100644 --- a/src/quick/items/qquickopenglshadereffectnode_p.h +++ b/src/quick/items/qquickopenglshadereffectnode_p.h @@ -90,9 +90,19 @@ public: QByteArray name; QVariant value; + int propertyIndex = -1; SpecialType specialType; bool operator == (const UniformData &other) const; + + void setValueFromProperty(QObject *item, const QMetaObject *itemMetaObject) + { + if (propertyIndex == -1) { + value = item->property(name); + } else { + value = itemMetaObject->property(propertyIndex).read(item); + } + } }; explicit QQuickOpenGLShaderEffectMaterial(QQuickOpenGLShaderEffectNode *node = 0); -- cgit v1.2.3