Is DXGI_FORMAT_R16G16B16_FLOAT missing!?

Started by
4 comments, last by ongamex92 10 years ago

In order to create a input layout that represent a vertex element of type half3 we need DXGI_FORMAT_R16G16B16_X (in D3D11_INPUT_ELEMENT_DESC) but there isn't such element in DXGI_FORMAT enumeration.

Am I missing something?

Advertisement

Yes, 3 x 16-bit per-channel format is missing, just use DXGI_FORMAT_R16G16B16A16_x and ignore the fourth component ore use three DXGI_FORMAT_R16_x.

"Recursion is the first step towards madness." - "Skegg?ld, Skálm?ld, Skildir ro Klofnir!"
Direct3D 12 quick reference: https://github.com/alessiot89/D3D12QuickRef/

I don't diractly need this. I was creating a wrapper around few graphics APIs when i found that DXGI_FORMAT_R16G16B16A16_x is missing. I'm just curious why did that hapen.

It's a potentially very inefficient format on some hardware, and typically isn't needed. Three-component texture formats in generally are very non-ideal as they tend to cause most texels to be oddly aligned. Usual computer stuff: 1, 2, and 4 components work well since they're powers of two.

Sean Middleditch – Game Systems Engineer – Join my team!

AFAIK, vertex atributes have to be 4-byte aligned on pretty much every card.

e.g.

4x Int8 is ok, but 1/2/3x Int8 is not.

2/4x F16 is ok, but 1/3x F16 is not.

If this is working under another API (I'm guessing OpenGL), then it's probably doing something horrible behind the scenes, like reallocating your vertex buffers and moving/aligning all the attributes for you... or inserting a bunch of code at the beginning of your vertex shader to fetch several Int32 variables and bitshift/merge them together before reinterpreting as half-float and then converting to float... sad.png

AFAIK, vertex atributes have to be 4-byte aligned on pretty much every card.

e.g.

4x Int8 is ok, but 1/2/3x Int8 is not.

2/4x F16 is ok, but 1/3x F16 is not.

If this is working under another API (I'm guessing OpenGL), then it's probably doing something horrible behind the scenes, like reallocating your vertex buffers and moving/aligning all the attributes for you... or inserting a bunch of code at the beginning of your vertex shader to fetch several Int32 variables and bitshift/merge them together before reinterpreting as half-float and then converting to float... sad.png

Thanks again for the explanation Hodgman. I don't use that format, so everything is fine for me.

This topic is closed to new replies.

Advertisement