~mmach/netext73/webkit2gtk

« back to all changes in this revision

Viewing changes to Source/ThirdParty/ANGLE/src/libANGLE/renderer/vulkan/doc/FormatTablesAndEmulation.md

  • Committer: mmach
  • Date: 2023-06-16 17:21:37 UTC
  • Revision ID: netbit73@gmail.com-20230616172137-2rqx6yr96ga9g3kp
1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Format Tables and Format Emulation
 
2
 
 
3
## Overrides and Fallbacks
 
4
 
 
5
The [required Vulkan format support][VulkanRequiredSupport] tables do not implement the full set of
 
6
formats needed for OpenGL conformance with extensions. ANGLE emulates missing formats using *format
 
7
overrides* and *format fallbacks*.
 
8
 
 
9
An *override* implements a missing GL format with a required format in all cases. For example, the
 
10
luminance texture format `L8_UNORM` does not exist in Vulkan. We override `L8_UNORM` with the
 
11
required image format `R8_UNORM`.
 
12
 
 
13
A *fallback* is one or more non-required formats ANGLE checks for support at runtime. For example,
 
14
`R8_UNORM` is not a required vertex buffer format. Some drivers do support `R8_UNORM` for vertex
 
15
buffers. So at runtime we check for sampled image support and fall back to `R32_FLOAT` if `R8_UNORM`
 
16
is not supported.
 
17
 
 
18
## The Vulkan Format Table
 
19
 
 
20
Overrides and fallbacks are implemented in ANGLE's [Vulkan format
 
21
table][../vk_format_table_autogen.cpp]. The table is auto-generated by
 
22
[`gen_vk_format_table.py`](../gen_vk_format_table.py). We store the mapping from
 
23
[`angle::Format::ID`](../../FormatID_autogen.h) to [VkFormat][VkFormat] in
 
24
[`vk_format_map.json`](../vk_format_map.json). The format map also lists the overrides and fallbacks.
 
25
To update the tables please modify the format map JSON and then run
 
26
[`scripts/run_code_generation.py`][RunCodeGeneration].
 
27
 
 
28
The [`vk::Format`](../vk_format_utils.h) class describes the information ANGLE needs for a particular
 
29
`VkFormat`. The 'intended' format ID is a reference to the front-end format. The 'actual Image' and
 
30
'actual Buffer' formats are the native Vulkan formats that implement a particular front-end format
 
31
for `VkImages` and `VkBuffers`. For the above example of `R8_UNORM` overriding `L8_UNORM`,
 
32
`L8_UNORM` is the intended format and `R8_UNORM` is the actual Image format.
 
33
 
 
34
For more information please see the source files.
 
35
 
 
36
[VulkanRequiredSupport]: https://renderdoc.org/vkspec_chunked/chap37.html#features-required-format-support
 
37
[VkFormat]: https://renderdoc.org/vkspec_chunked/chap37.html#VkFormat
 
38
[RunCodeGeneration]: ../../../../scripts/run_code_generation.py