From f4d3a0eba658c9043985a040b4878021a368708d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C4=81rti=C5=86=C5=A1=20Mo=C5=BEeiko?= Date: Wed, 17 Jul 2024 17:09:20 -0700 Subject: [PATCH] mesa 24.1.4 --- .github/workflows/build-mesa.yml | 100 +++++-------- .gitignore | 8 +- README.md | 3 +- build.cmd | 239 ++++++++++++++++++++++--------- mesa-zink.patch | 19 --- mesa.patch | 13 -- meson-arm64.txt | 12 ++ meson-x64.txt | 12 ++ meson.llvm.build | 39 +++++ 9 files changed, 278 insertions(+), 167 deletions(-) create mode 100644 meson-arm64.txt create mode 100644 meson-x64.txt create mode 100644 meson.llvm.build diff --git a/.github/workflows/build-mesa.yml b/.github/workflows/build-mesa.yml index d0d6a03..f95d915 100644 --- a/.github/workflows/build-mesa.yml +++ b/.github/workflows/build-mesa.yml @@ -9,80 +9,52 @@ on: jobs: build: runs-on: windows-2022 + strategy: + matrix: + arch: [x64, arm64] + + outputs: + MESA_VERSION: ${{ steps.build.outputs.MESA_VERSION }} + LLVM_VERSION: ${{ steps.build.outputs.LLVM_VERSION }} + steps: - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: build id: build shell: cmd - run: call build.cmd - - - name: release - id: release - if: steps.build.outputs.MESA_VERSION != '' - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.build.outputs.MESA_VERSION }} - release_name: ${{ steps.build.outputs.MESA_VERSION }} - body: | - [mesa ${{ steps.build.outputs.MESA_VERSION }} release notes](https://docs.mesa3d.org/relnotes/${{ steps.build.outputs.MESA_VERSION }}.html) - [llvm ${{ steps.build.outputs.LLVM_VERSION }} release notes](https://github.com/llvm/llvm-project/releases/tag/llvmorg-${{ steps.build.outputs.LLVM_VERSION }}) + run: call build.cmd ${{ matrix.arch }} - - name: upload llvmpipe - id: upload-llvmpipe - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: upload artifacts + uses: actions/upload-artifact@v4 with: - upload_url: ${{ steps.release.outputs.upload_url }} - asset_path: "mesa-llvmpipe-${{ steps.build.outputs.MESA_VERSION }}.zip" - asset_name: "mesa-llvmpipe-${{ steps.build.outputs.MESA_VERSION }}.zip" - asset_content_type: application/zip - - - name: upload osmesa - id: upload-osmesa - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.release.outputs.upload_url }} - asset_path: "mesa-osmesa-${{ steps.build.outputs.MESA_VERSION }}.zip" - asset_name: "mesa-osmesa-${{ steps.build.outputs.MESA_VERSION }}.zip" - asset_content_type: application/zip + name: mesa-${{ matrix.arch }}-${{ steps.build.outputs.MESA_VERSION }} + path: mesa-*-${{ matrix.arch }}-${{ steps.build.outputs.MESA_VERSION }}.zip + if-no-files-found: error + compression-level: 0 + + release: + runs-on: ubuntu-24.04 + needs: build + permissions: + contents: write + env: + GH_TOKEN: ${{ github.token }} + steps: - - name: upload lavapipe - id: upload-lavapipe - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.release.outputs.upload_url }} - asset_path: "mesa-lavapipe-${{ steps.build.outputs.MESA_VERSION }}.zip" - asset_name: "mesa-lavapipe-${{ steps.build.outputs.MESA_VERSION }}.zip" - asset_content_type: application/zip + - name: release + run: | + echo '[mesa ${{ needs.build.outputs.MESA_VERSION }} release notes](https://docs.mesa3d.org/relnotes/${{ needs.build.outputs.MESA_VERSION }}.html)' >>notes.txt + echo '[llvm ${{ needs.build.outputs.LLVM_VERSION }} release notes](https://github.com/llvm/llvm-project/releases/tag/llvmorg-${{ needs.build.outputs.LLVM_VERSION }})' >>notes.txt + gh release create ${{ needs.build.outputs.MESA_VERSION }} -R "${GITHUB_REPOSITORY}" -t '${{ needs.build.outputs.MESA_VERSION }}' -F notes.txt - - name: upload d3d12 - id: upload-d3d12 - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: get artifacts + uses: actions/download-artifact@v4 with: - upload_url: ${{ steps.release.outputs.upload_url }} - asset_path: "mesa-d3d12-${{ steps.build.outputs.MESA_VERSION }}.zip" - asset_name: "mesa-d3d12-${{ steps.build.outputs.MESA_VERSION }}.zip" - asset_content_type: application/zip + pattern: mesa-*-${{ needs.build.outputs.MESA_VERSION }} + merge-multiple: true - - name: upload zink - id: upload-zink - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.release.outputs.upload_url }} - asset_path: "mesa-zink-${{ steps.build.outputs.MESA_VERSION }}.zip" - asset_name: "mesa-zink-${{ steps.build.outputs.MESA_VERSION }}.zip" - asset_content_type: application/zip + - name: upload artifacts + run: gh release upload '${{ needs.build.outputs.MESA_VERSION }}' mesa-*-${{ needs.build.outputs.MESA_VERSION }}.zip -R "${GITHUB_REPOSITORY}" diff --git a/.gitignore b/.gitignore index 3a720b2..0bd695d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,11 @@ -llvm +llvm-* llvm.src -llvm.build +llvm.build-* mesa-* mesa.src -mesa.build +mesa.build-* archive-* winflexbison +cmake *.zip *.exe - diff --git a/README.md b/README.md index ce27925..3542790 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Automatic build of [mesa][] opengl implementations for 64-bit Windows. +Automatic build of [mesa][] opengl & vulkan implementations for 64-bit Windows. Builds are linked statically to their dependencies, just place necessary dll file next to your exe and it will use it. @@ -9,6 +9,7 @@ Download binary builds as zip archive from [latest release][] page. It provides * [d3d12][] - [Collabora & Microsoft][collabora] implementation of OpenGL using D3D12 * [zink][] - implementation of OpenGL using Vulkan * lavapipe - software implementation of Vulkan using llvm +* dzn - Microsoft implementation of Vulkan using D3D12 To build locally run `build.cmd` batch file, make sure you have installed all necessary dependencies (see the beginning of file). diff --git a/build.cmd b/build.cmd index 9316f71..1d73277 100644 --- a/build.cmd +++ b/build.cmd @@ -1,10 +1,52 @@ @echo off setlocal enabledelayedexpansion -set LLVM_VERSION=18.1.7 -set MESA_VERSION=24.1.2 +set LLVM_VERSION=18.1.8 +set MESA_VERSION=24.1.4 -set PATH=%CD%\llvm\bin;%CD%\winflexbison;%PATH% +rem *** architectures *** + +if "%1" equ "x64" ( + set MESA_ARCH=x64 +) else if "%1" equ "arm64" ( + set MESA_ARCH=arm64 +) else if "%1" neq "" ( + echo Unknown "%1" architecture! + exit /b 1 +) else if "%PROCESSOR_ARCHITECTURE%" equ "AMD64" ( + set MESA_ARCH=x64 +) else if "%PROCESSOR_ARCHITECTURE%" equ "ARM64" ( + set MESA_ARCH=arm64 +) else ( + echo Unknown host architecture! + exit /b 1 +) + +if "%MESA_ARCH%" equ "x64" ( + set TARGET_ARCH=amd64 + set LLVM_TARGETS_TO_BUILD=X86 + set TARGET_ARCH_NAME=x86_64 +) else if "%MESA_ARCH%" equ "arm64" ( + set TARGET_ARCH=arm64 + set LLVM_TARGETS_TO_BUILD=AArch64 + set TARGET_ARCH_NAME=aarch64 +) + +if "%PROCESSOR_ARCHITECTURE%" equ "AMD64" ( + set HOST_ARCH=amd64 +) else if "%PROCESSOR_ARCHITECTURE%" equ "ARM64" ( + set HOST_ARCH=arm64 +) + +if "!TARGET_ARCH!" neq "!HOST_ARCH!" ( + set LLVM_CROSS_CMAKE_FLAGS=-D CMAKE_SYSTEM_NAME=Windows -D LLVM_NATIVE_TOOL_DIR="%CD%\llvm.build-native\bin" + set MESON_CROSS=--cross-file "%CD%\meson-%MESA_ARCH%.txt" +) else if "%MESA_ARCH%" equ "arm64" ( + set LLVM_CROSS_CMAKE_FLAGS= + set MESON_CROSS= +) + +set PATH=%CD%\llvm-%MESA_ARCH%\bin;%CD%\winflexbison;%PATH% rem *** check dependencies *** @@ -60,46 +102,41 @@ where /q cmake.exe || ( ) where /q ninja.exe || ( - curl -Lsf -o ninja-win.zip https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip || exit /b 1 + if "%PROCESSOR_ARCHITECTURE%" equ "AMD64" ( + curl -LOsf https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-win.zip || exit /b 1 + ) else if "%PROCESSOR_ARCHITECTURE%" equ "ARM64" ( + curl -Lsf -o ninja-win.zip https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-winarm64.zip || exit /b 1 + ) %SZIP% x -bb0 -y ninja-win.zip 1>nul 2>nul || exit /b 1 del ninja-win.zip 1>nul 2>nul ) -rem *** Visual Studio environment *** - -where /Q cl.exe || ( - set __VSCMD_ARG_NO_LOGO=1 - for /f "tokens=*" %%i in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath') do set VS=%%i - if "!VS!" equ "" ( - echo ERROR: Visual Studio installation not found - exit /b 1 - ) - call "!VS!\VC\Auxiliary\Build\vcvarsall.bat" amd64 || exit /b 1 -) - rem *** download sources *** echo Downloading llvm curl -sfL https://github.com/llvm/llvm-project/releases/download/llvmorg-%LLVM_VERSION%/llvm-%LLVM_VERSION%.src.tar.xz ^ - | %SZIP% x -bb0 -txz -si -so ^ - | %SZIP% x -bb0 -ttar -si -aoa 1>nul 2>nul + | %SZIP% x -bb0 -txz -si -so ^ + | %SZIP% x -bb0 -ttar -si -aoa 1>nul 2>nul curl -sfL https://github.com/llvm/llvm-project/releases/download/llvmorg-%LLVM_VERSION%/cmake-%LLVM_VERSION%.src.tar.xz ^ | %SZIP% x -bb0 -txz -si -so ^ | %SZIP% x -bb0 -ttar -si -aoa 1>nul 2>nul -move llvm-%LLVM_VERSION%.src llvm.src -move cmake-%LLVM_VERSION%.src cmake +rd /s /q llvm.src 1>nul 2>nul +move llvm-%LLVM_VERSION%.src llvm.src 1>nul 2>nul +move cmake-%LLVM_VERSION%.src cmake 1>nul 2>nul echo Downloading mesa curl -sfL https://archive.mesa3d.org/mesa-%MESA_VERSION%.tar.xz ^ | %SZIP% x -bb0 -txz -si -so ^ | %SZIP% x -bb0 -ttar -si -aoa 1>nul 2>nul -move mesa-%MESA_VERSION% mesa.src -curl -sfLO https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29819.patch || exit /b 1 +rd /s /q mesa.src 1>nul 2>nul +move mesa-%MESA_VERSION% mesa.src 1>nul 2>nul git apply -p0 --directory=mesa.src mesa.patch || exit /b 1 -git apply -p1 --directory=mesa.src 29819.patch || exit /b 1 -echo Downloading win_flex_bison +mkdir mesa.src\subprojects\llvm +copy meson.llvm.build mesa.src\subprojects\llvm\meson.build + if not exist winflexbison ( + echo Downloading win_flex_bison mkdir winflexbison pushd winflexbison curl -sfL -o win_flex_bison.zip https://github.com/lexxmark/winflexbison/releases/download/v2.5.25/win_flex_bison-2.5.25.zip || exit /b 1 @@ -110,17 +147,75 @@ if not exist winflexbison ( del "@PaxHeader" "HEAD" "pax_global_header" 1>nul 2>nul +rem *** Visual Studio *** + +set __VSCMD_ARG_NO_LOGO=1 +for /f "tokens=*" %%i in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -property installationPath') do set VS=%%i +if "!VS!" equ "" ( + echo ERROR: Visual Studio installation not found + exit /b 1 +) + rem *** llvm *** +if "!TARGET_ARCH!" neq "!HOST_ARCH!" ( + + call "!VS!\Common7\Tools\VsDevCmd.bat" -arch=!HOST_ARCH! -host_arch=!HOST_ARCH! -startdir=none -no_logo || exit /b 1 + cmake ^ + -G Ninja ^ + -S llvm.src ^ + -B llvm.build-native ^ + -D CMAKE_INSTALL_PREFIX="%CD%\llvm-native" ^ + -D CMAKE_BUILD_TYPE="Release" ^ + -D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded ^ + -D BUILD_SHARED_LIBS=OFF ^ + -D LLVM_TARGETS_TO_BUILD=%LLVM_TARGETS_TO_BUILD% ^ + -D LLVM_ENABLE_BACKTRACES=OFF ^ + -D LLVM_ENABLE_UNWIND_TABLES=OFF ^ + -D LLVM_ENABLE_CRASH_OVERRIDES=OFF ^ + -D LLVM_ENABLE_TERMINFO=OFF ^ + -D LLVM_ENABLE_LIBXML2=OFF ^ + -D LLVM_ENABLE_LIBEDIT=OFF ^ + -D LLVM_ENABLE_LIBPFM=OFF ^ + -D LLVM_ENABLE_ZLIB=OFF ^ + -D LLVM_ENABLE_Z3_SOLVER=OFF ^ + -D LLVM_ENABLE_WARNINGS=OFF ^ + -D LLVM_ENABLE_PEDANTIC=OFF ^ + -D LLVM_ENABLE_WERROR=OFF ^ + -D LLVM_ENABLE_ASSERTIONS=OFF ^ + -D LLVM_BUILD_LLVM_C_DYLIB=OFF ^ + -D LLVM_BUILD_UTILS=OFF ^ + -D LLVM_BUILD_TESTS=OFF ^ + -D LLVM_BUILD_DOCS=OFF ^ + -D LLVM_BUILD_EXAMPLES=OFF ^ + -D LLVM_BUILD_BENCHMARKS=OFF ^ + -D LLVM_INCLUDE_UTILS=OFF ^ + -D LLVM_INCLUDE_TESTS=OFF ^ + -D LLVM_INCLUDE_DOCS=OFF ^ + -D LLVM_INCLUDE_EXAMPLES=OFF ^ + -D LLVM_INCLUDE_BENCHMARKS=OFF ^ + -D LLVM_ENABLE_BINDINGS=OFF ^ + -D LLVM_OPTIMIZED_TABLEGEN=ON ^ + -D LLVM_ENABLE_PLUGINS=OFF ^ + -D LLVM_ENABLE_IDE=OFF || exit /b 1 + + ninja -C llvm.build-native llvm-tblgen || exit /b 1 + echo . > llvm.build-native\bin\llvm-nm.exe + echo . > llvm.build-native\bin\llvm-readobj.exe +) + +call "!VS!\Common7\Tools\VsDevCmd.bat" -arch=!TARGET_ARCH! -host_arch=!HOST_ARCH! -startdir=none -no_logo || exit /b 1 cmake ^ -G Ninja ^ -S llvm.src ^ - -B llvm.build ^ - -D CMAKE_INSTALL_PREFIX="%CD%\llvm" ^ + -B llvm.build-%MESA_ARCH% ^ + !LLVM_CROSS_CMAKE_FLAGS! ^ + -D CMAKE_INSTALL_PREFIX="%CD%\llvm-%MESA_ARCH%" ^ -D CMAKE_BUILD_TYPE="Release" ^ -D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded ^ -D BUILD_SHARED_LIBS=OFF ^ - -D LLVM_TARGETS_TO_BUILD="X86" ^ + -D LLVM_HOST_TRIPLE=!TARGET_ARCH_NAME!-pc-windows-msvc ^ + -D LLVM_TARGETS_TO_BUILD=%LLVM_TARGETS_TO_BUILD% ^ -D LLVM_ENABLE_BACKTRACES=OFF ^ -D LLVM_ENABLE_UNWIND_TABLES=OFF ^ -D LLVM_ENABLE_CRASH_OVERRIDES=OFF ^ @@ -149,8 +244,8 @@ cmake ^ -D LLVM_OPTIMIZED_TABLEGEN=ON ^ -D LLVM_ENABLE_PLUGINS=OFF ^ -D LLVM_ENABLE_IDE=OFF || exit /b 1 -ninja -C llvm.build -ninja -C llvm.build install || exit /b 1 +ninja -C llvm.build-%MESA_ARCH% llvm-headers llvm-libraries || exit /b 1 +ninja -C llvm.build-%MESA_ARCH% install-llvm-headers install-llvm-libraries 1>nul || exit /b 1 rem *** extra libs *** @@ -158,11 +253,11 @@ set LINK=version.lib rem *** llvmpipe *** -rd /s /q mesa.build 1>nul 2>nul +rd /s /q mesa.build-%MESA_ARCH% 1>nul 2>nul meson setup ^ - mesa.build ^ + mesa.build-%MESA_ARCH% ^ mesa.src ^ - --prefix="%CD%\mesa-llvmpipe" ^ + --prefix="%CD%\mesa-llvmpipe-%MESA_ARCH%" ^ --default-library=static ^ -Dbuildtype=release ^ -Db_ndebug=true ^ @@ -171,16 +266,18 @@ meson setup ^ -Dplatforms=windows ^ -Dosmesa=true ^ -Dgallium-drivers=swrast ^ - -Dvulkan-drivers=swrast || exit /b 1 -ninja -C mesa.build install || exit /b 1 + -Dvulkan-drivers=swrast ^ + !MESON_CROSS! || exit /b 1 +ninja -C mesa.build-%MESA_ARCH% install || exit /b 1 +python mesa.src\src\vulkan\util\vk_icd_gen.py --api-version 1.1 --xml mesa.src\src\vulkan\registry\vk.xml --lib-path vulkan_lvp.dll --out mesa-llvmpipe-%MESA_ARCH%\bin\lvp_icd.!TARGET_ARCH_NAME!.json || exit /b 1 -rem *** d3d12 *** +rem *** d3d12 & dzn *** -rd /s /q mesa.build 1>nul 2>nul +rd /s /q mesa.build-%MESA_ARCH% 1>nul 2>nul meson setup ^ - mesa.build ^ + mesa.build-%MESA_ARCH% ^ mesa.src ^ - --prefix="%CD%\mesa-d3d12" ^ + --prefix="%CD%\mesa-d3d12-%MESA_ARCH%" ^ --default-library=static ^ -Dbuildtype=release ^ -Db_ndebug=true ^ @@ -188,18 +285,20 @@ meson setup ^ -Dllvm=disabled ^ -Dplatforms=windows ^ -Dosmesa=false ^ - -Dgallium-drivers=d3d12 || exit /b 1 -ninja -C mesa.build install || exit /b 1 + -Dgallium-drivers=d3d12 ^ + -Dvulkan-drivers=microsoft-experimental ^ + !MESON_CROSS! || exit /b 1 +ninja -C mesa.build-%MESA_ARCH% install || exit /b 1 +python mesa.src\src\vulkan\util\vk_icd_gen.py --api-version 1.1 --xml mesa.src\src\vulkan\registry\vk.xml --lib-path vulkan_dzn.dll --out mesa-d3d12-%MESA_ARCH%\bin\dzn_icd.!TARGET_ARCH_NAME!.json || exit /b 1 rem *** zink *** -rd /s /q mesa.build 1>nul 2>nul -rem includes rebased changes from https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29806 +rd /s /q mesa.build-%MESA_ARCH% 1>nul 2>nul git apply -p0 --directory=mesa.src mesa-zink.patch || exit /b 1 meson setup ^ - mesa.build ^ + mesa.build-%MESA_ARCH% ^ mesa.src ^ - --prefix="%CD%\mesa-zink" ^ + --prefix="%CD%\mesa-zink-%MESA_ARCH%" ^ --default-library=static ^ -Dbuildtype=release ^ -Db_ndebug=true ^ @@ -207,8 +306,9 @@ meson setup ^ -Dllvm=disabled ^ -Dplatforms=windows ^ -Dosmesa=false ^ - -Dgallium-drivers=zink || exit /b 1 -ninja -C mesa.build install || exit /b 1 + -Dgallium-drivers=zink ^ + !MESON_CROSS! || exit /b 1 +ninja -C mesa.build-%MESA_ARCH% install || exit /b 1 rem *** done *** rem output is in mesa-llvmpipe, mesa-d3d12, mesa-zink folders @@ -216,43 +316,50 @@ rem output is in mesa-llvmpipe, mesa-d3d12, mesa-zink folders if "%GITHUB_WORKFLOW%" neq "" ( mkdir archive-llvmpipe pushd archive-llvmpipe - copy /y ..\mesa-llvmpipe\bin\opengl32.dll . - %SZIP% a -mx=9 ..\mesa-llvmpipe-%MESA_VERSION%.zip + copy /y ..\mesa-llvmpipe-%MESA_ARCH%\bin\opengl32.dll . + %SZIP% a -mx=9 ..\mesa-llvmpipe-%MESA_ARCH%-%MESA_VERSION%.zip popd mkdir archive-osmesa pushd archive-osmesa - copy /y ..\mesa-llvmpipe\bin\osmesa.dll . - copy /y ..\mesa-llvmpipe\lib\osmesa.lib . - copy /y ..\mesa-llvmpipe\include\GL\osmesa.h . - %SZIP% a -mx=9 ..\mesa-osmesa-%MESA_VERSION%.zip + copy /y ..\mesa-llvmpipe-%MESA_ARCH%\bin\osmesa.dll . + copy /y ..\mesa-llvmpipe-%MESA_ARCH%\lib\osmesa.lib . + copy /y ..\mesa-llvmpipe-%MESA_ARCH%\include\GL\osmesa.h . + %SZIP% a -mx=9 ..\mesa-osmesa-%MESA_ARCH%-%MESA_VERSION%.zip popd mkdir archive-lavapipe pushd archive-lavapipe - copy /y ..\mesa-llvmpipe\bin\vulkan_lvp.dll . - python ..\mesa.src\src\vulkan\util\vk_icd_gen.py --api-version 1.1 --xml ..\mesa.src\src\vulkan\registry\vk.xml --lib-path vulkan_lvp.dll --out lvp_icd.x86_64.json - - %SZIP% a -mx=9 ..\mesa-lavapipe-%MESA_VERSION%.zip + copy /y ..\mesa-llvmpipe-%MESA_ARCH%\bin\vulkan_lvp.dll . + copy /y ..\mesa-llvmpipe-%MESA_ARCH%\bin\lvp_icd.!TARGET_ARCH_NAME!.json . + %SZIP% a -mx=9 ..\mesa-lavapipe-%MESA_ARCH%-%MESA_VERSION%.zip popd mkdir archive-d3d12 pushd archive-d3d12 - copy /y ..\mesa-d3d12\bin\opengl32.dll . - if exist "%ProgramFiles(x86)%\Windows Kits\10\Redist\D3D\x64\dxil.dll" ( - copy /y "%ProgramFiles(x86)%\Windows Kits\10\Redist\D3D\x64\dxil.dll" . - ) else if exist "%WindowsSdkVerBinPath%x64\dxil.dll" ( - copy /y "%WindowsSdkVerBinPath%x64\dxil.dll" . + copy /y ..\mesa-d3d12-%MESA_ARCH%\bin\opengl32.dll . + if exist "%ProgramFiles(x86)%\Windows Kits\10\Redist\D3D\%MESA_ARCH%\dxil.dll" ( + copy /y "%ProgramFiles(x86)%\Windows Kits\10\Redist\D3D\%MESA_ARCH%\dxil.dll" . + ) else if exist "%WindowsSdkVerBinPath%%MESA_ARCH%\dxil.dll" ( + copy /y "%WindowsSdkVerBinPath%%MESA_ARCH%\dxil.dll" . ) - %SZIP% a -mx=9 ..\mesa-d3d12-%MESA_VERSION%.zip + %SZIP% a -mx=9 ..\mesa-d3d12-%MESA_ARCH%-%MESA_VERSION%.zip popd mkdir archive-zink pushd archive-zink - copy /y ..\mesa-zink\bin\opengl32.dll . - %SZIP% a -mx=9 ..\mesa-zink-%MESA_VERSION%.zip + copy /y ..\mesa-zink-%MESA_ARCH%\bin\opengl32.dll . + %SZIP% a -mx=9 ..\mesa-zink-%MESA_ARCH%-%MESA_VERSION%.zip + popd + + mkdir archive-dzn + pushd archive-dzn + copy /y ..\mesa-d3d12-%MESA_ARCH%\bin\vulkan_dzn.dll . + copy /y ..\archive-d3d12\dxil.dll . + copy /y ..\mesa-d3d12-%MESA_ARCH%\bin\dzn_icd.!TARGET_ARCH_NAME!.json . + %SZIP% a -mx=9 ..\mesa-dzn-%MESA_ARCH%-%MESA_VERSION%.zip popd - echo ::set-output name=LLVM_VERSION::%LLVM_VERSION% - echo ::set-output name=MESA_VERSION::%MESA_VERSION% + echo LLVM_VERSION=%LLVM_VERSION%>>%GITHUB_OUTPUT% + echo MESA_VERSION=%MESA_VERSION%>>%GITHUB_OUTPUT% ) diff --git a/mesa-zink.patch b/mesa-zink.patch index 7a90d2e..39d3c72 100644 --- a/mesa-zink.patch +++ b/mesa-zink.patch @@ -11,22 +11,3 @@ index 90ebfd6..9a6063d 100644 vk_struct_type_cast, vk_extensions], include_directories : [inc_include, inc_src], dependencies : [vulkan_wsi_deps, idep_mesautil, idep_nir_headers], -diff --git src/gallium/drivers/zink/zink_screen.c.org src/gallium/drivers/zink/zink_screen.c -index 9177e85..935d880 100644 ---- src/gallium/drivers/zink/zink_screen.c -+++ src/gallium/drivers/zink/zink_screen.c -@@ -3268,12 +3268,12 @@ zink_internal_create_screen(const struct pipe_screen_config *config, int64_t dev - - struct zink_screen *screen = rzalloc(NULL, struct zink_screen); - if (!screen) { -- if (!config->implicit_driver_load) -+ if (!config || !config->implicit_driver_load) - mesa_loge("ZINK: failed to allocate screen"); - return NULL; - } - -- screen->implicitly_loaded = config->implicit_driver_load; -+ screen->implicitly_loaded = config && config->implicit_driver_load; - screen->drm_fd = -1; - - glsl_type_singleton_init_or_ref(); diff --git a/mesa.patch b/mesa.patch index c97b85b..358d7b9 100644 --- a/mesa.patch +++ b/mesa.patch @@ -106,16 +106,3 @@ index ebfcf94..ce9855d 100644 if with_any_intel subdir('intel') endif -diff --git src/util/futex.h src/util/futex.h -index 2a2a00c..5aff5ef 100644 ---- src/util/futex.h -+++ src/util/futex.h -@@ -31,7 +31,7 @@ - #elif defined(__OpenBSD__) - #define UTIL_FUTEX_SUPPORTED 1 - #elif defined(_WIN32) && !defined(WINDOWS_NO_FUTEX) --#define UTIL_FUTEX_SUPPORTED 1 -+#define UTIL_FUTEX_SUPPORTED 0 - #else - #define UTIL_FUTEX_SUPPORTED 0 - #endif diff --git a/meson-arm64.txt b/meson-arm64.txt new file mode 100644 index 0000000..de51060 --- /dev/null +++ b/meson-arm64.txt @@ -0,0 +1,12 @@ +[binaries] +c = 'cl.exe' +cpp = 'cl.exe' + +[host_machine] +system = 'windows' +cpu_family = 'aarch64' +cpu = 'aarch64' +endian = 'little' + +[properties] +skip_sanity_check = true diff --git a/meson-x64.txt b/meson-x64.txt new file mode 100644 index 0000000..7d49cf8 --- /dev/null +++ b/meson-x64.txt @@ -0,0 +1,12 @@ +[binaries] +c = 'cl.exe' +cpp = 'cl.exe' + +[host_machine] +system = 'windows' +cpu_family = 'x86_64' +cpu = 'x86_64' +endian = 'little' + +[properties] +skip_sanity_check = true diff --git a/meson.llvm.build b/meson.llvm.build new file mode 100644 index 0000000..cbd041d --- /dev/null +++ b/meson.llvm.build @@ -0,0 +1,39 @@ +project('llvm', ['cpp']) + +cpp = meson.get_compiler('cpp') + +deps = ['LLVMAggressiveInstCombine', 'LLVMAnalysis', 'LLVMAsmParser', 'LLVMAsmPrinter', + 'LLVMBinaryFormat', 'LLVMBitReader', 'LLVMBitstreamReader', 'LLVMBitWriter', + 'LLVMCFGuard', 'LLVMCodeGen', 'LLVMCodeGenTypes', 'LLVMCore', 'LLVMCoroutines', + 'LLVMDebugInfoBTF', 'LLVMDebugInfoCodeView', 'LLVMDebugInfoDWARF', + 'LLVMDebugInfoMSF', 'LLVMDebugInfoPDB', 'LLVMDemangle', 'LLVMExecutionEngine', + 'LLVMFrontendOffloading', 'LLVMFrontendOpenMP', 'LLVMGlobalISel', 'LLVMHipStdPar', + 'LLVMInstCombine', 'LLVMInstrumentation', 'LLVMInterpreter', 'LLVMipo', + 'LLVMIRPrinter', 'LLVMIRReader', 'LLVMLinker', 'LLVMMC', 'LLVMMCA', + 'LLVMMCDisassembler', 'LLVMMCJIT', 'LLVMMCParser', 'LLVMObjCARCOpts', + 'LLVMObject', 'LLVMOrcShared', 'LLVMOrcTargetProcess', 'LLVMPasses', + 'LLVMProfileData', 'LLVMRemarks', 'LLVMRuntimeDyld', 'LLVMScalarOpts', + 'LLVMSelectionDAG', 'LLVMSupport', 'LLVMSymbolize', 'LLVMTarget', + 'LLVMTargetParser', 'LLVMTextAPI', 'LLVMTransformUtils', 'LLVMVectorize'] + +if host_machine.cpu_family() == 'aarch64' + folder = '../../../llvm-arm64' + deps += ['LLVMAArch64AsmParser', 'LLVMAArch64CodeGen', 'LLVMAArch64Desc', + 'LLVMAArch64Disassembler', 'LLVMAArch64Info', 'LLVMAArch64Utils'] +else + folder = '../../../llvm-x64' + deps += ['LLVMX86AsmParser', 'LLVMX86CodeGen', 'LLVMX86Desc', 'LLVMX86Disassembler', + 'LLVMX86Info', 'LLVMX86TargetMCA'] +endif + +_deps = [] +_search = join_paths(meson.current_source_dir(), folder + '/lib') +foreach d : deps + _deps += cpp.find_library(d, dirs : _search) +endforeach + +dep_llvm = declare_dependency( + include_directories : include_directories(folder + '/include'), + dependencies : _deps, + version : '18.1.8', +)