- 修复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分类
1.3 KiB
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
线程安全: ❌
注意:
width和height必须大于 0colorAttachments数组长度必须与colorAttachmentCount匹配- 所有附件的尺寸必须与指定的
width、height一致 - 帧缓冲创建后,其尺寸不可更改,需调用
Shutdown后重新初始化
示例:
// 创建带有颜色和深度附件的帧缓冲
RHIResourceView* colorViews[1] = { colorRTView };
RHIResourceView* depthView = depthStencilView;
bool success = framebuffer->Initialize(
renderPass,
1920, 1080,
1, colorViews,
depthView
);