1<!-- markdownlint-disable MD041 -->
2<!-- Copyright 2015-2019 LunarG, Inc. -->
3
4[![Khronos Vulkan][1]][2]
5
6[1]: https://vulkan.lunarg.com/img/Vulkan_100px_Dec16.png "https://www.khronos.org/vulkan/"
7[2]: https://www.khronos.org/vulkan/
8
9# VK\_LAYER\_LUNARG\_core\_validation
10
11[![Creative Commons][3]][4]
12
13[3]: https://i.creativecommons.org/l/by-nd/4.0/88x31.png "Creative Commons License"
14[4]: https://creativecommons.org/licenses/by-nd/4.0/
15The `VK_LAYER_LUNARG_core_validation` layer validates the status of descriptor sets, command buffers, shader modules, pipeline states, renderpass usage, synchronization, dynamic states and is the workhorse layer for many other types of valid usage.
16
17`VK_LAYER_LUNARG_core_validation` validates that:
18
19- the descriptor set state and pipeline state at each draw call are consistent
20- pipelines are created correctly, known when used and bound at draw time
21- descriptor sets are known and consist of valid types, formats, and layout
22- descriptor set regions are valid, bound, and updated appropriately
23- command buffers referenced are known and valid
24- command sequencing for specific state dependencies and renderpass use is correct
25- memory is available
26- dynamic state is correctly set.
27
28The `VK_LAYER_LUNARG_core_validation` layer will print errors if validation checks are not correctly met.  `VK_LAYER_LUNARG_core_validation` will also display the values of the objects tracked.
29
30## Memory/Resource related functionality
31
32This layer additionally attempts to ensure that memory objects are managed correctly by the application.  These memory objects may be bound to pipelines, objects, and command buffers, and then submitted to the GPU for work. Specifically the layer validates that:
33
34- the correct memory objects have been bound
35- memory objects are specified correctly upon command buffer submittal
36- only existing memory objects are referenced
37- destroyed memory objects are not referenced
38- the application has confirmed any memory objects to be reused or destroyed have been properly unbound
39- checks texture formats and render target formats.
40
41Errors will be printed if validation checks are not correctly met and warnings if improper (but not illegal) use of memory is detected.  This validation layer also dumps all memory references and bindings for each operation.
42
43## Shader validation functionality
44
45Checks performed by this layer apply to the VS->FS and FS->CB interfaces with the pipeline.  These checks include:
46
47- validating that all variables which are part of a shader interface are  decorated with either `spv::DecLocation` or `spv::DecBuiltin` (that is, only the SSO rendezvous-by-location model is supported)
48- emitting a warning if a location is declared only in the producing stage (useless work is being done)
49- emitting an error if a location is declared only in the consuming stage (garbage will be read).
50
51A special error checking case invoked when the FS stage writes a built-in corresponding to the legacy `gl_FragColor`.  In this case, an error is emitted if
52
53- the FS also writes any user-defined output
54- the CB has any attachment with a `UINT` or `SINT` type.
55
56These extra checks are to ensure that the legacy broadcast of `gl_FragColor` to all bound color attachments is well-defined.
57
58## Swapchain validation functionality
59
60This area of functionality validates the use of the WSI (Window System Integration) "swapchain" extensions (e.g., `VK_EXT_KHR_swapchain` and `VK_EXT_KHR_device_swapchain`).
61