diff options
3 files changed, 40 insertions, 1 deletions
diff --git a/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc b/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc index d4c0c0eb2b..7790c7aa60 100644 --- a/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc +++ b/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc @@ -107,7 +107,10 @@ platforms that do not have \l{topics-graphics}{hardware-accelerated 3D graphics The Software adaptation was previously known as the Qt Quick 2D Renderer. However, unlike the 2D Renderer, this new, integrated version supports partial updates. This means that a full update of the window or screen contents is now avoided; only the changed areas are flushed. Partial -updates can significantly improve performance for many applications. +updates can significantly improve performance for many applications. It is also possible to disable +this partial update behavior by setting the environment variable +\c{QSG_SOFTWARE_RENDERER_FORCE_PARTIAL_UPDATES=0}, though doing so will have a negative impact on +performance. \section2 Shader Effects @@ -125,6 +128,18 @@ The text rendering with the Software adaptation is based on software rasterizati respond as well to transformations such as scaling, compared to when using a hardware-accelerated 3D graphics API. The quality is similar to choosing \l [QML] {Text::renderType}{Text.NativeRendering} with \l [QML] {Text} items. + + +\section2 High DPI + +The Software adaptation supports high DPI displays, but it does not support performing partial updates +when the using fractional scaling. This means that when using a non-integer scaling factor, the partial +update optimization is disabled, and the entire window is redrawn on every frame. This can be overridden +by setting an environment variable to \c{QSG_SOFTWARE_RENDERER_FORCE_PARTIAL_UPDATES=1} which forces +the Software adaptation to use partial updates even when fractional scaling is in use. However, this +may result in artifacts when scaling is not an integer value, and it is not recommended to use this +without thorough testing. + */ diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp index b59fd0fada..1e368446a7 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer.cpp @@ -21,6 +21,15 @@ QSGSoftwareRenderer::QSGSoftwareRenderer(QSGRenderContext *context) , m_paintDevice(nullptr) , m_backingStore(nullptr) { + // Check if the environment variable is set to force/disable partial updates + static bool partialUpdateOverrideSet = false; + static const int forcePartialUpdates = qEnvironmentVariableIntValue("QSG_SOFTWARE_RENDERER_FORCE_PARTIAL_UPDATES", &partialUpdateOverrideSet); + if (partialUpdateOverrideSet) { + if (forcePartialUpdates == 0) + m_partialUpdateMode = DisablePartialUpdate; + else + m_partialUpdateMode = ForcePartialUpdate; + } } QSGSoftwareRenderer::~QSGSoftwareRenderer() @@ -86,6 +95,15 @@ void QSGSoftwareRenderer::render() paintSize.width() / paintDevicePixelRatio, paintSize.height() / paintDevicePixelRatio), paintDevicePixelRatio); + // If paintDevicePixelRatio is not a whole number, opt to disable the partial update mechanism + const bool nonIntegerRatio = !qFuzzyIsNull(paintDevicePixelRatio - qFloor(paintDevicePixelRatio)); + bool disablePartialUpdates = m_partialUpdateMode == DisablePartialUpdate || nonIntegerRatio; + if (m_partialUpdateMode == ForcePartialUpdate) + disablePartialUpdates = false; + + // Force the whole render area to be marked as dirty, avoiding any partial update + if (disablePartialUpdates) + markDirty(); // Build Renderlist // The renderlist is created by visiting each node in the tree and when a diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer_p.h b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer_p.h index e87f79f8f3..82876c8af8 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer_p.h +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderer_p.h @@ -38,6 +38,12 @@ protected: void render() final; private: + enum PartialUpdateMode { + AutoPartialUpdate, + ForcePartialUpdate, + DisablePartialUpdate + } m_partialUpdateMode = AutoPartialUpdate; + QPaintDevice* m_paintDevice; QBackingStore* m_backingStore; QRegion m_flushRegion; |
