VULKAN-HPP:VK :: unique Handle和VK :: Raii包装器有什么区别?

发布于 2025-01-31 03:51:37 字数 465 浏览 3 评论 0原文

我读了 new raii rapper -HPP API。 看来vk :: uniqueHandle< t>和raii包装器都是移动唯一的对象,这些对象会破坏其在破坏者中的手柄。

似乎有一个区别是,RAII变体不能默认构建,而unique可以。

另一个区别是,RAII变体似乎需要vk :: raii :: context类要实例化并通过。

那么,为什么它们都存在呢?应该首选哪一个?在哪种情况下? 为什么RAII变体需要上下文对象?

I read the documentation of the new raii wrappers in the Vulkan-Hpp API.
It seems that both vk::UniqueHandle<T> and the raii wrappers are move only objects that destruct their handle in their destructors.

One difference seems to be is that the raii variants cannot be default constructed whereas the UniqueHandle ones can.

Another difference is that the raii variant seem to require the vk::raii::Context class to be instantiated and passed around.

So why both of them exists? Which one should be preferred and in what scenarios?
Why do the raii variants require the Context object?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文