Tuesday, March 31, 2020

Vulkan Software render (amd64+Windows)

There are small list of commands for compile Vulkan soft render library on amd64 debian, sequence is fully same as in the previous post related to check quake2 run on the arm64
  • git clone git@github.com:google/swiftshader.git
  • cd swiftshader/build
  • cmake ..
  • make -j 2 vk_swiftshader
  • sudo cp libvk_swiftshader.so /usr/lib/x86_64-linux-gnu/libvulkan_swiftshader.so
  • sed -i "s|./libvk_swiftshader.so|/usr/lib/x86_64-linux-gnu/libvulkan_swiftshader.so|g" Linux/vk_swiftshader_icd.json
  • sudo cp Linux/vk_swiftshader_icd.json /usr/share/vulkan/icd.d/swiftshader_icd.x86_64.json
  • sudo chmod 644 /usr/share/vulkan/icd.d/swiftshader_icd.x86_64.json
  • sudo chown root:root /usr/share/vulkan/icd.d/swiftshader_icd.x86_64.json
  • sudo chmod 644 /usr/lib/x86_64-linux-gnu/libvulkan_swiftshader.so
  • sudo chown root:root /usr/lib/x86_64-linux-gnu/libvulkan_swiftshader.so
And same story for Windows, It will be a little bit different story as result of different logic of package distribution. User have installed Vulkan drivers with Vulkan loader as part graphical drivers by default.

Compilation of code has required to install Vulkan SDK, CMake and Visual Studio.

And sequence of commands for build loader will be such for 64bit platform if no drivers installed with Vulkan.
  • git clone https://github.com/KhronosGroup/Vulkan-Loader.git
  • cd Vulkan-Loader/
  • cd external/
  • git clone https://github.com/google/googletest.git
  • git clone https://github.com/KhronosGroup/Vulkan-Headers.git
  • cd googletest
  • git checkout tags/release-1.8.1
  • cd ../..
  • mkdir build
  • cd build
  • cmake -A x64 --config Release ..
  • cmake --build . --config Release
  • cd ../..
  • Copy resulted library to C:\windows\System32 as vulkan-1.dll
Same commands but for 32 bit library
  • git clone https://github.com/KhronosGroup/Vulkan-Loader.git
  • cd Vulkan-Loader/
  • cd external/
  • git clone https://github.com/google/googletest.git
  • git clone https://github.com/KhronosGroup/Vulkan-Headers.git
  • cd googletest
  • git checkout tags/release-1.8.1
  • cd ../..
  • mkdir build
  • cd build
  • cmake -A win32 --config Release ..
  • cmake --build . --config Release
  • cd ../..
  • Copy resulted library to C:\windows\sysWOW64 as vulkan-1.dll
And then compile Vulkan driver for 64 platform:
  • git clone https://github.com/google/swiftshader.git
  • cd swiftshader/
  • git submodule init
  • cd third_party/
  • git clone https://github.com/google/googletest.git
  • git clone https://github.com/google/benchmark.git
  • git clone https://github.com/google/cppdap
  • git clone https://github.com/nlohmann/json.git
  • git clone https://github.com/ianlancetaylor/libbacktrace.git libbacktrace/src
  • cd ../build
  • cmake -A x64 --config Release ..
  • cmake --build . --config Release
  • cd ../..
  • Copy resulted file to preferred place, as example C:\Program Files\SwiftShaderVulkan
Same commands but for 32 bit library
  • git clone https://github.com/google/swiftshader.git
  • cd swiftshader/
  • git submodule init
  • cd third_party/
  • git clone https://github.com/google/googletest.git
  • git clone https://github.com/google/benchmark.git
  • git clone https://github.com/google/cppdap
  • git clone https://github.com/nlohmann/json.git
  • git clone https://github.com/ianlancetaylor/libbacktrace.git libbacktrace/src
  • cd ../build
  • cmake -A win32 --config Release ..
  • cmake --build . --config Release
  • cd ../..
  • Copy resulted file to preferred place, as example C:\Program Files\SwiftShaderVulkan
Also need to create ICD files like such C:\\Program Files\\SwiftShaderVulkan\\vk_swiftshader32.json with:
{
  "file_format_version": "1.0.0",
  "ICD": {
    "library_path": "C:\\Program Files\\SwiftShaderVulkan\\vk_swiftshader_32.dll",
    "api_version": "1.0.5"
  }
}
And C:\\Program Files\\SwiftShaderVulkan\\vk_swiftshader64.json with such content:
{
  "file_format_version": "1.0.0",
  "ICD": {
    "library_path": "C:\\Program Files\\SwiftShaderVulkan\\vk_swiftshader_64.dll",
    "api_version": "1.0.5"
  }
}
After that need to correctly register drivers, or,that will be less complicated, create reg file and apply such by RegEdit.
   
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Khronos\Vulkan\Drivers]
"C:\\Program Files\\SwiftShaderVulkan\\vk_swiftshader32.json"=dword:00000000

[HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\Vulkan\Drivers]
"C:\\Program Files\\SwiftShaderVulkan\\vk_swiftshader64.json"=dword:00000000

No comments:

Post a Comment