Files
XCEngine/docs/api/rhi/framebuffer/initialize.md
ssdfasd 1cf744b755 refactor(docs): RHI模块文档重构 - 修复18处链接错误并新增RHIFramebuffer/RHIRenderPass文档
- 修复opengl/下13个文件对overview.md的错误引用,改为opengl.md
- 修复opengl/shader/下2处get-native-handle.md的错误路径引用
- 修复rhi.md中rhifactory路径错误
- 修复opengl.md中对d3d12.md的错误引用
- 修复opengl/README.md中的overview.md引用
- 新增RHIFramebuffer完整文档(7个文件)
- 新增RHIRenderPass完整文档(7个文件)
- 更新rhi.md总览页,添加RHIFramebuffer和RHIRenderPass分类
2026-03-26 01:29:00 +08:00

1.3 KiB

RHIFramebuffer::Initialize

初始化帧缓冲对象。

virtual bool Initialize(
    class RHIRenderPass* renderPass,
    uint32_t width,
    uint32_t height,
    uint32_t colorAttachmentCount,
    RHIResourceView** colorAttachments,
    RHIResourceView* depthStencilAttachment
) = 0;

根据指定的渲染通道和附件配置,创建并初始化帧缓冲对象。

参数:

  • renderPass - 关联的渲染通道对象
  • width - 帧缓冲宽度(像素)
  • height - 帧缓冲高度(像素)
  • colorAttachmentCount - 颜色附件数量
  • colorAttachments - 颜色附件资源视图数组
  • depthStencilAttachment - 深度模板附件资源视图,可为 nullptr

返回: bool - 初始化成功返回 true,失败返回 false

线程安全:

注意:

  • widthheight 必须大于 0
  • colorAttachments 数组长度必须与 colorAttachmentCount 匹配
  • 所有附件的尺寸必须与指定的 widthheight 一致
  • 帧缓冲创建后,其尺寸不可更改,需调用 Shutdown 后重新初始化

示例:

// 创建带有颜色和深度附件的帧缓冲
RHIResourceView* colorViews[1] = { colorRTView };
RHIResourceView* depthView = depthStencilView;

bool success = framebuffer->Initialize(
    renderPass,
    1920, 1080,
    1, colorViews,
    depthView
);