Files
XCEngine/docs/api/XCEngine/RHI/OpenGL/OpenGLRenderPass/GetDepthStencilAttachment.md

916 B

OpenGLRenderPass::GetDepthStencilAttachment

const AttachmentDesc* GetDepthStencilAttachment() const override;

作用

返回深度/模板附件的描述信息。

返回值

  • 如果初始化时提供了 depthStencilAttachment,返回内部保存对象的地址。
  • 如果没有深度/模板附件,返回 nullptr

当前实现行为

  • 返回值受 m_hasDepthStencil 控制,而不是根据格式字段动态推断。
  • Initialize() 会复制一份 AttachmentDesc,因此不依赖外部描述结构体的存活时间。
  • Shutdown() 会把 m_hasDepthStencil 复位为 false,之后该方法重新返回 nullptr

使用建议

  • 使用前应始终判空。
  • 当前 OpenGL 后端主要把这里的 loadOp / stencilLoadOp 用于 BeginRenderPass() 的清除逻辑。

相关文档