如果我使用带有偏移量的 16 位索引,ID3D11DeviceContext::DrawIndexed() 是否具有 UB?

发布于 2025-01-11 18:32:01 字数 248 浏览 8 评论 0原文

ID3D11DeviceContext::DrawIndexed() 有一个参数StartIndexLocation,该参数在绘制时为每个Index 添加一个值。

如果我使用 16 位索引会发生什么?

16 位可以表示的最高值是 65535。如果我的绘制调用有 10000 个顶点并且我使用 65000 的 StartIndexLocation 会怎样?它会调用 UB 吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

赤濁 2025-01-18 18:32:01

StartIndexLocation 不是字节位置,而是索引位置。交叉引用 DirectX 索引缓冲区 -> Start of Index Buffer

所以StartIndexLocation的最大值与Index Buffer的stride无关。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文