Skip to content

Instantly share code, notes, and snippets.

@mmozeiko
Last active Aug 5, 2021
Embed
What would you like to do?
builds mesa with llvmpipe using Visual Studio
@echo off
setlocal
rem !!! make sure you have mako installed in python - run "pip install meson mako"
set LLVM_VERSION=12.0.1
set MESA_VERSION=21.2.0
where /q python.exe || (
echo ERROR: "python.exe" not found
exit /b 1
)
where /q git.exe || (
echo ERROR: "git.exe" not found
exit /b 1
)
where /q curl.exe || (
echo ERROR: "curl.exe" not found
exit /b 1
)
where /q 7za.exe || (
echo ERROR: "7za.exe" not found
exit /b 1
)
where /q cmake.exe || (
echo ERROR: "cmake.exe" not found
exit /b 1
)
where /q ninja.exe || (
echo ERROR: "ninja.exe" not found
exit /b 1
)
if not exist "%VS2019INSTALLDIR%\VC\Auxiliary\Build\vcvarsall.bat" (
echo ERROR: VS2019 installation not found
exit /b 1
)
set PATH=%CD%\llvm\bin;%CD%\winflexbison;%PATH%
call "%VS2019INSTALLDIR%\VC\Auxiliary\Build\vcvarsall.bat" amd64
echo Downloading llvm
curl -sfL https://github.com/llvm/llvm-project/releases/download/llvmorg-%LLVM_VERSION%/llvm-%LLVM_VERSION%.src.tar.xz ^
| 7za.exe x -bb0 -txz -si -so ^
| 7za.exe x -bb0 -ttar -si -aoa 1>nul 2>nul
move llvm-%LLVM_VERSION%.src llvm.src
echo Downloading mesa
curl -sfL https://archive.mesa3d.org//mesa-%MESA_VERSION%.tar.xz ^
| 7za.exe x -bb0 -txz -si -so ^
| 7za.exe x -bb0 -ttar -si -aoa 1>nul 2>nul
move mesa-%MESA_VERSION% mesa.src
git apply -p0 --directory=mesa.src mesa.patch
echo Downloading win_flex_bison
mkdir winflexbison
pushd winflexbison
curl -sfL -o win_flex_bison-2.5.24.zip https://github.com/lexxmark/winflexbison/releases/download/v2.5.24/win_flex_bison-2.5.24.zip
7za.exe x -bb0 -y win_flex_bison-2.5.24.zip 1>nul 2>nul
popd
del "@PaxHeader" "HEAD" "pax_global_header"
rem *** llvm ***
cmake ^
-G Ninja ^
-S llvm.src ^
-B llvm.build ^
-D CMAKE_INSTALL_PREFIX="%CD%\llvm" ^
-D CMAKE_BUILD_TYPE="Release" ^
-D BUILD_SHARED_LIBS=OFF ^
-D LLVM_TARGETS_TO_BUILD="X86" ^
-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_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_USE_CRT_RELEASE=MT ^
-D LLVM_ENABLE_IDE=OFF
ninja -C llvm.build install
rem *** mesa ***
pushd mesa.src
meson ^
..\mesa.build ^
--prefix="%CD%\..\mesa" ^
--default-library=static ^
-Dbuildtype=release ^
-Db_ndebug=true ^
-Db_vscrt=mt ^
-Dllvm=enabled ^
-Dplatforms=windows ^
-Dosmesa=true ^
-Dgallium-drivers=swrast
rem -Dgallium-drivers=swrast,d3d12,zink
popd
ninja -C mesa.build install
rem mesa binaries will be in "mesa\bin" folder
diff --git meson.build meson.build
index 932eb13..aad9bc3 100644
--- meson.build
+++ meson.build
@@ -1336,7 +1336,7 @@ if cc.links('int main() { return 0; }',
args : '-Wl,--version-script=@0@'.format(
join_paths(meson.source_root(), 'build-support/conftest.map')),
name : 'version-script')
- with_ld_version_script = true
+ with_ld_version_script = false
endif
with_ld_dynamic_list = false
if cc.links('int main() { return 0; }',
diff --git src/gallium/auxiliary/tgsi/tgsi_ureg.c src/gallium/auxiliary/tgsi/tgsi_ureg.c
index 4a6b89a..8011742 100644
--- src/gallium/auxiliary/tgsi/tgsi_ureg.c
+++ src/gallium/auxiliary/tgsi/tgsi_ureg.c
@@ -479,7 +479,7 @@ out:
struct ureg_dst
ureg_DECL_output_masked(struct ureg_program *ureg,
- unsigned name,
+ enum tgsi_semantic name,
unsigned index,
unsigned usage_mask,
unsigned array_id,
diff --git src/gallium/drivers/llvmpipe/lp_tex_sample.h src/gallium/drivers/llvmpipe/lp_tex_sample.h
index 51813ea..652f0fc 100644
--- src/gallium/drivers/llvmpipe/lp_tex_sample.h
+++ src/gallium/drivers/llvmpipe/lp_tex_sample.h
@@ -38,7 +38,7 @@ struct lp_image_static_state;
/**
* Whether texture cache is used for s3tc textures.
*/
-#define LP_USE_TEXTURE_CACHE 0
+#define LP_USE_TEXTURE_CACHE 1
/**
* Pure-LLVM texture sampling code generator.
diff --git src/gallium/winsys/d3d12/wgl/d3d12_wgl_public.h src/gallium/winsys/d3d12/wgl/d3d12_wgl_public.h
index ac5f2c7..70e48fa 100644
--- src/gallium/winsys/d3d12/wgl/d3d12_wgl_public.h
+++ src/gallium/winsys/d3d12/wgl/d3d12_wgl_public.h
@@ -33,7 +33,7 @@ extern "C" {
struct pipe_resource;
struct pipe_screen;
struct pipe_context;
-struct stw_winsys;
+struct sw_winsys;
struct pipe_screen *
d3d12_wgl_create_screen(struct sw_winsys *winsys,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment