From b42170c7b651695f9d4fecf67a5707010c07b006 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Gro=C3=9F?= Date: Sun, 10 Oct 2021 15:01:35 +0200 Subject: [PATCH 01/40] Disable automatic texture memory on unsupported platforms. Fix automatic texture memory fallback. --- .../gpu-gl-common/src/gpu/gl/GLBackend.cpp | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp index dd30727523..b907021399 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp +++ b/libraries/gpu-gl-common/src/gpu/gl/GLBackend.cpp @@ -151,13 +151,21 @@ void GLBackend::init() { GPUIdent* gpu = GPUIdent::getInstance(vendor, renderer); unsigned int mem; +// Do not try to get texture memory information on unsupported systems. +#if defined(Q_OS_ANDROID) || defined(USE_GLES) || defined(Q_OS_DARWIN) + qCDebug(gpugllogging) << "Automatic texture memory not supported in this configuration"; + _videoCard = Unknown; + _dedicatedMemory = gpu->getMemory() * BYTES_PER_MIB; + _totalMemory = _dedicatedMemory; +#endif + +#if !defined(Q_OS_ANDROID) && !defined(USE_GLES) && !defined(Q_OS_DARWIN) if (vendor.contains("NVIDIA") ) { qCDebug(gpugllogging) << "NVIDIA card detected"; -#if !defined(Q_OS_ANDROID) && !defined(USE_GLES) + GL_GET_INTEGER(GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX); GL_GET_INTEGER(GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX); GL_GET_INTEGER(GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX); -#endif qCDebug(gpugllogging) << "GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX: " << GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX; qCDebug(gpugllogging) << "GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX: " << GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX; @@ -170,10 +178,10 @@ void GLBackend::init() { } else if (vendor.contains("ATI")) { qCDebug(gpugllogging) << "ATI card detected"; -#if !defined(Q_OS_ANDROID) && !defined(USE_GLES) - GL_GET_INTEGER(TEXTURE_FREE_MEMORY_ATI); -#endif + GL_GET_INTEGER(TEXTURE_FREE_MEMORY_ATI); + + // We are actually getting free memory instead of total memory _totalMemory = TEXTURE_FREE_MEMORY_ATI * BYTES_PER_KIB; _dedicatedMemory = _totalMemory; _videoCard = ATI; @@ -187,9 +195,10 @@ void GLBackend::init() { } else { qCCritical(gpugllogging) << "Don't know how to get memory for OpenGL vendor " << vendor << "; renderer " << renderer << ", trying fallback"; _videoCard = Unknown; - _dedicatedMemory = gpu->getMemory(); + _dedicatedMemory = gpu->getMemory() * BYTES_PER_MIB; _totalMemory = _dedicatedMemory; } +#endif qCDebug(gpugllogging) << "dedicated: " << _dedicatedMemory; qCDebug(gpugllogging) << "total: " << _totalMemory; From e5609e10c2cadd89a9f127dc3731ea63cd111c1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Gro=C3=9F?= Date: Tue, 12 Oct 2021 00:20:43 +0200 Subject: [PATCH 02/40] Do not search for crashpad inside Interface binary. --- interface/src/CrashHandler_Crashpad.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interface/src/CrashHandler_Crashpad.cpp b/interface/src/CrashHandler_Crashpad.cpp index 8c8ceed4b3..50f384b0d6 100644 --- a/interface/src/CrashHandler_Crashpad.cpp +++ b/interface/src/CrashHandler_Crashpad.cpp @@ -386,6 +386,8 @@ bool startCrashHandler(std::string appPath) { } else { qCDebug(crash_handler) << "Locating own directory by argv[0]"; interfaceDir.setPath(QString::fromStdString(appPath)); + // argv[0] gets us the path including the binary file + interfaceDir.cdUp(); } if (!interfaceDir.exists(CRASHPAD_HANDLER_NAME)) { From dead52c41ec41f4f32d005460d901b57f7007de5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Oct 2021 22:42:07 +0000 Subject: [PATCH 03/40] Bump electron from 9.4.0 to 11.5.0 in /screenshare Bumps [electron](https://github.com/electron/electron) from 9.4.0 to 11.5.0. - [Release notes](https://github.com/electron/electron/releases) - [Changelog](https://github.com/electron/electron/blob/main/docs/breaking-changes.md) - [Commits](https://github.com/electron/electron/compare/v9.4.0...v11.5.0) --- updated-dependencies: - dependency-name: electron dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- screenshare/package-lock.json | 24 ++++++++++++------------ screenshare/package.json | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/screenshare/package-lock.json b/screenshare/package-lock.json index 16a9828357..dda7c85d8f 100644 --- a/screenshare/package-lock.json +++ b/screenshare/package-lock.json @@ -71,9 +71,9 @@ } }, "@types/node": { - "version": "12.19.15", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.15.tgz", - "integrity": "sha512-lowukE3GUI+VSYSu6VcBXl14d61Rp5hA1D+61r16qnwC0lYNSqdxcvRh0pswejorHfS+HgwBasM8jLXz0/aOsw==", + "version": "12.20.29", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.29.tgz", + "integrity": "sha512-dU2ypz+gO5va1OBvs0iT3BNHG5SgTqRvq8r+kU3e/LAseKapUJ8zTUE9Ve9fTpi27tN/7ahOAhCJwQWsffvsyw==", "dev": true }, "ansi-styles": { @@ -162,9 +162,9 @@ "dev": true }, "buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, "cacheable-request": { @@ -298,9 +298,9 @@ } }, "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", "dev": true }, "cross-zip": { @@ -365,9 +365,9 @@ "dev": true }, "electron": { - "version": "9.4.0", - "resolved": "https://registry.npmjs.org/electron/-/electron-9.4.0.tgz", - "integrity": "sha512-hOC4q0jkb+UDYZRy8vrZ1IANnq+jznZnbkD62OEo06nU+hIbp2IrwDRBNuSLmQ3cwZMVir0WSIA1qEVK0PkzGA==", + "version": "11.5.0", + "resolved": "https://registry.npmjs.org/electron/-/electron-11.5.0.tgz", + "integrity": "sha512-WjNDd6lGpxyiNjE3LhnFCAk/D9GIj1rU3GSDealVShhkkkPR3Vh4q8ErXGDl1OAO/faomVa10KoFPUN/pLbNxg==", "dev": true, "requires": { "@electron/get": "^1.0.1", diff --git a/screenshare/package.json b/screenshare/package.json index 07d461f252..c85b3fa6e1 100644 --- a/screenshare/package.json +++ b/screenshare/package.json @@ -18,7 +18,7 @@ }, "homepage": "https://github.com/highfidelity/hifi#readme", "devDependencies": { - "electron": "^9.4.0", + "electron": "^11.5.0", "electron-packager": "^14.0.6" }, "dependencies": { From b7b152ff4db668a3d03fd1d0599adb1545ce8834 Mon Sep 17 00:00:00 2001 From: Kalila <69767640+digisomni@users.noreply.github.com> Date: Fri, 15 Oct 2021 03:42:29 -0400 Subject: [PATCH 04/40] Update README.md --- README.md | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c1cd8323e9..8e8fe9314b 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,17 @@

Vircadia - Codename Athena

Website | Discord | Download

-

GitHub contributors GitHub stars GitHub forks Apache 2.0 Discord

+

+ GitHub contributors + GitHub sponsors + GitHub stars + GitHub forks + Apache 2.0 + Discord +

Build Status

-

Master CI Build

+

+ Master CI Build +

### What is this? @@ -50,7 +59,7 @@ Vircadia™ is a 3D social software project seeking to incrementally bring about ### Boot to Metaverse: [The Goal](https://vircadia.com/vision/) -Having a place to experience adventure, a place to relax with calm breath, that's a world to live in. An engine to support infinite combinations and possibilities of worlds without censorship and interruption, that's a metaverse. Finding a way to make infinite realities our reality is the dream. +Having a place to experience adventure, a place to relax with calm breath, that's a world to live in. An engine to support infinite combinations and possibilities of worlds without censorship and interruption, that's metaverse. Finding a way to make infinite realities our reality is the dream. ### Boot to Metaverse: The Technicals @@ -71,7 +80,7 @@ Vircadia consists of many projects and codebases with its unifying structure's g ### Contribution -There are many contributors to Vircadia. Code writers, reviewers, testers, documentation writers, modelers, and general supporters of the project are all integral to its development and success towards its goals. Find out how you can [contribute](CONTRIBUTING.md)! +There are many contributors to Vircadia. Code writers, reviewers, testers, documentation writers, modelers, and general supporters of the project are all integral to its development and success towards its goals. Find out how you can [contribute](https://vircadia.com/contribute)! ### Support @@ -85,4 +94,4 @@ Keep in mind that Vircadia consists of multiple smaller projects that might have | [Karol Suprynowicz - 74hc595](https://github.com/ksuprynowicz) | | --- | -|

[ksuprynowicz](https://github.com/ksuprynowicz)

\ No newline at end of file +|

[ksuprynowicz](https://github.com/ksuprynowicz)

From e322d9e506b6c451a91e14155ad221b3fa2ab459 Mon Sep 17 00:00:00 2001 From: Kalila <69767640+digisomni@users.noreply.github.com> Date: Fri, 15 Oct 2021 04:01:16 -0400 Subject: [PATCH 05/40] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8e8fe9314b..a062190092 100644 --- a/README.md +++ b/README.md @@ -73,8 +73,10 @@ Vircadia consists of many projects and codebases with its unifying structure's g - [The Metaverse Server Dashboard (Codename Iamus)](https://github.com/vircadia/project-iamus-dashboard/) - [The Launcher (Codename Pantheon)](https://github.com/vircadia/pantheon-launcher/) - Currently Windows only. -#### Child Projects +#### Tools - [Vircadia Builder for Linux](https://github.com/vircadia/vircadia-builder/) + +#### Documentation - [User Documentation](https://github.com/vircadia/vircadia-docs-sphinx/) - [Developer Documentation](https://github.com/vircadia/vircadia-dev-docs/) @@ -92,6 +94,6 @@ Keep in mind that Vircadia consists of multiple smaller projects that might have #### Supporters of the Vircadia Project -| [Karol Suprynowicz - 74hc595](https://github.com/ksuprynowicz) | +| [ksuprynowicz (74hc595)](https://github.com/ksuprynowicz) | | --- | |

[ksuprynowicz](https://github.com/ksuprynowicz)

From b684d83272ce1f47e968d266faa99c393853b828 Mon Sep 17 00:00:00 2001 From: Kalila <69767640+digisomni@users.noreply.github.com> Date: Tue, 19 Oct 2021 04:39:38 -0400 Subject: [PATCH 06/40] Update BUILD_OSX.md Revise MacOS build guide to be more clear. --- BUILD_OSX.md | 57 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 23 deletions(-) diff --git a/BUILD_OSX.md b/BUILD_OSX.md index d9c7f0ee0f..c704503ece 100644 --- a/BUILD_OSX.md +++ b/BUILD_OSX.md @@ -1,63 +1,74 @@ -# Build OSX +# Build MacOS -*Last Updated on January 16, 2021* +*Last Updated on October 19, 2021* -Please read the [general build guide](BUILD.md) for information on dependencies required for all platforms. Only macOS specific instructions are found in this document. +Please read the [general build guide](BUILD.md) for information on dependencies required for all platforms. This will include the necessary environment variables to customize your build. Only macOS specific instructions are found in this document. -## Homebrew +## Prerequisites -[Homebrew](https://brew.sh/) is an excellent package manager for macOS. It makes install of some Vircadia dependencies very simple. +### CMake, OpenSSL, and NPM + +[Homebrew](https://brew.sh/) is an excellent package manager for macOS. It makes the installation of some Vircadia dependencies very simple. ```bash brew install cmake openssl npm ``` -Note: cmake versions > 3.18.x have known problems building Vircadia, so alternatively you can download cmake 3.18.4 (or earlier versions) from [Github](https://github.com/Kitware/CMake/releases). +**Note:** CMake versions > 3.18.x have known problems building Vircadia, so alternatively you can download cmake 3.18.4 (or earlier versions) from [Github](https://github.com/Kitware/CMake/releases). -## Python 3 +### Python 3 Download an install Python 3.6.6 or higher from [here](https://www.python.org/downloads/). Execute the `Update Shell Profile.command` script that is provided with the installer. -## OSX SDK +### MacOS SDK -You will need version `10.12` of the OSX SDK for building, otherwise you may have crashing or other unintended issues due to the deprecation of OpenGL on OSX. You can get that SDK from [here](https://github.com/phracker/MacOSX-SDKs). You must copy it in to your Xcode SDK directory, e.g. +You will need version `10.12` of the macOS SDK for building, otherwise you may have crashing or other unintended issues due to the deprecation of OpenGL on macOS. You can get that SDK from [here](https://github.com/phracker/MacOSX-SDKs). You must copy it in to your Xcode SDK directory, e.g. ```bash cp -rp ~/Downloads/MacOSX10.12.sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ ``` -## OpenSSL +### OpenSSL -Assuming you've installed OpenSSL using the homebrew instructions above, you'll need to set OPENSSL_ROOT_DIR so CMake can find your installations. -For OpenSSL installed via homebrew, set OPENSSL_ROOT_DIR via - `export OPENSSL_ROOT_DIR=/usr/local/opt/openssl` - or by appending `-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl` to `cmake` +Assuming you've installed OpenSSL using the homebrew instructions above, you'll need to set `OPENSSL_ROOT_DIR` so CMake can find your installations. +For OpenSSL installed via homebrew, set `OPENSSL_ROOT_DIR` via `export OPENSSL_ROOT_DIR=/usr/local/opt/openssl` or by appending `-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl` to `cmake`. -## Xcode +## Generate and Build + +You can choose to use either Unix Makefiles or Xcode. + +### Xcode You can ask CMake to generate Xcode project files instead of Unix Makefiles using the `-G Xcode` parameter after CMake. You will need to select the Xcode installation in the terminal first if you have not done so already. ```bash sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer -cmake ../ -DCMAKE_OSX_SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOSX_SDK=10.12 .. +cmake ../ -DCMAKE_OSX_SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -G Xcode -DOSX_SDK=10.12 .. ``` -If `cmake` complains about Python 3 being missing, you may need to update your CMake binary with command `brew upgrade cmake`, or by downloading and running the latest CMake installer, depending on how you originally installed CMake. - -After running CMake, you will have the make files or Xcode project file necessary to build all of the components. Open the hifi.xcodeproj file, choose ALL_BUILD from the Product > Scheme menu (or target drop down), and click Run. +After running CMake, you will have the make files or Xcode project file necessary to build all of the components. Open the `vircadia.xcodeproj` file, choose `ALL_BUILD` from the Product > Scheme menu (or target drop down), and click Run. If the build completes successfully, you will have built targets for all components located in the `build/${target_name}/Debug` directories. -## make +### make -If you build with make rather than Xcode, you can append `-j4` for assigning more threads. The number indicates the number of threads, e.g. 4. +Run CMake. + +```bash +cmake -DCMAKE_OSX_SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOSX_SDK=10.12 .. +``` + +You can append `-j4` to assign more threads to build with. The number indicates the number of threads, e.g. 4. To package the installation, you can simply run `make package` afterwards. ## FAQ -1. **Problem:** Running the scheme `interface.app` from Xcode causes a crash for Interface related to `libgl` +1. **Problem:** Running the scheme `interface.app` from Xcode causes a crash for Interface related to `libgl`. 1. **Cause:** The target `gl` generates a binary called `libgl`. A macOS `libGL.framework` item gets loaded instead by Xcode. - 1. **Solution:** In the Xcode target settings for `libgl`, set the version to 1.0.0 + 2. **Solution:** In the Xcode target settings for `libgl`, set the version to `1.0.0`. +2. **Problem:** CMake complains about Python 3 being missing. + 1. **Cause:** CMake might be out of date. + 2. **Solution:** Try updating your CMake binary with command `brew upgrade cmake`, or by downloading and running a newer CMake installer, depending on how you originally installed CMake. Please keep in mind the recommended CMake versions noted above. From ad36978ec1bf9c9bb4f68fe19ac615228b823f2e Mon Sep 17 00:00:00 2001 From: Kalila <69767640+digisomni@users.noreply.github.com> Date: Sat, 23 Oct 2021 14:41:22 -0400 Subject: [PATCH 07/40] Remove CMake note about incompatibility on macOS. --- BUILD_OSX.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD_OSX.md b/BUILD_OSX.md index c704503ece..ee14b3b24e 100644 --- a/BUILD_OSX.md +++ b/BUILD_OSX.md @@ -14,7 +14,7 @@ Please read the [general build guide](BUILD.md) for information on dependencies brew install cmake openssl npm ``` -**Note:** CMake versions > 3.18.x have known problems building Vircadia, so alternatively you can download cmake 3.18.4 (or earlier versions) from [Github](https://github.com/Kitware/CMake/releases). +**Note:** You can also download alternative CMake versions from [Github](https://github.com/Kitware/CMake/releases) if needed. ### Python 3 From e474cb7f671d796179fa73378598959ad01bdc49 Mon Sep 17 00:00:00 2001 From: ksuprynowicz Date: Sun, 24 Oct 2021 15:47:17 +0200 Subject: [PATCH 08/40] Added CMake variables for optimization and architecture-specific options --- CMakeLists.txt | 58 ++++++++++++++++++++++++++++++ cmake/compiler.cmake | 2 ++ cmake/ports/bullet3/portfile.cmake | 26 +++++++++++++- cmake/ports/opus/portfile.cmake | 28 ++++++++++++++- 4 files changed, 112 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8abcce4489..820ba2aa32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,6 +74,64 @@ if ((NOT "${RELEASE_TYPE}" STREQUAL "PRODUCTION") AND (NOT "${RELEASE_TYPE}" STR set(RELEASE_TYPE "DEV") endif() +# VIRCADIA_OPTIMIZE +# Variable determining vircadia optimization. If not set, it defaults to true. +# It's used to determine build flags for main codebase and for VCPKG dependencies. +# Should be set to false to get completely unoptimized build for easier line-by-line debugging + +if(NOT DEFINED VIRCADIA_OPTIMIZE) + message("Enabling code optimization for Vircadia and compiled dependencies") + set(VIRCADIA_OPTIMIZE true CACHE BOOL "Enable code optimization for Vircadia and compiled dependencies") +endif() + +#compiler needs to be detected before building VCPKG dependencies +set(CMAKE_PLATFORM_INFO_DIR "${CMAKE_CURRENT_BINARY_DIR}") +include(CMakeDetermineCXXCompiler) + +set(VIRCADIA_OPTIMIZE_FLAGS "") + +if(VIRCADIA_OPTIMIZE) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/_env/VIRCADIA_OPTIMIZE.txt" "${VIRCADIA_OPTIMIZE}") + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + message("Clang compiler detected, adding -O3 -fPIC flags") + set(VIRCADIA_OPTIMIZE_FLAGS "-O3 -fPIC") + elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU") + message("GCC compiler detected, adding -O3 -fPIC flags") + set(VIRCADIA_OPTIMIZE_FLAGS "-O3 -fPIC") + elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + message("MSVC compiler detected, adding /O2 flag") + set(VIRCADIA_OPTIMIZE_FLAGS "/O2") + endif() +endif() +MESSAGE(STATUS "VIRCADIA_OPTIMIZE: ${VIRCADIA_OPTIMIZE}") + +# VIRCADIA_CPU_ARCHITECTURE +# Variable determining CPU architecture for which Vircadia will be built. +# If defined, it's appended to CXXFLAGS and CFLAGS for both Vircadia and VCPKG dependencies + +#Assume -march=native for compilers that allow it if architecture is not specified +if(NOT DEFINED VIRCADIA_CPU_ARCHITECTURE) + if(VIRCADIA_OPTIMIZE AND ( (CMAKE_CXX_COMPILER_ID MATCHES "Clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "GNU") ) ) + message("Optimization is enabled, but architecture is not specified. Assuming native build") + set(VIRCADIA_CPU_ARCHITECTURE "-march=native -mtune=native" CACHE STRING "Specify architecture dependent compiler flags here") + endif() +endif() + +if(DEFINED VIRCADIA_CPU_ARCHITECTURE) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/_env/VIRCADIA_CPU_ARCHITECTURE.txt" "${VIRCADIA_CPU_ARCHITECTURE}") + set(VIRCADIA_OPTIMIZE_FLAGS "${VIRCADIA_OPTIMIZE_FLAGS} ${VIRCADIA_CPU_ARCHITECTURE}") + message("Adding CPU architecture flags: ${VIRCADIA_CPU_ARCHITECTURE}") + MESSAGE(STATUS "VIRCADIA_CPU_ARCHITECTURE: ${VIRCADIA_CPU_ARCHITECTURE}") +endif() + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VIRCADIA_OPTIMIZE_FLAGS}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VIRCADIA_OPTIMIZE_FLAGS}") + +set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} ${VIRCADIA_OPTIMIZE_FLAGS}") +set(ENV{CFLAGS} "$ENV{CFLAGS} ${VIRCADIA_OPTIMIZE_FLAGS}") + +message($ENV{CXXFLAGS}) + if (HIFI_ANDROID) execute_process( COMMAND ${HIFI_PYTHON_EXEC} ${CMAKE_CURRENT_SOURCE_DIR}/prebuild.py --release-type ${RELEASE_TYPE} --android ${HIFI_ANDROID_APP} --build-root ${CMAKE_BINARY_DIR} diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index 45cef27727..5108253403 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -110,3 +110,5 @@ if (APPLE) set(CMAKE_OSX_SYSROOT ${_OSX_DESIRED_SDK_PATH}/MacOSX${OSX_SDK}.sdk) endif () endif () + +message("CXXFLAGS: ${CXXFLAGS}") diff --git a/cmake/ports/bullet3/portfile.cmake b/cmake/ports/bullet3/portfile.cmake index cda39ed349..8fc34179b6 100644 --- a/cmake/ports/bullet3/portfile.cmake +++ b/cmake/ports/bullet3/portfile.cmake @@ -15,6 +15,14 @@ include(vcpkg_common_functions) +if(EXISTS "${VCPKG_ROOT_DIR}/_env/VIRCADIA_OPTIMIZE.txt") + file(READ "${VCPKG_ROOT_DIR}/_env/VIRCADIA_OPTIMIZE.txt" VIRCADIA_OPTIMIZE) +endif() +if(EXISTS "${VCPKG_ROOT_DIR}/_env/VIRCADIA_CPU_ARCHITECTURE.txt") + file(READ "${VCPKG_ROOT_DIR}/_env/VIRCADIA_CPU_ARCHITECTURE.txt" VIRCADIA_CPU_ARCHITECTURE) +endif() + + if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) message(WARNING "Dynamic not supported, building static") set(VCPKG_LIBRARY_LINKAGE static) @@ -30,6 +38,21 @@ vcpkg_from_github( PATCHES "bullet-git-fix-build-clang-8.patch" ) + +if(VIRCADIA_OPTIMIZE) + set(VIRCADIA_BULLET_OPTIONS "-DCMAKE_BUILD_TYPE=Release") +else() + set(VIRCADIA_BULLET_OPTIONS "-DCMAKE_BUILD_TYPE=RelWithDebInfo") +endif() + +set(VIRCADIA_BULLET_OPTIONS "${VIRCADIA_BULLET_OPTIONS}") + +if(DEFINED VIRCADIA_CPU_ARCHITECTURE) + set(VIRCADIA_BULLET_OPTIONS "${VIRCADIA_BULLET_OPTIONS} -DCMAKE_CXX_FLAGS=\"${VIRCADIA_CPU_ARCHITECTURE}\" -DCMAKE_C_FLAGS=\"${VIRCADIA_CPU_ARCHITECTURE}\" ") +endif() + +message("Optimization options for Bullet: ${VIRCADIA_BULLET_OPTIONS}") + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} OPTIONS @@ -46,6 +69,7 @@ vcpkg_configure_cmake( -DBUILD_UNIT_TESTS=OFF -DBUILD_SHARED_LIBS=ON -DINSTALL_LIBS=ON + ${VIRCADIA_BULLET_OPTIONS} ) vcpkg_install_cmake() @@ -58,4 +82,4 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/bullet/BulletInverseDynamics vcpkg_copy_pdbs() # Handle copyright -file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/bullet3 RENAME copyright) \ No newline at end of file +file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/bullet3 RENAME copyright) diff --git a/cmake/ports/opus/portfile.cmake b/cmake/ports/opus/portfile.cmake index e5518351f8..238f481690 100644 --- a/cmake/ports/opus/portfile.cmake +++ b/cmake/ports/opus/portfile.cmake @@ -1,5 +1,12 @@ include(vcpkg_common_functions) +if(EXISTS "${VCPKG_ROOT_DIR}/_env/VIRCADIA_OPTIMIZE.txt") + file(READ "${VCPKG_ROOT_DIR}/_env/VIRCADIA_OPTIMIZE.txt" VIRCADIA_OPTIMIZE) +endif() +if(EXISTS "${VCPKG_ROOT_DIR}/_env/VIRCADIA_CPU_ARCHITECTURE.txt") + file(READ "${VCPKG_ROOT_DIR}/_env/VIRCADIA_CPU_ARCHITECTURE.txt" VIRCADIA_CPU_ARCHITECTURE) +endif() + vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH @@ -12,7 +19,26 @@ vcpkg_from_github( HEAD_REF master) -vcpkg_configure_cmake(SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA) +if(VIRCADIA_OPTIMIZE) + set(VIRCADIA_OPUS_OPTIONS "-DCMAKE_BUILD_TYPE=Release") +else() + set(VIRCADIA_OPUS_OPTIONS "-DCMAKE_BUILD_TYPE=RelWithDebInfo") +endif() + +set(VIRCADIA_OPUS_OPTIONS "${VIRCADIA_OPUS_OPTIONS}") + +if(DEFINED VIRCADIA_CPU_ARCHITECTURE) + set(VIRCADIA_OPUS_OPTIONS "${VIRCADIA_OPUS_OPTIONS} -DCMAKE_CXX_FLAGS=\"${VIRCADIA_CPU_ARCHITECTURE}\" -DCMAKE_C_FLAGS=\"${VIRCADIA_CPU_ARCHITECTURE}\" ") +endif() + +message("Optimization options for Opus: ${VIRCADIA_OPUS_OPTIONS}") + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS ${VIRCADIA_OPUS_OPTIONS} +) + vcpkg_install_cmake() vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/Opus) vcpkg_copy_pdbs() From fc3177a23cab74880b497f6cfd134af670bfaa44 Mon Sep 17 00:00:00 2001 From: ksuprynowicz Date: Sun, 24 Oct 2021 18:06:45 +0200 Subject: [PATCH 09/40] Disabled optimization settings on Windows because they were breaking the build --- CMakeLists.txt | 78 +++++++++++++++--------------- cmake/ports/bullet3/portfile.cmake | 34 +++++++------ cmake/ports/opus/portfile.cmake | 32 ++++++------ 3 files changed, 77 insertions(+), 67 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 820ba2aa32..681b391110 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,52 +84,54 @@ if(NOT DEFINED VIRCADIA_OPTIMIZE) set(VIRCADIA_OPTIMIZE true CACHE BOOL "Enable code optimization for Vircadia and compiled dependencies") endif() -#compiler needs to be detected before building VCPKG dependencies -set(CMAKE_PLATFORM_INFO_DIR "${CMAKE_CURRENT_BINARY_DIR}") -include(CMakeDetermineCXXCompiler) +if( NOT WIN32 ) + #compiler needs to be detected before building VCPKG dependencies + set(CMAKE_PLATFORM_INFO_DIR "${CMAKE_CURRENT_BINARY_DIR}") + include(CMakeDetermineCXXCompiler) -set(VIRCADIA_OPTIMIZE_FLAGS "") + set(VIRCADIA_OPTIMIZE_FLAGS "") -if(VIRCADIA_OPTIMIZE) - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/_env/VIRCADIA_OPTIMIZE.txt" "${VIRCADIA_OPTIMIZE}") - if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - message("Clang compiler detected, adding -O3 -fPIC flags") - set(VIRCADIA_OPTIMIZE_FLAGS "-O3 -fPIC") - elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU") - message("GCC compiler detected, adding -O3 -fPIC flags") - set(VIRCADIA_OPTIMIZE_FLAGS "-O3 -fPIC") - elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - message("MSVC compiler detected, adding /O2 flag") - set(VIRCADIA_OPTIMIZE_FLAGS "/O2") + set(VIRCADIA_OPTIMIZE_FLAGS "-O3 -fPIC") + if(VIRCADIA_OPTIMIZE) + + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/_env/VIRCADIA_OPTIMIZE.txt" "${VIRCADIA_OPTIMIZE}") + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + message("Clang compiler detected, adding -O3 -fPIC flags") + elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU") + message("GCC compiler detected, adding -O3 -fPIC flags") + set(VIRCADIA_OPTIMIZE_FLAGS "-O3 -fPIC") + else() + message("No predefined optimization flags for compiler ${CMAKE_CXX_COMPILER_ID}") + endif() endif() -endif() -MESSAGE(STATUS "VIRCADIA_OPTIMIZE: ${VIRCADIA_OPTIMIZE}") + MESSAGE(STATUS "VIRCADIA_OPTIMIZE: ${VIRCADIA_OPTIMIZE}") -# VIRCADIA_CPU_ARCHITECTURE -# Variable determining CPU architecture for which Vircadia will be built. -# If defined, it's appended to CXXFLAGS and CFLAGS for both Vircadia and VCPKG dependencies + # VIRCADIA_CPU_ARCHITECTURE + # Variable determining CPU architecture for which Vircadia will be built. + # If defined, it's appended to CXXFLAGS and CFLAGS for both Vircadia and VCPKG dependencies -#Assume -march=native for compilers that allow it if architecture is not specified -if(NOT DEFINED VIRCADIA_CPU_ARCHITECTURE) - if(VIRCADIA_OPTIMIZE AND ( (CMAKE_CXX_COMPILER_ID MATCHES "Clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "GNU") ) ) - message("Optimization is enabled, but architecture is not specified. Assuming native build") - set(VIRCADIA_CPU_ARCHITECTURE "-march=native -mtune=native" CACHE STRING "Specify architecture dependent compiler flags here") + #Assume -march=native for compilers that allow it if architecture is not specified + if(NOT DEFINED VIRCADIA_CPU_ARCHITECTURE) + if(VIRCADIA_OPTIMIZE AND ( (CMAKE_CXX_COMPILER_ID MATCHES "Clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "GNU") ) ) + message("Optimization is enabled, but architecture is not specified. Assuming native build") + set(VIRCADIA_CPU_ARCHITECTURE "-march=native -mtune=native" CACHE STRING "Specify architecture dependent compiler flags here") + endif() endif() + + if(DEFINED VIRCADIA_CPU_ARCHITECTURE) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/_env/VIRCADIA_CPU_ARCHITECTURE.txt" "${VIRCADIA_CPU_ARCHITECTURE}") + set(VIRCADIA_OPTIMIZE_FLAGS "${VIRCADIA_OPTIMIZE_FLAGS} ${VIRCADIA_CPU_ARCHITECTURE}") + message("Adding CPU architecture flags: ${VIRCADIA_CPU_ARCHITECTURE}") + MESSAGE(STATUS "VIRCADIA_CPU_ARCHITECTURE: ${VIRCADIA_CPU_ARCHITECTURE}") + endif() + + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VIRCADIA_OPTIMIZE_FLAGS}") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VIRCADIA_OPTIMIZE_FLAGS}") + + set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} ${VIRCADIA_OPTIMIZE_FLAGS}") + set(ENV{CFLAGS} "$ENV{CFLAGS} ${VIRCADIA_OPTIMIZE_FLAGS}") endif() -if(DEFINED VIRCADIA_CPU_ARCHITECTURE) - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/_env/VIRCADIA_CPU_ARCHITECTURE.txt" "${VIRCADIA_CPU_ARCHITECTURE}") - set(VIRCADIA_OPTIMIZE_FLAGS "${VIRCADIA_OPTIMIZE_FLAGS} ${VIRCADIA_CPU_ARCHITECTURE}") - message("Adding CPU architecture flags: ${VIRCADIA_CPU_ARCHITECTURE}") - MESSAGE(STATUS "VIRCADIA_CPU_ARCHITECTURE: ${VIRCADIA_CPU_ARCHITECTURE}") -endif() - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VIRCADIA_OPTIMIZE_FLAGS}") -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VIRCADIA_OPTIMIZE_FLAGS}") - -set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} ${VIRCADIA_OPTIMIZE_FLAGS}") -set(ENV{CFLAGS} "$ENV{CFLAGS} ${VIRCADIA_OPTIMIZE_FLAGS}") - message($ENV{CXXFLAGS}) if (HIFI_ANDROID) diff --git a/cmake/ports/bullet3/portfile.cmake b/cmake/ports/bullet3/portfile.cmake index 8fc34179b6..ab27c8494d 100644 --- a/cmake/ports/bullet3/portfile.cmake +++ b/cmake/ports/bullet3/portfile.cmake @@ -15,13 +15,6 @@ include(vcpkg_common_functions) -if(EXISTS "${VCPKG_ROOT_DIR}/_env/VIRCADIA_OPTIMIZE.txt") - file(READ "${VCPKG_ROOT_DIR}/_env/VIRCADIA_OPTIMIZE.txt" VIRCADIA_OPTIMIZE) -endif() -if(EXISTS "${VCPKG_ROOT_DIR}/_env/VIRCADIA_CPU_ARCHITECTURE.txt") - file(READ "${VCPKG_ROOT_DIR}/_env/VIRCADIA_CPU_ARCHITECTURE.txt" VIRCADIA_CPU_ARCHITECTURE) -endif() - if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) message(WARNING "Dynamic not supported, building static") @@ -38,17 +31,28 @@ vcpkg_from_github( PATCHES "bullet-git-fix-build-clang-8.patch" ) - -if(VIRCADIA_OPTIMIZE) - set(VIRCADIA_BULLET_OPTIONS "-DCMAKE_BUILD_TYPE=Release") +if(WIN32) + set(VIRCADIA_BULLET_OPTIONS "") else() - set(VIRCADIA_BULLET_OPTIONS "-DCMAKE_BUILD_TYPE=RelWithDebInfo") -endif() + if(EXISTS "${VCPKG_ROOT_DIR}/_env/VIRCADIA_OPTIMIZE.txt") + file(READ "${VCPKG_ROOT_DIR}/_env/VIRCADIA_OPTIMIZE.txt" VIRCADIA_OPTIMIZE) + endif() + if(EXISTS "${VCPKG_ROOT_DIR}/_env/VIRCADIA_CPU_ARCHITECTURE.txt") + file(READ "${VCPKG_ROOT_DIR}/_env/VIRCADIA_CPU_ARCHITECTURE.txt" VIRCADIA_CPU_ARCHITECTURE) + endif() -set(VIRCADIA_BULLET_OPTIONS "${VIRCADIA_BULLET_OPTIONS}") -if(DEFINED VIRCADIA_CPU_ARCHITECTURE) - set(VIRCADIA_BULLET_OPTIONS "${VIRCADIA_BULLET_OPTIONS} -DCMAKE_CXX_FLAGS=\"${VIRCADIA_CPU_ARCHITECTURE}\" -DCMAKE_C_FLAGS=\"${VIRCADIA_CPU_ARCHITECTURE}\" ") + if(VIRCADIA_OPTIMIZE) + set(VIRCADIA_BULLET_OPTIONS "-DCMAKE_BUILD_TYPE=Release") + else() + set(VIRCADIA_BULLET_OPTIONS "-DCMAKE_BUILD_TYPE=RelWithDebInfo") + endif() + + set(VIRCADIA_BULLET_OPTIONS "${VIRCADIA_BULLET_OPTIONS}") + + if(DEFINED VIRCADIA_CPU_ARCHITECTURE) + set(VIRCADIA_BULLET_OPTIONS "${VIRCADIA_BULLET_OPTIONS} -DCMAKE_CXX_FLAGS=\"${VIRCADIA_CPU_ARCHITECTURE}\" -DCMAKE_C_FLAGS=\"${VIRCADIA_CPU_ARCHITECTURE}\" ") + endif() endif() message("Optimization options for Bullet: ${VIRCADIA_BULLET_OPTIONS}") diff --git a/cmake/ports/opus/portfile.cmake b/cmake/ports/opus/portfile.cmake index 238f481690..6406cf10c0 100644 --- a/cmake/ports/opus/portfile.cmake +++ b/cmake/ports/opus/portfile.cmake @@ -1,12 +1,5 @@ include(vcpkg_common_functions) -if(EXISTS "${VCPKG_ROOT_DIR}/_env/VIRCADIA_OPTIMIZE.txt") - file(READ "${VCPKG_ROOT_DIR}/_env/VIRCADIA_OPTIMIZE.txt" VIRCADIA_OPTIMIZE) -endif() -if(EXISTS "${VCPKG_ROOT_DIR}/_env/VIRCADIA_CPU_ARCHITECTURE.txt") - file(READ "${VCPKG_ROOT_DIR}/_env/VIRCADIA_CPU_ARCHITECTURE.txt" VIRCADIA_CPU_ARCHITECTURE) -endif() - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH @@ -19,16 +12,27 @@ vcpkg_from_github( HEAD_REF master) -if(VIRCADIA_OPTIMIZE) - set(VIRCADIA_OPUS_OPTIONS "-DCMAKE_BUILD_TYPE=Release") +if(WIN32) + set(VIRCADIA_BULLET_OPTIONS "") else() - set(VIRCADIA_OPUS_OPTIONS "-DCMAKE_BUILD_TYPE=RelWithDebInfo") -endif() + if(EXISTS "${VCPKG_ROOT_DIR}/_env/VIRCADIA_OPTIMIZE.txt") + file(READ "${VCPKG_ROOT_DIR}/_env/VIRCADIA_OPTIMIZE.txt" VIRCADIA_OPTIMIZE) + endif() + if(EXISTS "${VCPKG_ROOT_DIR}/_env/VIRCADIA_CPU_ARCHITECTURE.txt") + file(READ "${VCPKG_ROOT_DIR}/_env/VIRCADIA_CPU_ARCHITECTURE.txt" VIRCADIA_CPU_ARCHITECTURE) + endif() -set(VIRCADIA_OPUS_OPTIONS "${VIRCADIA_OPUS_OPTIONS}") + if(VIRCADIA_OPTIMIZE) + set(VIRCADIA_OPUS_OPTIONS "-DCMAKE_BUILD_TYPE=Release") + else() + set(VIRCADIA_OPUS_OPTIONS "-DCMAKE_BUILD_TYPE=RelWithDebInfo") + endif() -if(DEFINED VIRCADIA_CPU_ARCHITECTURE) - set(VIRCADIA_OPUS_OPTIONS "${VIRCADIA_OPUS_OPTIONS} -DCMAKE_CXX_FLAGS=\"${VIRCADIA_CPU_ARCHITECTURE}\" -DCMAKE_C_FLAGS=\"${VIRCADIA_CPU_ARCHITECTURE}\" ") + set(VIRCADIA_OPUS_OPTIONS "${VIRCADIA_OPUS_OPTIONS}") + + if(DEFINED VIRCADIA_CPU_ARCHITECTURE) + set(VIRCADIA_OPUS_OPTIONS "${VIRCADIA_OPUS_OPTIONS} -DCMAKE_CXX_FLAGS=\"${VIRCADIA_CPU_ARCHITECTURE}\" -DCMAKE_C_FLAGS=\"${VIRCADIA_CPU_ARCHITECTURE}\" ") + endif() endif() message("Optimization options for Opus: ${VIRCADIA_OPUS_OPTIONS}") From 79386b409ea54f9ff651c3d907a2bac2fadc9af9 Mon Sep 17 00:00:00 2001 From: ksuprynowicz Date: Sun, 24 Oct 2021 18:39:42 +0200 Subject: [PATCH 10/40] Fixed typo in Opus portfile.cmake --- cmake/ports/opus/portfile.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/ports/opus/portfile.cmake b/cmake/ports/opus/portfile.cmake index 6406cf10c0..988096ad62 100644 --- a/cmake/ports/opus/portfile.cmake +++ b/cmake/ports/opus/portfile.cmake @@ -13,7 +13,7 @@ vcpkg_from_github( master) if(WIN32) - set(VIRCADIA_BULLET_OPTIONS "") + set(VIRCADIA_OPUS_OPTIONS "") else() if(EXISTS "${VCPKG_ROOT_DIR}/_env/VIRCADIA_OPTIMIZE.txt") file(READ "${VCPKG_ROOT_DIR}/_env/VIRCADIA_OPTIMIZE.txt" VIRCADIA_OPTIMIZE) From ed725fd814792e3dcaab353b6ebcc0856883fd01 Mon Sep 17 00:00:00 2001 From: Penguin-Guru Date: Sun, 24 Oct 2021 10:40:58 -0700 Subject: [PATCH 11/40] Fixed typo. --- interface/src/PerformanceManager.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/interface/src/PerformanceManager.cpp b/interface/src/PerformanceManager.cpp index 47e4f0612b..1ff2319b1b 100644 --- a/interface/src/PerformanceManager.cpp +++ b/interface/src/PerformanceManager.cpp @@ -69,15 +69,15 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP bool isDeferredCapable = platform::Profiler::isRenderMethodDeferredCapable(); auto masterDisplay = platform::getDisplay(platform::getMasterDisplay()); - // eval recommanded PPI and Scale - float recommandedPpiScale = 1.0f; - const float RECOMMANDED_PPI[] = { 200.0f, 120.f, 160.f, 250.f}; + // eval recommended PPI and Scale + float recommendedPpiScale = 1.0f; + const float RECOMMENDED_PPI[] = { 200.0f, 120.f, 160.f, 250.f}; if (!masterDisplay.empty() && masterDisplay.count(platform::keys::display::ppi)) { float ppi = masterDisplay[platform::keys::display::ppi]; // only scale if the actual ppi is higher than the recommended ppi - if (ppi > RECOMMANDED_PPI[preset]) { + if (ppi > RECOMMENDED_PPI[preset]) { // make sure the scale is no less than a quarter - recommandedPpiScale = std::max(0.25f, RECOMMANDED_PPI[preset] / (float) ppi); + recommendedPpiScale = std::max(0.25f, RECOMMENDED_PPI[preset] / (float) ppi); } } @@ -87,7 +87,7 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP RenderScriptingInterface::RenderMethod::DEFERRED : RenderScriptingInterface::RenderMethod::FORWARD ) ); - RenderScriptingInterface::getInstance()->setViewportResolutionScale(recommandedPpiScale); + RenderScriptingInterface::getInstance()->setViewportResolutionScale(recommendedPpiScale); RenderScriptingInterface::getInstance()->setShadowsEnabled(true); qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::REALTIME); @@ -100,7 +100,7 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP RenderScriptingInterface::RenderMethod::DEFERRED : RenderScriptingInterface::RenderMethod::FORWARD)); - RenderScriptingInterface::getInstance()->setViewportResolutionScale(recommandedPpiScale); + RenderScriptingInterface::getInstance()->setViewportResolutionScale(recommendedPpiScale); RenderScriptingInterface::getInstance()->setShadowsEnabled(false); qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::INTERACTIVE); @@ -112,7 +112,7 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP RenderScriptingInterface::getInstance()->setShadowsEnabled(false); qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::ECO); - RenderScriptingInterface::getInstance()->setViewportResolutionScale(recommandedPpiScale); + RenderScriptingInterface::getInstance()->setViewportResolutionScale(recommendedPpiScale); DependencyManager::get()->setWorldDetailQuality(WORLD_DETAIL_LOW); From fe29b36b443c7136c2b87119d6eacb1161689d90 Mon Sep 17 00:00:00 2001 From: ksuprynowicz Date: Sun, 24 Oct 2021 20:34:55 +0200 Subject: [PATCH 12/40] Fixed CMake error when there's no CXXFLAGS environment variable --- CMakeLists.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 681b391110..53caf10783 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,12 +79,12 @@ endif() # It's used to determine build flags for main codebase and for VCPKG dependencies. # Should be set to false to get completely unoptimized build for easier line-by-line debugging -if(NOT DEFINED VIRCADIA_OPTIMIZE) - message("Enabling code optimization for Vircadia and compiled dependencies") - set(VIRCADIA_OPTIMIZE true CACHE BOOL "Enable code optimization for Vircadia and compiled dependencies") -endif() - if( NOT WIN32 ) + if(NOT DEFINED VIRCADIA_OPTIMIZE) + message("Enabling code optimization for Vircadia and compiled dependencies") + set(VIRCADIA_OPTIMIZE true CACHE BOOL "Enable code optimization for Vircadia and compiled dependencies") + endif() + #compiler needs to be detected before building VCPKG dependencies set(CMAKE_PLATFORM_INFO_DIR "${CMAKE_CURRENT_BINARY_DIR}") include(CMakeDetermineCXXCompiler) @@ -130,9 +130,10 @@ if( NOT WIN32 ) set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} ${VIRCADIA_OPTIMIZE_FLAGS}") set(ENV{CFLAGS} "$ENV{CFLAGS} ${VIRCADIA_OPTIMIZE_FLAGS}") + message($ENV{CXXFLAGS}) endif() -message($ENV{CXXFLAGS}) + if (HIFI_ANDROID) execute_process( From 526f526aa67f8fb6ae5727e64f167f12d51e9411 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 24 Oct 2021 22:32:12 +0200 Subject: [PATCH 13/40] Don't retrieve repository's SHA in prebuild Doing this means source can only be built when checked out from git, and can't be build from an archive. --- prebuild.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/prebuild.py b/prebuild.py index f272b04b23..5483703cb7 100644 --- a/prebuild.py +++ b/prebuild.py @@ -58,22 +58,6 @@ class TrackableLogger(logging.Logger): logging.setLoggerClass(TrackableLogger) logger = logging.getLogger('prebuild') -def headSha(): - if shutil.which('git') is None: - logger.warn("Unable to find git executable, can't caclulate commit ID") - return '0xDEADBEEF' - repo_dir = os.path.dirname(os.path.abspath(__file__)) - git = subprocess.Popen( - 'git rev-parse --short HEAD', - stdout=subprocess.PIPE, stderr=subprocess.PIPE, - shell=True, cwd=repo_dir, universal_newlines=True, - ) - stdout, _ = git.communicate() - sha = stdout.split('\n')[0] - if not sha: - raise RuntimeError("couldn't find git sha for repository {}".format(repo_dir)) - return sha - @contextmanager def timer(name): ''' Print the elapsed time a context's execution takes to execute ''' @@ -120,7 +104,6 @@ def main(): if args.ci_build: logging.basicConfig(datefmt='%H:%M:%S', format='%(asctime)s %(guid)s %(message)s', level=logging.INFO) - logger.info('sha=%s' % headSha()) logger.info('start') # OS dependent information From 66fdfa40ad462a1b66366f0558dbdd01a1e83867 Mon Sep 17 00:00:00 2001 From: Penguin-Guru Date: Sun, 24 Oct 2021 15:32:51 -0700 Subject: [PATCH 14/40] Hopefully implemented antialiasing setting. --- .../dialogs/graphics/GraphicsSettings.qml | 62 +++++++++++++++++++ interface/src/Menu.cpp | 4 +- .../scripting/RenderScriptingInterface.cpp | 50 +++++++++------ .../src/scripting/RenderScriptingInterface.h | 28 +++++---- .../render-utils/src/AntialiasingEffect.h | 3 +- 5 files changed, 112 insertions(+), 35 deletions(-) diff --git a/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml b/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml index 6e345caaf7..2041bab9f8 100644 --- a/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml +++ b/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml @@ -358,6 +358,67 @@ Item { } } } + + ColumnLayout { + Layout.topMargin: 20 + Layout.preferredWidth: parent.width + spacing: 0 + + Item { + Layout.preferredWidth: parent.width + Layout.preferredHeight: 35 + + HifiStylesUit.RalewayRegular { + id: antialiasingHeader + text: "Anti-aliasing" + anchors.left: parent.left + anchors.top: parent.top + width: 130 + height: parent.height + size: 16 + color: "#FFFFFF" + } + + ListModel { + id: antialiasingModel + + ListElement { + text: "None" + } + ListElement { + text: "TAA" + } + ListElement { + text: "FXAA" + } + } + + HifiControlsUit.ComboBox { + id: antialiasingDropdown + anchors.left: antialiasingHeader.right + anchors.leftMargin: 20 + anchors.top: parent.top + width: 280 + height: parent.height + colorScheme: hifi.colorSchemes.dark + model: antialiasingModel + currentIndex: -1 + + function refreshAntialiasingDropdown() { + antialiasingDropdown.currentIndex = Render.antialiasingMode; + } + + Component.onCompleted: { + antialiasingDropdown.refreshAntialiasingDropdown(); + } + + onCurrentIndexChanged: { + Render.antialiasingMode = currentIndex; + antialiasingDropdown.displayText = model.get(currentIndex).text; + } + } + } + } } } @@ -365,5 +426,6 @@ Item { worldDetailDropdown.refreshWorldDetailDropdown(); renderingEffectsDropdown.refreshRenderingEffectsDropdownDisplay(); refreshRateDropdown.refreshRefreshRateDropdownDisplay(); + antialiasingDropdown.refreshAntialiasingDropdown(); } } diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 760a7b1127..0e0250501d 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -405,8 +405,8 @@ Menu::Menu() { // Developer > Render >>> MenuWrapper* renderOptionsMenu = developerMenu->addMenu("Render"); - addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::AntiAliasing, 0, RenderScriptingInterface::getInstance()->getAntialiasingEnabled(), - RenderScriptingInterface::getInstance(), SLOT(setAntialiasingEnabled(bool))); + addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::AntiAliasing, 0, RenderScriptingInterface::getInstance()->getAntialiasingMode(), + RenderScriptingInterface::getInstance(), SLOT(setAntialiasingMode(int))); addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Shadows, 0, RenderScriptingInterface::getInstance()->getShadowsEnabled(), RenderScriptingInterface::getInstance(), SLOT(setShadowsEnabled(bool))); diff --git a/interface/src/scripting/RenderScriptingInterface.cpp b/interface/src/scripting/RenderScriptingInterface.cpp index 56e9a93377..22598f690a 100644 --- a/interface/src/scripting/RenderScriptingInterface.cpp +++ b/interface/src/scripting/RenderScriptingInterface.cpp @@ -8,7 +8,6 @@ #include "RenderScriptingInterface.h" #include "LightingModel.h" -#include "AntialiasingEffect.h" RenderScriptingInterface* RenderScriptingInterface::getInstance() { @@ -29,13 +28,14 @@ void RenderScriptingInterface::loadSettings() { _renderMethod = (_renderMethodSetting.get()); _shadowsEnabled = (_shadowsEnabledSetting.get()); _ambientOcclusionEnabled = (_ambientOcclusionEnabledSetting.get()); - _antialiasingEnabled = (_antialiasingEnabledSetting.get()); + _antialiasingMode = (_antialiasingModeSetting.get()); _viewportResolutionScale = (_viewportResolutionScaleSetting.get()); }); forceRenderMethod((RenderMethod)_renderMethod); forceShadowsEnabled(_shadowsEnabled); forceAmbientOcclusionEnabled(_ambientOcclusionEnabled); - forceAntialiasingEnabled(_antialiasingEnabled); + forceAntialiasingMode(_antialiasingMode); + forceAntialiasingMode(_antialiasingMode); forceViewportResolutionScale(_viewportResolutionScale); } @@ -121,33 +121,45 @@ void RenderScriptingInterface::forceAmbientOcclusionEnabled(bool enabled) { }); } -bool RenderScriptingInterface::getAntialiasingEnabled() const { - return _antialiasingEnabled; +AntialiasingConfig::Mode RenderScriptingInterface::getAntialiasingMode() const { + return _antialiasingMode; } -void RenderScriptingInterface::setAntialiasingEnabled(bool enabled) { - if (_antialiasingEnabled != enabled) { - forceAntialiasingEnabled(enabled); +void RenderScriptingInterface::setAntialiasingMode(AntialiasingConfig::Mode mode) { + if (_antialiasingMode != mode) { + forceAntialiasingMode(mode); emit settingsChanged(); } } -void RenderScriptingInterface::forceAntialiasingEnabled(bool enabled) { +void RenderScriptingInterface::forceAntialiasingMode(AntialiasingConfig::Mode mode) { _renderSettingLock.withWriteLock([&] { - _antialiasingEnabled = (enabled); - _antialiasingEnabledSetting.set(enabled); + _antialiasingMode = static_cast(mode); + _antialiasingModeSetting.set(mode); auto mainViewJitterCamConfig = qApp->getRenderEngine()->getConfiguration()->getConfig("RenderMainView.JitterCam"); auto mainViewAntialiasingConfig = qApp->getRenderEngine()->getConfiguration()->getConfig("RenderMainView.Antialiasing"); if (mainViewJitterCamConfig && mainViewAntialiasingConfig) { - Menu::getInstance()->setIsOptionChecked(MenuOption::AntiAliasing, enabled); - if (enabled) { - mainViewJitterCamConfig->play(); - mainViewAntialiasingConfig->setDebugFXAA(false); - } - else { - mainViewJitterCamConfig->none(); - mainViewAntialiasingConfig->setDebugFXAA(true); + Menu::getInstance()->setIsOptionChecked(MenuOption::AntiAliasing, mode); + switch (mode) { + case AntialiasingConfig::Mode::NONE: + mainViewJitterCamConfig->none(); + mainViewAntialiasingConfig->setDebugFXAA(false); + break; + case AntialiasingConfig::TAA: + mainViewJitterCamConfig->play(); + mainViewAntialiasingConfig->setDebugFXAA(false); + break; + case AntialiasingConfig::Mode::FXAA: + mainViewJitterCamConfig->none(); + mainViewAntialiasingConfig->setDebugFXAA(true); + break; + default: + _antialiasingMode = AntialiasingConfig::Mode::NONE; + _antialiasingModeSetting.set(AntialiasingConfig::Mode::NONE); + mainViewJitterCamConfig->none(); + mainViewAntialiasingConfig->setDebugFXAA(false); + break; } } }); diff --git a/interface/src/scripting/RenderScriptingInterface.h b/interface/src/scripting/RenderScriptingInterface.h index 97b736259b..3c2b489a8e 100644 --- a/interface/src/scripting/RenderScriptingInterface.h +++ b/interface/src/scripting/RenderScriptingInterface.h @@ -13,6 +13,8 @@ #include "Application.h" #include "RenderForward.h" +#include "AntialiasingEffect.h" + /*@jsdoc * The Render API enables you to configure the graphics engine. @@ -27,7 +29,7 @@ * @property {boolean} shadowsEnabled - true if shadows are enabled, false if they're disabled. * @property {boolean} ambientOcclusionEnabled - true if ambient occlusion is enabled, false if it's * disabled. - * @property {boolean} antialiasingEnabled - true if anti-aliasing is enabled, false if it's disabled. + * @property {integer} antialiasingMode - The active anti-aliasing mode. * @property {number} viewportResolutionScale - The view port resolution scale, > 0.0. */ class RenderScriptingInterface : public QObject { @@ -35,7 +37,7 @@ class RenderScriptingInterface : public QObject { Q_PROPERTY(RenderMethod renderMethod READ getRenderMethod WRITE setRenderMethod NOTIFY settingsChanged) Q_PROPERTY(bool shadowsEnabled READ getShadowsEnabled WRITE setShadowsEnabled NOTIFY settingsChanged) Q_PROPERTY(bool ambientOcclusionEnabled READ getAmbientOcclusionEnabled WRITE setAmbientOcclusionEnabled NOTIFY settingsChanged) - Q_PROPERTY(bool antialiasingEnabled READ getAntialiasingEnabled WRITE setAntialiasingEnabled NOTIFY settingsChanged) + Q_PROPERTY(AntialiasingConfig::Mode antialiasingMode READ getAntialiasingMode WRITE setAntialiasingMode NOTIFY settingsChanged) Q_PROPERTY(float viewportResolutionScale READ getViewportResolutionScale WRITE setViewportResolutionScale NOTIFY settingsChanged) public: @@ -143,18 +145,18 @@ public slots: void setAmbientOcclusionEnabled(bool enabled); /*@jsdoc - * Gets whether or not anti-aliasing is enabled. - * @function Render.getAntialiasingEnabled - * @returns {boolean} true if anti-aliasing is enabled, false if it's disabled. + * Gets the active anti-aliasing mode. + * @function Render.getAntialiasingMode + * @returns {integer} the active anti-aliasing mode. */ - bool getAntialiasingEnabled() const; + AntialiasingConfig::Mode getAntialiasingMode() const; /*@jsdoc - * Sets whether or not anti-aliasing is enabled. - * @function Render.setAntialiasingEnabled - * @param {boolean} enabled - true to enable anti-aliasing, false to disable. + * Sets the active anti-aliasing mode. + * @function Render.setAntialiasingMode + * @param {integer} the active anti-aliasing mode. */ - void setAntialiasingEnabled(bool enabled); + void setAntialiasingMode(AntialiasingConfig::Mode mode); /*@jsdoc * Gets the view port resolution scale. @@ -192,21 +194,21 @@ private: int _renderMethod{ RENDER_FORWARD ? render::Args::RenderMethod::FORWARD : render::Args::RenderMethod::DEFERRED }; bool _shadowsEnabled{ true }; bool _ambientOcclusionEnabled{ false }; - bool _antialiasingEnabled{ true }; + AntialiasingConfig::Mode _antialiasingMode; float _viewportResolutionScale{ 1.0f }; // Actual settings saved on disk Setting::Handle _renderMethodSetting { "renderMethod", RENDER_FORWARD ? render::Args::RenderMethod::FORWARD : render::Args::RenderMethod::DEFERRED }; Setting::Handle _shadowsEnabledSetting { "shadowsEnabled", true }; Setting::Handle _ambientOcclusionEnabledSetting { "ambientOcclusionEnabled", false }; - Setting::Handle _antialiasingEnabledSetting { "antialiasingEnabled", true }; + Setting::Handle _antialiasingModeSetting { "antialiasingMode", AntialiasingConfig::Mode::TAA }; Setting::Handle _viewportResolutionScaleSetting { "viewportResolutionScale", 1.0f }; // Force assign both setting AND runtime value to the parameter value void forceRenderMethod(RenderMethod renderMethod); void forceShadowsEnabled(bool enabled); void forceAmbientOcclusionEnabled(bool enabled); - void forceAntialiasingEnabled(bool enabled); + void forceAntialiasingMode(AntialiasingConfig::Mode mode); void forceViewportResolutionScale(float scale); static std::once_flag registry_flag; diff --git a/libraries/render-utils/src/AntialiasingEffect.h b/libraries/render-utils/src/AntialiasingEffect.h index fc25343751..2e838764b4 100644 --- a/libraries/render-utils/src/AntialiasingEffect.h +++ b/libraries/render-utils/src/AntialiasingEffect.h @@ -110,7 +110,7 @@ public: AntialiasingConfig() : render::Job::Config(true) {} enum Mode { - OFF = 0, + NONE = 0, TAA, FXAA, MODE_COUNT @@ -144,6 +144,7 @@ public: signals: void dirty(); }; +Q_DECLARE_METATYPE(AntialiasingConfig::Mode); #define SET_BIT(bitfield, bitIndex, value) bitfield = ((bitfield) & ~(1 << (bitIndex))) | ((value) << (bitIndex)) #define GET_BIT(bitfield, bitIndex) ((bitfield) & (1 << (bitIndex))) From 8386f2eb61d8a033c7f09c5fec501eb843808cfa Mon Sep 17 00:00:00 2001 From: Penguin-Guru Date: Sun, 24 Oct 2021 19:19:20 -0700 Subject: [PATCH 15/40] Clumsy fix for enum storage. --- interface/src/Menu.cpp | 3 --- interface/src/Menu.h | 4 +++- interface/src/scripting/RenderScriptingInterface.cpp | 11 +++++------ interface/src/scripting/RenderScriptingInterface.h | 5 +++-- libraries/render-utils/src/AntialiasingEffect.h | 4 ++-- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 0e0250501d..72504c5571 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -405,9 +405,6 @@ Menu::Menu() { // Developer > Render >>> MenuWrapper* renderOptionsMenu = developerMenu->addMenu("Render"); - addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::AntiAliasing, 0, RenderScriptingInterface::getInstance()->getAntialiasingMode(), - RenderScriptingInterface::getInstance(), SLOT(setAntialiasingMode(int))); - addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Shadows, 0, RenderScriptingInterface::getInstance()->getShadowsEnabled(), RenderScriptingInterface::getInstance(), SLOT(setShadowsEnabled(bool))); diff --git a/interface/src/Menu.h b/interface/src/Menu.h index 5cd4c2112e..eecfd3af56 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -224,7 +224,9 @@ namespace MenuOption { const QString DesktopTabletToToolbar = "Desktop Tablet Becomes Toolbar"; const QString HMDTabletToToolbar = "HMD Tablet Becomes Toolbar"; const QString Shadows = "Shadows"; - const QString AntiAliasing = "Temporal Antialiasing (FXAA if disabled)"; + const QString AntiAliasingNONE = "Antialiasing Disabled"; + const QString AntiAliasingTAA = "Temporal Anti-aliasing"; + const QString AntiAliasingFXAA = "Fast Approximate Anti-aliasing"; const QString AmbientOcclusion = "Ambient Occlusion"; const QString NotificationSounds = "play_notification_sounds"; const QString NotificationSoundsSnapshot = "play_notification_sounds_snapshot"; diff --git a/interface/src/scripting/RenderScriptingInterface.cpp b/interface/src/scripting/RenderScriptingInterface.cpp index 22598f690a..3b356913d9 100644 --- a/interface/src/scripting/RenderScriptingInterface.cpp +++ b/interface/src/scripting/RenderScriptingInterface.cpp @@ -28,14 +28,14 @@ void RenderScriptingInterface::loadSettings() { _renderMethod = (_renderMethodSetting.get()); _shadowsEnabled = (_shadowsEnabledSetting.get()); _ambientOcclusionEnabled = (_ambientOcclusionEnabledSetting.get()); - _antialiasingMode = (_antialiasingModeSetting.get()); + //_antialiasingMode = (_antialiasingModeSetting.get()); + _antialiasingMode = static_cast(_antialiasingModeSetting.get()); _viewportResolutionScale = (_viewportResolutionScaleSetting.get()); }); forceRenderMethod((RenderMethod)_renderMethod); forceShadowsEnabled(_shadowsEnabled); forceAmbientOcclusionEnabled(_ambientOcclusionEnabled); forceAntialiasingMode(_antialiasingMode); - forceAntialiasingMode(_antialiasingMode); forceViewportResolutionScale(_viewportResolutionScale); } @@ -134,13 +134,11 @@ void RenderScriptingInterface::setAntialiasingMode(AntialiasingConfig::Mode mode void RenderScriptingInterface::forceAntialiasingMode(AntialiasingConfig::Mode mode) { _renderSettingLock.withWriteLock([&] { - _antialiasingMode = static_cast(mode); - _antialiasingModeSetting.set(mode); + _antialiasingMode = mode; auto mainViewJitterCamConfig = qApp->getRenderEngine()->getConfiguration()->getConfig("RenderMainView.JitterCam"); auto mainViewAntialiasingConfig = qApp->getRenderEngine()->getConfiguration()->getConfig("RenderMainView.Antialiasing"); if (mainViewJitterCamConfig && mainViewAntialiasingConfig) { - Menu::getInstance()->setIsOptionChecked(MenuOption::AntiAliasing, mode); switch (mode) { case AntialiasingConfig::Mode::NONE: mainViewJitterCamConfig->none(); @@ -156,12 +154,13 @@ void RenderScriptingInterface::forceAntialiasingMode(AntialiasingConfig::Mode mo break; default: _antialiasingMode = AntialiasingConfig::Mode::NONE; - _antialiasingModeSetting.set(AntialiasingConfig::Mode::NONE); mainViewJitterCamConfig->none(); mainViewAntialiasingConfig->setDebugFXAA(false); break; } } + + _antialiasingModeSetting.set(_antialiasingMode); }); } diff --git a/interface/src/scripting/RenderScriptingInterface.h b/interface/src/scripting/RenderScriptingInterface.h index 3c2b489a8e..88262b14c1 100644 --- a/interface/src/scripting/RenderScriptingInterface.h +++ b/interface/src/scripting/RenderScriptingInterface.h @@ -194,14 +194,15 @@ private: int _renderMethod{ RENDER_FORWARD ? render::Args::RenderMethod::FORWARD : render::Args::RenderMethod::DEFERRED }; bool _shadowsEnabled{ true }; bool _ambientOcclusionEnabled{ false }; - AntialiasingConfig::Mode _antialiasingMode; + AntialiasingConfig::Mode _antialiasingMode{ AntialiasingConfig::Mode::TAA }; float _viewportResolutionScale{ 1.0f }; // Actual settings saved on disk Setting::Handle _renderMethodSetting { "renderMethod", RENDER_FORWARD ? render::Args::RenderMethod::FORWARD : render::Args::RenderMethod::DEFERRED }; Setting::Handle _shadowsEnabledSetting { "shadowsEnabled", true }; Setting::Handle _ambientOcclusionEnabledSetting { "ambientOcclusionEnabled", false }; - Setting::Handle _antialiasingModeSetting { "antialiasingMode", AntialiasingConfig::Mode::TAA }; + //Setting::Handle _antialiasingModeSetting { "antialiasingMode", AntialiasingConfig::Mode::TAA }; + Setting::Handle _antialiasingModeSetting { "antialiasingMode", AntialiasingConfig::Mode::TAA }; Setting::Handle _viewportResolutionScaleSetting { "viewportResolutionScale", 1.0f }; // Force assign both setting AND runtime value to the parameter value diff --git a/libraries/render-utils/src/AntialiasingEffect.h b/libraries/render-utils/src/AntialiasingEffect.h index 2e838764b4..453c4ce992 100644 --- a/libraries/render-utils/src/AntialiasingEffect.h +++ b/libraries/render-utils/src/AntialiasingEffect.h @@ -115,6 +115,7 @@ public: FXAA, MODE_COUNT }; + Q_ENUM(Mode) // Stored as signed int. void setAAMode(int mode); int getAAMode() const { return _mode; } @@ -122,7 +123,7 @@ public: void setDebugFXAA(bool debug) { debugFXAAX = (debug ? 0.0f : 1.0f); emit dirty();} bool debugFXAA() const { return (debugFXAAX == 0.0f ? true : false); } - int _mode{ TAA }; + int _mode{ TAA }; // '_' prefix but not private? float blend{ 0.25f }; float sharpen{ 0.05f }; @@ -144,7 +145,6 @@ public: signals: void dirty(); }; -Q_DECLARE_METATYPE(AntialiasingConfig::Mode); #define SET_BIT(bitfield, bitIndex, value) bitfield = ((bitfield) & ~(1 << (bitIndex))) | ((value) << (bitIndex)) #define GET_BIT(bitfield, bitIndex) ((bitfield) & (1 << (bitIndex))) From e7d5a005b838d8fe0ca51fbfcbe4c58d7d1aa686 Mon Sep 17 00:00:00 2001 From: Penguin-Guru Date: Sun, 24 Oct 2021 19:24:00 -0700 Subject: [PATCH 16/40] Forgot to remove these. --- interface/src/Menu.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/interface/src/Menu.h b/interface/src/Menu.h index eecfd3af56..c42345894c 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -224,9 +224,6 @@ namespace MenuOption { const QString DesktopTabletToToolbar = "Desktop Tablet Becomes Toolbar"; const QString HMDTabletToToolbar = "HMD Tablet Becomes Toolbar"; const QString Shadows = "Shadows"; - const QString AntiAliasingNONE = "Antialiasing Disabled"; - const QString AntiAliasingTAA = "Temporal Anti-aliasing"; - const QString AntiAliasingFXAA = "Fast Approximate Anti-aliasing"; const QString AmbientOcclusion = "Ambient Occlusion"; const QString NotificationSounds = "play_notification_sounds"; const QString NotificationSoundsSnapshot = "play_notification_sounds_snapshot"; From 3c85964c5d2693e6432383e6be9c555c1028ae06 Mon Sep 17 00:00:00 2001 From: Penguin-Guru Date: Mon, 25 Oct 2021 13:25:31 -0700 Subject: [PATCH 17/40] Hopefully works. --- interface/src/scripting/RenderScriptingInterface.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/interface/src/scripting/RenderScriptingInterface.cpp b/interface/src/scripting/RenderScriptingInterface.cpp index 3b356913d9..741fafd0a9 100644 --- a/interface/src/scripting/RenderScriptingInterface.cpp +++ b/interface/src/scripting/RenderScriptingInterface.cpp @@ -142,6 +142,7 @@ void RenderScriptingInterface::forceAntialiasingMode(AntialiasingConfig::Mode mo switch (mode) { case AntialiasingConfig::Mode::NONE: mainViewJitterCamConfig->none(); + mainViewAntialiasingConfig->blend = 1; mainViewAntialiasingConfig->setDebugFXAA(false); break; case AntialiasingConfig::TAA: From fc1a0d6a4cb203c7c71feb7144c7d60b046efc17 Mon Sep 17 00:00:00 2001 From: Penguin-Guru Date: Mon, 25 Oct 2021 13:35:24 -0700 Subject: [PATCH 18/40] Apparently it worked. --- interface/src/scripting/RenderScriptingInterface.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/interface/src/scripting/RenderScriptingInterface.cpp b/interface/src/scripting/RenderScriptingInterface.cpp index 741fafd0a9..58738d0929 100644 --- a/interface/src/scripting/RenderScriptingInterface.cpp +++ b/interface/src/scripting/RenderScriptingInterface.cpp @@ -147,15 +147,18 @@ void RenderScriptingInterface::forceAntialiasingMode(AntialiasingConfig::Mode mo break; case AntialiasingConfig::TAA: mainViewJitterCamConfig->play(); + mainViewAntialiasingConfig->blend = 0.25; mainViewAntialiasingConfig->setDebugFXAA(false); break; case AntialiasingConfig::Mode::FXAA: mainViewJitterCamConfig->none(); + mainViewAntialiasingConfig->blend = 0.25; mainViewAntialiasingConfig->setDebugFXAA(true); break; default: _antialiasingMode = AntialiasingConfig::Mode::NONE; mainViewJitterCamConfig->none(); + mainViewAntialiasingConfig->blend = 1; mainViewAntialiasingConfig->setDebugFXAA(false); break; } From e6a41e85b234dd3f2927c08642c34750a9d48a98 Mon Sep 17 00:00:00 2001 From: Penguin-Guru Date: Mon, 25 Oct 2021 13:40:36 -0700 Subject: [PATCH 19/40] Added comments. Referenced all enums explicitly. --- .../qml/hifi/dialogs/graphics/GraphicsSettings.qml | 5 +++-- interface/src/scripting/RenderScriptingInterface.cpp | 2 +- libraries/render-utils/src/AntialiasingEffect.cpp | 2 +- libraries/render-utils/src/AntialiasingEffect.h | 8 ++++---- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml b/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml index 2041bab9f8..6ebb0099ca 100644 --- a/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml +++ b/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml @@ -378,10 +378,11 @@ Item { size: 16 color: "#FFFFFF" } - + ListModel { id: antialiasingModel - + + // Maintain same order as "AntialiasingConfig::Mode". ListElement { text: "None" } diff --git a/interface/src/scripting/RenderScriptingInterface.cpp b/interface/src/scripting/RenderScriptingInterface.cpp index 58738d0929..5ecb1a6e43 100644 --- a/interface/src/scripting/RenderScriptingInterface.cpp +++ b/interface/src/scripting/RenderScriptingInterface.cpp @@ -145,7 +145,7 @@ void RenderScriptingInterface::forceAntialiasingMode(AntialiasingConfig::Mode mo mainViewAntialiasingConfig->blend = 1; mainViewAntialiasingConfig->setDebugFXAA(false); break; - case AntialiasingConfig::TAA: + case AntialiasingConfig::Mode::TAA: mainViewJitterCamConfig->play(); mainViewAntialiasingConfig->blend = 0.25; mainViewAntialiasingConfig->setDebugFXAA(false); diff --git a/libraries/render-utils/src/AntialiasingEffect.cpp b/libraries/render-utils/src/AntialiasingEffect.cpp index c9da8373db..9083aa0c2e 100644 --- a/libraries/render-utils/src/AntialiasingEffect.cpp +++ b/libraries/render-utils/src/AntialiasingEffect.cpp @@ -140,7 +140,7 @@ void Antialiasing::run(const render::RenderContextPointer& renderContext, const #else void AntialiasingConfig::setAAMode(int mode) { - _mode = std::min((int)AntialiasingConfig::MODE_COUNT, std::max(0, mode)); + _mode = std::min((int)AntialiasingConfig::MODE_COUNT, std::max(0, mode)); // Just use unsigned? emit dirty(); } diff --git a/libraries/render-utils/src/AntialiasingEffect.h b/libraries/render-utils/src/AntialiasingEffect.h index 453c4ce992..dc81132cca 100644 --- a/libraries/render-utils/src/AntialiasingEffect.h +++ b/libraries/render-utils/src/AntialiasingEffect.h @@ -217,10 +217,10 @@ private: }; -#else -class AntiAliasingConfig : public render::Job::Config { +#else // User setting for antialias mode will probably be broken. +class AntiAliasingConfig : public render::Job::Config { // Not to be confused with AntialiasingConfig... Q_OBJECT - Q_PROPERTY(bool enabled MEMBER enabled) + Q_PROPERTY(bool enabled MEMBER enabled) // Not sure if still useful. public: AntiAliasingConfig() : render::Job::Config(true) {} }; @@ -237,7 +237,7 @@ public: const gpu::PipelinePointer& getAntialiasingPipeline(); const gpu::PipelinePointer& getBlendPipeline(); - + private: gpu::FramebufferPointer _antialiasingBuffer; From 124f4b5e83251c055613d47049946acf5e87f4ec Mon Sep 17 00:00:00 2001 From: ksuprynowicz Date: Sat, 30 Oct 2021 14:55:48 +0200 Subject: [PATCH 20/40] Removed unnecessary line in CMakeLists.txt --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 53caf10783..20354b7a6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,7 +91,6 @@ if( NOT WIN32 ) set(VIRCADIA_OPTIMIZE_FLAGS "") - set(VIRCADIA_OPTIMIZE_FLAGS "-O3 -fPIC") if(VIRCADIA_OPTIMIZE) file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/_env/VIRCADIA_OPTIMIZE.txt" "${VIRCADIA_OPTIMIZE}") From ac984d5e061afc58f79fdb04a0b826f77d518ff3 Mon Sep 17 00:00:00 2001 From: ksuprynowicz Date: Sat, 30 Oct 2021 15:08:52 +0200 Subject: [PATCH 21/40] Added information about optimization variables --- BUILD.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/BUILD.md b/BUILD.md index 82da773f08..68baa8558a 100644 --- a/BUILD.md +++ b/BUILD.md @@ -192,6 +192,11 @@ The following build options can be used when running CMake * CLIENT_ONLY // Will package only the Interface * SERVER_ONLY // Will package only the Server +### Optimization build options + +* VIRCADIA_OPTIMIZE - This variable defaults to 1 if not set and enables compiler optimization flags on Linux and MacOS. Setting it to 0 will result in unoptimized build. +* VIRCADIA_CPU_ARCHITECTURE - This variable contains architecture specific compiler flags which are used if VIRCADIA_OPTIMIZE is true. If it is not set, it defaults to "-march=native -mtune=native", which helps yield more performance for locally used build, but for packaging it needs to be set to different value for portability, for example "-msse3". + ### Developer Build Options * USE_GLES From a31350678f679429f3d427ff2f19f6cf5cbc80c5 Mon Sep 17 00:00:00 2001 From: ksuprynowicz Date: Sat, 30 Oct 2021 15:15:28 +0200 Subject: [PATCH 22/40] Added CPU architecture variable info to BUILD_LINUX.md --- BUILD_LINUX.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/BUILD_LINUX.md b/BUILD_LINUX.md index 1996360fed..8b058a1efb 100644 --- a/BUILD_LINUX.md +++ b/BUILD_LINUX.md @@ -171,3 +171,9 @@ If your goal is to set up a development environment, it is desirable to set the directory that vcpkg builds into with the `HIFI_VCPKG_BASE` environment variable. For example, you might set `HIFI_VCPKG_BASE` to `/home/$USER/vcpkg`. By default, vcpkg will build in the system `/tmp` directory. + +If build is intended for packaging or creation of AppImage, VIRCADIA_CPU_ARCHITECTURE +CMake variable needs to be set to architecture specific value. +It defaults to "-march=native -mtune=native", which yields builds optimized for particular +machine, but builds will not work on machines lacking same CPU instructions. +For packaging and AppImage it is recommended to set it to different value, for example "-msse3". From 6394dc8662de8f03b605c334120a28966cd68f84 Mon Sep 17 00:00:00 2001 From: ksuprynowicz Date: Sat, 30 Oct 2021 15:16:32 +0200 Subject: [PATCH 23/40] Update BUILD_LINUX.md --- BUILD_LINUX.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BUILD_LINUX.md b/BUILD_LINUX.md index 8b058a1efb..04d8e8b63b 100644 --- a/BUILD_LINUX.md +++ b/BUILD_LINUX.md @@ -172,8 +172,8 @@ directory that vcpkg builds into with the `HIFI_VCPKG_BASE` environment variable For example, you might set `HIFI_VCPKG_BASE` to `/home/$USER/vcpkg`. By default, vcpkg will build in the system `/tmp` directory. -If build is intended for packaging or creation of AppImage, VIRCADIA_CPU_ARCHITECTURE +If build is intended for packaging or creation of AppImage, `VIRCADIA_CPU_ARCHITECTURE` CMake variable needs to be set to architecture specific value. -It defaults to "-march=native -mtune=native", which yields builds optimized for particular +It defaults to `-march=native -mtune=native`, which yields builds optimized for particular machine, but builds will not work on machines lacking same CPU instructions. -For packaging and AppImage it is recommended to set it to different value, for example "-msse3". +For packaging and AppImage it is recommended to set it to different value, for example `-msse3`. From f2e4c4daa2679bd22185e2301f14dd514200e1f2 Mon Sep 17 00:00:00 2001 From: ksuprynowicz Date: Sat, 30 Oct 2021 15:17:49 +0200 Subject: [PATCH 24/40] Update BUILD_OSX.md --- BUILD_OSX.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/BUILD_OSX.md b/BUILD_OSX.md index ee14b3b24e..e1fb030e39 100644 --- a/BUILD_OSX.md +++ b/BUILD_OSX.md @@ -64,6 +64,14 @@ You can append `-j4` to assign more threads to build with. The number indicates To package the installation, you can simply run `make package` afterwards. +## Notes + +If build is intended for packaging or creation of AppImage, `VIRCADIA_CPU_ARCHITECTURE` +CMake variable needs to be set to architecture specific value. +It defaults to `-march=native -mtune=native`, which yields builds optimized for particular +machine, but builds will not work on machines lacking same CPU instructions. +For packaging and AppImage it is recommended to set it to different value, for example `-msse3`. + ## FAQ 1. **Problem:** Running the scheme `interface.app` from Xcode causes a crash for Interface related to `libgl`. From afae963031f15fcaee65e18a6b1f5cb8a0c8bfd2 Mon Sep 17 00:00:00 2001 From: ksuprynowicz Date: Sat, 30 Oct 2021 15:18:48 +0200 Subject: [PATCH 25/40] Update BUILD.md --- BUILD.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD.md b/BUILD.md index 68baa8558a..469d934b95 100644 --- a/BUILD.md +++ b/BUILD.md @@ -195,7 +195,7 @@ The following build options can be used when running CMake ### Optimization build options * VIRCADIA_OPTIMIZE - This variable defaults to 1 if not set and enables compiler optimization flags on Linux and MacOS. Setting it to 0 will result in unoptimized build. -* VIRCADIA_CPU_ARCHITECTURE - This variable contains architecture specific compiler flags which are used if VIRCADIA_OPTIMIZE is true. If it is not set, it defaults to "-march=native -mtune=native", which helps yield more performance for locally used build, but for packaging it needs to be set to different value for portability, for example "-msse3". +* VIRCADIA_CPU_ARCHITECTURE - This variable contains architecture specific compiler flags which are used if `VIRCADIA_OPTIMIZE` is true. If it is not set, it defaults to `-march=native -mtune=native`, which helps yield more performance for locally used build, but for packaging it needs to be set to different value for portability, for example `-msse3`. ### Developer Build Options From 44fb53d4f26dc956500560bde30501f3cfd1bfc7 Mon Sep 17 00:00:00 2001 From: Penguin-Guru Date: Sat, 30 Oct 2021 10:43:10 -0700 Subject: [PATCH 26/40] Removed comment. --- libraries/render-utils/src/AntialiasingEffect.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/render-utils/src/AntialiasingEffect.h b/libraries/render-utils/src/AntialiasingEffect.h index dc81132cca..ddb243f064 100644 --- a/libraries/render-utils/src/AntialiasingEffect.h +++ b/libraries/render-utils/src/AntialiasingEffect.h @@ -220,7 +220,7 @@ private: #else // User setting for antialias mode will probably be broken. class AntiAliasingConfig : public render::Job::Config { // Not to be confused with AntialiasingConfig... Q_OBJECT - Q_PROPERTY(bool enabled MEMBER enabled) // Not sure if still useful. + Q_PROPERTY(bool enabled MEMBER enabled) public: AntiAliasingConfig() : render::Job::Config(true) {} }; From 56bc962d36fbf03bbe952f6c6316bc636c033d6b Mon Sep 17 00:00:00 2001 From: Penguin-Guru Date: Sat, 23 Oct 2021 10:13:47 -0700 Subject: [PATCH 27/40] Changed preset framerates. Added preset. --- .../dialogs/graphics/GraphicsSettings.qml | 14 ++++++++ .../settingsApp/general/General.qml | 9 +++++ interface/src/PerformanceManager.cpp | 33 +++++++++++++------ interface/src/PerformanceManager.h | 1 + .../PerformanceScriptingInterface.cpp | 2 +- .../scripting/PerformanceScriptingInterface.h | 1 + libraries/platform/src/platform/Profiler.cpp | 2 +- libraries/platform/src/platform/Profiler.h | 1 + 8 files changed, 51 insertions(+), 12 deletions(-) diff --git a/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml b/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml index 6e345caaf7..188e8022fb 100644 --- a/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml +++ b/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml @@ -52,6 +52,20 @@ Item { Layout.preferredWidth: parent.width spacing: 0 + HifiControlsUit.RadioButton { + id: performanceLowPower + colorScheme: hifi.colorSchemes.dark + height: 18 + fontSize: 16 + leftPadding: 0 + text: "Low Power" + checked: Performance.getPerformancePreset() === PerformanceEnums.LOW_POWER + onClicked: { + Performance.setPerformancePreset(PerformanceEnums.LOW_POWER); + root.refreshAllDropdowns(); + } + } + HifiControlsUit.RadioButton { id: performanceLow colorScheme: hifi.colorSchemes.dark diff --git a/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml b/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml index 6a59816af8..2c17ecf6c3 100644 --- a/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml +++ b/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml @@ -174,6 +174,15 @@ Flickable { Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin spacing: simplifiedUI.margins.settings.spacingBetweenRadiobuttons + SimplifiedControls.RadioButton { + id: performanceLow + text: "Low Power Quality" + (PlatformInfo.getTierProfiled() === PerformanceEnums.LOW_POWER ? " (Recommended)" : "") + checked: Performance.getPerformancePreset() === PerformanceEnums.LOW_POWER + onClicked: { + Performance.setPerformancePreset(PerformanceEnums.LOW_POWER); + } + } + SimplifiedControls.RadioButton { id: performanceLow text: "Low Quality" + (PlatformInfo.getTierProfiled() === PerformanceEnums.LOW ? " (Recommended)" : "") diff --git a/interface/src/PerformanceManager.cpp b/interface/src/PerformanceManager.cpp index 1ff2319b1b..c4c6241a21 100644 --- a/interface/src/PerformanceManager.cpp +++ b/interface/src/PerformanceManager.cpp @@ -29,10 +29,11 @@ void PerformanceManager::setupPerformancePresetSettings(bool evaluatePlatformTie // Here is the mapping between platformTier and performance profile const std::array platformToPerformancePresetMap = { { - PerformanceManager::PerformancePreset::MID, // platform::Profiler::UNKNOWN - PerformanceManager::PerformancePreset::LOW, // platform::Profiler::LOW - PerformanceManager::PerformancePreset::MID, // platform::Profiler::MID - PerformanceManager::PerformancePreset::HIGH // platform::Profiler::HIGH + PerformanceManager::PerformancePreset::MID, // platform::Profiler::UNKNOWN + PerformanceManager::PerformancePreset::LOW_POWER, // platform::Profiler::LOW_POWER + PerformanceManager::PerformancePreset::LOW, // platform::Profiler::LOW + PerformanceManager::PerformancePreset::MID, // platform::Profiler::MID + PerformanceManager::PerformancePreset::HIGH // platform::Profiler::HIGH } }; // What is our profile? @@ -94,7 +95,7 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP DependencyManager::get()->setWorldDetailQuality(WORLD_DETAIL_HIGH); - break; + break; case PerformancePreset::MID: RenderScriptingInterface::getInstance()->setRenderMethod((isDeferredCapable ? RenderScriptingInterface::RenderMethod::DEFERRED : @@ -103,11 +104,21 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP RenderScriptingInterface::getInstance()->setViewportResolutionScale(recommendedPpiScale); RenderScriptingInterface::getInstance()->setShadowsEnabled(false); - qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::INTERACTIVE); + qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::REALTIME); DependencyManager::get()->setWorldDetailQuality(WORLD_DETAIL_MEDIUM); - break; + break; case PerformancePreset::LOW: + RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::FORWARD); + RenderScriptingInterface::getInstance()->setShadowsEnabled(false); + qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::REALTIME); + + RenderScriptingInterface::getInstance()->setViewportResolutionScale(recommandedPpiScale); + + DependencyManager::get()->setWorldDetailQuality(WORLD_DETAIL_LOW); + + break; + case PerformancePreset::LOW_POWER: RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::FORWARD); RenderScriptingInterface::getInstance()->setShadowsEnabled(false); qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::ECO); @@ -116,10 +127,12 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP DependencyManager::get()->setWorldDetailQuality(WORLD_DETAIL_LOW); - break; - case PerformancePreset::UNKNOWN: + break; + case + PerformancePreset::UNKNOWN: + // Intentionally unbroken. default: - // Do nothing anymore + // Do nothing. break; } } diff --git a/interface/src/PerformanceManager.h b/interface/src/PerformanceManager.h index f28d56d6ff..c1e451f54b 100644 --- a/interface/src/PerformanceManager.h +++ b/interface/src/PerformanceManager.h @@ -21,6 +21,7 @@ class PerformanceManager { public: enum PerformancePreset { UNKNOWN = 0, // Matching the platform Tier profiles enumeration for coherence + LOW_POWER, LOW, MID, HIGH, diff --git a/interface/src/scripting/PerformanceScriptingInterface.cpp b/interface/src/scripting/PerformanceScriptingInterface.cpp index 33ad9a3f95..ec56e83323 100644 --- a/interface/src/scripting/PerformanceScriptingInterface.cpp +++ b/interface/src/scripting/PerformanceScriptingInterface.cpp @@ -29,7 +29,7 @@ PerformanceScriptingInterface::PerformancePreset PerformanceScriptingInterface:: } QStringList PerformanceScriptingInterface::getPerformancePresetNames() const { - static const QStringList performancePresetNames = { "UNKNOWN", "LOW", "MID", "HIGH" }; + static const QStringList performancePresetNames = { "UNKNOWN", "LOW_POWER", "LOW", "MID", "HIGH" }; return performancePresetNames; } diff --git a/interface/src/scripting/PerformanceScriptingInterface.h b/interface/src/scripting/PerformanceScriptingInterface.h index d5048115c7..76e58f29b6 100644 --- a/interface/src/scripting/PerformanceScriptingInterface.h +++ b/interface/src/scripting/PerformanceScriptingInterface.h @@ -57,6 +57,7 @@ public: // PerformanceManager PerformancePreset tri state level enums enum PerformancePreset { UNKNOWN = PerformanceManager::PerformancePreset::UNKNOWN, + LOW_POWER = PerformanceManager::PerformancePreset::LOW_POWER, LOW = PerformanceManager::PerformancePreset::LOW, MID = PerformanceManager::PerformancePreset::MID, HIGH = PerformanceManager::PerformancePreset::HIGH, diff --git a/libraries/platform/src/platform/Profiler.cpp b/libraries/platform/src/platform/Profiler.cpp index d805fd8ebc..f64cc66059 100644 --- a/libraries/platform/src/platform/Profiler.cpp +++ b/libraries/platform/src/platform/Profiler.cpp @@ -16,7 +16,7 @@ using namespace platform; -const std::array Profiler::TierNames = {{ "UNKNOWN", "LOW", "MID", "HIGH" }}; +const std::array Profiler::TierNames = {{ "UNKNOWN", "LOW_POWER", "LOW", "MID", "HIGH" }}; bool filterOnComputer(const platform::json& computer, Profiler::Tier& tier); diff --git a/libraries/platform/src/platform/Profiler.h b/libraries/platform/src/platform/Profiler.h index c47f2587f2..eb8a7c4d11 100644 --- a/libraries/platform/src/platform/Profiler.h +++ b/libraries/platform/src/platform/Profiler.h @@ -19,6 +19,7 @@ class Profiler { public: enum Tier { UNKNOWN = 0, + LOW_POWER, LOW, MID, HIGH, From 727ac383720307c620c52e2e0e95e80362e28ca1 Mon Sep 17 00:00:00 2001 From: Penguin-Guru Date: Sat, 30 Oct 2021 10:48:27 -0700 Subject: [PATCH 28/40] Removed typo newline. --- interface/src/PerformanceManager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/interface/src/PerformanceManager.cpp b/interface/src/PerformanceManager.cpp index c4c6241a21..ac444ac571 100644 --- a/interface/src/PerformanceManager.cpp +++ b/interface/src/PerformanceManager.cpp @@ -128,8 +128,7 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP DependencyManager::get()->setWorldDetailQuality(WORLD_DETAIL_LOW); break; - case - PerformancePreset::UNKNOWN: + case PerformancePreset::UNKNOWN: // Intentionally unbroken. default: // Do nothing. From 6dd26c53a985410ed1968140a511d09c87be8f8a Mon Sep 17 00:00:00 2001 From: Penguin-Guru Date: Sat, 30 Oct 2021 11:47:25 -0700 Subject: [PATCH 29/40] Maybe this helps? --- interface/src/PerformanceManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/PerformanceManager.cpp b/interface/src/PerformanceManager.cpp index ac444ac571..fc2f3d1a4f 100644 --- a/interface/src/PerformanceManager.cpp +++ b/interface/src/PerformanceManager.cpp @@ -72,7 +72,7 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP // eval recommended PPI and Scale float recommendedPpiScale = 1.0f; - const float RECOMMENDED_PPI[] = { 200.0f, 120.f, 160.f, 250.f}; + const float RECOMMENDED_PPI[] = { 200.0f, 200.0f, 120.f, 160.f, 250.f}; if (!masterDisplay.empty() && masterDisplay.count(platform::keys::display::ppi)) { float ppi = masterDisplay[platform::keys::display::ppi]; // only scale if the actual ppi is higher than the recommended ppi From 021268696c73f699364fa93f5d6db03e6b1b8426 Mon Sep 17 00:00:00 2001 From: Penguin-Guru Date: Sat, 30 Oct 2021 12:58:32 -0700 Subject: [PATCH 30/40] Adjusted for rebase on typo correction. --- interface/src/PerformanceManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/PerformanceManager.cpp b/interface/src/PerformanceManager.cpp index fc2f3d1a4f..190071724a 100644 --- a/interface/src/PerformanceManager.cpp +++ b/interface/src/PerformanceManager.cpp @@ -113,7 +113,7 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP RenderScriptingInterface::getInstance()->setShadowsEnabled(false); qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::REALTIME); - RenderScriptingInterface::getInstance()->setViewportResolutionScale(recommandedPpiScale); + RenderScriptingInterface::getInstance()->setViewportResolutionScale(recommendedPpiScale); DependencyManager::get()->setWorldDetailQuality(WORLD_DETAIL_LOW); From 8f286205eb2cde78230abcfefc266b4310f6ef54 Mon Sep 17 00:00:00 2001 From: ksuprynowicz Date: Sun, 31 Oct 2021 13:45:40 +0100 Subject: [PATCH 31/40] Added empty CPU architecture variable to Github builds to ensure compatibility --- .github/workflows/master_build.yml | 4 ++-- .github/workflows/pr_build.yml | 8 ++++---- BUILD.md | 4 +++- BUILD_LINUX.md | 2 ++ BUILD_OSX.md | 2 ++ 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/master_build.yml b/.github/workflows/master_build.yml index 8d9844e03c..c4be9234cc 100644 --- a/.github/workflows/master_build.yml +++ b/.github/workflows/master_build.yml @@ -56,7 +56,7 @@ jobs: echo "PYTHON_EXEC=python3" >> $GITHUB_ENV echo "INSTALLER_EXT=tgz" >> $GITHUB_ENV echo "CMAKE_BUILD_EXTRA=-- -j3" >> $GITHUB_ENV - echo "CMAKE_EXTRA=-DBUILD_TOOLS:BOOLEAN=FALSE -DHIFI_PYTHON_EXEC:FILEPATH=$(which python3)" >> $GITHUB_ENV + echo "CMAKE_EXTRA=-DVIRCADIA_CPU_ARCHITECTURE= -DBUILD_TOOLS:BOOLEAN=FALSE -DHIFI_PYTHON_EXEC:FILEPATH=$(which python3)" >> $GITHUB_ENV fi # Mac build variables if [ "${{ matrix.os }}" = "macOS-10.15" ]; then @@ -64,7 +64,7 @@ jobs: echo "ZIP_COMMAND=zip" >> $GITHUB_ENV echo "ZIP_ARGS=-r" >> $GITHUB_ENV echo "INSTALLER_EXT=dmg" >> $GITHUB_ENV - echo "CMAKE_EXTRA=-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=OFF -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib -G Xcode" >> $GITHUB_ENV + echo "CMAKE_EXTRA=-DVIRCADIA_CPU_ARCHITECTURE= -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=OFF -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib -G Xcode" >> $GITHUB_ENV echo "::set-output name=symbols_archive::${BUILD_NUMBER}-${{ matrix.build_type }}-mac-symbols.zip" echo "APP_TARGET_NAME=Vircadia" >> $GITHUB_ENV fi diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index 9bd3f7fb12..3addace0b7 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -75,9 +75,9 @@ jobs: echo "VCPKG_FORCE_SYSTEM_BINARIES=true" >> $GITHUB_ENV fi if [ "${{ matrix.build_type }}" = "full" ]; then - echo "CMAKE_EXTRA=-DBUILD_TOOLS:BOOLEAN=FALSE -DHIFI_PYTHON_EXEC:FILEPATH=$(which python3)" >> $GITHUB_ENV + echo "CMAKE_EXTRA=-DVIRCADIA_CPU_ARCHITECTURE= -DBUILD_TOOLS:BOOLEAN=FALSE -DHIFI_PYTHON_EXEC:FILEPATH=$(which python3)" >> $GITHUB_ENV else - echo "CMAKE_EXTRA=-DCLIENT_ONLY=1 -DBUILD_TOOLS:BOOLEAN=FALSE -DHIFI_PYTHON_EXEC:FILEPATH=$(which python3)" >> $GITHUB_ENV + echo "CMAKE_EXTRA=-DVIRCADIA_CPU_ARCHITECTURE= -DCLIENT_ONLY=1 -DBUILD_TOOLS:BOOLEAN=FALSE -DHIFI_PYTHON_EXEC:FILEPATH=$(which python3)" >> $GITHUB_ENV fi fi # Mac build variables @@ -85,9 +85,9 @@ jobs: echo "PYTHON_EXEC=python3" >> $GITHUB_ENV echo "INSTALLER_EXT=dmg" >> $GITHUB_ENV if [ "${{ matrix.build_type }}" = "full" ]; then - echo "CMAKE_EXTRA=-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=OFF -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib -G Xcode" >> $GITHUB_ENV + echo "CMAKE_EXTRA=-DVIRCADIA_CPU_ARCHITECTURE= -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=OFF -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib -G Xcode" >> $GITHUB_ENV else - echo "CMAKE_EXTRA=-DCLIENT_ONLY=1 -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=OFF -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib -G Xcode" >> $GITHUB_ENV + echo "CMAKE_EXTRA=-DVIRCADIA_CPU_ARCHITECTURE= -DCLIENT_ONLY=1 -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=OFF -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib -G Xcode" >> $GITHUB_ENV fi echo "APP_TARGET_NAME=Vircadia" >> $GITHUB_ENV fi diff --git a/BUILD.md b/BUILD.md index 469d934b95..fd30b124eb 100644 --- a/BUILD.md +++ b/BUILD.md @@ -195,7 +195,9 @@ The following build options can be used when running CMake ### Optimization build options * VIRCADIA_OPTIMIZE - This variable defaults to 1 if not set and enables compiler optimization flags on Linux and MacOS. Setting it to 0 will result in unoptimized build. -* VIRCADIA_CPU_ARCHITECTURE - This variable contains architecture specific compiler flags which are used if `VIRCADIA_OPTIMIZE` is true. If it is not set, it defaults to `-march=native -mtune=native`, which helps yield more performance for locally used build, but for packaging it needs to be set to different value for portability, for example `-msse3`. +* VIRCADIA_CPU_ARCHITECTURE - This variable contains architecture specific compiler flags which are used if `VIRCADIA_OPTIMIZE` is true. If it is not set, it defaults to `-march=native -mtune=native`, which helps yield more performance for locally used build, but for packaging it needs to be set to different value for portability, for example `-msse3`. Setting `VIRCADIA_CPU_ARCHITECTURE` to empty string will use default compiler settings and yield +maximum compatibility. + ### Developer Build Options diff --git a/BUILD_LINUX.md b/BUILD_LINUX.md index 04d8e8b63b..ae0a88a98e 100644 --- a/BUILD_LINUX.md +++ b/BUILD_LINUX.md @@ -177,3 +177,5 @@ CMake variable needs to be set to architecture specific value. It defaults to `-march=native -mtune=native`, which yields builds optimized for particular machine, but builds will not work on machines lacking same CPU instructions. For packaging and AppImage it is recommended to set it to different value, for example `-msse3`. +Setting `VIRCADIA_CPU_ARCHITECTURE` to empty string will use default compiler settings and yield +maximum compatibility. diff --git a/BUILD_OSX.md b/BUILD_OSX.md index e1fb030e39..03106b9354 100644 --- a/BUILD_OSX.md +++ b/BUILD_OSX.md @@ -71,6 +71,8 @@ CMake variable needs to be set to architecture specific value. It defaults to `-march=native -mtune=native`, which yields builds optimized for particular machine, but builds will not work on machines lacking same CPU instructions. For packaging and AppImage it is recommended to set it to different value, for example `-msse3`. +Setting `VIRCADIA_CPU_ARCHITECTURE` to empty string will use default compiler settings and yield +maximum compatibility. ## FAQ From 9221d33ed29a637f9879a2b293b96c9b37202345 Mon Sep 17 00:00:00 2001 From: ksuprynowicz Date: Sun, 31 Oct 2021 19:59:48 +0100 Subject: [PATCH 32/40] Fixed build flags for MacOS --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 20354b7a6c..160e39ae5a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,6 +96,7 @@ if( NOT WIN32 ) file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/_env/VIRCADIA_OPTIMIZE.txt" "${VIRCADIA_OPTIMIZE}") if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") message("Clang compiler detected, adding -O3 -fPIC flags") + set(VIRCADIA_OPTIMIZE_FLAGS "-O3 -fPIC") elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU") message("GCC compiler detected, adding -O3 -fPIC flags") set(VIRCADIA_OPTIMIZE_FLAGS "-O3 -fPIC") From a94541d7e908d87c55d5fa338386dd3b6e707d9b Mon Sep 17 00:00:00 2001 From: ksuprynowicz Date: Mon, 1 Nov 2021 13:15:45 +0100 Subject: [PATCH 33/40] Added debug flags --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 160e39ae5a..aaafe2b3fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,11 +95,11 @@ if( NOT WIN32 ) file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/_env/VIRCADIA_OPTIMIZE.txt" "${VIRCADIA_OPTIMIZE}") if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - message("Clang compiler detected, adding -O3 -fPIC flags") - set(VIRCADIA_OPTIMIZE_FLAGS "-O3 -fPIC") + message("Clang compiler detected, adding -O3 -fPIC -g flags") + set(VIRCADIA_OPTIMIZE_FLAGS "-O3 -fPIC -g") elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU") - message("GCC compiler detected, adding -O3 -fPIC flags") - set(VIRCADIA_OPTIMIZE_FLAGS "-O3 -fPIC") + message("GCC compiler detected, adding -O3 -fPIC -ggdb flags") + set(VIRCADIA_OPTIMIZE_FLAGS "-O3 -fPIC -ggdb") else() message("No predefined optimization flags for compiler ${CMAKE_CXX_COMPILER_ID}") endif() From 5759c76154377618f667b338b059266c399092c0 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Wed, 3 Nov 2021 01:12:48 +0100 Subject: [PATCH 34/40] Fix mime type for .htm and .html files The code forces text/html for .shtml files, but if .html ones were used, it would look up in the mime database and come up with application/x-extension-html Web browsers try downloading that instead of rendering it. --- .../embedded-webserver/src/HTTPManager.cpp | 59 ++++++++++--------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/libraries/embedded-webserver/src/HTTPManager.cpp b/libraries/embedded-webserver/src/HTTPManager.cpp index ccebeaf9cc..6692d7a839 100644 --- a/libraries/embedded-webserver/src/HTTPManager.cpp +++ b/libraries/embedded-webserver/src/HTTPManager.cpp @@ -31,7 +31,7 @@ HTTPManager::HTTPManager(const QHostAddress& listenAddress, quint16 port, const _port(port) { bindSocket(); - + _isListeningTimer = new QTimer(this); connect(_isListeningTimer, &QTimer::timeout, this, &HTTPManager::isTcpServerListening); _isListeningTimer->start(SOCKET_CHECK_INTERVAL_IN_MS); @@ -39,7 +39,7 @@ HTTPManager::HTTPManager(const QHostAddress& listenAddress, quint16 port, const void HTTPManager::incomingConnection(qintptr socketDescriptor) { QTcpSocket* socket = new QTcpSocket(this); - + if (socket->setSocketDescriptor(socketDescriptor)) { new HTTPConnection(socket, this); } else { @@ -60,7 +60,7 @@ bool HTTPManager::handleHTTPRequest(HTTPConnection* connection, const QUrl& url, // so we don't need to attempt to do so in the document root return true; } - + if (!_documentRoot.isEmpty()) { // check to see if there is a file to serve from the document root for this path QString subPath = url.path(); @@ -88,22 +88,22 @@ bool HTTPManager::handleHTTPRequest(HTTPConnection* connection, const QUrl& url, // this could be a directory with a trailing slash // send a redirect to the path with a slash so we can QString redirectLocation = '/' + subPath + '/'; - + if (!url.query().isEmpty()) { redirectLocation += "?" + url.query(); } - + QHash redirectHeader; redirectHeader.insert(QByteArray("Location"), redirectLocation.toUtf8()); - + connection->respond(HTTPConnection::StatusCode302, "", HTTPConnection::DefaultContentType, redirectHeader); return true; } - + // if the last thing is a trailing slash then we want to look for index file if (subPath.endsWith('/') || subPath.size() == 0) { QStringList possibleIndexFiles = QStringList() << "index.html" << "index.shtml"; - + foreach (const QString& possibleIndexFilename, possibleIndexFiles) { if (QFileInfo(absoluteFilePath + possibleIndexFilename).exists()) { filePath = absoluteFilePath + possibleIndexFilename; @@ -111,64 +111,65 @@ bool HTTPManager::handleHTTPRequest(HTTPConnection* connection, const QUrl& url, } } } - + if (!filePath.isEmpty()) { // file exists, serve it static QMimeDatabase mimeDatabase; - + auto localFile = std::unique_ptr(new QFile(filePath)); localFile->open(QIODevice::ReadOnly); QByteArray localFileData; - + QFileInfo localFileInfo(filePath); - + if (localFileInfo.completeSuffix() == "shtml") { localFileData = localFile->readAll(); // this is a file that may have some SSI statements // the only thing we support is the include directive, but check the contents for that - + // setup our static QRegExp that will catch and directives const QString includeRegExpString = ""; QRegExp includeRegExp(includeRegExpString); - + int matchPosition = 0; - + QString localFileString(localFileData); - + while ((matchPosition = includeRegExp.indexIn(localFileString, matchPosition)) != -1) { // check if this is a file or vitual include bool isFileInclude = includeRegExp.cap(1) == "file"; - + // setup the correct file path for the included file QString includeFilePath = isFileInclude ? localFileInfo.canonicalPath() + "/" + includeRegExp.cap(2) : _documentRoot + includeRegExp.cap(2); - + QString replacementString; - + if (QFileInfo(includeFilePath).isFile()) { - + QFile includedFile(includeFilePath); includedFile.open(QIODevice::ReadOnly); - + replacementString = QString(includedFile.readAll()); } else { qCDebug(embeddedwebserver) << "SSI include directive referenced a missing file:" << includeFilePath; } - + // replace the match with the contents of the file, or an empty string if the file was not found localFileString.replace(matchPosition, includeRegExp.matchedLength(), replacementString); - + // push the match position forward so we can check the next match matchPosition += includeRegExp.matchedLength(); } - + localFileData = localFileString.toLocal8Bit(); } // if this is an shtml file just make the MIME type match HTML so browsers aren't confused // otherwise use the mimeDatabase to look it up - auto mimeType = localFileInfo.suffix() == "shtml" + auto suffix = localFileInfo.suffix(); + auto mimeType = (suffix == "shtml" || suffix == "html" || suffix == "htm") ? QString { "text/html" } : mimeDatabase.mimeTypeForFile(filePath).name(); @@ -181,10 +182,10 @@ bool HTTPManager::handleHTTPRequest(HTTPConnection* connection, const QUrl& url, return true; } } - + // respond with a 404 connection->respond(HTTPConnection::StatusCode404, "Resource not found."); - + return true; } @@ -201,10 +202,10 @@ void HTTPManager::isTcpServerListening() { bool HTTPManager::bindSocket() { qCDebug(embeddedwebserver) << "Attempting to bind TCP socket on port " << QString::number(_port); - + if (listen(_listenAddress, _port)) { qCDebug(embeddedwebserver) << "TCP socket is listening on" << serverAddress() << "and port" << serverPort(); - + return true; } else { QString errorMessage = "Failed to open HTTP server socket: " + errorString() + ", can't continue"; From 2eabd40215fde7d1cb786403c578a851c71daf8e Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Thu, 4 Nov 2021 18:43:39 +0100 Subject: [PATCH 35/40] Require OpenSSL 1.1.0 at the very least Earlier versions don't work with WebRTC, and cause linking errors. OpenSSL 1.1 is supported in Ubuntu 18.04, although 1.0 can still be installed. --- ice-server/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ice-server/CMakeLists.txt b/ice-server/CMakeLists.txt index 9234d68faf..eed795ca39 100644 --- a/ice-server/CMakeLists.txt +++ b/ice-server/CMakeLists.txt @@ -8,7 +8,7 @@ link_hifi_libraries(embedded-webserver networking shared) package_libraries_for_deployment() # find OpenSSL -find_package(OpenSSL REQUIRED) +find_package(OpenSSL 1.1.0 REQUIRED) if (APPLE AND ${OPENSSL_INCLUDE_DIR} STREQUAL "/usr/include") # this is a user on OS X using system OpenSSL, which is going to throw warnings since they're deprecating for their common crypto From 732b32b68ee6e452ee92b7853c7cd0708dc4be2c Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Thu, 4 Nov 2021 18:54:35 +0100 Subject: [PATCH 36/40] Require OpenSSL 1.1.0 in all other parts of the build --- cmake/macros/TargetOpenSSL.cmake | 2 +- launchers/qt/CMakeLists.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/macros/TargetOpenSSL.cmake b/cmake/macros/TargetOpenSSL.cmake index f74015201d..faf5116a25 100644 --- a/cmake/macros/TargetOpenSSL.cmake +++ b/cmake/macros/TargetOpenSSL.cmake @@ -12,7 +12,7 @@ macro(TARGET_OPENSSL) set(OPENSSL_LIBRARIES "${OPENSSL_INSTALL_DIR}/lib/libcrypto.a;${OPENSSL_INSTALL_DIR}/lib/libssl.a" CACHE STRING INTERNAL) else() # using VCPKG for OpenSSL - find_package(OpenSSL REQUIRED) + find_package(OpenSSL 1.1.0 REQUIRED) endif() include_directories(SYSTEM "${OPENSSL_INCLUDE_DIR}") diff --git a/launchers/qt/CMakeLists.txt b/launchers/qt/CMakeLists.txt index 400615be90..a472c670bb 100644 --- a/launchers/qt/CMakeLists.txt +++ b/launchers/qt/CMakeLists.txt @@ -69,7 +69,7 @@ if (WIN32) set(OPENSSL_ROOT_DIR ${SSL_DIR}) message("SSL dir is ${SSL_DIR}") set(OPENSSL_USE_STATIC_LIBS TRUE) - find_package(OpenSSL REQUIRED) + find_package(OpenSSL 1.1.0 REQUIRED) message("-- Found OpenSSL Libs ${OPENSSL_LIBRARIES}") @@ -105,7 +105,7 @@ endif() if (APPLE) set(OPENSSL_USE_STATIC_LIBS TRUE) - find_package(OpenSSL REQUIRED) + find_package(OpenSSL 1.1.0 REQUIRED) endif() find_package(Qt5 COMPONENTS Core Gui Qml Quick QuickControls2 Network REQUIRED) From 7fac5dd8b84235b78d8e8316e967a2700ef4f1a9 Mon Sep 17 00:00:00 2001 From: namark Date: Fri, 5 Nov 2021 00:16:59 +0400 Subject: [PATCH 37/40] Preserving _requestContent invariant in HTTPConnection class, in the case when Content-Length header is empty, to avoid null dereference in the requestContent() getter. --- libraries/embedded-webserver/src/HTTPConnection.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/embedded-webserver/src/HTTPConnection.cpp b/libraries/embedded-webserver/src/HTTPConnection.cpp index f5f0fe0289..a386fc7535 100644 --- a/libraries/embedded-webserver/src/HTTPConnection.cpp +++ b/libraries/embedded-webserver/src/HTTPConnection.cpp @@ -338,6 +338,7 @@ void HTTPConnection::readHeaders() { QByteArray clength = requestHeader("Content-Length"); if (clength.isEmpty()) { + _requestContent = MemoryStorage::make(0); _parentManager->handleHTTPRequest(this, _requestUrl); } else { From b4727adecc5c0880fc1ff7605fcf909b8e6e8b41 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Thu, 4 Nov 2021 23:53:56 +0100 Subject: [PATCH 38/40] Update comment as per review --- libraries/embedded-webserver/src/HTTPManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/embedded-webserver/src/HTTPManager.cpp b/libraries/embedded-webserver/src/HTTPManager.cpp index 6692d7a839..c89c46bd82 100644 --- a/libraries/embedded-webserver/src/HTTPManager.cpp +++ b/libraries/embedded-webserver/src/HTTPManager.cpp @@ -166,7 +166,7 @@ bool HTTPManager::handleHTTPRequest(HTTPConnection* connection, const QUrl& url, localFileData = localFileString.toLocal8Bit(); } - // if this is an shtml file just make the MIME type match HTML so browsers aren't confused + // if this is an shtml, html or htm file just make the MIME type match HTML so browsers aren't confused // otherwise use the mimeDatabase to look it up auto suffix = localFileInfo.suffix(); auto mimeType = (suffix == "shtml" || suffix == "html" || suffix == "htm") From e109b202bada7d433c2b7f5acdcff2e0a1fa532b Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Sat, 13 Nov 2021 00:02:36 -0500 Subject: [PATCH 39/40] Entity List: Indicator for Client and Server Scripts In the Entity List, there is a column to indicate the presence of script on an entity. Before that modification, it was only present for entities having a Client Script. Now it will be present if there is a Client and/or Server Script. --- scripts/system/create/entityList/entityList.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/system/create/entityList/entityList.js b/scripts/system/create/entityList/entityList.js index 02cd9a14ca..aa4f7eb218 100644 --- a/scripts/system/create/entityList/entityList.js +++ b/scripts/system/create/entityList/entityList.js @@ -203,8 +203,8 @@ EntityListTool = function(shouldUseEditTabletApp) { var cameraPosition = Camera.position; PROFILE("getMultipleProperties", function () { var multipleProperties = Entities.getMultipleEntityProperties(ids, ['position', 'name', 'type', 'locked', - 'visible', 'renderInfo', 'modelURL', 'materialURL', 'imageURL', 'script', 'certificateID', - 'skybox.url', 'ambientLight.url', 'created', 'lastEdited']); + 'visible', 'renderInfo', 'modelURL', 'materialURL', 'imageURL', 'script', 'serverScripts', + 'certificateID', 'skybox.url', 'ambientLight.url', 'created', 'lastEdited']); for (var i = 0; i < multipleProperties.length; i++) { var properties = multipleProperties[i]; @@ -247,7 +247,7 @@ EntityListTool = function(shouldUseEditTabletApp) { isBaked: entityIsBaked(properties), drawCalls: (properties.renderInfo !== undefined ? valueIfDefined(properties.renderInfo.drawCalls) : ""), - hasScript: properties.script !== "", + hasScript: (properties.script !== "" || properties.serverScripts !== ""), parentState: parentState, created: formatToStringDateTime(properties.created), lastEdited: formatToStringDateTime(properties.lastEdited) From 36f922dfc92471c3bea2d355787b716e6ea78758 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 13 Nov 2021 19:54:16 +0000 Subject: [PATCH 40/40] Bump postcss from 7.0.32 to 7.0.39 in /scripts/system/inventory Bumps [postcss](https://github.com/postcss/postcss) from 7.0.32 to 7.0.39. - [Release notes](https://github.com/postcss/postcss/releases) - [Changelog](https://github.com/postcss/postcss/blob/7.0.39/CHANGELOG.md) - [Commits](https://github.com/postcss/postcss/compare/7.0.32...7.0.39) --- updated-dependencies: - dependency-name: postcss dependency-type: indirect ... Signed-off-by: dependabot[bot] --- scripts/system/inventory/package-lock.json | 26 +++++++++------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/scripts/system/inventory/package-lock.json b/scripts/system/inventory/package-lock.json index 78a14492c7..f7132eb5dc 100644 --- a/scripts/system/inventory/package-lock.json +++ b/scripts/system/inventory/package-lock.json @@ -9228,6 +9228,12 @@ "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", "dev": true }, + "picocolors": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-0.2.1.tgz", + "integrity": "sha512-cMlDqaLEqfSaW8Z7N5Jw+lyIW869EzT73/F5lhtY9cLGoVxSXznfgfXMO0Z5K0o0Q2TkTXq+0KFsdnSe3jDViA==", + "dev": true + }, "picomatch": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", @@ -9302,14 +9308,13 @@ "dev": true }, "postcss": { - "version": "7.0.32", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.32.tgz", - "integrity": "sha512-03eXong5NLnNCD05xscnGKGDZ98CyzoqPSMjOe6SuoQY7Z2hIj0Ld1g/O/UQRuOle2aRtiIRDg9tDcTGAkLfKw==", + "version": "7.0.39", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.39.tgz", + "integrity": "sha512-yioayjNbHn6z1/Bywyb2Y4s3yvDAeXGOyxqD+LnVOinq6Mdmd++SW2wUNVzavyyHxd6+DxzWGIuosg6P1Rj8uA==", "dev": true, "requires": { - "chalk": "^2.4.2", - "source-map": "^0.6.1", - "supports-color": "^6.1.0" + "picocolors": "^0.2.1", + "source-map": "^0.6.1" }, "dependencies": { "source-map": { @@ -9317,15 +9322,6 @@ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true - }, - "supports-color": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", - "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } } } },