*DX11, HLSL* - Colour as 4 floats or one UINT

Posted by Paul on Game Development See other posts from Game Development or by Paul
Published on 2012-04-13T04:36:07Z Indexed on 2012/04/13 5:43 UTC
Read the original article Hit count: 428

Filed under:
|

With the DX11 pipeline, would it be much quicker for the vertex buffer to pass one single UINT with one byte per channel to the input assembler, as opposed to three floats? Then the vertex shader would convert the four bytes to four floats, which I guess is the required colour format for the pipeline. In this instance, colour accuracy isn't an issue.

The vertex buffer would need to be updated many times per frame, so using a single UINT and saving 12 bytes for every vertex could well be worth it: quicker uploads to vram and also less memory used. But the cost is the extra shader work for every vertex to convert each 8 bits of the input UNIT into a float.

Anyone have an idea if it might be worth doing?

Or, is it possible for the pipeline to be set to just internally use a four-byte colour format? The swap chain buffer has been initialised as DXGI_FORMAT_R8G8B8A8_UNORM, so ultimately that's how the colour will be written.

Thanks!

© Game Development or respective owner

Related posts about hlsl

Related posts about color