// Copyright 2021-2024 The Khronos Group Inc.
//
// SPDX-License-Identifier: CC-BY-4.0

include::{generated}/meta/{refprefix}VK_EXT_shader_module_identifier.adoc[]

=== Other Extension Metadata

*Last Modified Date*::
    2022-05-16
*IP Status*::
    No known IP claims.
*Contributors*::
  - Hans-Kristian Arntzen, Valve
  - Ricardo Garcia, Igalia
  - Piers Daniell, NVIDIA
  - Jan-Harald Fredriksen, Arm
  - Tom Olson, Arm
  - Faith Ekstrand, Collabora

=== Description

Some applications generate SPIR-V code at runtime.
When pipeline caches are primed, either explicitly through e.g.
slink:VkPipelineCache mechanisms, or implicitly through driver managed
caches, having to re-generate SPIR-V modules is redundant.
SPIR-V modules could be cached on disk by an application, but the extra disk
size requirement might be prohibitive in some use cases.

This extension adds the ability for an application to query a small
identifier associated with a slink:VkShaderModule.
On subsequent runs of the application, the same identifier can: be provided
in lieu of a slink:VkShaderModule object.
A pipeline creation call with such a module may: succeed if a pipeline could
be created without invoking compilation, and information inside the SPIR-V
module is not required by the implementation.

ename:VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT must: be used
if only the identifier is provided, and this use case is intended to work
like a non-blocking, speculative compile.
Applications can: fallback as necessary.

The main motivation for identifying the module itself and not the entire
pipeline is that pipeline identifiers change when a driver is updated, but
module identifiers are expected to be stable for any particular driver
implementation.
This approach is helpful for shader pre-compilation systems which can prime
pipeline caches ahead of time.
When on-disk pipeline caches are updated, the same shader identifiers could
lead to a pipeline cache hit.

include::{generated}/interfaces/VK_EXT_shader_module_identifier.adoc[]

=== Version History

  * Revision 1, 2022-03-16 (Hans-Kristian Arntzen)
  ** Initial draft
