From d62d8928c47b3490e512138f45b0dab57e610ba8 Mon Sep 17 00:00:00 2001 From: Matthew Albrecht Date: Mon, 18 Jul 2022 22:49:23 -0700 Subject: [PATCH] Add mingw ci --- .github/workflows/ci_build.yml | 77 ++++++++++++++++--- Engine/Graphics/CMakeLists.txt | 4 + .../Graphics/Descriptors/Descriptor.hpp | 1 - .../Graphics/Graphics/Pipelines/Pipeline.hpp | 5 +- .../Graphics/Pipelines/PipelineCompute.cpp | 4 + .../Graphics/Pipelines/PipelineCompute.hpp | 1 + .../Graphics/Pipelines/PipelineGraphics.cpp | 4 + .../Graphics/Pipelines/PipelineGraphics.hpp | 2 + Engine/Graphics/Graphics/Renderer.hpp | 4 - Engine/Network/Network/Tcp/TcpSocket.hpp | 2 - Engine/Scene/Maths/Frustum.hpp | 2 - Engine/Scene/Scenes/Entity.hpp | 2 - Engine/Ui/Fonts/Text.hpp | 7 -- Engine/Ui/Uis/Inputs/UiRadioInput.hpp | 2 - External/volk/volk.h | 18 ++--- 15 files changed, 92 insertions(+), 43 deletions(-) diff --git a/.github/workflows/ci_build.yml b/.github/workflows/ci_build.yml index 479d85c20..298e742ae 100644 --- a/.github/workflows/ci_build.yml +++ b/.github/workflows/ci_build.yml @@ -20,22 +20,22 @@ jobs: with: submodules: recursive - uses: lukka/get-cmake@v3.19.0 - - name: Download OpenAL - run: | - Invoke-WebRequest -Uri "https://openal-soft.org/openal-binaries/openal-soft-1.21.0-bin.zip" -OutFile openal-soft.zip - Expand-Archive -Path openal-soft.zip -DestinationPath C:\\ - name: Download Vulkan run: | - Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/1.2.154.1/windows/VulkanSDK-1.2.154.1-Installer.exe" -OutFile VulkanSDK.exe - $installer = Start-Process -FilePath VulkanSDK.exe -Wait -PassThru -ArgumentList @("/S"); + Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/1.3.216.0/windows/VulkanSDK-1.3.216.0-Installer.exe" -OutFile vulkan-sdk.exe + $installer = Start-Process -FilePath vulkan-sdk.exe -Wait -PassThru -ArgumentList @("/S"); $installer.WaitForExit(); + - name: Download OpenAL + run: | + Invoke-WebRequest -Uri "https://openal-soft.org/openal-binaries/openal-soft-1.22.2-bin.zip" -OutFile openal-soft.zip + Expand-Archive -Path openal-soft.zip -DestinationPath C:\\ - name: Build env: - VULKAN_SDK: "C:\\VulkanSDK\\1.2.154.1" - OPENALDIR: "C:\\openal-soft-1.21.0-bin" + VULKAN_SDK: "C:\\VulkanSDK\\1.3.216.0" + OPENALDIR: "C:\\openal-soft-1.22.0-bin" shell: cmd run: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" cmake --version ninja --version cmake -B Build -GNinja -DACID_LINK_RESOURCES=0 -DACID_INSTALL_RESOURCES=0 -DACID_INSTALL_EXAMPLES=0 -DCMAKE_BUILD_TYPE=Release @@ -47,7 +47,7 @@ jobs: - name: Run Tests shell: cmd run: | - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" cd Build ctest - name: Install @@ -63,6 +63,63 @@ jobs: name: Windows-MSVC.zip path: ./Windows-MSVC.zip + windows_mingw: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - uses: msys2/setup-msys2@v2 + with: + update: true + install: >- + mingw-w64-x86_64-cmake + mingw-w64-x86_64-ninja + mingw-w64-x86_64-msmpi + - name: Put MSYS2_MinGW64 on PATH + # there is not yet an environment variable for this path from msys2/setup-msys2 + run: echo "${{ runner.temp }}/msys64/mingw64/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + - name: Download Vulkan + run: | + Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/1.3.216.0/windows/VulkanSDK-1.3.216.0-Installer.exe" -OutFile vulkan-sdk.exe + $installer = Start-Process -FilePath vulkan-sdk.exe -Wait -PassThru -ArgumentList @("/S"); + $installer.WaitForExit(); + - name: Download OpenAL + run: | + Invoke-WebRequest -Uri "https://openal-soft.org/openal-binaries/openal-soft-1.22.2-bin.zip" -OutFile openal-soft.zip + Expand-Archive -Path openal-soft.zip -DestinationPath C:\\ + - name: Build + env: + VULKAN_SDK: "C:\\VulkanSDK\\1.3.216.0" + OPENALDIR: "C:\\openal-soft-1.22.0-bin" + shell: cmd + run: | + cmake --version + ninja --version + cmake -B Build -GNinja -DACID_LINK_RESOURCES=0 -DACID_INSTALL_RESOURCES=0 -DACID_INSTALL_EXAMPLES=0 -DCMAKE_BUILD_TYPE=Release + cmake --build Build + - name: Copy OpenAL32.dll + shell: cmd + run: | + cp .github\workflows\openal\OpenAL32.dll Build\bin\OpenAL32.dll + - name: Run Tests + shell: cmd + run: | + cd Build + ctest + - name: Install + run: | + cmake --install Build --prefix Install --strip + - name: Pack Zip + working-directory: Install + run: | + cmake -E tar "cvf" "../Windows-MinGW.zip" --format=zip . + - name: Upload zip + uses: actions/upload-artifact@v3 + with: + name: Windows-MinGW.zip + path: ./Windows-MinGW.zip + linux_clang: runs-on: ubuntu-latest steps: diff --git a/Engine/Graphics/CMakeLists.txt b/Engine/Graphics/CMakeLists.txt index 7b1ffccac..05d886dee 100644 --- a/Engine/Graphics/CMakeLists.txt +++ b/Engine/Graphics/CMakeLists.txt @@ -137,10 +137,12 @@ set(_component_generated_headers ${CMAKE_CURRENT_BINARY_DIR}/include/${_component_name}Export.hpp ) set(_component_third_party_headers + ${THIRD_PARTY_SOURCE_DIR}/stb/stb_image.h ${THIRD_PARTY_SOURCE_DIR}/tinygltf/tiny_gltf.h ${THIRD_PARTY_SOURCE_DIR}/tinyobj/tiny_obj.h ) set(_component_third_party_sources + ${THIRD_PARTY_SOURCE_DIR}/stb/stb_image.c ${THIRD_PARTY_SOURCE_DIR}/tinygltf/tiny_gltf.cpp ${THIRD_PARTY_SOURCE_DIR}/tinyobj/tiny_obj.cpp ) @@ -192,9 +194,11 @@ target_include_directories(${_component_library} PUBLIC $ $ + $ $ $ $ + $ $ $ PRIVATE diff --git a/Engine/Graphics/Graphics/Descriptors/Descriptor.hpp b/Engine/Graphics/Graphics/Descriptors/Descriptor.hpp index 0a800cb66..46bd96362 100644 --- a/Engine/Graphics/Graphics/Descriptors/Descriptor.hpp +++ b/Engine/Graphics/Graphics/Descriptors/Descriptor.hpp @@ -55,7 +55,6 @@ class ACID_GRAPHICS_EXPORT WriteDescriptorSet { class ACID_GRAPHICS_EXPORT Descriptor { public: - Descriptor() = default; virtual ~Descriptor() = default; virtual WriteDescriptorSet GetWriteDescriptor(uint32_t binding, VkDescriptorType descriptorType, const std::optional &offsetSize) const = 0; diff --git a/Engine/Graphics/Graphics/Pipelines/Pipeline.hpp b/Engine/Graphics/Graphics/Pipelines/Pipeline.hpp index 4c9060c59..821877fce 100644 --- a/Engine/Graphics/Graphics/Pipelines/Pipeline.hpp +++ b/Engine/Graphics/Graphics/Pipelines/Pipeline.hpp @@ -14,12 +14,9 @@ class ACID_GRAPHICS_EXPORT Pipeline { */ using Stage = std::pair; - Pipeline() = default; virtual ~Pipeline() = default; - void BindPipeline(const CommandBuffer &commandBuffer) const { - vkCmdBindPipeline(commandBuffer, GetPipelineBindPoint(), GetPipeline()); - } + virtual void BindPipeline(const CommandBuffer &commandBuffer) const = 0; virtual const Shader *GetShader() const = 0; virtual bool IsPushDescriptors() const = 0; diff --git a/Engine/Graphics/Graphics/Pipelines/PipelineCompute.cpp b/Engine/Graphics/Graphics/Pipelines/PipelineCompute.cpp index d636c04ac..0ffc1b403 100644 --- a/Engine/Graphics/Graphics/Pipelines/PipelineCompute.cpp +++ b/Engine/Graphics/Graphics/Pipelines/PipelineCompute.cpp @@ -42,6 +42,10 @@ void PipelineCompute::CmdRender(const CommandBuffer &commandBuffer, const Vector vkCmdDispatch(commandBuffer, groupCountX, groupCountY, 1); } +void PipelineCompute::BindPipeline(const CommandBuffer &commandBuffer) const { + vkCmdBindPipeline(commandBuffer, GetPipelineBindPoint(), GetPipeline()); +} + void PipelineCompute::CreateShaderProgram() { std::stringstream defineBlock; for (const auto &[defineName, defineValue] : defines) diff --git a/Engine/Graphics/Graphics/Pipelines/PipelineCompute.hpp b/Engine/Graphics/Graphics/Pipelines/PipelineCompute.hpp index 34a60e42f..189157ae9 100644 --- a/Engine/Graphics/Graphics/Pipelines/PipelineCompute.hpp +++ b/Engine/Graphics/Graphics/Pipelines/PipelineCompute.hpp @@ -20,6 +20,7 @@ class ACID_GRAPHICS_EXPORT PipelineCompute : public Pipeline { ~PipelineCompute(); void CmdRender(const CommandBuffer &commandBuffer, const Vector2ui &extent) const; + void BindPipeline(const CommandBuffer &commandBuffer) const override; const std::filesystem::path &GetShaderStage() const { return shaderStage; } const std::vector &GetDefines() const { return defines; } diff --git a/Engine/Graphics/Graphics/Pipelines/PipelineGraphics.cpp b/Engine/Graphics/Graphics/Pipelines/PipelineGraphics.cpp index c9fbf8417..8c7fa13ea 100644 --- a/Engine/Graphics/Graphics/Pipelines/PipelineGraphics.cpp +++ b/Engine/Graphics/Graphics/Pipelines/PipelineGraphics.cpp @@ -61,6 +61,10 @@ PipelineGraphics::~PipelineGraphics() { vkDestroyDescriptorSetLayout(*logicalDevice, descriptorSetLayout, nullptr); } +void PipelineGraphics::BindPipeline(const CommandBuffer &commandBuffer) const { + vkCmdBindPipeline(commandBuffer, GetPipelineBindPoint(), GetPipeline()); +} + const ImageDepth *PipelineGraphics::GetDepthStencil(const std::optional &stage) const { return Graphics::Get()->GetRenderStage(stage ? *stage : this->stage.first)->GetDepthStencil(); } diff --git a/Engine/Graphics/Graphics/Pipelines/PipelineGraphics.hpp b/Engine/Graphics/Graphics/Pipelines/PipelineGraphics.hpp index 2cf7ccd9c..e70035075 100644 --- a/Engine/Graphics/Graphics/Pipelines/PipelineGraphics.hpp +++ b/Engine/Graphics/Graphics/Pipelines/PipelineGraphics.hpp @@ -46,6 +46,8 @@ class ACID_GRAPHICS_EXPORT PipelineGraphics : public Pipeline { VkCullModeFlags cullMode = VK_CULL_MODE_BACK_BIT, VkFrontFace frontFace = VK_FRONT_FACE_CLOCKWISE, bool pushDescriptors = false); ~PipelineGraphics(); + void BindPipeline(const CommandBuffer &commandBuffer) const override; + /** * Gets the depth stencil used in a stage. * @param stage The stage to get values from, if not provided the pipelines stage will be used. diff --git a/Engine/Graphics/Graphics/Renderer.hpp b/Engine/Graphics/Graphics/Renderer.hpp index 45c6e9070..fbf2a253a 100644 --- a/Engine/Graphics/Graphics/Renderer.hpp +++ b/Engine/Graphics/Graphics/Renderer.hpp @@ -10,10 +10,6 @@ namespace acid { class ACID_GRAPHICS_EXPORT Renderer { friend class Graphics; public: - /** - * Creates a new renderer, fill {@link renderStages} in your subclass of this. - */ - Renderer() = default; virtual ~Renderer() = default; /** diff --git a/Engine/Network/Network/Tcp/TcpSocket.hpp b/Engine/Network/Network/Tcp/TcpSocket.hpp index a052e402f..438ef1fc6 100644 --- a/Engine/Network/Network/Tcp/TcpSocket.hpp +++ b/Engine/Network/Network/Tcp/TcpSocket.hpp @@ -34,8 +34,6 @@ class Packet; */ class ACID_NETWORK_EXPORT PendingPacket { public: - PendingPacket() = default; - /// Data of packet size. uint32_t size = 0; /// Number of size bytes received so far. diff --git a/Engine/Scene/Maths/Frustum.hpp b/Engine/Scene/Maths/Frustum.hpp index db6115f2d..e45bc95ea 100644 --- a/Engine/Scene/Maths/Frustum.hpp +++ b/Engine/Scene/Maths/Frustum.hpp @@ -11,8 +11,6 @@ namespace acid { */ class ACID_SCENE_EXPORT Frustum { public: - Frustum() = default; - /** * Updates a frustum from the view and projection matrix. * @param view The view matrix. diff --git a/Engine/Scene/Scenes/Entity.hpp b/Engine/Scene/Scenes/Entity.hpp index ab6c03dc5..0bc819b6d 100644 --- a/Engine/Scene/Scenes/Entity.hpp +++ b/Engine/Scene/Scenes/Entity.hpp @@ -9,8 +9,6 @@ namespace acid { */ class ACID_SCENE_EXPORT Entity final : NonCopyable { public: - Entity() = default; - void Update(); const std::string &GetName() const { return name; } diff --git a/Engine/Ui/Fonts/Text.hpp b/Engine/Ui/Fonts/Text.hpp index 65622915c..7859cdb41 100644 --- a/Engine/Ui/Fonts/Text.hpp +++ b/Engine/Ui/Fonts/Text.hpp @@ -56,8 +56,6 @@ class ACID_UI_EXPORT Text : public UiObject { Left, Centre, Right, Fully }; - Text() = default; - void UpdateObject() override; bool CmdRender(const CommandBuffer &commandBuffer, const PipelineGraphics &pipeline); @@ -170,11 +168,6 @@ class ACID_UI_EXPORT Text : public UiObject { */ class Word { public: - /** - * Creates a new text word. - */ - Word() = default; - /** * Adds a glyph to the end of the current word and increases the screen-space width of the word. * @param glyph The glyph to be added. diff --git a/Engine/Ui/Uis/Inputs/UiRadioInput.hpp b/Engine/Ui/Uis/Inputs/UiRadioInput.hpp index 92ff4b1a6..f134f15ab 100644 --- a/Engine/Ui/Uis/Inputs/UiRadioInput.hpp +++ b/Engine/Ui/Uis/Inputs/UiRadioInput.hpp @@ -46,8 +46,6 @@ class ACID_UI_EXPORT UiRadioInput : public UiObject { class ACID_UI_EXPORT UiRadioManager : public virtual rocket::trackable { public: - UiRadioManager() = default; - const UiRadioInput::Type &GetMarkType() const { return type; } void SetMarkType(const UiRadioInput::Type &type) { diff --git a/External/volk/volk.h b/External/volk/volk.h index 678850c48..f6b5a8a56 100644 --- a/External/volk/volk.h +++ b/External/volk/volk.h @@ -72,7 +72,7 @@ struct VolkDeviceTable; * * Returns VK_SUCCESS on success and VK_ERROR_INITIALIZATION_FAILED otherwise. */ -VkResult volkInitialize(void); +ACID_CONTEXT_EXPORT VkResult volkInitialize(void); /** * Initialize library by providing a custom handler to load global symbols. @@ -81,50 +81,50 @@ VkResult volkInitialize(void); * The handler function pointer will be asked to load global Vulkan symbols which require no instance * (such as vkCreateInstance, vkEnumerateInstance* and vkEnumerateInstanceVersion if available). */ -void volkInitializeCustom(PFN_vkGetInstanceProcAddr handler); +ACID_CONTEXT_EXPORT void volkInitializeCustom(PFN_vkGetInstanceProcAddr handler); /** * Get Vulkan instance version supported by the Vulkan loader, or 0 if Vulkan isn't supported * * Returns 0 if volkInitialize wasn't called or failed. */ -uint32_t volkGetInstanceVersion(void); +ACID_CONTEXT_EXPORT uint32_t volkGetInstanceVersion(void); /** * Load global function pointers using application-created VkInstance; call this function after creating the Vulkan instance. */ -void volkLoadInstance(VkInstance instance); +ACID_CONTEXT_EXPORT void volkLoadInstance(VkInstance instance); /** * Load global function pointers using application-created VkInstance; call this function after creating the Vulkan instance. * Skips loading device-based function pointers, requires usage of volkLoadDevice afterwards. */ -void volkLoadInstanceOnly(VkInstance instance); +ACID_CONTEXT_EXPORT void volkLoadInstanceOnly(VkInstance instance); /** * Load global function pointers using application-created VkDevice; call this function after creating the Vulkan device. * * Note: this is not suitable for applications that want to use multiple VkDevice objects concurrently. */ -void volkLoadDevice(VkDevice device); +ACID_CONTEXT_EXPORT void volkLoadDevice(VkDevice device); /** * Return last VkInstance for which global function pointers have been loaded via volkLoadInstance(), * or VK_NULL_HANDLE if volkLoadInstance() has not been called. */ -VkInstance volkGetLoadedInstance(void); +ACID_CONTEXT_EXPORT VkInstance volkGetLoadedInstance(void); /** * Return last VkDevice for which global function pointers have been loaded via volkLoadDevice(), * or VK_NULL_HANDLE if volkLoadDevice() has not been called. */ -VkDevice volkGetLoadedDevice(void); +ACID_CONTEXT_EXPORT VkDevice volkGetLoadedDevice(void); /** * Load function pointers using application-created VkDevice into a table. * Application should use function pointers from that table instead of using global function pointers. */ -void volkLoadDeviceTable(struct VolkDeviceTable* table, VkDevice device); +ACID_CONTEXT_EXPORT void volkLoadDeviceTable(struct VolkDeviceTable* table, VkDevice device); /** * Device-specific function pointer table