From 0c29f982d5bed52468bf28495fe9ab073d4340c9 Mon Sep 17 00:00:00 2001 From: PixelyIon Date: Fri, 26 Mar 2021 23:42:19 +0530 Subject: [PATCH] Replace skyline-emu/VkHpp with KhronosGroup/Vulkan-Hpp We used a custom version of Vulkan-Hpp which split the files a lot prior to avoid any developers needing to manually set IDE settings for IntelliJ to work but this wasn't practical due to how it required modifications to Vulkan-Hpp's generator which would make maintenance extremely difficult. It was determined that we should just add the requirement for changing the IDE settings and use Vulkan-Hpp directly. --- .github/workflows/ci.yml | 98 +++++++++++++------------- .gitmodules | 6 +- .idea/vcs.xml | 1 + CONTRIBUTING.md | 3 + app/CMakeLists.txt | 10 ++- app/libraries/vkhpp | 2 +- app/src/main/cpp/skyline/gpu/texture.h | 2 +- 7 files changed, 66 insertions(+), 56 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2bded3ba..24f905b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ name: CI -on: [push, pull_request] +on: [ push, pull_request ] jobs: build: @@ -9,61 +9,61 @@ jobs: JVM_OPTS: -Xmx6G steps: - - name: Git Checkout - uses: actions/checkout@v2 - with: - submodules: true + - name: Git Checkout + uses: actions/checkout@v2 + with: + submodules: recursive - - name: Restore Gradle Cache - uses: actions/cache@v2 - with: - path: /root/.gradle/ - key: ${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle') }} - restore-keys: | - ${{ runner.os }}-gradle- + - name: Restore Gradle Cache + uses: actions/cache@v2 + with: + path: /root/.gradle/ + key: ${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle') }} + restore-keys: | + ${{ runner.os }}-gradle- - - name: Restore CXX Cache - uses: actions/cache@v2 - with: - path: app/.cxx/ - key: ${{ runner.os }}-cxx-${{ hashFiles('**/CMakeLists.txt') }} - restore-keys: | - ${{ runner.os }}-cxx- + - name: Restore CXX Cache + uses: actions/cache@v2 + with: + path: app/.cxx/ + key: ${{ runner.os }}-cxx-${{ hashFiles('**/CMakeLists.txt') }} + restore-keys: | + ${{ runner.os }}-cxx- - - name: Setup Environment for Gradle & Ninja Build - run: | - chmod +x gradlew - sudo apt-get install -y ninja-build + - name: Setup Environment for Gradle & Ninja Build + run: | + chmod +x gradlew + sudo apt-get install -y ninja-build - - name: Android Lint - run: ./gradlew --stacktrace lint + - name: Android Lint + run: ./gradlew --stacktrace lint - - name: Upload Lint Report - uses: actions/upload-artifact@v2 - with: - name: lint-result.html - path: app/build/reports/lint-results.html + - name: Upload Lint Report + uses: actions/upload-artifact@v2 + with: + name: lint-result.html + path: app/build/reports/lint-results.html - - name: Android Assemble - run: ./gradlew assemble + - name: Android Assemble + run: ./gradlew assemble - - name: Upload Debug APK - uses: actions/upload-artifact@v2 - with: - name: app-debug.apk - path: app/build/outputs/apk/debug/ + - name: Upload Debug APK + uses: actions/upload-artifact@v2 + with: + name: app-debug.apk + path: app/build/outputs/apk/debug/ - - name: Upload Release APK - uses: actions/upload-artifact@v2 - with: - name: app-release.apk - path: app/build/outputs/apk/release/ + - name: Upload Release APK + uses: actions/upload-artifact@v2 + with: + name: app-release.apk + path: app/build/outputs/apk/release/ - - name: Upload R8 Mapping - uses: actions/upload-artifact@v2 - with: - name: mapping.txt - path: app/build/outputs/mapping/release/ + - name: Upload R8 Mapping + uses: actions/upload-artifact@v2 + with: + name: mapping.txt + path: app/build/outputs/mapping/release/ - - name: Delete Build Folder - run: rm -rf app/build/ + - name: Delete Build Folder + run: rm -rf app/build/ diff --git a/.gitmodules b/.gitmodules index da113779..4fb679b8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,9 +5,6 @@ path = app/libraries/oboe url = https://github.com/google/oboe branch = 1.3-stable -[submodule "app/libraries/vkhpp"] - path = app/libraries/vkhpp - url = https://github.com/skyline-emu/vkhpp [submodule "app/libraries/lz4"] path = app/libraries/lz4 url = https://github.com/lz4/lz4.git @@ -25,3 +22,6 @@ path = app/libraries/perfetto url = https://android.googlesource.com/platform/external/perfetto branch = releases/v12.x +[submodule "app/libraries/vkhpp"] + path = app/libraries/vkhpp + url = https://github.com/KhronosGroup/Vulkan-Hpp diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 36cdcdd4..69e1f66e 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -9,6 +9,7 @@ + \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9e611f8b..5812a074 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -225,6 +225,9 @@ In addition, try to `constexpr` as much as possible including constructors and f We should also mention that this isn't promoting the usage of `const`, it's use is actually discouraged out of references, in which case it is extremely encouraged. In addition, pointers are a general exception to this, using `const` with them isn't encouraged nor discouraged. Another exception are class functions, they can be made `const` if used from a `const` reference/pointer and don't modify any members but do not do this preemptively. +### Vulkan.hpp Header Size +The size of the header imported for [Vulkan-Hpp](https://github.com/KhronosGroup/Vulkan-Hpp) is extremely large and exceeds the CLion default analysis limit, it is required to run for properly annotating any code which uses components from it. To override this limit, refer to this [article from JetBrains](https://www.jetbrains.com/help/objc/configuring-file-size-limit.html#file-size-limit) or navigate to Help -> Edit Custom Properties and add `idea.max.intellisense.filesize=20000` to set the maximum limit to 20MB which should be adequate for it. + ## Kotlin ### Naming rules * Enumerator: `PascalCase` **(1)** diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 7039feee..be16802b 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -25,10 +25,16 @@ add_subdirectory("libraries/oboe") include_directories("libraries/oboe/include") set(LZ4_BUILD_CLI OFF CACHE BOOL "Build LZ4 CLI" FORCE) +set(LZ4_BUILD_LEGACY_LZ4C OFF CACHE BOOL "Build lz4c progam with legacy argument support" FORCE) add_subdirectory("libraries/lz4/build/cmake") include_directories("libraries/lz4/lib") -include_directories("libraries/vkhpp/include") +add_compile_definitions(VULKAN_HPP_NO_SPACESHIP_OPERATOR) # libcxx doesn't implement operator<=> for std::array which breaks this +add_compile_definitions(VULKAN_HPP_NO_STRUCT_CONSTRUCTORS) # We want to use designated initializers in Vulkan-Hpp +add_compile_definitions(VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1) # We use the dynamic loader rather than the static one +include_directories("libraries/vkhpp") +include_directories("libraries/vkhpp/Vulkan-Headers/include") # We use base Vulkan headers from this to ensure version parity with Vulkan-Hpp + include_directories("libraries/pugixml/src") # We use PugiXML in header-only mode include_directories("libraries/frozen/include") @@ -188,5 +194,5 @@ add_library(skyline SHARED ${source_DIR}/skyline/services/prepo/IPrepoService.cpp ) # target_precompile_headers(skyline PRIVATE ${source_DIR}/skyline/common.h) # PCH will currently break Intellisense -target_link_libraries(skyline vulkan android perfetto fmt lz4_static tzcode oboe mbedtls::mbedcrypto) +target_link_libraries(skyline android perfetto fmt lz4_static tzcode oboe mbedtls::mbedcrypto) target_compile_options(skyline PRIVATE -Wall -Wno-unknown-attributes -Wno-c++20-extensions -Wno-c++17-extensions -Wno-c99-designator -Wno-reorder -Wno-missing-braces -Wno-unused-variable -Wno-unused-private-field) diff --git a/app/libraries/vkhpp b/app/libraries/vkhpp index a4b8f749..32188df5 160000 --- a/app/libraries/vkhpp +++ b/app/libraries/vkhpp @@ -1 +1 @@ -Subproject commit a4b8f74942a932ea191dc95cc4a210fea524508f +Subproject commit 32188df57b217b5658bdf74e11c966fb84d7287d diff --git a/app/src/main/cpp/skyline/gpu/texture.h b/app/src/main/cpp/skyline/gpu/texture.h index efebe9f4..a9bfca3d 100644 --- a/app/src/main/cpp/skyline/gpu/texture.h +++ b/app/src/main/cpp/skyline/gpu/texture.h @@ -4,7 +4,7 @@ #pragma once #include -#include +#include namespace skyline { namespace service::hosbinder {