aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2016-04-10 17:20:13 +0200
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2016-04-11 10:12:22 +0000
commit38d2d6ede6722b0fb86ee6723bbfbb2b063c4d6b (patch)
tree73b7736fcfa6cc33331550eab120f8be478a5e6c
parentc276899e3f4e37aca88edad8895daf10a8435b19 (diff)
D3D12: Fix another set of disappearing text cases
Even after the previous fixes the cbuffer did not get updated after a rebuild in some cases. (Re)introduce a dirty state - this time with the proper name - indicating that any cached material data should be treated as invalid. This allows updatePipeline to disregard cached state and update the cbuffer even for values that are not otherwise dependent on the opacity or the matrix. Change-Id: I8e4e6c52067d1db4bd7049960bc8cfc7cac0b0ef Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
-rw-r--r--src/quick/scenegraph/adaptations/d3d12/qsgd3d12builtinmaterials.cpp4
-rw-r--r--src/quick/scenegraph/adaptations/d3d12/qsgd3d12material_p.h2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12builtinmaterials.cpp b/src/quick/scenegraph/adaptations/d3d12/qsgd3d12builtinmaterials.cpp
index 7768e114f3..ab0c98a8cd 100644
--- a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12builtinmaterials.cpp
+++ b/src/quick/scenegraph/adaptations/d3d12/qsgd3d12builtinmaterials.cpp
@@ -507,7 +507,7 @@ QSGD3D12Material::UpdateResults QSGD3D12TextMaterial::updatePipeline(const Rende
}
p += TEXT_CB_SIZE_0;
- if (m_lastGlyphCacheSize != glyphCache()->currentSize()) {
+ if (state.isCachedMaterialDataDirty() || m_lastGlyphCacheSize != glyphCache()->currentSize()) {
m_lastGlyphCacheSize = glyphCache()->currentSize();
const float textureScale[2] = { 1.0f / m_lastGlyphCacheSize.width(),
1.0f / m_lastGlyphCacheSize.height() };
@@ -542,7 +542,7 @@ QSGD3D12Material::UpdateResults QSGD3D12TextMaterial::updatePipeline(const Rende
}
p += TEXT_CB_SIZE_3 + TEXT_CB_SIZE_4;
- if (m_styleType == Styled && m_lastStyleShift != m_styleShift) {
+ if (m_styleType == Styled && (state.isCachedMaterialDataDirty() || m_lastStyleShift != m_styleShift)) {
m_lastStyleShift = m_styleShift;
const float f[2] = { m_styleShift.x(), m_styleShift.y() };
memcpy(p, f, TEXT_CB_SIZE_5);
diff --git a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12material_p.h b/src/quick/scenegraph/adaptations/d3d12/qsgd3d12material_p.h
index 307f73bbde..e9af8e68a0 100644
--- a/src/quick/scenegraph/adaptations/d3d12/qsgd3d12material_p.h
+++ b/src/quick/scenegraph/adaptations/d3d12/qsgd3d12material_p.h
@@ -69,6 +69,7 @@ public:
enum DirtyState {
DirtyMatrix = 0x0001,
DirtyOpacity = 0x0002,
+ DirtyCachedMaterialData = 0x0004,
DirtyAll = 0xFFFF
};
Q_DECLARE_FLAGS(DirtyStates, DirtyState)
@@ -77,6 +78,7 @@ public:
bool isMatrixDirty() const { return m_dirty & DirtyMatrix; }
bool isOpacityDirty() const { return m_dirty & DirtyOpacity; }
+ bool isCachedMaterialDataDirty() const { return m_dirty & DirtyCachedMaterialData; }
float opacity() const;
QMatrix4x4 combinedMatrix() const;