1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
# Maintainer: loathingkernel <loathingkernel @at gmail .dot com>
pkgname=dxvk-mingw
pkgver=1.9
pkgrel=2
pkgdesc='Vulkan-based implementation of D3D9, D3D10 and D3D11 for Linux / Wine, MingW version'
arch=('x86_64')
url="https://github.com/doitsujin/dxvk"
license=('zlib/libpng')
depends=('vulkan-icd-loader' 'wine>=4.0rc1' 'lib32-vulkan-icd-loader' 'bash')
makedepends=('ninja' 'meson>=0.43' 'glslang' 'git' 'mingw-w64-gcc')
provides=('dxvk' 'd9vk' "dxvk=$pkgver")
conflicts=('dxvk' 'd9vk')
options=(!lto)
source=(
"git+https://github.com/doitsujin/dxvk.git#tag=v$pkgver"
"setup_dxvk"
"dxvk-async.patch"
"dxvk-extraopts.patch"
)
sha256sums=(
'SKIP'
'b2413cabd8cca56e2d308ef5513edf1c7f909036ed2ccfeae17536a0e864dc96'
'acdb652830d642829057a035ebc69481697078a734f57ac974ee5b54454470ff'
'2bf3515ce9a3ee426c2632aa3355b2556ee8fe5dd8d88e088f90803e3d5f10a6'
)
prepare() {
cd dxvk
# Export CFLAGS used by proton
# -O2 is adjusted to -O3 since AVX is disabled
# This overrides CFLAGS from makepkg.conf, if you comment these you are on your own
# If you want the "best" possbile optimizations for your system you can use
# `-march=native` and remove the `-mtune=core-avx2` option.
export CFLAGS="-O3 -march=nocona -mtune=core-avx2 -pipe"
export CXXFLAGS="-O3 -march=nocona -mtune=core-avx2 -pipe"
# Uncomment to enable dxvk async patch.
# Enable at your own risk. If you don't know what it is,
# and its implications, leave it as is. You have been warned.
# I am not liable if anything happens to you by using it.
#patch -p1 -i "$srcdir"/dxvk-async.patch
# Uncomment to enable extra optimizations
# Patch crossfiles with extra optimizations from makepkg.conf
patch -p1 -i "$srcdir"/dxvk-extraopts.patch
local dxvk_cflags="$CFLAGS"
local dxvk_ldflags="$LDFLAGS"
# Filter known bad flags before applying optimizations
# Filter fstack-protector{ ,-all,-strong} flag for MingW.
# https://github.com/Joshua-Ashton/d9vk/issues/476
dxvk_cflags="${dxvk_cflags// -fstack-protector*([\-all|\-strong])/}"
# Doesn't compile with these flags in MingW so remove them.
# They are also filtered in Wine PKGBUILDs so remove them
# for winelib versions too.
dxvk_cflags="${dxvk_cflags/ -fno-plt/}"
dxvk_ldflags="${dxvk_ldflags/,-z,now/}"
dxvk_ldflags="${dxvk_ldflags/,-z,relro/}"
# If using -march=native and the CPU supports AVX, launching a d3d9
# game can cause an Unhandled exception. The cause seems to be the
# combination of AVX instructions and tree vectorization (implied by O3),
# all tested archictures from sandybridge to haswell are affected.
# Disabling AVX (and AVX2 as a side-effect).
# Since Wine 5.16 AVX is supported. Testing showed 32bit applications
# crashing with AVX regardless, but 64bit applications worked just fine.
# So disable AVX only for the 32bit binaries and AVX2 for the 64bit.
# AVX2 seems to degrade performance. So disregard the above.
# Relevant Wine issues
# https://bugs.winehq.org/show_bug.cgi?id=45289
# https://bugs.winehq.org/show_bug.cgi?id=43516
dxvk64_cflags="$dxvk_cflags -mno-avx"
dxvk32_cflags="$dxvk_cflags -mno-avx"
# These flags are taken from Proton, I don't know if there are issues with Arch wine.
dxvk64_cflags="$dxvk_cflags -mfpmath=sse -fwrapv -fno-strict-aliasing -gdwarf-2 -gstrict-dwarf"
dxvk32_cflags="$dxvk_cflags -mfpmath=sse -fwrapv -fno-strict-aliasing -gdwarf-2 -gstrict-dwarf"
dxvk_ldflags="$dxvk_ldflags -Wl,--file-alignment,4096"
sed -i build-win64.txt \
-e "s|@CARGS@|\'${dxvk64_cflags// /\',\'}\'|g" \
-e "s|@LDARGS@|\'${dxvk_ldflags// /\',\'}\'|g"
sed -i build-win32.txt \
-e "s|@CARGS@|\'${dxvk32_cflags// /\',\'}\'|g" \
-e "s|@LDARGS@|\'${dxvk_ldflags// /\',\'}\'|g"
}
build() {
meson dxvk "build/x64" \
--cross-file dxvk/build-win64.txt \
--prefix "/usr/share/dxvk/x64" \
--bindir "" --libdir "" \
--buildtype "release" \
--strip \
-Denable_tests=false
ninja -C "build/x64" -v
meson dxvk "build/x32" \
--cross-file dxvk/build-win32.txt \
--prefix "/usr/share/dxvk/x32" \
--bindir "" --libdir "" \
--buildtype "release" \
--strip \
-Denable_tests=false
ninja -C "build/x32" -v
}
package() {
DESTDIR="$pkgdir" ninja -C "build/x32" install
DESTDIR="$pkgdir" ninja -C "build/x64" install
install -Dm 755 -t "$pkgdir/usr/share/dxvk" dxvk/setup_dxvk.sh
install -Dm 644 -t "$pkgdir/usr/share/doc/dxvk" dxvk/dxvk.conf
install -Dm 644 -t "$pkgdir/usr/share/$pkgname" dxvk/LICENSE
install -Dm 755 -t "$pkgdir/usr/bin" setup_dxvk
}
|