mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-23 14:04:26 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into feat/hasScriptedBlendshapes
This commit is contained in:
commit
aa1c0654da
16 changed files with 106 additions and 65 deletions
|
@ -1486,16 +1486,16 @@ std::pair<bool, AssetMeta> AssetServer::readMetaFile(AssetUtils::AssetHash hash)
|
||||||
if (error.error == QJsonParseError::NoError && doc.isObject()) {
|
if (error.error == QJsonParseError::NoError && doc.isObject()) {
|
||||||
auto root = doc.object();
|
auto root = doc.object();
|
||||||
|
|
||||||
auto bakeVersion = root[BAKE_VERSION_KEY].toInt(-1);
|
auto bakeVersion = root[BAKE_VERSION_KEY];
|
||||||
auto failedLastBake = root[FAILED_LAST_BAKE_KEY];
|
auto failedLastBake = root[FAILED_LAST_BAKE_KEY];
|
||||||
auto lastBakeErrors = root[LAST_BAKE_ERRORS_KEY];
|
auto lastBakeErrors = root[LAST_BAKE_ERRORS_KEY];
|
||||||
|
|
||||||
if (bakeVersion != -1
|
if (bakeVersion.isDouble()
|
||||||
&& failedLastBake.isBool()
|
&& failedLastBake.isBool()
|
||||||
&& lastBakeErrors.isString()) {
|
&& lastBakeErrors.isString()) {
|
||||||
|
|
||||||
AssetMeta meta;
|
AssetMeta meta;
|
||||||
meta.bakeVersion = bakeVersion;
|
meta.bakeVersion = bakeVersion.toInt();
|
||||||
meta.failedLastBake = failedLastBake.toBool();
|
meta.failedLastBake = failedLastBake.toBool();
|
||||||
meta.lastBakeErrors = lastBakeErrors.toString();
|
meta.lastBakeErrors = lastBakeErrors.toString();
|
||||||
|
|
||||||
|
|
|
@ -14,12 +14,24 @@ macro(GENERATE_INSTALLERS)
|
||||||
|
|
||||||
set(CPACK_MODULE_PATH ${CPACK_MODULE_PATH} "${HF_CMAKE_DIR}/templates")
|
set(CPACK_MODULE_PATH ${CPACK_MODULE_PATH} "${HF_CMAKE_DIR}/templates")
|
||||||
|
|
||||||
|
|
||||||
|
if (CLIENT_ONLY)
|
||||||
|
set(_PACKAGE_NAME_EXTRA "-Interface")
|
||||||
|
set(INSTALLER_TYPE "client_only")
|
||||||
|
string(REGEX REPLACE "High Fidelity" "High Fidelity Interface" _DISPLAY_NAME ${BUILD_ORGANIZATION})
|
||||||
|
elseif (SERVER_ONLY)
|
||||||
|
set(_PACKAGE_NAME_EXTRA "-Sandbox")
|
||||||
|
set(INSTALLER_TYPE "server_only")
|
||||||
|
string(REGEX REPLACE "High Fidelity" "High Fidelity Sandbox" _DISPLAY_NAME ${BUILD_ORGANIZATION})
|
||||||
|
else ()
|
||||||
set(_DISPLAY_NAME ${BUILD_ORGANIZATION})
|
set(_DISPLAY_NAME ${BUILD_ORGANIZATION})
|
||||||
|
set(INSTALLER_TYPE "full")
|
||||||
|
endif ()
|
||||||
|
|
||||||
set(CPACK_PACKAGE_NAME ${_DISPLAY_NAME})
|
set(CPACK_PACKAGE_NAME ${_DISPLAY_NAME})
|
||||||
set(CPACK_PACKAGE_VENDOR "High Fidelity")
|
set(CPACK_PACKAGE_VENDOR "High Fidelity")
|
||||||
set(CPACK_PACKAGE_VERSION ${BUILD_VERSION})
|
set(CPACK_PACKAGE_VERSION ${BUILD_VERSION})
|
||||||
set(CPACK_PACKAGE_FILE_NAME "HighFidelity-Beta-${BUILD_VERSION}")
|
set(CPACK_PACKAGE_FILE_NAME "HighFidelity-Beta${_PACKAGE_NAME_EXTRA}-${BUILD_VERSION}")
|
||||||
set(CPACK_NSIS_DISPLAY_NAME ${_DISPLAY_NAME})
|
set(CPACK_NSIS_DISPLAY_NAME ${_DISPLAY_NAME})
|
||||||
set(CPACK_NSIS_PACKAGE_NAME ${_DISPLAY_NAME})
|
set(CPACK_NSIS_PACKAGE_NAME ${_DISPLAY_NAME})
|
||||||
if (PR_BUILD)
|
if (PR_BUILD)
|
||||||
|
|
|
@ -48,3 +48,4 @@ set(UNINSTALLER_HEADER_IMAGE "@UNINSTALLER_HEADER_IMAGE@")
|
||||||
set(ADD_REMOVE_ICON_PATH "@ADD_REMOVE_ICON_PATH@")
|
set(ADD_REMOVE_ICON_PATH "@ADD_REMOVE_ICON_PATH@")
|
||||||
set(SERVER_COMPONENT_CONDITIONAL "@SERVER_COMPONENT_CONDITIONAL@")
|
set(SERVER_COMPONENT_CONDITIONAL "@SERVER_COMPONENT_CONDITIONAL@")
|
||||||
set(CLIENT_COMPONENT_CONDITIONAL "@CLIENT_COMPONENT_CONDITIONAL@")
|
set(CLIENT_COMPONENT_CONDITIONAL "@CLIENT_COMPONENT_CONDITIONAL@")
|
||||||
|
set(INSTALLER_TYPE "@INSTALLER_TYPE@")
|
||||||
|
|
|
@ -710,11 +710,9 @@ Function PostInstallOptionsPage
|
||||||
!insertmacro SetInstallOption $ServerStartupCheckbox @CONSOLE_STARTUP_REG_KEY@ ${BST_CHECKED}
|
!insertmacro SetInstallOption $ServerStartupCheckbox @CONSOLE_STARTUP_REG_KEY@ ${BST_CHECKED}
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
${If} @SERVER_COMPONENT_CONDITIONAL@
|
|
||||||
${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Perform a clean install (Delete older settings and content)"
|
${NSD_CreateCheckbox} 0 $CurrentOffset$OffsetUnits 100% 10u "&Perform a clean install (Delete older settings and content)"
|
||||||
Pop $CleanInstallCheckbox
|
Pop $CleanInstallCheckbox
|
||||||
IntOp $CurrentOffset $CurrentOffset + 15
|
IntOp $CurrentOffset $CurrentOffset + 15
|
||||||
${EndIf}
|
|
||||||
|
|
||||||
${If} @PR_BUILD@ == 1
|
${If} @PR_BUILD@ == 1
|
||||||
; a PR build defaults all install options expect LaunchServerNowCheckbox, LaunchClientNowCheckbox and the settings copy to unchecked
|
; a PR build defaults all install options expect LaunchServerNowCheckbox, LaunchClientNowCheckbox and the settings copy to unchecked
|
||||||
|
@ -809,10 +807,8 @@ Function ReadPostInstallOptions
|
||||||
${NSD_GetState} $LaunchClientNowCheckbox $LaunchClientNowState
|
${NSD_GetState} $LaunchClientNowCheckbox $LaunchClientNowState
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
${If} @CLIENT_COMPONENT_CONDITIONAL@
|
|
||||||
; check if the user asked for a clean install
|
; check if the user asked for a clean install
|
||||||
${NSD_GetState} $CleanInstallCheckbox $CleanInstallState
|
${NSD_GetState} $CleanInstallCheckbox $CleanInstallState
|
||||||
${EndIf}
|
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
Function HandlePostInstallOptions
|
Function HandlePostInstallOptions
|
||||||
|
@ -856,13 +852,23 @@ Function HandlePostInstallOptions
|
||||||
${EndIf}
|
${EndIf}
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
${If} @CLIENT_COMPONENT_CONDITIONAL@
|
|
||||||
; check if the user asked for a clean install
|
; check if the user asked for a clean install
|
||||||
${If} $CleanInstallState == ${BST_CHECKED}
|
${If} $CleanInstallState == ${BST_CHECKED}
|
||||||
SetShellVarContext current
|
SetShellVarContext current
|
||||||
RMDir /r "$APPDATA\@BUILD_ORGANIZATION@"
|
|
||||||
RMDir /r "$LOCALAPPDATA\@BUILD_ORGANIZATION@"
|
${If} @SERVER_COMPONENT_CONDITIONAL@
|
||||||
|
RMDir /r "$APPDATA\@BUILD_ORGANIZATION@\Server Console"
|
||||||
|
RMDir /r "$APPDATA\@BUILD_ORGANIZATION@\assignment-client"
|
||||||
|
RMDir /r "$APPDATA\@BUILD_ORGANIZATION@\domain-server"
|
||||||
|
Delete "$APPDATA\@BUILD_ORGANIZATION@\domain-server.json"
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
|
${If} @CLIENT_COMPONENT_CONDITIONAL@
|
||||||
|
Delete "$APPDATA\@BUILD_ORGANIZATION@\Interface\AccountInfo.bin"
|
||||||
|
Delete "$APPDATA\@BUILD_ORGANIZATION@\Interface.json"
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
|
RMDir /r "$LOCALAPPDATA\@BUILD_ORGANIZATION@"
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
${If} @PR_BUILD@ == 1
|
${If} @PR_BUILD@ == 1
|
||||||
|
@ -976,6 +982,13 @@ Section "-Core installation"
|
||||||
;Store installation folder
|
;Store installation folder
|
||||||
WriteRegStr HKLM "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR
|
WriteRegStr HKLM "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR
|
||||||
|
|
||||||
|
;Write some information about this install to the installation folder
|
||||||
|
FileOpen $0 "$INSTDIR\installer.ini" w
|
||||||
|
FileWrite $0 "type=@INSTALLER_TYPE@$\r$\n"
|
||||||
|
FileWrite $0 "campaign=$CampaignName$\r$\n"
|
||||||
|
FileWrite $0 "exepath=$EXEPATH$\r$\n"
|
||||||
|
FileClose $0
|
||||||
|
|
||||||
;Package the signed uninstaller produced by the inner loop
|
;Package the signed uninstaller produced by the inner loop
|
||||||
!ifndef INNER
|
!ifndef INNER
|
||||||
; this packages the signed uninstaller
|
; this packages the signed uninstaller
|
||||||
|
|
|
@ -272,6 +272,8 @@ ModalWindow {
|
||||||
root.canceled();
|
root.canceled();
|
||||||
// FIXME we are leaking memory to avoid a crash
|
// FIXME we are leaking memory to avoid a crash
|
||||||
// root.destroy();
|
// root.destroy();
|
||||||
|
|
||||||
|
root.disableFade = true
|
||||||
visible = false;
|
visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -296,6 +298,8 @@ ModalWindow {
|
||||||
root.selected(root.result);
|
root.selected(root.result);
|
||||||
// FIXME we are leaking memory to avoid a crash
|
// FIXME we are leaking memory to avoid a crash
|
||||||
// root.destroy();
|
// root.destroy();
|
||||||
|
|
||||||
|
root.disableFade = true
|
||||||
visible = false;
|
visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,6 +171,8 @@ ModalWindow {
|
||||||
root.canceled();
|
root.canceled();
|
||||||
// FIXME we are leaking memory to avoid a crash
|
// FIXME we are leaking memory to avoid a crash
|
||||||
// root.destroy();
|
// root.destroy();
|
||||||
|
|
||||||
|
root.disableFade = true
|
||||||
visible = false;
|
visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,6 +185,8 @@ ModalWindow {
|
||||||
root.selected(root.result);
|
root.selected(root.result);
|
||||||
// FIXME we are leaking memory to avoid a crash
|
// FIXME we are leaking memory to avoid a crash
|
||||||
// root.destroy();
|
// root.destroy();
|
||||||
|
|
||||||
|
root.disableFade = true
|
||||||
visible = false;
|
visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,10 @@ StackView {
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
}
|
}
|
||||||
|
|
||||||
onHostChanged: updateLocationTextTimer.restart();
|
onHostChanged: {
|
||||||
|
updateLocationTextTimer.restart();
|
||||||
|
DialogsManager.hideAddressBar();
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: navBar
|
id: navBar
|
||||||
|
|
|
@ -39,7 +39,7 @@ FocusScope {
|
||||||
// If someone directly set the visibility to false
|
// If someone directly set the visibility to false
|
||||||
// toggle it back on and use the targetVisible flag to transition
|
// toggle it back on and use the targetVisible flag to transition
|
||||||
// via fading.
|
// via fading.
|
||||||
if ((!visible && fadeTargetProperty != 0.0) || (visible && fadeTargetProperty == 0.0)) {
|
if (!disableFade && ((!visible && fadeTargetProperty != 0.0) || (visible && fadeTargetProperty == 0.0))) {
|
||||||
var target = visible;
|
var target = visible;
|
||||||
visible = !visible;
|
visible = !visible;
|
||||||
fadeTargetProperty = target ? 1.0 : 0.0;
|
fadeTargetProperty = target ? 1.0 : 0.0;
|
||||||
|
|
|
@ -135,10 +135,8 @@ void EntityRenderer::makeStatusGetters(const EntityItemPointer& entity, Item::St
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::shared_ptr<T> make_renderer(const EntityItemPointer& entity) {
|
std::shared_ptr<T> make_renderer(const EntityItemPointer& entity) {
|
||||||
T* rawResult = new T(entity);
|
|
||||||
|
|
||||||
// We want to use deleteLater so that renderer destruction gets pushed to the main thread
|
// We want to use deleteLater so that renderer destruction gets pushed to the main thread
|
||||||
return std::shared_ptr<T>(rawResult, std::bind(&QObject::deleteLater, rawResult));
|
return std::shared_ptr<T>(new T(entity), [](T* ptr) { ptr->deleteLater(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityRenderer::EntityRenderer(const EntityItemPointer& entity) : _entity(entity) {
|
EntityRenderer::EntityRenderer(const EntityItemPointer& entity) : _entity(entity) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ static const QString WEB_ENTITY_QML = "controls/WebEntityView.qml";
|
||||||
|
|
||||||
const float METERS_TO_INCHES = 39.3701f;
|
const float METERS_TO_INCHES = 39.3701f;
|
||||||
static uint32_t _currentWebCount{ 0 };
|
static uint32_t _currentWebCount{ 0 };
|
||||||
// Don't allow more than 100 concurrent web views
|
// Don't allow more than 20 concurrent web views
|
||||||
static const uint32_t MAX_CONCURRENT_WEB_VIEWS = 20;
|
static const uint32_t MAX_CONCURRENT_WEB_VIEWS = 20;
|
||||||
// If a web-view hasn't been rendered for 30 seconds, de-allocate the framebuffer
|
// If a web-view hasn't been rendered for 30 seconds, de-allocate the framebuffer
|
||||||
static uint64_t MAX_NO_RENDER_INTERVAL = 30 * USECS_PER_SECOND;
|
static uint64_t MAX_NO_RENDER_INTERVAL = 30 * USECS_PER_SECOND;
|
||||||
|
@ -88,9 +88,15 @@ bool WebEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointe
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uvec2(getWindowSize(entity)) != toGlm(_webSurface->size())) {
|
{
|
||||||
|
QSharedPointer<OffscreenQmlSurface> webSurface;
|
||||||
|
withReadLock([&] {
|
||||||
|
webSurface = _webSurface;
|
||||||
|
});
|
||||||
|
if (webSurface && uvec2(getWindowSize(entity)) != toGlm(webSurface->size())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_lastSourceUrl != entity->getSourceUrl()) {
|
if (_lastSourceUrl != entity->getSourceUrl()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -108,10 +114,16 @@ bool WebEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointe
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WebEntityRenderer::needsRenderUpdate() const {
|
bool WebEntityRenderer::needsRenderUpdate() const {
|
||||||
if (!_webSurface) {
|
{
|
||||||
|
QSharedPointer<OffscreenQmlSurface> webSurface;
|
||||||
|
withReadLock([&] {
|
||||||
|
webSurface = _webSurface;
|
||||||
|
});
|
||||||
|
if (!webSurface) {
|
||||||
// If we have rendered recently, and there is no web surface, we're going to create one
|
// If we have rendered recently, and there is no web surface, we're going to create one
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Parent::needsRenderUpdate();
|
return Parent::needsRenderUpdate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <NumericalConstants.h>
|
#include <NumericalConstants.h>
|
||||||
#include <SettingHandle.h>
|
#include <SettingHandle.h>
|
||||||
#include <UUID.h>
|
#include <UUID.h>
|
||||||
#include <PathUtils.h>
|
|
||||||
|
|
||||||
#include "AddressManager.h"
|
#include "AddressManager.h"
|
||||||
#include "NodeList.h"
|
#include "NodeList.h"
|
||||||
|
@ -311,8 +310,7 @@ bool AddressManager::handleUrl(const QUrl& lookupUrl, LookupTrigger trigger) {
|
||||||
// lookupUrl.scheme() == URL_SCHEME_HTTPS ||
|
// lookupUrl.scheme() == URL_SCHEME_HTTPS ||
|
||||||
_previousLookup.clear();
|
_previousLookup.clear();
|
||||||
_shareablePlaceName.clear();
|
_shareablePlaceName.clear();
|
||||||
QUrl domainURL = PathUtils::expandToLocalDataAbsolutePath(lookupUrl);
|
setDomainInfo(lookupUrl, trigger);
|
||||||
setDomainInfo(domainURL, trigger);
|
|
||||||
emit lookupResultsFinished();
|
emit lookupResultsFinished();
|
||||||
handlePath(DOMAIN_SPAWNING_POINT, LookupTrigger::Internal, false);
|
handlePath(DOMAIN_SPAWNING_POINT, LookupTrigger::Internal, false);
|
||||||
return true;
|
return true;
|
||||||
|
@ -770,14 +768,6 @@ bool AddressManager::setHost(const QString& host, LookupTrigger trigger, quint16
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AddressManager::getHost() const {
|
|
||||||
if (isPossiblePlaceName(_domainURL.host())) {
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
return _domainURL.host();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AddressManager::setDomainInfo(const QUrl& domainURL, LookupTrigger trigger) {
|
bool AddressManager::setDomainInfo(const QUrl& domainURL, LookupTrigger trigger) {
|
||||||
const QString hostname = domainURL.host();
|
const QString hostname = domainURL.host();
|
||||||
quint16 port = domainURL.port();
|
quint16 port = domainURL.port();
|
||||||
|
|
|
@ -160,7 +160,7 @@ public:
|
||||||
QString getPlaceName() const;
|
QString getPlaceName() const;
|
||||||
QString getDomainID() const;
|
QString getDomainID() const;
|
||||||
|
|
||||||
QString getHost() const;
|
QString getHost() const { return _domainURL.host(); }
|
||||||
|
|
||||||
void setPositionGetter(PositionGetter positionGetter) { _positionGetter = positionGetter; }
|
void setPositionGetter(PositionGetter positionGetter) { _positionGetter = positionGetter; }
|
||||||
void setOrientationGetter(OrientationGetter orientationGetter) { _orientationGetter = orientationGetter; }
|
void setOrientationGetter(OrientationGetter orientationGetter) { _orientationGetter = orientationGetter; }
|
||||||
|
|
|
@ -9,8 +9,12 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include "DomainHandler.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#include <PathUtils.h>
|
||||||
|
|
||||||
#include <QtCore/QJsonDocument>
|
#include <QtCore/QJsonDocument>
|
||||||
#include <QtCore/QDataStream>
|
#include <QtCore/QDataStream>
|
||||||
|
|
||||||
|
@ -25,8 +29,6 @@
|
||||||
#include "UserActivityLogger.h"
|
#include "UserActivityLogger.h"
|
||||||
#include "NetworkLogging.h"
|
#include "NetworkLogging.h"
|
||||||
|
|
||||||
#include "DomainHandler.h"
|
|
||||||
|
|
||||||
DomainHandler::DomainHandler(QObject* parent) :
|
DomainHandler::DomainHandler(QObject* parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
_sockAddr(HifiSockAddr(QHostAddress::Null, DEFAULT_DOMAIN_SERVER_PORT)),
|
_sockAddr(HifiSockAddr(QHostAddress::Null, DEFAULT_DOMAIN_SERVER_PORT)),
|
||||||
|
@ -157,6 +159,11 @@ void DomainHandler::setURLAndID(QUrl domainURL, QUuid domainID) {
|
||||||
|
|
||||||
if (domainURL.scheme() != URL_SCHEME_HIFI) {
|
if (domainURL.scheme() != URL_SCHEME_HIFI) {
|
||||||
_sockAddr.clear();
|
_sockAddr.clear();
|
||||||
|
|
||||||
|
// if this is a file URL we need to see if it has a ~ for us to expand
|
||||||
|
if (domainURL.scheme() == URL_SCHEME_FILE) {
|
||||||
|
domainURL = PathUtils::expandToLocalDataAbsolutePath(domainURL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_domainURL != domainURL || _sockAddr.getPort() != domainURL.port()) {
|
if (_domainURL != domainURL || _sockAddr.getPort() != domainURL.port()) {
|
||||||
|
|
|
@ -37,9 +37,8 @@ static const int MIN_TIMER_MS = 5;
|
||||||
using namespace hifi::qml;
|
using namespace hifi::qml;
|
||||||
using namespace hifi::qml::impl;
|
using namespace hifi::qml::impl;
|
||||||
|
|
||||||
TextureCache offscreenTextures;
|
|
||||||
|
|
||||||
TextureCache& SharedObject::getTextureCache() {
|
TextureCache& SharedObject::getTextureCache() {
|
||||||
|
static TextureCache offscreenTextures;
|
||||||
return offscreenTextures;
|
return offscreenTextures;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +242,7 @@ void SharedObject::releaseTextureAndFence() {
|
||||||
QMutexLocker lock(&_mutex);
|
QMutexLocker lock(&_mutex);
|
||||||
// If the most recent texture was unused, we can directly recycle it
|
// If the most recent texture was unused, we can directly recycle it
|
||||||
if (_latestTextureAndFence.first) {
|
if (_latestTextureAndFence.first) {
|
||||||
offscreenTextures.releaseTexture(_latestTextureAndFence);
|
getTextureCache().releaseTexture(_latestTextureAndFence);
|
||||||
_latestTextureAndFence = TextureAndFence{ 0, 0 };
|
_latestTextureAndFence = TextureAndFence{ 0, 0 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -307,7 +306,10 @@ bool SharedObject::preRender() {
|
||||||
void SharedObject::shutdownRendering(OffscreenGLCanvas& canvas, const QSize& size) {
|
void SharedObject::shutdownRendering(OffscreenGLCanvas& canvas, const QSize& size) {
|
||||||
QMutexLocker locker(&_mutex);
|
QMutexLocker locker(&_mutex);
|
||||||
if (size != QSize(0, 0)) {
|
if (size != QSize(0, 0)) {
|
||||||
offscreenTextures.releaseSize(size);
|
getTextureCache().releaseSize(size);
|
||||||
|
if (_latestTextureAndFence.first) {
|
||||||
|
getTextureCache().releaseTexture(_latestTextureAndFence);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_renderControl->invalidate();
|
_renderControl->invalidate();
|
||||||
canvas.doneCurrent();
|
canvas.doneCurrent();
|
||||||
|
@ -403,7 +405,7 @@ void SharedObject::onRender() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SharedObject::onTimer() {
|
void SharedObject::onTimer() {
|
||||||
offscreenTextures.report();
|
getTextureCache().report();
|
||||||
if (!_renderRequested) {
|
if (!_renderRequested) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -436,7 +438,7 @@ void SharedObject::updateTextureAndFence(const TextureAndFence& newTextureAndFen
|
||||||
QMutexLocker locker(&_mutex);
|
QMutexLocker locker(&_mutex);
|
||||||
// If the most recent texture was unused, we can directly recycle it
|
// If the most recent texture was unused, we can directly recycle it
|
||||||
if (_latestTextureAndFence.first) {
|
if (_latestTextureAndFence.first) {
|
||||||
offscreenTextures.releaseTexture(_latestTextureAndFence);
|
getTextureCache().releaseTexture(_latestTextureAndFence);
|
||||||
_latestTextureAndFence = { 0, 0 };
|
_latestTextureAndFence = { 0, 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,6 @@
|
||||||
|
|
||||||
using namespace hifi::qml::impl;
|
using namespace hifi::qml::impl;
|
||||||
|
|
||||||
#if defined(Q_OS_ANDROID)
|
|
||||||
#define USE_GLES 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint64_t uvec2ToUint64(const QSize& size) {
|
uint64_t uvec2ToUint64(const QSize& size) {
|
||||||
uint64_t result = size.width();
|
uint64_t result = size.width();
|
||||||
result <<= 32;
|
result <<= 32;
|
||||||
|
@ -31,26 +27,23 @@ void TextureCache::acquireSize(const QSize& size) {
|
||||||
|
|
||||||
void TextureCache::releaseSize(const QSize& size) {
|
void TextureCache::releaseSize(const QSize& size) {
|
||||||
auto sizeKey = uvec2ToUint64(size);
|
auto sizeKey = uvec2ToUint64(size);
|
||||||
ValueList texturesToDelete;
|
|
||||||
{
|
{
|
||||||
Lock lock(_mutex);
|
Lock lock(_mutex);
|
||||||
assert(_textures.count(sizeKey));
|
assert(_textures.count(sizeKey));
|
||||||
auto& textureSet = _textures[sizeKey];
|
auto& textureSet = _textures[sizeKey];
|
||||||
if (0 == --textureSet.clientCount) {
|
if (0 == --textureSet.clientCount) {
|
||||||
texturesToDelete.swap(textureSet.returnedTextures);
|
for (const auto& textureAndFence : textureSet.returnedTextures) {
|
||||||
|
destroy(textureAndFence);
|
||||||
|
}
|
||||||
_textures.erase(sizeKey);
|
_textures.erase(sizeKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const auto& textureAndFence : texturesToDelete) {
|
|
||||||
destroy(textureAndFence);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t TextureCache::acquireTexture(const QSize& size) {
|
uint32_t TextureCache::acquireTexture(const QSize& size) {
|
||||||
Lock lock(_mutex);
|
Lock lock(_mutex);
|
||||||
recycle();
|
recycle();
|
||||||
|
|
||||||
|
|
||||||
++_activeTextureCount;
|
++_activeTextureCount;
|
||||||
auto sizeKey = uvec2ToUint64(size);
|
auto sizeKey = uvec2ToUint64(size);
|
||||||
assert(_textures.count(sizeKey));
|
assert(_textures.count(sizeKey));
|
||||||
|
@ -83,7 +76,12 @@ void TextureCache::report() {
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t TextureCache::getUsedTextureMemory() {
|
size_t TextureCache::getUsedTextureMemory() {
|
||||||
return _totalTextureUsage;
|
size_t toReturn;
|
||||||
|
{
|
||||||
|
Lock lock(_mutex);
|
||||||
|
toReturn = _totalTextureUsage;
|
||||||
|
}
|
||||||
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t TextureCache::getMemoryForSize(const QSize& size) {
|
size_t TextureCache::getMemoryForSize(const QSize& size) {
|
||||||
|
@ -122,8 +120,6 @@ uint32_t TextureCache::createTexture(const QSize& size) {
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 8.0f);
|
|
||||||
#if !defined(USE_GLES)
|
#if !defined(USE_GLES)
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_LOD_BIAS, -0.2f);
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_LOD_BIAS, -0.2f);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -41,7 +41,6 @@ public:
|
||||||
ValueList returnedTextures;
|
ValueList returnedTextures;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void releaseSize(const QSize& size);
|
void releaseSize(const QSize& size);
|
||||||
void acquireSize(const QSize& size);
|
void acquireSize(const QSize& size);
|
||||||
uint32_t acquireTexture(const QSize& size);
|
uint32_t acquireTexture(const QSize& size);
|
||||||
|
|
Loading…
Reference in a new issue