mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
Various Mac fixes
This commit is contained in:
parent
3a75dcf84d
commit
0f465da92f
5 changed files with 41 additions and 19 deletions
|
@ -144,25 +144,33 @@ int main(int argc, const char* argv[]) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// FIXME this method of checking the OpenGL version screws up the `QOpenGLContext::globalShareContext()` value, which in turn
|
||||||
|
// leads to crashes when creating the real OpenGL instance. Disabling for now until we come up with a better way of checking
|
||||||
|
// the GL version on the system without resorting to creating a full Qt application
|
||||||
|
#if 0
|
||||||
// Check OpenGL version.
|
// Check OpenGL version.
|
||||||
// This is done separately from the main Application so that start-up and shut-down logic within the main Application is
|
// 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.
|
// not made more complicated than it already is.
|
||||||
bool override = false;
|
bool overrideGLCheck = false;
|
||||||
|
|
||||||
QJsonObject glData;
|
QJsonObject glData;
|
||||||
{
|
{
|
||||||
OpenGLVersionChecker openGLVersionChecker(argc, const_cast<char**>(argv));
|
OpenGLVersionChecker openGLVersionChecker(argc, const_cast<char**>(argv));
|
||||||
bool valid = true;
|
bool valid = true;
|
||||||
glData = openGLVersionChecker.checkVersion(valid, override);
|
glData = openGLVersionChecker.checkVersion(valid, overrideGLCheck);
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
if (override) {
|
if (overrideGLCheck) {
|
||||||
auto glVersion = glData["version"].toString();
|
auto glVersion = glData["version"].toString();
|
||||||
qCDebug(interfaceapp, "Running on insufficient OpenGL version: %s.", glVersion.toStdString().c_str());
|
qCWarning(interfaceapp, "Running on insufficient OpenGL version: %s.", glVersion.toStdString().c_str());
|
||||||
} else {
|
} else {
|
||||||
qCDebug(interfaceapp, "Early exit due to OpenGL version.");
|
qCWarning(interfaceapp, "Early exit due to OpenGL version.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Debug option to demonstrate that the client's local time does not
|
// Debug option to demonstrate that the client's local time does not
|
||||||
// need to be in sync with any other network node. This forces clock
|
// need to be in sync with any other network node. This forces clock
|
||||||
|
@ -223,8 +231,9 @@ int main(int argc, const char* argv[]) {
|
||||||
|
|
||||||
Application app(argcExtended, const_cast<char**>(argvExtended.data()), startupTime, runningMarkerExisted);
|
Application app(argcExtended, const_cast<char**>(argvExtended.data()), startupTime, runningMarkerExisted);
|
||||||
|
|
||||||
|
#if 0
|
||||||
// If we failed the OpenGLVersion check, log it.
|
// If we failed the OpenGLVersion check, log it.
|
||||||
if (override) {
|
if (overrideGLcheck) {
|
||||||
auto accountManager = DependencyManager::get<AccountManager>();
|
auto accountManager = DependencyManager::get<AccountManager>();
|
||||||
if (accountManager->isLoggedIn()) {
|
if (accountManager->isLoggedIn()) {
|
||||||
UserActivityLogger::getInstance().insufficientGLVersion(glData);
|
UserActivityLogger::getInstance().insufficientGLVersion(glData);
|
||||||
|
@ -238,6 +247,8 @@ int main(int argc, const char* argv[]) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// Setup local server
|
// Setup local server
|
||||||
QLocalServer server { &app };
|
QLocalServer server { &app };
|
||||||
|
|
|
@ -91,7 +91,12 @@ void entitiesScriptEngineDeleter(ScriptEngine* engine) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Wait for the scripting thread from the thread pool to avoid hanging the main thread
|
// Wait for the scripting thread from the thread pool to avoid hanging the main thread
|
||||||
QThreadPool::globalInstance()->start(new WaitRunnable(engine));
|
auto threadPool = QThreadPool::globalInstance();
|
||||||
|
if (threadPool) {
|
||||||
|
threadPool->start(new WaitRunnable(engine));
|
||||||
|
} else {
|
||||||
|
delete engine;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTreeRenderer::resetEntitiesScriptEngine() {
|
void EntityTreeRenderer::resetEntitiesScriptEngine() {
|
||||||
|
|
|
@ -40,8 +40,11 @@ const QSurfaceFormat& getDefaultOpenGLSurfaceFormat() {
|
||||||
|
|
||||||
int glVersionToInteger(QString glVersion) {
|
int glVersionToInteger(QString glVersion) {
|
||||||
QStringList versionParts = glVersion.split(QRegularExpression("[\\.\\s]"));
|
QStringList versionParts = glVersion.split(QRegularExpression("[\\.\\s]"));
|
||||||
int majorNumber = versionParts[0].toInt();
|
int majorNumber = 0, minorNumber = 0;
|
||||||
int minorNumber = versionParts[1].toInt();
|
if (versionParts.size() >= 2) {
|
||||||
|
majorNumber = versionParts[0].toInt();
|
||||||
|
minorNumber = versionParts[1].toInt();
|
||||||
|
}
|
||||||
return (majorNumber << 16) | minorNumber;
|
return (majorNumber << 16) | minorNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -467,12 +467,14 @@ void GLVariableAllocationSupport::updateMemoryPressure() {
|
||||||
_demoteQueue = WorkQueue();
|
_demoteQueue = WorkQueue();
|
||||||
|
|
||||||
// Populate the existing textures into the queue
|
// Populate the existing textures into the queue
|
||||||
for (const auto& texture : strongTextures) {
|
if (_memoryPressureState != MemoryPressureState::Idle) {
|
||||||
// Race conditions can still leave nulls in the list, so we need to check
|
for (const auto& texture : strongTextures) {
|
||||||
if (!texture) {
|
// Race conditions can still leave nulls in the list, so we need to check
|
||||||
continue;
|
if (!texture) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
addToWorkQueue(texture);
|
||||||
}
|
}
|
||||||
addToWorkQueue(texture);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -528,6 +528,12 @@ void OffscreenQmlSurface::create() {
|
||||||
|
|
||||||
connect(_quickWindow, &QQuickWindow::focusObjectChanged, this, &OffscreenQmlSurface::onFocusObjectChanged);
|
connect(_quickWindow, &QQuickWindow::focusObjectChanged, this, &OffscreenQmlSurface::onFocusObjectChanged);
|
||||||
|
|
||||||
|
// acquireEngine interrogates the GL context, so we need to have the context current here
|
||||||
|
if (!_canvas->makeCurrent()) {
|
||||||
|
qFatal("Failed to make context current for QML Renderer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Create a QML engine.
|
// Create a QML engine.
|
||||||
auto qmlEngine = acquireEngine(_quickWindow);
|
auto qmlEngine = acquireEngine(_quickWindow);
|
||||||
|
|
||||||
|
@ -540,11 +546,6 @@ void OffscreenQmlSurface::create() {
|
||||||
// FIXME Compatibility mechanism for existing HTML and JS that uses eventBridgeWrapper
|
// FIXME Compatibility mechanism for existing HTML and JS that uses eventBridgeWrapper
|
||||||
// Find a way to flag older scripts using this mechanism and wanr that this is deprecated
|
// Find a way to flag older scripts using this mechanism and wanr that this is deprecated
|
||||||
_qmlContext->setContextProperty("eventBridgeWrapper", new EventBridgeWrapper(this, _qmlContext));
|
_qmlContext->setContextProperty("eventBridgeWrapper", new EventBridgeWrapper(this, _qmlContext));
|
||||||
|
|
||||||
if (!_canvas->makeCurrent()) {
|
|
||||||
qWarning("Failed to make context current for QML Renderer");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_renderControl->initialize(_canvas->getContext());
|
_renderControl->initialize(_canvas->getContext());
|
||||||
|
|
||||||
// When Quick says there is a need to render, we will not render immediately. Instead,
|
// When Quick says there is a need to render, we will not render immediately. Instead,
|
||||||
|
|
Loading…
Reference in a new issue