Raildex
Raildex

Reputation: 4747

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?

Upvotes: 1

Views: 247

Answers (1)

PhillipH
PhillipH

Reputation: 6222

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.

Upvotes: 1

Related Questions