- Qt 6.11
- Qt Quick 3D
- QML Types
- DepthStencilAttachment
- Qt Quick 3D | Commercial or GPLv3

# DepthStencilAttachment QML Type

Defines a depth-stencil attachment for a RenderPass. More...

Import Statement: | `import QtQuick3D`
Since: | Qt 6.11
Inherits: | Command

- List of all members, including inherited members

## Detailed Description

DepthStencilAttachment adds an implicit depth/stencil render buffer to a RenderPass. The render buffer is automatically created and managed by the rendering system. Because it is backed by an opaque render buffer rather than a texture, its contents cannot be sampled in shaders. If you need to read back depth values in a later pass, use DepthTextureAttachment instead.

Use DepthStencilAttachment when you need depth testing and/or stencil operations in a pass but do not need to access the depth data afterwards.

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

See also DepthTextureAttachment and RenderPassTexture.