1b8e80941SmrgQuickstart Guide
2b8e80941Smrg
3b8e80941Smrg*** Configure and build mesa
4b8e80941SmrgCFLAGS="-m32" CXXFLAGS="-m32" ./autogen.sh --prefix=/usr \
5b8e80941Smrg --with-gallium-drivers=nouveau,r600,swrast --enable-nine \
6b8e80941Smrg --enable-debug --enable-texture-float --with-dri-drivers= --disable-dri \
7b8e80941Smrg --disable-opengl --disable-egl --disable-vdpau --disable-xvmc --disable-gbm \
8b8e80941Smrg --disable-llvm
9b8e80941Smrgmake
10b8e80941Smrg
11b8e80941Smrg*** Then we create some symlinks to mesa:
12b8e80941Smrgln -s "`pwd`/lib/gallium/libd3dadapter9.so.0.0.0" /usr/lib/
13b8e80941Smrgln -s "`pwd`/lib/gallium/libd3dadapter9.so.0" /usr/lib/
14b8e80941Smrgln -s "`pwd`/lib/gallium/libd3dadapter9.so" /usr/lib/
15b8e80941Smrgln -s "`pwd`/include/d3dadapter" /usr/include/
16b8e80941Smrg
17b8e80941Smrg*** Clone and build a patched wine
18b8e80941Smrggit clone git@github.com:iXit/wine.git
19b8e80941Smrg./configure
20b8e80941Smrgmake
21b8e80941Smrg
22b8e80941Smrg*** And finally we create some symlinks to our patched wine files:
23b8e80941Smrgfor f in d3d9.dll gdi32.dll user32.dll wineps.drv winex11.drv;
24b8e80941Smrgdo
25b8e80941Smrg    mv /usr/lib/wine/$f.so /usr/lib/wine/$f.so.old
26b8e80941Smrg    ln -s "`pwd`/dlls/`basename -s .dll $f`/$f.so" /usr/lib/wine/
27b8e80941Smrgdone
28b8e80941Smrg
29b8e80941Smrg*** Activating it within wine
30b8e80941Smrgregedit
31b8e80941SmrgNavigate to HKCU\Software\Wine\Direct3D
32b8e80941SmrgIf it's not there, create it
33b8e80941SmrgCreate a new DWORD value called UseNative
34b8e80941SmrgSet its value to 1
35b8e80941Smrg
36b8e80941SmrgEvery Direct3D9 program will now try using nine before wined3d
37b8e80941Smrg
38b8e80941SmrgIf you want to selectively enable it per-exe instead, use the key:
39b8e80941SmrgHKCU\Software\Wine\AppDefaults\app.exe\Direct3D\UseNative
40b8e80941Smrgwhere app.exe is the name of your .exe file
41b8e80941Smrg
42b8e80941Smrg
43b8e80941Smrg*** HOW IT WORKS ***
44b8e80941Smrg
45b8e80941SmrgNine implements the full IDirect3DDevice9 COM interface and a custom COM
46b8e80941Smrginterface called ID3DAdapter9 which is used to implement a final IDirect3D9Ex
47b8e80941SmrgCOM interface.
48b8e80941SmrgID3DAdapter9 is completely devoid of window system code, meaning this can be
49b8e80941Smrgprovided by wine, Xlib, Wayland, etc. It's inadvisible to write a non-Windows
50b8e80941Smrgbackend though, as we don't want to encourage linux developers to use this API.
51b8e80941Smrg
52b8e80941SmrgThe state tracker is compiled, along with pipe-loader, into a library called
53b8e80941Smrglibd3dadapter9.so. This library loads pipe_[driver].so drivers on demand and
54b8e80941Smrgexports a single symbol for getting a subsystem driver. Currently only DRM is
55b8e80941Smrgsupported.
56b8e80941SmrgThis library is then linked to the library implementing the IDirect3D9[Ex]
57b8e80941Smrginterface and the actual Direct3D9 entry points (Direct3DCreate9[Ex])
58b8e80941Smrg
59b8e80941SmrgThe implementation of IDirect3D9[Ex] lies within wine and coexists with
60b8e80941Smrgwined3d. It's loaded on demand and so if it's not there, it doesn't have any
61b8e80941Smrgdrivers or something else is wrong, d3d9.dll will automatically revert to using
62b8e80941Smrgwined3d.
63b8e80941SmrgWhether or not it's even tried is determined by 2 DWORD registry keys.
64b8e80941Smrg> HKCU\Software\Wine\Direct3D\UseNative
65b8e80941Smrg> HKCU\Software\Wine\AppDefaults\app.exe\Direct3D\UseNative
66b8e80941SmrgThe former is the global on-switch. The latter is per-exe.
67b8e80941Smrg
68b8e80941SmrgThe driver search path can be set at configure time with
69b8e80941Smrg--with-gallium-driver-dir and overridden at runtime with D3D9_DRIVERS_PATH.
70b8e80941SmrgDebugging information can be gotten with the WINEDEBUG channels d3d9 and
71b8e80941Smrgd3dadapter, and state_tracker debug information can be gotten with NINE_DEBUG.
72b8e80941SmrgHelp on NINE_DEBUG is shown through NINE_DEBUG=help
73b8e80941Smrg
74b8e80941SmrgFinally, the ID3DPresent[Group] and ID3DAdapter9 interfaces are not set in
75b8e80941Smrgstone, so feel free to hack on those as well as st/nine.
76b8e80941Smrg
77b8e80941SmrgHappy Hacking!
78