From d715e3806aec206412a7f9ea42d353739ab1eeab Mon Sep 17 00:00:00 2001 From: Thaddeus Crews Date: Mon, 23 Sep 2024 09:13:51 -0500 Subject: [PATCH] CI: Add MinGW/GCC build to Windows GHA --- .github/workflows/windows_builds.yml | 27 ++++++++++++++----- drivers/d3d12/SCsub | 6 +++++ drivers/d3d12/dxil_hash.cpp | 2 +- .../d3d12/rendering_device_driver_d3d12.cpp | 9 +++++-- platform/windows/detect.py | 3 ++- 5 files changed, 37 insertions(+), 10 deletions(-) diff --git a/.github/workflows/windows_builds.yml b/.github/workflows/windows_builds.yml index 95e3d4a553d..384284b6047 100644 --- a/.github/workflows/windows_builds.yml +++ b/.github/workflows/windows_builds.yml @@ -30,7 +30,7 @@ jobs: # 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 - artifact: true + compiler: msvc - name: Editor w/ clang-cl (target=editor, tests=yes, use_llvm=yes) cache-name: windows-editor-clang @@ -38,6 +38,7 @@ jobs: tests: true sconsflags: debug_symbols=no windows_subsystem=console use_llvm=yes bin: ./bin/godot.windows.editor.x86_64.llvm.exe + compiler: clang - name: Template (target=template_release, tests=yes) cache-name: windows-template @@ -45,7 +46,16 @@ jobs: tests: true sconsflags: debug_symbols=no bin: ./bin/godot.windows.template_release.x86_64.console.exe - artifact: true + compiler: msvc + + - 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 steps: - name: Checkout @@ -69,16 +79,21 @@ jobs: uses: dsaltares/fetch-gh-release-asset@1.1.2 with: repo: godotengine/godot-angle-static - version: tags/chromium/6029 - file: Windows.6029-1.MSVC_17.x86_64.x86_32.zip + version: tags/chromium/6601.2 + file: godot-angle-static-x86_64-${{ matrix.compiler == 'gcc' && 'gcc' || 'msvc' }}-release.zip target: angle/angle.zip - name: Extract pre-built ANGLE static libraries run: Expand-Archive -Force angle/angle.zip ${{ github.workspace }}/ - name: Setup MSVC problem matcher + if: matrix.compiler == 'msvc' uses: ammaraskar/msvc-problem-matcher@master + - name: Setup GCC problem matcher + if: matrix.compiler != 'msvc' + uses: ammaraskar/gcc-problem-matcher@master + - name: Compilation uses: ./.github/actions/godot-build with: @@ -94,12 +109,12 @@ jobs: continue-on-error: true - name: Prepare artifact - if: ${{ matrix.artifact }} + if: matrix.compiler == 'msvc' run: | Remove-Item bin/* -Include *.exp,*.lib,*.pdb -Force - name: Upload artifact - if: ${{ matrix.artifact }} + if: matrix.compiler == 'msvc' uses: ./.github/actions/upload-artifact with: name: ${{ matrix.cache-name }} diff --git a/drivers/d3d12/SCsub b/drivers/d3d12/SCsub index b6ceed23ac8..beeb13398e3 100644 --- a/drivers/d3d12/SCsub +++ b/drivers/d3d12/SCsub @@ -4,6 +4,8 @@ from misc.utility.scons_hints import * import os from pathlib import Path +import methods + Import("env") env_d3d12_rdd = env.Clone() @@ -139,6 +141,10 @@ else: extra_defines += [ "HAVE_STRUCT_TIMESPEC", ] + if methods.using_gcc(env) and methods.get_compiler_version(env)["major"] < 13: + # `region` & `endregion` not recognized as valid pragmas. + env_d3d12_rdd.Append(CCFLAGS=["-Wno-unknown-pragmas"]) + env.Append(CCFLAGS=["-Wno-unknown-pragmas"]) # This is needed since rendering_device_d3d12.cpp needs to include some Mesa internals. env_d3d12_rdd.Prepend(CPPPATH=mesa_private_inc_paths) diff --git a/drivers/d3d12/dxil_hash.cpp b/drivers/d3d12/dxil_hash.cpp index f94a4a30df3..e08492c9ea9 100644 --- a/drivers/d3d12/dxil_hash.cpp +++ b/drivers/d3d12/dxil_hash.cpp @@ -96,7 +96,7 @@ void compute_dxil_hash(const BYTE *pData, UINT byteCount, BYTE *pOutHash) { UINT NextEndState = bTwoRowsPadding ? N - 2 : N - 1; const BYTE *pCurrData = pData; for (UINT i = 0; i < N; i++, offset += 64, pCurrData += 64) { - UINT x[16]; + UINT x[16] = {}; const UINT *pX; if (i == NextEndState) { if (!bTwoRowsPadding && i == N - 1) { diff --git a/drivers/d3d12/rendering_device_driver_d3d12.cpp b/drivers/d3d12/rendering_device_driver_d3d12.cpp index 52883de45e6..9db4fa09a4a 100644 --- a/drivers/d3d12/rendering_device_driver_d3d12.cpp +++ b/drivers/d3d12/rendering_device_driver_d3d12.cpp @@ -1415,7 +1415,14 @@ RDD::TextureID RenderingDeviceDriverD3D12::texture_create(const TextureFormat &p } tex_info->states_ptr = &tex_info->owner_info.states; tex_info->format = p_format.format; +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif tex_info->desc = *(CD3DX12_RESOURCE_DESC *)&resource_desc; +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif tex_info->base_layer = 0; tex_info->layers = resource_desc.ArraySize(); tex_info->base_mip = 0; @@ -6645,8 +6652,6 @@ static Error create_command_signature(ID3D12Device *device, D3D12_INDIRECT_ARGUM Error RenderingDeviceDriverD3D12::_initialize_frames(uint32_t p_frame_count) { Error err; - D3D12MA::ALLOCATION_DESC allocation_desc = {}; - allocation_desc.HeapType = D3D12_HEAP_TYPE_DEFAULT; //CD3DX12_RESOURCE_DESC resource_desc = CD3DX12_RESOURCE_DESC::Buffer(D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT); uint32_t resource_descriptors_per_frame = GLOBAL_GET("rendering/rendering_device/d3d12/max_resource_descriptors_per_frame"); diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 4043f3a8c28..249d9540d78 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -789,7 +789,8 @@ def configure_mingw(env: "SConsEnvironment"): if try_cmd("as --version", env["mingw_prefix"], env["arch"]): env["AS"] = mingw_bin_prefix + "as" if try_cmd("gcc-ar --version", env["mingw_prefix"], env["arch"]): - env["AR"] = mingw_bin_prefix + "gcc-ar" + if os.name != "nt": # Don't affect cross-compilation. + env["AR"] = mingw_bin_prefix + "gcc-ar" if try_cmd("gcc-ranlib --version", env["mingw_prefix"], env["arch"]): env["RANLIB"] = mingw_bin_prefix + "gcc-ranlib"