xref: /aosp_15_r20/external/mesa3d/docs/gallium-nine.rst (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1*61046927SAndroid Build Coastguard WorkerGallium Nine
2*61046927SAndroid Build Coastguard Worker============
3*61046927SAndroid Build Coastguard Worker
4*61046927SAndroid Build Coastguard WorkerThe Gallium frontend, which implements Direct3D 9.
5*61046927SAndroid Build Coastguard Worker
6*61046927SAndroid Build Coastguard WorkerNine implements the full IDirect3DDevice9 COM interface and a custom COM interface called ID3DAdapter9, which is used to implement the final IDirect3D9Ex COM interface.
7*61046927SAndroid Build Coastguard WorkerID3DAdapter9 is completely agnostic regarding the window system code, meaning this can be provided by wine, Xlib, Wayland, etc.
8*61046927SAndroid Build Coastguard Worker
9*61046927SAndroid Build Coastguard WorkerGallium Nine is commonly used in conjunction with `Wine <https://www.winehq.org/>`__.
10*61046927SAndroid Build Coastguard Worker`Gallium Nine Standalone <https://github.com/iXit/wine-nine-standalone>`__ is the standalone version of the Wine parts of Gallium Nine which makes it possible to use it with any stock Wine version. It's simple to install through `Winetricks <https://github.com/Winetricks/winetricks>`__ with ``winetricks galliumnine``.
11*61046927SAndroid Build Coastguard WorkerAside from Wine, Gallium Nine works well with `Box86 <https://ptitseb.github.io/box86/>`__.
12*61046927SAndroid Build Coastguard WorkerCan be used via `Zink <https://www.supergoodcode.com/to-the-nines/>`__ even on the `Vulkan API <https://en.wikipedia.org/wiki/Vulkan>`__.
13*61046927SAndroid Build Coastguard Worker
14*61046927SAndroid Build Coastguard WorkerIn the majority of cases this implementation has better performance than Wine doing the translation from D3D9 to OpenGL itself.
15*61046927SAndroid Build Coastguard Worker
16*61046927SAndroid Build Coastguard WorkerIt's also possible to use D3D9 directly from the Linux environment. For tests, demos, and more details, you can see `this repository <https://github.com/iXit/nine-tests>`__.
17*61046927SAndroid Build Coastguard Worker
18*61046927SAndroid Build Coastguard WorkerBuild
19*61046927SAndroid Build Coastguard Worker-----
20*61046927SAndroid Build Coastguard Worker
21*61046927SAndroid Build Coastguard WorkerBeware: Most Direct3D games are 32-bit, and thus need a 32-bit version of Mesa.
22*61046927SAndroid Build Coastguard Worker
23*61046927SAndroid Build Coastguard Worker.. code-block:: sh
24*61046927SAndroid Build Coastguard Worker
25*61046927SAndroid Build Coastguard Worker   $ meson configure \
26*61046927SAndroid Build Coastguard Worker         -D gallium-nine=true \
27*61046927SAndroid Build Coastguard Worker         -D dri3=enabled \
28*61046927SAndroid Build Coastguard Worker         ...
29*61046927SAndroid Build Coastguard Worker
30*61046927SAndroid Build Coastguard WorkerPaths
31*61046927SAndroid Build Coastguard Worker-----
32*61046927SAndroid Build Coastguard Worker
33*61046927SAndroid Build Coastguard WorkerYou need to point wine-nine-standalone to the location of ``d3dadapter9.so``.
34*61046927SAndroid Build Coastguard WorkerIf you use distribution packaged Mesa, it should work out of the box.
35*61046927SAndroid Build Coastguard Worker
36*61046927SAndroid Build Coastguard WorkerThere are three options (sorted from permanent to temporary):
37*61046927SAndroid Build Coastguard Worker - compile Wine Nine Standalone with ``D3D9NINE_MODULEPATH`` pointing to your local library
38*61046927SAndroid Build Coastguard Worker - set ModulePath of Software\Wine\Direct3DNine in the wine registers
39*61046927SAndroid Build Coastguard Worker - ``$ D3D_MODULE_PATH="$MESA_INSTALLDIR/lib/d3d/d3dadapter9.so" wine ...``
40*61046927SAndroid Build Coastguard Worker
41*61046927SAndroid Build Coastguard WorkerRun
42*61046927SAndroid Build Coastguard Worker---
43*61046927SAndroid Build Coastguard Worker
44*61046927SAndroid Build Coastguard WorkerBefore running your application in Wine, verify that everything works as expected by running:
45*61046927SAndroid Build Coastguard Worker
46*61046927SAndroid Build Coastguard Worker.. code-block:: sh
47*61046927SAndroid Build Coastguard Worker
48*61046927SAndroid Build Coastguard Worker   $ wine ninewinecfg
49