Search code examples
directx-11

Passing sRGB colors in vertices


Is there a way to pass sRGB colors in a vertex?

Trying to set a D3D11_INPUT_ELEMENT_DESC's Format to a *_SRGB format yields an error:

D3D11 ERROR: ID3D11Device::CreateInputLayout:
Element[n]'s format (*_SRGB) cannot be used with the Input Assembler.

Of course, the vertex colors could be converted manually, but this seems like a weird special case, as I am using sRGB render targets and sRGB textures (to get proper blending), so everything else is converted between sRGB and linear spaces by hardware autmatically.


Solution

  • The _SRGB format 'property' is implemented in the texture lookup hardware and the blending hardware, but not in the 'input layout' hardware. This is why it doesn't work as an Input Layout format.