NativeBuffer Struct

struct QRhiBuffer::NativeBuffer

Contains information about the underlying native resources of a buffer. More...

Public Variables

const void *[3] objects
int slotCount

Detailed Description

Member Variable Documentation

const void *[3] NativeBuffer::objects

This variable holds an array with pointers to the native object handles.

With OpenGL, the native handle is a GLuint value, so the elements in the objects array are pointers to a GLuint. With Vulkan, the native handle is a VkBuffer, so the elements of the array are pointers to a VkBuffer. With Direct3D 11 and Metal the elements are pointers to a ID3D11Buffer or MTLBuffer pointer, respectively. With Direct3D 12, the elements are pointers to a ID3D12Resource.

Note: Pay attention to the fact that the elements are always pointers to the native buffer handle type, even if the native type itself is a pointer. (so the elements are VkBuffer * on Vulkan, even though VkBuffer itself is a pointer on 64-bit architectures).

int NativeBuffer::slotCount

Specifies the number of valid elements in the objects array.

The value can be 0, 1, 2, or 3 in practice. 0 indicates that the QRhiBuffer is not backed by any native buffer objects. This can happen with QRhiBuffers with the usage UniformBuffer when the underlying API does not support (or the backend chooses not to use) native uniform buffers. 1 is commonly used for Immutable and Static types (but some backends may differ). 2 or 3 is typical when the type is Dynamic (but some backends may differ).

See also QRhi::currentFrameSlot() and QRhi::FramesInFlight.

© 2023 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.