本页内容

DepthStencilAttachment QML Type

定义了RenderPass 的深度-模板附件。更多...

Import Statement: import QtQuick3D
Since: Qt 6.11
Inherits:

Command

详细描述

DepthStencilAttachment 为RenderPass 添加了一个隐式深度/模板渲染缓冲区。该渲染缓冲区由渲染系统自动创建和管理。由于其后端是不透明的渲染缓冲区而非纹理,因此无法在着色器中采样其内容。若需在后续渲染阶段回读深度值,请改用DepthTextureAttachment 。

当您在某个渲染阶段需要深度测试和/或模板操作,但后续无需访问深度数据时,请使用 DepthStencilAttachment。

RenderPass {
    commands: [
        ColorAttachment { name: "color0"; target: colorTexture },
        // Add a depth buffer so depth testing works in this pass
        DepthStencilAttachment {}
    ]
}

另请参阅 DepthTextureAttachment 和RenderPassTexture 。

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