Skip to content

Remove some texture formats that are not universal.#357

Merged
kdashg merged 1 commit intogpuweb:masterfrom
Kangz:remove-formats
Jul 15, 2019
Merged

Remove some texture formats that are not universal.#357
kdashg merged 1 commit intogpuweb:masterfrom
Kangz:remove-formats

Conversation

@Kangz
Copy link
Contributor

@Kangz Kangz commented Jul 4, 2019

The r8unorm-srgb and rg8unorm-srgb are not guaranteed to be present in
Vulkan and in fact rg8unorm-srgb isn't available on a recent NVIDIA
Linux Vulkan driver.

The r5g6b5unorm format isn't supported on Metal on macOS.


Preview | Diff

Copy link
Contributor

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sad to lose "b5g6r5unorm", but there is not much we can do.

Copy link
Contributor

@kdashg kdashg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect b5g6r5unorm is actually well-supported, but that the naming conventions used by the APIs make this unclear.
D3D11.1+: DXGI_FORMAT_B5G6R5_UNORM (LSB-first! In D3D9 this was D3DFMT_R5G6B5!)
Vulkan: VK_FORMAT_R5G6B5_UNORM_PACK16 (MSB-first, shows you the bits in the spec)
Metal: MTLPixelFormat.b5g6r5Unorm (I'm betting this is LSB-first!)

We should check on Metal, but its other packed 16bit formats are:

  • a1bgr5Unorm
  • abgr4Unorm
  • bgr5a1Unorm

I would be surprised if abgr4Unorm was not GL_RGBA4.

FWIW, DXGI also declares DXGI_FORMAT_B5G5R5A1_UNORM. (Vulcan, of course, declares everything)

@Kangz
Copy link
Contributor Author

Kangz commented Jul 9, 2019

@jdashg the problem on Metal isn't the order of component in the format, like you said, it is likely the same format as in other APIs.

The issue is that the format is explicitly marked unavailable on macOS, here's an extract of the system headers on my machine:

typedef NS_ENUM(NSUInteger, MTLPixelFormat)
{
    // ...

    /* Packed 16 bit formats */

    MTLPixelFormatB5G6R5Unorm API_AVAILABLE(ios(8.0)) API_UNAVAILABLE(macos) = 40,
    MTLPixelFormatA1BGR5Unorm API_AVAILABLE(ios(8.0)) API_UNAVAILABLE(macos) = 41,
    MTLPixelFormatABGR4Unorm  API_AVAILABLE(ios(8.0)) API_UNAVAILABLE(macos) = 42,
    MTLPixelFormatBGR5A1Unorm API_AVAILABLE(ios(8.0)) API_UNAVAILABLE(macos) = 43,

    //...
};

@kdashg
Copy link
Contributor

kdashg commented Jul 9, 2019

@grorg Please inform the Metal team of my disappointment about B5G6R5Unorm desktop support. :)

The r8unorm-srgb and rg8unorm-srgb are not guaranteed to be present in
Vulkan and in fact rg8unorm-srgb isn't available on a recent NVIDIA
Linux Vulkan driver.

The r5g6b5unorm format isn't supported on Metal on macOS.
@kainino0x
Copy link
Contributor

Rebased over #365.

@kdashg kdashg merged commit dd012b8 into gpuweb:master Jul 15, 2019
@Kangz Kangz deleted the remove-formats branch August 20, 2019 07:15
ben-clayton pushed a commit to ben-clayton/gpuweb that referenced this pull request Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants