• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2018-2024 The Khronos Group Inc.
2//
3// SPDX-License-Identifier: CC-BY-4.0
4
5include::{generated}/meta/{refprefix}VK_EXT_astc_decode_mode.adoc[]
6
7=== Other Extension Metadata
8
9*Last Modified Date*::
10    2018-08-07
11*Contributors*::
12  - Jan-Harald Fredriksen, Arm
13
14=== Description
15
16The existing specification requires that low dynamic range (LDR) ASTC
17textures are decompressed to FP16 values per component.
18In many cases, decompressing LDR textures to a lower precision intermediate
19result gives acceptable image quality.
20Source material for LDR textures is typically authored as 8-bit UNORM
21values, so decoding to FP16 values adds little value.
22On the other hand, reducing precision of the decoded result reduces the size
23of the decompressed data, potentially improving texture cache performance
24and saving power.
25
26The goal of this extension is to enable this efficiency gain on existing
27ASTC texture data.
28This is achieved by giving the application the ability to select the
29intermediate decoding precision.
30
31Three decoding options are provided:
32
33  * Decode to ename:VK_FORMAT_R16G16B16A16_SFLOAT precision: This is the
34    default, and matches the required behavior in the core API.
35  * Decode to ename:VK_FORMAT_R8G8B8A8_UNORM precision: This is provided as
36    an option in LDR mode.
37  * Decode to ename:VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 precision: This is
38    provided as an option in both LDR and HDR mode.
39    In this mode, negative values cannot be represented and are clamped to
40    zero.
41    The alpha component is ignored, and the results are as if alpha was 1.0.
42    This decode mode is optional and support can be queried via the physical
43    device properties.
44
45include::{generated}/interfaces/VK_EXT_astc_decode_mode.adoc[]
46
47=== Issues
48
491) Are implementations allowed to decode at a higher precision than what is
50requested?
51
52    RESOLUTION: No.
53    If we allow this, then this extension could be exposed on all
54    implementations that support ASTC.
55    But developers would have no way of knowing what precision was actually
56    used, and thus whether the image quality is sufficient at reduced
57    precision.
58
592) Should the decode mode be image view state and/or sampler state?
60
61    RESOLUTION: Image view state only.
62    Some implementations treat the different decode modes as different
63    texture formats.
64
65=== Example
66
67Create an image view that decodes to ename:VK_FORMAT_R8G8B8A8_UNORM
68precision:
69
70[source,c++]
71----
72    VkImageViewASTCDecodeModeEXT decodeMode =
73    {
74        .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_ASTC_DECODE_MODE_EXT,
75        .pNext = NULL,
76        .decodeMode = VK_FORMAT_R8G8B8A8_UNORM
77    };
78
79    VkImageViewCreateInfo createInfo =
80    {
81        .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
82        .pNext = &decodeMode,
83        // flags, image, viewType set to application-desired values
84        .format = VK_FORMAT_ASTC_8x8_UNORM_BLOCK,
85        // components, subresourceRange set to application-desired values
86    };
87
88    VkImageView imageView;
89    VkResult result = vkCreateImageView(
90        device,
91        &createInfo,
92        NULL,
93        &imageView);
94----
95
96=== Version History
97
98  * Revision 1, 2018-08-07 (Jan-Harald Fredriksen)
99  ** Initial revision
100
101