RHI: Implement CreateRenderPass/CreateFramebuffer in D3D12 and OpenGL backends

This commit is contained in:
2026-03-25 13:03:02 +08:00
parent 2313124cc5
commit 41cea4d1a2
4 changed files with 75 additions and 3 deletions

View File

@@ -17,6 +17,7 @@
#include "XCEngine/RHI/OpenGL/OpenGLTextureUnitAllocator.h"
#include "XCEngine/RHI/OpenGL/OpenGLUniformBufferManager.h"
#include "XCEngine/RHI/OpenGL/OpenGLFramebuffer.h"
#include "XCEngine/RHI/OpenGL/OpenGLRenderPass.h"
#include "XCEngine/RHI/OpenGL/OpenGLResourceView.h"
#include "XCEngine/RHI/OpenGL/OpenGLDescriptorPool.h"
#include "XCEngine/RHI/OpenGL/OpenGLDescriptorSet.h"
@@ -418,6 +419,32 @@ RHISampler* OpenGLDevice::CreateSampler(const SamplerDesc& desc) {
return sampler;
}
RHIRenderPass* OpenGLDevice::CreateRenderPass(
uint32_t colorAttachmentCount,
const AttachmentDesc* colorAttachments,
const AttachmentDesc* depthStencilAttachment) {
auto* renderPass = new OpenGLRenderPass();
if (!renderPass->Initialize(colorAttachmentCount, colorAttachments, depthStencilAttachment)) {
delete renderPass;
return nullptr;
}
return renderPass;
}
RHIFramebuffer* OpenGLDevice::CreateFramebuffer(
class RHIRenderPass* renderPass,
uint32_t width, uint32_t height,
uint32_t colorAttachmentCount,
RHIResourceView** colorAttachments,
RHIResourceView* depthStencilAttachment) {
auto* framebuffer = new OpenGLFramebuffer();
if (!framebuffer->Initialize(renderPass, width, height, colorAttachmentCount, colorAttachments, depthStencilAttachment)) {
delete framebuffer;
return nullptr;
}
return framebuffer;
}
RHIDescriptorPool* OpenGLDevice::CreateDescriptorPool(const DescriptorPoolDesc& desc) {
auto* pool = new OpenGLDescriptorPool();
if (pool->Initialize(desc)) {