Zebrafish
Zebrafish

Reputation: 13876

Is it normal for your gpu device not to support three channel formats?

I've noticed that the GPU I'm running on Vulkan doesn't support so many of the R8G8B8_UINT formats but does with the R8G8B8A8 FORMATS. Also the same thing with many others like R32G32B32_SFLOAT. I've noticed that's also the with other GPUs I've seen on OpenGPU database.

Is this normal? Why is this so? Is it normal with other graphics APIs? Is it to align values/texels to a "round/nicer/aligned" number of bytes? How are you supposed to get around this? I'm having trouble seeing how throughout your code you'll be interacting with images that you have no idea what colour format they are, which complicates things both on host code and in shaders.

Also if I have 3 channel colour format image on the host and I want to use with Vulkan and say R8G8B8 or R32G32B32, do I need to loop through the image manually and rearrange the texels?

Upvotes: 1

Views: 249

Answers (1)

Chuck Walbourn
Chuck Walbourn

Reputation: 41077

24bpp formats are hard to optimize in graphics hardware. This is why there is no "R8G8B8" format even defined for the DirectX Graphics Infrastructure pixel formats used for Direct3D 10, 11.x, and 12. Almost all the work is around optimizing 32bpp formats which is why RGBA32, BGRA32, etc. are much more commonly supported. 64bpp and 128bpp formats are multiples of 32-bits, so it makes just the 24bpp format the 'odd-man out' in many cases. You often can find a B8G8R8X8 (32-bit) format which is about as close as you get to 24bpp.

Some hardware will find ways to support 24bpp formats (which were supported by older Direct3D releases for example), but it's generally less efficiently rendered.

Similar issues arise with 96bpp formats (R32G32B32 floating-point). For Direct3D Hardware Feature Levels, this format is always optional and when implemented it's typically done as three 32-bit floating-point planes, one for each color channel.

Upvotes: 2

Related Questions