diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2016-12-08 13:21:22 +0000 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2016-12-10 16:31:19 +0000 |
commit | 1c9d92ecbb5d132313905c68914384674099ec29 (patch) | |
tree | 0312861cce3110e6a4238be9d0444a13cad953af /src/render/backend/uniform_p.h | |
parent | 0de007ab0e9c23bfeb9eba26798df05a06439821 (diff) |
Work around QML -> C++ float to int conversion
QML converts values of reals that have zero fractional parts e.g. 2.0
to integers when passing them to C++. This can result in Qt 3D and the
Uniform class passing these to uniform floats in GLSL by
reinterpret_casting the integer to a float which results in a garbage
value in the shader which in turn leads to very difficult to debug
shader issues.
This commit handles this particular case (in a hacky way) for the
Qt 5.8.0 release. We need to find a more fully featured solution for
converting Uniform's to the correct introspected GLSL types. This will
require being in position of the introspected shader interface when
building the RenderViews. This is too large of a change to do in time
for the 5.8.0 release. Hence this work around solution for now.
Task-number: QTBUG-57510
Change-Id: I6631879fff8259a32960e461bad4c692ca630220
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/render/backend/uniform_p.h')
-rw-r--r-- | src/render/backend/uniform_p.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/render/backend/uniform_p.h b/src/render/backend/uniform_p.h index 56a50aea2..6b5ae4172 100644 --- a/src/render/backend/uniform_p.h +++ b/src/render/backend/uniform_p.h @@ -169,6 +169,7 @@ public: } ValueType valueType() const { return m_valueType; } + UniformType storedType() const { return m_storedType; } static UniformValue fromVariant(const QVariant &variant); @@ -199,6 +200,9 @@ private: QVarLengthArray<float, 4> m_data; ValueType m_valueType = ScalarValue; + + // TODO: Replace this hack see QTBUG-57510 + UniformType m_storedType = Unknown; }; } // namespace Render |