README.md
1Vulkan CTS README
2=================
3
4This document describes how to build and run Vulkan Conformance Test suite.
5
6Vulkan CTS is built on dEQP framework. dEQP documentation is available
7at http://source.android.com/devices/graphics/testing.html
8
9
10Requirements
11------------
12
13### Common
14
15The following tools must be installed and present in the PATH variable:
16
17 * Git (for checking out sources)
18 * Python 3.x (for the build related scripts, some other scripts still use Python 2.7.x)
19 * CMake 3.10.2 or newer
20
21### Win32
22
23 * Visual Studio 2015 or newer (glslang uses several C++11 features)
24
25### Linux
26
27 * Standard toolchain (make, gcc/clang)
28 * If you have X11 installed, then the build assumes you also have the `GL/glx.h` header
29 file.
30 * You can get this from the `mesa-common-dev` Ubuntu package.
31
32### MacOS
33
34 * Xcode
35
36Vulkan SDK for macOS includes a MoltenVK runtime library which is recommended method for
37developing a Vulkan application.
38
39### Android
40
41 * Android NDK r17c or later.
42 * Android SDK with: SDK Tools, SDK Platform-tools, SDK Build-tools, and API 28
43 * Java Development Kit (JDK)
44 * Windows: either NMake or Ninja in PATH
45
46If you have downloaded the Android SDK command line tools package (25.2.3 or higher) then
47you can install the necessary components by running:
48
49 tools/bin/sdkmanager tools platform-tools 'build-tools;25.0.2' 'platforms;android-28'
50
51
52Building CTS
53------------
54
55To build dEQP, you need first to download sources for zlib, libpng, glslang,
56vulkan-docs, spirv-headers, and spirv-tools.
57
58To download sources, run:
59
60 python external/fetch_sources.py
61
62You may need to re-run `fetch_sources.py` to update to the latest glslang,
63vulkan-docs and spirv-tools revisions occasionally.
64
65You also need to install lxml python module by running:
66
67 python -m pip install lxml
68
69With CMake out-of-source builds are always recommended. Create a build directory
70of your choosing, and in that directory generate Makefiles or IDE project
71using cmake.
72
73
74### Windows x86-32
75
76 cmake <path to vulkancts> -G"Visual Studio 14"
77 start dEQP-Core-default.sln
78
79### Windows x86-64
80
81 cmake <path to vulkancts> -G"Visual Studio 14 Win64"
82 start dEQP-Core-default.sln
83
84### Linux 32-bit Debug
85
86 cmake <path to vulkancts> -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=-m32 -DCMAKE_CXX_FLAGS=-m32
87 make -j
88
89Release build can be done by using -DCMAKE_BUILD_TYPE=Release
90
91If building for 32-bit x86 with GCC, you probably also want to add `-msse2
92-mfpmath=sse` to ensure that you get correct IEEE floating-point behavior.
93
94### Linux 64-bit Debug
95
96 cmake <path to vulkancts> -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=-m64 -DCMAKE_CXX_FLAGS=-m64
97 make -j
98
99
100### MacOS 64-bit Debug
101
102 cmake <path to vulkancts> -DCMAKE_BUILD_TYPE=Debug -DDEQP_TARGET=osx -DCMAKE_C_FLAGS=-m64 -DCMAKE_CXX_FLAGS=-m64
103 make -j
104
105### Android
106
107Following command will build dEQP.apk:
108
109 python scripts/android/build_apk.py --sdk <path to Android SDK> --ndk <path to Android NDK>
110
111By default the CTS package will be built for the Android API level 28.
112Another API level may be supplied using --native-api command line option.
113
114The package can be installed by either running:
115
116 python scripts/android/install_apk.py
117
118By default the CTS package will contain libdeqp.so built for armeabi-v7a, arm64-v8a,
119x86, and x86_64 ABIs, but that can be changed at build time by passing the --abis command line
120option to `scripts/android/build_apk.py`.
121
122To pick which ABI to use at _install time_, use the following command instead:
123
124 adb install -g --abi <ABI name> <build-root>/package/dEQP.apk
125
126
127Building Mustpass
128-----------------
129
130Current mustpass is checked into repository and can be found at:
131
132 external/vulkancts/mustpass/master/vk-default.txt
133
134This file contains list of files located in vk-default subdirectory. Those files contain
135tests from top-level groups and together they contain all test cases that should pass.
136
137Vulkan CTS mustpass can be re-generated by running:
138
139 python <vulkancts>/external/vulkancts/scripts/build_mustpass.py
140
141
142Running CTS
143-----------
144
145Following command line options MUST be used when running CTS:
146
147 --deqp-caselist-file=<vulkancts>/external/vulkancts/mustpass/master/vk-default.txt
148 --deqp-log-images=disable
149 --deqp-log-shader-sources=disable
150
151If an implementation ships with [implicit layers](https://github.com/KhronosGroup/Vulkan-Loader/blob/master/loader/LoaderAndLayerInterface.md#implicit-vs-explicit-layers) enabled, then such layers must be enabled
152when running CTS.
153
154In addition, on multi-device systems the device for which conformance is claimed
155can be selected with:
156
157 --deqp-vk-device-id=<value>
158
159To speed up the conformance run on some platforms the following command line
160option may be used to disable frequent fflush() calls to the output logs:
161
162 --deqp-log-flush=disable
163
164By default, the test log will be written into the path "TestResults.qpa". If the
165platform requires a different path, it can be specified with:
166
167 --deqp-log-filename=<path>
168
169By default, the CTS will expect to find its test resource files in the current
170working directory. This can be overridden with:
171
172 --deqp-archive-dir=<path>
173
174By default, the shader cache will be written into the path "shadercache.bin". If the
175platform requires a different path, it can be specified with:
176
177 --deqp-shadercache-filename=<path>
178
179If the shader cache is not desired, it can be disabled with:
180
181 --deqp-shadercache=disable
182
183CTS execution may be split into N fractions ( for the purpose of running it in parallel ) using
184
185 --deqp-fraction=I,N
186
187where I denotes index of current CTS execution ( I=[0..N-1], N=[1..8] )
188
189When collecting results for a Conformance Submission Package the number of fractions must not exceed 8,
190and a list of mandatory information tests for each fraction must be supplied:
191
192 --deqp-fraction-mandatory-caselist-file=<vulkancts>external/vulkancts/mustpass/master/vk-fraction-mandatory-tests.txt
193
194To specify file containing waived tests that are omitted only by specified vendor and renderer/device
195the following command line option may be used:
196
197 --deqp-waiver-file=<path>
198
199To make log more clear for high level shader source analysis
200output of decompiled SPIR-V shader sources can be disabled:
201
202 --deqp-log-decompiled-spirv=disable
203
204Also non-informative empty LogInfo sections can be removed
205from output into log by specifying:
206
207 --deqp-log-empty-loginfo=disable
208
209No other command line options are allowed.
210
211### Win32
212
213 cd <builddir>/external/vulkancts/modules/vulkan
214 Debug\deqp-vk.exe --deqp-caselist-file=...
215
216Test log will be written into TestResults.qpa
217
218### Linux
219
220 cd <builddir>/external/vulkancts/modules/vulkan
221 ./deqp-vk --deqp-caselist-file=...
222
223### MacOS
224
225 cd <builddir>/external/vulkancts/modules/vulkan
226 ./deqp-vk --deqp-caselist-file=...
227
228### Android
229
230 adb push <vulkancts>/external/vulkancts/mustpass/master/vk-default.txt /sdcard/vk-default.txt
231 adb shell
232
233In device shell:
234
235 am start -n com.drawelements.deqp/android.app.NativeActivity -e cmdLine "deqp --deqp-caselist-file=/sdcard/vk-default.txt --deqp-log-images=disable --deqp-log-shader-sources=disable --deqp-log-filename=/sdcard/TestResults.qpa"
236
237Test progress will be written to device log and can be displayed with:
238
239 adb logcat -s dEQP
240
241Test log will be written into `/sdcard/TestResults.qpa`.
242
243
244Conformance Submission Package Requirements
245-------------------------------------------
246
247The conformance submission package must contain the following:
248
2491. Full test logs (`TestResults.qpa`) from CTS runs against all driver builds and all fractions
2502. Result of `git status` and `git log` from CTS source directory
2513. Any patches used on top of release tag
2524. Conformance statement
253
254Test logs (1) should be named `<submission pkg dir>/TestResults-<driver build type>-<fraction id>-of-<total fractions>.qpa`,
255for example `TestResults-armeabi-v7a-1-of-8.qpa`. On platforms where multiple different driver
256builds (for example 64-bit and 32-bit) are present, CTS logs must be provided
257for each driver build as part of the submission package. If CTS run was split into multiple
258fractions then result files for all fractions must be provided, each file must
259contain results of the mandatory information tests.
260
261Fractions may be run on different physical devices but each device must represent
262the same Conformant Product.
263
264Test logs generated on a system which exposes more than one physical device
265in a device group can be used for products that expose one or more physical
266devices in their device group.
267
268The CTS build must always be done from clean git repository that doesn't have any
269uncommitted changes. Thus it is necessary to run and capture output of `git
270status` and `git log` (2) in the source directory:
271
272 git status > <submission pkg dir>/git-status.txt
273 git log --first-parent <release tag>^..HEAD > <submission pkg dir>/git-log.txt
274
275Any changes made to CTS must be committed to the local repository, and provided
276as part of the submission package (3). This can be done by running:
277
278 git format-patch -o <submission pkg dir> <release tag>..HEAD
279
280Changes to platform-specific code (mostly under `framework/platform`)
281are allowed. The commit message for each change must include a clear
282description of the change and why it is necessary.
283
284Bugfixes to the tests are allowed. Before being used for a submission,
285bugfixes must be accepted and merged into the CTS repository.
286`git cherry-pick` is strongly recommended as a method of applying bug fixes.
287
288Other changes must be accompanied by a waiver (see below).
289
290NOTE: When cherry-picking patches on top of release tag, please use `git cherry-pick -x`
291to include original commit hash in the commit message.
292
293Conformance statement (4) must be included in a file called `STATEMENT-<adopter>`
294and must contain following:
295
296 CONFORM_VERSION: <git tag of CTS release>
297 PRODUCT: <string-value>
298 CPU: <string-value>
299 OS: <string-value>
300
301Note that product/cpu/os information is also captured in `dEQP-VK.info.*` tests
302if `vk::Platform::describePlatform()` is implemented.
303
304If the submission package covers multiple products, you can list them by appending
305additional `PRODUCT:` lines to the conformance statement. For example:
306
307 CONFORM_VERSION: vulkan-cts-1.2.6.0
308 PRODUCT: Product A
309 PRODUCT: Product B
310 ...
311
312The actual submission package consists of the above set of files which must
313be bundled into a gzipped tar file named `VK<API major><API minor>_<adopter><_info>.tgz`.
314`<API major>` is the major version of the Vulkan API specification, `<API minor>`is the minor
315version of the Vulkan API specification.
316`<adopter>` is the name of the Adopting member company, or some recognizable abbreviation.
317The `<_info>` field is optional. It may be used to uniquely identify a submission
318by OS, platform, date, or other criteria when making multiple submissions.
319For example, a company XYZ may make a submission for a Vulkan 1.1 implementation named
320`VK11_XYZ_PRODUCTA_Windows10.tgz`
321
322One way to create a suiteable gzipped tar file is to execute the command:
323
324 tar -cvzf <filename.tgz> -C <submission pkg dir> .
325
326where `<submission pkg dir>` is the directory containing the files from (1)-(4)
327from above. A submission package must contain all of the files listed above,
328and only those files.
329
330As an example submission package could contain:
331
332 STATEMENT-Khronos
333 git-log.txt
334 git-status.txt
335 0001-Remove-Waived-Filtering-Tests.patch
336 0002-Fix-Pipeline-Parameters.patch
337 TestResults-armeabi-v7a.qpa
338 TestResults-arm64-v8a.qpa
339
340
341Waivers
342-------
343
344The process for requesting a waiver is to report the issue by filing a bug
345report in the Gitlab VulkanCTS project (TODO Github?). When creating the
346submission package, include references to the waiver in the commit message of
347the relevant change. Including as much information as possible in your bug
348report (including a unified diff or a merge request of suggested file changes)
349will ensure the issue can be progressed as rapidly as possible. Issues must
350be labeled "Waiver" (TODO!) and identify the version of the CTS and affected
351tests.
352
353Conformance Criteria
354--------------------
355
356Conformance run is considered passing if all tests finish with allowed result
357codes. Test results are contained in the TestResults.qpa log. Each
358test case section contains XML tag Result, for example:
359
360 <Result StatusCode="Pass">Not validated</Result>
361
362The result code is the value of the StatusCode attribute. Following status
363codes are allowed:
364
365 Pass
366 NotSupported
367 QualityWarning
368 CompatibilityWarning
369 Waiver
370
371Submission package can be verified using `verify_submission.py`
372script located in [vk-gl-cts-Tools](https://github.com/KhronosGroup/vk-gl-cts-Tools).
373
374Vulkan platform port
375--------------------
376
377Vulkan support from Platform implementation requires providing
378`getVulkanPlatform()` method in `tcu::Platform` class implementation.
379
380See `framework/common/tcuPlatform.hpp` and examples in
381`framework/platform/win32/tcuWin32Platform.cpp` and
382`framework/platform/android/tcuAndroidPlatform.cpp`.
383
384If any WSI extensions are supported, platform port must also implement
385methods for creating native display (`vk::Platform::createWsiDisplay`)
386and window handles (`vk::wsi::Display::createWindow`). Otherwise tests
387under `dEQP-VK.wsi` will fail.
388
389
390Null (dummy) driver
391-------------------
392
393For testing and development purposes it might be useful to be able to run
394tests on dummy Vulkan implementation. One such implementation is provided in
395vkNullDriver.cpp. To use that, implement `vk::Platform::createLibrary()` with
396`vk::createNullDriver()`.
397
398
399Validation Layers
400-----------------
401
402Vulkan CTS framework includes first-party support for validation layers, that
403can be turned on with `--deqp-validation=enable` command line option.
404
405When validation is turned on, default instance and device will be created with
406validation layers enabled and debug callback is registered to record any
407messages. Debug messages collected during test execution will be included at
408the end of the test case log.
409
410In addition, when the `--deqp-print-validation-errors` command line option is
411used, validation errors are additionally printed to standard error in the
412moment they are generated.
413
414If any validation errors are found, test result will be set to `InternalError`.
415
416By default `VK_DEBUG_REPORT_INFORMATION_BIT_EXT` and `_DEBUG_BIT_EXT` messages
417are excluded from the log, but that can be customized by modifying
418`vk::DebugReportMessage::shouldBeLogged()` in `vkDebugReportUtil.hpp`.
419
420On the Android target, layers can be added to the APK during the build process
421by setting the `--layers-path` command line option to point into the NDK or to
422a locally-built layers tree. The layers are expected to be found under $abi/
423under the layers path.
424
425
426Cherry GUI
427----------
428
429Vulkan test module can be used with Cherry (GUI for test execution and
430analysis). Cherry is available at
431https://android.googlesource.com/platform/external/cherry. Please follow
432instructions in README to get started.
433
434Before first launch, and every time test hierarchy has been modified, test
435case list must be refreshed by running:
436
437 python scripts/build_caselists.py path/to/cherry/data
438
439Cherry must be restarted for the case list update to take effect.
440
441
442Shader Optimizer
443----------------
444
445Vulkan CTS can be optionally run with the shader optimizer enabled. This
446is an experimental feature which can be used to further stress both the
447drivers as well as the optimizer itself. The shader optimizer is disabled
448by default.
449
450The following command line options can be used to configure the shader
451optimizer:
452
453 --deqp-optimization-recipe=<number>
454
455The list of the optimization recipes can be found and customized in the
456`optimizeCompiledBinary()` function in `vkPrograms.cpp`.
457
458As of this writing, there are 2 recipes to choose from:
459
460 0. Disabled (default)
461 1. Optimize for performance
462 2. Optimize for size
463
464The performance and size optimization recipes are defined by the spir-v
465optimizer, and will change from time to time as the optimizer matures.
466
467 --deqp-optimize-spirv=enable
468
469This option is not required to run the optimizer. By default, the shader
470optimizer only optimizes shaders generated from GLSL or HLSL, and leaves
471hand-written SPIR-V shaders alone.
472
473Many of the hand-written SPIR-V tests stress specific features of the
474SPIR-V which might get optimized out. Using this option will enable the
475optimizer on the hand-written SPIR-V as well, which may be useful in
476finding new bugs in drivers or the optimizer itself, but will likely
477invalidate the tests themselves.
478
479
480Shader Cache
481------------
482
483The Vulkan CTS framework contains a shader cache for speeding up the running
484of the CTS. Skipping shader compilation can significantly reduce runtime,
485especially for repeated runs.
486
487Default behavior is to have the shader cache enabled, but truncated at the
488start of the CTS run. This still gives the benefit of skipping shader
489compilation for identical shaders in different tests (which there are many),
490while making sure that the shader cache file does not grow indefinitely.
491
492The shader cache identifies the shaders by hashing the shader source code
493along with various bits of information that may affect the shader compilation
494(such as shader stage, CTS version, possible compilation flags, etc). If a
495cached shader with matching hash is found, a byte-by-byte comparison of the
496shader sources is made to make sure that the correct shader is being
497retrieved from the cache.
498
499The behavior of the shader cache can be modified with the following command
500line options:
501
502 --deqp-shadercache=disable
503
504Disable the shader cache. All shaders will be compiled every time.
505
506 --deqp-shadercache-filename=<filename>
507
508Set the name of the file where the cached shaders will be stored. This
509option may be required for the shader cache to work at all on Android
510targets.
511
512 --deqp-shadercache-truncate=disable
513
514Do not truncate the shader cache file at startup. No shader compilation will
515occur on repeated runs of the CTS.
516
517
518RenderDoc
519---------
520The RenderDoc (https://renderdoc.org/) graphics debugger may be used to debug
521Vulkan tests.
522
523Following command line option should be used when launching tests from
524RenderDoc UI:
525
526 --deqp-renderdoc=enable
527
528This causes the framework to interface with the debugger and mark each dEQP
529test case as a separate 'frame', just for the purpose of capturing. The frames
530are added using RenderDoc 'In-Application API', instead of swapchain operations.
531
532
533Third Party Runners
534-------------------
535
536Some CTS tests use third-party runners. By default all tests are executed
537regardless of runner type (`any`). To exclude all tests using any of the
538external runners (`none`) or to only include tests using a certain runner:
539
540 --deqp-runner-type=(any|none|amber)
541
542
543Command Line
544------------
545Full list of parameters for the `deqp-vk` module:
546
547OpenGL and OpenCL parameters not affecting Vulkan API were suppressed.
548
549 -h, --help
550 Show this help
551
552 -n, --deqp-case=<value>
553 Test case(s) to run, supports wildcards (e.g. dEQP-GLES2.info.*)
554
555 --deqp-caselist=<value>
556 Case list to run in trie format (e.g. {dEQP-GLES2{info{version,renderer}}})
557
558 --deqp-caselist-file=<value>
559 Read case list (in trie format) from given file
560
561 --deqp-caselist-resource=<value>
562 Read case list (in trie format) from given file located application's assets
563
564 --deqp-stdin-caselist
565 Read case list (in trie format) from stdin
566
567 --deqp-log-filename=<value>
568 Write test results to given file
569 default: 'TestResults.qpa'
570
571 --deqp-runmode=[execute|xml-caselist|txt-caselist|stdout-caselist]
572 Execute tests, or write list of test cases into a file
573 default: 'execute'
574
575 --deqp-caselist-export-file=<value>
576 Set the target file name pattern for caselist export
577 default: '${packageName}-cases.${typeExtension}'
578
579 --deqp-watchdog=[enable|disable]
580 Enable test watchdog
581 default: 'disable'
582
583 --deqp-crashhandler=[enable|disable]
584 Enable crash handling
585 default: 'disable'
586
587 --deqp-base-seed=<value>
588 Base seed for test cases that use randomization
589 default: '0'
590
591 --deqp-test-iteration-count=<value>
592 Iteration count for cases that support variable number of iterations
593 default: '0'
594
595 --deqp-visibility=[windowed|fullscreen|hidden]
596 Default test window visibility
597 default: 'windowed'
598
599 --deqp-surface-width=<value>
600 Use given surface width if possible
601 default: '-1'
602
603 --deqp-surface-height=<value>
604 Use given surface height if possible
605 default: '-1'
606
607 --deqp-surface-type=[window|pixmap|pbuffer|fbo]
608 Use given surface type
609 default: 'window'
610
611 --deqp-screen-rotation=[unspecified|0|90|180|270]
612 Screen rotation for platforms that support it
613 default: '0'
614
615 --deqp-vk-device-id=<value>
616 Vulkan device ID (IDs start from 1)
617 default: '1'
618
619 --deqp-vk-device-group-id=<value>
620 Vulkan device Group ID (IDs start from 1)
621 default: '1'
622
623 --deqp-log-images=[enable|disable]
624 Enable or disable logging of result images
625 default: 'enable'
626
627 --deqp-log-shader-sources=[enable|disable]
628 Enable or disable logging of shader sources
629 default: 'enable'
630
631 --deqp-test-oom=[enable|disable]
632 Run tests that exhaust memory on purpose
633 default: 'enable'
634
635 --deqp-archive-dir=<value>
636 Path to test resource files
637 default: '.'
638
639 --deqp-log-flush=[enable|disable]
640 Enable or disable log file fflush
641 default: 'enable'
642
643 --deqp-validation=[enable|disable]
644 Enable or disable test case validation
645 default: 'disable'
646
647 --deqp-print-validation-errors
648 Print validation errors to standard error
649
650 --deqp-optimization-recipe=<value>
651 Shader optimization recipe (0=disabled, 1=performance, 2=size)
652 default: '0'
653
654 --deqp-optimize-spirv=[enable|disable]
655 Apply optimization to spir-v shaders as well
656 default: 'disable'
657
658 --deqp-shadercache=[enable|disable]
659 Enable or disable shader cache
660 default: 'enable'
661
662 --deqp-shadercache-filename=<value>
663 Write shader cache to given file
664 default: 'shadercache.bin'
665
666 --deqp-shadercache-truncate=[enable|disable]
667 Truncate shader cache before running tests
668 default: 'enable'
669
670 --deqp-renderdoc=[enable|disable]
671 Enable RenderDoc frame markers
672 default: 'disable'
673
674 --deqp-fraction=<value>
675 Run a fraction of the test cases (e.g. N,M means run group%M==N)
676 default: ''
677
678 --deqp-fraction-mandatory-caselist-file=<value>
679 Case list file that must be run for each fraction
680 default: ''
681
682 --deqp-waiver-file=<value>
683 Read waived tests from given file
684 default: ''
685
686 --deqp-runner-type=[any|none|amber]
687 Filter test cases based on runner
688 default: 'any'
689
690 --deqp-terminate-on-fail=[enable|disable]
691 Terminate the run on first failure
692 default: 'disable'