Merge "Try harder to defeat GLSL compiler dead-code optimizations" into nougat-cts...
[platform/upstream/VK-GL-CTS.git] / doc / testspecs / VK / apitests.adoc
1 // asciidoc -b html5 -d book -f apitests.conf apitests.adoc
2
3 :toc:
4 :numbered:
5 :docinfo:
6 :revnumber: 4
7
8 Vulkan API Test Plan
9 ====================
10
11 This document currently outlines Vulkan API testing plan. The document splits API into features, and for each the important testing objectives are described. The technical implementation is not currently planned or documented here, except in select cases.
12
13 In the future this document will likely evolve into a description of various tests and test coverage.
14
15 Test framework
16 --------------
17
18 Test framework will provide tests access to Vulkan platform interface. In addition a library of generic utilties will be provided.
19
20 Test case base class
21 ~~~~~~~~~~~~~~~~~~~~
22
23 Vulkan test cases will use a slightly different interface from traditional +tcu::TestCase+ to facilitate following:
24
25  * Ability to generate shaders in high-level language, and pre-compile them without running the tests
26  * Cleaner separation between test case parameters and execution instance
27
28 [source,cpp]
29 ----
30 class TestCase : public tcu::TestCase
31 {
32 public:
33                             TestCase        (tcu::TestContext& testCtx, const std::string& name, const std::string& description);
34                             TestCase        (tcu::TestContext& testCtx, tcu::TestNodeType type, const std::string& name, const std::string& description);
35     virtual                 ~TestCase       (void) {}
36
37     virtual void            initPrograms    (vk::ProgramCollection<glu::ProgramSources>& programCollection) const;
38     virtual TestInstance*   createInstance  (Context& context) const = 0;
39
40     IterateResult           iterate         (void) { DE_ASSERT(false); return STOP; } // Deprecated in this module
41 };
42
43 class TestInstance
44 {
45 public:
46                                 TestInstance    (Context& context) : m_context(context) {}
47     virtual                     ~TestInstance   (void) {}
48
49     virtual tcu::TestStatus     iterate         (void) = 0;
50
51 protected:
52     Context&                    m_context;
53 };
54 ----
55
56 In addition for simple tests a utility to wrap a function as a test case is provided:
57
58 [source,cpp]
59 ----
60 tcu::TestStatus createSamplerTest (Context& context)
61 {
62     TestLog&                log         = context.getTestContext().getLog();
63     const DefaultDevice     device      (context.getPlatformInterface(), context.getTestContext().getCommandLine());
64     const VkDevice          vkDevice    = device.getDevice();
65     const DeviceInterface&  vk          = device.getInterface();
66
67     {
68         const struct VkSamplerCreateInfo        samplerInfo =
69         {
70             VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,  //  VkStructureType sType;
71             DE_NULL,                                //  const void*     pNext;
72             VK_TEX_FILTER_NEAREST,                  //  VkTexFilter     magFilter;
73             VK_TEX_FILTER_NEAREST,                  //  VkTexFilter     minFilter;
74             VK_TEX_MIPMAP_MODE_BASE,                //  VkTexMipmapMode mipMode;
75             VK_TEX_ADDRESS_CLAMP,                   //  VkTexAddress    addressU;
76             VK_TEX_ADDRESS_CLAMP,                   //  VkTexAddress    addressV;
77             VK_TEX_ADDRESS_CLAMP,                   //  VkTexAddress    addressW;
78             0.0f,                                   //  float           mipLodBias;
79             0u,                                     //  deUint32        maxAnisotropy;
80             VK_COMPARE_OP_ALWAYS,                   //  VkCompareOp     compareOp;
81             0.0f,                                   //  float           minLod;
82             0.0f,                                   //  float           maxLod;
83             VK_BORDER_COLOR_TRANSPARENT_BLACK,      //  VkBorderColor   borderColor;
84         };
85
86         Move<VkSamplerT>    tmpSampler  = createSampler(vk, vkDevice, &samplerInfo);
87     }
88
89     return tcu::TestStatus::pass("Creating sampler succeeded");
90 }
91
92 tcu::TestCaseGroup* createTests (tcu::TestContext& testCtx)
93 {
94     de::MovePtr<tcu::TestCaseGroup> apiTests    (new tcu::TestCaseGroup(testCtx, "api", "API Tests"));
95
96     addFunctionCase(apiTests.get(), "create_sampler",   "", createSamplerTest);
97
98     return apiTests.release();
99 }
100 ----
101
102 +vkt::Context+, which is passed to +vkt::TestInstance+ will provide access to Vulkan platform interface, and a default device instance. Most test cases should use default device instance:
103
104  * Creating device can take up to tens of milliseconds
105  * --deqp-vk-device-id=N command line option can be used to change device
106  * Framework can force validation layers (--deqp-vk-layers=validation,...)
107
108 Other considerations:
109
110  * Rather than using default header, deqp uses custom header & interface wrappers
111  ** See +vk::PlatformInterface+ and +vk::DeviceInterface+
112  ** Enables optional run-time dependency to Vulkan driver (required for Android, useful in general)
113  ** Various logging & other analysis facilities can be layered on top of that interface
114  * Expose validation state to tests to be able to test validation
115  * Extensions are opt-in, some tests will require certain extensions to work
116  ** --deqp-vk-extensions? enable all by default?
117  ** Probably good to be able to override extensions as well (verify that tests report correct results without extensions)
118
119 Common utilities
120 ~~~~~~~~~~~~~~~~
121
122 Test case independent Vulkan utilities will be provided in +vk+ namespace, and can be found under +framework/vulkan+. These include:
123
124  * +Unique<T>+ and +Move<T>+ wrappers for Vulkan API objects
125  * Creating all types of work with configurable parameters:
126  ** Workload "size" (not really comparable between types)
127  ** Consume & produce memory contents
128  *** Simple checksumming / other verification against reference data typically fine
129
130 .TODO
131  * Document important utilities (vkRef.hpp for example).
132  * Document Vulkan platform port.
133
134 Object management
135 -----------------
136
137 Object management tests verify that the driver is able to create and destroy objects of all types. The tests don't attempt to use the objects (unless necessary for testing object construction) as that is covered by feature-specific tests. For all object types the object management tests cover:
138
139  * Creating objects with a relevant set of parameters
140  ** Not exhaustive, guided by what might actually make driver to take different path
141  * Allocating multiple objects of same type
142  ** Reasonable limit depends on object type
143  * Creating objects from multiple threads concurrently (where possible)
144  * Freeing objects from multiple threads
145
146 NOTE: tests for various +vkCreate*()+ functions are documented in feature-specific sections.
147
148 Multithreaded scaling
149 ---------------------
150
151 Vulkan API is free-threaded and suggests that many operations (such as constructing command buffers) will scale with number of app threads. Tests are needed for proving that such scalability actually exists, and there are no locks in important functionality preventing that.
152
153 NOTE: Khronos CTS has not traditionally included any performance testing, and the tests may not be part of conformance criteria. The tests may however be useful for IHVs for driver optimization, and could be enforced by platform-specific conformance tests, such as Android CTS.
154
155 Destructor functions
156 ~~~~~~~~~~~~~~~~~~~~
157
158 API Queries
159 -----------
160
161 Objective of API query tests is to validate that various +vkGet*+ functions return correct values. Generic checks that apply to all query types are:
162
163  * Returned value size is equal or multiple of relevant struct size
164  * Query doesn't write outside the provided pointer
165  * Query values (where expected) don't change between subsequent queries
166  * Concurrent queries from multiple threads work
167
168 Platform queries
169 ~~~~~~~~~~~~~~~~
170
171 Platform query tests will validate that all queries work as expected and return sensible values.
172
173  * Sensible device properties
174  ** May have some Android-specific requirements
175  *** TBD queue 0 must be universal queue (all command types supported)
176  * All required functions present
177  ** Both platform (physicalDevice = 0) and device-specific
178  ** Culled based on enabled extension list?
179
180 Device queries
181 ~~~~~~~~~~~~~~
182
183 Object queries
184 ~~~~~~~~~~~~~~
185
186  * Memory requirements: verify that for buffers the returned size is at least the size of the buffer
187
188 Format & image capabilities
189 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
190
191 Memory management
192 -----------------
193
194 Memory management tests cover memory allocation, sub-allocation, access, and CPU and GPU cache control. Testing some areas such as cache control will require stress-testing memory accesses from CPU and various pipeline stages.
195
196 Memory allocation
197 ~~~~~~~~~~~~~~~~~
198
199  * Test combination of:
200  ** Various allocation sizes
201  ** All heaps
202  * Allocations that exceed total available memory size (expected to fail)
203  * Concurrent allocation and free from multiple threads
204  * Memory leak tests (may not work on platforms that overcommit)
205  ** Allocate memory until fails, free all and repeat
206  ** Total allocated memory size should remain stable over iterations
207  ** Allocate and free in random order
208
209 .Spec issues
210
211 What are the alignment guarantees for the returned memory allocation? Will it satisfy alignment requirements for all object types? If not, app needs to know the alignment, or alignment parameter needs to be added to +VkMemoryAllocInfo+.
212
213 Minimum allocation size? If 1, presumably implementation has to round it up to next page size at least? Is there a query for that? What happens when accessing the added padding?
214
215 Mapping memory and CPU access
216 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
217
218  * Verify that mapping of all host-visible allocations succeed and accessing memory works
219  * Verify mapping of sub-ranges
220  * Access still works after un-mapping and re-mapping memory
221  * Attaching or detaching memory allocation from buffer/image doesn't affect mapped memory access or contents
222  ** Images: test with various formats, mip-levels etc.
223
224 .Spec issues
225  * Man pages say vkMapMemory is thread-safe, but to what extent?
226  ** Mapping different VkDeviceMemory allocs concurrently?
227  ** Mapping different sub-ranges of same VkDeviceMemory?
228  ** Mapping overlapping sub-ranges of same VkDeviceMemory?
229  * Okay to re-map same or overlapping range? What pointers should be returned in that case?
230  * Can re-mapping same block return different virtual address?
231  * Alignment of returned CPU pointer?
232  ** Access using SIMD instructions can benefit from alignment
233
234 CPU cache control
235 ~~~~~~~~~~~~~~~~~
236
237  * TODO Semantics discussed at https://cvs.khronos.org/bugzilla/show_bug.cgi?id=13690
238  ** Invalidate relevant for HOST_NON_COHERENT_BIT, flushes CPU read caches
239  ** Flush flushes CPU write caches?
240  * Test behavior with all possible mem alloc types & various sizes
241  * Corner-cases:
242  ** Empty list
243  ** Empty ranges
244  ** Same range specified multiple times
245  ** Partial overlap between ranges
246
247 .Spec issues
248  * Thread-safety? Okay to flush different ranges concurrently?
249
250 GPU cache control
251 ~~~~~~~~~~~~~~~~~
252
253 Validate that GPU caches are invalidated where instructed. This includes visibility of memory writes made by both CPU and GPU to both CPU and GPU pipeline stages.
254
255  * Image layout transitions may need special care
256
257 Binding memory to objects
258 ~~~~~~~~~~~~~~~~~~~~~~~~~
259
260  * Buffers and images only
261  * Straightforward mapping where allocation size matches object size and memOffset = 0
262  * Sub-allocation of larger allocations
263  * Re-binding object to different memory allocation
264  * Binding multiple objects to same or partially overlapping memory ranges
265  ** Aliasing writable resources? Access granularity?
266  * Binding various (supported) types of memory allocations
267
268 .Spec issues
269  * When binding multiple objects to same memory, will data in memory be visible for all objects?
270  ** Reinterpretation rules?
271  * Memory contents after re-binding memory to a different object?
272
273 Sparse resources
274 ----------------
275
276 Sparse memory resources are treated as separate feature from basic memory management. Details TBD still.
277
278 Binding model
279 -------------
280
281 The objective of the binding model tests is to verify:
282
283  * All valid descriptor sets can be created
284  * Accessing resources from shaders using various layouts
285  * Descriptor updates
286  * Descriptor set chaining
287  * Descriptor set limits
288
289 As a necessary side effect, the tests will provide coverage for allocating and accessing all types of resources from all shader stages.
290
291 Descriptor set functions
292 ~~~~~~~~~~~~~~~~~~~~~~~~
293
294 Pipeline layout functions
295 ~~~~~~~~~~~~~~~~~~~~~~~~~
296
297 Pipeline layouts will be covered mostly by tests that use various layouts, but in addition some corner-case tests are needed:
298
299  * Creating empty layouts for shaders that don't use any resources
300  ** For example: vertex data generated with +gl_VertexID+ only
301
302 Multipass
303 ---------
304
305 Multipass tests will verify:
306
307  * Various possible multipass data flow configurations
308  ** Target formats, number of targets, load, store, resolve, dependencies, ...
309  ** Exhaustive tests for selected dimensions
310  ** Randomized tests
311  * Interaction with other features
312  ** Blending
313  ** Tessellation, geometry shaders (esp. massive geometry expansion)
314  ** Barriers that may cause tiler flushes
315  ** Queries
316  * Large passes that may require tiler flushes
317
318 Device initialization
319 ---------------------
320
321 Device initialization tests verify that all reported devices can be created, with various possible configurations.
322
323  - +VkApplicationInfo+ parameters
324    * Arbitrary +pAppName+ / +pEngineName+ (spaces, utf-8, ...)
325    * +pAppName+ / +pEngineName+ = NULL?
326    * +appVersion+ / +engineVersion+ for 0, ~0, couple of values
327    * Valid +apiVersion+
328    * Invalid +apiVersion+ (expected to fail?)
329  - +VkAllocCallbacks+
330    * Want to be able to run all tests with and without callbacks?
331    ** See discussion about default device in framework section
332    * Custom allocators that provide guardbands and check them at free
333    * Override malloc / free and verify that driver doesn't call if callbacks provided
334    ** As part of object mgmt tests
335    * Must be inherited to all devices created from instance
336  - +VkInstanceCreateInfo+
337    * Empty extension list
338    * Unsupported extensions (expect VK_UNSUPPORTED)
339    * Various combinations of supported extensions
340    ** Any dependencies between extensions (enabling Y requires enabling X)?
341
342 .Spec issues
343  * Only VkPhysicalDevice is passed to vkCreateDevice, ICD-specific magic needed for passing callbacks down to VkDevice instance
344
345  * Creating multiple devices from single physical device
346  * Different queue configurations
347  ** Combinations of supported node indexes
348  ** Use of all queues simultaneously for various operations
349  ** Various queue counts
350  * Various extension combinations
351  * Flags
352  ** Enabling validation (see spec issues)
353  ** VK_DEVICE_CREATE_MULTI_DEVICE_IQ_MATCH_BIT not relevant for Android
354
355 .Spec issues
356  * Can same queue node index used multiple times in +pRequestedQueues+ list?
357  * VK_DEVICE_CREATE_VALIDATION_BIT vs. layers
358
359 Queue functions
360 ---------------
361
362 Queue functions (one currently) will have a lot of indicental coverage from other tests, so only targeted corner-case tests are needed:
363
364  * +cmdBufferCount+ = 0
365  * Submitting empty VkCmdBuffer
366
367 .Spec issues
368  * Can +fence+ be +NULL+ if app doesn't need it?
369
370 Synchronization
371 ---------------
372
373 Synchronization tests will verify that all execution ordering primitives provided by the API will function as expected. Testing scheduling and synchronization robustness will require generating non-trivial workloads and possibly randomization to reveal potential issues.
374
375  * Verify that all sync objects signaled after *WaitIdle() returns
376  ** Fences (vkGetFenceStatus)
377  ** Events (vkEventGetStatus)
378  ** No way to query semaphore status?
379  * Threads blocking at vkWaitForFences() must be resumed
380  * Various amounts of work queued (from nothing to large command buffers)
381  * vkDeviceWaitIdle() concurrently with commands that submit more work
382  * all types of work
383
384 Fences
385 ~~~~~~
386
387  * Basic waiting on fences
388  ** All types of commands
389  ** Waiting on a different thread than the thread that submitted the work
390  * Reusing fences (vkResetFences)
391  * Waiting on a fence / querying status of a fence before it has been submitted to be signaled
392  * Waiting on a fence / querying status of a fence has just been created with CREATE_SIGNALED_BIT
393  ** Reuse in different queue
394  ** Different queues
395
396 .Spec issues
397  * Using same fence in multiple vkQueueSubmit calls without waiting/resetting in between
398  ** Completion of first cmdbuf will reset fence and others won't do anything?
399  * Waiting on same fence from multiple threads?
400
401 Semaphores
402 ~~~~~~~~~~
403
404  * All types of commands waiting & signaling semaphore
405  * Cross-queue semaphores
406  * Queuing wait on initially signaled semaphore
407  * Queuing wait immediately after queuing signaling
408  * vkQueueWaitIdle & vkDeviceWaitIdle waiting on semaphore
409  * Multiple queues waiting on same semaphore
410
411 NOTE: Semaphores might change; counting is causing problems for some IHVs.
412
413 Events
414 ~~~~~~
415
416  * All types of work waiting on all types of events
417  ** Including signaling from CPU side (vkSetEvent)
418  ** Memory barrier
419  * Polling event status (vkGetEventStatus)
420  * Memory barriers (see also GPU cache control)
421  * Corner-cases:
422  ** Re-setting event before it has been signaled
423  ** Polling status of event concurrently with signaling it or re-setting it from another thread
424  ** Multiple commands (maybe multiple queues as well) setting same event
425  *** Presumably first set will take effect, rest have no effect before event is re-set
426
427 Pipeline queries
428 ----------------
429
430 Pipeline query test details TBD. These are of lower priority initially.
431
432 NOTE: Currently contains only exact occlusion query as mandatory. Might be problematic for some, and may change?
433
434 Buffers
435 -------
436
437 Buffers will have a lot of coverage from memory management and access tests. Targeted buffer tests need to verify that various corner-cases and more exotic configurations work as expected.
438
439  * All combinations of create and usage flags work
440  ** There are total 511 combinations of usage flags and 7 combinations of create flags
441  * Buffers of various sizes can be created and they report sensible memory requirements
442  ** Test with different sizes:
443  *** 0 Byte
444  *** 1181 Byte
445  *** 15991 Byte
446  *** 16 kByte
447  *** Device limit (maxTexelBufferSize)
448  * Sparse buffers: very large (limit TBD) buffers can be created
449
450 Buffer views
451 ~~~~~~~~~~~~
452
453  * Buffer views of all (valid) types and formats can be created from all (compatible) buffers
454  ** There are 2 buffer types and 173 different formats.
455  * Various view sizes
456  ** Complete buffer
457  ** Partial buffer
458  * View can be created before and after attaching memory to buffer
459  ** 2 tests for each bufferView
460  * Changing memory binding makes memory contents visible in already created views
461  ** Concurrently changing memory binding and creating views
462
463 .Spec issues
464  * Alignment or size requirements for buffer views?
465
466 Images
467 ------
468
469 Like buffers, images will have significant coverage from other test groups that focus on various ways to access image data. Additional coverage not provided by those tests will be included in this feature group.
470
471 Image functions
472 ~~~~~~~~~~~~~~~
473
474 .Spec issues
475  * +VK_IMAGE_USAGE_GENERAL+?
476
477  * All valid and supported combinations of image parameters
478  ** Sampling verification with nearest only (other modes will be covered separately)
479  * Various image sizes
480  * Linear-layout images & writing data from CPU
481  * Copying data between identical opaque-layout images on CPU?
482
483 Image view functions
484 ~~~~~~~~~~~~~~~~~~~~
485
486 .Spec issues
487  * What are format compatibility rules?
488  * Can color/depth/stencil attachments to write to image which has different format?
489  ** Can I create DS view of RGBA texture and write to only one component by creating VkDepthStencilView for example?
490  * Image view granularity
491  ** All sub-rects allowed? In all use cases (RTs for example)?
492  * Memory access granularity
493  ** Writing concurrently to different areas of same memory backed by same/different image or view
494
495  * Image views of all (valid) types and formats can be created from all (compatible) images
496  * Channel swizzles
497  * Depth- and stencil-mode
498  * Different formats
499  * Various view sizes
500  ** Complete image
501  ** Partial image (mip- or array slice)
502  * View can be created before and after attaching memory to image
503  * Changing memory binding makes memory contents visible in already created views
504  ** Concurrently changing memory binding and creating views
505
506 Render target views
507 ^^^^^^^^^^^^^^^^^^^
508
509  * Writing to color/depth/stencil attachments in various view configurations
510  ** Multipass tests will contain some coverage for this
511  ** Image layout
512  ** View size
513  ** Image mip- or array sub-range
514  * +msaaResolveImage+
515  ** TODO What is exactly this?
516
517 Shaders
518 -------
519
520 Shader API test will verify that shader loading functions behave as expected. Verifying that various SPIR-V constructs are accepted and executed correctly however is not an objective; that will be covered more extensively by a separate SPIR-V test set.
521
522 Pipelines
523 ---------
524
525 Construction
526 ~~~~~~~~~~~~
527
528 Pipeline tests will create various pipelines and verify that rendering results appear to match (resulting HW pipeline is correct). Fixed-function unit corner-cases nor accuracy is verified. It is not possible to exhaustively test all pipeline configurations so tests have to test some areas in isolation and extend coverage with randomized tests.
529
530 Pipeline caches
531 ^^^^^^^^^^^^^^^
532
533 Extend pipeline tests to cases to use pipeline caches, test that pipelines created from pre-populated cache still produce identical results to pipelines created with empty cache.
534
535 Verify that maximum cache size is not exceeded.
536
537 Pipeline state
538 ~~~~~~~~~~~~~~
539
540 Pipeline tests, as they need to verify rendering results, will provide a lot of coverage for pipeline state manipulation. In addition some corner-case tests are needed:
541
542  * Re-setting pipeline state bits before use
543  * Carrying / manipulating only part of state over draw calls
544  * Submitting command buffers that have only pipeline state manipulation calls (should be no-op)
545
546 .Spec issues
547  * Does vkCmdBindPipeline invalidate other state bits?
548
549 Samplers
550 --------
551
552 Sampler tests verify that sampler parameters are mapped to correct HW state. That will be verified by sampling various textures in certain configurations (as listed below). More exhaustive texture filtering verification will be done separately.
553
554  * All valid sampler state configurations
555  * Selected texture formats (RGBA8, FP16, integer textures)
556  * All texture types
557  * Mip-mapping with explicit and implicit LOD
558
559 Dynamic state objects
560 ---------------------
561
562 Pipeline tests will include coverage for most dynamic state object usage as some pipeline configurations need corresponding dynamic state objects. In addition there are couple of corner-cases worth exploring separately:
563
564  * Re-setting dynamic state bindings one or more times before first use
565  * Dynamic state object binding persistence over pipeline changes
566  * Large amounts of unique dynamic state objects in a command buffer, pass, or multipass
567
568 Command buffers
569 ---------------
570
571 Tests for various rendering features will provide significant coverage for command buffer recording. Additional coverage will be needed for:
572
573  * Re-setting command buffers
574  * Very small (empty) and large command buffers
575  * Various optimize flags combined with various command buffer sizes and contents
576  ** Forcing optimize flags in other tests might be useful for finding cases that may break
577
578 Command Pools (5.1 in VK 1.0 Spec)
579 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
580
581 [cols="1,4,8,8", options="header"]
582 |===
583 |No. | Tested area | Test Description | Relevant specification text
584 |1  | Creation | Call vkCreateCommandPool with all parameters that can be NULL having that value | If pAllocator is not NULL, pAllocator must be a pointer to a valid VkAllocationCallbacks structure
585 |2  | | ... with pAllocator != NULL |
586 |3  | | ... with VK_COMMAND_POOL_CREATE_TRANSIENT_BIT set in pCreateInfo's flags | flags is a combination of bitfield flags indicating usage behavior for the pool and command buffers allocated from it.
587 |4  | | ... with VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT set in pCreateInfo's flags |
588 |5  | Resetting | Call vkResetCommandPool with VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT set |
589 |6  | | ... without any bits set |
590 |===
591
592 Command Buffer Lifetime (5.2 in VK 1.0 Spec)
593 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
594
595 [cols="1,4,8,8", options="header"]
596 |===
597 |No. | Tested area | Test Description | Relevant specification text
598 |1  | Allocation | Allocate a single primary  buffer |
599 |2  | | Allocate a large number of primary buffers |
600 |3  | | Allocate no primary buffers (bufferCount == 0) |
601 |4  | | Allocate a single secondary buffer |
602 |5  | | Allocate a large number of secondary buffers |
603 |6  | | Allocate no secondary buffers (bufferCount == 0) |
604 |7  | Execution | Execute a small primary buffer |
605 |8  | | Execute a large primary buffer |
606 |9  | Resetting - implicit | Reset a command buffer by calling vkBeginCommandBuffer on a buffer that has already been recorded |
607 |===
608
609 Command Buffer Recording (5.3 in VK 1.0 Spec)
610 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
611
612 [cols="1,4,8,8", options="header"]
613 |===
614 |No. | Tested area | Test Description | Relevant specification text
615 |1  | Recording to buffers  | Record a single command in a primary buffer |
616 |2  | | Record a large number of commands in a primary buffer |
617 |3  | | Record a single command in a secondary buffer |
618 |4  | | Record a large number of commands in a secondary buffer |
619 |5  | | Record a primary command buffer without VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT. Submit it twice in a row. |
620 |6  | | Record a secondary command buffer without VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT. Submit it twice in a row. |
621 |7  | Recording for one time usage | Record a primary command buffer with VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT. Submit it, reset, record, and submit again. |
622 |8  | | Record a secondary command buffer with VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT. Submit it, reset, record, and submit again. |
623 |9  | Render pass in seconday command buffer  | if VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT flag is not set, the values of renderPass, framebuffer, and subpass members of the VkCommandBufferBeginInfo should be ignored | If flags has VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT set, the entire secondary command buffer is considered inside a render pass. In this case, the renderPass, framebuffer, and subpass members of the VkCommandBufferBeginInfo structure must be set as described below. Otherwise the renderPass, framebuffer, and subpass members of the VkCommandBufferBeginInfo structure are ignored, and the secondary command buffer may not contain commands that are only allowed inside a render pass.
624 |10  | Simultaneous use – primary buffers | Set flag VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT and submit two times simultanously | If flags does not have VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT set, the command buffer must not be pending execution more than once at any given time. A primary command buffer is considered to be pending execution from the time it is submitted via vkQueueSubmit until that submission completes.
625 |11  | Simultaneous use – secondary buffers | Set VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT on secondary buffer, and use the secondary buffer twice in primary buffer | If VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT is not set on a secondary command buffer, that command buffer cannot be used more than once in a given primary command buffer.
626 |12 | Recording with an active occlusion query | Recond a secondary command buffer with occlusionQueryEnable == VK_TRUE and queryFlags == VK_QUERY_CONTROL_PRECISE_BIT and execute it in a primary buffer with an active precise occlusion query |
627 |13 | | ... imprecise occlusion query |
628 |14 | | ... queryFlags == 0x00000000, imprecise occlusion query |
629 |===
630
631 Command Buffer Submission (5.4 in VK 1.0 Spec)
632 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
633
634 [cols="1,4,8,8", options="header"]
635 |===
636 |No. | Tested area | Test Description | Relevant specification text
637 |1  | Submission correctness | Call vkQueueSubmit with submitCount equal to the actual count of submits | pSubmits must be an array of submitCount valid VkSubmitInfo structures. If submitCount is 0 though, pSubmits is ignored
638 |2  | | ... submitCount == 0 |
639 |3  | Submission with semaphores | Call vkQueueSubmit that waits for a single semaphore |
640 |4  | | ... for multiple semaphores |
641 |5  | | ... notifies a single semaphore |
642 |6  | | ... notifies multiple semaphores |
643 |7  | Submission without a fence | Call vkQueueSubmit with VK_NULL_HANDLE passed as fence. | If fence is not VK_NULL_HANDLE, fence must be a valid VkFence handle
644 |===
645
646 Secondary Command Buffer Execution (5.6 in VK 1.0 Spec)
647 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
648
649 [cols="1,4,8,8", options="header"]
650 |===
651 |No. | Tested area | Test Description | Relevant specification text
652 |1  | Secondary buffers execution | Check if secondary command buffers are executed | Secondary command buffers may be called from primary command buffers, and are not directly submitted to queues.
653 |2  | Simultaneous use | Call vkCmdExecuteCommands with pCommandBuffers such that its element is already pending execution in commandBuffer and was created with the VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT flag | Any given element of pCommandBuffers must not be already pending execution in commandBuffer, or appear twice in pCommandBuffers, unless it was created with the VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT flag
654 |3  | | Call vkCmdExecuteCommands with pCommandBuffers such that its element appears twice in pCommandBuffers and was created with the VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT flag |
655 |4  | Call from within a VkRenderPass | Call vkCmdExecuteCommands within a VkRenderPass with all elements of pCommandBuffers recorded with the VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT | If vkCmdExecuteCommands is being called within a VkRenderPass, any given element of pCommandBuffers must have been recorded with the VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT
656 |===
657
658 Commands Allowed Inside Command Buffers
659 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
660
661 [cols="1,4,8,8", options="header"]
662 |===
663 |No. | Tested area | Test Description | Relevant specification text
664 |1  | Order of execution | Check if vkCmdBindPipeline commands are executed in-order  |
665 |2  | | Check if vkCmdBindDescriptorSets commands are executed in-order  |
666 |3  | | Check if vkCmdBindIndexBuffer commands are executed in-order |
667 |4  | | Check if vkCmdBindVertexBuffers commands are executed in-order |
668 |5  | | Check if vkCmdResetQueryPool, vkCmdBeginQuery, vkCmdEndQuery, vkCmdCopyQueryPoolResults commands are executed in-order relative to each other |
669 |===
670
671 Draw commands
672 -------------
673
674 Draw command tests verify that all draw parameters are respected (including vertex input state) and various draw call sizes work correctly. The tests won't however validate that all side effects of shader invocations happen as intended (covered by feature-specific tests) nor that primitive rasterization is fully correct (will be covered by separate targeted tests).
675
676 Compute
677 -------
678
679 Like draw tests, compute dispatch tests will validate that call parameters have desired effects. In addition compute tests need to verify that various dispatch parameters (number of work groups, invocation IDs) are passed correctly to the shader invocations.
680
681 NOTE: Assuming that compute-specific shader features, such as shared memory access, is covered by SPIR-V tests.
682
683 Copies and blits
684 ----------------
685
686 Buffer copies
687 ~~~~~~~~~~~~~
688
689 Buffer copy tests need to validate that copies and updates happen as expected for both simple and more complex cases:
690
691  * Whole-buffer, partial copies
692  * Small (1 byte) to very large copies and updates
693  * Copies between objects backed by same memory
694
695 NOTE: GPU cache control tests need to verify copy source and destination visibility as well.
696
697 Image copies
698 ~~~~~~~~~~~~
699
700 Image copy and blitting tests need to validate that copies and updates happen as expected for both simple and more complex cases:
701
702 * Image copies should cover
703 ** Whole and partial copies
704 ** Source and destination are backed by the same Image
705 ** Compressed and uncompressed copies
706 ** Multiple copy regions in one command
707 ** Copies between different but compatible formats
708 * Blitting should cover
709 ** Whole and partial copies
710 ** With and without scaling
711 ** Copies between different but compatible formats (format conversions)
712
713 Copies between buffers and images
714 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
715
716 The copies between buffers and images are used for checking the rendering result across the vulkancts so it
717 is well tested. This tests should cover corner cases.
718
719 * Various sizes
720 ** Whole and partial copies
721 * Multiple copies in one command
722
723 Clearing images
724 ~~~~~~~~~~~~~~~
725
726 Clearing tests need to validate that clearing happen as expected for both simple and more complex cases:
727
728 * Clear the attachments.
729 ** Whole and partial clear.
730
731 Multisample resolve
732 ~~~~~~~~~~~~~~~~~~~
733
734 Multisample tests need to validate that image resolving happen as expected for both simple and more complex cases.
735
736 * Various multisample counts.
737 ** All possible sample counts: 2, 4, 8, 16, 32 and 64.
738 * Whole and partial image.
739 ** Regions with different offsets and extents.
740 ** Use multiple regions.
741
742 Push constants
743 --------------
744
745  * Range size, including verify various size of a single range from minimum to maximum
746  * Range count, including verify all the valid shader stages
747  * Data update, including verify a sub-range update, multiple times of updates
748
749  ? Invalid usages specified in spec NOT tested
750
751 GPU timestamps
752 --------------
753
754  * All timestamp stages
755  * record multiple timestamps in single command buffer
756  * timestamps in/out of render pass
757  * Command buffers that only record timestamps
758
759 .Spec issues
760
761 Validation layer tests
762 ----------------------
763
764 Validation layer tests exercise all relevant invalid API usage patterns and verify that correct return values and error messages are generated. In addition validation tests would try to load invalid SPIR-V binaries and verify that all generic SPIR-V, and Vulkan SPIR-V environment rules are checked.
765
766 Android doesn't plan to ship validation layer as part of the system image so validation tests are not required by Android CTS and thus are of very low priority currently.