From ca460e2b0d8b8f743140d236f66f0f0c587d91b1 Mon Sep 17 00:00:00 2001 From: Mounir Tohami Date: Fri, 20 Dec 2024 05:17:16 +0200 Subject: [PATCH] Add PixelEngine --- .github/workflows/android_builds.yml | 55 +++-- .github/workflows/ios_builds.yml | 23 +- .github/workflows/linux_builds.yml | 222 +++++++----------- .github/workflows/macos_builds.yml | 46 ++-- .github/workflows/runner.yml | 14 +- .github/workflows/web_builds.yml | 30 ++- .github/workflows/windows_builds.yml | 59 ++--- .pre-commit-config.yaml | 3 +- AUTHORS.md | 4 + SConstruct | 37 +-- core/SCsub | 3 + core/config/engine.cpp | 3 + core/config/project_settings.cpp | 70 ++++-- core/config/project_settings.h | 2 + core/version.h | 1 + .../pulseaudio/audio_driver_pulseaudio.cpp | 4 + drivers/unix/os_unix.cpp | 5 +- .../rendering_context_driver_vulkan.cpp | 8 + main/main.cpp | 60 ++++- methods.py | 11 +- modules/mono/utils/path_utils.cpp | 4 + modules/openxr/openxr_api.cpp | 12 +- pixel/SCsub | 12 + pixel/main_tree.cpp | 49 ++++ pixel/main_tree.h | 46 ++++ platform/linuxbsd/SCsub | 4 +- platform/linuxbsd/freedesktop_screensaver.cpp | 8 +- platform/linuxbsd/tts_linux.cpp | 5 + .../wayland/display_server_wayland.cpp | 4 + platform/linuxbsd/x11/display_server_x11.cpp | 4 + platform/macos/SCsub | 5 +- platform/macos/display_server_macos.mm | 4 + platform/web/SCsub | 9 +- platform/web/emscripten_helpers.py | 8 +- platform/web/os_web.cpp | 4 + platform/windows/SCsub | 6 +- platform/windows/display_server_windows.cpp | 16 +- .../windows/gl_manager_windows_native.cpp | 4 + platform/windows/os_windows.cpp | 4 + platform_methods.py | 4 +- scene/gui/control.cpp | 10 + scene/main/scene_tree.cpp | 2 + scene/main/window.cpp | 12 +- scene/register_scene_types.cpp | 2 + servers/audio_server.cpp | 2 + servers/movie_writer/movie_writer.cpp | 4 + version.py | 7 +- 47 files changed, 599 insertions(+), 312 deletions(-) create mode 100644 pixel/SCsub create mode 100644 pixel/main_tree.cpp create mode 100644 pixel/main_tree.h diff --git a/.github/workflows/android_builds.yml b/.github/workflows/android_builds.yml index 2803ff4b5e88..cbc337dd92d1 100644 --- a/.github/workflows/android_builds.yml +++ b/.github/workflows/android_builds.yml @@ -6,7 +6,7 @@ on: env: # Used for the cache key. Add version suffix to force clean build. GODOT_BASE_BRANCH: master - SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no module_text_server_fb_enabled=yes strict_checks=yes + SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no strict_checks=yes concurrency: group: ci-${{ github.actor }}-${{ github.head_ref || github.run_number }}-${{ github.ref }}-android @@ -14,30 +14,37 @@ concurrency: jobs: build-android: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest name: ${{ matrix.name }} strategy: fail-fast: false matrix: include: - - name: Editor (target=editor) - cache-name: android-editor - target: editor + - name: Pixel Debug (arch=arm32) + cache-name: android_pixel_debug_arm32 + target: pixel_debug tests: false - sconsflags: arch=arm64 production=yes swappy=yes + sconsflags: arch=arm32 swappy=yes cache-limit: 1 - - name: Template arm32 (target=template_release, arch=arm32) - cache-name: android-template-arm32 - target: template_release + - name: Pixel Release (arch=arm32) + cache-name: android_pixel_release_arm32 + target: pixel_release tests: false sconsflags: arch=arm32 swappy=yes cache-limit: 1 - - name: Template arm64 (target=template_release, arch=arm64) - cache-name: android-template-arm64 - target: template_release - tests: false + - name: Pixel Debug (arch=arm64) + cache-name: android_pixel_debug_arm64 + target: pixel_debug + # tests: false + sconsflags: arch=arm64 swappy=yes + cache-limit: 1 + + - name: Pixel Release (arch=arm64) + cache-name: android_pixel_release_arm64 + target: pixel_release + # tests: false sconsflags: arch=arm64 swappy=yes cache-limit: 1 @@ -79,7 +86,7 @@ jobs: sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }} platform: android target: ${{ matrix.target }} - tests: ${{ matrix.tests }} + # tests: ${{ matrix.tests }} scons-cache-limit: ${{ matrix.cache-limit }} - name: Save Godot build cache @@ -88,22 +95,22 @@ jobs: cache-name: ${{ matrix.cache-name }} continue-on-error: true - - name: Generate Godot templates - if: matrix.target == 'template_release' - run: | - cd platform/android/java - ./gradlew generateGodotTemplates - cd ../../.. - ls -l bin/ + # - name: Generate Godot templates + # if: matrix.target == 'template_release' + # run: | + # cd platform/android/java + # ./gradlew generateGodotTemplates + # cd ../../.. + # ls -l bin/ - name: Generate Godot editor - if: matrix.target == 'editor' run: | cd platform/android/java ./gradlew generateGodotEditor - ./gradlew generateGodotHorizonOSEditor cd ../../.. - ls -l bin/android_editor_builds/ + cd bin + rm *.zip + rm *.aar - name: Upload artifact uses: ./.github/actions/upload-artifact diff --git a/.github/workflows/ios_builds.yml b/.github/workflows/ios_builds.yml index 270204ebe507..d1ce268b8f21 100644 --- a/.github/workflows/ios_builds.yml +++ b/.github/workflows/ios_builds.yml @@ -6,16 +6,29 @@ on: env: # Used for the cache key. Add version suffix to force clean build. GODOT_BASE_BRANCH: master - SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no module_text_server_fb_enabled=yes strict_checks=yes + SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no strict_checks=yes concurrency: group: ci-${{ github.actor }}-${{ github.head_ref || github.run_number }}-${{ github.ref }}-ios cancel-in-progress: true jobs: - ios-template: + build-ios: runs-on: macos-latest - name: Template (target=template_release) + name: ${{ matrix.name }} + strategy: + fail-fast: false + matrix: + include: + - name: Pixel Debug + cache-name: ios_pixel_engine_debug + target: pixel_debug + cache-limit: 2 + + - name: Pixel Release + cache-name: ios_pixel_engine_release + target: pixel_release + cache-limit: 2 steps: - name: Checkout @@ -35,7 +48,7 @@ jobs: with: sconsflags: ${{ env.SCONSFLAGS }} platform: ios - target: template_release + target: ${{ matrix.target }} tests: false scons-cache-limit: 1 @@ -45,3 +58,5 @@ jobs: - name: Upload artifact uses: ./.github/actions/upload-artifact + with: + name: ${{ matrix.cache-name }} diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml index 193942a1bb3a..917fa782ac35 100644 --- a/.github/workflows/linux_builds.yml +++ b/.github/workflows/linux_builds.yml @@ -6,7 +6,7 @@ on: env: # Used for the cache key. Add version suffix to force clean build. GODOT_BASE_BRANCH: master - SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes strict_checks=yes + SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no strict_checks=yes DOTNET_NOLOGO: true DOTNET_CLI_TELEMETRY_OPTOUT: true TSAN_OPTIONS: suppressions=misc/error_suppressions/tsan.txt @@ -19,82 +19,26 @@ concurrency: jobs: build-linux: # Stay one LTS before latest to increase portability of Linux artifacts. - runs-on: ubuntu-22.04 + runs-on: ubuntu-20.04 name: ${{ matrix.name }} strategy: fail-fast: false matrix: include: - - name: Editor w/ Mono (target=editor) - cache-name: linux-editor-mono - target: editor - sconsflags: module_mono_enabled=yes - bin: ./bin/godot.linuxbsd.editor.x86_64.mono - build-mono: true - tests: false # Disabled due freeze caused by mix Mono build and CI - doc-test: true - proj-conv: true - api-compat: true + - name: Pixel Debug + cache-name: linux_pixel_engine_debug + target: pixel_debug + # bin: ./bin/pixel.linuxbsd.pixel_debug.x86_64 artifact: true cache-limit: 1 - - name: Editor with doubles and GCC sanitizers (target=editor, tests=yes, dev_build=yes, scu_build=yes, precision=double, use_asan=yes, use_ubsan=yes, linker=gold) - cache-name: linux-editor-double-sanitizers - target: editor - # Debug symbols disabled as they're huge on this build and we hit the 14 GB limit for runners. - sconsflags: dev_build=yes scu_build=yes debug_symbols=no precision=double use_asan=yes use_ubsan=yes linker=gold - bin: ./bin/godot.linuxbsd.editor.dev.double.x86_64.san - build-mono: false - tests: true - proj-test: true - # Generate an API dump for godot-cpp tests. - api-dump: true - # Skip 2GiB artifact speeding up action. - artifact: false - cache-limit: 7 - - - name: Editor with clang sanitizers (target=editor, tests=yes, dev_build=yes, use_asan=yes, use_ubsan=yes, use_llvm=yes, linker=lld) - cache-name: linux-editor-llvm-sanitizers - target: editor - sconsflags: dev_build=yes use_asan=yes use_ubsan=yes use_llvm=yes linker=lld - bin: ./bin/godot.linuxbsd.editor.dev.x86_64.llvm.san - build-mono: false - tests: true - # Skip 2GiB artifact speeding up action. - artifact: false - # Test our oldest supported SCons/Python versions on one arbitrary editor build. - legacy-scons: true - cache-limit: 7 - - - name: Editor with ThreadSanitizer (target=editor, tests=yes, dev_build=yes, use_tsan=yes, use_llvm=yes, linker=lld) - cache-name: linux-editor-thread-sanitizer - target: editor - tests: true - sconsflags: dev_build=yes use_tsan=yes use_llvm=yes linker=lld - bin: ./bin/godot.linuxbsd.editor.dev.x86_64.llvm.san - build-mono: false - # Skip 2GiB artifact speeding up action. - artifact: false - cache-limit: 5 - - - name: Template w/ Mono (target=template_release, tests=yes) - cache-name: linux-template-mono - target: template_release - sconsflags: module_mono_enabled=yes - bin: ./bin/godot.linuxbsd.template_release.x86_64.mono - build-mono: false - tests: true + - name: Pixel Release + cache-name: linux_pixel_engine_release + target: pixel_debug + # bin: ./bin/pixel.linuxbsd.pixel_release.x86_64 artifact: true cache-limit: 1 - - name: Minimal template (target=template_release, tests=yes, everything disabled) - cache-name: linux-template-minimal - target: template_release - sconsflags: modules_enabled_by_default=no disable_3d=yes disable_advanced_gui=yes deprecated=no minizip=no - bin: ./bin/godot.linuxbsd.template_release.x86_64 - tests: true - artifact: true - cache-limit: 1 steps: - name: Checkout @@ -102,14 +46,14 @@ jobs: with: submodules: recursive - # Need newer mesa for lavapipe to work properly. - - name: Linux dependencies for tests - if: matrix.proj-test - run: | - sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EB8B81E14DA65431D7504EA8F63F0F2B90935439 - sudo add-apt-repository "deb https://ppa.launchpadcontent.net/kisak/turtle/ubuntu ${{ matrix.os == 'ubuntu-20.04' && 'focal' || 'jammy' }} main" - sudo apt-get install -qq mesa-vulkan-drivers + # # Need newer mesa for lavapipe to work properly. + # - name: Linux dependencies for tests + # if: matrix.proj-test + # run: | + # sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list + # sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EB8B81E14DA65431D7504EA8F63F0F2B90935439 + # sudo add-apt-repository "deb https://ppa.launchpadcontent.net/kisak/turtle/ubuntu ${{ matrix.os == 'ubuntu-20.04' && 'focal' || 'jammy' }} main" + # sudo apt-get install -qq mesa-vulkan-drivers # TODO: Figure out somehow how to embed this one. - name: wayland-scanner dependency @@ -132,21 +76,21 @@ jobs: if: '!matrix.legacy-scons' uses: ./.github/actions/godot-deps - - name: Setup Python and SCons (legacy versions) - if: matrix.legacy-scons - uses: ./.github/actions/godot-deps - with: - # Sync with Ensure*Version in SConstruct. - python-version: 3.8 - scons-version: 4.0 + # - name: Setup Python and SCons (legacy versions) + # if: matrix.legacy-scons + # uses: ./.github/actions/godot-deps + # with: + # # Sync with Ensure*Version in SConstruct. + # python-version: 3.8 + # scons-version: 4.0 - name: Compilation uses: ./.github/actions/godot-build with: - sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }} + sconsflags: ${{ env.SCONSFLAGS }} platform: linuxbsd target: ${{ matrix.target }} - tests: ${{ matrix.tests }} + # tests: ${{ matrix.tests }} scons-cache-limit: ${{ matrix.cache-limit }} - name: Save Godot build cache @@ -155,21 +99,21 @@ jobs: cache-name: ${{ matrix.cache-name }} continue-on-error: true - - name: Generate C# glue - if: matrix.build-mono - run: | - ${{ matrix.bin }} --headless --generate-mono-glue ./modules/mono/glue + # - name: Generate C# glue + # if: matrix.build-mono + # run: | + # ${{ matrix.bin }} --headless --generate-mono-glue ./modules/mono/glue - - name: Build .NET solutions - if: matrix.build-mono - run: | - ./modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --godot-platform=linuxbsd + # - name: Build .NET solutions + # if: matrix.build-mono + # run: | + # ./modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --godot-platform=linuxbsd - name: Prepare artifact if: matrix.artifact run: | - strip bin/godot.* - chmod +x bin/godot.* + strip bin/pixel.* + chmod +x bin/pixel.* - name: Upload artifact uses: ./.github/actions/upload-artifact @@ -177,49 +121,49 @@ jobs: with: name: ${{ matrix.cache-name }} - - name: Dump Godot API - uses: ./.github/actions/godot-api-dump - if: matrix.api-dump - with: - bin: ${{ matrix.bin }} - - - name: Unit tests - if: matrix.tests - run: | - ${{ matrix.bin }} --version - ${{ matrix.bin }} --help - ${{ matrix.bin }} --headless --test --force-colors - - - name: .NET source generators tests - if: matrix.build-mono - run: | - dotnet test modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests - - # Check class reference - - name: Check for class reference updates - if: matrix.doc-test - run: | - echo "Running --doctool to see if this changes the public API without updating the documentation." - echo -e "If a diff is shown, it means that your code/doc changes are incomplete and you should update the class reference with --doctool.\n\n" - ${{ matrix.bin }} --doctool --headless 2>&1 > /dev/null || true - git diff --color --exit-code && ! git ls-files --others --exclude-standard | sed -e 's/^/New doc file missing in PR: /' | grep 'xml$' - - # Check API backwards compatibility - - name: Check for GDExtension compatibility - if: matrix.api-compat - run: | - ./misc/scripts/validate_extension_api.sh "${{ matrix.bin }}" - - # Download and run the test project - - name: Test Godot project - uses: ./.github/actions/godot-project-test - if: matrix.proj-test - with: - bin: ${{ matrix.bin }} - - # Test the project converter - - name: Test project converter - uses: ./.github/actions/godot-converter-test - if: matrix.proj-conv - with: - bin: ${{ matrix.bin }} + # - name: Dump Godot API + # uses: ./.github/actions/godot-api-dump + # if: matrix.api-dump + # with: + # bin: ${{ matrix.bin }} + + # - name: Unit tests + # if: matrix.tests + # run: | + # ${{ matrix.bin }} --version + # ${{ matrix.bin }} --help + # ${{ matrix.bin }} --headless --test --force-colors + + # - name: .NET source generators tests + # if: matrix.build-mono + # run: | + # dotnet test modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests + + # # Check class reference + # - name: Check for class reference updates + # if: matrix.doc-test + # run: | + # echo "Running --doctool to see if this changes the public API without updating the documentation." + # echo -e "If a diff is shown, it means that your code/doc changes are incomplete and you should update the class reference with --doctool.\n\n" + # ${{ matrix.bin }} --doctool --headless 2>&1 > /dev/null || true + # git diff --color --exit-code && ! git ls-files --others --exclude-standard | sed -e 's/^/New doc file missing in PR: /' | grep 'xml$' + + # # Check API backwards compatibility + # - name: Check for GDExtension compatibility + # if: matrix.api-compat + # run: | + # ./misc/scripts/validate_extension_api.sh "${{ matrix.bin }}" + + # # Download and run the test project + # - name: Test Godot project + # uses: ./.github/actions/godot-project-test + # if: matrix.proj-test + # with: + # bin: ${{ matrix.bin }} + + # # Test the project converter + # - name: Test project converter + # uses: ./.github/actions/godot-converter-test + # if: matrix.proj-conv + # with: + # bin: ${{ matrix.bin }} diff --git a/.github/workflows/macos_builds.yml b/.github/workflows/macos_builds.yml index 3fedc2a5c9a9..0b641079e7a6 100644 --- a/.github/workflows/macos_builds.yml +++ b/.github/workflows/macos_builds.yml @@ -6,7 +6,7 @@ on: env: # Used for the cache key. Add version suffix to force clean build. GODOT_BASE_BRANCH: master - SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes strict_checks=yes + SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no strict_checks=yes concurrency: group: ci-${{ github.actor }}-${{ github.head_ref || github.run_number }}-${{ github.ref }}-macos @@ -20,19 +20,17 @@ jobs: fail-fast: false matrix: include: - - name: Editor (target=editor, tests=yes) - cache-name: macos-editor - target: editor - tests: true - bin: ./bin/godot.macos.editor.universal + - name: Pixel Debug + cache-name: macos_pixel_engine_debug + target: pixel_debug + # bin: ./bin/pixel.macos.pixel_debug.universal cache-limit: 1 - - name: Template (target=template_release, tests=yes) - cache-name: macos-template - target: template_release - tests: true + - name: Pixel Release + cache-name: macos_pixel_engine_release + target: pixel_release sconsflags: debug_symbols=no - bin: ./bin/godot.macos.template_release.universal + # bin: ./bin/pixel.macos.pixel_release.universal cache-limit: 1 steps: @@ -60,8 +58,7 @@ jobs: sconsflags: ${{ env.SCONSFLAGS }} arch=x86_64 platform: macos target: ${{ matrix.target }} - tests: ${{ matrix.tests }} - scons-cache-limit: 0 # Only cap on second run to avoid purging unnecessarily + # tests: ${{ matrix.tests }} - name: Compilation (arm64) uses: ./.github/actions/godot-build @@ -69,8 +66,7 @@ jobs: sconsflags: ${{ env.SCONSFLAGS }} arch=arm64 platform: macos target: ${{ matrix.target }} - tests: ${{ matrix.tests }} - scons-cache-limit: ${{ matrix.cache-limit }} + # tests: ${{ matrix.tests }} - name: Save Godot build cache uses: ./.github/actions/godot-cache-save @@ -80,19 +76,19 @@ jobs: - name: Prepare artifact run: | - lipo -create ./bin/godot.macos.${{ matrix.target }}.x86_64 ./bin/godot.macos.${{ matrix.target }}.arm64 -output ./bin/godot.macos.${{ matrix.target }}.universal - rm ./bin/godot.macos.${{ matrix.target }}.x86_64 ./bin/godot.macos.${{ matrix.target }}.arm64 - strip bin/godot.* - chmod +x bin/godot.* + lipo -create ./bin/pixel.macos.${{ matrix.target }}.x86_64 ./bin/pixel.macos.${{ matrix.target }}.arm64 -output ./bin/pixel.macos.${{ matrix.target }}.universal + rm ./bin/pixel.macos.${{ matrix.target }}.x86_64 ./bin/pixel.macos.${{ matrix.target }}.arm64 + strip bin/pixel.* + chmod +x bin/pixel.* - name: Upload artifact uses: ./.github/actions/upload-artifact with: name: ${{ matrix.cache-name }} - - name: Unit tests - if: matrix.tests - run: | - ${{ matrix.bin }} --version - ${{ matrix.bin }} --help - ${{ matrix.bin }} --test --force-colors + # - name: Unit tests + # if: matrix.tests + # run: | + # ${{ matrix.bin }} --version + # ${{ matrix.bin }} --help + # ${{ matrix.bin }} --test --force-colors diff --git a/.github/workflows/runner.yml b/.github/workflows/runner.yml index fd5e74b914ad..767fbb0dc15b 100644 --- a/.github/workflows/runner.yml +++ b/.github/workflows/runner.yml @@ -49,10 +49,10 @@ jobs: # Can be turned off for PRs that intentionally break compat with godot-cpp, # until both the upstream PR and the matching godot-cpp changes are merged. - godot-cpp-test: - name: 🪲 Godot CPP - # This can be changed to depend on another platform, if we decide to use it for - # godot-cpp instead. Make sure to move the .github/actions/godot-api-dump step - # appropriately. - needs: linux-build - uses: ./.github/workflows/godot_cpp_test.yml + # godot-cpp-test: + # name: 🪲 Godot CPP + # # This can be changed to depend on another platform, if we decide to use it for + # # godot-cpp instead. Make sure to move the .github/actions/godot-api-dump step + # # appropriately. + # needs: linux-build + # uses: ./.github/workflows/godot_cpp_test.yml diff --git a/.github/workflows/web_builds.yml b/.github/workflows/web_builds.yml index dac6270b2bd6..1912771e490c 100644 --- a/.github/workflows/web_builds.yml +++ b/.github/workflows/web_builds.yml @@ -14,27 +14,41 @@ concurrency: cancel-in-progress: true jobs: - web-template: - runs-on: ubuntu-24.04 + build-web: + runs-on: ubuntu-latest name: ${{ matrix.name }} strategy: fail-fast: false matrix: include: - - name: Template w/ threads (target=template_release, threads=yes) - cache-name: web-template - target: template_release + - name: Pixel Debug (threads=no) + cache-name: web_pixel_debug_web + target: pixel_debug + sconsflags: threads=no + tests: false + artifact: true + + - name: Pixel Debug (threads=yes) + cache-name: web_pixel_debug_web_threads + target: pixel_debug sconsflags: threads=yes tests: false artifact: true - - name: Template w/o threads (target=template_release, threads=no) - cache-name: web-nothreads-template - target: template_release + - name: Pixel Release (threads=no) + cache-name: web_pixel_release_web + target: pixel_release sconsflags: threads=no tests: false artifact: true + - name: Pixel Release (threads=yes) + cache-name: web_pixel_release_web_threads + target: pixel_release + sconsflags: threads=yes + tests: false + artifact: true + steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/windows_builds.yml b/.github/workflows/windows_builds.yml index c407ae12d099..22e04ed8173e 100644 --- a/.github/workflows/windows_builds.yml +++ b/.github/workflows/windows_builds.yml @@ -7,7 +7,7 @@ on: env: # Used for the cache key. Add version suffix to force clean build. GODOT_BASE_BRANCH: master - SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes d3d12=yes strict_checks=yes "angle_libs=${{ github.workspace }}/" + SCONSFLAGS: verbose=yes warnings=extra werror=yes debug_symbols=no strict_checks=yes d3d12=yes "angle_libs=${{ github.workspace }}/" SCONS_CACHE_MSVC_CONFIG: true concurrency: @@ -23,44 +23,20 @@ jobs: fail-fast: false matrix: include: - - name: Editor (target=editor, tests=yes) - cache-name: windows-editor - target: editor - tests: true - # Skip debug symbols, they're way too big with MSVC. - sconsflags: debug_symbols=no vsproj=yes vsproj_gen_only=no windows_subsystem=console - bin: ./bin/godot.windows.editor.x86_64.exe + - name: Pixel Debug + cache-name: windows_pixel_engine_debug + target: pixel_debug + # bin: ./bin/pixel.windows.pixel_debug.x86_64.console.exe compiler: msvc cache-limit: 2 - - name: Editor w/ clang-cl (target=editor, tests=yes, use_llvm=yes) - cache-name: windows-editor-clang - target: editor - tests: true - sconsflags: debug_symbols=no windows_subsystem=console use_llvm=yes - bin: ./bin/godot.windows.editor.x86_64.llvm.exe - compiler: clang - cache-limit: 1 - - - name: Template (target=template_release, tests=yes) - cache-name: windows-template - target: template_release - tests: true - sconsflags: debug_symbols=no - bin: ./bin/godot.windows.template_release.x86_64.console.exe + - name: Pixel Release + cache-name: windows_pixel_engine_release + target: pixel_release + # bin: ./bin/pixel.windows.pixel_release.x86_64.console.exe compiler: msvc cache-limit: 2 - - name: Template w/ GCC (target=template_release, tests=yes, use_mingw=yes) - cache-name: windows-template-gcc - # MinGW takes MUCH longer to compile; save time by only targeting Template. - target: template_release - tests: true - sconsflags: debug_symbols=no use_mingw=yes - bin: ./bin/godot.windows.template_release.x86_64.console.exe - compiler: gcc - cache-limit: 1 - steps: - name: Checkout uses: actions/checkout@v4 @@ -93,11 +69,10 @@ jobs: - name: Compilation uses: ./.github/actions/godot-build with: - sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }} + sconsflags: ${{ env.SCONSFLAGS }} platform: windows target: ${{ matrix.target }} - tests: ${{ matrix.tests }} - scons-cache-limit: ${{ matrix.cache-limit }} + # tests: ${{ matrix.tests }} - name: Save Godot build cache uses: ./.github/actions/godot-cache-save @@ -116,9 +91,9 @@ jobs: with: name: ${{ matrix.cache-name }} - - name: Unit tests - if: matrix.tests - run: | - ${{ matrix.bin }} --version - ${{ matrix.bin }} --help - ${{ matrix.bin }} --test --force-colors + # - name: Unit tests + # if: matrix.tests + # run: | + # ${{ matrix.bin }} --version + # ${{ matrix.bin }} --help + # ${{ matrix.bin }} --test --force-colors diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 77418d45b03c..c5a11c757225 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -162,7 +162,8 @@ repos: platform/android/java/lib/src/com/.*| platform/android/java/lib/src/org/godotengine/godot/gl/GLSurfaceView\.java$| platform/android/java/lib/src/org/godotengine/godot/gl/EGLLogWrapper\.java$| - platform/android/java/lib/src/org/godotengine/godot/utils/ProcessPhoenix\.java$ + platform/android/java/lib/src/org/godotengine/godot/utils/ProcessPhoenix\.java$| + pixel/.* ) - id: header-guards diff --git a/AUTHORS.md b/AUTHORS.md index b21270b3f700..d03dcd74eb35 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -339,3 +339,7 @@ name is available. 忘忧の (Daylily-Zeleen) 谢天 (jsjtxietian) 风青山 (Rindbee) + +## Pixel Engine Contributers + + Mounir Tohami (WhalesState) diff --git a/SConstruct b/SConstruct index 83f1f8f80b4f..5a5efa5a2de3 100644 --- a/SConstruct +++ b/SConstruct @@ -194,7 +194,7 @@ if env.scons_version >= (4, 3): else: opts.Add("platform", "Target platform (%s)" % "|".join(platform_list), "") opts.Add("p", "Alias for 'platform'", "") -opts.Add(EnumVariable("target", "Compilation target", "editor", ("editor", "template_release", "template_debug"))) +opts.Add(EnumVariable("target", "Compilation target", "pixel_debug", ("pixel_debug", "pixel_release"))) opts.Add(EnumVariable("arch", "CPU architecture", "auto", ["auto"] + architectures, architecture_aliases)) opts.Add(BoolVariable("dev_build", "Developer build with dev-only debugging code (DEV_ENABLED)", False)) opts.Add( @@ -213,7 +213,7 @@ opts.Add(BoolVariable("production", "Set defaults to build Godot for use in prod opts.Add(BoolVariable("threads", "Enable threading support", True)) # Components -opts.Add(BoolVariable("deprecated", "Enable compatibility code for deprecated and removed features", True)) +opts.Add(BoolVariable("deprecated", "Enable compatibility code for deprecated and removed features", False)) opts.Add(EnumVariable("precision", "Set the floating-point precision level", "single", ("single", "double"))) opts.Add(BoolVariable("minizip", "Enable ZIP archive support using minizip", True)) opts.Add(BoolVariable("brotli", "Enable Brotli for decompresson and WOFF2 fonts support", True)) @@ -254,12 +254,12 @@ opts.Add("object_prefix", "Custom prefix added to the base filename of all gener opts.Add(BoolVariable("vsproj", "Generate a Visual Studio solution", False)) opts.Add("vsproj_name", "Name of the Visual Studio solution", "godot") opts.Add("import_env_vars", "A comma-separated list of environment variables to copy from the outer environment.", "") -opts.Add(BoolVariable("disable_3d", "Disable 3D nodes for a smaller executable", False)) -opts.Add(BoolVariable("disable_navigation", "Disable 2D and 3D navigation for a smaller executable", False)) -opts.Add(BoolVariable("disable_physics", "Disable 2D and 3D physics for a smaller executable", False)) -opts.Add(BoolVariable("disable_visual_shader", "Disable visual shader for a smaller executable", False)) +opts.Add(BoolVariable("disable_3d", "Disable 3D nodes for a smaller executable", True)) +opts.Add(BoolVariable("disable_navigation", "Disable 2D and 3D navigation for a smaller executable", True)) +opts.Add(BoolVariable("disable_physics", "Disable 2D and 3D physics for a smaller executable", True)) +opts.Add(BoolVariable("disable_visual_shader", "Disable visual shader for a smaller executable", True)) opts.Add(BoolVariable("disable_advanced_gui", "Disable advanced GUI nodes and behaviors", False)) -opts.Add(BoolVariable("disable_graph", "Disable graph nodes for a smaller executable", False)) +opts.Add(BoolVariable("disable_graph", "Disable graph nodes for a smaller executable", True)) opts.Add("build_profile", "Path to a file containing a feature build profile", "") opts.Add(BoolVariable("modules_enabled_by_default", "If no, disable all modules except ones explicitly enabled", True)) opts.Add(BoolVariable("no_editor_splash", "Don't use the custom splash screen for the editor", True)) @@ -474,9 +474,10 @@ env.platform_apis = platform_apis # - Optimization level # - Debug symbols for crash traces / debuggers -env.editor_build = env["target"] == "editor" -env.dev_build = env["dev_build"] -env.debug_features = env["target"] in ["editor", "template_debug"] +env.pixel_engine = env["target"] in ["pixel_debug", "pixel_release"] +env.editor_build = not env.pixel_engine and env["target"] == "editor" +env.debug_features = env["target"] in ["editor", "template_debug", "pixel_debug"] +env.dev_build = env["target"] == "pixel_debug" or env["dev_build"] if env["optimize"] == "auto": if env.dev_build: @@ -491,13 +492,19 @@ env["debug_symbols"] = methods.get_cmdline_bool("debug_symbols", env.dev_build) if env.editor_build: env.Append(CPPDEFINES=["TOOLS_ENABLED"]) - -if env.debug_features: +elif env["target"] == "pixel_debug": + env.Append(CPPDEFINES=["PIXEL_ENGINE"]) + env.Append(CPPDEFINES=["PIXEL_DEBUG"]) +elif env["target"] == "pixel_release": + env.Append(CPPDEFINES=["PIXEL_ENGINE"]) + env.Append(CPPDEFINES=["PIXEL_RELEASE"]) + +if env.debug_features or env["target"] == "pixel_debug": # DEBUG_ENABLED enables debugging *features* and debug-only code, which is intended # to give *users* extra debugging information for their game development. env.Append(CPPDEFINES=["DEBUG_ENABLED"]) -if env.dev_build: +if env.dev_build or env["target"] == "pixel_debug": # DEV_ENABLED enables *engine developer* code which should only be compiled for those # working on the engine itself. env.Append(CPPDEFINES=["DEV_ENABLED"]) @@ -924,7 +931,7 @@ else: suffix = "." + env["platform"] suffix += "." + env["target"] -if env.dev_build: +if env.dev_build and not env.pixel_engine: suffix += ".dev" if env["precision"] == "double": @@ -1115,6 +1122,8 @@ SConscript("servers/SCsub") SConscript("scene/SCsub") if env.editor_build: SConscript("editor/SCsub") +if env.pixel_engine: + SConscript("pixel/SCsub") SConscript("drivers/SCsub") SConscript("platform/SCsub") diff --git a/core/SCsub b/core/SCsub index 8bda230b870c..7ea3a3174e7d 100644 --- a/core/SCsub +++ b/core/SCsub @@ -185,6 +185,9 @@ def version_info_builder(target, source, env): #define VERSION_MAJOR {major} #define VERSION_MINOR {minor} #define VERSION_PATCH {patch} +#define PIXEL_MAJOR {pixel_major} +#define PIXEL_MINOR {pixel_minor} +#define PIXEL_PATCH {pixel_patch} #define VERSION_STATUS "{status}" #define VERSION_BUILD "{build}" #define VERSION_MODULE_CONFIG "{module_config}" diff --git a/core/config/engine.cpp b/core/config/engine.cpp index 250f39b08a32..d8d13433dff6 100644 --- a/core/config/engine.cpp +++ b/core/config/engine.cpp @@ -128,6 +128,9 @@ Dictionary Engine::get_version_info() const { dict["major"] = VERSION_MAJOR; dict["minor"] = VERSION_MINOR; dict["patch"] = VERSION_PATCH; + dict["pixel_major"] = PIXEL_MAJOR; + dict["pixel_minor"] = PIXEL_MINOR; + dict["pixel_patch"] = PIXEL_PATCH; dict["hex"] = VERSION_HEX; dict["status"] = VERSION_STATUS; dict["build"] = VERSION_BUILD; diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index 8e5525d0767b..50de01e26660 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -50,7 +50,6 @@ #include "core/io/marshalls.h" #include "core/io/resource_uid.h" #include "core/object/script_language.h" -#include "core/os/keyboard.h" #include "core/templates/rb_set.h" #include "core/variant/typed_array.h" #include "core/variant/variant_parser.h" @@ -60,7 +59,9 @@ #include "modules/modules_enabled.gen.h" // For mono. #endif // TOOLS_ENABLED +#ifndef PIXEL_ENGINE const String ProjectSettings::PROJECT_DATA_DIR_NAME_SUFFIX = "godot"; +#endif // !PIXEL_ENGINE ProjectSettings *ProjectSettings::singleton = nullptr; @@ -73,7 +74,11 @@ String ProjectSettings::get_project_data_dir_name() const { } String ProjectSettings::get_project_data_path() const { +#ifndef PIXEL_ENGINE return "res://" + get_project_data_dir_name(); +#else + return "user://" + get_project_data_dir_name(); +#endif // !PIXEL_ENGINE } String ProjectSettings::get_resource_path() const { @@ -572,6 +577,7 @@ void ProjectSettings::_convert_to_last_version(int p_from_version) { * If nothing was found, error out. */ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, bool p_upwards, bool p_ignore_override) { +#ifndef PIXEL_ENGINE if (!OS::get_singleton()->get_resource_dir().is_empty()) { // OS will call ProjectSettings->get_resource_path which will be empty if not overridden! // If the OS would rather use a specific location, then it will not be empty. @@ -662,11 +668,15 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b // Nothing was found, try to find a project file in provided path (`p_path`) // or, if requested (`p_upwards`) in parent directories. +#endif // !PIXEL_ENGINE Ref d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); ERR_FAIL_COND_V_MSG(d.is_null(), ERR_CANT_CREATE, vformat("Cannot create DirAccess for path '%s'.", p_path)); d->change_dir(p_path); +#ifdef PIXEL_ENGINE + return _load_settings_text(d->get_current_dir().path_join("settings.pixel")); +#else String current_dir = d->get_current_dir(); bool found = false; Error err; @@ -704,10 +714,12 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b } return OK; +#endif // PIXEL_ENGINE } Error ProjectSettings::setup(const String &p_path, const String &p_main_pack, bool p_upwards, bool p_ignore_override) { Error err = _setup(p_path, p_main_pack, p_upwards, p_ignore_override); +#ifndef PIXEL_ENGINE if (err == OK && !p_ignore_override) { String custom_settings = GLOBAL_GET("application/config/project_settings_override"); if (!custom_settings.is_empty()) { @@ -718,6 +730,9 @@ Error ProjectSettings::setup(const String &p_path, const String &p_main_pack, bo // Updating the default value after the project settings have loaded. bool use_hidden_directory = GLOBAL_GET("application/config/use_hidden_project_data_directory"); project_data_dir_name = (use_hidden_directory ? "." : "") + PROJECT_DATA_DIR_NAME_SUFFIX; +#else + project_data_dir_name = "." + String(VERSION_SHORT_NAME); +#endif // !PIXEL_ENGINE // Using GLOBAL_GET on every block for compressing can be slow, so assigning here. Compression::zstd_long_distance_matching = GLOBAL_GET("compression/formats/zstd/long_distance_matching"); @@ -806,8 +821,12 @@ Error ProjectSettings::_load_settings_text(const String &p_path) { if (err == ERR_FILE_EOF) { // If we're loading a project.godot from source code, we can operate some // ProjectSettings conversions if need be. +#ifndef PIXEL_ENGINE _convert_to_last_version(config_version); last_save_time = FileAccess::get_modified_time(get_resource_path().path_join("project.godot")); +#else + last_save_time = FileAccess::get_modified_time(OS::get_singleton()->get_user_data_dir().path_join("settings.pixel")); +#endif // !PIXEL_ENGINE return OK; } ERR_FAIL_COND_V_MSG(err != OK, err, vformat("Error parsing '%s' at line %d: %s File might be corrupted.", p_path, lines, error_text)); @@ -886,9 +905,14 @@ void ProjectSettings::clear(const String &p_name) { } Error ProjectSettings::save() { - Error error = save_custom(get_resource_path().path_join("project.godot")); +#ifndef PIXEL_ENGINE + const String path = get_resource_path().path_join("project.godot"); +#else + const String path = OS::get_singleton()->get_user_data_dir().path_join("settings.pixel"); +#endif // !PIXEL_ENGINE + Error error = save_custom(path); if (error == OK) { - last_save_time = FileAccess::get_modified_time(get_resource_path().path_join("project.godot")); + last_save_time = FileAccess::get_modified_time(path); } return error; } @@ -966,7 +990,11 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const RBMap file = FileAccess::open(p_file, FileAccess::WRITE, &err); +#ifndef PIXEL_ENGINE ERR_FAIL_COND_V_MSG(err != OK, err, vformat("Couldn't save project.godot - %s.", p_file)); +#else + ERR_FAIL_COND_V_MSG(err != OK, err, vformat("Couldn't save settings.pixel - %s.", p_file)); +#endif // !PIXEL_ENGINE file->store_line("; Engine configuration file."); file->store_line("; It's best edited using the editor UI and not directly,"); @@ -1136,7 +1164,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust save_features += f; } - if (p_path.ends_with(".godot") || p_path.ends_with("override.cfg")) { + if (p_path.ends_with(".godot") || p_path.ends_with("override.cfg") || p_path.ends_with(".pixel")) { return _save_settings_text(p_path, save_props, p_custom, save_features); } else if (p_path.ends_with(".binary")) { return _save_settings_binary(p_path, save_props, p_custom, save_features); @@ -1253,10 +1281,10 @@ TypedArray ProjectSettings::get_global_class_list() { if (cf->load(get_global_class_list_path()) == OK) { global_class_list = cf->get_value("", "list", Array()); } else { -#ifndef TOOLS_ENABLED +#if !defined(TOOLS_ENABLED) && !defined(PIXEL_ENGINE) // Script classes can't be recreated in exported project, so print an error. ERR_PRINT("Could not load global script cache."); -#endif +#endif // !defined(TOOLS_ENABLED) && !defined(PIXEL_ENGINE) } // File read succeeded or failed. If it failed, assume everything is still okay. @@ -1459,25 +1487,25 @@ ProjectSettings::ProjectSettings() { } } #endif - +#ifndef PIXEL_ENGINE GLOBAL_DEF_BASIC("application/config/name", ""); GLOBAL_DEF_BASIC(PropertyInfo(Variant::DICTIONARY, "application/config/name_localized", PROPERTY_HINT_LOCALIZABLE_STRING), Dictionary()); GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "application/config/description", PROPERTY_HINT_MULTILINE_TEXT), ""); GLOBAL_DEF_BASIC("application/config/version", ""); GLOBAL_DEF_INTERNAL(PropertyInfo(Variant::STRING, "application/config/tags"), PackedStringArray()); GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "application/run/main_scene", PROPERTY_HINT_FILE, "*.tscn,*.scn,*.res"), ""); - GLOBAL_DEF("application/run/disable_stdout", false); - GLOBAL_DEF("application/run/disable_stderr", false); - GLOBAL_DEF("application/run/print_header", true); - GLOBAL_DEF("application/run/enable_alt_space_menu", false); GLOBAL_DEF_RST("application/config/use_hidden_project_data_directory", true); GLOBAL_DEF("application/config/use_custom_user_dir", false); GLOBAL_DEF("application/config/custom_user_dir_name", ""); - GLOBAL_DEF("application/config/project_settings_override", ""); - GLOBAL_DEF("application/run/main_loop_type", "SceneTree"); GLOBAL_DEF("application/config/auto_accept_quit", true); GLOBAL_DEF("application/config/quit_on_go_back", true); + GLOBAL_DEF("application/config/project_settings_override", ""); +#endif // !PIXEL_ENGINE + GLOBAL_DEF("application/run/disable_stdout", false); + GLOBAL_DEF("application/run/disable_stderr", false); + GLOBAL_DEF("application/run/print_header", true); + GLOBAL_DEF("application/run/enable_alt_space_menu", false); // The default window size is tuned to: // - Have a 16:9 aspect ratio, @@ -1504,16 +1532,24 @@ ProjectSettings::ProjectSettings() { GLOBAL_DEF(PropertyInfo(Variant::INT, "display/window/size/window_width_override", PROPERTY_HINT_RANGE, "0,7680,1,or_greater"), 0); // 8K resolution GLOBAL_DEF(PropertyInfo(Variant::INT, "display/window/size/window_height_override", PROPERTY_HINT_RANGE, "0,4320,1,or_greater"), 0); // 8K resolution +#ifndef PIXEL_ENGINE GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true); +#else + GLOBAL_DEF("display/window/energy_saving/keep_screen_on", false); +#endif // !PIXEL_ENGINE GLOBAL_DEF("animation/warnings/check_invalid_track_paths", true); GLOBAL_DEF("animation/warnings/check_angle_interpolation_type_conflicting", true); +#ifndef PIXEL_ENGINE GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "audio/buses/default_bus_layout", PROPERTY_HINT_FILE, "*.tres"), "res://default_bus_layout.tres"); +#endif // !PIXEL_ENGINE GLOBAL_DEF(PropertyInfo(Variant::INT, "audio/general/default_playback_type", PROPERTY_HINT_ENUM, "Stream,Sample"), 0); GLOBAL_DEF(PropertyInfo(Variant::INT, "audio/general/default_playback_type.web", PROPERTY_HINT_ENUM, "Stream,Sample"), 1); GLOBAL_DEF_RST("audio/general/text_to_speech", false); +#ifndef PIXEL_ENGINE GLOBAL_DEF_RST(PropertyInfo(Variant::FLOAT, "audio/general/2d_panning_strength", PROPERTY_HINT_RANGE, "0,2,0.01"), 0.5f); GLOBAL_DEF_RST(PropertyInfo(Variant::FLOAT, "audio/general/3d_panning_strength", PROPERTY_HINT_RANGE, "0,2,0.01"), 0.5f); +#endif // !PIXEL_ENGINE GLOBAL_DEF(PropertyInfo(Variant::INT, "audio/general/ios/session_category", PROPERTY_HINT_ENUM, "Ambient,Multi Route,Play and Record,Playback,Record,Solo Ambient"), 0); GLOBAL_DEF("audio/general/ios/mix_with_others", false); @@ -1522,7 +1558,9 @@ ProjectSettings::ProjectSettings() { // Keep the enum values in sync with the `DisplayServer::ScreenOrientation` enum. custom_prop_info["display/window/handheld/orientation"] = PropertyInfo(Variant::INT, "display/window/handheld/orientation", PROPERTY_HINT_ENUM, "Landscape,Portrait,Reverse Landscape,Reverse Portrait,Sensor Landscape,Sensor Portrait,Sensor"); +#ifndef PIXEL_ENGINE GLOBAL_DEF("display/window/subwindows/embed_subwindows", true); +#endif // !PIXEL_ENGINE // Keep the enum values in sync with the `DisplayServer::VSyncMode` enum. custom_prop_info["display/window/vsync/vsync_mode"] = PropertyInfo(Variant::INT, "display/window/vsync/vsync_mode", PROPERTY_HINT_ENUM, "Disabled,Enabled,Adaptive,Mailbox"); @@ -1533,9 +1571,11 @@ ProjectSettings::ProjectSettings() { custom_prop_info["rendering/driver/threads/thread_model"] = PropertyInfo(Variant::INT, "rendering/driver/threads/thread_model", PROPERTY_HINT_ENUM, "Safe:1,Separate"); #else custom_prop_info["rendering/driver/threads/thread_model"] = PropertyInfo(Variant::INT, "rendering/driver/threads/thread_model", PROPERTY_HINT_ENUM, "Unsafe (deprecated),Safe,Separate"); -#endif +#endif // DISABLE_DEPRECATED +#ifndef PIXEL_ENGINE GLOBAL_DEF("physics/2d/run_on_separate_thread", false); GLOBAL_DEF("physics/3d/run_on_separate_thread", false); +#endif // !PIXEL_ENGINE GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "display/window/stretch/mode", PROPERTY_HINT_ENUM, "disabled,canvas_items,viewport"), "disabled"); GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "display/window/stretch/aspect", PROPERTY_HINT_ENUM, "ignore,keep,keep_width,keep_height,expand"), "keep"); @@ -1558,9 +1598,11 @@ ProjectSettings::ProjectSettings() { GLOBAL_DEF_RST(PropertyInfo(Variant::INT, "rendering/occlusion_culling/bvh_build_quality", PROPERTY_HINT_ENUM, "Low,Medium,High"), 2); GLOBAL_DEF_RST("rendering/occlusion_culling/jitter_projection", true); +#ifndef PIXEL_ENGINE GLOBAL_DEF_RST("internationalization/rendering/force_right_to_left_layout_direction", false); GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "internationalization/rendering/root_node_layout_direction", PROPERTY_HINT_ENUM, "Based on Application Locale,Left-to-Right,Right-to-Left,Based on System Locale"), 0); GLOBAL_DEF_BASIC("internationalization/rendering/root_node_auto_translate", true); +#endif // !PIXEL_ENGINE GLOBAL_DEF(PropertyInfo(Variant::INT, "gui/timers/incremental_search_max_interval_msec", PROPERTY_HINT_RANGE, "0,10000,1,or_greater"), 2000); GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "gui/timers/tooltip_delay_sec", PROPERTY_HINT_RANGE, "0,5,0.01,or_greater"), 0.5); diff --git a/core/config/project_settings.h b/core/config/project_settings.h index 922c88c15132..7594ec1c574b 100644 --- a/core/config/project_settings.h +++ b/core/config/project_settings.h @@ -45,7 +45,9 @@ class ProjectSettings : public Object { public: typedef HashMap CustomMap; +#ifndef PIXEL_ENGINE static const String PROJECT_DATA_DIR_NAME_SUFFIX; +#endif // !PIXEL_ENGINE enum { // Properties that are not for built in values begin from this value, so builtin ones are displayed first. diff --git a/core/version.h b/core/version.h index 18a97cadf0de..00a77734f8c8 100644 --- a/core/version.h +++ b/core/version.h @@ -48,6 +48,7 @@ // Defines the main "branch" version. Patch versions in this branch should be // forward-compatible. // Example: "3.1" +#define PIXEL_VERSION _MKSTR(PIXEL_MAJOR) "." _MKSTR(PIXEL_MINOR) "." _MKSTR(PIXEL_PATCH) #define VERSION_BRANCH _MKSTR(VERSION_MAJOR) "." _MKSTR(VERSION_MINOR) #if VERSION_PATCH // Example: "3.1.4" diff --git a/drivers/pulseaudio/audio_driver_pulseaudio.cpp b/drivers/pulseaudio/audio_driver_pulseaudio.cpp index 669e6c2aa951..27fa8de4eeee 100644 --- a/drivers/pulseaudio/audio_driver_pulseaudio.cpp +++ b/drivers/pulseaudio/audio_driver_pulseaudio.cpp @@ -314,7 +314,11 @@ Error AudioDriverPulseAudio::init() { if (Engine::get_singleton()->is_editor_hint()) { context_name = VERSION_NAME " Editor"; } else { +#ifndef PIXEL_ENGINE context_name = GLOBAL_GET("application/config/name"); +#else + context_name = "Pixel Engine"; +#endif // !PIXEL_ENGINE if (context_name.is_empty()) { context_name = VERSION_NAME " Project"; } diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 1fc7816774cd..8ec927d4ee56 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -960,6 +960,7 @@ void OS_Unix::unset_environment(const String &p_var) const { } String OS_Unix::get_user_data_dir() const { +#ifndef PIXEL_ENGINE String appname = get_safe_dir_name(GLOBAL_GET("application/config/name")); if (!appname.is_empty()) { bool use_custom_dir = GLOBAL_GET("application/config/use_custom_user_dir"); @@ -973,8 +974,10 @@ String OS_Unix::get_user_data_dir() const { return get_data_path().path_join(get_godot_dir_name()).path_join("app_userdata").path_join(appname); } } - return get_data_path().path_join(get_godot_dir_name()).path_join("app_userdata").path_join("[unnamed project]"); +#else + return get_data_path().path_join(get_godot_dir_name()); +#endif // !PIXEL_ENGINE } String OS_Unix::get_executable_path() const { diff --git a/drivers/vulkan/rendering_context_driver_vulkan.cpp b/drivers/vulkan/rendering_context_driver_vulkan.cpp index 3c1aa323f45e..6f4184efa778 100644 --- a/drivers/vulkan/rendering_context_driver_vulkan.cpp +++ b/drivers/vulkan/rendering_context_driver_vulkan.cpp @@ -682,12 +682,20 @@ Error RenderingContextDriverVulkan::_initialize_instance() { // to anything but 1.0. Note that this value is only used by validation layers to warn us about version issues. uint32_t application_api_version = instance_api_version == VK_API_VERSION_1_0 ? VK_API_VERSION_1_0 : VK_API_VERSION_1_2; +#ifndef PIXEL_ENGINE CharString cs = GLOBAL_GET("application/config/name").operator String().utf8(); +#else + CharString cs = String("Pixel Engine").utf8(); +#endif // !PIXEL_ENGINE VkApplicationInfo app_info = {}; app_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; app_info.pApplicationName = cs.get_data(); app_info.pEngineName = VERSION_NAME; +#ifndef PIXEL_ENGINE app_info.engineVersion = VK_MAKE_VERSION(VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH); +#else + app_info.engineVersion = VK_MAKE_VERSION(PIXEL_MAJOR, PIXEL_MINOR, PIXEL_PATCH); +#endif // !PIXEL_ENGINE app_info.apiVersion = application_api_version; TightLocalVector enabled_layer_names; diff --git a/main/main.cpp b/main/main.cpp index 4e3096159385..af42d1a58fdb 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -69,6 +69,7 @@ #include "main/performance.h" #include "main/splash.gen.h" #include "modules/register_module_types.h" +#include "pixel/main_tree.h" #include "platform/register_platform_apis.h" #include "scene/main/scene_tree.h" #include "scene/main/window.h" @@ -208,6 +209,7 @@ static int audio_driver_idx = -1; static bool single_window = false; static bool editor = false; static bool project_manager = false; +static bool pixel_engine = false; static bool cmdline_tool = false; static String locale; static String log_file; @@ -1032,7 +1034,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph String audio_driver = ""; String project_path = "."; +#ifndef PIXEL_ENGINE bool upwards = false; +#endif // !PIXEL_ENGINE String debug_uri = ""; bool skip_breakpoints = false; String main_pack; @@ -1626,8 +1630,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph OS::get_singleton()->print("Missing relative or absolute path, aborting.\n"); goto error; } +#ifndef PIXEL_ENGINE } else if (arg == "-u" || arg == "--upwards") { // scan folders upwards upwards = true; +#endif // !PIXEL_ENGINE } else if (arg == "--quit") { // Auto quit at the end of the first main loop iteration quit_after = 1; } else if (arg == "--quit-after") { // Quit after the given number of iterations @@ -1876,6 +1882,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } } +#ifndef PIXEL_ENGINE OS::get_singleton()->_in_editor = editor; if (globals->setup(project_path, main_pack, upwards, editor) == OK) { #ifdef TOOLS_ENABLED @@ -1890,13 +1897,19 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph OS::get_singleton()->alert(error_msg); goto error; -#endif +#endif // TOOLS_ENABLED } +#else + if (FileAccess::exists(OS::get_singleton()->get_user_data_dir().path_join("settings.pixel"))) { + globals->setup(OS::get_singleton()->get_user_data_dir(), ""); + } + pixel_engine = true; +#endif // Initialize WorkerThreadPool. { #ifdef THREADS_ENABLED - if (editor || project_manager) { + if (editor || project_manager || pixel_engine) { WorkerThreadPool::get_singleton()->init(-1, 0.75); } else { int worker_threads = GLOBAL_GET("threading/worker_pool/max_threads"); @@ -1943,7 +1956,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph // Initialize user data dir. OS::get_singleton()->ensure_user_data_dir(); +#ifndef PIXEL_ENGINE OS::get_singleton()->set_low_processor_usage_mode(GLOBAL_DEF("application/run/low_processor_mode", false)); +#else + OS::get_singleton()->set_low_processor_usage_mode(GLOBAL_DEF("application/run/low_processor_mode", true)); +#endif // !PIXEL_ENGINE OS::get_singleton()->set_low_processor_usage_mode_sleep_usec( GLOBAL_DEF(PropertyInfo(Variant::INT, "application/run/low_processor_mode_sleep_usec", PROPERTY_HINT_RANGE, "0,33200,1,or_greater"), 6900)); // Roughly 144 FPS @@ -1994,7 +2011,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph // This also prevents logs from being created for the editor instance, as feature tags // are disabled while in the editor (even if they should logically apply). GLOBAL_DEF("debug/file_logging/enable_file_logging.pc", true); - GLOBAL_DEF("debug/file_logging/log_path", "user://logs/godot.log"); + GLOBAL_DEF("debug/file_logging/log_path", "user://logs/pixel.log"); GLOBAL_DEF(PropertyInfo(Variant::INT, "debug/file_logging/max_log_files", PROPERTY_HINT_RANGE, "0,20,1,or_greater"), 5); // If `--log-file` is used to override the log path, allow creating logs for the project manager or editor @@ -2018,7 +2035,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph OS::get_singleton()->add_logger(memnew(RotatedFileLogger(base_path, max_files))); } - if (main_args.size() == 0 && String(GLOBAL_GET("application/run/main_scene")) == "") { +#ifndef PIXEL_ENGINE + if (!pixel_engine && main_args.size() == 0 && String(GLOBAL_GET("application/run/main_scene")) == "") { #ifdef TOOLS_ENABLED if (!editor && !project_manager) { #endif // TOOLS_ENABLED @@ -2030,9 +2048,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } #endif // TOOLS_ENABLED } +#endif // !PIXEL_ENGINE - if (editor || project_manager) { - Engine::get_singleton()->set_editor_hint(true); + if (editor || project_manager || pixel_engine) { + Engine::get_singleton()->set_editor_hint(!pixel_engine); use_custom_res = false; input_map->load_default(); //keys for editor } else { @@ -3616,8 +3635,9 @@ int Main::start() { #endif // TOOLS_ENABLED main_timer_sync.init(OS::get_singleton()->get_ticks_usec()); - List args = OS::get_singleton()->get_cmdline_args(); +#ifndef PIXEL_ENGINE + List args = OS::get_singleton()->get_cmdline_args(); for (List::Element *E = args.front(); E; E = E->next()) { // First check parameters that do not have an argument to the right. @@ -3722,6 +3742,7 @@ int Main::start() { } #endif } +#endif // !PIXEL_ENGINE uint64_t minimum_time_msec = GLOBAL_DEF(PropertyInfo(Variant::INT, "application/boot_splash/minimum_display_time", PROPERTY_HINT_RANGE, "0,100,1,or_greater,suffix:ms"), 0); if (Engine::get_singleton()->is_editor_hint()) { @@ -3864,9 +3885,11 @@ int Main::start() { #endif // TOOLS_ENABLED +#ifndef PIXEL_ENGINE if (script.is_empty() && game_path.is_empty() && String(GLOBAL_GET("application/run/main_scene")) != "") { game_path = GLOBAL_GET("application/run/main_scene"); } +#endif // !PIXEL_ENGINE #ifdef TOOLS_ENABLED if (!editor && !project_manager && !cmdline_tool && script.is_empty() && game_path.is_empty()) { @@ -3879,13 +3902,21 @@ int Main::start() { } #endif +#ifdef PIXEL_ENGINE + pixel_engine = true; +#endif + MainLoop *main_loop = nullptr; if (editor) { main_loop = memnew(SceneTree); + } else if (pixel_engine) { + main_loop = memnew(MainTree); } +#ifndef PIXEL_ENGINE if (main_loop_type.is_empty()) { main_loop_type = GLOBAL_GET("application/run/main_loop_type"); } +#endif // !PIXEL_ENGINE if (!script.is_empty()) { Ref