From d9ce258c174bc7295b92046519ce885613c14608 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Wed, 6 Feb 2019 11:54:15 +0000 Subject: [PATCH] CMake: Generate the ICD json file into the output directory Bug b/116336664 Change-Id: I1df29a8ef6b2700089ee5cc104b28ed898ccec1b Reviewed-on: https://swiftshader-review.googlesource.com/c/24470 Reviewed-by: Chris Forbes Reviewed-by: Nicolas Capens Tested-by: Ben Clayton Kokoro-Presubmit: kokoro --- CMakeLists.txt | 3 ++ docs/dEQP.md | 54 +++++++++++++++++++++++++++++---- src/Vulkan/vk_swiftshader_icd.json.tmpl | 7 +++++ 3 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 src/Vulkan/vk_swiftshader_icd.json.tmpl diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bc49df36..32811fd9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2214,6 +2214,9 @@ if(BUILD_VULKAN) COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_SOURCE_DIR}/out/${CMAKE_SYSTEM_NAME}/ COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_CURRENT_SOURCE_DIR}/out/${CMAKE_SYSTEM_NAME}/ ) + configure_file( + "${VULKAN_DIR}/vk_swiftshader_icd.json.tmpl" + "${CMAKE_CURRENT_SOURCE_DIR}/out/${CMAKE_SYSTEM_NAME}/vk_swiftshader_icd.json") endif() ########################################################### diff --git a/docs/dEQP.md b/docs/dEQP.md index 1b7809847..e9524ddec 100644 --- a/docs/dEQP.md +++ b/docs/dEQP.md @@ -17,7 +17,7 @@ Prerequisites 9. Set environment variables: Config Panel -> System and Security -> System -> Advanced system settigns -> Environment Variables * Add `` to your PATH environment variable * Add `\bin` to your PATH environment variable - * Add `` to your PATH environment variable + * Add `` to your PATH environment variable Note: abd is in the Android SDK, typically in `C:\Users\\AppData\Local\Android\sdk\platform-tools` @@ -53,7 +53,7 @@ Building the code 16. Build dEQP's Visual Studio files using the CMake GUI, or, in the dEQP root dir, run: ``` - mkdir build + mkdir build cd build cmake .. ``` @@ -89,12 +89,12 @@ Testing OpenGL ES 20. a) Assuming you already built SwiftShader, copy these two files: - `libEGL.dll` + `libEGL.dll`\ `libGLESv2.dll` From: - `\out\Release_x64` or + `\out\Release_x64` or\ `\out\Debug_x64` To: @@ -106,7 +106,7 @@ Testing Vulkan 20. b) Assuming you already built SwiftShader, copy and rename this file: - `\out\Release_x64\vk_swiftshader.dll` or + `\out\Release_x64\vk_swiftshader.dll` or\ `\out\Debug_x64\vk_swiftshader.dll` To: @@ -143,4 +143,46 @@ Differences to the steps above: 1. Instead of copying the .dll files, you need to set LD_LIBRARY_PATH to point to SwiftShader's build directory. 2. Use `make` instead of Visual Studio. -3. There are no Debug/Release directories or .exe suffixes, so remove them from DeviceConfig in data.go. \ No newline at end of file +3. There are no Debug/Release directories or .exe suffixes, so remove them from DeviceConfig in data.go. + +Running dEQP Vulkan tests on Linux +---------------------------------- + +1. Get dEQP source code: + + `git clone https://android.googlesource.com/platform/external/deqp` + +2. Fetch dEQP's dependencies: + + `cd deqp`\ + `python external/fetch_sources.py` + +3. Run cmake and generate Makefiles: + + `mkdir build`\ + `cd build`\ + `cmake ..` + +4. Build dEQP: + + `make` + +5. Configure dEQP to use SwiftShader's Vulkan driver: + + We do this by setting the `VK_ICD_FILENAMES` environment variable to point to SwiftShader's `vk_swiftshader_icd.json` file. Replace (or `export`) `$SWIFTSHADER_ROOT` to the root checkout directory of SwiftShader, and type: + + `export VK_ICD_FILENAMES=$SWIFTSHADER_ROOT/out/Linux/vk_swiftshader_icd.json` + +6. Run the tests: + + Assuming the current working directory is still `$DEQP_ROOT/build`, type: + + `external/vulkancts/modules/vulkan/deqp-vk` + + If `deqp-vk` returns an error similar to: + + `libVulkan.cpp:69: VkResult vkCreateInstance(const VkInstanceCreateInfo*, const VkAllocationCallbacks*, VkInstance_T**): Assertion 'false' failed.` + + Then it is likely that your system is using a broken Vulkan loader. [Grab the Vulkan SDK from here](https://vulkan.lunarg.com/), and update `LD_LIBRARY_PATH` to search the SDK's `libs` directory: + + `export LD_LIBRARY_PATH=$VULKAN_SDK_PATH/x86_64/lib:$LD_LIBRARY_PATH` diff --git a/src/Vulkan/vk_swiftshader_icd.json.tmpl b/src/Vulkan/vk_swiftshader_icd.json.tmpl new file mode 100644 index 000000000..509223219 --- /dev/null +++ b/src/Vulkan/vk_swiftshader_icd.json.tmpl @@ -0,0 +1,7 @@ +{ + "file_format_version": "1.0.0", + "ICD": { + "library_path": "${CMAKE_CURRENT_SOURCE_DIR}/out/${CMAKE_SYSTEM_NAME}/${CMAKE_SHARED_LIBRARY_PREFIX}vk_swiftshader${CMAKE_SHARED_LIBRARY_SUFFIX}", + "api_version": "1.0.5" + } +} \ No newline at end of file -- 2.11.0