Merge pull request #2659 from Cacodemon345/qt-hwrenderer-fix
qt_hardwarerenderer: Don't update the entire texture on blits
This commit is contained in:
@@ -21,6 +21,8 @@
|
||||
#include "qt_hardwarerenderer.hpp"
|
||||
#include <QApplication>
|
||||
#include <QVector2D>
|
||||
#include <QOpenGLPixelTransferOptions>
|
||||
|
||||
#include <atomic>
|
||||
#include <vector>
|
||||
|
||||
@@ -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());
|
||||
|
@@ -8,6 +8,7 @@
|
||||
#include <QOpenGLShader>
|
||||
#include <QOpenGLShaderProgram>
|
||||
#include <QOpenGLTextureBlitter>
|
||||
#include <QOpenGLPixelTransferOptions>
|
||||
#include <QPainter>
|
||||
#include <QEvent>
|
||||
#include <QKeyEvent>
|
||||
@@ -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();
|
||||
|
Reference in New Issue
Block a user