summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/render/backend/uniform.cpp1
-rw-r--r--src/render/backend/uniform_p.h4
-rw-r--r--src/render/graphicshelpers/graphicscontext.cpp9
3 files changed, 13 insertions, 1 deletions
diff --git a/src/render/backend/uniform.cpp b/src/render/backend/uniform.cpp
index 0369f3f5e..821dd6992 100644
--- a/src/render/backend/uniform.cpp
+++ b/src/render/backend/uniform.cpp
@@ -121,6 +121,7 @@ UniformValue UniformValue::fromVariant(const QVariant &variant)
case QMetaType::Char:
case QMetaType::UChar:
v.data<int>()[0] = variant.toInt();
+ v.m_storedType = Int;
break;
case QMetaType::Float:
case QMetaType::Double: // Convert double to floats
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
diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp
index 8c0803a79..9ec544b11 100644
--- a/src/render/graphicshelpers/graphicscontext.cpp
+++ b/src/render/graphicshelpers/graphicscontext.cpp
@@ -1205,7 +1205,14 @@ void GraphicsContext::applyUniform(const ShaderUniform &description, const Unifo
switch (type) {
case UniformType::Float:
- applyUniformHelper<UniformType::Float>(description.m_location, description.m_size, v);
+ // See QTBUG-57510 and uniform_p.h
+ if (v.storedType() == Int) {
+ float value = float(*v.constData<int>());
+ UniformValue floatV(value);
+ applyUniformHelper<UniformType::Float>(description.m_location, description.m_size, floatV);
+ } else {
+ applyUniformHelper<UniformType::Float>(description.m_location, description.m_size, v);
+ }
break;
case UniformType::Vec2:
applyUniformHelper<UniformType::Vec2>(description.m_location, description.m_size, v);