KhronosGroup / KhronosGroup/Vulkan-Docs
Handling of SRGB vertex formats is confusing
- Dominant language
- JavaScript
- Stars
- 3.3k
- Forks
- 549
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 2
Description
Section [21.3.1](https://registry.khronos.org/vulkan/specs/1.3/html/vkspec.html#fxvertex-input-extraction) of the spec makes no mention of running an sRGB to linear conversion for SRGB formats. The [CTS](https://github.com/KhronosGroup/VK-GL-CTS/blob/385ae8bed1f99e497cdf2f3a5640905b90e69292/external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexInputTests.cpp#L1001-L1009) seems to take this as an indication that SRGB vertex formats should be treated identically to UNORM formats. MoltenVK and RADV both support SRGB vertex buffers, and I assume have implemented them in this way (confirmed for MoltenVK).
On the other hand, the [VkFormat description](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkFormat.html) makes no mention of this special handling, and states that the formats are all "stored with sRGB nonlinear encoding". In addition, I think most people would expect that the same color data with the same format would come up the same regardless of whether you loaded it from a texel buffer or a vertex attribute.
I think one of the following changes would improve clarity:
- Update VkFormat's docs to specifically mention that SRGB formats are treated as linear when used with vertex attributes
- Update 21.3.1 to say that sRGB to linear conversion should happen on vertex buffers, and update CTS accordingly
Contributor guide
Assessment
This issue has not been assessed yet.