本页内容

QRhiBuffer::NativeBuffer Struct

struct QRhiBuffer::NativeBuffer

包含有关缓冲区底层本机资源的信息。更多...

公共变量

const void *[3] objects
int slotCount

详细说明

成员变量文档

const void *[3] NativeBuffer::objects

该变量包含一个数组,其中存储了指向本机对象句柄的指针。

在 OpenGL 中,本机句柄是一个 GLuint 值,因此 `objects ` 数组中的元素是指向 GLuint 的指针。在 Vulkan 中,本机句柄是一个 VkBuffer,因此该数组的元素是指向 VkBuffer 的指针。 在 Direct3D 11 和 Metal 中,这些元素分别是指向 ID3D11Buffer 或 MTLBuffer 的指针。在 Direct3D 12 中,这些元素是指向 ID3D12Resource 的指针。

注意:请 注意,即使原生类型本身是指针,数组的元素也始终是指向原生缓冲区句柄类型的指针。(因此,在 Vulkan 中,元素是 `VkBuffer * `,尽管在 64 位架构上 `VkBuffer` 本身是一个指针)。

int NativeBuffer::slotCount

指定 objects 数组中有效元素的数量。

实际中该值可以是 0、1、2 或 3。0 表示该QRhiBuffer 未由任何原生缓冲区对象支持。当底层 API 不支持(或后端选择不使用)原生统一缓冲区时,使用UniformBuffer 的 QRhiBuffer 可能会出现这种情况。 1通常用于不可变(Immutable)和静态(Static)类型(但某些后端可能有所不同)。2或3通常用于动态(Dynamic)类型(但某些后端可能有所不同)。

另请参阅 QRhi::currentFrameSlot() 和QRhi::FramesInFlight 。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.