mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 11:37:58 +02:00
Add command line disabling of QML and KTX cache
This commit is contained in:
parent
c924cbf2a7
commit
58d4d193f7
5 changed files with 29 additions and 21 deletions
|
@ -26,9 +26,11 @@ endif()
|
||||||
if (ANDROID OR UWP)
|
if (ANDROID OR UWP)
|
||||||
option(BUILD_SERVER "Build server components" OFF)
|
option(BUILD_SERVER "Build server components" OFF)
|
||||||
option(BUILD_TOOLS "Build tools" OFF)
|
option(BUILD_TOOLS "Build tools" OFF)
|
||||||
|
option(BUILD_INSTALLER "Build installer" OFF)
|
||||||
else()
|
else()
|
||||||
option(BUILD_SERVER "Build server components" ON)
|
option(BUILD_SERVER "Build server components" ON)
|
||||||
option(BUILD_TOOLS "Build tools" ON)
|
option(BUILD_TOOLS "Build tools" ON)
|
||||||
|
option(BUILD_INSTALLER "Build installer" ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (SERVER_ONLY)
|
if (SERVER_ONLY)
|
||||||
|
@ -39,6 +41,8 @@ else()
|
||||||
option(BUILD_TESTS "Build tests" ON)
|
option(BUILD_TESTS "Build tests" ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
option(DISABLE_QML "Disable QML" OFF)
|
||||||
|
option(DISABLE_KTX_CACHE "Disable KTX Cache" OFF)
|
||||||
|
|
||||||
|
|
||||||
if (ANDROID)
|
if (ANDROID)
|
||||||
|
@ -64,8 +68,6 @@ foreach(PLATFORM_QT_COMPONENT ${PLATFORM_QT_COMPONENTS})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
|
||||||
option(BUILD_INSTALLER "Build installer" ON)
|
|
||||||
|
|
||||||
MESSAGE(STATUS "Build server: " ${BUILD_SERVER})
|
MESSAGE(STATUS "Build server: " ${BUILD_SERVER})
|
||||||
MESSAGE(STATUS "Build client: " ${BUILD_CLIENT})
|
MESSAGE(STATUS "Build client: " ${BUILD_CLIENT})
|
||||||
MESSAGE(STATUS "Build tests: " ${BUILD_TESTS})
|
MESSAGE(STATUS "Build tests: " ${BUILD_TESTS})
|
||||||
|
@ -73,6 +75,16 @@ MESSAGE(STATUS "Build tools: " ${BUILD_TOOLS})
|
||||||
MESSAGE(STATUS "Build installer: " ${BUILD_INSTALLER})
|
MESSAGE(STATUS "Build installer: " ${BUILD_INSTALLER})
|
||||||
MESSAGE(STATUS "GL ES: " ${USE_GLES})
|
MESSAGE(STATUS "GL ES: " ${USE_GLES})
|
||||||
|
|
||||||
|
if (DISABLE_QML)
|
||||||
|
MESSAGE(STATUS "QML disabled!")
|
||||||
|
add_definitions(-DDISABLE_QML)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (DISABLE_KTX_CACHE)
|
||||||
|
MESSAGE(STATUS "KTX cache disabled!")
|
||||||
|
add_definitions(-DDISABLE_KTX_CACHE)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (UNIX AND DEFINED ENV{HIFI_MEMORY_DEBUGGING})
|
if (UNIX AND DEFINED ENV{HIFI_MEMORY_DEBUGGING})
|
||||||
MESSAGE(STATUS "Memory debugging is enabled")
|
MESSAGE(STATUS "Memory debugging is enabled")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -50,7 +50,7 @@ Q_LOGGING_CATEGORY(trace_resource_parse_image, "trace.resource.parse.image")
|
||||||
Q_LOGGING_CATEGORY(trace_resource_parse_image_raw, "trace.resource.parse.image.raw")
|
Q_LOGGING_CATEGORY(trace_resource_parse_image_raw, "trace.resource.parse.image.raw")
|
||||||
Q_LOGGING_CATEGORY(trace_resource_parse_image_ktx, "trace.resource.parse.image.ktx")
|
Q_LOGGING_CATEGORY(trace_resource_parse_image_ktx, "trace.resource.parse.image.ktx")
|
||||||
|
|
||||||
#if ENABLE_KTX_CACHE
|
#if !defined(DISABLE_KTX_CACHE)
|
||||||
const std::string TextureCache::KTX_DIRNAME { "ktx_cache" };
|
const std::string TextureCache::KTX_DIRNAME { "ktx_cache" };
|
||||||
const std::string TextureCache::KTX_EXT { "ktx" };
|
const std::string TextureCache::KTX_EXT { "ktx" };
|
||||||
#endif
|
#endif
|
||||||
|
@ -63,7 +63,7 @@ static const float SKYBOX_LOAD_PRIORITY { 10.0f }; // Make sure skybox loads fir
|
||||||
static const float HIGH_MIPS_LOAD_PRIORITY { 9.0f }; // Make sure high mips loads after skybox but before models
|
static const float HIGH_MIPS_LOAD_PRIORITY { 9.0f }; // Make sure high mips loads after skybox but before models
|
||||||
|
|
||||||
TextureCache::TextureCache() {
|
TextureCache::TextureCache() {
|
||||||
#if ENABLE_KTX_CACHE
|
#if !defined(DISABLE_KTX_CACHE)
|
||||||
_ktxCache->initialize();
|
_ktxCache->initialize();
|
||||||
#endif
|
#endif
|
||||||
setUnusedResourceCacheSize(0);
|
setUnusedResourceCacheSize(0);
|
||||||
|
@ -746,7 +746,7 @@ void NetworkTexture::handleFinishedInitialLoad() {
|
||||||
|
|
||||||
gpu::TexturePointer texture = textureCache->getTextureByHash(hash);
|
gpu::TexturePointer texture = textureCache->getTextureByHash(hash);
|
||||||
|
|
||||||
#if ENABLE_KTX_CACHE
|
#if !defined(DISABLE_KTX_CACHE)
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
auto ktxFile = textureCache->_ktxCache->getFile(hash);
|
auto ktxFile = textureCache->_ktxCache->getFile(hash);
|
||||||
if (ktxFile) {
|
if (ktxFile) {
|
||||||
|
@ -933,7 +933,7 @@ void ImageReader::read() {
|
||||||
// If we already have a live texture with the same hash, use it
|
// If we already have a live texture with the same hash, use it
|
||||||
auto texture = textureCache->getTextureByHash(hash);
|
auto texture = textureCache->getTextureByHash(hash);
|
||||||
|
|
||||||
#if ENABLE_KTX_CACHE
|
#if !defined(DISABLE_KTX_CACHE)
|
||||||
// If there is no live texture, check if there's an existing KTX file
|
// If there is no live texture, check if there's an existing KTX file
|
||||||
if (!texture) {
|
if (!texture) {
|
||||||
auto ktxFile = textureCache->_ktxCache->getFile(hash);
|
auto ktxFile = textureCache->_ktxCache->getFile(hash);
|
||||||
|
@ -982,7 +982,7 @@ void ImageReader::read() {
|
||||||
|
|
||||||
// Save the image into a KTXFile
|
// Save the image into a KTXFile
|
||||||
if (texture && textureCache) {
|
if (texture && textureCache) {
|
||||||
#if ENABLE_KTX_CACHE
|
#if !defined(DISABLE_KTX_CACHE)
|
||||||
auto memKtx = gpu::Texture::serialize(*texture);
|
auto memKtx = gpu::Texture::serialize(*texture);
|
||||||
|
|
||||||
// Move the texture into a memory mapped file
|
// Move the texture into a memory mapped file
|
||||||
|
|
|
@ -27,8 +27,6 @@
|
||||||
|
|
||||||
#include "KTXCache.h"
|
#include "KTXCache.h"
|
||||||
|
|
||||||
#define ENABLE_KTX_CACHE 0
|
|
||||||
|
|
||||||
namespace gpu {
|
namespace gpu {
|
||||||
class Batch;
|
class Batch;
|
||||||
}
|
}
|
||||||
|
@ -196,7 +194,7 @@ private:
|
||||||
TextureCache();
|
TextureCache();
|
||||||
virtual ~TextureCache();
|
virtual ~TextureCache();
|
||||||
|
|
||||||
#if ENABLE_KTX_CACHE
|
#if !defined(DISABLE_KTX_CACHE)
|
||||||
static const std::string KTX_DIRNAME;
|
static const std::string KTX_DIRNAME;
|
||||||
static const std::string KTX_EXT;
|
static const std::string KTX_EXT;
|
||||||
|
|
||||||
|
|
|
@ -518,7 +518,7 @@ QOpenGLContext* OffscreenQmlSurface::getSharedContext() {
|
||||||
|
|
||||||
void OffscreenQmlSurface::cleanup() {
|
void OffscreenQmlSurface::cleanup() {
|
||||||
_isCleaned = true;
|
_isCleaned = true;
|
||||||
#if ENABLE_QML_RENDERING
|
#if !defined(DISABLE_QML)
|
||||||
_canvas->makeCurrent();
|
_canvas->makeCurrent();
|
||||||
|
|
||||||
_renderControl->invalidate();
|
_renderControl->invalidate();
|
||||||
|
@ -540,7 +540,7 @@ void OffscreenQmlSurface::cleanup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffscreenQmlSurface::render() {
|
void OffscreenQmlSurface::render() {
|
||||||
#if ENABLE_QML_RENDERING
|
#if !defined(DISABLE_QML)
|
||||||
if (nsightActive()) {
|
if (nsightActive()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -625,7 +625,7 @@ OffscreenQmlSurface::~OffscreenQmlSurface() {
|
||||||
|
|
||||||
cleanup();
|
cleanup();
|
||||||
auto engine = _qmlContext->engine();
|
auto engine = _qmlContext->engine();
|
||||||
#if ENABLE_QML_RENDERING
|
#if !defined(DISABLE_QML)
|
||||||
_canvas->deleteLater();
|
_canvas->deleteLater();
|
||||||
#endif
|
#endif
|
||||||
_rootItem->deleteLater();
|
_rootItem->deleteLater();
|
||||||
|
@ -652,7 +652,7 @@ void OffscreenQmlSurface::disconnectAudioOutputTimer() {
|
||||||
void OffscreenQmlSurface::create() {
|
void OffscreenQmlSurface::create() {
|
||||||
qCDebug(uiLogging) << "Building QML surface";
|
qCDebug(uiLogging) << "Building QML surface";
|
||||||
|
|
||||||
#if ENABLE_QML_RENDERING
|
#if !defined(DISABLE_QML)
|
||||||
_renderControl = new QMyQuickRenderControl();
|
_renderControl = new QMyQuickRenderControl();
|
||||||
connect(_renderControl, &QQuickRenderControl::renderRequested, this, [this] { _render = true; });
|
connect(_renderControl, &QQuickRenderControl::renderRequested, this, [this] { _render = true; });
|
||||||
connect(_renderControl, &QQuickRenderControl::sceneChanged, this, [this] { _render = _polish = true; });
|
connect(_renderControl, &QQuickRenderControl::sceneChanged, this, [this] { _render = _polish = true; });
|
||||||
|
@ -702,7 +702,7 @@ void OffscreenQmlSurface::create() {
|
||||||
// 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 ENABLE_QML_RENDERING
|
#if !defined(DISABLE_QML)
|
||||||
_renderControl->initialize(_canvas->getContext());
|
_renderControl->initialize(_canvas->getContext());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -804,7 +804,7 @@ void OffscreenQmlSurface::resize(const QSize& newSize_, bool forceResize) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_QML_RENDERING
|
#if !defined(DISABLE_QML)
|
||||||
qCDebug(uiLogging) << "Offscreen UI resizing to " << newSize.width() << "x" << newSize.height();
|
qCDebug(uiLogging) << "Offscreen UI resizing to " << newSize.width() << "x" << newSize.height();
|
||||||
gl::withSavedContext([&] {
|
gl::withSavedContext([&] {
|
||||||
_canvas->makeCurrent();
|
_canvas->makeCurrent();
|
||||||
|
@ -1024,7 +1024,7 @@ void OffscreenQmlSurface::updateQuick() {
|
||||||
|
|
||||||
if (_polish) {
|
if (_polish) {
|
||||||
PROFILE_RANGE(render_qml, "OffscreenQML polish")
|
PROFILE_RANGE(render_qml, "OffscreenQML polish")
|
||||||
#if ENABLE_QML_RENDERING
|
#if !defined(DISABLE_QML)
|
||||||
_renderControl->polishItems();
|
_renderControl->polishItems();
|
||||||
#endif
|
#endif
|
||||||
_polish = false;
|
_polish = false;
|
||||||
|
@ -1317,7 +1317,7 @@ bool OffscreenQmlSurface::isPaused() const {
|
||||||
|
|
||||||
void OffscreenQmlSurface::setProxyWindow(QWindow* window) {
|
void OffscreenQmlSurface::setProxyWindow(QWindow* window) {
|
||||||
_proxyWindow = window;
|
_proxyWindow = window;
|
||||||
#if ENABLE_QML_RENDERING
|
#if !defined(DISABLE_QML)
|
||||||
if (_renderControl) {
|
if (_renderControl) {
|
||||||
_renderControl->_renderWindow = window;
|
_renderControl->_renderWindow = window;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,6 @@ class QQuickWindow;
|
||||||
class QQuickItem;
|
class QQuickItem;
|
||||||
class QJSValue;
|
class QJSValue;
|
||||||
|
|
||||||
#define ENABLE_QML_RENDERING 0
|
|
||||||
|
|
||||||
// GPU resources are typically buffered for one copy being used by the renderer,
|
// GPU resources are typically buffered for one copy being used by the renderer,
|
||||||
// one copy in flight, and one copy being used by the receiver
|
// one copy in flight, and one copy being used by the receiver
|
||||||
#define GPU_RESOURCE_BUFFER_SIZE 3
|
#define GPU_RESOURCE_BUFFER_SIZE 3
|
||||||
|
@ -173,7 +171,7 @@ private:
|
||||||
QQmlContext* _qmlContext { nullptr };
|
QQmlContext* _qmlContext { nullptr };
|
||||||
QQuickItem* _rootItem { nullptr };
|
QQuickItem* _rootItem { nullptr };
|
||||||
|
|
||||||
#if ENABLE_QML_RENDERING
|
#if !defined(DISABLE_QML)
|
||||||
QMyQuickRenderControl* _renderControl{ nullptr };
|
QMyQuickRenderControl* _renderControl{ nullptr };
|
||||||
OffscreenGLCanvas* _canvas { nullptr };
|
OffscreenGLCanvas* _canvas { nullptr };
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue