feat: 修复RHI渲染循环问题

- 修复RootSignature参数数量与HelloEarth一致
- 修复StaticMeshComponent中device为nullptr的问题
- 修复CommandList::Reset类型转换问题
- 修复RTV创建使用nullptr而不是rtvDesc
- 添加SwapChain的GetCurrentRenderTarget方法
- 修复DepthStencil创建问题(暂时跳过)
- 渲染循环基本可运行
This commit is contained in:
2026-03-14 03:13:10 +08:00
parent 5f12393424
commit 3ad317afb2
18 changed files with 271 additions and 17 deletions

View File

@@ -1,4 +1,5 @@
#include <Rendering\StaticMeshComponent.h>
#include <RHI\D3D12\D3D12RHI.h>
#include <RHI\D3D12\D3D12Resources.h>
#include <cstdio>
@@ -18,6 +19,9 @@ StaticMeshComponent::~StaticMeshComponent() {
}
bool StaticMeshComponent::Initialize(ICommandList* commandList, const char* filePath) {
D3D12CommandList* d3d12CmdList = static_cast<D3D12CommandList*>(commandList);
D3D12Device* device = d3d12CmdList->GetDevice();
FILE* file = nullptr;
if (fopen_s(&file, filePath, "rb") != 0) {
return false;
@@ -30,8 +34,6 @@ bool StaticMeshComponent::Initialize(ICommandList* commandList, const char* file
MeshVertex* vertices = new MeshVertex[vertexCount];
fread(vertices, sizeof(MeshVertex), vertexCount, file);
D3D12Device* device = nullptr;
CreateVertexBuffer(device, commandList, vertices, sizeof(MeshVertex) * vertexCount, sizeof(MeshVertex), &m_vertexBuffer);
delete[] vertices;