Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to rhi #1463

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
936 changes: 16 additions & 920 deletions qmlui/CMakeLists.txt

Large diffs are not rendered by default.

17 changes: 14 additions & 3 deletions qmlui/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <QPrinter>
#include <QPainter>
#include <QScreen>
#include <QQmlFileSelector>
#include <unistd.h>

#include "app.h"
Expand Down Expand Up @@ -124,6 +125,11 @@ void App::startup()
qmlRegisterType<ModelSelector>("org.qlcplus.classes", 1, 0, "ModelSelector");
qmlRegisterType<FolderBrowser>("org.qlcplus.classes", 1, 0, "FolderBrowser");

#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QQmlFileSelector* selector = new QQmlFileSelector(engine());
selector->setExtraSelectors({"qt5"});
#endif

setTitle(APPNAME);
setIcon(QIcon(":/qlcplus.svg"));

Expand Down Expand Up @@ -256,9 +262,14 @@ bool App::is3DSupported() const
int glVersion = (openglContext()->format().majorVersion() * 10) + openglContext()->format().minorVersion();
return glVersion < 33 ? false : true;
#else
// TODO: Qt6

return true;
if (rendererInterface()->isApiRhiBased(graphicsApi())) {
return true;
}
QOpenGLContext * openglContext = static_cast<QOpenGLContext *>(rendererInterface()->getResource(const_cast<App *>(this), QSGRendererInterface::OpenGLContextResource));
if (openglContext && openglContext->isValid() && openglContext->format().majorVersion() * 10 + openglContext->format().minorVersion() >= 33) {
return true;
}
return false;
#endif
}

Expand Down
3 changes: 1 addition & 2 deletions qmlui/inputprofileeditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ class InputProfileEditor : public QObject
* Initialization
************************************************************************/
public:
InputProfileEditor(QObject *parent = nullptr);
InputProfileEditor(QLCInputProfile *profile, Doc *doc, QObject *parent = nullptr);
explicit InputProfileEditor(QLCInputProfile *profile, Doc *doc, QObject *parent = nullptr);
~InputProfileEditor();

/* Get/Set the profile modified state */
Expand Down
46 changes: 43 additions & 3 deletions qmlui/mainview3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,9 @@ void MainView3D::initialize3DProperties()
QMetaObject::invokeMethod(m_scene3D, "updateFrameGraph", Q_ARG(QVariant, true));
}

QString MainView3D::makeShader(QString str) {

QString prefix = R"(#version 150
QString MainView3D::makeGlShader(const QString &str)
{
QString prefix = R"(#version 150
#define GL3

#ifdef GL3
Expand Down Expand Up @@ -416,6 +416,46 @@ QString MainView3D::makeShader(QString str) {
return prefix + str;
}

QString MainView3D::makeRhiShader(const QString &str) {

QString prefix = R"(#version 450 core

layout(std140, binding = 0) uniform qt3d_render_view_uniforms {
mat4 viewMatrix;
mat4 projectionMatrix;
mat4 uncorrectedProjectionMatrix;
mat4 clipCorrectionMatrix;
mat4 viewProjectionMatrix;
mat4 inverseViewMatrix;
mat4 inverseProjectionMatrix;
mat4 inverseViewProjectionMatrix;
mat4 viewportMatrix;
mat4 inverseViewportMatrix;
vec4 textureTransformMatrix;
vec3 eyePosition;
float aspectRatio;
float gamma;
float exposure;
float time;
float yUpInNDC;
float yUpInFBO;
};

layout(std140, binding = 1) uniform qt3d_command_uniforms {
mat4 modelMatrix;
mat4 inverseModelMatrix;
mat4 modelViewMatrix;
mat3 modelNormalMatrix;
mat4 inverseModelViewMatrix;
mat4 modelViewProjection;
mat4 inverseModelViewProjectionMatrix;
};

)";

return prefix + str;
}

void MainView3D::sceneReady()
{
qDebug() << "Scene entity ready";
Expand Down
4 changes: 3 additions & 1 deletion qmlui/mainview3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ protected slots:

Q_INVOKABLE void initializeFixture(quint32 itemID, QEntity *fxEntity, QSceneLoader *loader);

Q_INVOKABLE QString makeShader(QString str);
Q_INVOKABLE QString makeGlShader(const QString &str);

Q_INVOKABLE QString makeRhiShader(const QString &str);

/** Update the fixture preview items when some channels have changed */
void updateFixture(Fixture *fixture, QByteArray &previous);
Expand Down
Loading