directxdirectx-11direct3ddirect3d11

Does ID3D11DeviceContext::DrawIndexed() have UB if I use 16 bit Indices with an Offset?


ID3D11DeviceContext::DrawIndexed() has a parameter StartIndexLocation, which adds a value to each Index when drawing.

What happens if I use 16 bit Indices ?

The highest value 16 bit can represent is 65535. What If my Draw Call has 10000 vertices and I use a StartIndexLocation of 65000 ? Will it invoke UB?


Solution

  • StartIndexLocation is not a byte-position, but an Index position. Cross reference DirectX Index Buffer -> Start of Index Buffer

    So the maximum StartIndexLocation is not related to the stride of the Index Buffer.