xref: /aosp_15_r20/external/swiftshader/docs/dEQP.md (revision 03ce13f70fcc45d86ee91b7ee4cab1936a95046e)
1*03ce13f7SAndroid Build Coastguard WorkerdEQP
2*03ce13f7SAndroid Build Coastguard Worker====
3*03ce13f7SAndroid Build Coastguard Worker
4*03ce13f7SAndroid Build Coastguard WorkerThese steps are specifically for testing SwiftShader's Vulkan implementation using dEQP on Windows (steps for Linux below the Windows instructions).
5*03ce13f7SAndroid Build Coastguard Worker
6*03ce13f7SAndroid Build Coastguard WorkerPrerequisites
7*03ce13f7SAndroid Build Coastguard Worker-------------
8*03ce13f7SAndroid Build Coastguard Worker
9*03ce13f7SAndroid Build Coastguard Worker1. Install the latest [Python 3](https://www.python.org/downloads/)
10*03ce13f7SAndroid Build Coastguard Worker2. Install [Visual Studio](https://visualstudio.microsoft.com/vs/community/)
11*03ce13f7SAndroid Build Coastguard Worker3. Install [CMake](https://cmake.org/download/)
12*03ce13f7SAndroid Build Coastguard Worker4. Install [Go](https://golang.org/doc/install)
13*03ce13f7SAndroid Build Coastguard Worker5. Install [MinGW-W64](http://mingw-w64.org/doku.php/download)
14*03ce13f7SAndroid Build Coastguard Worker  * Select 'x86_64' as Architecture during setup
15*03ce13f7SAndroid Build Coastguard Worker6. Install [Git](https://git-scm.com/download/win)
16*03ce13f7SAndroid Build Coastguard Worker7. Set environment variables: Config Panel -> System and Security -> System -> Advanced system settigns -> Environment Variables
17*03ce13f7SAndroid Build Coastguard Worker  * Add `<path to python>` to your PATH environment variable
18*03ce13f7SAndroid Build Coastguard Worker  * Add `<path to MinGW-W64>\bin` to your PATH environment variable
19*03ce13f7SAndroid Build Coastguard Worker
20*03ce13f7SAndroid Build Coastguard Worker8. (Optional) Install [TortoiseGit](https://tortoisegit.org/)
21*03ce13f7SAndroid Build Coastguard Worker
22*03ce13f7SAndroid Build Coastguard WorkerGetting the Code
23*03ce13f7SAndroid Build Coastguard Worker----------------
24*03ce13f7SAndroid Build Coastguard Worker
25*03ce13f7SAndroid Build Coastguard Worker12. Get dEQP (either in 'cmd' or by using TortoiseGit):
26*03ce13f7SAndroid Build Coastguard Worker
27*03ce13f7SAndroid Build Coastguard Worker    `git clone https://github.com/KhronosGroup/VK-GL-CTS`
28*03ce13f7SAndroid Build Coastguard Worker
29*03ce13f7SAndroid Build Coastguard Worker    You may wish to check out a stable vulkan-cts-* branch.
30*03ce13f7SAndroid Build Coastguard Worker
31*03ce13f7SAndroid Build Coastguard Worker13. Get dEQP's dependencies. In your dEQP root directory, open 'cmd' and run:
32*03ce13f7SAndroid Build Coastguard Worker
33*03ce13f7SAndroid Build Coastguard Worker    `python3 external\fetch_sources.py`
34*03ce13f7SAndroid Build Coastguard Worker
35*03ce13f7SAndroid Build Coastguard Worker14. Get Cherry (either in 'cmd' or by using TortoiseGit):
36*03ce13f7SAndroid Build Coastguard Worker
37*03ce13f7SAndroid Build Coastguard Worker    `git clone https://android.googlesource.com/platform/external/cherry`
38*03ce13f7SAndroid Build Coastguard Worker
39*03ce13f7SAndroid Build Coastguard Worker15. Set environment variable (see point 9):
40*03ce13f7SAndroid Build Coastguard Worker
41*03ce13f7SAndroid Build Coastguard Worker    Add new variable GOPATH='`<path to cherry>`'
42*03ce13f7SAndroid Build Coastguard Worker
43*03ce13f7SAndroid Build Coastguard WorkerBuilding the code
44*03ce13f7SAndroid Build Coastguard Worker-----------------
45*03ce13f7SAndroid Build Coastguard Worker
46*03ce13f7SAndroid Build Coastguard Worker16. Build dEQP's Visual Studio files using the CMake GUI, or, in the dEQP root dir, run:
47*03ce13f7SAndroid Build Coastguard Worker    ```
48*03ce13f7SAndroid Build Coastguard Worker    mkdir build
49*03ce13f7SAndroid Build Coastguard Worker    cd build
50*03ce13f7SAndroid Build Coastguard Worker    cmake ..
51*03ce13f7SAndroid Build Coastguard Worker    ```
52*03ce13f7SAndroid Build Coastguard Worker    Note: don't call 'cmake .' directly in the root directory. It will make things fails later on. If you do, simply erase the files created by CMake and follow the steps above.
53*03ce13f7SAndroid Build Coastguard Worker
54*03ce13f7SAndroid Build Coastguard Worker17. Build dEQP:
55*03ce13f7SAndroid Build Coastguard Worker
56*03ce13f7SAndroid Build Coastguard Worker    Open `<path to dEQP>\build\dEQP-Core-default.sln` in Visual Studio and Build Solution
57*03ce13f7SAndroid Build Coastguard Worker
58*03ce13f7SAndroid Build Coastguard Worker    Note: Choose a 'Debug' build.
59*03ce13f7SAndroid Build Coastguard Worker
60*03ce13f7SAndroid Build Coastguard Worker18. Generate test cases:
61*03ce13f7SAndroid Build Coastguard Worker    ```
62*03ce13f7SAndroid Build Coastguard Worker    mkdir <path to cherry>\data
63*03ce13f7SAndroid Build Coastguard Worker    cd <path to dEQP>
64*03ce13f7SAndroid Build Coastguard Worker    python3 scripts\build_caselists.py <path to cherry>\data
65*03ce13f7SAndroid Build Coastguard Worker    ```
66*03ce13f7SAndroid Build Coastguard Worker
67*03ce13f7SAndroid Build Coastguard Worker    Note: you need to run `python3 scripts\build_caselists.py <path to cherry>\data` every time you update dEQP.
68*03ce13f7SAndroid Build Coastguard Worker
69*03ce13f7SAndroid Build Coastguard WorkerPreparing the server
70*03ce13f7SAndroid Build Coastguard Worker--------------------
71*03ce13f7SAndroid Build Coastguard Worker
72*03ce13f7SAndroid Build Coastguard Worker19. Edit `<path to cherry>\cherry\data.go`
73*03ce13f7SAndroid Build Coastguard Worker* Search for `../candy-build/deqp-wgl` and replace that by `<path to deqp>/build`
74*03ce13f7SAndroid Build Coastguard Worker* Just above, add an option to CommandLine: `--deqp-gl-context-type=egl`
75*03ce13f7SAndroid Build Coastguard Worker* Remove `--deqp-watchdog=enable` to avoid timeouts during debugging.
76*03ce13f7SAndroid Build Coastguard Worker
77*03ce13f7SAndroid Build Coastguard Worker  Note: If you chose a Release build at step 17, modify the BinaryPath from 'Debug' to 'Release'.
78*03ce13f7SAndroid Build Coastguard Worker
79*03ce13f7SAndroid Build Coastguard WorkerTesting Vulkan
80*03ce13f7SAndroid Build Coastguard Worker--------------
81*03ce13f7SAndroid Build Coastguard Worker
82*03ce13f7SAndroid Build Coastguard Worker20. Assuming you already built SwiftShader, copy and rename this file:
83*03ce13f7SAndroid Build Coastguard Worker
84*03ce13f7SAndroid Build Coastguard Worker    `<path to SwiftShader>\build\Release_x64\vk_swiftshader.dll` or\
85*03ce13f7SAndroid Build Coastguard Worker    `<path to SwiftShader>\build\Debug_x64\vk_swiftshader.dll`
86*03ce13f7SAndroid Build Coastguard Worker
87*03ce13f7SAndroid Build Coastguard Worker    To:
88*03ce13f7SAndroid Build Coastguard Worker
89*03ce13f7SAndroid Build Coastguard Worker    `<path to dEQP>\build\external\vulkancts\modules\vulkan\Debug\vulkan-1.dll`
90*03ce13f7SAndroid Build Coastguard Worker
91*03ce13f7SAndroid Build Coastguard Worker    This will cause dEQP to load SwiftShader's Vulkan implementatin directly, without going through a system-provided [loader](https://github.com/KhronosGroup/Vulkan-Loader/blob/master/loader/LoaderAndLayerInterface.md#the-loader) library or any layers.
92*03ce13f7SAndroid Build Coastguard Worker
93*03ce13f7SAndroid Build Coastguard Worker     This step can also be automated by setting the `SWIFTSHADER_VULKAN_API_LIBRARY_INSTALL_PATH` environment variable to a path where we'd like the drop-in API library to be installed. For example `<path to dEQP>/build/external/vulkancts/modules/vulkan/Debug/`.
94*03ce13f7SAndroid Build Coastguard Worker
95*03ce13f7SAndroid Build Coastguard Worker    To use SwiftShader as an [Installable Client Driver](https://github.com/KhronosGroup/Vulkan-Loader/blob/master/loader/LoaderAndLayerInterface.md#installable-client-drivers) (ICD) instead:
96*03ce13f7SAndroid Build Coastguard Worker    * Edit environment variables:
97*03ce13f7SAndroid Build Coastguard Worker      * Define VK_ICD_FILENAMES to `<path to SwiftShader>\src\Vulkan\vk_swiftshader_icd.json`
98*03ce13f7SAndroid Build Coastguard Worker    * If the location of `vk_swiftshader.dll` you're using is different than the one specified in `src\Vulkan\vk_swiftshader_icd.json`, modify it to point to the `vk_swiftshader.dll` file you want to use.
99*03ce13f7SAndroid Build Coastguard Worker
100*03ce13f7SAndroid Build Coastguard WorkerRunning the tests
101*03ce13f7SAndroid Build Coastguard Worker-----------------
102*03ce13f7SAndroid Build Coastguard Worker
103*03ce13f7SAndroid Build Coastguard Worker21. Start the test server. Go to `<path to cherry>` and run:
104*03ce13f7SAndroid Build Coastguard Worker
105*03ce13f7SAndroid Build Coastguard Worker    `go run server.go`
106*03ce13f7SAndroid Build Coastguard Worker
107*03ce13f7SAndroid Build Coastguard Worker22. Open your favorite browser and navigate to `localhost:8080`
108*03ce13f7SAndroid Build Coastguard Worker
109*03ce13f7SAndroid Build Coastguard Worker    Get Started -> Choose Device 'localhost' -> Select Tests 'dEQP-VK' -> Execute tests!
110*03ce13f7SAndroid Build Coastguard Worker
111*03ce13f7SAndroid Build Coastguard WorkerMustpass sets
112*03ce13f7SAndroid Build Coastguard Worker-------------
113*03ce13f7SAndroid Build Coastguard Worker
114*03ce13f7SAndroid Build Coastguard WorkerdEQP contains more tests than what is expected to pass by a conformant implementation (e.g. some tests are considered too strict, or assume certain undefined behavior). The [android/cts/master/vk-master.txt](https://android.googlesource.com/platform/external/deqp/+/master/android/cts/master/vk-master.txt) text file which can be loaded in Cherry's 'Test sets' tab to only run the latest tests expected to pass by certified Android devices.
115*03ce13f7SAndroid Build Coastguard Worker
116*03ce13f7SAndroid Build Coastguard WorkerLinux
117*03ce13f7SAndroid Build Coastguard Worker-----
118*03ce13f7SAndroid Build Coastguard Worker
119*03ce13f7SAndroid Build Coastguard WorkerThe Linux process is similar to Windows. However it doesn't use Release or Debug variants, paths use forward slashes, and it uses shared object files instead of DLLs.
120*03ce13f7SAndroid Build Coastguard Worker
121*03ce13f7SAndroid Build Coastguard Worker1. Install the latest [Python 3](https://www.python.org/downloads/)
122*03ce13f7SAndroid Build Coastguard Worker2. Install GCC and Make. In a terminal, run:
123*03ce13f7SAndroid Build Coastguard Worker
124*03ce13f7SAndroid Build Coastguard Worker    `sudo apt-get install gcc make`
125*03ce13f7SAndroid Build Coastguard Worker
126*03ce13f7SAndroid Build Coastguard Worker3. Install [CMake](https://cmake.org/download/)
127*03ce13f7SAndroid Build Coastguard Worker4. Install [Go](https://golang.org/doc/install)
128*03ce13f7SAndroid Build Coastguard Worker5. Install Git. In a terminal, run:
129*03ce13f7SAndroid Build Coastguard Worker
130*03ce13f7SAndroid Build Coastguard Worker    `sudo apt-get install git`
131*03ce13f7SAndroid Build Coastguard Worker
132*03ce13f7SAndroid Build Coastguard Worker6. Download the [Vulkan SDK](https://vulkan.lunarg.com/) and unpack it into a location you like.
133*03ce13f7SAndroid Build Coastguard Worker
134*03ce13f7SAndroid Build Coastguard WorkerGetting the Code
135*03ce13f7SAndroid Build Coastguard Worker----------------
136*03ce13f7SAndroid Build Coastguard Worker
137*03ce13f7SAndroid Build Coastguard Worker7. Get Swiftshader. In a terminal, go to the location you want to keep Swiftshader, and run:
138*03ce13f7SAndroid Build Coastguard Worker
139*03ce13f7SAndroid Build Coastguard Worker    ```
140*03ce13f7SAndroid Build Coastguard Worker    git clone https://swiftshader.googlesource.com/SwiftShader && (cd SwiftShader && curl -Lo `git rev-parse --git-dir`/hooks/commit-msg https://gerrit-review.googlesource.com/tools/hooks/commit-msg ; chmod +x `git rev-parse --git-dir`/hooks/commit-msg)
141*03ce13f7SAndroid Build Coastguard Worker    ```
142*03ce13f7SAndroid Build Coastguard Worker
143*03ce13f7SAndroid Build Coastguard Worker    This will also install the commit hooks you need for committing to SwiftShader.
144*03ce13f7SAndroid Build Coastguard Worker
145*03ce13f7SAndroid Build Coastguard Worker8. Get dEQP:
146*03ce13f7SAndroid Build Coastguard Worker
147*03ce13f7SAndroid Build Coastguard Worker   `git clone https://github.com/KhronosGroup/VK-GL-CTS`
148*03ce13f7SAndroid Build Coastguard Worker
149*03ce13f7SAndroid Build Coastguard Worker9. Get dEQP's dependencies. In your dEQP root directory, run:
150*03ce13f7SAndroid Build Coastguard Worker
151*03ce13f7SAndroid Build Coastguard Worker    `python3 external/fetch_sources.py`
152*03ce13f7SAndroid Build Coastguard Worker
153*03ce13f7SAndroid Build Coastguard Worker10. Get Cherry, similar to step 8:
154*03ce13f7SAndroid Build Coastguard Worker
155*03ce13f7SAndroid Build Coastguard Worker    `git clone https://android.googlesource.com/platform/external/cherry`
156*03ce13f7SAndroid Build Coastguard Worker
157*03ce13f7SAndroid Build Coastguard Worker11. Set environment variable. Open ~/.bashrc in your preferred editor and add the following line:
158*03ce13f7SAndroid Build Coastguard Worker
159*03ce13f7SAndroid Build Coastguard Worker    GOPATH='`<path to cherry>`'
160*03ce13f7SAndroid Build Coastguard Worker
161*03ce13f7SAndroid Build Coastguard WorkerBuilding the code
162*03ce13f7SAndroid Build Coastguard Worker-----------------
163*03ce13f7SAndroid Build Coastguard Worker
164*03ce13f7SAndroid Build Coastguard Worker12. Build Swiftshader. In the Swiftshader root dir, run:
165*03ce13f7SAndroid Build Coastguard Worker    ```
166*03ce13f7SAndroid Build Coastguard Worker    cd build
167*03ce13f7SAndroid Build Coastguard Worker    cmake ..
168*03ce13f7SAndroid Build Coastguard Worker    make --jobs=$(nproc)
169*03ce13f7SAndroid Build Coastguard Worker    ```
170*03ce13f7SAndroid Build Coastguard Worker
171*03ce13f7SAndroid Build Coastguard Worker13. Set your environment variables. In the terminal in which you'll be building dEQP, run the following commands:
172*03ce13f7SAndroid Build Coastguard Worker
173*03ce13f7SAndroid Build Coastguard Worker    ```
174*03ce13f7SAndroid Build Coastguard Worker    export LD_LIBRARY_PATH="<Vulkan SDK location>/x86_64/lib:$LD_LIBRARY_PATH"
175*03ce13f7SAndroid Build Coastguard Worker    export LD_LIBRARY_PATH="<Swiftshader location>/build:$LD_LIBRARY_PATH"
176*03ce13f7SAndroid Build Coastguard Worker    ```
177*03ce13f7SAndroid Build Coastguard Worker
178*03ce13f7SAndroid Build Coastguard Worker14. Build dEQP. In the dEQP root dir, run:
179*03ce13f7SAndroid Build Coastguard Worker    ```
180*03ce13f7SAndroid Build Coastguard Worker    mkdir build
181*03ce13f7SAndroid Build Coastguard Worker    cd build
182*03ce13f7SAndroid Build Coastguard Worker    cmake ..
183*03ce13f7SAndroid Build Coastguard Worker    make --jobs=$(nproc)
184*03ce13f7SAndroid Build Coastguard Worker    ```
185*03ce13f7SAndroid Build Coastguard Worker
186*03ce13f7SAndroid Build Coastguard Worker    Also: don't call 'cmake .' directly in the root directory. It will make things fails later on. If you do, simply erase the files created by CMake and follow the steps above.
187*03ce13f7SAndroid Build Coastguard Worker
188*03ce13f7SAndroid Build Coastguard Worker15. Generate test cases:
189*03ce13f7SAndroid Build Coastguard Worker    ```
190*03ce13f7SAndroid Build Coastguard Worker    mkdir <path to cherry>/data
191*03ce13f7SAndroid Build Coastguard Worker    cd <path to dEQP>
192*03ce13f7SAndroid Build Coastguard Worker    python3 scripts/build_caselists.py <path to cherry>/data
193*03ce13f7SAndroid Build Coastguard Worker    ```
194*03ce13f7SAndroid Build Coastguard Worker
195*03ce13f7SAndroid Build Coastguard Worker    Note: you need to run `python3 scripts/build_caselists.py <path to cherry>/data` every time you update dEQP.
196*03ce13f7SAndroid Build Coastguard Worker
197*03ce13f7SAndroid Build Coastguard WorkerPreparing the server
198*03ce13f7SAndroid Build Coastguard Worker--------------------
199*03ce13f7SAndroid Build Coastguard Worker
200*03ce13f7SAndroid Build Coastguard Worker16. Edit `<path to cherry>/cherry/data.go`
201*03ce13f7SAndroid Build Coastguard Worker* Search for ".exe" and remove all instances.
202*03ce13f7SAndroid Build Coastguard Worker* Search for `../candy-build/deqp-wgl/execserver/Release` and replace that by `<path to deqp>/build/execserver/execserver`
203*03ce13f7SAndroid Build Coastguard Worker* Just above, add an option to CommandLine: `--deqp-gl-context-type=egl`
204*03ce13f7SAndroid Build Coastguard Worker* Just below, remove 'Debug/' from the BinaryPath.
205*03ce13f7SAndroid Build Coastguard Worker* Just one more line below, replace `../candy-build/deqp-wgl/` with `<path to deqp>/build/modules/${TestPackageDir}`.
206*03ce13f7SAndroid Build Coastguard Worker* Remove `--deqp-watchdog=enable` to avoid timeouts during debugging.
207*03ce13f7SAndroid Build Coastguard Worker
208*03ce13f7SAndroid Build Coastguard WorkerTesting Vulkan
209*03ce13f7SAndroid Build Coastguard Worker--------------
210*03ce13f7SAndroid Build Coastguard Worker
211*03ce13f7SAndroid Build Coastguard Worker17. Use SwiftShader as an [Installable Client Driver](https://github.com/KhronosGroup/Vulkan-Loader/blob/master/loader/LoaderAndLayerInterface.md#installable-client-drivers) (ICD). Add the following line to your `~/.bashrc`:
212*03ce13f7SAndroid Build Coastguard Worker
213*03ce13f7SAndroid Build Coastguard Worker      `export VK_ICD_FILENAMES="<path to SwiftShader>/build/Linux/vk_swiftshader_icd.json"`
214*03ce13f7SAndroid Build Coastguard Worker
215*03ce13f7SAndroid Build Coastguard Worker    Then run `source ~/.bashrc` in the terminal(s) you'll be running tests from.
216*03ce13f7SAndroid Build Coastguard Worker
217*03ce13f7SAndroid Build Coastguard Worker
218*03ce13f7SAndroid Build Coastguard WorkerRunning the tests
219*03ce13f7SAndroid Build Coastguard Worker-----------------
220*03ce13f7SAndroid Build Coastguard Worker
221*03ce13f7SAndroid Build Coastguard Worker18. Start the test server. Go to `<path to cherry>` and run:
222*03ce13f7SAndroid Build Coastguard Worker
223*03ce13f7SAndroid Build Coastguard Worker    `go run server.go`
224*03ce13f7SAndroid Build Coastguard Worker
225*03ce13f7SAndroid Build Coastguard Worker19. Open your favorite browser and navigate to `localhost:8080`
226*03ce13f7SAndroid Build Coastguard Worker
227*03ce13f7SAndroid Build Coastguard Worker    Get Started -> Choose Device 'localhost' -> Select Tests 'dEQP-VK' -> Execute tests!
228*03ce13f7SAndroid Build Coastguard Worker
229*03ce13f7SAndroid Build Coastguard Worker20. To make sure that you're running SwiftShader's drivers, select only the dEQP-VK->info->device test. In the next window, click on these tests in the left pane. If you see SwiftShader in the deviceName field, then you've set your suite up properly.
230*03ce13f7SAndroid Build Coastguard Worker
231*03ce13f7SAndroid Build Coastguard Worker21. If you want to run Vulkan tests in the command line, go to the build directory in dEQP root. Then run the following command:
232*03ce13f7SAndroid Build Coastguard Worker
233*03ce13f7SAndroid Build Coastguard Worker    `external/vulkanacts/modules/vulkan/deqp-vk`
234*03ce13f7SAndroid Build Coastguard Worker
235*03ce13f7SAndroid Build Coastguard Worker    You can also run individual tests with:
236*03ce13f7SAndroid Build Coastguard Worker
237*03ce13f7SAndroid Build Coastguard Worker    `external/vulkanacts/modules/vulkan/deqp-vk --deqp-case=<test name>`
238*03ce13f7SAndroid Build Coastguard Worker
239*03ce13f7SAndroid Build Coastguard Worker    And you can find a list of the test names in `<Swiftshader root>/tests/regres/testlists/vk-master.txt` However, deqp-vk will cease upon the first failure. It's recommended that you use cherry for your testing needs unless you know what you're doing.
240*03ce13f7SAndroid Build Coastguard Worker
241*03ce13f7SAndroid Build Coastguard Worker22. To check that you're running SwiftShader in cherry, start the server
242*03ce13f7SAndroid Build Coastguard Worker
243*03ce13f7SAndroid Build Coastguard WorkerMustpass sets
244*03ce13f7SAndroid Build Coastguard Worker-------------
245*03ce13f7SAndroid Build Coastguard Worker
246*03ce13f7SAndroid Build Coastguard WorkerdEQP contains more tests than what is expected to pass by a conformant implementation (e.g. some tests are considered too strict, or assume certain undefined behavior). The [android/cts/master/vk-master.txt](https://android.googlesource.com/platform/external/deqp/+/master/android/cts/master/vk-master.txt) text file which can be loaded in Cherry's 'Test sets' tab to only run the latest tests expected to pass by certified Android devices.
247