feat: 修复RHI渲染循环问题
- 修复RootSignature参数数量与HelloEarth一致 - 修复StaticMeshComponent中device为nullptr的问题 - 修复CommandList::Reset类型转换问题 - 修复RTV创建使用nullptr而不是rtvDesc - 添加SwapChain的GetCurrentRenderTarget方法 - 修复DepthStencil创建问题(暂时跳过) - 渲染循环基本可运行
This commit is contained in:
@@ -437,6 +437,18 @@ void* D3D12SwapChain::GetBuffer(uint32_t index) {
|
||||
return GetBufferResource(index);
|
||||
}
|
||||
|
||||
void* D3D12SwapChain::GetCurrentRenderTarget() {
|
||||
uint32_t index = GetCurrentBufferIndex();
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE handle = m_rtvHeap->GetNativeHeap()->GetCPUDescriptorHandleForHeapStart();
|
||||
UINT rtvSize = m_device->GetD3D12Device()->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
|
||||
handle.ptr += index * rtvSize;
|
||||
return (void*)handle.ptr;
|
||||
}
|
||||
|
||||
void* D3D12SwapChain::GetDepthStencil() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void D3D12SwapChain::SetFullscreen(bool fullscreen) {
|
||||
m_fullscreen = fullscreen;
|
||||
m_swapChain->SetFullscreenState(fullscreen, nullptr);
|
||||
@@ -660,7 +672,9 @@ D3D12CommandList::~D3D12CommandList() {
|
||||
}
|
||||
|
||||
void D3D12CommandList::Reset(void* allocator) {
|
||||
ID3D12CommandAllocator* d3dAllocator = static_cast<ID3D12CommandAllocator*>(allocator);
|
||||
ICommandAllocator* cmdAlloc = static_cast<ICommandAllocator*>(allocator);
|
||||
D3D12CommandAllocator* d3d12Alloc = static_cast<D3D12CommandAllocator*>(cmdAlloc);
|
||||
ID3D12CommandAllocator* d3dAllocator = d3d12Alloc->GetNativeAllocator();
|
||||
m_commandList->Reset(d3dAllocator, nullptr);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user