mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Merge pull request #7611 from zzmp/guard/amd
Disable gradient QML items on AMD
This commit is contained in:
commit
3f05ded932
14 changed files with 67 additions and 24 deletions
|
@ -116,7 +116,7 @@ Column {
|
|||
|
||||
LinearGradient {
|
||||
id: bottomBar
|
||||
visible: isCollapsible
|
||||
visible: desktop.gradientsSupported && isCollapsible
|
||||
width: frame.width
|
||||
height: visible ? 4 : 0
|
||||
x: -hifi.dimensions.contentMargin.x
|
||||
|
|
|
@ -34,6 +34,10 @@ FocusScope {
|
|||
// The VR version of the primary menu
|
||||
property var rootMenu: Menu { objectName: "rootMenu" }
|
||||
|
||||
// FIXME: Alpha gradients display as fuschia under QtQuick 2.5 on OSX/AMD
|
||||
// because shaders are 4.2, and do not include #version declarations.
|
||||
property bool gradientsSupported: Qt.platform.os != "osx" && !~GL.vendor.indexOf("ATI")
|
||||
|
||||
readonly property alias zLevels: zLevels
|
||||
QtObject {
|
||||
id: zLevels;
|
||||
|
|
|
@ -20,6 +20,8 @@ Item {
|
|||
|
||||
default property var decoration
|
||||
|
||||
property bool gradientsSupported: desktop.gradientsSupported
|
||||
|
||||
readonly property int iconSize: 22
|
||||
readonly property int frameMargin: 9
|
||||
readonly property int frameMarginLeft: frameMargin
|
||||
|
@ -59,9 +61,7 @@ Item {
|
|||
height: 1.66 * window.height
|
||||
x: (window.width - width) / 2
|
||||
y: window.height / 2 - 0.375 * height
|
||||
// FIXME: Alpha gradients display as fuschia under QtQuick 2.5 on OSX.
|
||||
// Check again when have a later version of QtQuick.
|
||||
visible: window && window.focus && pane.visible && Qt.platform.os != "osx"
|
||||
visible: gradientsSupported && window && window.focus && pane.visible
|
||||
gradient: Gradient {
|
||||
// GradientStop position 0.5 is at full circumference of circle that fits inside the square.
|
||||
GradientStop { position: 0.0; color: "#ff000000" } // black, 100% opacity
|
||||
|
|
|
@ -51,6 +51,7 @@ Fadable {
|
|||
// property bool pinnable: false
|
||||
// property bool pinned: false
|
||||
property bool resizable: false
|
||||
property bool gradientsSupported: desktop.gradientsSupported
|
||||
|
||||
property vector2d minSize: Qt.vector2d(100, 100)
|
||||
property vector2d maxSize: Qt.vector2d(1280, 800)
|
||||
|
@ -142,9 +143,7 @@ Fadable {
|
|||
}
|
||||
|
||||
LinearGradient {
|
||||
// FIXME: Alpha gradients display as fuschia under QtQuick 2.5 on OSX.
|
||||
// Check again when have a later version of QtQuick.
|
||||
visible: modality != Qt.ApplicationModal && Qt.platform.os != "osx"
|
||||
visible: gradientsSupported && modality != Qt.ApplicationModal
|
||||
anchors.top: contentBackground.bottom
|
||||
anchors.left: contentBackground.left
|
||||
width: contentBackground.width - 1
|
||||
|
|
|
@ -1334,7 +1334,9 @@ void Application::initializeGL() {
|
|||
|
||||
InfoView::show(INFO_HELP_PATH, true);
|
||||
}
|
||||
|
||||
extern void setupPreferences();
|
||||
|
||||
void Application::initializeUi() {
|
||||
AddressBarDialog::registerType();
|
||||
ErrorDialog::registerType();
|
||||
|
@ -1346,6 +1348,9 @@ void Application::initializeUi() {
|
|||
|
||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||
offscreenUi->create(_offscreenContext->getContext());
|
||||
|
||||
auto rootContext = offscreenUi->getRootContext();
|
||||
|
||||
offscreenUi->setProxyWindow(_window->windowHandle());
|
||||
offscreenUi->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/"));
|
||||
// OffscreenUi is a subclass of OffscreenQmlSurface specifically designed to
|
||||
|
@ -1356,7 +1361,6 @@ void Application::initializeUi() {
|
|||
// do better detection in the offscreen UI of what has focus
|
||||
offscreenUi->setNavigationFocused(false);
|
||||
|
||||
auto rootContext = offscreenUi->getRootContext();
|
||||
auto engine = rootContext->engine();
|
||||
connect(engine, &QQmlEngine::quit, [] {
|
||||
qApp->quit();
|
||||
|
|
|
@ -44,7 +44,7 @@ int main(int argc, const char* argv[]) {
|
|||
MiniDmpSender mpSender { BUG_SPLAT_DATABASE, BUG_SPLAT_APPLICATION_NAME, qPrintable(BuildInfo::VERSION),
|
||||
nullptr, BUG_SPLAT_FLAGS };
|
||||
#endif
|
||||
|
||||
|
||||
QString applicationName = "High Fidelity Interface - " + qgetenv("USERNAME");
|
||||
|
||||
bool instanceMightBeRunning = true;
|
||||
|
@ -105,13 +105,14 @@ int main(int argc, const char* argv[]) {
|
|||
// This is done separately from the main Application so that start-up and shut-down logic within the main Application is
|
||||
// not made more complicated than it already is.
|
||||
bool override = false;
|
||||
QString glVersion;
|
||||
QJsonObject glData;
|
||||
{
|
||||
OpenGLVersionChecker openGLVersionChecker(argc, const_cast<char**>(argv));
|
||||
bool valid = true;
|
||||
glVersion = openGLVersionChecker.checkVersion(valid, override);
|
||||
glData = openGLVersionChecker.checkVersion(valid, override);
|
||||
if (!valid) {
|
||||
if (override) {
|
||||
auto glVersion = glData["version"].toString();
|
||||
qCDebug(interfaceapp, "Running on insufficient OpenGL version: %s.", glVersion.toStdString().c_str());
|
||||
} else {
|
||||
qCDebug(interfaceapp, "Early exit due to OpenGL version.");
|
||||
|
@ -148,12 +149,12 @@ int main(int argc, const char* argv[]) {
|
|||
if (override) {
|
||||
auto& accountManager = AccountManager::getInstance();
|
||||
if (accountManager.isLoggedIn()) {
|
||||
UserActivityLogger::getInstance().insufficientGLVersion(glVersion);
|
||||
UserActivityLogger::getInstance().insufficientGLVersion(glData);
|
||||
} else {
|
||||
QObject::connect(&AccountManager::getInstance(), &AccountManager::loginComplete, [glVersion](){
|
||||
QObject::connect(&AccountManager::getInstance(), &AccountManager::loginComplete, [glData](){
|
||||
static bool loggedInsufficientGL = false;
|
||||
if (!loggedInsufficientGL) {
|
||||
UserActivityLogger::getInstance().insufficientGLVersion(glVersion);
|
||||
UserActivityLogger::getInstance().insufficientGLVersion(glData);
|
||||
loggedInsufficientGL = true;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <QtGui/QSurfaceFormat>
|
||||
#include <QtOpenGL/QGL>
|
||||
#include <QOpenGLContext>
|
||||
|
||||
const QSurfaceFormat& getDefaultOpenGLSurfaceFormat() {
|
||||
static QSurfaceFormat format;
|
||||
|
@ -37,3 +38,21 @@ const QGLFormat& getDefaultGLFormat() {
|
|||
});
|
||||
return glFormat;
|
||||
}
|
||||
|
||||
QJsonObject getGLContextData() {
|
||||
if (!QOpenGLContext::currentContext()) {
|
||||
return QJsonObject();
|
||||
}
|
||||
|
||||
QString glVersion = QString((const char*)glGetString(GL_VERSION));
|
||||
QString glslVersion = QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION));
|
||||
QString glVendor = QString((const char*) glGetString(GL_VENDOR));
|
||||
QString glRenderer = QString((const char*)glGetString(GL_RENDERER));
|
||||
|
||||
return QJsonObject {
|
||||
{ "version", glVersion },
|
||||
{ "slVersion", glslVersion },
|
||||
{ "vendor", glVendor },
|
||||
{ "renderer", glRenderer },
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#ifndef hifi_GLHelpers_h
|
||||
#define hifi_GLHelpers_h
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
// 16 bits of depth precision
|
||||
#define DEFAULT_GL_DEPTH_BUFFER_BITS 16
|
||||
// 8 bits of stencil buffer (typically you really only need 1 bit for functionality
|
||||
|
@ -24,4 +26,6 @@ void setGLFormatVersion(F& format, int major = 4, int minor = 5) { format.setVer
|
|||
|
||||
const QSurfaceFormat& getDefaultOpenGLSurfaceFormat();
|
||||
const QGLFormat& getDefaultGLFormat();
|
||||
QJsonObject getGLContextData();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "OffscreenGLCanvas.h"
|
||||
#include "GLEscrow.h"
|
||||
#include "GLHelpers.h"
|
||||
|
||||
|
||||
// Time between receiving a request to render the offscreen UI actually triggering
|
||||
|
@ -222,6 +223,11 @@ void OffscreenQmlRenderThread::init() {
|
|||
return;
|
||||
}
|
||||
|
||||
// Expose GL data to QML
|
||||
auto glData = getGLContextData();
|
||||
auto setGL = [=]{ _surface->getRootContext()->setContextProperty("GL", glData); };
|
||||
_surface->executeOnUiThread(setGL);
|
||||
|
||||
_renderControl->initialize(_canvas.getContext());
|
||||
setupFbo();
|
||||
_escrow.setRecycler([this](GLuint texture){
|
||||
|
|
|
@ -13,16 +13,18 @@
|
|||
|
||||
#include <QMessageBox>
|
||||
#include <QRegularExpression>
|
||||
#include <QJsonObject>
|
||||
|
||||
#include "Config.h"
|
||||
#include "GLWidget.h"
|
||||
#include "GLHelpers.h"
|
||||
|
||||
OpenGLVersionChecker::OpenGLVersionChecker(int& argc, char** argv) :
|
||||
QApplication(argc, argv)
|
||||
{
|
||||
}
|
||||
|
||||
QString OpenGLVersionChecker::checkVersion(bool& valid, bool& override) {
|
||||
QJsonObject OpenGLVersionChecker::checkVersion(bool& valid, bool& override) {
|
||||
valid = true;
|
||||
override = false;
|
||||
|
||||
|
@ -38,12 +40,12 @@ QString OpenGLVersionChecker::checkVersion(bool& valid, bool& override) {
|
|||
messageBox.setStandardButtons(QMessageBox::Ok);
|
||||
messageBox.setDefaultButton(QMessageBox::Ok);
|
||||
messageBox.exec();
|
||||
return QString();
|
||||
return QJsonObject();
|
||||
}
|
||||
|
||||
// Retrieve OpenGL version
|
||||
glWidget->initializeGL();
|
||||
QString glVersion = QString((const char*)glGetString(GL_VERSION));
|
||||
QJsonObject glData = getGLContextData();
|
||||
delete glWidget;
|
||||
|
||||
// Compare against minimum
|
||||
|
@ -51,6 +53,8 @@ QString OpenGLVersionChecker::checkVersion(bool& valid, bool& override) {
|
|||
// - major_number.minor_number
|
||||
// - major_number.minor_number.release_number
|
||||
// Reference: https://www.opengl.org/sdk/docs/man/docbook4/xhtml/glGetString.xml
|
||||
const QString version { "version" };
|
||||
QString glVersion = glData[version].toString();
|
||||
QStringList versionParts = glVersion.split(QRegularExpression("[\\.\\s]"));
|
||||
int majorNumber = versionParts[0].toInt();
|
||||
int minorNumber = versionParts[1].toInt();
|
||||
|
@ -72,5 +76,5 @@ QString OpenGLVersionChecker::checkVersion(bool& valid, bool& override) {
|
|||
override = messageBox.exec() == QMessageBox::Ignore;
|
||||
}
|
||||
|
||||
return glVersion;
|
||||
return glData;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class OpenGLVersionChecker : public QApplication {
|
|||
public:
|
||||
OpenGLVersionChecker(int& argc, char** argv);
|
||||
|
||||
static QString checkVersion(bool& valid, bool& override);
|
||||
static QJsonObject checkVersion(bool& valid, bool& override);
|
||||
};
|
||||
|
||||
#endif // hifi_OpenGLVersionChecker_h
|
||||
|
|
|
@ -85,11 +85,11 @@ void UserActivityLogger::launch(QString applicationVersion, bool previousSession
|
|||
logAction(ACTION_NAME, actionDetails);
|
||||
}
|
||||
|
||||
void UserActivityLogger::insufficientGLVersion(QString glVersion) {
|
||||
void UserActivityLogger::insufficientGLVersion(const QJsonObject& glData) {
|
||||
const QString ACTION_NAME = "insufficient_gl";
|
||||
QJsonObject actionDetails;
|
||||
QString GL_VERSION = "glVersion";
|
||||
actionDetails.insert(GL_VERSION, glVersion);
|
||||
QString GL_DATA = "glData";
|
||||
actionDetails.insert(GL_DATA, glData);
|
||||
|
||||
logAction(ACTION_NAME, actionDetails);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public slots:
|
|||
|
||||
void launch(QString applicationVersion, bool previousSessionCrashed, int previousSessionRuntime);
|
||||
|
||||
void insufficientGLVersion(QString glVersion);
|
||||
void insufficientGLVersion(const QJsonObject& glData);
|
||||
|
||||
void changedDisplayName(QString displayName);
|
||||
void changedModel(QString typeOfModel, QString modelURL);
|
||||
|
@ -48,4 +48,4 @@ private:
|
|||
bool _disabled;
|
||||
};
|
||||
|
||||
#endif // hifi_UserActivityLogger_h
|
||||
#endif // hifi_UserActivityLogger_h
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include <QtQuick/QQuickWindow>
|
||||
#include <QtQml/QtQml>
|
||||
|
||||
#include <gl/GLHelpers.h>
|
||||
|
||||
#include <AbstractUriHandler.h>
|
||||
#include <AccountManager.h>
|
||||
|
||||
|
|
Loading…
Reference in a new issue