From 11f6fee8caf484ce20d9a8a3d9403eea355a3cf4 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Thu, 1 Sep 2022 16:55:12 +0600 Subject: [PATCH] qt_hardwarerenderer: Don't update the entire texture on blits --- src/qt/qt_hardwarerenderer.cpp | 4 +++- src/qt/qt_hardwarerenderer.hpp | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/qt/qt_hardwarerenderer.cpp b/src/qt/qt_hardwarerenderer.cpp index 3577234ee..a7af8bb4c 100644 --- a/src/qt/qt_hardwarerenderer.cpp +++ b/src/qt/qt_hardwarerenderer.cpp @@ -21,6 +21,8 @@ #include "qt_hardwarerenderer.hpp" #include #include +#include + #include #include @@ -196,7 +198,7 @@ void HardwareRenderer::onBlit(int buf_idx, int x, int y, int w, int h) { return; } m_context->makeCurrent(this); - m_texture->setData(QOpenGLTexture::PixelFormat::RGBA, QOpenGLTexture::PixelType::UInt8, (const void*)imagebufs[buf_idx].get()); + m_texture->setData(0, 0, 0, w + x, h + y, 0, QOpenGLTexture::PixelFormat::RGBA, QOpenGLTexture::PixelType::UInt8, (const void*)imagebufs[buf_idx].get(), &m_transferOptions); buf_usage[buf_idx].clear(); source.setRect(x, y, w, h); if (origSource != source) onResize(this->width(), this->height()); diff --git a/src/qt/qt_hardwarerenderer.hpp b/src/qt/qt_hardwarerenderer.hpp index b9b7895e0..6bf0d3276 100644 --- a/src/qt/qt_hardwarerenderer.hpp +++ b/src/qt/qt_hardwarerenderer.hpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -38,6 +39,8 @@ private: QOpenGLTextureBlitter* m_blt{nullptr}; QOpenGLBuffer m_vbo[2]; QOpenGLVertexArrayObject m_vao; + QOpenGLPixelTransferOptions m_transferOptions; + public: enum class RenderType { OpenGL, @@ -67,6 +70,8 @@ public: parentWidget = parent; setRenderType(rtype); + m_transferOptions.setRowLength(2048); + m_context = new QOpenGLContext(); m_context->setFormat(format()); m_context->create();