This tutorial (msdn) gives a description of a vertex layout.

This is an example of a input layout:

UINT numElements = ARRAYSIZE(layout);

It seems to me that it would be easier to bypass this and simply consider data sent to the vertex shader/pixel shader as a block of floats and allow the vertex or pixel shader to interpret it as it wants.

My question is this:

  • What is the purpose of a vertex layout?
  • Is a vertex layout optional in Direct3D 11?

2 Answers 2


The example reasons why a vertex layout is needed:

We now have a structure that represents our vertex. That takes care of storing vertex information in system memory in our application. However, when we feed the GPU the vertex buffer containing our vertices, we are just feeding it a chunk of memory. The GPU must also know about the vertex layout in order to extract correct attributes out from the buffer. To accomplish this requires the use of an input layout.

Take into account that the vertex shader is just a step in the rendering pipeline, so is the responsibility of the GPU to issue the correct data as parameters in the shader. Yes, you could just define a "data size" and receive an array with that size in the shader and then process it, but that would require more code in the shader, and also could disallow GPU internal optimizations.

I haven't work with DX11, but in OpenGl, DX9 and other graphical APIs, you must define some kind of vertex layout


'A block of floats' wouldn't quite work, as

1) GPUs generally deal with vectors, usually 4-element vectors - and a vertex declaration defines how the floats are grouped into vectors (3-element position, 2-element UV set, etc)

2) Non-float data formats can be used, such as a 32-bit RGBA (which gets expanded into a vector of floats). The GPU needs to know about this


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .