Skip to content

sRGB texture formats are defined as having an sRGB-encoded alpha channel in vk.xml #2513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
theagentd opened this issue Mar 19, 2025 · 1 comment

Comments

@theagentd
Copy link

In the formats section of vk.xml, sRGB formats are listed as having sRGB encoded alpha channels.

However, for VK_FORMAT_R8G8B8A8_SRGB the spec states the following:

VK_FORMAT_R8G8B8A8_SRGB specifies a four-component, 32-bit unsigned normalized format that has an 8-bit R component stored with sRGB nonlinear encoding in byte 0, an 8-bit G component stored with sRGB nonlinear encoding in byte 1, an 8-bit B component stored with sRGB nonlinear encoding in byte 2, and an 8-bit A component in byte 3.

As such, sRGB formats with alpha channels should have their alpha channels listed as having a numericFormat of "UNORM", not "SRGB".

Example:

        <format name="VK_FORMAT_R8G8B8A8_SRGB" class="32-bit" blockSize="4" texelsPerBlock="1">
            <component name="R" bits="8" numericFormat="SRGB"/>
            <component name="G" bits="8" numericFormat="SRGB"/>
            <component name="B" bits="8" numericFormat="SRGB"/>
            <component name="A" bits="8" numericFormat="SRGB"/> <!--Incorrect, should be UNORM-->
        </format>

I've found that all the sRGB formats with alpha channels have this issue:

  • VK_FORMAT_R8G8B8A8_SRGB
  • VK_FORMAT_B8G8R8A8_SRGB
  • VK_FORMAT_A8B8G8R8_SRGB_PACK32
  • VK_FORMAT_BC1_RGBA_SRGB_BLOCK
  • VK_FORMAT_BC2_SRGB_BLOCK
  • VK_FORMAT_BC3_SRGB_BLOCK
  • VK_FORMAT_BC7_SRGB_BLOCK
  • VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK
  • VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK
  • All ASTC formats with sRGB encoding:
    • VK_FORMAT_ASTC_4x4_SRGB_BLOCK
    • VK_FORMAT_ASTC_5x4_SRGB_BLOCK
    • VK_FORMAT_ASTC_5x5_SRGB_BLOCK
    • VK_FORMAT_ASTC_6x5_SRGB_BLOCK
    • VK_FORMAT_ASTC_6x6_SRGB_BLOCK
    • VK_FORMAT_ASTC_8x5_SRGB_BLOCK
    • VK_FORMAT_ASTC_8x6_SRGB_BLOCK
    • VK_FORMAT_ASTC_8x8_SRGB_BLOCK
    • VK_FORMAT_ASTC_10x5_SRGB_BLOCK
    • VK_FORMAT_ASTC_10x6_SRGB_BLOCK
    • VK_FORMAT_ASTC_10x8_SRGB_BLOCK
    • VK_FORMAT_ASTC_10x10_SRGB_BLOCK
    • VK_FORMAT_ASTC_12x10_SRGB_BLOCK
    • VK_FORMAT_ASTC_12x12_SRGB_BLOCK
  • VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG
  • VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG
  • VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG
  • VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG
@spencer-lunarg
Copy link

@theagentd thanks for pointing this out, this is indeed wrong and I will get a fix in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants