mesa/src/gallium/frontends/nine
Yonggang Luo a9e2c699aa util/c11: Update function u_thread_create to be c11 conformance
Do not assume thrd_t to be a pointer or integer, as the C11 standard tells us:
  thrd_t: implementation-defined complete object type identifying a thread
At https://en.cppreference.com/w/c/thread
So we always return the thread creation return code instead of thrd_t value, and judge the return
code properly.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15087>
2022-06-15 17:37:17 +00:00
..
.editorconfig
README
adapter9.c gallium: rename PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE to *_BUFFER0_* 2022-06-07 00:17:57 -04:00
adapter9.h st/nine: Allow to override the vram size 2021-04-14 08:33:14 +00:00
authenticatedchannel9.c
authenticatedchannel9.h
basetexture9.c st/nine: Fix invalid NULL check 2021-04-14 08:33:13 +00:00
basetexture9.h st/nine: Track formats compatible with FETCH4 2021-03-02 20:07:07 +01:00
buffer9.c gallium: split transfer_(un)map into buffer_(un)map and texture_(un)map 2021-05-21 17:38:04 +00:00
buffer9.h st/nine: detect worker threads syncs for systemmem 2021-03-13 21:23:24 +00:00
cryptosession9.c
cryptosession9.h
cubetexture9.c st/nine: Fix cubetexture early destruction 2021-04-14 08:33:13 +00:00
cubetexture9.h st/nine: Use the texture memory helper 2021-03-07 13:13:53 +00:00
device9.c gallium: rename PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE to *_BUFFER0_* 2022-06-07 00:17:57 -04:00
device9.h st/nine: Complete *Ex stubs 2021-04-14 08:33:14 +00:00
device9ex.c st/nine: Add logging to Ex function 2021-04-14 08:33:14 +00:00
device9ex.h
device9video.c
device9video.h
guid.c
guid.h
indexbuffer9.c
indexbuffer9.h
iunknown.c st/nine: Prevent negative reference count 2021-04-14 08:33:13 +00:00
iunknown.h
meson.build mesa: Merge libmesa_gallium and libmesa_common 2021-12-03 23:53:06 +00:00
nine_buffer_upload.c gallium: split transfer_(un)map into buffer_(un)map and texture_(un)map 2021-05-21 17:38:04 +00:00
nine_buffer_upload.h
nine_csmt_helper.h
nine_debug.c st/nine: Fix compilation issue in nine_debug 2021-03-12 17:12:58 +00:00
nine_debug.h
nine_defines.h
nine_dump.c c11: Implement thread_local in c11/threads.h 2022-06-15 17:37:17 +00:00
nine_dump.h
nine_ff.c gallium: rename sysval caps 2022-03-17 16:44:42 +00:00
nine_ff.h
nine_flags.h
nine_helpers.c
nine_helpers.h
nine_limits.h
nine_lock.c st/nine: Protect *PrivateData also for Volumes 2021-03-02 20:07:07 +01:00
nine_lock.h
nine_memory_helper.c st/nine: Fix compilation warnings 2021-04-14 08:33:13 +00:00
nine_memory_helper.h st/nine: Control the memfd virtual limit 2021-03-07 13:13:53 +00:00
nine_pdata.h st/nine: Refactor ht_guid_delete 2021-03-02 20:07:07 +01:00
nine_pipe.c nine: don't memset sampler state during conversion 2021-08-06 15:12:54 +00:00
nine_pipe.h st/nine: Add fallback for YUV formats 2021-04-14 08:33:14 +00:00
nine_queue.c
nine_queue.h
nine_quirk.c
nine_quirk.h
nine_shader.c Revert "nine: Disable optional use of TTN when MUL_ZERO_WINS is available." 2022-06-10 03:26:33 +00:00
nine_shader.h st/nine: Implement experimental FETCH4 2021-03-02 20:07:07 +01:00
nine_state.c util/c11: Update function u_thread_create to be c11 conformance 2022-06-15 17:37:17 +00:00
nine_state.h nine: track bound sampler count to optimize unbinds 2021-08-06 17:12:54 +00:00
nineexoverlayextension.c
nineexoverlayextension.h
pixelshader9.c st/nine: Implement experimental FETCH4 2021-03-02 20:07:07 +01:00
pixelshader9.h st/nine: Implement experimental FETCH4 2021-03-02 20:07:07 +01:00
query9.c
query9.h
resource9.c
resource9.h
stateblock9.c
stateblock9.h
surface9.c gallium: split transfer_(un)map into buffer_(un)map and texture_(un)map 2021-05-21 17:38:04 +00:00
surface9.h st/nine: Use the texture memory helper 2021-03-07 13:13:53 +00:00
swapchain9.c st/nine: Improve performance with thread_submit 2021-04-14 08:33:14 +00:00
swapchain9.h
swapchain9ex.c
swapchain9ex.h
texture9.c nine: Fix uninitialized warning in texture9.c 2021-05-20 17:11:22 +00:00
texture9.h st/nine: Use the texture memory helper 2021-03-07 13:13:53 +00:00
threadpool.c
threadpool.h
vertexbuffer9.c
vertexbuffer9.h
vertexdeclaration9.c gallium: add pipe_vertex_element::dual_slot to move lowering to CSO creation 2021-08-02 19:58:28 +00:00
vertexdeclaration9.h
vertexshader9.c st/nine: Implement experimental FETCH4 2021-03-02 20:07:07 +01:00
vertexshader9.h
volume9.c gallium: split transfer_(un)map into buffer_(un)map and texture_(un)map 2021-05-21 17:38:04 +00:00
volume9.h
volumetexture9.c st/nine: Reduce system memory allocated by D3DUSAGE_AUTOGENMIPMAP 2021-03-02 20:07:07 +01:00
volumetexture9.h

README

Quickstart Guide

*** Configure and build mesa
CFLAGS="-m32" CXXFLAGS="-m32" ./autogen.sh --prefix=/usr \
 --with-gallium-drivers=nouveau,r600,swrast --enable-nine \
 --enable-debug --enable-texture-float --with-dri-drivers= --disable-dri \
 --disable-opengl --disable-egl --disable-vdpau --disable-xvmc --disable-gbm \
 --disable-llvm
make

*** Then we create some symlinks to mesa:
ln -s "`pwd`/lib/gallium/libd3dadapter9.so.0.0.0" /usr/lib/
ln -s "`pwd`/lib/gallium/libd3dadapter9.so.0" /usr/lib/
ln -s "`pwd`/lib/gallium/libd3dadapter9.so" /usr/lib/
ln -s "`pwd`/include/d3dadapter" /usr/include/

*** Clone and build a patched wine
git clone git@github.com:iXit/wine.git
./configure
make

*** And finally we create some symlinks to our patched wine files:
for f in d3d9.dll gdi32.dll user32.dll wineps.drv winex11.drv;
do
    mv /usr/lib/wine/$f.so /usr/lib/wine/$f.so.old
    ln -s "`pwd`/dlls/`basename -s .dll $f`/$f.so" /usr/lib/wine/
done

*** Activating it within wine
regedit
Navigate to HKCU\Software\Wine\Direct3D
If it's not there, create it
Create a new DWORD value called UseNative
Set its value to 1

Every Direct3D9 program will now try using nine before wined3d

If you want to selectively enable it per-exe instead, use the key:
HKCU\Software\Wine\AppDefaults\app.exe\Direct3D\UseNative
where app.exe is the name of your .exe file


*** HOW IT WORKS ***

Nine implements the full IDirect3DDevice9 COM interface and a custom COM
interface called ID3DAdapter9 which is used to implement a final IDirect3D9Ex
COM interface.
ID3DAdapter9 is completely devoid of window system code, meaning this can be
provided by wine, Xlib, Wayland, etc. It's inadvisible to write a non-Windows
backend though, as we don't want to encourage linux developers to use this API.

The gallium frontend is compiled, along with pipe-loader, into a library called
libd3dadapter9.so. This library loads pipe_[driver].so drivers on demand and
exports a single symbol for getting a subsystem driver. Currently only DRM is
supported.
This library is then linked to the library implementing the IDirect3D9[Ex]
interface and the actual Direct3D9 entry points (Direct3DCreate9[Ex])

The implementation of IDirect3D9[Ex] lies within wine and coexists with
wined3d. It's loaded on demand and so if it's not there, it doesn't have any
drivers or something else is wrong, d3d9.dll will automatically revert to using
wined3d.
Whether or not it's even tried is determined by 2 DWORD registry keys.
> HKCU\Software\Wine\Direct3D\UseNative
> HKCU\Software\Wine\AppDefaults\app.exe\Direct3D\UseNative
The former is the global on-switch. The latter is per-exe.

The driver search path can be set at configure time with
--with-gallium-driver-dir and overridden at runtime with D3D9_DRIVERS_PATH.
Debugging information can be gotten with the WINEDEBUG channels d3d9 and
d3dadapter, and gallium frontend debug information can be gotten with NINE_DEBUG.
Help on NINE_DEBUG is shown through NINE_DEBUG=help

Finally, the ID3DPresent[Group] and ID3DAdapter9 interfaces are not set in
stone, so feel free to hack on those as well as st/nine.

Happy Hacking!