Fix RHI format conversion and test viewDesc initialization

- Fix CreateTexture to use ToD3D12() for format conversion
- Fix CreateRenderTargetView to use ToD3D12() for format conversion
- Fix CreateDepthStencilView to use ToD3D12() for format conversion
- Fix CreateShaderResourceView to use ToD3D12() for format conversion
- Update test to pass correct format in ResourceViewDesc

These fixes resolve CommandList_ClearDepthStencil_WithRealView test.
Other RTV-related tests still fail with DXGI_ERROR_NOT_CURRENTLY_AVAILABLE
from CreateCommandAllocator - further investigation needed.
This commit is contained in:
2026-03-25 17:43:59 +08:00
parent 295459067f
commit 6612330347
2 changed files with 7 additions and 1 deletions

View File

@@ -537,6 +537,10 @@ RHIResourceView* D3D12Device::CreateRenderTargetView(RHITexture* texture, const
}
RHIResourceView* D3D12Device::CreateDepthStencilView(RHITexture* texture, const ResourceViewDesc& desc) {
{
FILE* f = fopen("D:\\Xuanchi\\Main\\XCEngine\\debug_rhi.log", "a");
if (f) { fprintf(f, "[CreateDepthStencilView] Start, desc.format=%d\n", desc.format); fclose(f); }
}
auto* view = new D3D12ResourceView();
auto* d3d12Texture = static_cast<D3D12Texture*>(texture);
ID3D12Resource* resource = d3d12Texture->GetResource();