Difference between revisions of "Vkd3d"

From WineHQ Wiki
Jump to: navigation, search
(Building)
(Tests)
 
(14 intermediate revisions by the same user not shown)
Line 25: Line 25:
 
  ../vkd3d/configure --build=i686-pc-linux-gnu "CPPFLAGS=-m32" "LDFLAGS=-m32"
 
  ../vkd3d/configure --build=i686-pc-linux-gnu "CPPFLAGS=-m32" "LDFLAGS=-m32"
  
== Building Wine with vkd3d support ==
+
== Building Wine with Direct3D 12 support ==
  
Wine uses '''pkg-config''' to find vkd3d libraries. If vkd3d libraries are installed, the Wine configure script should find the vkd3d libraries. You can also use '''PKG_CONFIG_PATH''', '''VKD3D_CFLAGS''' or '''VKD3D_LIBS''' to override '''pkg-config''' search path, C compiles flags for '''libvkd3d''', or linker flags for '''libvkd3d''', e.g.
+
Wine uses '''pkg-config''' to find vkd3d libraries. If vkd3d libraries are installed system-wide, the Wine configure script should find the vkd3d libraries automatically. You can also use '''PKG_CONFIG_PATH''', '''VKD3D_CFLAGS''' or '''VKD3D_LIBS''' to override '''pkg-config''' search path, C compiler flags for '''libvkd3d''', or linker flags for '''libvkd3d''', e.g.
  
  PKG_CONFIG_PATH=$HOME/src/vulkan/install/lib/pkgconfig
+
  ../wine-git/configure PKG_CONFIG_PATH=$HOME/src/vulkan/install/lib/pkgconfig
  
 
= Debugging =
 
= Debugging =
 +
 +
== Debug output ==
  
 
Vkd3d provides '''VKD3D_DEBUG''' and '''VKD3D_SHADER_DEBUG''' environment variables to control debug log messages. The debug variables can be set to one of the following debug log levels: '''none''', '''err''', '''fixme''', '''warn''', '''trace'''.
 
Vkd3d provides '''VKD3D_DEBUG''' and '''VKD3D_SHADER_DEBUG''' environment variables to control debug log messages. The debug variables can be set to one of the following debug log levels: '''none''', '''err''', '''fixme''', '''warn''', '''trace'''.
  
 
See the [https://source.winehq.org/git/vkd3d.git/blob_plain/HEAD:/README README file] for description of all debug environment variables.
 
See the [https://source.winehq.org/git/vkd3d.git/blob_plain/HEAD:/README README file] for description of all debug environment variables.
 +
 +
== Vulkan validation layers ==
 +
 +
Enable validation layers in a standard way:
 +
 +
export VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_standard_validation
 +
 +
You may also want to enable Vulkan debug extensions in vkd3d:
 +
 +
VKD3D_CONFIG=vk_debug
 +
 +
== Other tools ==
 +
 +
* [https://renderdoc.org/ RenderDoc] is a frame-capture based debugger. It supports Vulkan and Direct3D 12.
 +
* VK_LAYER_LUNARG_api_dump is useful to dump Vulkan commands produced by libvkd3d.
 +
* [https://github.com/ValveSoftware/Fossilize Fossilize] might be useful for debugging crashes in driver shader compiler. Just capture pipelines using VK_LAYER_fossilize and use fossilize-replay to reproduce the crash.
 +
 +
= Tests =
 +
 +
Use the following command to run tests:
 +
make check
 +
 +
Tests can also be run individually, for example:
 +
  make tests/d3d12 && ./tests/d3d12
 +
  VKD3D_TEST_FILTER=clear_render_target ./tests/d3d12
 +
 +
To cross-compile tests for Windows run the following command:
 +
make crosstest
 +
 +
== Shader bytecode in tests ==
 +
 +
Some tests include compiled shader bytecode. Shader bytecode should be generated with '''/Qstrip_debug /Qstrip_reflect''' options. For example:
 +
fxc /Qstrip_debug /Qstrip_reflect /T ps_5_0 source.hlsl /Fo output.dxbc
  
 
= See also =
 
= See also =
  
 
* [[vkd3d-todo]]
 
* [[vkd3d-todo]]
 +
* [[Vkd3d known issues]]
 +
 +
[[Category:vkd3d]]

Latest revision as of 08:36, 1 August 2019

Vkd3d is a 3D graphics library built on top of Vulkan. It has an API very similar, but not identical, to Direct3D 12. Wine uses vkd3d libraries for its implementation of Direct3D 12.

Building

Getting the vkd3d source

You can download the Vkd3d source code as a tarball, but if you plan to do any actual testing or developing, you'll want to use git.

To grab the source code, just enter the following command:

git clone git://source.winehq.org/git/vkd3d.git/

Compiling

Enter the following commands:

./autogen.sh
./configure
make

See also the README file.

In order to build 32-bit libraries:

../vkd3d/configure --build=i686-pc-linux-gnu "CPPFLAGS=-m32" "LDFLAGS=-m32"

Building Wine with Direct3D 12 support

Wine uses pkg-config to find vkd3d libraries. If vkd3d libraries are installed system-wide, the Wine configure script should find the vkd3d libraries automatically. You can also use PKG_CONFIG_PATH, VKD3D_CFLAGS or VKD3D_LIBS to override pkg-config search path, C compiler flags for libvkd3d, or linker flags for libvkd3d, e.g.

../wine-git/configure PKG_CONFIG_PATH=$HOME/src/vulkan/install/lib/pkgconfig

Debugging

Debug output

Vkd3d provides VKD3D_DEBUG and VKD3D_SHADER_DEBUG environment variables to control debug log messages. The debug variables can be set to one of the following debug log levels: none, err, fixme, warn, trace.

See the README file for description of all debug environment variables.

Vulkan validation layers

Enable validation layers in a standard way:

export VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_standard_validation

You may also want to enable Vulkan debug extensions in vkd3d:

VKD3D_CONFIG=vk_debug

Other tools

  • RenderDoc is a frame-capture based debugger. It supports Vulkan and Direct3D 12.
  • VK_LAYER_LUNARG_api_dump is useful to dump Vulkan commands produced by libvkd3d.
  • Fossilize might be useful for debugging crashes in driver shader compiler. Just capture pipelines using VK_LAYER_fossilize and use fossilize-replay to reproduce the crash.

Tests

Use the following command to run tests:

make check

Tests can also be run individually, for example:

 make tests/d3d12 && ./tests/d3d12
 VKD3D_TEST_FILTER=clear_render_target ./tests/d3d12

To cross-compile tests for Windows run the following command:

make crosstest

Shader bytecode in tests

Some tests include compiled shader bytecode. Shader bytecode should be generated with /Qstrip_debug /Qstrip_reflect options. For example:

fxc /Qstrip_debug /Qstrip_reflect /T ps_5_0 source.hlsl /Fo output.dxbc

See also